From 3d30e720e6f012f2d9996b136154dd551844998a Mon Sep 17 00:00:00 2001
From: Normand Briere <nbriere@noware.ca>
Date: Wed, 25 Dec 2019 16:54:14 -0500
Subject: [PATCH] Conditional key pressed to support print screen.

---
 BoxEditor.java |  106 ++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 80 insertions(+), 26 deletions(-)

diff --git a/BoxEditor.java b/BoxEditor.java
index 9860739..4125fc5 100644
--- a/BoxEditor.java
+++ b/BoxEditor.java
@@ -9,31 +9,46 @@
 
 class BoxEditor extends ObjEditor
 {
+    BoxEditor(Box inBox, GroupEditor callee)
+    {
+        super(inBox, callee);
+
+        //objEditor = new BiparamEditor(inCone, this, callee);
+        objEditor = callee.GetEditor();
+
+        this.box = inBox;
+
+        SetupUI2(GetEditor());
+    }
+	
 	
     BoxEditor(Box inBox, Object3D copy, GroupEditor callee)
     {
         super(inBox, copy, callee);
+        
+        new Exception().printStackTrace();
+        
         box = (Box) copy;
-        ctrlPanel.add(minLabel = new JLabel("Minima"), aConstraints);
-		aConstraints.gridx += 1;
-		aConstraints.fill = GridBagConstraints.HORIZONTAL;
-		aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
-        ctrlPanel.add(minimaField = new NumberField(), aConstraints);
-		aConstraints.gridwidth = 1;
-        minimaField.setVector(box.minima);
-		aConstraints.gridx = 0;
-		aConstraints.gridy += 1;
-		aConstraints.fill = GridBagConstraints.NONE;
-        ctrlPanel.add(maxLabel = new JLabel("Maxima"), aConstraints);
-		aConstraints.gridx += 1;
-		aConstraints.fill = GridBagConstraints.HORIZONTAL;
-		aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
-        ctrlPanel.add(maximaField = new NumberField(), aConstraints);
-		aConstraints.gridwidth = 1;
-        maximaField.setVector(box.maxima);
-		aConstraints.fill = GridBagConstraints.NONE;
-		aConstraints.gridx = 0;
-		aConstraints.gridy += 1;
+//        ctrlPanel.add(minLabel = new JLabel("Minima"), aConstraints);
+//		aConstraints.gridx += 1;
+//		aConstraints.fill = GridBagConstraints.HORIZONTAL;
+//		aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
+//        ctrlPanel.add(minimaField = new NumberField(), aConstraints);
+//		aConstraints.gridwidth = 1;
+//        minimaField.setVector(box.minima);
+//		aConstraints.gridx = 0;
+//		aConstraints.gridy += 1;
+//		aConstraints.fill = GridBagConstraints.NONE;
+//        ctrlPanel.add(maxLabel = new JLabel("Maxima"), aConstraints);
+//		aConstraints.gridx += 1;
+//		aConstraints.fill = GridBagConstraints.HORIZONTAL;
+//		aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
+//        ctrlPanel.add(maximaField = new NumberField(), aConstraints);
+//		aConstraints.gridwidth = 1;
+//        maximaField.setVector(box.maxima);
+//		aConstraints.fill = GridBagConstraints.NONE;
+//		aConstraints.gridx = 0;
+//		aConstraints.gridy += 1;
     }
 	
 	void Clear()
@@ -53,17 +68,56 @@
     }
     */
     
+	void SetupUI2(ObjEditor oe)
+	{
+            super.SetupUI2(oe);
+            
+            oe.ctrlPanel.add(optionCB = new JCheckBox("Close Surface", !box.open)); //, oe.aConstraints, oe.ctrlPanel.getComponentCount()-2);
+            optionCB.addItemListener(this);
+            oe.ctrlPanel.Return();
+        }
+        
+	public void itemStateChanged(ItemEvent e)
+	{
+		if (//e.getSource() == nameField ||
+        	    e.getSource() == optionCB)
+		{
+                    box.open = (e.getStateChange() != ItemEvent.SELECTED);
+                    
+                    applySelf();
+                    
+                    objEditor.refreshContents();
+                }
+                else
+                {
+                    super.itemStateChanged(e);
+                }
+	}
+	
+	
+	public void closeUI()
+	{
+            ObjEditor oe = GetEditor();
+
+            oe.ctrlPanel.remove(optionCB);
+
+            super.closeUI();
+	}
+	
     public void applySelf()
     {
 // june 2013        super.applySelf();
-        minimaField.getVector(box.minima);
-        maximaField.getVector(box.maxima);
+//        minimaField.getVector(box.minima);
+//        maximaField.getVector(box.maxima);
         box.recalculate();
     }
 	
     Box box;
-    JLabel minLabel;
-    JLabel maxLabel;
-    NumberField minimaField;
-    NumberField maximaField;
+    
+//    JLabel minLabel;
+//    JLabel maxLabel;
+//    NumberField minimaField;
+//    NumberField maximaField;
+    
+    JCheckBox optionCB;
 }

--
Gitblit v1.6.2