Normand Briere
2019-07-17 a5580a47d246c1272b10adba68070f6e13da5e41
GroupEditor.java
....@@ -84,10 +84,10 @@
8484
8585 void CloneSelection(boolean supports)
8686 {
87
- if (Globals.SAVEONMAKE)
87
+ if (Globals.REPLACEONMAKE)
8888 Save();
89
- boolean keep = Globals.SAVEONMAKE;
90
- Globals.SAVEONMAKE = false;
89
+ boolean keep = Globals.REPLACEONMAKE;
90
+ Globals.REPLACEONMAKE = false;
9191 // Object3D keep = GrafreeD.clipboard;
9292 //Object3D obj;
9393 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -98,7 +98,7 @@
9898
9999 makeSomething(clone, i==group.selection.size()-1);
100100 }
101
- Globals.SAVEONMAKE = keep;
101
+ Globals.REPLACEONMAKE = keep;
102102 }
103103
104104 void CloneClipboard(boolean supports)
....@@ -544,6 +544,7 @@
544544 buildToolsMenu(menu);
545545 }
546546
547
+
547548 void SetupUI2(ObjEditor oe)
548549 {
549550 // June 2019
....@@ -615,29 +616,42 @@
615616 restoreCameraButton.setToolTipText("Restore viewpoint");
616617 restoreCameraButton.addActionListener(this);
617618
619
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
620
+ saveButton.setToolTipText("New version");
621
+ saveButton.addActionListener(this);
622
+
618623 copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
619
- undoButton.setToolTipText("Undo changes");
624
+ undoButton.setToolTipText("Previous version");
620625 undoButton.addActionListener(this);
621626 undoButton.setEnabled(false);
622627
628
+ cGridBag updown = new cGridBag().setVertical(true);
629
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
630
+ restoreButton.setToolTipText("Restore current");
631
+ restoreButton.addActionListener(this);
632
+ restoreButton.setEnabled(false);
633
+
634
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
635
+ replaceButton.setToolTipText("Replace current");
636
+ replaceButton.addActionListener(this);
637
+ replaceButton.setEnabled(false);
638
+
639
+ copyOptionsPanel.add(updown);
640
+
623641 copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
624
- redoButton.setToolTipText("Redo changes");
642
+ redoButton.setToolTipText("Next version");
625643 redoButton.addActionListener(this);
626644 redoButton.setEnabled(false);
627645
628
- copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
629
- saveButton.setToolTipText("Save changes");
630
- saveButton.addActionListener(this);
631
-
632
- copyOptionsPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
646
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
633647 liveCB.setToolTipText("Enable animation");
634648 liveCB.addItemListener(this);
635649
636
- copyOptionsPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
650
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
637651 oneStepButton.setToolTipText("Animate one step forward");
638652 oneStepButton.addActionListener(this);
639653
640
- copyOptionsPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
654
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
641655 fastCB.setToolTipText("Fast mode");
642656 fastCB.addItemListener(this);
643657
....@@ -820,6 +834,9 @@
820834
821835 oe.treePanel.add(copyOptionsPanel);
822836 oe.treePanel.Return();
837
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 10, 0);
838
+ versionField = (cNumberSlider)sliderPane.getComponent(1);
839
+ sliderPane.preferredHeight = 1;
823840
824841 // mainPanel.setDividerLocation(0.5); //1.0);
825842 // mainPanel.setResizeWeight(0.5);
....@@ -945,9 +962,9 @@
945962 toggleSwitchCB.setToolTipText("Choose a single item");
946963 toggleSwitchCB.addItemListener(this);
947964
948
- panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints);
949
- autosaveCB.setToolTipText("On structure change");
950
- autosaveCB.addItemListener(this);
965
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
966
+ autokeepCB.setToolTipText("On structure change");
967
+ autokeepCB.addItemListener(this);
951968
952969 panel.Return();
953970 if (Globals.ADVANCED)
....@@ -1024,7 +1041,7 @@
10241041
10251042 cCheckBox oeilCB;
10261043 cCheckBox shadowCB;
1027
- cCheckBox autosaveCB;
1044
+ cCheckBox autokeepCB;
10281045 cCheckBox lookAtCB;
10291046
10301047 // static int COLOR = 1;
....@@ -1136,9 +1153,9 @@
11361153 {
11371154 Globals.FREEZEONMOVE ^= true;
11381155 }
1139
- else if(e.getSource() == autosaveCB)
1156
+ else if(e.getSource() == autokeepCB)
11401157 {
1141
- Globals.SAVEONMAKE ^= true;
1158
+ Globals.REPLACEONMAKE ^= true;
11421159 }
11431160 else if(e.getSource() == lookAtCB)
11441161 {
....@@ -2225,15 +2242,29 @@
22252242 } else
22262243 if (source == undoButton)
22272244 {
2228
- if (!Undo())
2229
- java.awt.Toolkit.getDefaultToolkit().beep();
2245
+ // Go to previous version
2246
+ //if (!Undo())
2247
+ //java.awt.Toolkit.getDefaultToolkit().beep();
2248
+ Undo();
2249
+ } else
2250
+ if (source == restoreButton)
2251
+ {
2252
+ // Restore current version
2253
+ Restore();
2254
+ } else
2255
+ if (source == replaceButton)
2256
+ {
2257
+ // Overwrite current version
2258
+ Replace();
22302259 } else
22312260 if (source == redoButton)
22322261 {
2262
+ // Go to next version
22332263 Redo();
22342264 } else
22352265 if (source == saveButton)
22362266 {
2267
+ // Save a new version
22372268 if (!Save(true))
22382269 java.awt.Toolkit.getDefaultToolkit().beep();
22392270 } else
....@@ -3479,6 +3510,9 @@
34793510 }
34803511
34813512 copy = group;
3513
+
3514
+ SetUndoStates();
3515
+
34823516 //Globals.theRenderer.object = group;
34833517 if(!useclient)
34843518 {
....@@ -4942,10 +4976,10 @@
49424976
49434977 void paste(boolean expand)
49444978 {
4945
- if (Globals.SAVEONMAKE)
4979
+ if (Globals.REPLACEONMAKE)
49464980 Save();
4947
- boolean keep = Globals.SAVEONMAKE;
4948
- Globals.SAVEONMAKE = false;
4981
+ boolean keep = Globals.REPLACEONMAKE;
4982
+ Globals.REPLACEONMAKE = false;
49494983 // if (GrafreeD.clipboard == null)
49504984 // return;
49514985 boolean first = true;
....@@ -5005,7 +5039,7 @@
50055039 Grafreed.clipboard.get(0).parent = keepparent;
50065040 }
50075041
5008
- Globals.SAVEONMAKE = keep;
5042
+ Globals.REPLACEONMAKE = keep;
50095043 ResetModel();
50105044 refreshContents();
50115045 }
....@@ -5141,10 +5175,10 @@
51415175
51425176 void group(Object3D csg, boolean grab)
51435177 {
5144
- if (Globals.SAVEONMAKE)
5178
+ if (Globals.REPLACEONMAKE)
51455179 Save();
5146
- boolean keep = Globals.SAVEONMAKE;
5147
- Globals.SAVEONMAKE = false;
5180
+ boolean keep = Globals.REPLACEONMAKE;
5181
+ Globals.REPLACEONMAKE = false;
51485182 if (//false) // why??
51495183 !group.selection.isEmpty())
51505184 {
....@@ -5258,15 +5292,15 @@
52585292 //node.add(csg);
52595293 //makeSomething(node);
52605294 makeSomething(csg);
5261
- Globals.SAVEONMAKE = keep;
5295
+ Globals.REPLACEONMAKE = keep;
52625296 }
52635297
52645298 void Ungroup(Object3D g)
52655299 {
5266
- if (Globals.SAVEONMAKE)
5300
+ if (Globals.REPLACEONMAKE)
52675301 Save();
5268
- boolean keep = Globals.SAVEONMAKE;
5269
- Globals.SAVEONMAKE = false;
5302
+ boolean keep = Globals.REPLACEONMAKE;
5303
+ Globals.REPLACEONMAKE = false;
52705304 if (g instanceof HiddenObject)
52715305 {
52725306 HiddenObject h = (HiddenObject) g;
....@@ -5283,7 +5317,7 @@
52835317 objEditor.makeSomething(g.get(i), false);
52845318 }
52855319 }
5286
- Globals.SAVEONMAKE = keep;
5320
+ Globals.REPLACEONMAKE = keep;
52875321 }
52885322
52895323 void ungroup()