altosui: Remove duplicate AltosUIPreferences.java
authorKeith Packard <keithp@keithp.com>
Sun, 20 Jan 2013 23:39:53 +0000 (15:39 -0800)
committerKeith Packard <keithp@keithp.com>
Sun, 20 Jan 2013 23:45:16 +0000 (15:45 -0800)
This lives in altosuilib now. Several files needed imports of
altosuilib added as a result.

Signed-off-by: Keith Packard <keithp@keithp.com>
altosui/AltosDataChooser.java
altosui/AltosFreqList.java
altosui/AltosSiteMap.java
altosui/AltosUIPreferences.java [deleted file]
altosui/AltosVoice.java
altosui/Makefile.am

index a8a2ca4928e564428b95a2753aaebc71ba623f25..242af9ad4876c76c6ef036269b49415450f1a943 100644 (file)
@@ -21,6 +21,7 @@ import javax.swing.*;
 import javax.swing.filechooser.FileNameExtensionFilter;
 import java.io.*;
 import org.altusmetrum.AltosLib.*;
+import org.altusmetrum.altosuilib.*;
 
 public class AltosDataChooser extends JFileChooser {
        JFrame  frame;
index 4edf088c5246acd2de2b775b3b2d7ed3b936a1ab..cc1f07efe6f0158f4f2b268cdfbb884484a4cc5f 100644 (file)
@@ -19,6 +19,7 @@ package altosui;
 
 import javax.swing.*;
 import org.altusmetrum.AltosLib.*;
+import org.altusmetrum.altosuilib.*;
 
 public class AltosFreqList extends JComboBox {
 
index 4e939b885d5bf446352cb9688de5ae6273736652..144d506df3fc428bf49d556788282905e1fe2e3e 100644 (file)
@@ -24,6 +24,7 @@ import java.lang.Math;
 import java.awt.geom.Point2D;
 import java.util.concurrent.*;
 import org.altusmetrum.AltosLib.*;
+import org.altusmetrum.altosuilib.*;
 
 public class AltosSiteMap extends JScrollPane implements AltosFlightDisplay {
        // preferred vertical step in a tile in naut. miles
diff --git a/altosui/AltosUIPreferences.java b/altosui/AltosUIPreferences.java
deleted file mode 100644 (file)
index 9c56d03..0000000
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * 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;
-
-import java.io.*;
-import java.util.*;
-import java.awt.Component;
-import javax.swing.*;
-import org.altusmetrum.AltosLib.*;
-import org.altusmetrum.altosuilib.*;
-
-public class AltosUIPreferences extends AltosPreferences {
-
-       /* font size preferences name */
-       final static String fontSizePreference = "FONT-SIZE";
-
-       /* Look&Feel preference name */
-       final static String lookAndFeelPreference = "LOOK-AND-FEEL";
-
-       /* UI Component to pop dialogs up */
-       static Component component;
-
-       static LinkedList<AltosFontListener> font_listeners;
-
-       static int font_size = Altos.font_size_medium;
-
-       static LinkedList<AltosUIListener> ui_listeners;
-
-       static String look_and_feel = null;
-
-       /* Serial debug */
-       static boolean serial_debug;
-
-       public static void init() {
-               AltosPreferences.init(new AltosUIPreferencesBackend());
-
-               font_listeners = new LinkedList<AltosFontListener>();
-
-               font_size = backend.getInt(fontSizePreference, Altos.font_size_medium);
-               Altos.set_fonts(font_size);
-               look_and_feel = backend.getString(lookAndFeelPreference, UIManager.getSystemLookAndFeelClassName());
-
-               ui_listeners = new LinkedList<AltosUIListener>();
-               serial_debug = backend.getBoolean(serialDebugPreference, false);
-               AltosLink.set_debug(serial_debug);
-       }
-
-       static { init(); }
-
-       static void set_component(Component in_component) {
-               component = in_component;
-       }
-
-       private static boolean check_dir(File dir) {
-               if (!dir.exists()) {
-                       if (!dir.mkdirs()) {
-                               JOptionPane.showMessageDialog(component,
-                                                             dir.getName(),
-                                                             "Cannot create directory",
-                                                             JOptionPane.ERROR_MESSAGE);
-                               return false;
-                       }
-               } else if (!dir.isDirectory()) {
-                       JOptionPane.showMessageDialog(component,
-                                                     dir.getName(),
-                                                     "Is not a directory",
-                                                     JOptionPane.ERROR_MESSAGE);
-                       return false;
-               }
-               return true;
-       }
-
-       /* Configure the log directory. This is where all telemetry and eeprom files
-        * will be written to, and where replay will look for telemetry files
-        */
-       public static void ConfigureLog() {
-               JFileChooser    logdir_chooser = new JFileChooser(logdir.getParentFile());
-
-               logdir_chooser.setDialogTitle("Configure Data Logging Directory");
-               logdir_chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
-
-               if (logdir_chooser.showDialog(component, "Select Directory") == JFileChooser.APPROVE_OPTION) {
-                       File dir = logdir_chooser.getSelectedFile();
-                       if (check_dir(dir))
-                               set_logdir(dir);
-               }
-       }
-       public static int font_size() {
-               synchronized (backend) {
-                       return font_size;
-               }
-       }
-
-       static void set_fonts() {
-       }
-
-       public static void set_font_size(int new_font_size) {
-               synchronized (backend) {
-                       font_size = new_font_size;
-                       backend.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 (backend) {
-                       font_listeners.add(l);
-               }
-       }
-
-       public static void unregister_font_listener(AltosFontListener l) {
-               synchronized (backend) {
-                       font_listeners.remove(l);
-               }
-       }
-
-       public static void set_look_and_feel(String new_look_and_feel) {
-               try {
-                       UIManager.setLookAndFeel(new_look_and_feel);
-               } catch (Exception e) {
-               }
-               synchronized(backend) {
-                       look_and_feel = new_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 (backend) {
-                       return look_and_feel;
-               }
-       }
-
-       public static void register_ui_listener(AltosUIListener l) {
-               synchronized(backend) {
-                       ui_listeners.add(l);
-               }
-       }
-
-       public static void unregister_ui_listener(AltosUIListener l) {
-               synchronized (backend) {
-                       ui_listeners.remove(l);
-               }
-       }
-       public static void set_serial_debug(boolean new_serial_debug) {
-               AltosLink.set_debug(new_serial_debug);
-               synchronized (backend) {
-                       serial_debug = new_serial_debug;
-                       backend.putBoolean(serialDebugPreference, serial_debug);
-                       flush_preferences();
-               }
-       }
-
-       public static boolean serial_debug() {
-               synchronized (backend) {
-                       return serial_debug;
-               }
-       }
-
-}
index f84c11220393ba7ad7fcff1a7ec2f248a19c46b0..775c13d51f39c83c9ad2c5c2975d51fcbc12ba7f 100644 (file)
@@ -20,6 +20,7 @@ package altosui;
 import com.sun.speech.freetts.Voice;
 import com.sun.speech.freetts.VoiceManager;
 import java.util.concurrent.LinkedBlockingQueue;
+import org.altusmetrum.altosuilib.*;
 
 public class AltosVoice implements Runnable {
        VoiceManager                    voice_manager;
index 7d000f7b9ba7c270ddcd4f55b71413a40ce87de0..f5b83ce7c7ede2ff85c0a28a990dd73f49206ed9 100644 (file)
@@ -62,7 +62,6 @@ altosui_JAVA = \
        AltosLed.java \
        AltosLights.java \
        AltosPad.java \
-       AltosUIPreferences.java \
        AltosUIPreferencesBackend.java \
        AltosRomconfig.java \
        AltosRomconfigUI.java \