diff options
| -rw-r--r-- | altosui/Altos.java | 42 | ||||
| -rw-r--r-- | altosui/AltosAscent.java | 30 | ||||
| -rw-r--r-- | altosui/AltosCompanionInfo.java | 15 | ||||
| -rw-r--r-- | altosui/AltosConfigureUI.java | 61 | ||||
| -rw-r--r-- | altosui/AltosDescent.java | 28 | ||||
| -rw-r--r-- | altosui/AltosFlightDisplay.java | 2 | ||||
| -rw-r--r-- | altosui/AltosFlightStatus.java | 14 | ||||
| -rw-r--r-- | altosui/AltosFlightUI.java | 21 | ||||
| -rw-r--r-- | altosui/AltosFontListener.java | 22 | ||||
| -rw-r--r-- | altosui/AltosIdleMonitorUI.java | 5 | ||||
| -rw-r--r-- | altosui/AltosInfoTable.java | 12 | ||||
| -rw-r--r-- | altosui/AltosLanded.java | 23 | ||||
| -rw-r--r-- | altosui/AltosPad.java | 22 | ||||
| -rw-r--r-- | altosui/AltosPreferences.java | 42 | ||||
| -rw-r--r-- | altosui/AltosSiteMap.java | 4 | ||||
| -rw-r--r-- | altosui/AltosTelemetryRecordCompanion.java | 2 | ||||
| -rw-r--r-- | altosui/Makefile.am | 1 | ||||
| -rw-r--r-- | altosui/altos-windows.nsi | 4 | ||||
| -rw-r--r-- | doc/altusmetrum.xsl | 7 | 
19 files changed, 317 insertions, 40 deletions
diff --git a/altosui/Altos.java b/altosui/Altos.java index ddf1005a..e4f974f9 100644 --- a/altosui/Altos.java +++ b/altosui/Altos.java @@ -97,9 +97,45 @@ public class Altos {  	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 Font label_font; +	static Font value_font; +	static Font status_font; +	static Font table_label_font; +	static Font table_value_font; + +	final static int font_size_small = 1; +	final static int font_size_medium = 2; +	final static int font_size_large = 3; + +	static void set_fonts(int size) { +		int	brief_size; +		int	table_size; +		int	status_size; + +		switch (size) { +		case font_size_small: +			brief_size = 16; +			status_size = 18; +			table_size = 11; +			break; +		default: +		case font_size_medium: +			brief_size = 22; +			status_size = 24; +			table_size = 14; +			break; +		case font_size_large: +			brief_size = 26; +			status_size = 30; +			table_size = 17; +			break; +		} +		label_font = new Font("Dialog", Font.PLAIN, brief_size); +		value_font = new Font("Monospaced", Font.PLAIN, brief_size); +		status_font = new Font("SansSerif", Font.BOLD, status_size); +		table_label_font = new Font("SansSerif", Font.PLAIN, table_size); +		table_value_font = new Font("Monospaced", Font.PLAIN, table_size); +	}  	static final int text_width = 20; diff --git a/altosui/AltosAscent.java b/altosui/AltosAscent.java index d607b0c5..c8e5f3af 100644 --- a/altosui/AltosAscent.java +++ b/altosui/AltosAscent.java @@ -30,6 +30,7 @@ import java.util.concurrent.LinkedBlockingQueue;  public class AltosAscent extends JComponent implements AltosFlightDisplay {  	GridBagLayout	layout; +	JLabel			cur, max;  	public class AscentStatus {  		JLabel		label; @@ -54,6 +55,11 @@ public class AltosAscent extends JComponent implements AltosFlightDisplay {  			lights.set(false);  		} +		void set_font() { +			label.setFont(Altos.label_font); +			value.setFont(Altos.value_font); +		} +  		public AscentStatus (GridBagLayout layout, int y, String text) {  			GridBagConstraints	c = new GridBagConstraints();  			c.weighty = 1; @@ -109,6 +115,11 @@ public class AltosAscent extends JComponent implements AltosFlightDisplay {  			label.setVisible(false);  			value.setVisible(false);  		} +		void set_font() { +			label.setFont(Altos.label_font); +			value.setFont(Altos.value_font); +		} +  		public AscentValue (GridBagLayout layout, int y, String text) {  			GridBagConstraints	c = new GridBagConstraints();  			c.weighty = 1; @@ -151,6 +162,12 @@ public class AltosAscent extends JComponent implements AltosFlightDisplay {  			max = AltosRecord.MISSING;  		} +		void set_font() { +			label.setFont(Altos.label_font); +			value.setFont(Altos.value_font); +			max_value.setFont(Altos.value_font); +		} +  		void show(String format, double v) {  			if (v == AltosRecord.MISSING) {  				value.setText("Missing"); @@ -314,6 +331,18 @@ public class AltosAscent extends JComponent implements AltosFlightDisplay {  		accel.reset();  	} +	public void set_font() { +		cur.setFont(Altos.label_font); +		max.setFont(Altos.label_font); +		lat.set_font(); +		lon.set_font(); +		main.set_font(); +		apogee.set_font(); +		height.set_font(); +		speed.set_font(); +		accel.set_font(); +	} +  	public void show(AltosState state, int crc_errors) {  		if (state.gps != null && state.gps.connected) {  			lat.show(state, crc_errors); @@ -337,7 +366,6 @@ public class AltosAscent extends JComponent implements AltosFlightDisplay {  	public void labels(GridBagLayout layout, int y) {  		GridBagConstraints	c; -		JLabel			cur, max;  		cur = new JLabel("Current");  		cur.setFont(Altos.label_font); diff --git a/altosui/AltosCompanionInfo.java b/altosui/AltosCompanionInfo.java index f287a8ea..82bde623 100644 --- a/altosui/AltosCompanionInfo.java +++ b/altosui/AltosCompanionInfo.java @@ -31,25 +31,26 @@ import java.util.concurrent.LinkedBlockingQueue;  public class AltosCompanionInfo extends JTable {  	private AltosFlightInfoTableModel model; -	private Font infoLabelFont = new Font("SansSerif", Font.PLAIN, 14); -	private Font infoValueFont = new Font("Monospaced", Font.PLAIN, 14); -  	static final int info_columns = 2;  	static final int info_rows = 17;  	int desired_row_height() { -		FontMetrics	infoValueMetrics = getFontMetrics(infoValueFont); +		FontMetrics	infoValueMetrics = getFontMetrics(Altos.table_value_font);  		return (infoValueMetrics.getHeight() + infoValueMetrics.getLeading()) * 18 / 10;  	} +	public void set_font() { +		setFont(Altos.table_value_font); +		setRowHeight(desired_row_height()); +		doLayout(); +	} +  	public AltosCompanionInfo() {  		super(new AltosFlightInfoTableModel(info_rows, info_columns));  		model = (AltosFlightInfoTableModel) getModel(); -		setFont(infoValueFont);  		setAutoResizeMode(AUTO_RESIZE_ALL_COLUMNS);  		setShowGrid(true); -		setRowHeight(desired_row_height()); -		doLayout(); +		set_font();  	}  	public Dimension getPreferredScrollableViewportSize() { diff --git a/altosui/AltosConfigureUI.java b/altosui/AltosConfigureUI.java index 0c865d0e..bcb9636b 100644 --- a/altosui/AltosConfigureUI.java +++ b/altosui/AltosConfigureUI.java @@ -47,12 +47,17 @@ public class AltosConfigureUI  	JLabel		callsign_label;  	JTextField	callsign_value; +	JLabel		font_size_label; +	JComboBox	font_size_value; +  	JRadioButton	serial_debug;  // BLUETOOTH  //	JButton		manage_bluetooth;  	JButton		manage_frequencies; +	final static String[] font_size_names = { "Small", "Medium", "Large" }; +  	/* DocumentListener interface methods */  	public void changedUpdate(DocumentEvent e) {  		AltosPreferences.set_callsign(callsign_value.getText()); @@ -73,6 +78,8 @@ public class AltosConfigureUI  		Insets insets = new Insets(4, 4, 4, 4); +		int row = 0; +  		owner = in_owner;  		voice = in_voice;  		pane = getContentPane(); @@ -85,14 +92,14 @@ public class AltosConfigureUI  		/* Nice label at the top */  		c.gridx = 0; -		c.gridy = 0; +		c.gridy = row++;  		c.gridwidth = 3;  		c.fill = GridBagConstraints.NONE;  		c.anchor = GridBagConstraints.CENTER;  		pane.add(new JLabel ("Configure AltOS UI"), c);  		c.gridx = 0; -		c.gridy = 1; +		c.gridy = row++;  		c.gridwidth = 3;  		c.fill = GridBagConstraints.NONE;  		c.anchor = GridBagConstraints.CENTER; @@ -100,7 +107,7 @@ public class AltosConfigureUI  		/* Voice settings */  		c.gridx = 0; -		c.gridy = 2; +		c.gridy = row;  		c.gridwidth = 1;  		c.fill = GridBagConstraints.NONE;  		c.anchor = GridBagConstraints.WEST; @@ -119,7 +126,7 @@ public class AltosConfigureUI  				}  			});  		c.gridx = 1; -		c.gridy = 2; +		c.gridy = row;  		c.gridwidth = 1;  		c.weightx = 1;  		c.fill = GridBagConstraints.NONE; @@ -128,7 +135,7 @@ public class AltosConfigureUI  		enable_voice.setToolTipText("Enable/Disable all audio in-flight announcements");  		c.gridx = 2; -		c.gridy = 2; +		c.gridy = row++;  		c.gridwidth = 1;  		c.weightx = 1;  		c.fill = GridBagConstraints.NONE; @@ -144,7 +151,7 @@ public class AltosConfigureUI  		/* Log directory settings */  		c.gridx = 0; -		c.gridy = 3; +		c.gridy = row;  		c.gridwidth = 1;  		c.fill = GridBagConstraints.NONE;  		c.anchor = GridBagConstraints.WEST; @@ -158,7 +165,7 @@ public class AltosConfigureUI  				}  			});  		c.gridx = 1; -		c.gridy = 3; +		c.gridy = row++;  		c.gridwidth = 2;  		c.fill = GridBagConstraints.BOTH;  		c.anchor = GridBagConstraints.WEST; @@ -167,7 +174,7 @@ public class AltosConfigureUI  		/* Callsign setting */  		c.gridx = 0; -		c.gridy = 4; +		c.gridy = row;  		c.gridwidth = 1;  		c.fill = GridBagConstraints.NONE;  		c.anchor = GridBagConstraints.WEST; @@ -176,16 +183,42 @@ public class AltosConfigureUI  		callsign_value = new JTextField(AltosPreferences.callsign());  		callsign_value.getDocument().addDocumentListener(this);  		c.gridx = 1; -		c.gridy = 4; +		c.gridy = row++;  		c.gridwidth = 2;  		c.fill = GridBagConstraints.BOTH;  		c.anchor = GridBagConstraints.WEST;  		pane.add(callsign_value, c);  		callsign_value.setToolTipText("Callsign sent in packet mode"); +		/* Font size setting */ +		c.gridx = 0; +		c.gridy = row; +		c.gridwidth = 1; +		c.fill = GridBagConstraints.NONE; +		c.anchor = GridBagConstraints.WEST; +		pane.add(new JLabel("Font size"), c); + +		font_size_value = new JComboBox(font_size_names); +		int font_size = AltosPreferences.font_size(); +		font_size_value.setSelectedIndex(font_size - Altos.font_size_small); +		font_size_value.addActionListener(new ActionListener() { +				public void actionPerformed(ActionEvent e) { +					int	size = font_size_value.getSelectedIndex() + Altos.font_size_small; + +					AltosPreferences.set_font_size(size); +				} +			}); +		c.gridx = 1; +		c.gridy = row++; +		c.gridwidth = 2; +		c.fill = GridBagConstraints.BOTH; +		c.anchor = GridBagConstraints.WEST; +		pane.add(font_size_value, c); +		font_size_value.setToolTipText("Font size used in telemetry window"); +  		/* Serial debug setting */  		c.gridx = 0; -		c.gridy = 5; +		c.gridy = row;  		c.gridwidth = 1;  		c.fill = GridBagConstraints.NONE;  		c.anchor = GridBagConstraints.WEST; @@ -202,7 +235,7 @@ public class AltosConfigureUI  		serial_debug.setToolTipText("Enable/Disable USB I/O getting sent to the console");  		c.gridx = 1; -		c.gridy = 5; +		c.gridy = row++;  		c.gridwidth = 3;  		c.fill = GridBagConstraints.NONE;  		c.anchor = GridBagConstraints.WEST; @@ -216,7 +249,7 @@ public class AltosConfigureUI  //				}  //			});  //		c.gridx = 0; -//		c.gridy = 6; +//		c.gridy = row++;  //		c.gridwidth = 2;  //		c.fill = GridBagConstraints.NONE;  //		c.anchor = GridBagConstraints.WEST; @@ -232,7 +265,7 @@ public class AltosConfigureUI  // BLUETOOTH  //		c.gridx = 2;  		c.gridx = 1; -		c.gridy = 6; +		c.gridy = row++;  		c.gridwidth = 2;  		c.fill = GridBagConstraints.NONE;  		c.anchor = GridBagConstraints.WEST; @@ -246,7 +279,7 @@ public class AltosConfigureUI  				}  			});  		c.gridx = 0; -		c.gridy = 7; +		c.gridy = row++;  		c.gridwidth = 3;  		c.fill = GridBagConstraints.NONE;  		c.anchor = GridBagConstraints.CENTER; diff --git a/altosui/AltosDescent.java b/altosui/AltosDescent.java index 2a9e7eef..0fcd690b 100644 --- a/altosui/AltosDescent.java +++ b/altosui/AltosDescent.java @@ -55,6 +55,11 @@ public class AltosDescent extends JComponent implements AltosFlightDisplay {  			lights.set(false);  		} +		void set_font() { +			label.setFont(Altos.label_font); +			value.setFont(Altos.value_font); +		} +  		public DescentStatus (GridBagLayout layout, int y, String text) {  			GridBagConstraints	c = new GridBagConstraints();  			c.weighty = 1; @@ -121,6 +126,11 @@ public class AltosDescent extends JComponent implements AltosFlightDisplay {  			value.setText(v);  		} +		void set_font() { +			label.setFont(Altos.label_font); +			value.setFont(Altos.value_font); +		} +  		public DescentValue (GridBagLayout layout, int x, int y, String text) {  			GridBagConstraints	c = new GridBagConstraints();  			c.weighty = 1; @@ -169,6 +179,12 @@ public class AltosDescent extends JComponent implements AltosFlightDisplay {  			value2.setVisible(false);  		} +		void set_font() { +			label.setFont(Altos.label_font); +			value1.setFont(Altos.value_font); +			value2.setFont(Altos.value_font); +		} +  		abstract void show(AltosState state, int crc_errors);  		void show(String v1, String v2) { @@ -361,6 +377,18 @@ public class AltosDescent extends JComponent implements AltosFlightDisplay {  		apogee.reset();  	} +	public void set_font() { +		lat.set_font(); +		lon.set_font(); +		height.set_font(); +		speed.set_font(); +		bearing.set_font(); +		range.set_font(); +		elevation.set_font(); +		main.set_font(); +		apogee.set_font(); +	} +  	public void show(AltosState state, int crc_errors) {  		height.show(state, crc_errors);  		speed.show(state, crc_errors); diff --git a/altosui/AltosFlightDisplay.java b/altosui/AltosFlightDisplay.java index d18d1d1f..f633c8e6 100644 --- a/altosui/AltosFlightDisplay.java +++ b/altosui/AltosFlightDisplay.java @@ -21,4 +21,6 @@ public interface AltosFlightDisplay {  	void reset();  	void show(AltosState state, int crc_errors); + +	void set_font();  } diff --git a/altosui/AltosFlightStatus.java b/altosui/AltosFlightStatus.java index 59c9e9db..ed273384 100644 --- a/altosui/AltosFlightStatus.java +++ b/altosui/AltosFlightStatus.java @@ -40,6 +40,12 @@ public class AltosFlightStatus extends JComponent implements AltosFlightDisplay  		void reset() {  			value.setText("");  		} + +		void set_font() { +			label.setFont(Altos.status_font); +			value.setFont(Altos.status_font); +		} +  		public FlightValue (GridBagLayout layout, int x, String text) {  			GridBagConstraints	c = new GridBagConstraints();  			c.insets = new Insets(5, 5, 5, 5); @@ -127,6 +133,14 @@ public class AltosFlightStatus extends JComponent implements AltosFlightDisplay  		rssi.reset();  	} +	public void set_font () { +		call.set_font(); +		serial.set_font(); +		flight.set_font(); +		flight_state.set_font(); +		rssi.set_font(); +	} +  	public void show (AltosState state, int crc_errors) {  		call.show(state, crc_errors);  		serial.show(state, crc_errors); diff --git a/altosui/AltosFlightUI.java b/altosui/AltosFlightUI.java index abe08a18..b44b9d43 100644 --- a/altosui/AltosFlightUI.java +++ b/altosui/AltosFlightUI.java @@ -28,7 +28,7 @@ import java.text.*;  import java.util.prefs.*;  import java.util.concurrent.*; -public class AltosFlightUI extends JFrame implements AltosFlightDisplay { +public class AltosFlightUI extends JFrame implements AltosFlightDisplay, AltosFontListener {  	AltosVoice		voice;  	AltosFlightReader	reader;  	AltosDisplayThread	thread; @@ -83,6 +83,21 @@ public class AltosFlightUI extends JFrame implements AltosFlightDisplay {  		sitemap.reset();  	} +	public void set_font() { +		pad.set_font(); +		ascent.set_font(); +		descent.set_font(); +		landed.set_font(); +		flightStatus.set_font(); +		flightInfo.set_font(); +		sitemap.set_font(); +		companion.set_font(); +	} + +	public void font_size_changed(int font_size) { +		set_font(); +	} +  	public void show(AltosState state, int crc_errors) {  		JComponent tab = which_tab(state);  		try { @@ -254,12 +269,16 @@ public class AltosFlightUI extends JFrame implements AltosFlightDisplay {  		bag.add(pane, c);  		setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); + +		AltosPreferences.register_font_listener(this); +  		addWindowListener(new WindowAdapter() {  				@Override  				public void windowClosing(WindowEvent e) {  					disconnect();  					setVisible(false);  					dispose(); +					AltosPreferences.unregister_font_listener(AltosFlightUI.this);  					if (exit_on_close)  						System.exit(0);  				} diff --git a/altosui/AltosFontListener.java b/altosui/AltosFontListener.java new file mode 100644 index 00000000..0dda0f29 --- /dev/null +++ b/altosui/AltosFontListener.java @@ -0,0 +1,22 @@ +/* + * Copyright © 2011 Keith Packard <keithp@keithp.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + */ + +package altosui; + +public interface AltosFontListener { +	void font_size_changed(int font_size); +} diff --git a/altosui/AltosIdleMonitorUI.java b/altosui/AltosIdleMonitorUI.java index 142f0278..988a797c 100644 --- a/altosui/AltosIdleMonitorUI.java +++ b/altosui/AltosIdleMonitorUI.java @@ -284,6 +284,11 @@ public class AltosIdleMonitorUI extends JFrame implements AltosFlightDisplay {  		flightInfo.clear();  	} +	public void set_font() { +		pad.set_font(); +		flightInfo.set_font(); +	} +  	public void show(AltosState state, int crc_errors) {  		try {  			pad.show(state, crc_errors); diff --git a/altosui/AltosInfoTable.java b/altosui/AltosInfoTable.java index 8ebeaba1..c023369e 100644 --- a/altosui/AltosInfoTable.java +++ b/altosui/AltosInfoTable.java @@ -31,27 +31,29 @@ import java.util.concurrent.LinkedBlockingQueue;  public class AltosInfoTable extends JTable {  	private AltosFlightInfoTableModel model; -	private Font infoLabelFont = new Font("SansSerif", Font.PLAIN, 14); -	private Font infoValueFont = new Font("Monospaced", Font.PLAIN, 14); -  	static final int info_columns = 3;  	static final int info_rows = 17;  	int desired_row_height() { -		FontMetrics	infoValueMetrics = getFontMetrics(infoValueFont); +		FontMetrics	infoValueMetrics = getFontMetrics(Altos.table_value_font);  		return (infoValueMetrics.getHeight() + infoValueMetrics.getLeading()) * 18 / 10;  	}  	public AltosInfoTable() {  		super(new AltosFlightInfoTableModel(info_rows, info_columns));  		model = (AltosFlightInfoTableModel) getModel(); -		setFont(infoValueFont); +		setFont(Altos.table_value_font);  		setAutoResizeMode(AUTO_RESIZE_ALL_COLUMNS);  		setShowGrid(true);  		setRowHeight(desired_row_height());  		doLayout();  	} +	public void set_font() { +		setFont(Altos.table_value_font); +		doLayout(); +	} +  	public Dimension getPreferredScrollableViewportSize() {  		return getPreferredSize();  	} diff --git a/altosui/AltosLanded.java b/altosui/AltosLanded.java index 71c10663..50e6b542 100644 --- a/altosui/AltosLanded.java +++ b/altosui/AltosLanded.java @@ -30,8 +30,6 @@ import java.util.concurrent.LinkedBlockingQueue;  public class AltosLanded extends JComponent implements AltosFlightDisplay, ActionListener {  	GridBagLayout	layout; -	Font		label_font; -	Font		value_font;  	public class LandedValue {  		JLabel		label; @@ -47,6 +45,11 @@ public class AltosLanded extends JComponent implements AltosFlightDisplay, Actio  			value.setVisible(true);  		} +		public void set_font() { +			label.setFont(Altos.label_font); +			value.setFont(Altos.value_font); +		} +  		void hide() {  			label.setVisible(false);  			value.setVisible(false); @@ -63,7 +66,7 @@ public class AltosLanded extends JComponent implements AltosFlightDisplay, Actio  			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); @@ -74,7 +77,7 @@ public class AltosLanded extends JComponent implements AltosFlightDisplay, Actio  			add(label);  			value = new JTextField(Altos.text_width); -			value.setFont(value_font); +			value.setFont(Altos.value_font);  			value.setHorizontalAlignment(SwingConstants.RIGHT);  			c.gridx = 1; c.gridy = y;  			c.anchor = GridBagConstraints.WEST; @@ -199,6 +202,16 @@ public class AltosLanded extends JComponent implements AltosFlightDisplay, Actio  		accel.reset();  	} +	public void set_font() { +		lat.set_font(); +		lon.set_font(); +		bearing.set_font(); +		distance.set_font(); +		height.set_font(); +		speed.set_font(); +		accel.set_font(); +	} +  	public void show(AltosState state, int crc_errors) {  		if (state.gps != null && state.gps.connected) {  			bearing.show(state, crc_errors); @@ -259,8 +272,6 @@ public class AltosLanded extends JComponent implements AltosFlightDisplay, Actio  		reader = in_reader; -		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/altosui/AltosPad.java b/altosui/AltosPad.java index 3a8d04fe..6ef66f7a 100644 --- a/altosui/AltosPad.java +++ b/altosui/AltosPad.java @@ -54,6 +54,11 @@ public class AltosPad extends JComponent implements AltosFlightDisplay {  			lights.setVisible(false);  		} +		public void set_font() { +			label.setFont(Altos.label_font); +			value.setFont(Altos.value_font); +		} +  		public LaunchStatus (GridBagLayout layout, int y, String text) {  			GridBagConstraints	c = new GridBagConstraints();  			c.weighty = 1; @@ -105,6 +110,11 @@ public class AltosPad extends JComponent implements AltosFlightDisplay {  			value.setVisible(false);  		} +		public void set_font() { +			label.setFont(Altos.label_font); +			value.setFont(Altos.value_font); +		} +  		void reset() {  			value.setText("");  		} @@ -282,6 +292,18 @@ public class AltosPad extends JComponent implements AltosFlightDisplay {  		pad_alt.reset();  	} +	public void set_font() { +		battery.set_font(); +		apogee.set_font(); +		main.set_font(); +		logging_ready.set_font(); +		gps_locked.set_font(); +		gps_ready.set_font(); +		pad_lat.set_font(); +		pad_lon.set_font(); +		pad_alt.set_font(); +	} +	  	public void show(AltosState state, int crc_errors) {  		battery.show(state, crc_errors);  		if (state.drogue_sense == AltosRecord.MISSING) diff --git a/altosui/AltosPreferences.java b/altosui/AltosPreferences.java index de926b38..716559ab 100644 --- a/altosui/AltosPreferences.java +++ b/altosui/AltosPreferences.java @@ -55,6 +55,9 @@ class AltosPreferences {  	/* scanning telemetry preferences name */  	final static String scanningTelemetryPreference = "SCANNING-TELEMETRY"; +	/* font size preferences name */ +	final static String fontSizePreference = "FONT-SIZE"; +  	/* Default logdir is ~/TeleMetrum */  	final static String logdirName = "TeleMetrum"; @@ -88,6 +91,10 @@ class AltosPreferences {  	/* Scanning telemetry */  	static int scanning_telemetry; +	static LinkedList<AltosFontListener> font_listeners; + +	static int font_size = Altos.font_size_medium; +  	/* List of frequencies */  	final static String common_frequencies_node_name = "COMMON-FREQUENCIES";  	static AltosFrequency[] common_frequencies; @@ -164,6 +171,11 @@ class AltosPreferences {  		scanning_telemetry = preferences.getInt(scanningTelemetryPreference,(1 << Altos.ao_telemetry_standard)); +		font_listeners = new LinkedList<AltosFontListener>(); + +		font_size = preferences.getInt(fontSizePreference, Altos.font_size_medium); +		Altos.set_fonts(font_size); +  		String firmwaredir_string = preferences.get(firmwaredirPreference, null);  		if (firmwaredir_string != null)  			firmwaredir = new File(firmwaredir_string); @@ -335,6 +347,36 @@ class AltosPreferences {  		return firmwaredir;  	} +	public static int font_size() { +		return font_size; +	} + +	static void set_fonts() { +	} + +	public static void set_font_size(int new_font_size) { +		font_size = new_font_size; +		synchronized (preferences) { +			preferences.putInt(fontSizePreference, font_size); +			flush_preferences(); +			Altos.set_fonts(font_size); +			for (AltosFontListener l : font_listeners) +				l.font_size_changed(font_size); +		} +	} + +	public static void register_font_listener(AltosFontListener l) { +		synchronized (preferences) { +			font_listeners.add(l); +		} +	} + +	public static void unregister_font_listener(AltosFontListener l) { +		synchronized (preferences) { +			font_listeners.remove(l); +		} +	} +  	public static void set_serial_debug(boolean new_serial_debug) {  		serial_debug = new_serial_debug;  		AltosSerial.set_debug(serial_debug); diff --git a/altosui/AltosSiteMap.java b/altosui/AltosSiteMap.java index b3fb3c54..c258b3e5 100644 --- a/altosui/AltosSiteMap.java +++ b/altosui/AltosSiteMap.java @@ -146,6 +146,10 @@ public class AltosSiteMap extends JScrollPane implements AltosFlightDisplay {  		// nothing  	} +	public void set_font() { +		// nothing +	} +  	private void loadMap(final AltosSiteMapTile tile,  			     File pngfile, String pngurl)  	{ diff --git a/altosui/AltosTelemetryRecordCompanion.java b/altosui/AltosTelemetryRecordCompanion.java index 11b349e1..52d7f4cf 100644 --- a/altosui/AltosTelemetryRecordCompanion.java +++ b/altosui/AltosTelemetryRecordCompanion.java @@ -36,7 +36,7 @@ public class AltosTelemetryRecordCompanion extends AltosTelemetryRecordRaw {  		companion.tick		= tick;  		companion.board_id      = uint8(5);  		companion.update_period = uint8(6+off); -		for (int i = 0; i < channels; i++) +		for (int i = 0; i < companion.companion_data.length; i++)  			companion.companion_data[i] = uint16(8 + off + i * 2);  	} diff --git a/altosui/Makefile.am b/altosui/Makefile.am index f626d3fa..ba1c830c 100644 --- a/altosui/Makefile.am +++ b/altosui/Makefile.am @@ -57,6 +57,7 @@ altosui_JAVA = \  	AltosFlightStatsTable.java \  	AltosFlightStatus.java \  	AltosFlightUI.java \ +	AltosFontListener.java \  	AltosFrequency.java \  	AltosFreqList.java \  	AltosGPS.java \ diff --git a/altosui/altos-windows.nsi b/altosui/altos-windows.nsi index 70dc03ca..cbcb389d 100644 --- a/altosui/altos-windows.nsi +++ b/altosui/altos-windows.nsi @@ -1,7 +1,7 @@  !addplugindir Instdrv/NSIS/Plugins  ; Definitions for Java 1.6 Detection  !define JRE_VERSION "1.6" -!define JRE_URL "http://javadl.sun.com/webapps/download/AutoDL?BundleId=18714&/jre-6u5-windows-i586-p.exe" +!define JRE_URL "http://javadl.sun.com/webapps/download/AutoDL?BundleId=52247&/jre-6u27-windows-i586-p.exe"  !define PRODUCT_NAME "Altus Metrum Windows Software"  Name "Altus Metrum Installer" @@ -23,7 +23,7 @@ ShowInstDetails Show  ComponentText "Altus Metrum Software and Driver Installer"  Function GetJRE -        MessageBox MB_OK "${PRODUCT_NAME} uses Java ${JRE_VERSION}, it will now \ +        MessageBox MB_OK "${PRODUCT_NAME} uses Java ${JRE_VERSION} 32-bit, it will now \                           be downloaded and installed"          StrCpy $2 "$TEMP\Java Runtime Environment.exe" diff --git a/doc/altusmetrum.xsl b/doc/altusmetrum.xsl index 601b62eb..df1e6635 100644 --- a/doc/altusmetrum.xsl +++ b/doc/altusmetrum.xsl @@ -1538,6 +1538,13 @@ NAR #88757, TRA #12200          </para>        </section>        <section> +	<title>Font Size</title> +	<para> +	  Selects the set of fonts used in the flight monitor +	  window. Choose between the small, medium and large sets. +	</para> +      </section> +      <section>          <title>Serial Debug</title>          <para>            This causes all communication with a connected device to be  | 
