From f1382bc839a74ef1d1534c61ea94e53cf54716df Mon Sep 17 00:00:00 2001
From: Normand Briere <nbriere@noware.ca>
Date: Sun, 23 Jun 2019 15:00:47 -0400
Subject: [PATCH] Edit panel

---
 GroupEditor.java |  181 +++++++++++++++++++++++++++++++++++----------
 1 files changed, 140 insertions(+), 41 deletions(-)

diff --git a/GroupEditor.java b/GroupEditor.java
index 7bbf24b..8646c14 100644
--- a/GroupEditor.java
+++ b/GroupEditor.java
@@ -176,7 +176,6 @@
 		copyItem.addActionListener(this);
 		pasteItem = menu.add(new MenuItem("Paste"));
 		pasteItem.addActionListener(this);
-		menu.add("-");
                 
 		menu.add("-");
 		pasteIntoItem = menu.add(new MenuItem("Paste into"));
@@ -246,7 +245,7 @@
 
                 cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
                 toggleDebugItem.addItemListener(this);
-                toggleDebugItem.setState(CameraPane.DEBUG);
+                toggleDebugItem.setState(Globals.DEBUG);
 
                 cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
                 toggleFrustumItem.addItemListener(this);
@@ -369,11 +368,11 @@
 		billboardItem.addActionListener(this);
 		csgItem = menu.add(new MenuItem("CSG"));
 		csgItem.addActionListener(this);
-                shadowXItem = menu.add(new MenuItem("Shadow X"));
+                shadowXItem = menu.add(new MenuItem("Shadow Red"));
 		shadowXItem.addActionListener(this);
-                shadowYItem = menu.add(new MenuItem("Shadow Y"));
+                shadowYItem = menu.add(new MenuItem("Shadow Green"));
 		shadowYItem.addActionListener(this);
-                shadowZItem = menu.add(new MenuItem("Shadow Z"));
+                shadowZItem = menu.add(new MenuItem("Shadow Blue"));
 		shadowZItem.addActionListener(this);
         if (Globals.ADVANCED)
         {
@@ -470,6 +469,14 @@
 		markleavesItem.addActionListener(this);
 		unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
 		unmarkleavesItem.addActionListener(this);
+		rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
+		rewindleavesItem.addActionListener(this);
+		unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
+		unrewindleavesItem.addActionListener(this);
+		randomleavesItem = menu.add(new MenuItem("Random Leaves"));
+		randomleavesItem.addActionListener(this);
+		unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
+		unrandomleavesItem.addActionListener(this);
 		menu.add("-");
 		flipVItem = menu.add(new MenuItem("Flip V"));
 		flipVItem.addActionListener(this);
@@ -527,6 +534,18 @@
 	
 	void SetupUI2(ObjEditor oe)
 	{
+            // June 2019
+            if (oe == null)
+            {
+                //super.SetupUI2(this);
+                //return;
+            }
+            
+            if (copy != group)
+            {
+                //super.SetupUI2(this);
+            }
+            
             //new Exception().printStackTrace();
                 
         oe.radioPanel = new JPanel(new GridBagLayout());
@@ -557,15 +576,27 @@
          */
                 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
                 
-		oe.toolbarPanel.add(undoButton = new cButton("Undo", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
+		//oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
+                //minButton.setToolTipText("Minimize window");
+		//minButton.addActionListener(this);
+                
+		oe.toolbarPanel.add(maxButton = new cButton("\u271A", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
+                maxButton.setToolTipText("Maximize window");
+		maxButton.addActionListener(this);
+                
+		oe.toolbarPanel.add(fullButton = new cButton("\u2b1c", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
+                fullButton.setToolTipText("Full-screen window");
+		fullButton.addActionListener(this);
+                
+		oe.toolbarPanel.add(undoButton = new cButton("\u21a9", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
                 undoButton.setToolTipText("Undo changes");
 		undoButton.addActionListener(this);
                 
-		oe.toolbarPanel.add(redoButton = new cButton("Redo", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
+		oe.toolbarPanel.add(redoButton = new cButton("\u21aa", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
                 redoButton.setToolTipText("Redo changes");
 		redoButton.addActionListener(this);
                 
-		oe.toolbarPanel.add(saveButton = new cButton("Save", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
+		oe.toolbarPanel.add(saveButton = new cButton("\u21e3", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
                 saveButton.setToolTipText("Save changes");
 		saveButton.addActionListener(this);
                 
@@ -573,7 +604,7 @@
                 liveCB.setToolTipText("Enable animation");
                                 liveCB.addItemListener(this);
 
-		oe.toolbarPanel.add(oneStepButton = new cButton("Step", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
+		oe.toolbarPanel.add(oneStepButton = new cButton("\u29f4", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
                 oneStepButton.setToolTipText("Animate one step forward");
 		oneStepButton.addActionListener(this);
                 
@@ -581,7 +612,7 @@
                 fastCB.setToolTipText("Fast mode");
                                 fastCB.addItemListener(this);
                                 
-                oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
+                oe.toolbarPanel.add(trackCB = new cCheckBox(":", CameraPane.TRACK)); //, oe.aConstraints);
                 trackCB.setToolTipText("Enable tracking");
                                 trackCB.addItemListener(this);
 
@@ -605,19 +636,19 @@
                 
 		oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
                 
-		oe.toolbarPanel.add(twoButton = new cButton("|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
+		oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
                 twoButton.setToolTipText("Show center view only");
 		twoButton.addActionListener(this);
-		oe.toolbarPanel.add(fourButton = new cButton("+||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
+		oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
 		fourButton.addActionListener(this);
                 fourButton.setToolTipText("Show left panel only");
-		oe.toolbarPanel.add(sixButton = new cButton("+|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
+		oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
                 sixButton.setToolTipText("2-column layout left");
 		sixButton.addActionListener(this);
-		oe.toolbarPanel.add(threeButton = new cButton("|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
+		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);
+		oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
                 sevenButton.setToolTipText("3-column layout");
 		sevenButton.addActionListener(this);
                 //
@@ -632,32 +663,30 @@
 		//oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
 		//clearButton.addActionListener(this);
                         
-                cGridBag commandsPanel = new cGridBag();
-                
-		commandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
+		editCommandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
                 editButton.setToolTipText("Edit selection");
 		editButton.addActionListener(this);
 
-		commandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
+		editCommandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
                 uneditButton.setToolTipText("Unedit selection");
 		uneditButton.addActionListener(this);
 
-		commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
+		editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
                 allParamsButton.setToolTipText("Edit all params");
 		allParamsButton.addActionListener(this);
 
-		commandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
+		editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
                 clearPanelButton.setToolTipText("Clear edit panel");
 		clearPanelButton.addActionListener(this);
 
-		commandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
+		editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
                 unselectButton.setToolTipText("Unselect");
 		unselectButton.addActionListener(this);
 
-                commandsPanel.preferredHeight = 1;
+                editCommandsPanel.preferredHeight = 1;
                 
-                oe.treePanel.add(commandsPanel);
-                oe.treePanel.Return();
+//                oe.treePanel.add(commandsPanel);
+//                oe.treePanel.Return();
                 
 //		oe.aConstraints.gridx += 1;
 //		oe.aConstraints.weighty = 0;
@@ -809,6 +838,8 @@
         
         void SetupViews(ObjEditor oe)
         {
+                    theFrame = this;
+                    
             oe.SetupViews();
             
 		System.out.println("SetupViews");
@@ -1420,6 +1451,7 @@
             shadow.material = new cMaterial(obj.material);
             shadow.material.diffuse = 0.0001f;
             shadow.material.specular = 0.0001f;
+            //shadow.projectedVertices[1].x = 300;
             
             makeSomething(shadow);
         }
@@ -1969,6 +2001,18 @@
 		if (source == dumpItem)
 		{
                     DumpObject();
+		} else
+		if (source == minButton)
+		{
+			Minimize();
+		} else
+		if (source == maxButton)
+		{
+			Maximize();
+		} else
+		if (source == fullButton)
+		{
+			ToggleFullScreen();
 		} else
 		if (source == undoButton)
 		{
@@ -2609,6 +2653,22 @@
                 {
 			MarkLeaves(false);
 		} else
+		if (source == rewindleavesItem)
+                {
+			RewindLeaves(true);
+		} else
+		if (source == unrewindleavesItem)
+                {
+			RewindLeaves(false);
+		} else
+		if (source == randomleavesItem)
+                {
+			RandomLeaves(true);
+		} else
+		if (source == unrandomleavesItem)
+                {
+			RandomLeaves(false);
+		} else
 		if (source == flipVItem)
                 {
 			FlipV(true);
@@ -2875,6 +2935,24 @@
                     bigThree.ClearUI();
                     bigThree.add(centralPanel);
                     bigThree.FlushUI();
+                    
+                    cameraView.requestFocusInWindow();
+                    
+//                    refreshContents(true);
+//                    
+//                    try
+//                    {
+//                        java.awt.Robot bot = new java.awt.Robot();
+//                        int mask = InputEvent.BUTTON1_MASK;
+//                        bot.mouseMove(100, 100);           
+//                        bot.mousePress(mask);     
+//                        bot.mouseRelease(mask);                    
+//                    }
+//                    catch (Exception e)
+//                    {
+//                        
+//                    }
+                    
                 } else
 		if (source == threeButton)
 		{
@@ -2911,6 +2989,8 @@
                     bigThree.add(centralPanel);
                     bigThree.add(XYZPanel);
                     bigThree.FlushUI();
+                    
+                    cameraView.requestFocusInWindow();
                 } else
 		if (source == fourButton)
 		{
@@ -2946,6 +3026,8 @@
                     bigThree.ClearUI();
                     bigThree.add(scenePanel);
                     bigThree.FlushUI();
+                    
+                    cameraView.requestFocusInWindow();
                 } else
 		if (source == sixButton)
 		{
@@ -2982,6 +3064,8 @@
                     bigThree.add(scenePanel);
                     bigThree.add(centralPanel);
                     bigThree.FlushUI();
+                    
+                    cameraView.requestFocusInWindow();
                 } else
 		if (source == sevenButton)
 		{
@@ -3019,6 +3103,8 @@
                     bigThree.add(centralPanel);
                     bigThree.add(XYZPanel);
                     bigThree.FlushUI();
+                    
+                    cameraView.requestFocusInWindow();
                 } else
 		if (source == rootButton)
 		{
@@ -3030,6 +3116,7 @@
                                 EditObject(obj);
                     }
 
+                    cameraView.requestFocusInWindow();
                     refreshContents(true);
 		} else
 		if (source == closeButton)
@@ -3051,6 +3138,8 @@
                                 break;
                             }
                     }
+                    
+                    cameraView.requestFocusInWindow();
                     refreshContents(true);
 		} else
 		if (source == editItem || source == editButton)
@@ -3155,7 +3244,7 @@
                     }
                     
 // fix "+" issue
-                    group.editWindow = this;
+                    //group.editWindow = this;
                     
                     /*
                     currentLayout = radio.layout;
@@ -3168,6 +3257,8 @@
                     //group.parent = null; // ROOT
                     //group.attributes = -1;
                     ResetModel();
+                    
+                    cameraView.requestFocusInWindow();
                     refreshContents(true);
                 } else if (event.getSource() == editCameraItem)
                 {
@@ -3191,7 +3282,6 @@
 	}
         
         boolean useclient = false;
-        cRadio radio;
         
         void ToggleRoot()
         {
@@ -4146,6 +4236,18 @@
 		refreshContents();
 	}
 	
+	void RewindLeaves(boolean hide)
+	{
+		group.selection.RewindLeaves(hide);
+		refreshContents();
+	}
+	
+	void RandomLeaves(boolean hide)
+	{
+		group.selection.RandomLeaves(hide);
+		refreshContents();
+	}
+	
 	void SetTexRes(int tr)
 	{
 		group.selection.SetTexRes(tr);
@@ -4329,6 +4431,7 @@
 					
 					//if (child.parent != null)
 						//child.parent.addSelectee(child);
+                    objEditor.SetMaterial(child);
 					group.addSelectee(child);
 				}
 			}
@@ -4369,15 +4472,12 @@
             {
                 objEditor.ClearInfo(); // .GetMaterial());
 
-                for (int i=0; i < group.selection.size(); i++)
+                for (int i=0; i < group.selection.Size(); i++)
                 {
-                    Object3D child = (Object3D) group.selection.reserve(i);
+                    Object3D child = (Object3D) group.selection.get(i);
 
-                    objEditor.SetMaterial(child);
                     objEditor.AddInfo(child, this, true);
     System.err.println("info : " + child.GetPath());
-
-                    group.selection.release(i);
                 }
 
                 objEditor.SetText(); // jan 2014
@@ -5185,9 +5285,12 @@
 	cButton clearpanelButton;
 	cButton unselectButton;
 	
-	cButton saveButton;
+	cButton minButton;
+	cButton maxButton;
+	cButton fullButton;
 	cButton undoButton;
 	cButton redoButton;
+	cButton saveButton;
 	cButton oneStepButton;
         
 	cButton screenfitButton;
@@ -5200,14 +5303,6 @@
 	cButton closeButton;
 
 	cButton setsupportButton;
-        
-	cButton twoButton;
-	cButton sixButton;
-	cButton threeButton;
-	cButton sevenButton;
-	cButton fourButton; // full panel
-	cButton oneButton; // full XYZ
-        //cButton currentLayout;
         
 	//
         //Composite
@@ -5285,6 +5380,10 @@
 	private MenuItem showleavesItem;
 	private MenuItem markleavesItem;
 	private MenuItem unmarkleavesItem;
+	private MenuItem rewindleavesItem;
+	private MenuItem unrewindleavesItem;
+	private MenuItem randomleavesItem;
+	private MenuItem unrandomleavesItem;
         
 	private MenuItem flipVItem;
 	private MenuItem unflipVItem;

--
Gitblit v1.6.2