From ecaf579303705545735450cbc8b8014d7e062329 Mon Sep 17 00:00:00 2001
From: Normand Briere <nbriere@noware.ca>
Date: Sat, 07 Jul 2018 18:44:29 -0400
Subject: [PATCH] Timeline integrated

---
 ObjEditor.java                        |   15 ++-
 timeflow/app/TimeflowApp.java         |   89 ++++++++++------------
 GroupEditor.java                      |   18 ++--
 GrafreeD.java                         |   17 ++--
 timeflow/app/TimeflowAppLauncher.java |   92 +++++++++++++----------
 5 files changed, 118 insertions(+), 113 deletions(-)

diff --git a/GrafreeD.java b/GrafreeD.java
index ea65a13..ac56d92 100644
--- a/GrafreeD.java
+++ b/GrafreeD.java
@@ -50,7 +50,7 @@
         universe.material = new cMaterial();
         //god.addChild(universe);
         universe.name = "Applet";
-        theApplet3D = this;
+        grafreeD = this;
     }
 
     /**/
@@ -750,16 +750,17 @@
 
         //Monitor mon=MonitorFactory.start("myFirstMonitor");
         standAlone = true;
-        theApplet3D = new GrafreeD();
-        theApplet3D.universe = new Composite();
-        theApplet3D.universe.name = "Scene";
-        theApplet3D.universe.material = new cMaterial();
+        grafreeD = new GrafreeD();
+        grafreeD.universe = new Composite();
+        grafreeD.universe.name = "Scene";
+        grafreeD.universe.material = new cMaterial();
         //   theApplet3D.universe.textures = CameraPane.DEFAULT_TEXTURE;
 
-        theApplet3D.universe.root = true;
-        theApplet3D.universe.openEditWindow(null, true); //, true);
+        grafreeD.universe.root = true;
+        grafreeD.universe.openEditWindow(null, true); //, true);
         //mon.stop();
         //System.out.println(mon);
+        //timeflow.app.TimeflowAppLauncher.GetTimeFlow();
     }
 
     // Timer callback
@@ -984,7 +985,7 @@
         } while (avail > 0 && numRead >= 0);
         return new String(data, 0, pos, "US-ASCII");
     }
-    public static GrafreeD theApplet3D;
+    public static GrafreeD grafreeD;
     public static boolean standAlone = true;
     public Composite universe;
     public static Object3D clipboard = new Object3D();
diff --git a/GroupEditor.java b/GroupEditor.java
index d7a1c3e..d3c66a5 100644
--- a/GroupEditor.java
+++ b/GroupEditor.java
@@ -1794,7 +1794,7 @@
 		if (event.getSource() == invariantsItem)
 		{
                     System.out.println("Invariants:");
-                    GrafreeD.theApplet3D.universe.invariants();
+                    GrafreeD.grafreeD.universe.invariants();
 		} else
 		if (event.getSource() == memoryItem)
 		{
@@ -2638,7 +2638,7 @@
                     // bug
                     //gridPanel.setDividerLocation(1.0);
                     //bigPanel.setDividerLocation(0.0);
-                    bigThree.remove(jtp);
+                    bigThree.remove(scenePanel);
                     bigThree.remove(cameraPanel);
                     bigThree.remove(XYZPanel);
                     aWindowConstraints.gridx = 0;
@@ -2666,7 +2666,7 @@
 		if (event.getSource() == threeButton)
 		{
                     radio.layout = threeButton;
-                    bigThree.remove(jtp);
+                    bigThree.remove(scenePanel);
                     bigThree.remove(cameraPanel);
                     bigThree.remove(XYZPanel);
                     aWindowConstraints.gridx = 0;
@@ -2694,7 +2694,7 @@
 		if (event.getSource() == fourButton)
 		{
                     radio.layout = fourButton;
-                    bigThree.remove(jtp);
+                    bigThree.remove(scenePanel);
                     bigThree.remove(cameraPanel);
                     bigThree.remove(XYZPanel);
                     aWindowConstraints.gridx = 0;
@@ -2704,7 +2704,7 @@
                     aWindowConstraints.fill = GridBagConstraints.BOTH;
                     aWindowConstraints.weightx = 1;
                     aWindowConstraints.weighty = 1;
-                    bigThree.add(jtp, aWindowConstraints);
+                    bigThree.add(scenePanel, aWindowConstraints);
                     aWindowConstraints.weightx = 1;
                     aWindowConstraints.gridwidth = 3;
               //      aConstraints.gridheight = 3;
@@ -2722,7 +2722,7 @@
 		if (event.getSource() == sixButton)
 		{
                     radio.layout = sixButton;
-                    bigThree.remove(jtp);
+                    bigThree.remove(scenePanel);
                     bigThree.remove(cameraPanel);
                     bigThree.remove(XYZPanel);
                     aWindowConstraints.gridx = 0;
@@ -2732,7 +2732,7 @@
                     aWindowConstraints.fill = GridBagConstraints.VERTICAL;
                     aWindowConstraints.weightx = 0;
                     aWindowConstraints.weighty = 1;
-                    bigThree.add(jtp, aWindowConstraints);
+                    bigThree.add(scenePanel, aWindowConstraints);
                     aWindowConstraints.weightx = 1;
                     aWindowConstraints.gridwidth = 3;
               //      aWindowConstraints.gridheight = 3;
@@ -2750,7 +2750,7 @@
 		if (event.getSource() == sevenButton)
 		{
                     radio.layout = sevenButton;
-                    bigThree.remove(jtp);
+                    bigThree.remove(scenePanel);
                     bigThree.remove(cameraPanel);
                     bigThree.remove(XYZPanel);
                     aWindowConstraints.gridx = 0;
@@ -2760,7 +2760,7 @@
                     aWindowConstraints.fill = GridBagConstraints.VERTICAL;
                     aWindowConstraints.weightx = 0;
                     aWindowConstraints.weighty = 1;
-                    bigThree.add(jtp, aWindowConstraints);
+                    bigThree.add(scenePanel, aWindowConstraints);
                     aWindowConstraints.weightx = 1;
                     aWindowConstraints.gridwidth = 3;
                //     aWindowConstraints.gridheight = 3;
diff --git a/ObjEditor.java b/ObjEditor.java
index a7f467c..4b1a4fd 100644
--- a/ObjEditor.java
+++ b/ObjEditor.java
@@ -1161,6 +1161,7 @@
 		/*JPanel*/ cameraPanel =
                 new JPanel(new BorderLayout());
         cameraPanel.add(cameraView);
+        //new timeflow.app.TimeflowApp().TimeFlowWindow(cameraPanel, frame);
 
         //topView.camera = ;
         //frontView.camera = new Camera(2);
@@ -1244,15 +1245,15 @@
         scrollpane.setWheelScrollingEnabled(true);
         scrollpane.addMouseWheelListener(this); // Default not fast enough
 
-        /*JTabbedPane*/ jtp = new JTabbedPane();
-        jtp.add(scrollpane);
+        /*JTabbedPane*/ scenePanel = new JTabbedPane();
+        scenePanel.add(scrollpane);
 
-        jtp.add(FSPane = new cFileSystemPane(this));
+        scenePanel.add(FSPane = new cFileSystemPane(this));
 
         optionsPanel = new JPanel(new GridBagLayout());
 
         optionsPanel.setName("Options");
-        jtp.add(optionsPanel);
+        scenePanel.add(optionsPanel);
 
 
         /*
@@ -1275,7 +1276,7 @@
         jtp.add(tree);
          */
 
-        bigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, jtp, gridPanel);
+        bigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, scenePanel, gridPanel);
         bigPanel.setContinuousLayout(true);
         bigPanel.setOneTouchExpandable(true);
         bigPanel.setDividerLocation(0.8);
@@ -1297,7 +1298,7 @@
         aWindowConstraints.fill = GridBagConstraints.VERTICAL;
         aWindowConstraints.weightx = 0;
         aWindowConstraints.weighty = 1;
-        bigThree.add(jtp, aWindowConstraints);
+        bigThree.add(scenePanel, aWindowConstraints);
         aWindowConstraints.weightx = 1;
         aWindowConstraints.gridwidth = 3;
         //	aConstraints.gridheight = 3;
@@ -4471,7 +4472,7 @@
     JSplitPane gridPanel;
     JSplitPane bigPanel;
     JPanel bigThree;
-    JTabbedPane jtp;
+    JTabbedPane scenePanel;
     JPanel cameraPanel;
     JSplitPane framePanel;
     JTextArea/*Field*/ nameField;
diff --git a/timeflow/app/TimeflowApp.java b/timeflow/app/TimeflowApp.java
index b7b8442..4c1f460 100755
--- a/timeflow/app/TimeflowApp.java
+++ b/timeflow/app/TimeflowApp.java
@@ -25,7 +25,6 @@
 
 public class TimeflowApp extends JFrame
 {
-
         public TFModel model = new TFModel();
         public JFileChooser fileChooser;
         AboutWindow splash;
@@ -39,7 +38,6 @@
         LinkTabPane leftPanel;
         TFListener filterMenuMaker = new TFListener()
         {
-
                 @Override
                 public void note(TFEvent e)
                 {
@@ -70,35 +68,8 @@
                 }
         };
 
-        void splash(boolean visible)
+        public void TimeFlowWindow(Container container, JFrame frame) throws HeadlessException
         {
-                splash.setVisible(visible);
-        }
-
-        public void init() throws Exception
-        {
-                Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
-                setBounds(0, 0, Math.min(d.width, 1200), Math.min(d.height, 900));
-                setTitle(Display.version());
-                setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
-                final QuitAction quitAction = new QuitAction(this, model);
-                addWindowListener(new WindowAdapter()
-                {
-
-                        @Override
-                        public void windowClosing(WindowEvent e)
-                        {
-                                quitAction.quit();
-                        }
-
-                        public void windowStateChanged(WindowEvent e)
-                        {
-                                repaint();
-                        }
-                });
-                Image icon = Toolkit.getDefaultToolkit().getImage("images/icon.gif");
-                setIconImage(icon);
-
                 // read example directory
                 String[] ex = getVisibleFiles("settings/examples");
                 int n = ex.length;
@@ -115,11 +86,11 @@
                 templates = getVisibleFiles("settings/templates");
                 fileChooser = new JFileChooser(state.getCurrentFile());
 
-                getContentPane().setLayout(new BorderLayout());
+                container.setLayout(new BorderLayout());
 
                 // left tab area, with vertical gray divider.
                 JPanel leftHolder = new JPanel();
-                getContentPane().add(leftHolder, BorderLayout.WEST);
+                container.add(leftHolder, BorderLayout.WEST);
 
                 leftHolder.setLayout(new BorderLayout());
                 JPanel pad = new Pad(3, 3);
@@ -148,11 +119,10 @@
                 // center tab area
 
                 final LinkTabPane center = new LinkTabPane();
-                getContentPane().add(center, BorderLayout.CENTER);
+                container.add(center, BorderLayout.CENTER);
 
                 center.addPropertyChangeListener(new PropertyChangeListener()
                 {
-
                         @Override
                         public void propertyChange(PropertyChangeEvent evt)
                         {
@@ -187,7 +157,6 @@
                 // but then, once data is loaded, switch directly to the timeline view.
                 model.addListener(new TFListener()
                 {
-
                         @Override
                         public void note(TFEvent e)
                         {
@@ -203,7 +172,7 @@
                 });
 
                 JMenuBar menubar = new JMenuBar();
-                setJMenuBar(menubar);
+                frame.setJMenuBar(menubar);
 
                 JMenu fileMenu = new JMenu("File");
                 menubar.add(fileMenu);
@@ -236,7 +205,6 @@
                 fileMenu.add(open);
                 open.addActionListener(new ActionListener()
                 {
-
                         @Override
                         public void actionPerformed(ActionEvent e)
                         {
@@ -254,7 +222,6 @@
                 fileMenu.add(impDel);
                 impDel.addActionListener(new ActionListener()
                 {
-
                         @Override
                         public void actionPerformed(ActionEvent e)
                         {
@@ -273,7 +240,6 @@
                 save.setEnabled(false);
                 save.addActionListener(new ActionListener()
                 {
-
                         @Override
                         public void actionPerformed(ActionEvent e)
                         {
@@ -283,7 +249,6 @@
                 });
                 model.addListener(new TFListener()
                 {
-
                         @Override
                         public void note(TFEvent e)
                         {
@@ -295,7 +260,6 @@
                 fileMenu.add(saveAs);
                 saveAs.addActionListener(new ActionListener()
                 {
-
                         @Override
                         public void actionPerformed(ActionEvent e)
                         {
@@ -309,7 +273,6 @@
                 fileMenu.add(exportTSV);
                 exportTSV.addActionListener(new ActionListener()
                 {
-
                         @Override
                         public void actionPerformed(ActionEvent e)
                         {
@@ -320,7 +283,6 @@
                 fileMenu.add(exportCSV);
                 exportCSV.addActionListener(new ActionListener()
                 {
-
                         @Override
                         public void actionPerformed(ActionEvent e)
                         {
@@ -331,15 +293,14 @@
                 fileMenu.add(exportHTML);
                 exportHTML.addActionListener(new ActionListener()
                 {
-
                         @Override
                         public void actionPerformed(ActionEvent e)
                         {
                                 exportHtml();
                         }
                 });
-                fileMenu.addSeparator();
-                fileMenu.add(quitAction);
+//                fileMenu.addSeparator();
+//                fileMenu.add(quitAction);
 
                 JMenu editMenu = new JMenu("Edit");
                 menubar.add(editMenu);
@@ -370,7 +331,6 @@
                         final String file = examples[i][1];
                         example.addActionListener(new ActionListener()
                         {
-
                                 @Override
                                 public void actionPerformed(ActionEvent e)
                                 {
@@ -388,7 +348,6 @@
                 helpMenu.add(about);
                 about.addActionListener(new ActionListener()
                 {
-
                         @Override
                         public void actionPerformed(ActionEvent e)
                         {
@@ -398,7 +357,6 @@
 
                 model.addListener(new TFListener()
                 {
-
                         @Override
                         public void note(TFEvent e)
                         {
@@ -416,6 +374,39 @@
                 });
         }
 
+        void splash(boolean visible)
+        {
+                splash.setVisible(visible);
+        }
+
+        public void init() throws Exception
+        {
+                Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
+                setBounds(0, 0, Math.min(d.width, 1200), Math.min(d.height, 900));
+                setTitle(Display.version());
+                setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
+//                final QuitAction quitAction = new QuitAction(this, model);
+//                addWindowListener(new WindowAdapter()
+//                {
+//                        @Override
+//                        public void windowClosing(WindowEvent e)
+//                        {
+//                                quitAction.quit();
+//                        }
+//
+//                        public void windowStateChanged(WindowEvent e)
+//                        {
+//                                repaint();
+//                        }
+//                });
+                Image icon = Toolkit.getDefaultToolkit().getImage("images/icon.gif");
+                setIconImage(icon);
+
+                Container container = getContentPane();
+
+                TimeFlowWindow(container, this);
+        }
+
         void makeRecentFileMenu()
         {
                 openRecent.removeAll();
diff --git a/timeflow/app/TimeflowAppLauncher.java b/timeflow/app/TimeflowAppLauncher.java
index f034666..311adbb 100755
--- a/timeflow/app/TimeflowAppLauncher.java
+++ b/timeflow/app/TimeflowAppLauncher.java
@@ -7,46 +7,58 @@
 
 // For some reason we have to do this in a separate class in order to
 // get the menubar working right on the Mac.
+public class TimeflowAppLauncher
+{
+        public static void main(String[] args) throws Exception
+        {
+                System.setProperty("apple.laf.useScreenMenuBar", "true");
+                System.setProperty("com.apple.mrj.application.apple.menu.about.name", "TimeFlow");
+                System.out.println("Running " + Display.version());
 
-public class TimeflowAppLauncher {
-	public static void main(String[] args) throws Exception
-	{
-		System.setProperty("apple.laf.useScreenMenuBar", "true");
-		System.setProperty("com.apple.mrj.application.apple.menu.about.name", "TimeFlow");
-		System.out.println("Running "+Display.version());
-		
-		try {
-	        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
-	    } 
-	    catch (Exception e) {
-	       System.out.println("Can't set system look & feel");
-	    }		
-		
-		final TimeflowApp t=new TimeflowApp();
-		t.splash=new AboutWindow(t, t.model.getDisplay());
-		t.splash(true);
-		SwingUtilities.invokeLater(new Runnable() {
-			@Override
-			public void run() {
-				try
-				{
-					t.init();
-					t.setVisible(true);				
-				}
-				catch (Exception e)
-				{
-					e.printStackTrace(System.out);
-				}
-				t.splash.addMouseListener(new MouseAdapter() {
+                try
+                {
+                        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
+                } catch (Exception e)
+                {
+                        System.out.println("Can't set system look & feel");
+                }
+                
+                GetTimeFlow();
+        }
 
-					@Override
-					public void mouseClicked(MouseEvent e) {
-						t.splash.setVisible(false);
-					}}
-				);
-				t.splash(false);
-				//t.splash.message=t.model.getDisplay().version();
-			}});
-		
-	}
+        public static TimeflowApp GetTimeFlow()
+        {
+                final TimeflowApp t = new TimeflowApp();
+                t.splash = new AboutWindow(t, t.model.getDisplay());
+                t.splash(true);
+                SwingUtilities.invokeLater(new Runnable()
+                {
+
+                        @Override
+                        public void run()
+                        {
+                                try
+                                {
+                                        t.init();
+                                        t.setVisible(true);
+                                } catch (Exception e)
+                                {
+                                        e.printStackTrace(System.out);
+                                }
+                                t.splash.addMouseListener(new MouseAdapter()
+                                {
+
+                                        @Override
+                                        public void mouseClicked(MouseEvent e)
+                                        {
+                                                t.splash.setVisible(false);
+                                        }
+                                });
+                                t.splash(false);
+                                //t.splash.message=t.model.getDisplay().version();
+                        }
+                });
+                
+                return t;
+        }
 }

--
Gitblit v1.6.2