Merge branch 'buttonbox' of git://git.gag.com/fw/altos into buttonbox
[fw/altos] / ao-tools / altosui / AltosFlightUI.java
index 3581c54c1ce8a6b14c5135ecb1839b656bc05ec6..1372cc00d8da9368ded43ae3bb15c771d0862b71 100644 (file)
@@ -44,8 +44,10 @@ public class AltosFlightUI extends JFrame implements AltosFlightDisplay {
        AltosAscent     ascent;
        AltosDescent    descent;
        AltosLanded     landed;
        AltosAscent     ascent;
        AltosDescent    descent;
        AltosLanded     landed;
+    AltosSiteMap    sitemap;
 
 
-       private AltosStatusTable flightStatus;
+       private AltosFlightStatus flightStatus;
+       private JScrollPane flightInfoPane;
        private AltosInfoTable flightInfo;
 
        static final int tab_pad = 1;
        private AltosInfoTable flightInfo;
 
        static final int tab_pad = 1;
@@ -55,6 +57,8 @@ public class AltosFlightUI extends JFrame implements AltosFlightDisplay {
 
        int cur_tab = 0;
 
 
        int cur_tab = 0;
 
+       boolean exit_on_close = false;
+
        int which_tab(AltosState state) {
                if (state.state < Altos.ao_flight_boost)
                        return tab_pad;
        int which_tab(AltosState state) {
                if (state.state < Altos.ao_flight_boost)
                        return tab_pad;
@@ -93,6 +97,7 @@ public class AltosFlightUI extends JFrame implements AltosFlightDisplay {
                descent.reset();
                landed.reset();
                flightInfo.clear();
                descent.reset();
                landed.reset();
                flightInfo.clear();
+               sitemap.reset();
        }
 
        public void show(AltosState state, int crc_errors) {
        }
 
        public void show(AltosState state, int crc_errors) {
@@ -117,12 +122,17 @@ public class AltosFlightUI extends JFrame implements AltosFlightDisplay {
                        }
                        cur_tab = tab;
                }
                        }
                        cur_tab = tab;
                }
-               flightStatus.set(state);
+               flightStatus.show(state, crc_errors);
                flightInfo.show(state, crc_errors);
                flightInfo.show(state, crc_errors);
+               sitemap.show(state, crc_errors);
+       }
+
+       public void set_exit_on_close() {
+               exit_on_close = true;
        }
 
        public AltosFlightUI(AltosVoice in_voice, AltosFlightReader in_reader, final int serial) {
        }
 
        public AltosFlightUI(AltosVoice in_voice, AltosFlightReader in_reader, final int serial) {
-        AltosPreferences.init(this);
+               AltosPreferences.init(this);
 
                voice = in_voice;
                reader = in_reader;
 
                voice = in_voice;
                reader = in_reader;
@@ -133,7 +143,7 @@ public class AltosFlightUI extends JFrame implements AltosFlightDisplay {
 
                setTitle(String.format("AltOS %s", reader.name));
 
 
                setTitle(String.format("AltOS %s", reader.name));
 
-               flightStatus = new AltosStatusTable();
+               flightStatus = new AltosFlightStatus();
 
                vbox = new Box (BoxLayout.Y_AXIS);
                vbox.add(flightStatus);
 
                vbox = new Box (BoxLayout.Y_AXIS);
                vbox.add(flightStatus);
@@ -153,7 +163,11 @@ public class AltosFlightUI extends JFrame implements AltosFlightDisplay {
                pane.add("Landed", landed);
 
                flightInfo = new AltosInfoTable();
                pane.add("Landed", landed);
 
                flightInfo = new AltosInfoTable();
-               pane.add("Table", flightInfo.box());
+               flightInfoPane = new JScrollPane(flightInfo.box());
+               pane.add("Table", flightInfoPane);
+
+        sitemap = new AltosSiteMap();
+        pane.add("Site Map", sitemap);
 
                vbox.add(pane);
 
 
                vbox.add(pane);
 
@@ -179,7 +193,7 @@ public class AltosFlightUI extends JFrame implements AltosFlightDisplay {
                        this.setJMenuBar(menubar);
                }
 
                        this.setJMenuBar(menubar);
                }
 
-               this.setSize(new Dimension (width(), height()));
+               this.setSize(this.getPreferredSize());
                this.validate();
 
                setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
                this.validate();
 
                setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
@@ -189,6 +203,8 @@ public class AltosFlightUI extends JFrame implements AltosFlightDisplay {
                                disconnect();
                                setVisible(false);
                                dispose();
                                disconnect();
                                setVisible(false);
                                dispose();
+                               if (exit_on_close)
+                                       System.exit(0);
                        }
                });
 
                        }
                });