summaryrefslogtreecommitdiff
path: root/altosui/AltosPreferences.java
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2011-08-24 19:13:03 -0700
committerKeith Packard <keithp@keithp.com>2011-08-24 19:35:11 -0700
commitcbfbaabb39f9f7709d00cf3dc63cc1bc7563062e (patch)
tree418a3ab5f1bd9db5ff476bb5d70f076d23d0d852 /altosui/AltosPreferences.java
parent9849883a754a73b861dd7be530753ff5c2abb499 (diff)
altosui: Make flight monitor font size configurable
Tiny netbooks aren't tall enough for the 'usual' font size, so provide a smaller option. Then provide a bigger option, just because. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altosui/AltosPreferences.java')
-rw-r--r--altosui/AltosPreferences.java42
1 files changed, 42 insertions, 0 deletions
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);