.. | .. |
---|
84 | 84 | |
---|
85 | 85 | void CloneSelection(boolean supports) |
---|
86 | 86 | { |
---|
| 87 | + if (Globals.REPLACEONMAKE) |
---|
| 88 | + Save(); |
---|
| 89 | + boolean keep = Globals.REPLACEONMAKE; |
---|
| 90 | + Globals.REPLACEONMAKE = false; |
---|
87 | 91 | // Object3D keep = GrafreeD.clipboard; |
---|
88 | 92 | //Object3D obj; |
---|
89 | 93 | for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();) |
---|
.. | .. |
---|
94 | 98 | |
---|
95 | 99 | makeSomething(clone, i==group.selection.size()-1); |
---|
96 | 100 | } |
---|
| 101 | + Globals.REPLACEONMAKE = keep; |
---|
97 | 102 | } |
---|
98 | 103 | |
---|
99 | 104 | void CloneClipboard(boolean supports) |
---|
.. | .. |
---|
380 | 385 | shadowYItem.addActionListener(this); |
---|
381 | 386 | shadowZItem = menu.add(new MenuItem("Shadow Blue")); |
---|
382 | 387 | shadowZItem.addActionListener(this); |
---|
| 388 | + attributeItem = menu.add(new MenuItem("Attribute")); |
---|
| 389 | + attributeItem.addActionListener(this); |
---|
383 | 390 | |
---|
384 | 391 | if (Globals.ADVANCED) |
---|
385 | 392 | { |
---|
386 | 393 | menu.add("-"); |
---|
387 | 394 | linkerItem = menu.add(new MenuItem("Linker")); |
---|
388 | 395 | linkerItem.addActionListener(this); |
---|
389 | | - attributeItem = menu.add(new MenuItem("Attribute")); |
---|
390 | | - attributeItem.addActionListener(this); |
---|
391 | 396 | templateItem = menu.add(new MenuItem("Template")); |
---|
392 | 397 | templateItem.addActionListener(this); |
---|
393 | 398 | pointflowItem = menu.add(new MenuItem("Point Flow")); |
---|
.. | .. |
---|
539 | 544 | buildToolsMenu(menu); |
---|
540 | 545 | } |
---|
541 | 546 | |
---|
| 547 | + |
---|
542 | 548 | void SetupUI2(ObjEditor oe) |
---|
543 | 549 | { |
---|
544 | 550 | // June 2019 |
---|
.. | .. |
---|
610 | 616 | restoreCameraButton.setToolTipText("Restore viewpoint"); |
---|
611 | 617 | restoreCameraButton.addActionListener(this); |
---|
612 | 618 | |
---|
| 619 | + copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 620 | + saveButton.setToolTipText("New version"); |
---|
| 621 | + saveButton.addActionListener(this); |
---|
| 622 | + |
---|
613 | 623 | copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
614 | | - undoButton.setToolTipText("Undo changes"); |
---|
| 624 | + undoButton.setToolTipText("Previous version"); |
---|
615 | 625 | undoButton.addActionListener(this); |
---|
616 | 626 | undoButton.setEnabled(false); |
---|
617 | 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 | + |
---|
618 | 641 | copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
619 | | - redoButton.setToolTipText("Redo changes"); |
---|
| 642 | + redoButton.setToolTipText("Next version"); |
---|
620 | 643 | redoButton.addActionListener(this); |
---|
621 | 644 | redoButton.setEnabled(false); |
---|
622 | 645 | |
---|
623 | | - copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
624 | | - saveButton.setToolTipText("Save changes"); |
---|
625 | | - saveButton.addActionListener(this); |
---|
626 | | - |
---|
627 | | - copyOptionsPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints); |
---|
| 646 | + oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints); |
---|
628 | 647 | liveCB.setToolTipText("Enable animation"); |
---|
629 | 648 | liveCB.addItemListener(this); |
---|
630 | 649 | |
---|
631 | | - copyOptionsPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 650 | + oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
632 | 651 | oneStepButton.setToolTipText("Animate one step forward"); |
---|
633 | 652 | oneStepButton.addActionListener(this); |
---|
634 | 653 | |
---|
635 | | - copyOptionsPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints); |
---|
| 654 | + oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints); |
---|
636 | 655 | fastCB.setToolTipText("Fast mode"); |
---|
637 | 656 | fastCB.addItemListener(this); |
---|
638 | 657 | |
---|
.. | .. |
---|
815 | 834 | |
---|
816 | 835 | oe.treePanel.add(copyOptionsPanel); |
---|
817 | 836 | oe.treePanel.Return(); |
---|
| 837 | + cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 10, 0); |
---|
| 838 | + versionField = (cNumberSlider)sliderPane.getComponent(1); |
---|
| 839 | + sliderPane.preferredHeight = 1; |
---|
818 | 840 | |
---|
819 | 841 | // mainPanel.setDividerLocation(0.5); //1.0); |
---|
820 | 842 | // mainPanel.setResizeWeight(0.5); |
---|
.. | .. |
---|
940 | 962 | toggleSwitchCB.setToolTipText("Choose a single item"); |
---|
941 | 963 | toggleSwitchCB.addItemListener(this); |
---|
942 | 964 | |
---|
943 | | - panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints); |
---|
944 | | - autosaveCB.setToolTipText("On structure change"); |
---|
945 | | - autosaveCB.addItemListener(this); |
---|
| 965 | + panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints); |
---|
| 966 | + autokeepCB.setToolTipText("On structure change"); |
---|
| 967 | + autokeepCB.addItemListener(this); |
---|
946 | 968 | |
---|
947 | 969 | panel.Return(); |
---|
948 | 970 | if (Globals.ADVANCED) |
---|
.. | .. |
---|
971 | 993 | { |
---|
972 | 994 | cRadio radioButton = new cRadio(obj.name); |
---|
973 | 995 | |
---|
974 | | - // Patch to avoid bug with transparency. |
---|
| 996 | + // June 2019. Patch to avoid bug with transparency. |
---|
975 | 997 | radioButton.hadMaterial = obj.material != null; |
---|
976 | 998 | if (!radioButton.hadMaterial) |
---|
977 | 999 | { |
---|
.. | .. |
---|
1019 | 1041 | |
---|
1020 | 1042 | cCheckBox oeilCB; |
---|
1021 | 1043 | cCheckBox shadowCB; |
---|
1022 | | - cCheckBox autosaveCB; |
---|
| 1044 | + cCheckBox autokeepCB; |
---|
1023 | 1045 | cCheckBox lookAtCB; |
---|
1024 | 1046 | |
---|
1025 | 1047 | // static int COLOR = 1; |
---|
.. | .. |
---|
1131 | 1153 | { |
---|
1132 | 1154 | Globals.FREEZEONMOVE ^= true; |
---|
1133 | 1155 | } |
---|
1134 | | - else if(e.getSource() == autosaveCB) |
---|
| 1156 | + else if(e.getSource() == autokeepCB) |
---|
1135 | 1157 | { |
---|
1136 | | - Globals.SAVEONMAKE ^= true; |
---|
| 1158 | + Globals.REPLACEONMAKE ^= true; |
---|
1137 | 1159 | } |
---|
1138 | 1160 | else if(e.getSource() == lookAtCB) |
---|
1139 | 1161 | { |
---|
.. | .. |
---|
1223 | 1245 | // return; |
---|
1224 | 1246 | // } |
---|
1225 | 1247 | |
---|
1226 | | - String string = (String) object; |
---|
| 1248 | + String string = object.toString(); |
---|
1227 | 1249 | |
---|
1228 | 1250 | // File path for Mac and Windows |
---|
1229 | 1251 | if (string.charAt(0) == '/' || string.charAt(1) == ':') |
---|
.. | .. |
---|
1488 | 1510 | reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)")); |
---|
1489 | 1511 | reduce34MorphItem.addActionListener(this); |
---|
1490 | 1512 | menu.add("-"); |
---|
| 1513 | + menu.add(memoryItem = new MenuItem("Memory Usage")); |
---|
| 1514 | + memoryItem.addActionListener(this); |
---|
1491 | 1515 | menu.add(computeAOItem = new MenuItem("Compute AO")); |
---|
1492 | 1516 | computeAOItem.addActionListener(this); |
---|
1493 | 1517 | |
---|
.. | .. |
---|
1496 | 1520 | mirrorItem = menu.add(new MenuItem("Mirror Poses")); |
---|
1497 | 1521 | mirrorItem.addActionListener(this); |
---|
1498 | 1522 | menu.add("-"); |
---|
1499 | | - menu.add(memoryItem = new MenuItem("Memory Usage")); |
---|
1500 | | - memoryItem.addActionListener(this); |
---|
1501 | 1523 | menu.add(analyzeItem = new MenuItem("Analyze")); |
---|
1502 | 1524 | analyzeItem.addActionListener(this); |
---|
1503 | 1525 | menu.add(dumpItem = new MenuItem("Print")); |
---|
.. | .. |
---|
2220 | 2242 | } else |
---|
2221 | 2243 | if (source == undoButton) |
---|
2222 | 2244 | { |
---|
2223 | | - if (!Undo()) |
---|
2224 | | - 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(); |
---|
2225 | 2259 | } else |
---|
2226 | 2260 | if (source == redoButton) |
---|
2227 | 2261 | { |
---|
| 2262 | + // Go to next version |
---|
2228 | 2263 | Redo(); |
---|
2229 | 2264 | } else |
---|
2230 | 2265 | if (source == saveButton) |
---|
2231 | 2266 | { |
---|
| 2267 | + // Save a new version |
---|
2232 | 2268 | if (!Save(true)) |
---|
2233 | 2269 | java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
2234 | 2270 | } else |
---|
.. | .. |
---|
3474 | 3510 | } |
---|
3475 | 3511 | |
---|
3476 | 3512 | copy = group; |
---|
| 3513 | + |
---|
| 3514 | + SetUndoStates(); |
---|
| 3515 | + |
---|
3477 | 3516 | //Globals.theRenderer.object = group; |
---|
3478 | 3517 | if(!useclient) |
---|
3479 | 3518 | { |
---|
.. | .. |
---|
4833 | 4872 | |
---|
4834 | 4873 | if (cut) |
---|
4835 | 4874 | { |
---|
4836 | | - if (Globals.SAVEONMAKE) |
---|
4837 | | - Save(); |
---|
| 4875 | +// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save. |
---|
| 4876 | +// Save(); |
---|
4838 | 4877 | //int indices[] = jList.getSelectedIndices(); |
---|
4839 | 4878 | //for (int i = indices.length - 1; i >= 0; i--) |
---|
4840 | 4879 | //jList.remove(indices[i]); |
---|
.. | .. |
---|
4937 | 4976 | |
---|
4938 | 4977 | void paste(boolean expand) |
---|
4939 | 4978 | { |
---|
| 4979 | + if (Globals.REPLACEONMAKE) |
---|
| 4980 | + Save(); |
---|
| 4981 | + boolean keep = Globals.REPLACEONMAKE; |
---|
| 4982 | + Globals.REPLACEONMAKE = false; |
---|
4940 | 4983 | // if (GrafreeD.clipboard == null) |
---|
4941 | 4984 | // return; |
---|
4942 | 4985 | boolean first = true; |
---|
.. | .. |
---|
4996 | 5039 | Grafreed.clipboard.get(0).parent = keepparent; |
---|
4997 | 5040 | } |
---|
4998 | 5041 | |
---|
| 5042 | + Globals.REPLACEONMAKE = keep; |
---|
4999 | 5043 | ResetModel(); |
---|
5000 | 5044 | refreshContents(); |
---|
5001 | 5045 | } |
---|
.. | .. |
---|
5131 | 5175 | |
---|
5132 | 5176 | void group(Object3D csg, boolean grab) |
---|
5133 | 5177 | { |
---|
| 5178 | + if (Globals.REPLACEONMAKE) |
---|
| 5179 | + Save(); |
---|
| 5180 | + boolean keep = Globals.REPLACEONMAKE; |
---|
| 5181 | + Globals.REPLACEONMAKE = false; |
---|
5134 | 5182 | if (//false) // why?? |
---|
5135 | 5183 | !group.selection.isEmpty()) |
---|
5136 | 5184 | { |
---|
.. | .. |
---|
5244 | 5292 | //node.add(csg); |
---|
5245 | 5293 | //makeSomething(node); |
---|
5246 | 5294 | makeSomething(csg); |
---|
| 5295 | + Globals.REPLACEONMAKE = keep; |
---|
5247 | 5296 | } |
---|
5248 | 5297 | |
---|
5249 | 5298 | void Ungroup(Object3D g) |
---|
5250 | 5299 | { |
---|
| 5300 | + if (Globals.REPLACEONMAKE) |
---|
| 5301 | + Save(); |
---|
| 5302 | + boolean keep = Globals.REPLACEONMAKE; |
---|
| 5303 | + Globals.REPLACEONMAKE = false; |
---|
5251 | 5304 | if (g instanceof HiddenObject) |
---|
5252 | 5305 | { |
---|
5253 | 5306 | HiddenObject h = (HiddenObject) g; |
---|
.. | .. |
---|
5264 | 5317 | objEditor.makeSomething(g.get(i), false); |
---|
5265 | 5318 | } |
---|
5266 | 5319 | } |
---|
| 5320 | + Globals.REPLACEONMAKE = keep; |
---|
5267 | 5321 | } |
---|
5268 | 5322 | |
---|
5269 | 5323 | void ungroup() |
---|