summaryrefslogtreecommitdiff
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
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>
-rw-r--r--altosui/AltosConfigTDUI.java33
-rw-r--r--altosui/AltosConfigUI.java9
-rw-r--r--altosui/AltosFlightUI.java65
-rw-r--r--altosui/AltosIdleMonitorUI.java4
-rw-r--r--altosuilib/AltosFreqList.java206
-rw-r--r--altosuilib/AltosUIFreqList.java85
-rw-r--r--altosuilib/AltosUITelemetryList.java47
-rw-r--r--altosuilib/AltosUITelemetryMenu.java88
-rw-r--r--altosuilib/Makefile.am4
-rw-r--r--telegps/TeleGPS.java28
-rw-r--r--telegps/TeleGPSConfigUI.java10
11 files changed, 229 insertions, 350 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() {
diff --git a/altosui/AltosConfigUI.java b/altosui/AltosConfigUI.java
index de1b582e..91c37fd5 100644
--- a/altosui/AltosConfigUI.java
+++ b/altosui/AltosConfigUI.java
@@ -59,7 +59,7 @@ public class AltosConfigUI
JComboBox<String> main_deploy_value;
JComboBox<String> apogee_delay_value;
JComboBox<String> apogee_lockout_value;
- AltosFreqList radio_frequency_value;
+ AltosUIFreqList radio_frequency_value;
JTextField radio_calibration_value;
JRadioButton radio_enable_value;
JComboBox<String> aprs_interval_value;
@@ -432,12 +432,9 @@ public class AltosConfigUI
c.anchor = GridBagConstraints.LINE_START;
c.insets = ir;
c.ipady = 5;
- radio_frequency_value = new AltosFreqList();
+ radio_frequency_value = new AltosUIFreqList();
radio_frequency_value.addItemListener(this);
-
- JMenuBar menu_bar = new JMenuBar();
- menu_bar.add(radio_frequency_value);
- pane.add(menu_bar, c);
+ pane.add(radio_frequency_value, c);
radio_frequency_value.setToolTipText("Telemetry, RDF and packet frequency");
row++;
diff --git a/altosui/AltosFlightUI.java b/altosui/AltosFlightUI.java
index 5aff1817..5db0ee92 100644
--- a/altosui/AltosFlightUI.java
+++ b/altosui/AltosFlightUI.java
@@ -169,18 +169,14 @@ public class AltosFlightUI extends AltosUIFrame implements AltosFlightDisplay {
exit_on_close = true;
}
- Container bag;
-
- JMenuBar menu_bar;
- AltosFreqList frequencies;
- AltosUITelemetryMenu telemetries;
+ Container bag;
+ AltosUIFreqList frequencies;
+ AltosUITelemetryList telemetries;
JLabel telemetry;
ActionListener show_timer;
public AltosFlightUI(AltosVoice in_voice, AltosFlightReader in_reader, final int serial) {
- super();
-
AltosUIPreferences.set_component(this);
displays = new LinkedList<AltosFlightDisplay>();
@@ -197,12 +193,8 @@ public class AltosFlightUI extends AltosUIFrame implements AltosFlightDisplay {
/* Stick channel selector at top of table for telemetry monitoring */
if (serial >= 0) {
-
- menu_bar = new JMenuBar();
- setJMenuBar(menu_bar);
-
- // Channel menu
- frequencies = new AltosFreqList(AltosUIPreferences.frequency(serial));
+ // Frequency menu
+ frequencies = new AltosUIFreqList(AltosUIPreferences.frequency(serial));
frequencies.set_product("Monitor");
frequencies.set_serial(serial);
frequencies.addActionListener(new ActionListener() {
@@ -216,19 +208,43 @@ public class AltosFlightUI extends AltosUIFrame implements AltosFlightDisplay {
reader.save_frequency();
}
});
- menu_bar.add (frequencies);
-
- // Telemetry format menu
- if (reader.supports_telemetry(AltosLib.ao_telemetry_standard)) {
- telemetries = new AltosUITelemetryMenu(serial);
+ c.gridx = 0;
+ c.gridy = 0;
+ c.weightx = 0;
+ c.weighty = 0;
+ c.insets = new Insets(3, 3, 3, 3);
+ c.fill = GridBagConstraints.NONE;
+ c.anchor = GridBagConstraints.WEST;
+ bag.add (frequencies, c);
+
+ // Telemetry format list
+ if (reader.supports_telemetry(Altos.ao_telemetry_standard)) {
+ telemetries = new JComboBox<String>();
+ for (int i = 1; i <= Altos.ao_telemetry_max; i++)
+ telemetries.addItem(Altos.telemetry_name(i));
+ int telemetry = AltosPreferences.telemetry(serial);
+ if (telemetry <= Altos.ao_telemetry_off ||
+ telemetry > Altos.ao_telemetry_max)
+ telemetry = Altos.ao_telemetry_standard;
+ telemetries.setSelectedIndex(telemetry - 1);
+ telemetries.setMaximumRowCount(Altos.ao_telemetry_max);
+ telemetries.setPreferredSize(null);
+ telemetries.revalidate();
telemetries.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
- int telemetry = telemetries.get_selected();
+ int telemetry = telemetries.getSelectedIndex() + 1;
reader.set_telemetry(telemetry);
reader.save_telemetry();
}
});
- menu_bar.add(telemetries);
+ c.gridx = 1;
+ c.gridy = 0;
+ c.weightx = 0;
+ c.weighty = 0;
+ c.fill = GridBagConstraints.NONE;
+ c.anchor = GridBagConstraints.WEST;
+ bag.add (telemetries, c);
+ c.insets = new Insets(0, 0, 0, 0);
} else {
String version;
@@ -240,7 +256,14 @@ public class AltosFlightUI extends AltosUIFrame implements AltosFlightDisplay {
version = "Telemetry: None";
telemetry = new JLabel(version);
- menu_bar.add(telemetry);
+ c.gridx = 1;
+ c.gridy = 0;
+ c.weightx = 0;
+ c.weighty = 0;
+ c.fill = GridBagConstraints.NONE;
+ c.anchor = GridBagConstraints.WEST;
+ bag.add (telemetry, c);
+ c.insets = new Insets(0, 0, 0, 0);
}
}
diff --git a/altosui/AltosIdleMonitorUI.java b/altosui/AltosIdleMonitorUI.java
index 63d86291..67b7a989 100644
--- a/altosui/AltosIdleMonitorUI.java
+++ b/altosui/AltosIdleMonitorUI.java
@@ -103,7 +103,7 @@ public class AltosIdleMonitorUI extends AltosUIFrame implements AltosFlightDispl
}
Container bag;
- AltosFreqList frequencies;
+ AltosUIFreqList frequencies;
JTextField callsign_value;
/* DocumentListener interface methods */
@@ -200,7 +200,7 @@ public class AltosIdleMonitorUI extends AltosUIFrame implements AltosFlightDispl
/* Stick frequency selector at top of table for telemetry monitoring */
if (remote && serial >= 0) {
// Frequency menu
- frequencies = new AltosFreqList(AltosUIPreferences.frequency(serial));
+ frequencies = new AltosUIFreqList(AltosUIPreferences.frequency(serial));
frequencies.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
double frequency = frequencies.frequency();
diff --git a/altosuilib/AltosFreqList.java b/altosuilib/AltosFreqList.java
deleted file mode 100644
index 293ce032..00000000
--- a/altosuilib/AltosFreqList.java
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * Copyright © 2011 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-package org.altusmetrum.altosuilib_3;
-
-import java.util.*;
-import javax.swing.*;
-import java.awt.event.*;
-import org.altusmetrum.altoslib_5.*;
-
-class FreqEntry extends JMenuItem {
- AltosFrequency frequency;
-
- public FreqEntry(AltosFrequency frequency) {
- super(frequency.toShortString());
- this.frequency = frequency;
- }
-}
-
-public class AltosFreqList extends JMenu implements ActionListener {
-
- String product;
- int serial;
- int calibrate;
-
- AltosFrequency[] frequencies = new AltosFrequency[0];
-
- int selected = -1;
-
- LinkedList<ActionListener> action_listeners = new LinkedList<ActionListener>();
-
- public void addActionListener(ActionListener listener) {
- action_listeners.add(listener);
- }
-
- public void removeActionListener(ActionListener listener) {
- action_listeners.remove(listener);
- }
-
- public void actionPerformed(ActionEvent ev) {
- FreqEntry e = (FreqEntry) ev.getSource();
- set_selected(e.frequency);
- ActionEvent event = new ActionEvent(e.frequency, 0, "selected");
- for (ActionListener l : action_listeners)
- l.actionPerformed(event);
- }
-
- boolean label = true;
-
- public void set_label(boolean label) {
- this.label = label;
- set_label();
- }
-
- private void set_label() {
- String new_text = "";
- if (0 <= selected && selected < frequencies.length) {
- AltosFrequency frequency = frequencies[selected];
- new_text = String.format("%s%7.3f MHz (%s) ▾",
- label ? "Frequency: " : "",
- frequency.frequency,
- frequency.description);
- }
- setText(new_text);
- }
-
- private void set_selected(AltosFrequency frequency) {
- for (int i = 0; i < frequencies.length; i++) {
- if (frequencies[i].frequency == frequency.frequency) {
- selected = i;
- set_label();
- }
- }
- }
-
- private AltosFrequency get_selected() {
- if (0 <= selected && selected < frequencies.length)
- return frequencies[selected];
- return null;
- }
-
- private void add(AltosFrequency add) {
- int insert;
-
- for (insert = 0; insert < frequencies.length; insert++) {
- if (frequencies[insert].frequency == add.frequency)
- return;
- if (add.frequency < frequencies[insert].frequency)
- break;
- }
-
- AltosFrequency[] new_frequencies = new AltosFrequency[frequencies.length + 1];
-
- for (int before = 0; before < insert; before++)
- new_frequencies[before] = frequencies[before];
- new_frequencies[insert] = add;
-
- for (int after = insert; after < frequencies.length; after++)
- new_frequencies[after+1] = frequencies[after];
-
- frequencies = new_frequencies;
-
- FreqEntry e = new FreqEntry(add);
- add(e, insert);
- e.addActionListener(this);
- }
-
- private void remove(AltosFrequency remove) {
- int delete;
- for (delete = 0; delete < frequencies.length; delete++) {
- if (frequencies[delete].frequency == remove.frequency)
- break;
- if (remove.frequency < frequencies[delete].frequency)
- return;
- }
-
- remove(delete);
-
- AltosFrequency[] new_frequencies = new AltosFrequency[frequencies.length - 1];
-
- for (int before = 0; before < delete; before++)
- new_frequencies[before] = frequencies[before];
-
- for (int after = delete + 1; after < frequencies.length; after++)
- new_frequencies[after-1] = frequencies[after];
- frequencies = new_frequencies;
- }
-
- public void set_frequency(double new_frequency) {
- int i;
-
- if (new_frequency < 0) {
- setVisible(false);
- return;
- }
-
- for (i = 0; i < frequencies.length; i++) {
- AltosFrequency f = frequencies[i];
-
- if (f.close(new_frequency)) {
- set_selected(f);
- return;
- }
- }
-
- String description = String.format("%s serial %d", product, serial);
- AltosFrequency frequency = new AltosFrequency(new_frequency, description);
- AltosUIPreferences.add_common_frequency(frequency);
-
- add(frequency);
- set_selected(frequency);
- }
-
- public void set_product(String new_product) {
- product = new_product;
- }
-
- public void set_serial(int new_serial) {
- serial = new_serial;
- }
-
- public double frequency() {
- AltosFrequency f = get_selected();
- if (f != null)
- return f.frequency;
- return 434.550;
- }
-
- public AltosFreqList(double in_frequency, boolean label) {
- super();
- this.label = label;
-
- for (AltosFrequency frequency: AltosUIPreferences.common_frequencies())
- add(frequency);
- product = "Unknown";
- serial = 0;
-
- if (in_frequency != 0)
- set_frequency(in_frequency);
- }
- public AltosFreqList(double in_frequency) {
- this(in_frequency, true);
- }
-
- public AltosFreqList (boolean label) {
- this(0, label);
- }
-
- public AltosFreqList () {
- this(0, true);
- }
-}
diff --git a/altosuilib/AltosUIFreqList.java b/altosuilib/AltosUIFreqList.java
new file mode 100644
index 00000000..f1f83dd5
--- /dev/null
+++ b/altosuilib/AltosUIFreqList.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright © 2011 Keith Packard <keithp@keithp.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+
+package org.altusmetrum.altosuilib_3;
+
+import javax.swing.*;
+import org.altusmetrum.altoslib_5.*;
+
+public class AltosUIFreqList extends JComboBox<AltosFrequency> {
+
+ String product;
+ int serial;
+ int calibrate;
+
+ public void set_frequency(double new_frequency) {
+ int i;
+
+ if (new_frequency < 0) {
+ setVisible(false);
+ return;
+ }
+
+ for (i = 0; i < getItemCount(); i++) {
+ AltosFrequency f = (AltosFrequency) getItemAt(i);
+
+ if (f.close(new_frequency)) {
+ setSelectedIndex(i);
+ return;
+ }
+ }
+ for (i = 0; i < getItemCount(); i++) {
+ AltosFrequency f = (AltosFrequency) getItemAt(i);
+
+ if (new_frequency < f.frequency)
+ break;
+ }
+ String description = String.format("%s serial %d", product, serial);
+ AltosFrequency frequency = new AltosFrequency(new_frequency, description);
+ AltosUIPreferences.add_common_frequency(frequency);
+ insertItemAt(frequency, i);
+ setMaximumRowCount(getItemCount());
+ }
+
+ public void set_product(String new_product) {
+ product = new_product;
+ }
+
+ public void set_serial(int new_serial) {
+ serial = new_serial;
+ }
+
+ public double frequency() {
+ AltosFrequency f = (AltosFrequency) getSelectedItem();
+ if (f != null)
+ return f.frequency;
+ return 434.550;
+ }
+
+ public AltosUIFreqList () {
+ super(AltosUIPreferences.common_frequencies());
+ setMaximumRowCount(getItemCount());
+ setEditable(false);
+ product = "Unknown";
+ serial = 0;
+ }
+
+ public AltosUIFreqList(double in_frequency) {
+ this();
+ set_frequency(in_frequency);
+ }
+}
diff --git a/altosuilib/AltosUITelemetryList.java b/altosuilib/AltosUITelemetryList.java
new file mode 100644
index 00000000..facfdcde
--- /dev/null
+++ b/altosuilib/AltosUITelemetryList.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright © 2014 Keith Packard <keithp@keithp.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+
+package org.altusmetrum.altosuilib_3;
+
+import java.util.*;
+import javax.swing.*;
+import org.altusmetrum.altoslib_5.*;
+
+
+public class AltosUITelemetryList extends JComboBox<String> {
+ public int get_selected() {
+ return getSelectedIndex() + 1;
+ }
+
+ public void set_selected(int telemetry) {
+ setSelectedIndex(telemetry-1);
+ }
+
+ public AltosUITelemetryList(int serial) {
+ super();
+ for (int i = AltosLib.ao_telemetry_min; i <= AltosLib.ao_telemetry_max; i++)
+ addItem(AltosLib.telemetry_name(i));
+
+ int telemetry = AltosPreferences.telemetry(serial);
+ if (telemetry < AltosLib.ao_telemetry_min || AltosLib.ao_telemetry_max < telemetry)
+ telemetry = AltosLib.ao_telemetry_standard;
+ setMaximumRowCount(AltosLib.ao_telemetry_max);
+ set_selected(telemetry);
+ revalidate();
+ }
+}
+
diff --git a/altosuilib/AltosUITelemetryMenu.java b/altosuilib/AltosUITelemetryMenu.java
deleted file mode 100644
index 893c3c44..00000000
--- a/altosuilib/AltosUITelemetryMenu.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright © 2014 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-package org.altusmetrum.altosuilib_3;
-
-import java.util.*;
-import javax.swing.*;
-import java.awt.event.*;
-import org.altusmetrum.altoslib_5.*;
-
-class TelemetryMenuItem extends JMenuItem {
- public int telemetry;
-
- public TelemetryMenuItem (int telemetry) {
- super(AltosLib.telemetry_name(telemetry));
- this.telemetry = telemetry;
- }
-}
-
-public class AltosUITelemetryMenu extends JMenu implements ActionListener {
- TelemetryMenuItem selected = null;
-
- public int get_selected() {
- if (selected == null)
- return AltosLib.ao_telemetry_off;
- return selected.telemetry;
- }
-
- public void set_selected(int telemetry) {
- for (int i = 0; i < getItemCount(); i++) {
- TelemetryMenuItem item = (TelemetryMenuItem) getItem(i);
- if (item.telemetry == telemetry) {
- selected = item;
- String new_text = String.format("Format: %s ▾", AltosLib.telemetry_name(telemetry));
- setText(new_text);
- break;
- }
- }
- }
-
- private LinkedList<ActionListener> action_listeners = new LinkedList<ActionListener>();
-
- public void addActionListener(ActionListener l) {
- action_listeners.add(l);
- }
-
- public void removeActionListener(ActionListener l) {
- action_listeners.remove(l);
- }
-
- public void actionPerformed(ActionEvent e) {
- TelemetryMenuItem item = (TelemetryMenuItem) e.getSource();
- set_selected(item.telemetry);
- ActionEvent my_e = new ActionEvent(selected, 0, "selected");
- for (ActionListener l : action_listeners)
- l.actionPerformed(my_e);
- }
-
- public AltosUITelemetryMenu(int serial) {
- super();
- for (int i = AltosLib.ao_telemetry_min; i <= AltosLib.ao_telemetry_max; i++) {
- TelemetryMenuItem item = new TelemetryMenuItem(i);
-
- item.addActionListener(this);
- add(item);
- }
-
- int telemetry = AltosPreferences.telemetry(serial);
- if (telemetry < AltosLib.ao_telemetry_min || AltosLib.ao_telemetry_max < telemetry)
- telemetry = AltosLib.ao_telemetry_standard;
- set_selected(telemetry);
- }
-}
-
diff --git a/altosuilib/Makefile.am b/altosuilib/Makefile.am
index 56b01ec5..40e6dda5 100644
--- a/altosuilib/Makefile.am
+++ b/altosuilib/Makefile.am
@@ -36,7 +36,6 @@ altosuilib_JAVA = \
AltosVoice.java \
AltosDisplayThread.java \
AltosDeviceUIDialog.java \
- AltosFreqList.java \
AltosSerial.java \
AltosSerialInUseException.java \
AltosConfigFreqUI.java \
@@ -82,7 +81,8 @@ altosuilib_JAVA = \
AltosUIIndicator.java \
AltosUIUnitsIndicator.java \
AltosUIVoltageIndicator.java \
- AltosUITelemetryMenu.java \
+ AltosUIFreqList.java \
+ AltosUITelemetryList.java \
OSXAdapter.java
JAR=altosuilib_$(ALTOSUILIB_VERSION).jar
diff --git a/telegps/TeleGPS.java b/telegps/TeleGPS.java
index e78c2124..7e5ff42a 100644
--- a/telegps/TeleGPS.java
+++ b/telegps/TeleGPS.java
@@ -58,7 +58,7 @@ public class TeleGPS
JMenu file_menu;
JMenu monitor_menu;
JMenu device_menu;
- AltosFreqList frequencies;
+ AltosUIFreqList frequencies;
ActionListener frequency_listener;
Container bag;
@@ -351,18 +351,17 @@ public class TeleGPS
frequencies.set_product("Monitor");
frequencies.set_serial(serial);
frequencies.set_frequency(AltosUIPreferences.frequency(serial));
+ frequencies.setEnabled(true);
- menu_bar.add(frequencies);
- menu_bar.repaint();
}
void disable_frequency_menu() {
- if (frequency_listener == null)
- return;
- frequencies.removeActionListener(frequency_listener);
- menu_bar.remove(frequencies);
- menu_bar.repaint();
- frequency_listener = null;
+ if (frequency_listener != null) {
+ frequencies.removeActionListener(frequency_listener);
+ frequencies.setEnabled(false);
+ frequency_listener = null;
+ }
+
}
public void set_reader(AltosFlightReader reader, AltosDevice device) {
@@ -457,7 +456,16 @@ public class TeleGPS
file_menu = make_menu("File", file_menu_entries);
monitor_menu = make_menu("Monitor", monitor_menu_entries);
device_menu = make_menu("Device", device_menu_entries);
- frequencies = new AltosFreqList();
+
+ frequencies = new AltosUIFreqList();
+ frequencies.setEnabled(false);
+ c.gridx = 0;
+ c.gridy = 0;
+ c.fill = GridBagConstraints.NONE;
+ c.anchor = GridBagConstraints.WEST;
+ c.weightx = 0;
+ c.gridwidth = 1;
+ bag.add(frequencies, c);
displays = new LinkedList<AltosFlightDisplay>();
diff --git a/telegps/TeleGPSConfigUI.java b/telegps/TeleGPSConfigUI.java
index ee2fbd2d..e5ac6d7e 100644
--- a/telegps/TeleGPSConfigUI.java
+++ b/telegps/TeleGPSConfigUI.java
@@ -50,7 +50,7 @@ public class TeleGPSConfigUI
JLabel product_value;
JLabel version_value;
JLabel serial_value;
- AltosFreqList radio_frequency_value;
+ AltosUIFreqList radio_frequency_value;
JTextField radio_calibration_value;
JRadioButton radio_enable_value;
JComboBox<String> aprs_interval_value;
@@ -270,13 +270,9 @@ public class TeleGPSConfigUI
c.anchor = GridBagConstraints.LINE_START;
c.insets = ir;
c.ipady = 5;
- radio_frequency_value = new AltosFreqList();
+ radio_frequency_value = new AltosUIFreqList();
radio_frequency_value.addItemListener(this);
-
- JMenuBar menu_bar = new JMenuBar();
- menu_bar.add(radio_frequency_value);
-
- pane.add(menu_bar, c);
+ pane.add(radio_frequency_value, c);
radio_frequency_value.setToolTipText("Telemetry, RDF and packet frequency");
row++;