From f4160780a4d8278920b99ada1050f320d6e30a73 Mon Sep 17 00:00:00 2001
From: Normand Briere <nbriere@noware.ca>
Date: Sun, 08 Jul 2018 10:29:46 -0400
Subject: [PATCH] Timeline activated

---
 ObjEditor.java                |   59 +++++++++++++++++++++--------
 timeflow/app/TimeflowApp.java |   11 +++--
 GroupEditor.java              |   24 ++++++-----
 Object3D.java                 |    1 
 cButton.java                  |   10 +++++
 5 files changed, 74 insertions(+), 31 deletions(-)

diff --git a/GroupEditor.java b/GroupEditor.java
index d3c66a5..aafbf22 100644
--- a/GroupEditor.java
+++ b/GroupEditor.java
@@ -520,6 +520,9 @@
 		
 		oe.toolbarPanel.add(flashSelectionButton = new cButton(" ? ")); //, oe.aConstraints);
 		flashSelectionButton.addActionListener(this);
+                
+		oe.toolbarPanel.add(new cButton("     ", false));
+                
 		oe.aConstraints.gridx += 1;
 		oe.aConstraints.weighty = 0;
 		oe.aConstraints.gridwidth = 1;
@@ -715,8 +718,7 @@
                     dropAttributes |= Object3D.TEXTURE;
                 else
                     dropAttributes &= ~Object3D.TEXTURE;
-            }
-            else if(e.getSource() == liveCB)
+            } else if(e.getSource() == liveCB)
             {
                 cameraView.ToggleLive();
             }
@@ -2639,7 +2641,7 @@
                     //gridPanel.setDividerLocation(1.0);
                     //bigPanel.setDividerLocation(0.0);
                     bigThree.remove(scenePanel);
-                    bigThree.remove(cameraPanel);
+                    bigThree.remove(centralPanel);
                     bigThree.remove(XYZPanel);
                     aWindowConstraints.gridx = 0;
                     aWindowConstraints.gridy = 0;
@@ -2654,7 +2656,7 @@
             //        aConstraints.gridheight = 3;
                     aWindowConstraints.gridx = 1;
                     aWindowConstraints.fill = GridBagConstraints.BOTH;
-                    bigThree.add(cameraPanel, aWindowConstraints);
+                    bigThree.add(centralPanel, aWindowConstraints);
                     aWindowConstraints.weightx = 0;
                     aWindowConstraints.gridx = 4;
                     aWindowConstraints.gridwidth = 1;
@@ -2667,7 +2669,7 @@
 		{
                     radio.layout = threeButton;
                     bigThree.remove(scenePanel);
-                    bigThree.remove(cameraPanel);
+                    bigThree.remove(centralPanel);
                     bigThree.remove(XYZPanel);
                     aWindowConstraints.gridx = 0;
                     aWindowConstraints.gridy = 0;
@@ -2682,7 +2684,7 @@
             //        aConstraints.gridheight = 3;
                     aWindowConstraints.gridx = 1;
                     aWindowConstraints.fill = GridBagConstraints.BOTH;
-                    bigThree.add(cameraPanel, aWindowConstraints);
+                    bigThree.add(centralPanel, aWindowConstraints);
                     aWindowConstraints.weightx = 0;
                     aWindowConstraints.gridx = 4;
                     aWindowConstraints.gridwidth = 1;
@@ -2695,7 +2697,7 @@
 		{
                     radio.layout = fourButton;
                     bigThree.remove(scenePanel);
-                    bigThree.remove(cameraPanel);
+                    bigThree.remove(centralPanel);
                     bigThree.remove(XYZPanel);
                     aWindowConstraints.gridx = 0;
                     aWindowConstraints.gridy = 0;
@@ -2723,7 +2725,7 @@
 		{
                     radio.layout = sixButton;
                     bigThree.remove(scenePanel);
-                    bigThree.remove(cameraPanel);
+                    bigThree.remove(centralPanel);
                     bigThree.remove(XYZPanel);
                     aWindowConstraints.gridx = 0;
                     aWindowConstraints.gridy = 0;
@@ -2738,7 +2740,7 @@
               //      aWindowConstraints.gridheight = 3;
                     aWindowConstraints.gridx = 1;
                     aWindowConstraints.fill = GridBagConstraints.BOTH;
-                    bigThree.add(cameraPanel, aWindowConstraints);
+                    bigThree.add(centralPanel, aWindowConstraints);
                     aWindowConstraints.weightx = 0;
                     aWindowConstraints.gridx = 4;
                     aWindowConstraints.gridwidth = 1;
@@ -2751,7 +2753,7 @@
 		{
                     radio.layout = sevenButton;
                     bigThree.remove(scenePanel);
-                    bigThree.remove(cameraPanel);
+                    bigThree.remove(centralPanel);
                     bigThree.remove(XYZPanel);
                     aWindowConstraints.gridx = 0;
                     aWindowConstraints.gridy = 0;
@@ -2766,7 +2768,7 @@
                //     aWindowConstraints.gridheight = 3;
                     aWindowConstraints.gridx = 1;
                     aWindowConstraints.fill = GridBagConstraints.BOTH;
-                    bigThree.add(cameraPanel, aWindowConstraints);
+                    bigThree.add(centralPanel, aWindowConstraints);
                     aWindowConstraints.weightx = 0;
                     aWindowConstraints.gridx = 4;
                     aWindowConstraints.gridwidth = 1;
diff --git a/ObjEditor.java b/ObjEditor.java
index 4b1a4fd..6877515 100644
--- a/ObjEditor.java
+++ b/ObjEditor.java
@@ -292,9 +292,11 @@
         //normalLensItem.addActionListener(this);
         cameraMenu.add(revertCameraItem = new MenuItem("Revert Camera"));
         revertCameraItem.addActionListener(this);
-        cameraMenu.add(toggleFullItem = new CheckboxMenuItem("Full Screen"));
-        toggleFullItem.addItemListener(this);
-        toggleFullItem.setState(CameraPane.FULLSCREEN);
+        cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
+        toggleFullScreenItem.addItemListener(this);
+        toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
+        cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
+        toggleTimelineItem.addItemListener(this);
         cameraMenu.add("-");
         cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
         toggleTextureItem.addItemListener(this);
@@ -1158,11 +1160,14 @@
         //JPanel worldPanel =
         //		new gov.nasa.worldwind.examples.ApplicationTemplate.AppPanel(null, true);
         //worldPanel.setName("World");
-		/*JPanel*/ cameraPanel =
-                new JPanel(new BorderLayout());
-        cameraPanel.add(cameraView);
-        //new timeflow.app.TimeflowApp().TimeFlowWindow(cameraPanel, frame);
+	centralPanel = new JPanel(new BorderLayout());
+	timelinePanel = new JPanel(new BorderLayout());
+        timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel);
 
+        centralPanel.add(cameraView);
+        //frame.setJMenuBar(timelineMenubar);
+        //centralPanel.add(timelinePanel);
+        
         //topView.camera = ;
         //frontView.camera = new Camera(2);
         //sideView.camera = new Camera(3);
@@ -1192,7 +1197,7 @@
         gridPanel.add(cameraView);
         gridPanel.add(XYZPanel);
          */
-        gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, cameraPanel, XYZPanel); //new BorderLayout());
+        gridPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, centralPanel, XYZPanel); //new BorderLayout());
         gridPanel.setContinuousLayout(true);
         gridPanel.setOneTouchExpandable(true);
         gridPanel.setDividerLocation(1.0);
@@ -1304,7 +1309,7 @@
         //	aConstraints.gridheight = 3;
         aWindowConstraints.gridx = 1;
         aWindowConstraints.fill = GridBagConstraints.BOTH;
-        bigThree.add(cameraPanel, aWindowConstraints);
+        bigThree.add(centralPanel, aWindowConstraints);
         aWindowConstraints.weightx = 0;
         aWindowConstraints.gridx = 4;
         aWindowConstraints.gridwidth = 1;
@@ -2959,7 +2964,26 @@
             // june 2013           copy.HardTouch();
             cameraView.repaint();
             return;
-        } else if (event.getSource() == toggleFullItem)
+        } else if (event.getSource() == toggleTimelineItem)
+        {
+            copy.timeline ^= true;
+
+            if (copy.timeline)
+            {
+                centralPanel.remove(cameraView);
+                centralPanel.add(timelinePanel);
+                frame.setJMenuBar(timelineMenubar);
+            }
+            else
+            {
+                centralPanel.remove(timelinePanel);
+                centralPanel.add(cameraView);
+                frame.setJMenuBar(null);
+            }
+
+            frame.validate();
+            return;
+        } else if (event.getSource() == toggleFullScreenItem)
         {
             if (CameraPane.FULLSCREEN)
             {
@@ -3221,9 +3245,9 @@
             cameraView.RevertCamera();
             cameraView.repaint();
             return;
-        } else if (event.getSource() == textureButton)
-        {
-            return; // true;
+//        } else if (event.getSource() == textureButton)
+//        {
+//            return; // true;
         } else // combos...
         if (event.getSource() == texresMenu)
         {
@@ -4445,7 +4469,8 @@
     MenuItem revertCameraItem;
     CheckboxMenuItem toggleLiveItem;
     MenuItem stepItem;
-    CheckboxMenuItem toggleFullItem;
+    CheckboxMenuItem toggleFullScreenItem;
+    CheckboxMenuItem toggleTimelineItem;
     CheckboxMenuItem toggleRenderItem;
     CheckboxMenuItem toggleDebugItem;
     CheckboxMenuItem toggleFrustumItem;
@@ -4473,10 +4498,12 @@
     JSplitPane bigPanel;
     JPanel bigThree;
     JTabbedPane scenePanel;
-    JPanel cameraPanel;
+    JPanel centralPanel;
+    JPanel timelinePanel;
+    JMenuBar timelineMenubar;
     JSplitPane framePanel;
     JTextArea/*Field*/ nameField;
-    cButton textureButton;
+    //cButton textureButton;
     cButton okButton;
     cButton applyButton;
     cButton cancelButton;
diff --git a/Object3D.java b/Object3D.java
index f6cf69b..27c3158 100644
--- a/Object3D.java
+++ b/Object3D.java
@@ -285,6 +285,7 @@
             return parent.GetName() + "#";
         }
         
+    boolean timeline = false;
     boolean live = false;
     boolean hide = false;
     boolean link2master = false; // performs reset support/master at each frame
diff --git a/cButton.java b/cButton.java
index 5f82877..1a6a27a 100644
--- a/cButton.java
+++ b/cButton.java
@@ -7,4 +7,14 @@
         //setBorder(new javax.swing.border.EmptyBorder(0,0,0,0));
         setBorder(new javax.swing.border.EtchedBorder());
     }
+    
+    cButton(String name, boolean border)
+    {
+        super(name);
+        
+        if (border)
+                setBorder(new javax.swing.border.EtchedBorder());
+        else
+                setBorder(new javax.swing.border.EmptyBorder(0,0,0,0));
+    }
 }
diff --git a/timeflow/app/TimeflowApp.java b/timeflow/app/TimeflowApp.java
index 4c1f460..4826184 100755
--- a/timeflow/app/TimeflowApp.java
+++ b/timeflow/app/TimeflowApp.java
@@ -68,7 +68,7 @@
                 }
         };
 
-        public void TimeFlowWindow(Container container, JFrame frame) throws HeadlessException
+        public JMenuBar TimeFlowWindow(Container container) throws HeadlessException
         {
                 // read example directory
                 String[] ex = getVisibleFiles("settings/examples");
@@ -172,7 +172,8 @@
                 });
 
                 JMenuBar menubar = new JMenuBar();
-                frame.setJMenuBar(menubar);
+                
+                // frame.setJMenuBar(menubar);
 
                 JMenu fileMenu = new JMenu("File");
                 menubar.add(fileMenu);
@@ -340,7 +341,7 @@
                 }
 
                 JMenu helpMenu = new JMenu("Help");
-                menubar.add(helpMenu);
+                //menubar.add(helpMenu);
 
                 helpMenu.add(new WebDocAction(this));
 
@@ -372,6 +373,8 @@
                                 }
                         }
                 });
+                
+                return menubar;
         }
 
         void splash(boolean visible)
@@ -404,7 +407,7 @@
 
                 Container container = getContentPane();
 
-                TimeFlowWindow(container, this);
+                TimeFlowWindow(container);
         }
 
         void makeRecentFileMenu()

--
Gitblit v1.6.2