X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=altosui%2FAltosFlightUI.java;h=2e192c730412e03f6cf0b16ac8da616fdace44ab;hp=43deb631705f86abc30dd5f072570daeb6e3a7ba;hb=e612693e33ef3b0e22db0656792992fa6e961ff2;hpb=6579e4cae8fea65780f1c4677f29c1fc17ca41e2 diff --git a/altosui/AltosFlightUI.java b/altosui/AltosFlightUI.java index 43deb631..2e192c73 100644 --- a/altosui/AltosFlightUI.java +++ b/altosui/AltosFlightUI.java @@ -170,13 +170,17 @@ public class AltosFlightUI extends AltosUIFrame implements AltosFlightDisplay { } Container bag; - AltosFreqList frequencies; - JComboBox telemetries; - JLabel telemetry; + + JMenuBar menu_bar; + AltosFreqList frequencies; + AltosUITelemetryMenu 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(); @@ -193,6 +197,10 @@ 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)); frequencies.set_product("Monitor"); @@ -208,43 +216,19 @@ public class AltosFlightUI extends AltosUIFrame implements AltosFlightDisplay { reader.save_frequency(); } }); - 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); + menu_bar.add (frequencies); // Telemetry format menu - if (reader.supports_telemetry(Altos.ao_telemetry_standard)) { - telemetries = new JComboBox(); - 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(); + if (reader.supports_telemetry(AltosLib.ao_telemetry_standard)) { + telemetries = new AltosUITelemetryMenu(serial); telemetries.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - int telemetry = telemetries.getSelectedIndex() + 1; + int telemetry = telemetries.get_selected(); reader.set_telemetry(telemetry); reader.save_telemetry(); } }); - 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); + menu_bar.add(telemetries); } else { String version; @@ -256,14 +240,7 @@ public class AltosFlightUI extends AltosUIFrame implements AltosFlightDisplay { version = "Telemetry: None"; telemetry = new JLabel(version); - 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); + menu_bar.add(telemetry); } }