.. | .. |
---|
60 | 60 | this.copy = this.group = group; |
---|
61 | 61 | //selectees = this.group.selectees; |
---|
62 | 62 | |
---|
| 63 | + if (copy.versions == null) |
---|
| 64 | + { |
---|
| 65 | + copy.versions = new byte[100][]; |
---|
| 66 | + copy.versionindex = -1; |
---|
| 67 | + } |
---|
| 68 | + |
---|
63 | 69 | if(ui) |
---|
64 | 70 | SetupUI(objEditor); |
---|
65 | 71 | } |
---|
.. | .. |
---|
74 | 80 | this.copy = this.group = copy; |
---|
75 | 81 | //selectees = this.group.selectees; |
---|
76 | 82 | |
---|
| 83 | + if (copy.versions == null) |
---|
| 84 | + { |
---|
| 85 | + copy.versions = new byte[100][]; |
---|
| 86 | + copy.versionindex = -1; |
---|
| 87 | + } |
---|
| 88 | + |
---|
77 | 89 | SetupMenu2(this); //objEditor); |
---|
78 | 90 | SetupUI2(objEditor); |
---|
79 | 91 | objEditor.SetupUI(true); |
---|
.. | .. |
---|
84 | 96 | |
---|
85 | 97 | void CloneSelection(boolean supports) |
---|
86 | 98 | { |
---|
87 | | - if (Globals.SAVEONMAKE) |
---|
| 99 | + if (Globals.REPLACEONMAKE) |
---|
88 | 100 | Save(); |
---|
89 | | - boolean keep = Globals.SAVEONMAKE; |
---|
90 | | - Globals.SAVEONMAKE = false; |
---|
| 101 | + boolean keep = Globals.REPLACEONMAKE; |
---|
| 102 | + Globals.REPLACEONMAKE = false; |
---|
91 | 103 | // Object3D keep = GrafreeD.clipboard; |
---|
92 | 104 | //Object3D obj; |
---|
93 | 105 | for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();) |
---|
.. | .. |
---|
98 | 110 | |
---|
99 | 111 | makeSomething(clone, i==group.selection.size()-1); |
---|
100 | 112 | } |
---|
101 | | - Globals.SAVEONMAKE = keep; |
---|
| 113 | + Globals.REPLACEONMAKE = keep; |
---|
102 | 114 | } |
---|
103 | 115 | |
---|
104 | 116 | void CloneClipboard(boolean supports) |
---|
.. | .. |
---|
544 | 556 | buildToolsMenu(menu); |
---|
545 | 557 | } |
---|
546 | 558 | |
---|
| 559 | + |
---|
547 | 560 | void SetupUI2(ObjEditor oe) |
---|
548 | 561 | { |
---|
549 | 562 | // June 2019 |
---|
.. | .. |
---|
615 | 628 | restoreCameraButton.setToolTipText("Restore viewpoint"); |
---|
616 | 629 | restoreCameraButton.addActionListener(this); |
---|
617 | 630 | |
---|
| 631 | + copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 632 | + saveButton.setToolTipText("New version"); |
---|
| 633 | + saveButton.addActionListener(this); |
---|
| 634 | + |
---|
618 | 635 | copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
619 | | - undoButton.setToolTipText("Undo changes"); |
---|
| 636 | + undoButton.setToolTipText("Previous version"); |
---|
620 | 637 | undoButton.addActionListener(this); |
---|
621 | 638 | undoButton.setEnabled(false); |
---|
622 | 639 | |
---|
| 640 | + cGridBag updown = new cGridBag().setVertical(true); |
---|
| 641 | + updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 642 | + restoreButton.setToolTipText("Restore current"); |
---|
| 643 | + restoreButton.addActionListener(this); |
---|
| 644 | + restoreButton.setEnabled(false); |
---|
| 645 | + |
---|
| 646 | + updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 647 | + replaceButton.setToolTipText("Replace current"); |
---|
| 648 | + replaceButton.addActionListener(this); |
---|
| 649 | + replaceButton.setEnabled(false); |
---|
| 650 | + |
---|
| 651 | + copyOptionsPanel.add(updown); |
---|
| 652 | + |
---|
623 | 653 | copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
624 | | - redoButton.setToolTipText("Redo changes"); |
---|
| 654 | + redoButton.setToolTipText("Next version"); |
---|
625 | 655 | redoButton.addActionListener(this); |
---|
626 | 656 | redoButton.setEnabled(false); |
---|
627 | 657 | |
---|
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); |
---|
| 658 | + oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints); |
---|
633 | 659 | liveCB.setToolTipText("Enable animation"); |
---|
634 | 660 | liveCB.addItemListener(this); |
---|
635 | 661 | |
---|
636 | | - copyOptionsPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 662 | + oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
637 | 663 | oneStepButton.setToolTipText("Animate one step forward"); |
---|
638 | 664 | oneStepButton.addActionListener(this); |
---|
639 | 665 | |
---|
640 | | - copyOptionsPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints); |
---|
| 666 | + oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints); |
---|
641 | 667 | fastCB.setToolTipText("Fast mode"); |
---|
642 | 668 | fastCB.addItemListener(this); |
---|
643 | 669 | |
---|
.. | .. |
---|
820 | 846 | |
---|
821 | 847 | oe.treePanel.add(copyOptionsPanel); |
---|
822 | 848 | oe.treePanel.Return(); |
---|
| 849 | + cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0); |
---|
| 850 | + versionSlider = (cNumberSlider)sliderPane.getComponent(1); |
---|
| 851 | + sliderPane.preferredHeight = 1; |
---|
823 | 852 | |
---|
824 | 853 | // mainPanel.setDividerLocation(0.5); //1.0); |
---|
825 | 854 | // mainPanel.setResizeWeight(0.5); |
---|
.. | .. |
---|
945 | 974 | toggleSwitchCB.setToolTipText("Choose a single item"); |
---|
946 | 975 | toggleSwitchCB.addItemListener(this); |
---|
947 | 976 | |
---|
948 | | - panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints); |
---|
949 | | - autosaveCB.setToolTipText("On structure change"); |
---|
950 | | - autosaveCB.addItemListener(this); |
---|
| 977 | + panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints); |
---|
| 978 | + autokeepCB.setToolTipText("On structure change"); |
---|
| 979 | + autokeepCB.addItemListener(this); |
---|
951 | 980 | |
---|
952 | 981 | panel.Return(); |
---|
953 | 982 | if (Globals.ADVANCED) |
---|
.. | .. |
---|
1024 | 1053 | |
---|
1025 | 1054 | cCheckBox oeilCB; |
---|
1026 | 1055 | cCheckBox shadowCB; |
---|
1027 | | - cCheckBox autosaveCB; |
---|
| 1056 | + cCheckBox autokeepCB; |
---|
1028 | 1057 | cCheckBox lookAtCB; |
---|
1029 | 1058 | |
---|
1030 | 1059 | // static int COLOR = 1; |
---|
.. | .. |
---|
1136 | 1165 | { |
---|
1137 | 1166 | Globals.FREEZEONMOVE ^= true; |
---|
1138 | 1167 | } |
---|
1139 | | - else if(e.getSource() == autosaveCB) |
---|
| 1168 | + else if(e.getSource() == autokeepCB) |
---|
1140 | 1169 | { |
---|
1141 | | - Globals.SAVEONMAKE ^= true; |
---|
| 1170 | + Globals.REPLACEONMAKE ^= true; |
---|
1142 | 1171 | } |
---|
1143 | 1172 | else if(e.getSource() == lookAtCB) |
---|
1144 | 1173 | { |
---|
.. | .. |
---|
2225 | 2254 | } else |
---|
2226 | 2255 | if (source == undoButton) |
---|
2227 | 2256 | { |
---|
2228 | | - if (!Undo()) |
---|
2229 | | - java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 2257 | + // Go to previous version |
---|
| 2258 | + //if (!Undo()) |
---|
| 2259 | + //java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 2260 | + Undo(); |
---|
| 2261 | + } else |
---|
| 2262 | + if (source == restoreButton) |
---|
| 2263 | + { |
---|
| 2264 | + // Restore current version |
---|
| 2265 | + Restore(); |
---|
| 2266 | + } else |
---|
| 2267 | + if (source == replaceButton) |
---|
| 2268 | + { |
---|
| 2269 | + // Overwrite current version |
---|
| 2270 | + Replace(); |
---|
2230 | 2271 | } else |
---|
2231 | 2272 | if (source == redoButton) |
---|
2232 | 2273 | { |
---|
| 2274 | + // Go to next version |
---|
2233 | 2275 | Redo(); |
---|
2234 | 2276 | } else |
---|
2235 | 2277 | if (source == saveButton) |
---|
2236 | 2278 | { |
---|
| 2279 | + // Save a new version |
---|
2237 | 2280 | if (!Save(true)) |
---|
2238 | 2281 | java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
2239 | 2282 | } else |
---|
.. | .. |
---|
3479 | 3522 | } |
---|
3480 | 3523 | |
---|
3481 | 3524 | copy = group; |
---|
| 3525 | + |
---|
| 3526 | + SetUndoStates(); |
---|
| 3527 | + |
---|
3482 | 3528 | //Globals.theRenderer.object = group; |
---|
3483 | 3529 | if(!useclient) |
---|
3484 | 3530 | { |
---|
.. | .. |
---|
3507 | 3553 | radio.layout.doClick(); |
---|
3508 | 3554 | |
---|
3509 | 3555 | ClearUnpinned(); |
---|
| 3556 | + Grafreed.Assert(group != null); |
---|
| 3557 | + Grafreed.Assert(group.selection != null); |
---|
3510 | 3558 | SetPinStates(group.selection.size() > 0); |
---|
3511 | 3559 | if (group.selection.size() == 1) |
---|
3512 | 3560 | EditSelection(false); |
---|
.. | .. |
---|
4942 | 4990 | |
---|
4943 | 4991 | void paste(boolean expand) |
---|
4944 | 4992 | { |
---|
4945 | | - if (Globals.SAVEONMAKE) |
---|
| 4993 | + if (Globals.REPLACEONMAKE) |
---|
4946 | 4994 | Save(); |
---|
4947 | | - boolean keep = Globals.SAVEONMAKE; |
---|
4948 | | - Globals.SAVEONMAKE = false; |
---|
| 4995 | + boolean keep = Globals.REPLACEONMAKE; |
---|
| 4996 | + Globals.REPLACEONMAKE = false; |
---|
4949 | 4997 | // if (GrafreeD.clipboard == null) |
---|
4950 | 4998 | // return; |
---|
4951 | 4999 | boolean first = true; |
---|
.. | .. |
---|
5005 | 5053 | Grafreed.clipboard.get(0).parent = keepparent; |
---|
5006 | 5054 | } |
---|
5007 | 5055 | |
---|
5008 | | - Globals.SAVEONMAKE = keep; |
---|
| 5056 | + Globals.REPLACEONMAKE = keep; |
---|
5009 | 5057 | ResetModel(); |
---|
5010 | 5058 | refreshContents(); |
---|
5011 | 5059 | } |
---|
.. | .. |
---|
5141 | 5189 | |
---|
5142 | 5190 | void group(Object3D csg, boolean grab) |
---|
5143 | 5191 | { |
---|
5144 | | - if (Globals.SAVEONMAKE) |
---|
| 5192 | + if (Globals.REPLACEONMAKE) |
---|
5145 | 5193 | Save(); |
---|
5146 | | - boolean keep = Globals.SAVEONMAKE; |
---|
5147 | | - Globals.SAVEONMAKE = false; |
---|
| 5194 | + boolean keep = Globals.REPLACEONMAKE; |
---|
| 5195 | + Globals.REPLACEONMAKE = false; |
---|
5148 | 5196 | if (//false) // why?? |
---|
5149 | 5197 | !group.selection.isEmpty()) |
---|
5150 | 5198 | { |
---|
.. | .. |
---|
5258 | 5306 | //node.add(csg); |
---|
5259 | 5307 | //makeSomething(node); |
---|
5260 | 5308 | makeSomething(csg); |
---|
5261 | | - Globals.SAVEONMAKE = keep; |
---|
| 5309 | + Globals.REPLACEONMAKE = keep; |
---|
5262 | 5310 | } |
---|
5263 | 5311 | |
---|
5264 | 5312 | void Ungroup(Object3D g) |
---|
5265 | 5313 | { |
---|
5266 | | - if (Globals.SAVEONMAKE) |
---|
| 5314 | + if (Globals.REPLACEONMAKE) |
---|
5267 | 5315 | Save(); |
---|
5268 | | - boolean keep = Globals.SAVEONMAKE; |
---|
5269 | | - Globals.SAVEONMAKE = false; |
---|
| 5316 | + boolean keep = Globals.REPLACEONMAKE; |
---|
| 5317 | + Globals.REPLACEONMAKE = false; |
---|
5270 | 5318 | if (g instanceof HiddenObject) |
---|
5271 | 5319 | { |
---|
5272 | 5320 | HiddenObject h = (HiddenObject) g; |
---|
.. | .. |
---|
5283 | 5331 | objEditor.makeSomething(g.get(i), false); |
---|
5284 | 5332 | } |
---|
5285 | 5333 | } |
---|
5286 | | - Globals.SAVEONMAKE = keep; |
---|
| 5334 | + Globals.REPLACEONMAKE = keep; |
---|
5287 | 5335 | } |
---|
5288 | 5336 | |
---|
5289 | 5337 | void ungroup() |
---|