}
AltosFlightReader reader;
- AltosDisplayThread thread;
+ TeleGPSDisplayThread thread;
JMenuBar menu_bar;
JTabbedPane pane;
- AltosSiteMap sitemap;
+ AltosUIMap map;
TeleGPSInfo gps_info;
+ TeleGPSState gps_state;
AltosInfoTable info_table;
LinkedList<AltosFlightDisplay> displays;
}
void load_maps() {
- new AltosSiteMapPreload(this);
+ new AltosUIMapPreload(this);
}
void disconnect() {
void add_frequency_menu(int serial, final AltosFlightReader reader) {
// Channel menu
+ if (frequencies != null)
+ return;
+
frequencies = new AltosFreqList(AltosUIPreferences.frequency(serial));
frequencies.set_product("Monitor");
frequencies.set_serial(serial);
void remove_frequency_menu() {
if (frequencies != null) {
menu_bar.remove(frequencies);
+ menu_bar.repaint();
frequencies = null;
}
}
public void set_reader(AltosFlightReader reader) {
setTitle(String.format("TeleGPS %s", reader.name));
- thread = new AltosDisplayThread(this, voice(), this, reader);
+ thread = new TeleGPSDisplayThread(this, voice(), this, reader);
thread.start();
}
static int number_of_windows;
+ static public void add_window() {
+ ++number_of_windows;
+ }
+
+ static public void subtract_window() {
+ --number_of_windows;
+ if (number_of_windows == 0)
+ System.exit(0);
+ }
+
private void close() {
+ disconnect();
AltosUIPreferences.unregister_font_listener(this);
AltosPreferences.unregister_units_listener(this);
setVisible(false);
dispose();
- --number_of_windows;
- if (number_of_windows == 0)
- System.exit(0);
+ subtract_window();
}
private void add_menu(JMenu menu, String label, String action) {
c.gridwidth = 2;
bag.add(pane, c);
- sitemap = new AltosSiteMap();
- pane.add("Site Map", sitemap);
- displays.add(sitemap);
+ map = new AltosUIMap();
+ pane.add(map.getName(), map);
+ displays.add(map);
gps_info = new TeleGPSInfo();
- pane.add("Info", gps_info);
+ pane.add(gps_info.getName(), gps_info);
displays.add(gps_info);
+ gps_state = new TeleGPSState();
+ pane.add(gps_state.getName(), gps_state);
+ displays.add(gps_state);
+
info_table = new AltosInfoTable();
pane.add("Table", info_table);
displays.add(info_table);
pack();
setVisible(true);
- ++number_of_windows;
+ add_window();
status_update = new TeleGPSStatusUpdate(telegps_status);
return new AltosReplayReader(states.iterator(), file);
}
+ static boolean process_graph(File file) {
+ AltosStateIterable states = record_iterable(file);
+ if (states == null)
+ return false;
+ try {
+ new TeleGPSGraphUI(states, file);
+ } catch (Exception e) {
+ return false;
+ }
+ return true;
+ }
+
static boolean process_replay(File file) {
AltosReplayReader new_reader = replay_file(file);
if (new_reader == null)
} else {
double lat = Double.parseDouble(args[i+1]);
double lon = Double.parseDouble(args[i+2]);
- AltosSiteMap.prefetchMaps(lat, lon);
+ AltosUIMap.prefetch_maps(lat, lon);
i += 2;
}
} else if (args[i].equals("--replay"))
else {
File file = new File(args[i]);
switch (process) {
+ case process_none:
case process_graph:
- ++errors;
+ if (!process_graph(file))
+ ++errors;
break;
- case process_none:
case process_replay:
if (!process_replay(file))
++errors;
}
if (errors != 0)
System.exit(errors);
- if (!any_created) {
+ if (number_of_windows == 0) {
java.util.List<AltosDevice> devices = AltosUSBDevice.list(AltosLib.product_basestation);
if (devices != null)
for (AltosDevice device : devices) {
new TeleGPS(device);
any_created = true;
}
- if (!any_created)
+ if (number_of_windows == 0)
new TeleGPS();
}
}