From 0216409e390b2005d6bc4eaf564ef9ca2e508dab Mon Sep 17 00:00:00 2001
From: Normand Briere <nbriere@noware.ca>
Date: Mon, 02 Sep 2019 11:49:36 -0400
Subject: [PATCH] New maximize button.

---
 ObjEditor.java   |   32 +++++++++++++---
 GroupEditor.java |   45 +++++++++-------------
 2 files changed, 44 insertions(+), 33 deletions(-)

diff --git a/GroupEditor.java b/GroupEditor.java
index 597afe6..ae9ebf2 100644
--- a/GroupEditor.java
+++ b/GroupEditor.java
@@ -368,16 +368,6 @@
         refreshContents();
     }
 
-    public void Show3DView()
-    {
-        // bug
-        //gridPanel.setDividerLocation(1.0);
-        //bigPanel.setDividerLocation(0.0);
-        bigThree.ClearUI();
-        bigThree.add(centralPanel);
-        bigThree.FlushUI();
-    }
-
     //ObjEditor objEditor;
 	public void closeUI2()
 	{
@@ -1081,13 +1071,17 @@
 //                        }
 //                });
                 
+		oe.toolbarPanel.add(fullScreenButton = GetButton("icons/fullscreen.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
+                fullScreenButton.setToolTipText("Full-screen window");
+		fullScreenButton.addActionListener(this);
+                
 		oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
                 collapseButton.setToolTipText("Collapse toolbar");
 		collapseButton.addActionListener(this);
                 
-		oe.toolbarPanel.add(maximize3DButton = GetButton("icons/square.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
-                maximize3DButton.setToolTipText("Maximize 3D view");
-		maximize3DButton.addActionListener(this);
+//		oe.toolbarPanel.add(maximize3DButton = GetButton("icons/square.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
+//                maximize3DButton.setToolTipText("Maximize 3D view");
+//		maximize3DButton.addActionListener(this);
                 
 		oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
                 twoButton.setToolTipText("Show 3D view only");
@@ -1107,10 +1101,6 @@
 //                sevenButton.setToolTipText("3-column layout");
 //		sevenButton.addActionListener(this);
                 //
-                
-		oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
-                fullButton.setToolTipText("Full-screen window");
-		fullButton.addActionListener(this);
                 
 		oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Globals.NIMBUSLAF)); //, oe.aConstraints);
                 screenfitButton.setToolTipText("Screen fit");
@@ -2807,7 +2797,7 @@
 		{
 			Maximize();
 		} else
-		if (source == fullButton)
+		if (source == fullScreenButton)
 		{
 			ToggleFullScreen();
 		} else
@@ -2816,13 +2806,13 @@
                         this.expandedLayout = radio.layout;
 			CollapseToolbar();
 		} else
-		if (source == maximize3DButton)
-		{
-                        this.expandedLayout = radio.layout;
-                        radio.layout = twoButton;
-                        Show3DView();
-			CollapseToolbar();
-		} else
+//		if (source == maximize3DButton)
+//		{
+//                        this.expandedLayout = radio.layout;
+//                        radio.layout = twoButton;
+//			CollapseToolbar();
+//                        Show3DView();
+//		} else
 		if (source == previousVersionButton)
 		{
                         // Go to previous version
@@ -4169,9 +4159,10 @@
             // and check if any of these nodes are reachable below the root.
             Grafreed.grafreed.universe.TagObjects(copy, true);
             
-            if (copy instanceof Composite && copy.versionlist == null && !copy.HasTags())
+            if (copy instanceof Composite && !copy.HasTags())
             {
-                copy.versionlist = new Object3D[100];
+                if (copy.versionlist == null)
+                    copy.versionlist = new Object3D[100];
                 
                 //Save(true);
             }
diff --git a/ObjEditor.java b/ObjEditor.java
index eab8b93..46f9842 100644
--- a/ObjEditor.java
+++ b/ObjEditor.java
@@ -906,10 +906,20 @@
         
 	cButton minButton;
 	cButton maxButton;
-	cButton fullButton;
+	cButton fullScreenButton;
 	cButton collapseButton;
         cButton maximize3DButton;
         
+    public void Show3DView()
+    {
+        // bug
+        //gridPanel.setDividerLocation(1.0);
+        //bigPanel.setDividerLocation(0.0);
+        bigThree.ClearUI();
+        bigThree.add(centralPanel);
+        bigThree.FlushUI();
+    }
+
         void ToggleFullScreen()
         {
             GraphicsDevice device = frame.getGraphicsConfiguration().getDevice();
@@ -936,14 +946,18 @@
 //                    framePanel.setDividerLocation(46); // icons are 24x24
                     
                     //frame.setVisible(true);
-//                    radio.layout = keepButton;
+                    radio.layout = keepButton;
                     //theFrame = null;
                     keepButton = null;
-//                    radio.layout.doClick();
+                    radio.layout.doClick();
                     
                 } else
                 {
                     keepButton = radio.layout;
+                    
+                    radio.layout = twoButton;
+                    Show3DView();
+                        
                     //keeprect = frame.getBounds();
 //                frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width,
 //                        frame.getToolkit().getScreenSize().height);
@@ -965,6 +979,7 @@
 //                    radio.layout = fullscreenLayout;
 //                    radio.layout.doClick();
                     //frame.setVisible(true);
+                    CollapseToolbar();
                 }
             frame.validate();
             
@@ -1985,11 +2000,16 @@
                     {
                         if ((Integer)pce.getOldValue() == 1)
                         {
-                            if (radio.layout != expandedLayout)
+                            if (CameraPane.FULLSCREEN)
                             {
-                                radio.layout = expandedLayout;
-                                radio.layout.doClick();
+                                ToggleFullScreen();
                             }
+                            
+//                            if (radio.layout != expandedLayout)
+//                            {
+//                                radio.layout = expandedLayout;
+//                                radio.layout.doClick();
+//                            }
                         }
                     }
                 });

--
Gitblit v1.6.2