From 40f408aaee14abd85d391008b4d22977dc586b50 Mon Sep 17 00:00:00 2001
From: Normand Briere <nbriere@noware.ca>
Date: Sun, 21 Jul 2019 16:45:10 -0400
Subject: [PATCH] Prepare bimtexture.

---
 GroupEditor.java |  281 ++++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 194 insertions(+), 87 deletions(-)

diff --git a/GroupEditor.java b/GroupEditor.java
index aa482be..ff6c98d 100644
--- a/GroupEditor.java
+++ b/GroupEditor.java
@@ -60,6 +60,12 @@
 		this.copy = this.group = group;
 		//selectees = this.group.selectees;
 		
+        if (copy.versions == null)
+        {
+            copy.versions = new byte[100][];
+            copy.versionindex = -1;
+        }
+        
 		if(ui)
                     SetupUI(objEditor);
 	}
@@ -80,10 +86,22 @@
 		SetupViews(objEditor);
                 
                 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
+                
+        if (copy.versions == null)
+        {
+            copy.versions = new byte[100][];
+            copy.versionindex = -1;
+            
+            Save(true);
+        }
 	}
 
     void CloneSelection(boolean supports)
     {
+        if (Globals.REPLACEONMAKE)
+            Save();
+        boolean keep = Globals.REPLACEONMAKE;
+        Globals.REPLACEONMAKE = false;
         //   Object3D keep = GrafreeD.clipboard;
            //Object3D obj;
            for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
@@ -94,6 +112,7 @@
                
                makeSomething(clone, i==group.selection.size()-1);
            }
+        Globals.REPLACEONMAKE = keep;
     }
 
     void CloneClipboard(boolean supports)
@@ -189,8 +208,8 @@
 //		pasteExpandItem = menu.add(new MenuItem("Paste expand"));
 //		pasteExpandItem.addActionListener(this);
 		menu.add("-");
-		clearItem = menu.add(new MenuItem("Clear"));
-		clearItem.addActionListener(this);
+		deleteItem = menu.add(new MenuItem("Delete"));
+		deleteItem.addActionListener(this);
                 
         if (Globals.ADVANCED)
         {
@@ -220,7 +239,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);
         
@@ -380,13 +399,14 @@
 		shadowYItem.addActionListener(this);
                 shadowZItem = menu.add(new MenuItem("Shadow Blue"));
 		shadowZItem.addActionListener(this);
+		attributeItem = menu.add(new MenuItem("Attribute"));
+		attributeItem.addActionListener(this);
+                
         if (Globals.ADVANCED)
         {
 		menu.add("-");
 		linkerItem = menu.add(new MenuItem("Linker"));
 		linkerItem.addActionListener(this);
-		attributeItem = menu.add(new MenuItem("Attribute"));
-		attributeItem.addActionListener(this);
 		templateItem = menu.add(new MenuItem("Template"));
 		templateItem.addActionListener(this);
 		pointflowItem = menu.add(new MenuItem("Point Flow"));
@@ -415,7 +435,7 @@
 		genNormalsMESHItem.addActionListener(this);
         if (Globals.ADVANCED)
         {
-		genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
+		genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
 		genNormalsMINEItem.addActionListener(this);
         }
 		stripifyItem = menu.add(new MenuItem("Stripify"));
@@ -538,6 +558,7 @@
 		buildToolsMenu(menu);
 	}
 	
+        
 	void SetupUI2(ObjEditor oe)
 	{
             // June 2019
@@ -582,7 +603,7 @@
          */
                 cGridBag copyOptionsPanel = new cGridBag();
                                         
-                copyOptionsPanel.preferredHeight = 2;
+                copyOptionsPanel.preferredHeight = 1;
                 
                 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
                 
@@ -590,50 +611,66 @@
                 //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");
 		fullButton.addActionListener(this);
                 
+		oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
+                screenfitButton.setToolTipText("Screen fit");
+		screenfitButton.addActionListener(this);
+
 		oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
                 restoreCameraButton.setToolTipText("Restore viewpoint");
 		restoreCameraButton.addActionListener(this);
                 
+		copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
+                saveButton.setToolTipText("New version");
+		saveButton.addActionListener(this);
+                                                
 		copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
-                undoButton.setToolTipText("Undo changes");
+                undoButton.setToolTipText("Previous version");
 		undoButton.addActionListener(this);
                 undoButton.setEnabled(false);
                 
+                cGridBag updown = new cGridBag().setVertical(true);
+		updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
+                restoreButton.setToolTipText("Restore current");
+		restoreButton.addActionListener(this);
+                restoreButton.setEnabled(false);
+                
+		updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
+                replaceButton.setToolTipText("Replace current");
+		replaceButton.addActionListener(this);
+                replaceButton.setEnabled(false);
+                
+                copyOptionsPanel.add(updown);
+                
 		copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
-                redoButton.setToolTipText("Redo changes");
+                redoButton.setToolTipText("Next version");
 		redoButton.addActionListener(this);
                 redoButton.setEnabled(false);
                 
-		copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
-                saveButton.setToolTipText("Save changes");
-		saveButton.addActionListener(this);
-                
-                copyOptionsPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
+                oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
                 liveCB.setToolTipText("Enable animation");
                                 liveCB.addItemListener(this);
 
-		copyOptionsPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
+		oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
                 oneStepButton.setToolTipText("Animate one step forward");
 		oneStepButton.addActionListener(this);
                 
-                copyOptionsPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
+                oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
                 fastCB.setToolTipText("Fast mode");
                                 fastCB.addItemListener(this);
                                 
                 //oe.toolboxPanel.Return();
                 
-		copyOptionsPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
-                screenfitButton.setToolTipText("Screen fit");
-		screenfitButton.addActionListener(this);
-
 //                copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
 //                trackCB.setToolTipText("Enable tracking");
 //                                trackCB.addItemListener(this);
@@ -650,27 +687,28 @@
 
 		//oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
                 
-		oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
-                twoButton.setToolTipText("Show center view only");
-		twoButton.addActionListener(this);
-                this.fullscreenLayout = twoButton;
-                
 		oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
 		fourButton.addActionListener(this);
                 fourButton.setToolTipText("Show left panel only");
+                
+		oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
+                twoButton.setToolTipText("Show right view only");
+		twoButton.addActionListener(this);
+                this.fullscreenLayout = twoButton;
+                
 		oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
-                sixButton.setToolTipText("2-column layout left");
+                sixButton.setToolTipText("Show left and right");
 		sixButton.addActionListener(this);
-		oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
-                threeButton.setToolTipText("2-column layout right");
-		threeButton.addActionListener(this);
-		oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
-                sevenButton.setToolTipText("3-column layout");
-		sevenButton.addActionListener(this);
+//		oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
+//                threeButton.setToolTipText("2-column layout right");
+//		threeButton.addActionListener(this);
+//		oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
+//                sevenButton.setToolTipText("3-column layout");
+//		sevenButton.addActionListener(this);
                 //
 
-		oe.toolbarPanel.add(rootButton = GetButton("icons/write.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
-                rootButton.setToolTipText("Edit selection in new tab");
+		oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
+                rootButton.setToolTipText("Open selection in new tab");
 		rootButton.addActionListener(this);
 
                 oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
@@ -726,7 +764,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);
@@ -811,6 +849,9 @@
 
                 oe.treePanel.add(copyOptionsPanel);
                 oe.treePanel.Return();
+        cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
+            versionSlider = (cNumberSlider)sliderPane.getComponent(1);
+            sliderPane.preferredHeight = 1;
                 
 //        mainPanel.setDividerLocation(0.5); //1.0);
 //        mainPanel.setResizeWeight(0.5);
@@ -833,7 +874,7 @@
 		dgr.addDragGestureListener(this);
 		}catch(Exception e) {}
 		*/
-        radio.layout = sevenButton;
+        radio.layout = sixButton; // sevenButton;
         oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
 	}
         
@@ -863,9 +904,13 @@
 
         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);
@@ -929,12 +974,12 @@
                                 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("On structure change");
-                                autosaveCB.addItemListener(this);
+                panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
+                autokeepCB.setToolTipText("On structure change");
+                                autokeepCB.addItemListener(this);
 
                 panel.Return();
             if (Globals.ADVANCED)
@@ -963,7 +1008,7 @@
         {
             cRadio radioButton = new cRadio(obj.name);
             
-            // Patch to avoid bug with transparency.
+            // June 2019. Patch to avoid bug with transparency.
             radioButton.hadMaterial = obj.material != null;
             if (!radioButton.hadMaterial)
             {
@@ -971,7 +1016,7 @@
             }
             
             radioButton.SetObject(obj);
-            radioButton.layout = sevenButton;
+            radioButton.layout = sixButton; // sevenButton;
             radioButton.SetCamera(cameraView.renderCamera, false);
             radioButton.addActionListener(this);
             radioPanel.add(radioButton);
@@ -1000,6 +1045,7 @@
         cCheckBox slowCB;
         cCheckBox boxCB;
         cCheckBox zoomBoxCB;
+        cCheckBox freezeCB;
         //cToggleButton trackCB;
         cCheckBox trackCB;
         cCheckBox smoothfocusCB;
@@ -1010,7 +1056,7 @@
         
         cCheckBox oeilCB;
         cCheckBox shadowCB;
-        cCheckBox autosaveCB;
+        cCheckBox autokeepCB;
         cCheckBox lookAtCB;
         
 //        static int COLOR = 1;
@@ -1118,9 +1164,13 @@
             {
                 Globals.COMPUTESHADOWWHENLIVE ^= true;
             }
-            else if(e.getSource() == autosaveCB)
+            else if(e.getSource() == freezeCB)
             {
-                Globals.SAVEONMAKE ^= true;
+                Globals.FREEZEONMOVE ^= true;
+            }
+            else if(e.getSource() == autokeepCB)
+            {
+                Globals.REPLACEONMAKE ^= true;
             }
             else if(e.getSource() == lookAtCB)
             {
@@ -1202,8 +1252,6 @@
                         }
                     }
                     
-                    String string = (String) object;
-                    
                     System.out.println("Transfer = " + object + "; drop : " + target);
 //                    if( object instanceof java.io.File[])
 //                    {
@@ -1211,6 +1259,8 @@
 //                        objEditor.DropFile((java.io.File[]) object, true);
 //                        return;
 //                    }
+                    
+                    String string = object.toString();
                     
                     // File path for Mac and Windows
                     if (string.charAt(0) == '/' || string.charAt(1) == ':')
@@ -1460,6 +1510,9 @@
 		animationItem.addItemListener(this);
                 animationItem.setState(Globals.ANIMATION);
                 
+		menu.add(archiveItem = new MenuItem("Archive3D..."));
+		archiveItem.addActionListener(this);
+                
 		menu.add("-");
 		parseverticesItem = menu.add(new MenuItem("Multiplicity"));
 		parseverticesItem.addActionListener(this);
@@ -1472,6 +1525,8 @@
 		reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
 		reduce34MorphItem.addActionListener(this);
 		menu.add("-");
+		menu.add(memoryItem = new MenuItem("Memory Usage"));
+		memoryItem.addActionListener(this);
 		menu.add(computeAOItem = new MenuItem("Compute AO"));
 		computeAOItem.addActionListener(this);
                 
@@ -1480,8 +1535,6 @@
 		mirrorItem = menu.add(new MenuItem("Mirror Poses"));
 		mirrorItem.addActionListener(this);
 		menu.add("-");
-		menu.add(memoryItem = new MenuItem("Memory Usage"));
-		memoryItem.addActionListener(this);
 		menu.add(analyzeItem = new MenuItem("Analyze"));
 		analyzeItem.addActionListener(this);
 		menu.add(dumpItem = new MenuItem("Print"));
@@ -1642,6 +1695,16 @@
                 listUI.remove(i);
             }
         }
+    }
+
+    private void EditElement(Object3D elem, boolean newWindow)
+    {
+        //    if (!(elem instanceof Composite))
+        //        newWindow = false;
+            listUI.add(elem);
+            elem.openEditWindow(this, newWindow); //, false);
+            System.out.println("edit : " + elem);
+            elem.editWindow.refreshContents(true); // ? new
     }
         
     /**
@@ -2122,25 +2185,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();
@@ -2204,15 +2267,31 @@
 		} else
 		if (source == undoButton)
 		{
+                        // Go to previous version
+			//if (!Undo())
+                            //java.awt.Toolkit.getDefaultToolkit().beep();
 			Undo();
+		} else
+		if (source == restoreButton)
+		{
+                        // Restore current version
+			Restore();
+		} else
+		if (source == replaceButton)
+		{
+                        // Overwrite current version
+			Replace();
 		} else
 		if (source == redoButton)
 		{
+                        // Go to next version
 			Redo();
 		} else
 		if (source == saveButton)
 		{
-			Save();
+                        // Save a new version
+			if (!Save(true))
+                            java.awt.Toolkit.getDefaultToolkit().beep();
 		} else
 		if (source == oneStepButton)
 		{
@@ -2221,17 +2300,14 @@
 		} else
 		if (source == screenfitButton)
 		{
-			//Reload(lastConverter, lastFilename, true);
                     ScreenFit();
 		} else
 		if (source == screenfitpointButton)
 		{
-			//Reload(lastConverter, lastFilename, true);
                     ScreenFitPoint();
 		} else
 		if (source == snapobjectButton)
 		{
-			//Reload(lastConverter, lastFilename, true);
                     SnapObject();
 		} else
 //		if (event.getSource() == recompileButton)
@@ -2595,7 +2671,7 @@
 		{
 			StepAll();
 		} else
-		if (source == clearItem) // || event.getSource() == clearButton)
+		if (source == deleteItem) // || event.getSource() == clearButton)
 		{
 			//int indices[] = jList.getSelectedIndices();
 			//for (int i = indices.length - 1; i >= 0; i--)
@@ -2755,15 +2831,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)
                 {
@@ -3446,6 +3535,9 @@
                     }
                     
                     copy = group;
+                    
+                    SetUndoStates();
+
                     //Globals.theRenderer.object = group;
                     if(!useclient)
                     {
@@ -3474,8 +3566,10 @@
                     radio.layout.doClick();
                     
                     ClearUnpinned();
-                    SetPinStates(group.selection.size() > 0);
-                    if (group.selection.size() == 1)
+                    //Grafreed.Assert(group != null);
+                    //Grafreed.Assert(group.selection != null);
+                    SetPinStates(group.selection == null || group.selection.size() > 0);
+                    if (group.selection == null || group.selection.size() == 1)
                         EditSelection(false);
                     keepparent = group.parent;
                     // PARENT = NULL or not???
@@ -4069,7 +4163,7 @@
                             
                             try
                             {
-                                texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
+                                texturedata = Globals.theRenderer.GetTextureData(tex.pigmenttexture, pigment, false, node.texres);
                             }
                             catch (Exception e)
                             {
@@ -4546,6 +4640,12 @@
 	
 	void EditSelection(boolean newWindow)
 	{
+                if (group.selection == null)
+                {
+                     EditElement(group, newWindow); // ? new
+                     return;
+                }
+                
         //    aConstraints.gridy = 0;
 		for (int i=0; i<group.selection.size(); i++)
 		{
@@ -4556,12 +4656,7 @@
 			Object3D elem = (Object3D)group.selection.elementAt(i);
                         if(elem != group || !newWindow)
                         {
-                        //    if (!(elem instanceof Composite))
-                        //        newWindow = false;
-                            listUI.add(elem);
-                            elem.openEditWindow(this, newWindow); //, false);
-                            System.out.println("edit : " + elem);
-                            elem.editWindow.refreshContents(true); // ? new
+                            EditElement(elem, newWindow); // ? new
                         }
 		}
 	}
@@ -4705,8 +4800,8 @@
 
         void refreshContents(boolean cp)
         {
-            if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
-            if (!Globals.MOUSEDRAGGED) // && !Globals.TIMERRUNNING)
+            if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
+            if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
             {
                 objEditor.ClearInfo(); // .GetMaterial());
 
@@ -4805,8 +4900,8 @@
                 
 		if (cut)
 		{
-        if (Globals.SAVEONMAKE)
-                    Save();
+//        if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
+//                    Save();
 			//int indices[] = jList.getSelectedIndices();
 			//for (int i = indices.length - 1; i >= 0; i--)
 			//jList.remove(indices[i]);
@@ -4909,6 +5004,10 @@
 	
 	void paste(boolean expand)
 	{
+        if (Globals.REPLACEONMAKE)
+            Save();
+        boolean keep = Globals.REPLACEONMAKE;
+        Globals.REPLACEONMAKE = false;
 	//	if (GrafreeD.clipboard == null)
 	//		return;
 		boolean first = true;
@@ -4968,6 +5067,7 @@
                         Grafreed.clipboard.get(0).parent = keepparent;
 		}
 		
+        Globals.REPLACEONMAKE = keep;
 		ResetModel();
 		refreshContents();
 	}
@@ -5103,6 +5203,10 @@
         
 	void group(Object3D csg, boolean grab)
 	{
+        if (Globals.REPLACEONMAKE)
+            Save();
+        boolean keep = Globals.REPLACEONMAKE;
+        Globals.REPLACEONMAKE = false;
 		if (//false) // why??
                     !group.selection.isEmpty())
                 {
@@ -5216,10 +5320,15 @@
                 //node.add(csg);
 		//makeSomething(node);
 		makeSomething(csg);
+        Globals.REPLACEONMAKE = keep;
 	}
 	
         void Ungroup(Object3D g)
         {
+        if (Globals.REPLACEONMAKE)
+            Save();
+        boolean keep = Globals.REPLACEONMAKE;
+        Globals.REPLACEONMAKE = false;
             if (g instanceof HiddenObject)
             {
                 HiddenObject h = (HiddenObject) g;
@@ -5236,6 +5345,7 @@
                     objEditor.makeSomething(g.get(i), false);
                 }
             }
+        Globals.REPLACEONMAKE = keep;
         }
         
 	void ungroup()
@@ -5526,9 +5636,6 @@
 	
 	cButton restoreCameraButton;
         
-	cButton minButton;
-	cButton maxButton;
-	cButton fullButton;
 	cButton saveButton;
 	cButton oneStepButton;
         
@@ -5602,7 +5709,7 @@
 	private MenuItem pasteLinkItem;
 	private MenuItem pasteCloneItem;
 	private MenuItem pasteExpandItem;
-	private MenuItem clearItem;
+	private MenuItem deleteItem;
 	private MenuItem clearAllItem;
 	private MenuItem genUVItem;
 	private MenuItem genNormalsMESHItem;

--
Gitblit v1.6.2