import java.io.*;
import java.util.*;
-import java.text.*;
-import java.util.prefs.*;
-import java.util.concurrent.LinkedBlockingQueue;
import java.awt.Component;
import javax.swing.*;
-import javax.swing.filechooser.FileSystemView;
import org.altusmetrum.AltosLib.*;
+import org.altusmetrum.altosuilib.*;
public class AltosUIPreferences extends AltosPreferences {
static boolean serial_debug;
public static void init() {
+ AltosPreferences.init(new AltosUIPreferencesBackend());
+
font_listeners = new LinkedList<AltosFontListener>();
- font_size = preferences.getInt(fontSizePreference, Altos.font_size_medium);
+ font_size = backend.getInt(fontSizePreference, Altos.font_size_medium);
Altos.set_fonts(font_size);
- look_and_feel = preferences.get(lookAndFeelPreference, UIManager.getSystemLookAndFeelClassName());
+ look_and_feel = backend.getString(lookAndFeelPreference, UIManager.getSystemLookAndFeelClassName());
ui_listeners = new LinkedList<AltosUIListener>();
- serial_debug = preferences.getBoolean(serialDebugPreference, false);
+ serial_debug = backend.getBoolean(serialDebugPreference, false);
AltosLink.set_debug(serial_debug);
}
}
}
public static int font_size() {
- synchronized (preferences) {
+ synchronized (backend) {
return font_size;
}
}
}
public static void set_font_size(int new_font_size) {
- synchronized (preferences) {
+ synchronized (backend) {
font_size = new_font_size;
- preferences.putInt(fontSizePreference, font_size);
+ backend.putInt(fontSizePreference, font_size);
flush_preferences();
Altos.set_fonts(font_size);
for (AltosFontListener l : font_listeners)
}
public static void register_font_listener(AltosFontListener l) {
- synchronized (preferences) {
+ synchronized (backend) {
font_listeners.add(l);
}
}
public static void unregister_font_listener(AltosFontListener l) {
- synchronized (preferences) {
+ synchronized (backend) {
font_listeners.remove(l);
}
}
UIManager.setLookAndFeel(new_look_and_feel);
} catch (Exception e) {
}
- synchronized(preferences) {
+ synchronized(backend) {
look_and_feel = new_look_and_feel;
- preferences.put(lookAndFeelPreference, look_and_feel);
+ backend.putString(lookAndFeelPreference, look_and_feel);
flush_preferences();
for (AltosUIListener l : ui_listeners)
l.ui_changed(look_and_feel);
}
public static String look_and_feel() {
- synchronized (preferences) {
+ synchronized (backend) {
return look_and_feel;
}
}
public static void register_ui_listener(AltosUIListener l) {
- synchronized(preferences) {
+ synchronized(backend) {
ui_listeners.add(l);
}
}
public static void unregister_ui_listener(AltosUIListener l) {
- synchronized (preferences) {
+ synchronized (backend) {
ui_listeners.remove(l);
}
}
public static void set_serial_debug(boolean new_serial_debug) {
AltosLink.set_debug(new_serial_debug);
- synchronized (preferences) {
+ synchronized (backend) {
serial_debug = new_serial_debug;
- preferences.putBoolean(serialDebugPreference, serial_debug);
+ backend.putBoolean(serialDebugPreference, serial_debug);
flush_preferences();
}
}
public static boolean serial_debug() {
- synchronized (preferences) {
+ synchronized (backend) {
return serial_debug;
}
}
-}
\ No newline at end of file
+}