From: Keith Packard Date: Wed, 25 Jun 2014 03:52:34 +0000 (-0700) Subject: altosui: Don't show the tracker motion value when switching units X-Git-Tag: 1.4.9.1~27 X-Git-Url: https://git.gag.com/?a=commitdiff_plain;ds=inline;h=7427f8bac7b3743ce0ab990612bf7168b95e22f9;p=fw%2Faltos altosui: Don't show the tracker motion value when switching units The tracker value was left enabled when hidden; the logic for deciding whether to update it with new information used only the enabled state, not the visible state. Set both states when hiding it to keep things more consistent Signed-off-by: Keith Packard --- diff --git a/altosui/AltosConfigUI.java b/altosui/AltosConfigUI.java index 6e1b47c2..de1b582e 100644 --- a/altosui/AltosConfigUI.java +++ b/altosui/AltosConfigUI.java @@ -925,6 +925,8 @@ public class AltosConfigUI } public void units_changed(boolean imperial_units) { + boolean was_dirty = dirty; + String v = main_deploy_value.getSelectedItem().toString(); main_deploy_label.setText(get_main_deploy_label()); set_main_deploy_values(); @@ -937,6 +939,9 @@ public class AltosConfigUI set_tracker_motion_values(); set_tracker_motion((int) (AltosConvert.height.parse(motion, !imperial_units) + 0.5)); } + + if (!was_dirty) + set_clean(); } public void set_apogee_delay(int new_apogee_delay) { @@ -1151,9 +1156,11 @@ public class AltosConfigUI if (tracker_motion < 0) { tracker_motion_label.setVisible(false); tracker_motion_value.setVisible(false); + tracker_motion_value.setEnabled(false); } else { tracker_motion_label.setVisible(true); tracker_motion_value.setVisible(true); + tracker_motion_value.setEnabled(true); tracker_motion_value.setSelectedItem(AltosConvert.height.say(tracker_motion)); } } @@ -1166,9 +1173,11 @@ public class AltosConfigUI if (tracker_interval< 0) { tracker_interval_label.setVisible(false); tracker_interval_value.setVisible(false); + tracker_interval_value.setEnabled(false); } else { tracker_interval_label.setVisible(true); tracker_interval_value.setVisible(true); + tracker_interval_value.setEnabled(true); tracker_interval_value.setSelectedItem(String.format("%d", tracker_interval)); } }