.. | .. |
---|
84 | 84 | |
---|
85 | 85 | void CloneSelection(boolean supports) |
---|
86 | 86 | { |
---|
87 | | - if (Globals.SAVEONMAKE) |
---|
| 87 | + if (Globals.REPLACEONMAKE) |
---|
88 | 88 | Save(); |
---|
89 | | - boolean keep = Globals.SAVEONMAKE; |
---|
90 | | - Globals.SAVEONMAKE = false; |
---|
| 89 | + boolean keep = Globals.REPLACEONMAKE; |
---|
| 90 | + Globals.REPLACEONMAKE = false; |
---|
91 | 91 | // Object3D keep = GrafreeD.clipboard; |
---|
92 | 92 | //Object3D obj; |
---|
93 | 93 | for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();) |
---|
.. | .. |
---|
98 | 98 | |
---|
99 | 99 | makeSomething(clone, i==group.selection.size()-1); |
---|
100 | 100 | } |
---|
101 | | - Globals.SAVEONMAKE = keep; |
---|
| 101 | + Globals.REPLACEONMAKE = keep; |
---|
102 | 102 | } |
---|
103 | 103 | |
---|
104 | 104 | void CloneClipboard(boolean supports) |
---|
.. | .. |
---|
544 | 544 | buildToolsMenu(menu); |
---|
545 | 545 | } |
---|
546 | 546 | |
---|
| 547 | + |
---|
547 | 548 | void SetupUI2(ObjEditor oe) |
---|
548 | 549 | { |
---|
549 | 550 | // June 2019 |
---|
.. | .. |
---|
615 | 616 | restoreCameraButton.setToolTipText("Restore viewpoint"); |
---|
616 | 617 | restoreCameraButton.addActionListener(this); |
---|
617 | 618 | |
---|
| 619 | + copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 620 | + saveButton.setToolTipText("New version"); |
---|
| 621 | + saveButton.addActionListener(this); |
---|
| 622 | + |
---|
618 | 623 | copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
619 | | - undoButton.setToolTipText("Undo changes"); |
---|
| 624 | + undoButton.setToolTipText("Previous version"); |
---|
620 | 625 | undoButton.addActionListener(this); |
---|
621 | 626 | undoButton.setEnabled(false); |
---|
622 | 627 | |
---|
| 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 | + |
---|
623 | 641 | copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
624 | | - redoButton.setToolTipText("Redo changes"); |
---|
| 642 | + redoButton.setToolTipText("Next version"); |
---|
625 | 643 | redoButton.addActionListener(this); |
---|
626 | 644 | redoButton.setEnabled(false); |
---|
627 | 645 | |
---|
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); |
---|
633 | 647 | liveCB.setToolTipText("Enable animation"); |
---|
634 | 648 | liveCB.addItemListener(this); |
---|
635 | 649 | |
---|
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); |
---|
637 | 651 | oneStepButton.setToolTipText("Animate one step forward"); |
---|
638 | 652 | oneStepButton.addActionListener(this); |
---|
639 | 653 | |
---|
640 | | - copyOptionsPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints); |
---|
| 654 | + oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints); |
---|
641 | 655 | fastCB.setToolTipText("Fast mode"); |
---|
642 | 656 | fastCB.addItemListener(this); |
---|
643 | 657 | |
---|
.. | .. |
---|
820 | 834 | |
---|
821 | 835 | oe.treePanel.add(copyOptionsPanel); |
---|
822 | 836 | oe.treePanel.Return(); |
---|
| 837 | + cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 10, 0); |
---|
| 838 | + versionField = (cNumberSlider)sliderPane.getComponent(1); |
---|
| 839 | + sliderPane.preferredHeight = 1; |
---|
823 | 840 | |
---|
824 | 841 | // mainPanel.setDividerLocation(0.5); //1.0); |
---|
825 | 842 | // mainPanel.setResizeWeight(0.5); |
---|
.. | .. |
---|
945 | 962 | toggleSwitchCB.setToolTipText("Choose a single item"); |
---|
946 | 963 | toggleSwitchCB.addItemListener(this); |
---|
947 | 964 | |
---|
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); |
---|
951 | 968 | |
---|
952 | 969 | panel.Return(); |
---|
953 | 970 | if (Globals.ADVANCED) |
---|
.. | .. |
---|
1024 | 1041 | |
---|
1025 | 1042 | cCheckBox oeilCB; |
---|
1026 | 1043 | cCheckBox shadowCB; |
---|
1027 | | - cCheckBox autosaveCB; |
---|
| 1044 | + cCheckBox autokeepCB; |
---|
1028 | 1045 | cCheckBox lookAtCB; |
---|
1029 | 1046 | |
---|
1030 | 1047 | // static int COLOR = 1; |
---|
.. | .. |
---|
1136 | 1153 | { |
---|
1137 | 1154 | Globals.FREEZEONMOVE ^= true; |
---|
1138 | 1155 | } |
---|
1139 | | - else if(e.getSource() == autosaveCB) |
---|
| 1156 | + else if(e.getSource() == autokeepCB) |
---|
1140 | 1157 | { |
---|
1141 | | - Globals.SAVEONMAKE ^= true; |
---|
| 1158 | + Globals.REPLACEONMAKE ^= true; |
---|
1142 | 1159 | } |
---|
1143 | 1160 | else if(e.getSource() == lookAtCB) |
---|
1144 | 1161 | { |
---|
.. | .. |
---|
2225 | 2242 | } else |
---|
2226 | 2243 | if (source == undoButton) |
---|
2227 | 2244 | { |
---|
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(); |
---|
2230 | 2259 | } else |
---|
2231 | 2260 | if (source == redoButton) |
---|
2232 | 2261 | { |
---|
| 2262 | + // Go to next version |
---|
2233 | 2263 | Redo(); |
---|
2234 | 2264 | } else |
---|
2235 | 2265 | if (source == saveButton) |
---|
2236 | 2266 | { |
---|
| 2267 | + // Save a new version |
---|
2237 | 2268 | if (!Save(true)) |
---|
2238 | 2269 | java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
2239 | 2270 | } else |
---|
.. | .. |
---|
3479 | 3510 | } |
---|
3480 | 3511 | |
---|
3481 | 3512 | copy = group; |
---|
| 3513 | + |
---|
| 3514 | + SetUndoStates(); |
---|
| 3515 | + |
---|
3482 | 3516 | //Globals.theRenderer.object = group; |
---|
3483 | 3517 | if(!useclient) |
---|
3484 | 3518 | { |
---|
.. | .. |
---|
4942 | 4976 | |
---|
4943 | 4977 | void paste(boolean expand) |
---|
4944 | 4978 | { |
---|
4945 | | - if (Globals.SAVEONMAKE) |
---|
| 4979 | + if (Globals.REPLACEONMAKE) |
---|
4946 | 4980 | Save(); |
---|
4947 | | - boolean keep = Globals.SAVEONMAKE; |
---|
4948 | | - Globals.SAVEONMAKE = false; |
---|
| 4981 | + boolean keep = Globals.REPLACEONMAKE; |
---|
| 4982 | + Globals.REPLACEONMAKE = false; |
---|
4949 | 4983 | // if (GrafreeD.clipboard == null) |
---|
4950 | 4984 | // return; |
---|
4951 | 4985 | boolean first = true; |
---|
.. | .. |
---|
5005 | 5039 | Grafreed.clipboard.get(0).parent = keepparent; |
---|
5006 | 5040 | } |
---|
5007 | 5041 | |
---|
5008 | | - Globals.SAVEONMAKE = keep; |
---|
| 5042 | + Globals.REPLACEONMAKE = keep; |
---|
5009 | 5043 | ResetModel(); |
---|
5010 | 5044 | refreshContents(); |
---|
5011 | 5045 | } |
---|
.. | .. |
---|
5141 | 5175 | |
---|
5142 | 5176 | void group(Object3D csg, boolean grab) |
---|
5143 | 5177 | { |
---|
5144 | | - if (Globals.SAVEONMAKE) |
---|
| 5178 | + if (Globals.REPLACEONMAKE) |
---|
5145 | 5179 | Save(); |
---|
5146 | | - boolean keep = Globals.SAVEONMAKE; |
---|
5147 | | - Globals.SAVEONMAKE = false; |
---|
| 5180 | + boolean keep = Globals.REPLACEONMAKE; |
---|
| 5181 | + Globals.REPLACEONMAKE = false; |
---|
5148 | 5182 | if (//false) // why?? |
---|
5149 | 5183 | !group.selection.isEmpty()) |
---|
5150 | 5184 | { |
---|
.. | .. |
---|
5258 | 5292 | //node.add(csg); |
---|
5259 | 5293 | //makeSomething(node); |
---|
5260 | 5294 | makeSomething(csg); |
---|
5261 | | - Globals.SAVEONMAKE = keep; |
---|
| 5295 | + Globals.REPLACEONMAKE = keep; |
---|
5262 | 5296 | } |
---|
5263 | 5297 | |
---|
5264 | 5298 | void Ungroup(Object3D g) |
---|
5265 | 5299 | { |
---|
5266 | | - if (Globals.SAVEONMAKE) |
---|
| 5300 | + if (Globals.REPLACEONMAKE) |
---|
5267 | 5301 | Save(); |
---|
5268 | | - boolean keep = Globals.SAVEONMAKE; |
---|
5269 | | - Globals.SAVEONMAKE = false; |
---|
| 5302 | + boolean keep = Globals.REPLACEONMAKE; |
---|
| 5303 | + Globals.REPLACEONMAKE = false; |
---|
5270 | 5304 | if (g instanceof HiddenObject) |
---|
5271 | 5305 | { |
---|
5272 | 5306 | HiddenObject h = (HiddenObject) g; |
---|
.. | .. |
---|
5283 | 5317 | objEditor.makeSomething(g.get(i), false); |
---|
5284 | 5318 | } |
---|
5285 | 5319 | } |
---|
5286 | | - Globals.SAVEONMAKE = keep; |
---|
| 5320 | + Globals.REPLACEONMAKE = keep; |
---|
5287 | 5321 | } |
---|
5288 | 5322 | |
---|
5289 | 5323 | void ungroup() |
---|