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

---
 ObjEditor.java                      |   22 +++++++++--
 icons/Media_player_icons-04-512.png |    0 
 /dev/null                           |    0 
 CameraPane.java                     |    5 ++
 GroupEditor.java                    |   52 ++++++++++++++++----------
 cTree.java                          |    6 ++
 Grid.java                           |    2 
 icons/flash-light.png               |    0 
 Object3D.java                       |    2 +
 icons/controls.png                  |    0 
 icons/remove.png                    |    0 
 11 files changed, 63 insertions(+), 26 deletions(-)

diff --git a/CameraPane.java b/CameraPane.java
index b2db6b7..88a2741 100644
--- a/CameraPane.java
+++ b/CameraPane.java
@@ -16783,6 +16783,11 @@
                 //System.out.println("objects[color] = " + objects[color]);
                 //objects[color].Select();
                 indexcount = 0;
+                    ObjEditor window = object.GetWindow();
+                    if (window != null && deselect)
+                    {
+                        window.Select(null, deselect, true);
+                    }
                 object.Select(color, deselect);
             }
 
diff --git a/Grid.java b/Grid.java
index 1780c12..e8b144a 100644
--- a/Grid.java
+++ b/Grid.java
@@ -64,7 +64,7 @@
 
     Vertex biparamFunction(double u, double v)
     {
-        Vertex temp = new Vertex((2*v-1)*radius*8, 0 /*-radius,*/, (2*u-1)*radius*8);
+        Vertex temp = new Vertex((2*v-1)*radius*4, 0 /*-radius,*/, (2*u-1)*radius*4);
         temp.norm = LA.newVector(0,1,0);
         return temp;
     }
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)
diff --git a/ObjEditor.java b/ObjEditor.java
index d10d05b..ef7c93d 100644
--- a/ObjEditor.java
+++ b/ObjEditor.java
@@ -15,6 +15,9 @@
 //import javax.swing.plaf.ColorUIResource;
 //import javax.swing.plaf.metal.DefaultMetalTheme;
 
+import javax.swing.plaf.basic.BasicSplitPaneDivider;
+import javax.swing.plaf.basic.BasicSplitPaneUI;
+
 //import javax.media.opengl.GLCanvas;
 
 import //weka.core.
@@ -458,7 +461,13 @@
         mainPanel.setDividerSize(9);
         mainPanel.setDividerLocation(0.5); //1.0);
         mainPanel.setResizeWeight(0.5);
-
+        
+//mainPanel.setDividerSize((int) (mainPanel.getDividerSize() * 1.5));
+//    BasicSplitPaneDivider divider = ( (BasicSplitPaneUI) mainPanel.getUI()).getDivider();
+//    divider.setDividerSize(15);
+//    divider.setBorder(BorderFactory.createTitledBorder(divider.getBorder(), "Custom border title -- gets rid of the one-touch arrows!"));    
+    
+    
         //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5));
         //mainPanel.setLayout(new GridBagLayout());
         toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
@@ -1125,7 +1134,7 @@
         hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
                 hideCB.setToolTipText("Hide object");
         markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
-        markCB.setToolTipText("Set the animation target transform");
+        markCB.setToolTipText("As animation target transform");
         
             setupPanel2 = new cGridBag().setVertical(false);
             
@@ -1133,7 +1142,7 @@
         rewindCB.setToolTipText("Rewind animation");
         
         randomCB = AddCheckBox(setupPanel2, "Rand", copy.random);
-        randomCB.setToolTipText("Randomly Rewind or Go back and forth");
+        randomCB.setToolTipText("Randomly Rewind (or Go back and forth)");
 
         if (Globals.ADVANCED)
         {
@@ -3017,12 +3026,17 @@
 //                }
 
         /**/
-        if (deselect)
+        if (deselect || child == null)
         {
             //group.deselectAll();
             //freeze = true;
             GetTree().clearSelection();
             //freeze = false;
+            
+            if (child == null)
+            {
+                return;
+            }
         }
 
         //group.addSelectee(child);
diff --git a/Object3D.java b/Object3D.java
index e829908..355ed54 100644
--- a/Object3D.java
+++ b/Object3D.java
@@ -5043,6 +5043,7 @@
 
             if (child == null)
                 continue;
+            
             if (child.HasTransparency() && child.size() != 0)
             {
                 cTreePath leaf = child.Select(indexcount, deselect);
@@ -5929,6 +5930,7 @@
             if (GetBRep() != null)
             {
                 display.NextIndex();
+                
                 // vertex color conflict : gl.glCallList(list);
                 DrawNode(display, root, selected);
                 if (this instanceof BezierPatch)
diff --git a/cTree.java b/cTree.java
index 2632e2b..405e4e2 100644
--- a/cTree.java
+++ b/cTree.java
@@ -20,7 +20,11 @@
         {
             public void mousePressed(MouseEvent e)
             {
-                if (e.isPopupTrigger()) {
+                if (e.isPopupTrigger())
+                {
+                    int row = getClosestRowForLocation(e.getX(), e.getY());
+                    if (!isRowSelected(row))
+                        setSelectionRow(row);
                     popup.show((JComponent) e.getSource(), e.getX(), e.getY());
                 }
             }
diff --git a/icons/Media_player_icons-04-512.png b/icons/Media_player_icons-04-512.png
new file mode 100644
index 0000000..a90effd
--- /dev/null
+++ b/icons/Media_player_icons-04-512.png
Binary files differ
diff --git a/icons/controls.png b/icons/controls.png
new file mode 100644
index 0000000..bdb146e
--- /dev/null
+++ b/icons/controls.png
Binary files differ
diff --git a/icons/flash-light.png b/icons/flash-light.png
index 81ba154..d2ee190 100644
--- a/icons/flash-light.png
+++ b/icons/flash-light.png
Binary files differ
diff --git a/icons/loop0.png b/icons/loop0.png
deleted file mode 100644
index 1bd548e..0000000
--- a/icons/loop0.png
+++ /dev/null
Binary files differ
diff --git a/icons/particles0.png b/icons/particles0.png
deleted file mode 100644
index 62fcd6c..0000000
--- a/icons/particles0.png
+++ /dev/null
Binary files differ
diff --git a/icons/remove.png b/icons/remove.png
new file mode 100644
index 0000000..5ccc7b2
--- /dev/null
+++ b/icons/remove.png
Binary files differ

--
Gitblit v1.6.2