summaryrefslogtreecommitdiff
path: root/altosui/AltosConfigTDUI.java
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2014-07-04 23:38:53 -0700
committerKeith Packard <keithp@keithp.com>2014-07-05 00:38:09 -0700
commit98c3c3f7edd58358939f7dacf5b8f4c336712f5b (patch)
tree8580e11d93fb6f7c777ef175f1baf4dfdb14c4d7 /altosui/AltosConfigTDUI.java
parent505c6a1f8b8d68fe6f74dcb4428c860157fae3de (diff)
altosui/telegps: Undo the frequency/telemetry menu changes
Using menus for these items isn't what we want; we want to show the current value on the screen, which is what a combo box is for. Switch back to those and remove the frequency and telemetry config from the TeleGPS menu bar so that Mac OS X is happy. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altosui/AltosConfigTDUI.java')
-rw-r--r--altosui/AltosConfigTDUI.java33
1 files changed, 25 insertions, 8 deletions
diff --git a/altosui/AltosConfigTDUI.java b/altosui/AltosConfigTDUI.java
index ca365718..947d78ee 100644
--- a/altosui/AltosConfigTDUI.java
+++ b/altosui/AltosConfigTDUI.java
@@ -44,8 +44,7 @@ public class AltosConfigTDUI
JLabel product_value;
JLabel version_value;
JLabel serial_value;
- JMenuBar radio_frequency_menu_bar;
- AltosFreqList radio_frequency_value;
+ AltosUIFreqList radio_frequency_value;
JLabel radio_calibration_value;
JButton save;
@@ -55,7 +54,6 @@ public class AltosConfigTDUI
ActionListener listener;
-
/* A window listener to catch closing events and tell the config code */
class ConfigListener extends WindowAdapter {
AltosConfigTDUI ui;
@@ -167,11 +165,9 @@ public class AltosConfigTDUI
c.anchor = GridBagConstraints.LINE_START;
c.insets = ir;
c.ipady = 5;
- radio_frequency_value = new AltosFreqList(false);
+ radio_frequency_value = new AltosUIFreqList();
radio_frequency_value.addItemListener(this);
- radio_frequency_menu_bar = new JMenuBar();
- radio_frequency_menu_bar.add(radio_frequency_value);
- pane.add(radio_frequency_menu_bar, c);
+ pane.add(radio_frequency_value, c);
radio_frequency_value.setToolTipText("Telemetry, RDF and packet frequency");
/* Radio Calibration */
@@ -311,7 +307,28 @@ public class AltosConfigTDUI
}
public void set_radio_frequency(double new_radio_frequency) {
- radio_frequency_value.set_frequency(new_radio_frequency);
+ int i;
+ for (i = 0; i < radio_frequency_value.getItemCount(); i++) {
+ AltosFrequency f = (AltosFrequency) radio_frequency_value.getItemAt(i);
+
+ if (f.close(new_radio_frequency)) {
+ radio_frequency_value.setSelectedIndex(i);
+ return;
+ }
+ }
+ for (i = 0; i < radio_frequency_value.getItemCount(); i++) {
+ AltosFrequency f = (AltosFrequency) radio_frequency_value.getItemAt(i);
+
+ if (new_radio_frequency < f.frequency)
+ break;
+ }
+ String description = String.format("%s serial %s",
+ product_value.getText(),
+ serial_value.getText());
+ AltosFrequency new_frequency = new AltosFrequency(new_radio_frequency, description);
+ AltosPreferences.add_common_frequency(new_frequency);
+ radio_frequency_value.insertItemAt(new_frequency, i);
+ radio_frequency_value.setSelectedIndex(i);
}
public double radio_frequency() {