Skip to content

Commit

Permalink
Common: change knots to kts
Browse files Browse the repository at this point in the history
  • Loading branch information
meee1 committed Feb 18, 2018
1 parent a6c54eb commit d5aae7a
Show file tree
Hide file tree
Showing 6 changed files with 259 additions and 150 deletions.
6 changes: 6 additions & 0 deletions Common.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ public class Common
{
private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);

public enum altitudes
{
Meters,
Feet
}

public enum distances
{
Meters,
Expand Down
8 changes: 5 additions & 3 deletions CurrentState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ public class CurrentState : ICloneable
public static string DistanceUnit = "";
public static float multiplierspeed = 1;
public static string SpeedUnit = "";
public static float multiplieralt = 1;
public static string AltUnit = "";

public static double toDistDisplayUnit(double input)
{
Expand Down Expand Up @@ -116,7 +118,7 @@ public float groundcourse
[DisplayText("Altitude (dist)")]
public float alt
{
get { return (_alt - altoffsethome)*multiplierdist; }
get { return (_alt - altoffsethome)* multiplieralt; }
set
{
// check update rate, and ensure time hasnt gone backwards
Expand All @@ -139,7 +141,7 @@ public float alt
[DisplayText("Altitude (dist)")]
public float altasl
{
get { return _altasl*multiplierdist; }
get { return _altasl* multiplieralt; }
set { _altasl = value; }
}

Expand Down Expand Up @@ -535,7 +537,7 @@ public float wp_dist
[DisplayText("Altitude Error (dist)")]
public float alt_error
{
get { return _alt_error*multiplierdist; }
get { return _alt_error* multiplieralt; }
set
{
if (_alt_error == value) return;
Expand Down
19 changes: 19 additions & 0 deletions GCSViews/ConfigurationView/ConfigPlanner.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions GCSViews/ConfigurationView/ConfigPlanner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public void Activate()
// set distance/speed unit states
CMB_distunits.DataSource = Enum.GetNames(typeof (Common.distances));
CMB_speedunits.DataSource = Enum.GetNames(typeof (Common.speeds));
CMB_altunits.DataSource = Enum.GetNames(typeof(Common.altitudes));

CMB_theme.DataSource = Enum.GetNames(typeof (ThemeManager.Themes));

Expand Down Expand Up @@ -930,5 +931,13 @@ private void chk_shownofly_CheckedChanged(object sender, EventArgs e)
{
Settings.Instance["ShowNoFly"] = chk_shownofly.Checked.ToString();
}

private void CMB_altunits_SelectedIndexChanged(object sender, EventArgs e)
{
if (startup)
return;
Settings.Instance["altunits"] = CMB_altunits.Text;
MainV2.instance.ChangeUnits();
}
}
}
Loading

0 comments on commit d5aae7a

Please sign in to comment.