summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2010-11-16 22:20:00 +0800
committerKeith Packard <keithp@keithp.com>2010-11-16 22:20:00 +0800
commitd0eb41619544ead6d9dab3a8d024a12936c9cdd0 (patch)
tree4fb427d21515541adffe3a7c4edb6b03d534cf8e
parentfcca333cda64be35f0c9fb0109eef1be3709dddd (diff)
altosui: Cleanup flight UI layout
Use common constants for fonts and insets Shrink fonts so that the window is < 600 pixels tall. Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r--ao-tools/altosui/Altos.java6
-rw-r--r--ao-tools/altosui/AltosAscent.java24
-rw-r--r--ao-tools/altosui/AltosDescent.java18
-rw-r--r--ao-tools/altosui/AltosFlightInfoTableModel.java2
-rw-r--r--ao-tools/altosui/AltosFlightStatus.java7
-rw-r--r--ao-tools/altosui/AltosFlightUI.java2
-rw-r--r--ao-tools/altosui/AltosLanded.java4
-rw-r--r--ao-tools/altosui/AltosPad.java50
8 files changed, 64 insertions, 49 deletions
diff --git a/ao-tools/altosui/Altos.java b/ao-tools/altosui/Altos.java
index 997550e0..197e98db 100644
--- a/ao-tools/altosui/Altos.java
+++ b/ao-tools/altosui/Altos.java
@@ -67,6 +67,12 @@ public class Altos {
static boolean map_initialized = false;
+ static final int tab_elt_pad = 5;
+
+ static final Font label_font = new Font("Dialog", Font.PLAIN, 22);
+ static final Font value_font = new Font("Monospaced", Font.PLAIN, 22);
+ static final Font status_font = new Font("SansSerif", Font.BOLD, 24);
+
static void initialize_map()
{
string_to_state.put("startup", ao_flight_startup);
diff --git a/ao-tools/altosui/AltosAscent.java b/ao-tools/altosui/AltosAscent.java
index 7525b655..8e1b6347 100644
--- a/ao-tools/altosui/AltosAscent.java
+++ b/ao-tools/altosui/AltosAscent.java
@@ -30,8 +30,6 @@ import java.util.concurrent.LinkedBlockingQueue;
public class AltosAscent extends JComponent implements AltosFlightDisplay {
GridBagLayout layout;
- Font label_font;
- Font value_font;
public class AscentValue {
JLabel label;
@@ -46,10 +44,10 @@ public class AltosAscent extends JComponent implements AltosFlightDisplay {
c.weighty = 1;
label = new JLabel(text);
- label.setFont(label_font);
+ label.setFont(Altos.label_font);
label.setHorizontalAlignment(SwingConstants.LEFT);
c.gridx = 0; c.gridy = y;
- c.insets = new Insets(10, 10, 10, 10);
+ c.insets = new Insets(Altos.tab_elt_pad, Altos.tab_elt_pad, Altos.tab_elt_pad, Altos.tab_elt_pad);
c.anchor = GridBagConstraints.WEST;
c.fill = GridBagConstraints.VERTICAL;
c.weightx = 0;
@@ -57,7 +55,7 @@ public class AltosAscent extends JComponent implements AltosFlightDisplay {
add(label);
value = new JTextField(30);
- value.setFont(value_font);
+ value.setFont(Altos.value_font);
value.setHorizontalAlignment(SwingConstants.RIGHT);
c.gridx = 1; c.gridy = y;
c.anchor = GridBagConstraints.WEST;
@@ -95,10 +93,10 @@ public class AltosAscent extends JComponent implements AltosFlightDisplay {
c.weighty = 1;
label = new JLabel(text);
- label.setFont(label_font);
+ label.setFont(Altos.label_font);
label.setHorizontalAlignment(SwingConstants.LEFT);
c.gridx = 0; c.gridy = y;
- c.insets = new Insets(10, 10, 10, 10);
+ c.insets = new Insets(Altos.tab_elt_pad, Altos.tab_elt_pad, Altos.tab_elt_pad, Altos.tab_elt_pad);
c.anchor = GridBagConstraints.WEST;
c.fill = GridBagConstraints.VERTICAL;
c.weightx = 0;
@@ -106,7 +104,7 @@ public class AltosAscent extends JComponent implements AltosFlightDisplay {
add(label);
value = new JTextField(15);
- value.setFont(value_font);
+ value.setFont(Altos.value_font);
value.setHorizontalAlignment(SwingConstants.RIGHT);
c.gridx = 1; c.gridy = y;
c.anchor = GridBagConstraints.EAST;
@@ -116,7 +114,7 @@ public class AltosAscent extends JComponent implements AltosFlightDisplay {
add(value);
max_value = new JTextField(15);
- max_value.setFont(value_font);
+ max_value.setFont(Altos.value_font);
max_value.setHorizontalAlignment(SwingConstants.RIGHT);
c.gridx = 2; c.gridy = y;
c.anchor = GridBagConstraints.EAST;
@@ -224,15 +222,15 @@ public class AltosAscent extends JComponent implements AltosFlightDisplay {
JLabel cur, max;
cur = new JLabel("Current");
- cur.setFont(label_font);
+ cur.setFont(Altos.label_font);
c = new GridBagConstraints();
c.gridx = 1; c.gridy = y;
- c.insets = new Insets(10, 10, 10, 10);
+ c.insets = new Insets(Altos.tab_elt_pad, Altos.tab_elt_pad, Altos.tab_elt_pad, Altos.tab_elt_pad);
layout.setConstraints(cur, c);
add(cur);
max = new JLabel("Maximum");
- max.setFont(label_font);
+ max.setFont(Altos.label_font);
c.gridx = 2; c.gridy = y;
layout.setConstraints(max, c);
add(max);
@@ -241,8 +239,6 @@ public class AltosAscent extends JComponent implements AltosFlightDisplay {
public AltosAscent() {
layout = new GridBagLayout();
- label_font = new Font("Dialog", Font.PLAIN, 24);
- value_font = new Font("Monospaced", Font.PLAIN, 24);
setLayout(layout);
/* Elements in ascent display:
diff --git a/ao-tools/altosui/AltosDescent.java b/ao-tools/altosui/AltosDescent.java
index b69e36b6..ceb78e57 100644
--- a/ao-tools/altosui/AltosDescent.java
+++ b/ao-tools/altosui/AltosDescent.java
@@ -30,8 +30,6 @@ import java.util.concurrent.LinkedBlockingQueue;
public class AltosDescent extends JComponent implements AltosFlightDisplay {
GridBagLayout layout;
- Font label_font;
- Font value_font;
public class DescentValue {
JLabel label;
@@ -51,10 +49,10 @@ public class AltosDescent extends JComponent implements AltosFlightDisplay {
c.weighty = 1;
label = new JLabel(text);
- label.setFont(label_font);
+ label.setFont(Altos.label_font);
label.setHorizontalAlignment(SwingConstants.LEFT);
c.gridx = 0; c.gridy = y;
- c.insets = new Insets(10, 10, 10, 10);
+ c.insets = new Insets(Altos.tab_elt_pad, Altos.tab_elt_pad, Altos.tab_elt_pad, Altos.tab_elt_pad);
c.anchor = GridBagConstraints.WEST;
c.fill = GridBagConstraints.VERTICAL;
c.weightx = 0;
@@ -62,7 +60,7 @@ public class AltosDescent extends JComponent implements AltosFlightDisplay {
add(label);
value = new JTextField(30);
- value.setFont(value_font);
+ value.setFont(Altos.value_font);
value.setHorizontalAlignment(SwingConstants.RIGHT);
c.gridx = 1; c.gridy = y;
c.gridwidth = 2;
@@ -161,10 +159,10 @@ public class AltosDescent extends JComponent implements AltosFlightDisplay {
c.weighty = 1;
label = new JLabel("Bearing");
- label.setFont(label_font);
+ label.setFont(Altos.label_font);
label.setHorizontalAlignment(SwingConstants.LEFT);
c.gridx = 0; c.gridy = y;
- c.insets = new Insets(10, 10, 10, 10);
+ c.insets = new Insets(Altos.tab_elt_pad, Altos.tab_elt_pad, Altos.tab_elt_pad, Altos.tab_elt_pad);
c.anchor = GridBagConstraints.WEST;
c.weightx = 0;
c.fill = GridBagConstraints.VERTICAL;
@@ -172,7 +170,7 @@ public class AltosDescent extends JComponent implements AltosFlightDisplay {
add(label);
value = new JTextField(30);
- value.setFont(value_font);
+ value.setFont(Altos.value_font);
value.setHorizontalAlignment(SwingConstants.RIGHT);
c.gridx = 1; c.gridy = y;
c.anchor = GridBagConstraints.EAST;
@@ -182,7 +180,7 @@ public class AltosDescent extends JComponent implements AltosFlightDisplay {
add(value);
value_deg = new JTextField(5);
- value_deg.setFont(value_font);
+ value_deg.setFont(Altos.value_font);
value_deg.setHorizontalAlignment(SwingConstants.RIGHT);
c.gridx = 2; c.gridy = y;
c.anchor = GridBagConstraints.EAST;
@@ -243,8 +241,6 @@ public class AltosDescent extends JComponent implements AltosFlightDisplay {
public AltosDescent() {
layout = new GridBagLayout();
- label_font = new Font("Dialog", Font.PLAIN, 24);
- value_font = new Font("Monospaced", Font.PLAIN, 24);
setLayout(layout);
/* Elements in descent display */
diff --git a/ao-tools/altosui/AltosFlightInfoTableModel.java b/ao-tools/altosui/AltosFlightInfoTableModel.java
index 2a22e3e5..3355ff52 100644
--- a/ao-tools/altosui/AltosFlightInfoTableModel.java
+++ b/ao-tools/altosui/AltosFlightInfoTableModel.java
@@ -46,7 +46,7 @@ public class AltosFlightInfoTableModel extends AbstractTableModel {
public int getColumnCount() { return columnNames.length; }
public String getColumnName(int col) { return columnNames[col]; }
- public int getRowCount() { return 20; }
+ public int getRowCount() { return 17; }
int current_row = 0;
int prev_num_rows = 0;
diff --git a/ao-tools/altosui/AltosFlightStatus.java b/ao-tools/altosui/AltosFlightStatus.java
index b99a5325..59c9e9db 100644
--- a/ao-tools/altosui/AltosFlightStatus.java
+++ b/ao-tools/altosui/AltosFlightStatus.java
@@ -31,8 +31,6 @@ import java.util.concurrent.LinkedBlockingQueue;
public class AltosFlightStatus extends JComponent implements AltosFlightDisplay {
GridBagLayout layout;
- private Font status_font;
-
public class FlightValue {
JLabel label;
JTextField value;
@@ -51,14 +49,14 @@ public class AltosFlightStatus extends JComponent implements AltosFlightDisplay
c.weighty = 1;
label = new JLabel(text);
- label.setFont(status_font);
+ label.setFont(Altos.status_font);
label.setHorizontalAlignment(SwingConstants.CENTER);
c.gridx = x; c.gridy = 0;
layout.setConstraints(label, c);
add(label);
value = new JTextField("");
- value.setFont(status_font);
+ value.setFont(Altos.status_font);
value.setHorizontalAlignment(SwingConstants.CENTER);
c.gridx = x; c.gridy = 1;
layout.setConstraints(value, c);
@@ -145,7 +143,6 @@ public class AltosFlightStatus extends JComponent implements AltosFlightDisplay
public AltosFlightStatus() {
layout = new GridBagLayout();
- status_font = new Font("SansSerif", Font.BOLD, 24);
setLayout(layout);
call = new Call(layout, 0);
diff --git a/ao-tools/altosui/AltosFlightUI.java b/ao-tools/altosui/AltosFlightUI.java
index 5134a24e..78b005c0 100644
--- a/ao-tools/altosui/AltosFlightUI.java
+++ b/ao-tools/altosui/AltosFlightUI.java
@@ -187,7 +187,7 @@ public class AltosFlightUI extends JFrame implements AltosFlightDisplay {
this.setJMenuBar(menubar);
}
- this.setSize(new Dimension (width(), height()));
+ this.setSize(this.getPreferredSize());
this.validate();
setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
diff --git a/ao-tools/altosui/AltosLanded.java b/ao-tools/altosui/AltosLanded.java
index 465c9dce..0656ea6c 100644
--- a/ao-tools/altosui/AltosLanded.java
+++ b/ao-tools/altosui/AltosLanded.java
@@ -196,8 +196,8 @@ public class AltosLanded extends JComponent implements AltosFlightDisplay {
public AltosLanded() {
layout = new GridBagLayout();
- label_font = new Font("Dialog", Font.PLAIN, 24);
- value_font = new Font("Monospaced", Font.PLAIN, 24);
+ label_font = new Font("Dialog", Font.PLAIN, 22);
+ value_font = new Font("Monospaced", Font.PLAIN, 22);
setLayout(layout);
/* Elements in descent display */
diff --git a/ao-tools/altosui/AltosPad.java b/ao-tools/altosui/AltosPad.java
index 650ed012..8b258c7d 100644
--- a/ao-tools/altosui/AltosPad.java
+++ b/ao-tools/altosui/AltosPad.java
@@ -60,7 +60,7 @@ public class AltosPad extends JComponent implements AltosFlightDisplay {
label.setFont(label_font);
label.setHorizontalAlignment(SwingConstants.LEFT);
c.gridx = 1; c.gridy = y;
- c.insets = new Insets(10, 10, 10, 10);
+ c.insets = new Insets(Altos.tab_elt_pad, Altos.tab_elt_pad, Altos.tab_elt_pad, Altos.tab_elt_pad);
c.anchor = GridBagConstraints.WEST;
c.fill = GridBagConstraints.VERTICAL;
c.weightx = 0;
@@ -90,7 +90,7 @@ public class AltosPad extends JComponent implements AltosFlightDisplay {
}
public LaunchValue (GridBagLayout layout, int y, String text) {
GridBagConstraints c = new GridBagConstraints();
- c.insets = new Insets(10, 10, 10, 10);
+ c.insets = new Insets(Altos.tab_elt_pad, Altos.tab_elt_pad, Altos.tab_elt_pad, Altos.tab_elt_pad);
c.weighty = 1;
label = new JLabel(text);
@@ -151,17 +151,32 @@ public class AltosPad extends JComponent implements AltosFlightDisplay {
Main main;
- class GPS extends LaunchStatus {
+ class GPSLocked extends LaunchStatus {
void show (AltosState state, int crc_errors) {
value.setText(String.format("%4d sats", state.gps.nsat));
+ lights.set(state.gps.locked);
+ }
+ public GPSLocked (GridBagLayout layout, int y) {
+ super (layout, y, "GPS Locked");
+ }
+ }
+
+ GPSLocked gps_locked;
+
+ class GPSReady extends LaunchStatus {
+ void show (AltosState state, int crc_errors) {
+ if (state.gps_ready)
+ value.setText("Ready");
+ else
+ value.setText(String.format("Waiting %d", state.gps_waiting));
lights.set(state.gps_ready);
}
- public GPS (GridBagLayout layout, int y) {
- super (layout, y, "GPS Status");
+ public GPSReady (GridBagLayout layout, int y) {
+ super (layout, y, "GPS Ready");
}
}
- GPS gps;
+ GPSReady gps_ready;
String pos(double p, String pos, String neg) {
String h = pos;
@@ -211,7 +226,8 @@ public class AltosPad extends JComponent implements AltosFlightDisplay {
battery.reset();
apogee.reset();
main.reset();
- gps.reset();
+ gps_locked.reset();
+ gps_ready.reset();
pad_lat.reset();
pad_lon.reset();
pad_alt.reset();
@@ -221,7 +237,8 @@ public class AltosPad extends JComponent implements AltosFlightDisplay {
battery.show(state, crc_errors);
apogee.show(state, crc_errors);
main.show(state, crc_errors);
- gps.show(state, crc_errors);
+ gps_locked.show(state, crc_errors);
+ gps_ready.show(state, crc_errors);
pad_lat.show(state, crc_errors);
pad_lon.show(state, crc_errors);
pad_alt.show(state, crc_errors);
@@ -230,24 +247,27 @@ public class AltosPad extends JComponent implements AltosFlightDisplay {
public AltosPad() {
layout = new GridBagLayout();
- label_font = new Font("Dialog", Font.PLAIN, 24);
- value_font = new Font("Monospaced", Font.PLAIN, 24);
+ label_font = new Font("Dialog", Font.PLAIN, 22);
+ value_font = new Font("Monospaced", Font.PLAIN, 22);
setLayout(layout);
/* Elements in pad display:
*
* Battery voltage
* Igniter continuity
- * GPS lock status and location
+ * GPS lock status
+ * GPS ready status
+ * GPS location
* Pad altitude
* RSSI
*/
battery = new Battery(layout, 0);
apogee = new Apogee(layout, 1);
main = new Main(layout, 2);
- gps = new GPS(layout, 3);
- pad_lat = new PadLat(layout, 4);
- pad_lon = new PadLon(layout, 5);
- pad_alt = new PadAlt(layout, 6);
+ gps_locked = new GPSLocked(layout, 3);
+ gps_ready = new GPSReady(layout, 4);
+ pad_lat = new PadLat(layout, 5);
+ pad_lon = new PadLon(layout, 6);
+ pad_alt = new PadAlt(layout, 7);
}
}