]> gitweb.fperrin.net Git - GpsPrune.git/blobdiff - tim/prune/GpsPruner.java
Version 11.1, August 2010
[GpsPrune.git] / tim / prune / GpsPruner.java
index 7a172a4a64ceeb0a2576de987a4240b3018cc423..5e0c591b76f82e94173c381c3d991e5b10747337 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,13 +16,14 @@ 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.ProfileChart;
 import tim.prune.gui.SelectorDisplay;
 import tim.prune.gui.StatusBar;
 import tim.prune.gui.Viewport;
 import tim.prune.gui.map.MapCanvas;
+import tim.prune.gui.profile.ProfileChart;
 
 /**
  * Prune is a tool to visualize, edit, convert and prune GPS data
@@ -33,12 +35,15 @@ import tim.prune.gui.map.MapCanvas;
 public class GpsPruner
 {
        /** Version number of application, used in about screen and for version check */
-       public static final String VERSION_NUMBER = "9";
+       public static final String VERSION_NUMBER = "11.1";
        /** Build number, just used for about screen */
-       public static final String BUILD_NUMBER = "176";
+       public static final String BUILD_NUMBER = "205";
        /** Static reference to App object */
        private static App APP = null;
 
+       /** Program name, used for Frame title and for Macs also on the system bar */
+       private static final String PROGRAM_NAME = "Prune";
+
 
        /**
         * Main method
@@ -52,6 +57,13 @@ public class GpsPruner
                String configFilename = null;
                ArrayList<File> dataFiles = new ArrayList<File>();
                boolean showUsage = false;
+
+               // Mac OSX - specific properties (Mac insists that this is done as soon as possible)
+               if (System.getProperty("mrj.version") != null) {
+                       System.setProperty("apple.laf.useScreenMenuBar", "true"); // menu at top of screen
+                       System.setProperty("com.apple.mrj.application.apple.menu.about.name", PROGRAM_NAME);
+               }
+               // Loop over given arguments, if any
                for (int i=0; i<args.length; i++)
                {
                        String arg = args[i];
@@ -168,7 +180,8 @@ public class GpsPruner
         */
        private static void launch(ArrayList<File> inDataFiles)
        {
-               JFrame frame = new JFrame("Prune");
+               // Initialise Frame
+               JFrame frame = new JFrame(PROGRAM_NAME);
                APP = new App(frame);
 
                // make menu
@@ -195,15 +208,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
@@ -226,8 +239,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);
        }