From f78dd18c66d607b693c0bf5937fc59181bf5a26b Mon Sep 17 00:00:00 2001
From: Normand Briere <nbriere@noware.ca>
Date: Wed, 26 Jun 2019 20:39:14 -0400
Subject: [PATCH] Fix multiple selection

---
 GroupEditor.java |   52 ++++++++++++++++++++++++++++++++--------------------
 1 files changed, 32 insertions(+), 20 deletions(-)

diff --git a/GroupEditor.java b/GroupEditor.java
index 502ff05..aa482be 100644
--- a/GroupEditor.java
+++ b/GroupEditor.java
@@ -758,16 +758,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 +784,7 @@
                 
                 editCommandsPanel.preferredHeight = 1;
                 
+                SetPinStates(false);
 //                oe.treePanel.add(commandsPanel);
 //                oe.treePanel.Return();
                 
@@ -857,7 +858,7 @@
                                 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)
@@ -919,7 +920,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();
@@ -932,7 +933,7 @@
                                 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();
@@ -1628,6 +1629,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
@@ -3372,7 +3387,7 @@
                     //copy.ClearUI();
                     for (Object3D obj : listUI)
                     {
-                        obj.pinned = true;
+                        obj.pinned = false;
                         obj.CloseUI();
                     }
                     listUI.clear();
@@ -3457,6 +3472,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 +4636,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 +4699,8 @@
         {
             editButton.setEnabled(enabled);
             uneditButton.setEnabled(enabled);
+            unselectButton.setEnabled(enabled);
+            flashSelectionButton.setEnabled(enabled);
         }
 
         void refreshContents(boolean cp)

--
Gitblit v1.6.2