X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=altosui%2FAltosFlightUI.java;h=8c3f821e6c96db559153196a5bcb1e5bcb8bf813;hb=81bb6f42d8b859195ea5a35806c42d98ba82e8e1;hp=68e0ef874fe7363928898352f35f2d0d5151715d;hpb=f3e68341f6f5daaf26dd162e4f9a06c29988986a;p=fw%2Faltos diff --git a/altosui/AltosFlightUI.java b/altosui/AltosFlightUI.java index 68e0ef87..8c3f821e 100644 --- a/altosui/AltosFlightUI.java +++ b/altosui/AltosFlightUI.java @@ -26,7 +26,7 @@ import java.io.*; import java.util.*; import java.text.*; import java.util.prefs.*; -import java.util.concurrent.LinkedBlockingQueue; +import java.util.concurrent.*; public class AltosFlightUI extends JFrame implements AltosFlightDisplay { AltosVoice voice; @@ -118,10 +118,11 @@ public class AltosFlightUI extends JFrame implements AltosFlightDisplay { } Container bag; - JComboBox channels; + AltosFreqList frequencies; + JComboBox telemetries; public AltosFlightUI(AltosVoice in_voice, AltosFlightReader in_reader, final int serial) { - AltosPreferences.init(this); + AltosPreferences.set_component(this); voice = in_voice; reader = in_reader; @@ -140,17 +141,49 @@ public class AltosFlightUI extends JFrame implements AltosFlightDisplay { /* Stick channel selector at top of table for telemetry monitoring */ if (serial >= 0) { // Channel menu - channels = new AltosChannelMenu(AltosPreferences.channel(serial)); - channels.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - int channel = channels.getSelectedIndex(); - reader.set_channel(channel); - } + frequencies = new AltosFreqList(AltosPreferences.frequency(serial)); + frequencies.set_product("Monitor"); + frequencies.set_serial(serial); + frequencies.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + double frequency = frequencies.frequency(); + reader.save_frequency(); + try { + reader.set_frequency(frequency); + } catch (TimeoutException te) { + } catch (InterruptedException ie) { + } + } }); c.gridx = 0; c.gridy = 0; + c.insets = new Insets(3, 3, 3, 3); + c.anchor = GridBagConstraints.WEST; + bag.add (frequencies, c); + + // Telemetry format menu + 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.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + int telemetry = telemetries.getSelectedIndex() + 1; + reader.set_telemetry(telemetry); + reader.save_telemetry(); + } + }); + c.gridx = 1; + c.gridy = 0; + c.fill = GridBagConstraints.NONE; c.anchor = GridBagConstraints.WEST; - bag.add (channels, c); + bag.add (telemetries, c); + c.insets = new Insets(0, 0, 0, 0); } /* Flight status is always visible */ @@ -159,7 +192,9 @@ public class AltosFlightUI extends JFrame implements AltosFlightDisplay { c.gridy = 1; c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1; + c.gridwidth = 2; bag.add(flightStatus, c); + c.gridwidth = 1; /* The rest of the window uses a tabbed pane to * show one of the alternate data views @@ -190,6 +225,7 @@ public class AltosFlightUI extends JFrame implements AltosFlightDisplay { c.fill = GridBagConstraints.BOTH; c.weightx = 1; c.weighty = 1; + c.gridwidth = 2; bag.add(pane, c); setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);