Merge branch 'master-fixes' into stm-flash-fixes
authorKeith Packard <keithp@keithp.com>
Fri, 10 May 2013 04:06:52 +0000 (21:06 -0700)
committerKeith Packard <keithp@keithp.com>
Fri, 10 May 2013 04:06:52 +0000 (21:06 -0700)
altosdroid/Notebook
altoslib/AltosPreferences.java
configure.ac
micropeak/MicroFileChooser.java
micropeak/MicroPeak.java
micropeak/MicroSave.java

index 9b3839990ae79e50f8d575d638ba4709086e68ac..b4ae2b7f51ef21ac73f8f36ebc9ba6da172d8223 100644 (file)
@@ -26,3 +26,5 @@ Desired AltosDroid feature list
     
  *) Re-loading flight data from .telem file to get back to
     'find my rocket' mode after shutting down the application.
+
+ *) Imperial Units mode
index 392497ef6909de1324a26d62d47db3aba8b1624e..088ca3d7589c7507c1e17afb090158043737a218 100644 (file)
@@ -62,6 +62,9 @@ public class AltosPreferences {
        /* Log directory */
        public static File logdir;
 
+       /* Last log directory - use this next time we open or save something */
+       public static File last_logdir;
+
        /* Map directory -- hangs of logdir */
        public static File mapdir;
 
@@ -198,6 +201,24 @@ public class AltosPreferences {
                }
        }
 
+       public static File last_logdir() {
+               synchronized (backend) {
+                       if (last_logdir == null)
+                               last_logdir = logdir;
+                       return last_logdir;
+               }
+       }
+
+       public static void set_last_logdir(File file) {
+               synchronized(backend) {
+                       if (file != null && !file.isDirectory())
+                               file = file.getParentFile();
+                       if (file == null)
+                               file = new File(".");
+                       last_logdir = file;
+               }
+       }
+
        public static File mapdir() {
                synchronized (backend) {
                        return mapdir;
index 46467705124c995bedc8c9c9980448f07810f354..32ab33a8f0f03f6c56d15aa40070265f84953822 100644 (file)
@@ -148,7 +148,7 @@ fi
 if test "x$ANDROID_SDK" != "xno"; then
        HAVE_ANDROID_SDK="yes"
 else
-       HAVE_ANDROD_SDK="no"
+       HAVE_ANDROID_SDK="no"
 fi
 
 AM_CONDITIONAL([ANDROID], [test x$ANDROID_SDK != xno])
index 7a3423b4e255c056caf29d7776ff72c1721185aa..d52eab2ccf830ead8d532f73ffcb0a7b1bb0e34f 100644 (file)
@@ -50,6 +50,6 @@ public class MicroFileChooser extends JFileChooser {
                setDialogTitle("Select MicroPeak Data File");
                setFileFilter(new FileNameExtensionFilter("MicroPeak data file",
                                                          "mpd"));
-               setCurrentDirectory(AltosUIPreferences.logdir());
+               setCurrentDirectory(AltosUIPreferences.last_logdir());
        }
 }
index 57f17dbe4780abb310feb062688a401572cf9187..792231768808a04011246d2561c29b637bffb8ef 100644 (file)
@@ -64,6 +64,7 @@ public class MicroPeak extends MicroFrame implements ActionListener, ItemListene
                FileInputStream fis = new FileInputStream(filename);
                try {
                        data = new MicroData((InputStream) fis, filename.getName());
+                       AltosUIPreferences.set_last_logdir(filename);
                } catch (InterruptedException ie) {
                        data = null;
                } finally {
index 5088b7d7b0379769f796f07639f1cc910b3ef829..99f621ce8aa18269c408c14010838257c09a131c 100644 (file)
@@ -83,6 +83,7 @@ public class MicroSave extends JFileChooser {
                        }
                        try {
                                save(file, data);
+                               AltosUIPreferences.set_last_logdir(file.getParentFile());
                                data.set_name(filename);
                                return true;
                        } catch (FileNotFoundException fe) {
@@ -101,7 +102,7 @@ public class MicroSave extends JFileChooser {
                setDialogTitle("Save MicroPeak Data File");
                setFileFilter(new FileNameExtensionFilter("MicroPeak data file",
                                                          "mpd"));
-               setCurrentDirectory(AltosUIPreferences.logdir());
+               setCurrentDirectory(AltosUIPreferences.last_logdir());
                setSelectedFile(MicroFile.make());
        }
 }