From 1d909ffa0c2beb51d453b53b845c4f3a749ca5f0 Mon Sep 17 00:00:00 2001
From: Normand Briere <nbriere@noware.ca>
Date: Mon, 10 Jun 2019 20:38:07 -0400
Subject: [PATCH] Undo/redo fully working
---
ObjEditor.java | 2
GroupEditor.java | 49 ++++++++++++++++++++----
Composite.java | 61 +++++++++++++++---------------
3 files changed, 73 insertions(+), 39 deletions(-)
diff --git a/Composite.java b/Composite.java
index 1d9e036..2a525ae 100644
--- a/Composite.java
+++ b/Composite.java
@@ -160,36 +160,37 @@
// //Touch();
// }
- public void clear()
- {
- if (blockloop)
- {
- //blockloop = false;
- return;
- }
-
- blockloop = true;
- //Applet3D.tracein("Clear", this);
- for (int i = 0; i < Children().size(); i++)
- {
- Object3D obj = (Object3D) Children().get(i); // reserve(i);
-
- //if (!obj.ReadOnly()) // Object3D Serial...
- if (!(obj instanceof Composite) || !((Composite) obj).ReadOnly())
- {
- obj.clear();
- //Children().release(i);
- Children().remove(i);
- --i;
- } else
- {
- //Children().release(i);
- }
- }
- //Applet3D.traceout("Clear", this);
-
- blockloop = false;
- }
+ // JUNE 2019??? That cannot work...
+// public void clear()
+// {
+// if (blockloop)
+// {
+// //blockloop = false;
+// return;
+// }
+//
+// blockloop = true;
+// //Applet3D.tracein("Clear", this);
+// for (int i = 0; i < Children().size(); i++)
+// {
+// Object3D obj = (Object3D) Children().get(i); // reserve(i);
+//
+// //if (!obj.ReadOnly()) // Object3D Serial...
+// if (!(obj instanceof Composite) || !((Composite) obj).ReadOnly())
+// {
+// obj.clear();
+// //Children().release(i);
+// Children().remove(i);
+// --i;
+// } else
+// {
+// //Children().release(i);
+// }
+// }
+// //Applet3D.traceout("Clear", this);
+//
+// blockloop = false;
+// }
boolean ReadOnly()
{
diff --git a/GroupEditor.java b/GroupEditor.java
index 3fdc5c4..b4f001a 100644
--- a/GroupEditor.java
+++ b/GroupEditor.java
@@ -154,11 +154,12 @@
oe.menuBar.add(menu = new Menu("Edit"));
//editItem = menu.add(new MenuItem("Edit"));
//editItem.addActionListener(this);
- undoItem = menu.add(new MenuItem("Undo"));
- undoItem.addActionListener(this);
- redoItem = menu.add(new MenuItem("Redo"));
- redoItem.addActionListener(this);
- menu.add("-");
+
+// undoItem = menu.add(new MenuItem("Undo"));
+// undoItem.addActionListener(this);
+// redoItem = menu.add(new MenuItem("Redo"));
+// redoItem.addActionListener(this);
+// menu.add("-");
duplicateItem = menu.add(new MenuItem("Duplicate"));
duplicateItem.addActionListener(this);
cloneItem = menu.add(new MenuItem("Clone"));
@@ -202,7 +203,7 @@
//zBufferItem.addActionListener(this);
//cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
//normalLensItem.addActionListener(this);
- cameraMenu.add(revertCameraItem = new MenuItem("Restore Camera"));
+ cameraMenu.add(revertCameraItem = new MenuItem("Restore Viewpoint"));
revertCameraItem.addActionListener(this);
cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
@@ -266,7 +267,7 @@
// animationItem.addItemListener(this);
// animationItem.setState(CameraPane.ANIMATION);
cameraMenu.add("-");
- cameraMenu.add(editCameraItem = new MenuItem("Save Camera"));
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
editCameraItem.addActionListener(this);
if (Globals.ADVANCED)
@@ -555,6 +556,18 @@
oe.buttonGroup.add(dummyButton);
*/
//this.AddOptions(oe.toolbarPanel, oe.aConstraints);
+
+ oe.toolbarPanel.add(undoButton = new cButton("Undo", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
+ undoButton.setToolTipText("Undo changes");
+ undoButton.addActionListener(this);
+
+ oe.toolbarPanel.add(redoButton = new cButton("Redo", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
+ redoButton.setToolTipText("Redo changes");
+ redoButton.addActionListener(this);
+
+ oe.toolbarPanel.add(saveButton = new cButton("Save", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
+ saveButton.setToolTipText("Save changes");
+ saveButton.addActionListener(this);
oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
liveCB.setToolTipText("Enable animation");
@@ -1956,6 +1969,18 @@
{
DumpObject();
} else
+ if (source == undoButton)
+ {
+ Undo();
+ } else
+ if (source == redoButton)
+ {
+ Redo();
+ } else
+ if (source == saveButton)
+ {
+ Save();
+ } else
if (source == oneStepButton)
{
Globals.ONESTEP = true;
@@ -3128,7 +3153,8 @@
sideView.object = group;
}
-// fix "+" issue group.editWindow = this;
+// fix "+" issue
+ group.editWindow = this;
/*
currentLayout = radio.layout;
@@ -4404,6 +4430,7 @@
{
if (group.selection.isEmpty())
return;
+
Grafreed.clipboardIsTempGroup = false;
Composite tGroup = null;
if (group.selection.size() > 0) // 1)
@@ -4414,6 +4441,7 @@
if (cut)
{
+ Save();
//int indices[] = jList.getSelectedIndices();
//for (int i = indices.length - 1; i >= 0; i--)
//jList.remove(indices[i]);
@@ -4503,8 +4531,10 @@
}
}
+
if (Grafreed.clipboardIsTempGroup)
Grafreed.clipboard = tGroup;
+
if (cut)
{
ResetModel();
@@ -5129,6 +5159,9 @@
cButton clearpanelButton;
cButton unselectButton;
+ cButton saveButton;
+ cButton undoButton;
+ cButton redoButton;
cButton oneStepButton;
cButton screenfitButton;
diff --git a/ObjEditor.java b/ObjEditor.java
index 422d126..b7c343d 100644
--- a/ObjEditor.java
+++ b/ObjEditor.java
@@ -3242,7 +3242,7 @@
for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
{
ab = (cRadio)e.nextElement();
- if(ab.GetObject() == client)
+ if(ab.GetObject() == copy)
{
return ab;
}
--
Gitblit v1.6.2