From 9079880942d022ee32fd3a543843e132e52deb1a Mon Sep 17 00:00:00 2001
From: Normand Briere <nbriere@noware.ca>
Date: Sun, 30 Jun 2019 23:52:19 -0400
Subject: [PATCH] Tree icons.

---
 GroupEditor.java |  123 ++++++++++++++++++++++++++--------------
 1 files changed, 80 insertions(+), 43 deletions(-)

diff --git a/GroupEditor.java b/GroupEditor.java
index 502ff05..847a6e0 100644
--- a/GroupEditor.java
+++ b/GroupEditor.java
@@ -220,7 +220,7 @@
 //        toggleSwitchItem.addItemListener(this);
 //        toggleSwitchItem.setState(CameraPane.SWITCH);
         
-        cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
+        cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
         toggleHandleItem.addItemListener(this);
         toggleHandleItem.setState(CameraPane.HANDLES);
         
@@ -582,7 +582,7 @@
          */
                 cGridBag copyOptionsPanel = new cGridBag();
                                         
-                copyOptionsPanel.preferredHeight = 2;
+                copyOptionsPanel.preferredHeight = 1;
                 
                 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
                 
@@ -590,9 +590,12 @@
                 //minButton.setToolTipText("Minimize window");
 		//minButton.addActionListener(this);
                 
-		oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
-                maxButton.setToolTipText("Maximize window");
-		maxButton.addActionListener(this);
+                if (Globals.ADVANCED)
+                {
+                    oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
+                    maxButton.setToolTipText("Maximize window");
+                    maxButton.addActionListener(this);
+                }
                 
 		oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
                 fullButton.setToolTipText("Full-screen window");
@@ -726,7 +729,7 @@
                                compositeButton.addActionListener(this);
 
                 oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
-                switchButton.setToolTipText("Create switch");
+                switchButton.setToolTipText("Create item switcher");
                                switchButton.addActionListener(this);
 
                 oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
@@ -758,16 +761,16 @@
                 }
                 
                 // EDIT panel
-		editCommandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
-                editButton.setToolTipText("Edit selection");
+		editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
+                editButton.setToolTipText("Pin selection controls");
 		editButton.addActionListener(this);
 
-		editCommandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
-                uneditButton.setToolTipText("Unedit selection");
+		editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
+                uneditButton.setToolTipText("Remove selection controls");
 		uneditButton.addActionListener(this);
 
 		editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
-                allParamsButton.setToolTipText("Edit all params");
+                allParamsButton.setToolTipText("Show all controle");
 		allParamsButton.addActionListener(this);
 
 		editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
@@ -784,6 +787,7 @@
                 
                 editCommandsPanel.preferredHeight = 1;
                 
+                SetPinStates(false);
 //                oe.treePanel.add(commandsPanel);
 //                oe.treePanel.Return();
                 
@@ -857,14 +861,18 @@
                                 boxCB.addItemListener(this);
                                 
                 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
-                zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
+                zoomBoxCB.setToolTipText("Display only for wheel");
                                 zoomBoxCB.addItemListener(this);
 
         if (true) // Globals.ADVANCED)
         {
-                panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
-                supportCB.setToolTipText("Enable rigging");
-                                supportCB.addItemListener(this);
+//                panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
+//                supportCB.setToolTipText("Enable rigging");
+//                                supportCB.addItemListener(this);
+
+                panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
+                freezeCB.setToolTipText("Fast moving camera");
+                                freezeCB.addItemListener(this);
 
         //        panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
         //                        localCB.addItemListener(this);
@@ -919,7 +927,7 @@
                                 oeilCB.addItemListener(this);
 
                 panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
-                shadowCB.setToolTipText("Compute shadows when live");
+                shadowCB.setToolTipText("When live compute shadows");
                                 shadowCB.addItemListener(this);
 
                 panel.Return();
@@ -928,11 +936,11 @@
                                 toggleTextureCB.addItemListener(this);
                                 
                 panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
-                toggleSwitchCB.setToolTipText("Use switch");
+                toggleSwitchCB.setToolTipText("Choose a single item");
                                 toggleSwitchCB.addItemListener(this);
                                 
                 panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints);
-                autosaveCB.setToolTipText("Auto-save on structure change");
+                autosaveCB.setToolTipText("On structure change");
                                 autosaveCB.addItemListener(this);
 
                 panel.Return();
@@ -999,6 +1007,7 @@
         cCheckBox slowCB;
         cCheckBox boxCB;
         cCheckBox zoomBoxCB;
+        cCheckBox freezeCB;
         //cToggleButton trackCB;
         cCheckBox trackCB;
         cCheckBox smoothfocusCB;
@@ -1116,6 +1125,10 @@
             else if(e.getSource() == shadowCB)
             {
                 Globals.COMPUTESHADOWWHENLIVE ^= true;
+            }
+            else if(e.getSource() == freezeCB)
+            {
+                Globals.FREEZEONMOVE ^= true;
             }
             else if(e.getSource() == autosaveCB)
             {
@@ -1459,6 +1472,9 @@
 		animationItem.addItemListener(this);
                 animationItem.setState(Globals.ANIMATION);
                 
+		menu.add(archiveItem = new CheckboxMenuItem("Archive3D..."));
+		archiveItem.addItemListener(this);
+                
 		menu.add("-");
 		parseverticesItem = menu.add(new MenuItem("Multiplicity"));
 		parseverticesItem.addActionListener(this);
@@ -1628,6 +1644,20 @@
             
             makeSomething(shadow);
         }
+
+    private void ClearUnpinned()
+    {
+        //for (Object3D obj : listUI)
+        for (int i=listUI.size(); --i>=0;)
+        {
+            Object3D obj = listUI.elementAt(i);
+            if (!obj.pinned)
+            {
+                obj.CloseUI();
+                listUI.remove(i);
+            }
+        }
+    }
         
     /**
      * applyExample
@@ -2107,25 +2137,25 @@
                         Composite csg = new GroupLeaf();
                         csg.count = 5;
 			group(csg);
-                        Composite child = new cGroup();
+                        Composite child = new cGroup("Branch");
                         csg.addChild(child);
                         child.addChild(csg);
 		} else
 		if (source == doubleItem)
 		{
-                        Composite csg = new GroupLeaf();
+                        Composite csg = new GroupLeaf("Fork");
                         csg.count = 5;
 			group(csg);
-                        Composite child = new cGroup();
+                        Composite child = new cGroup("Branch A");
                         csg.addChild(child);
                         child.addChild(csg);
-                        child = new cGroup();
+                        child = new cGroup("Branch B");
                         csg.addChild(child);
                         child.addChild(csg);
 		} else
 		if (source == tripleItem)
 		{
-                        Composite csg = new GroupLeaf();
+                        Composite csg = new GroupLeaf("Trident");
                         csg.count = 4;
 			group(csg);
                         Composite child = new cGroup();
@@ -2740,15 +2770,28 @@
 		} else
 		if (source == ungroupItem || source == ungroupButton)
 		{
-			//ungroup();
+                    boolean hasRoot = false;
+                    
                     for (int i=0; i<group.selection.size(); i++)
                     {
-                        Ungroup(group.selection.get(i));
+                        if (group.selection.get(i) == group)
+                        {
+                            hasRoot = true;
+                            break;
+                        }
                     }
 
-                    ClearSelection(false);
-                    
-                    refreshContents();
+                    if (!hasRoot)
+                    {
+                        for (int i=0; i<group.selection.size(); i++)
+                        {
+                            Ungroup(group.selection.get(i));
+                        }
+
+                        ClearSelection(false);
+
+                        refreshContents();
+                    }
 		} else
 		if (source == genUVItem)
                 {
@@ -3372,7 +3415,7 @@
                     //copy.ClearUI();
                     for (Object3D obj : listUI)
                     {
-                        obj.pinned = true;
+                        obj.pinned = false;
                         obj.CloseUI();
                     }
                     listUI.clear();
@@ -3457,6 +3500,11 @@
                         currentLayout = sevenButton;
                      */
                     radio.layout.doClick();
+                    
+                    ClearUnpinned();
+                    SetPinStates(group.selection.size() > 0);
+                    if (group.selection.size() == 1)
+                        EditSelection(false);
                     keepparent = group.parent;
                     // PARENT = NULL or not???
                     //group.parent = null; // ROOT
@@ -4616,17 +4664,7 @@
 		//new Exception().printStackTrace();
 
 		freezemodel = true;
-		
-                //for (Object3D obj : listUI)
-                for (int i=listUI.size(); --i>=0;)
-                {
-                    Object3D obj = listUI.elementAt(i);
-                    if (!obj.pinned)
-                    {
-                        obj.CloseUI();
-                        listUI.remove(i);
-                    }
-                }
+        ClearUnpinned();
                     
 		/**/
 		//switch (event.id)
@@ -4689,6 +4727,8 @@
         {
             editButton.setEnabled(enabled);
             uneditButton.setEnabled(enabled);
+            unselectButton.setEnabled(enabled);
+            flashSelectionButton.setEnabled(enabled);
         }
 
         void refreshContents(boolean cp)
@@ -5514,9 +5554,6 @@
 	
 	cButton restoreCameraButton;
         
-	cButton minButton;
-	cButton maxButton;
-	cButton fullButton;
 	cButton saveButton;
 	cButton oneStepButton;
         

--
Gitblit v1.6.2