]> gitweb.fperrin.net Git - GpsPrune.git/blobdiff - tim/prune/GpsPruner.java
Version 12, December 2010
[GpsPrune.git] / tim / prune / GpsPruner.java
index ac61501a2cadc025315918261f138fcc91f367ef..217d7d429ceee7036d72058d6987527e63b27758 100644 (file)
@@ -2,6 +2,7 @@ package tim.prune;
 
 import java.awt.event.WindowAdapter;
 import java.awt.BorderLayout;
+import java.awt.Component;
 import java.awt.event.WindowEvent;
 import java.io.File;
 import java.io.FileNotFoundException;
@@ -15,6 +16,7 @@ import javax.swing.WindowConstants;
 import tim.prune.config.Config;
 import tim.prune.config.ConfigException;
 import tim.prune.gui.DetailsDisplay;
+import tim.prune.gui.SidebarController;
 import tim.prune.gui.IconManager;
 import tim.prune.gui.MenuManager;
 import tim.prune.gui.SelectorDisplay;
@@ -33,9 +35,9 @@ import tim.prune.gui.profile.ProfileChart;
 public class GpsPruner
 {
        /** Version number of application, used in about screen and for version check */
-       public static final String VERSION_NUMBER = "10";
+       public static final String VERSION_NUMBER = "12";
        /** Build number, just used for about screen */
-       public static final String BUILD_NUMBER = "189";
+       public static final String BUILD_NUMBER = "223";
        /** Static reference to App object */
        private static App APP = null;
 
@@ -65,12 +67,7 @@ public class GpsPruner
                for (int i=0; i<args.length; i++)
                {
                        String arg = args[i];
-                       if (arg.startsWith("--locale="))
-                       {
-                               localeCode = arg.substring(9);
-                               locale = getLanguage(localeCode);
-                       }
-                       else if (arg.startsWith("--lang="))
+                       if (arg.startsWith("--lang="))
                        {
                                localeCode = arg.substring(7);
                                locale = getLanguage(localeCode);
@@ -102,7 +99,7 @@ public class GpsPruner
                if (showUsage) {
                        System.out.println("Possible parameters:"
                                + "\n   --configfile=<file> used to specify a configuration file"
-                               + "\n   --lang=<code> or --locale=<code>  used to specify language"
+                               + "\n   --lang=<code>       used to specify language code such as DE"
                                + "\n   --langfile=<file>   used to specify an alternative language file\n");
                }
                // Initialise configuration if selected
@@ -162,7 +159,7 @@ public class GpsPruner
                {
                        return new Locale(inString);
                }
-               else if (inString.length() == 5)
+               else if (inString.length() == 5 && inString.charAt(2) == '_')
                {
                        return new Locale(inString.substring(0, 2), inString.substring(3));
                }
@@ -206,15 +203,15 @@ public class GpsPruner
                UpdateMessageBroker.informSubscribers("Prune v" + VERSION_NUMBER);
 
                // Arrange in the frame using split panes
-               JSplitPane midPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, mapDisp, profileDisp);
-               midPane.setResizeWeight(1.0); // allocate as much space as poss to map
-               JSplitPane triplePane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, midPane, rightPanel);
-               triplePane.setResizeWeight(1.0); // allocate as much space as poss to map
+               JSplitPane midSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT, mapDisp, profileDisp);
+               midSplit.setResizeWeight(1.0); // allocate as much space as poss to map
+               JSplitPane rightSplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, midSplit, rightPanel);
+               rightSplit.setResizeWeight(1.0); // allocate as much space as poss to map
 
                frame.getContentPane().setLayout(new BorderLayout());
                frame.getContentPane().add(toolbar, BorderLayout.NORTH);
-               frame.getContentPane().add(new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftPanel,
-                       triplePane), BorderLayout.CENTER);
+               JSplitPane leftSplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftPanel, rightSplit);
+               frame.getContentPane().add(leftSplit, BorderLayout.CENTER);
                frame.getContentPane().add(statusBar, BorderLayout.SOUTH);
 
                // add closing listener
@@ -237,8 +234,12 @@ public class GpsPruner
                frame.setSize(650, 450);
                frame.setVisible(true);
                // Set position of map/profile splitter
-               midPane.setDividerLocation(0.75);
+               midSplit.setDividerLocation(0.75);
 
+               // Make a full screen toggler
+               SidebarController fsc = new SidebarController(new Component[] {leftPanel, profileDisp, rightPanel},
+                       new JSplitPane[] {leftSplit, midSplit, rightSplit});
+               APP.setSidebarController(fsc);
                // Finally, give the files to load to the App
                APP.loadDataFiles(inDataFiles);
        }