.. | .. |
---|
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 | { |
---|
| 99 | + if (Globals.REPLACEONMAKE) |
---|
| 100 | + Save(); |
---|
| 101 | + boolean keep = Globals.REPLACEONMAKE; |
---|
| 102 | + Globals.REPLACEONMAKE = false; |
---|
87 | 103 | // Object3D keep = GrafreeD.clipboard; |
---|
88 | 104 | //Object3D obj; |
---|
89 | 105 | for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();) |
---|
.. | .. |
---|
94 | 110 | |
---|
95 | 111 | makeSomething(clone, i==group.selection.size()-1); |
---|
96 | 112 | } |
---|
| 113 | + Globals.REPLACEONMAKE = keep; |
---|
97 | 114 | } |
---|
98 | 115 | |
---|
99 | 116 | void CloneClipboard(boolean supports) |
---|
.. | .. |
---|
380 | 397 | shadowYItem.addActionListener(this); |
---|
381 | 398 | shadowZItem = menu.add(new MenuItem("Shadow Blue")); |
---|
382 | 399 | shadowZItem.addActionListener(this); |
---|
| 400 | + attributeItem = menu.add(new MenuItem("Attribute")); |
---|
| 401 | + attributeItem.addActionListener(this); |
---|
| 402 | + |
---|
383 | 403 | if (Globals.ADVANCED) |
---|
384 | 404 | { |
---|
385 | 405 | menu.add("-"); |
---|
386 | 406 | linkerItem = menu.add(new MenuItem("Linker")); |
---|
387 | 407 | linkerItem.addActionListener(this); |
---|
388 | | - attributeItem = menu.add(new MenuItem("Attribute")); |
---|
389 | | - attributeItem.addActionListener(this); |
---|
390 | 408 | templateItem = menu.add(new MenuItem("Template")); |
---|
391 | 409 | templateItem.addActionListener(this); |
---|
392 | 410 | pointflowItem = menu.add(new MenuItem("Point Flow")); |
---|
.. | .. |
---|
538 | 556 | buildToolsMenu(menu); |
---|
539 | 557 | } |
---|
540 | 558 | |
---|
| 559 | + |
---|
541 | 560 | void SetupUI2(ObjEditor oe) |
---|
542 | 561 | { |
---|
543 | 562 | // June 2019 |
---|
.. | .. |
---|
590 | 609 | //minButton.setToolTipText("Minimize window"); |
---|
591 | 610 | //minButton.addActionListener(this); |
---|
592 | 611 | |
---|
593 | | - oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
594 | | - maxButton.setToolTipText("Maximize window"); |
---|
595 | | - maxButton.addActionListener(this); |
---|
| 612 | + if (Globals.ADVANCED) |
---|
| 613 | + { |
---|
| 614 | + oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 615 | + maxButton.setToolTipText("Maximize window"); |
---|
| 616 | + maxButton.addActionListener(this); |
---|
| 617 | + } |
---|
596 | 618 | |
---|
597 | 619 | oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
598 | 620 | fullButton.setToolTipText("Full-screen window"); |
---|
599 | 621 | fullButton.addActionListener(this); |
---|
600 | 622 | |
---|
| 623 | + oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 624 | + screenfitButton.setToolTipText("Screen fit"); |
---|
| 625 | + screenfitButton.addActionListener(this); |
---|
| 626 | + |
---|
601 | 627 | oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
602 | 628 | restoreCameraButton.setToolTipText("Restore viewpoint"); |
---|
603 | 629 | restoreCameraButton.addActionListener(this); |
---|
604 | 630 | |
---|
| 631 | + copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 632 | + saveButton.setToolTipText("New version"); |
---|
| 633 | + saveButton.addActionListener(this); |
---|
| 634 | + |
---|
605 | 635 | copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
606 | | - undoButton.setToolTipText("Undo changes"); |
---|
| 636 | + undoButton.setToolTipText("Previous version"); |
---|
607 | 637 | undoButton.addActionListener(this); |
---|
608 | 638 | undoButton.setEnabled(false); |
---|
609 | 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 | + |
---|
610 | 653 | copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
611 | | - redoButton.setToolTipText("Redo changes"); |
---|
| 654 | + redoButton.setToolTipText("Next version"); |
---|
612 | 655 | redoButton.addActionListener(this); |
---|
613 | 656 | redoButton.setEnabled(false); |
---|
614 | 657 | |
---|
615 | | - copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
616 | | - saveButton.setToolTipText("Save changes"); |
---|
617 | | - saveButton.addActionListener(this); |
---|
618 | | - |
---|
619 | | - copyOptionsPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints); |
---|
| 658 | + oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints); |
---|
620 | 659 | liveCB.setToolTipText("Enable animation"); |
---|
621 | 660 | liveCB.addItemListener(this); |
---|
622 | 661 | |
---|
623 | | - copyOptionsPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 662 | + oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
624 | 663 | oneStepButton.setToolTipText("Animate one step forward"); |
---|
625 | 664 | oneStepButton.addActionListener(this); |
---|
626 | 665 | |
---|
627 | | - copyOptionsPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints); |
---|
| 666 | + oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints); |
---|
628 | 667 | fastCB.setToolTipText("Fast mode"); |
---|
629 | 668 | fastCB.addItemListener(this); |
---|
630 | 669 | |
---|
631 | 670 | //oe.toolboxPanel.Return(); |
---|
632 | 671 | |
---|
633 | | - copyOptionsPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
634 | | - screenfitButton.setToolTipText("Screen fit"); |
---|
635 | | - screenfitButton.addActionListener(this); |
---|
636 | | - |
---|
637 | 672 | // copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints); |
---|
638 | 673 | // trackCB.setToolTipText("Enable tracking"); |
---|
639 | 674 | // trackCB.addItemListener(this); |
---|
.. | .. |
---|
811 | 846 | |
---|
812 | 847 | oe.treePanel.add(copyOptionsPanel); |
---|
813 | 848 | oe.treePanel.Return(); |
---|
| 849 | + cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0); |
---|
| 850 | + versionSlider = (cNumberSlider)sliderPane.getComponent(1); |
---|
| 851 | + sliderPane.preferredHeight = 1; |
---|
814 | 852 | |
---|
815 | 853 | // mainPanel.setDividerLocation(0.5); //1.0); |
---|
816 | 854 | // mainPanel.setResizeWeight(0.5); |
---|
.. | .. |
---|
936 | 974 | toggleSwitchCB.setToolTipText("Choose a single item"); |
---|
937 | 975 | toggleSwitchCB.addItemListener(this); |
---|
938 | 976 | |
---|
939 | | - panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints); |
---|
940 | | - autosaveCB.setToolTipText("On structure change"); |
---|
941 | | - autosaveCB.addItemListener(this); |
---|
| 977 | + panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints); |
---|
| 978 | + autokeepCB.setToolTipText("On structure change"); |
---|
| 979 | + autokeepCB.addItemListener(this); |
---|
942 | 980 | |
---|
943 | 981 | panel.Return(); |
---|
944 | 982 | if (Globals.ADVANCED) |
---|
.. | .. |
---|
967 | 1005 | { |
---|
968 | 1006 | cRadio radioButton = new cRadio(obj.name); |
---|
969 | 1007 | |
---|
970 | | - // Patch to avoid bug with transparency. |
---|
| 1008 | + // June 2019. Patch to avoid bug with transparency. |
---|
971 | 1009 | radioButton.hadMaterial = obj.material != null; |
---|
972 | 1010 | if (!radioButton.hadMaterial) |
---|
973 | 1011 | { |
---|
.. | .. |
---|
1015 | 1053 | |
---|
1016 | 1054 | cCheckBox oeilCB; |
---|
1017 | 1055 | cCheckBox shadowCB; |
---|
1018 | | - cCheckBox autosaveCB; |
---|
| 1056 | + cCheckBox autokeepCB; |
---|
1019 | 1057 | cCheckBox lookAtCB; |
---|
1020 | 1058 | |
---|
1021 | 1059 | // static int COLOR = 1; |
---|
.. | .. |
---|
1127 | 1165 | { |
---|
1128 | 1166 | Globals.FREEZEONMOVE ^= true; |
---|
1129 | 1167 | } |
---|
1130 | | - else if(e.getSource() == autosaveCB) |
---|
| 1168 | + else if(e.getSource() == autokeepCB) |
---|
1131 | 1169 | { |
---|
1132 | | - Globals.SAVEONMAKE ^= true; |
---|
| 1170 | + Globals.REPLACEONMAKE ^= true; |
---|
1133 | 1171 | } |
---|
1134 | 1172 | else if(e.getSource() == lookAtCB) |
---|
1135 | 1173 | { |
---|
.. | .. |
---|
1211 | 1249 | } |
---|
1212 | 1250 | } |
---|
1213 | 1251 | |
---|
1214 | | - String string = (String) object; |
---|
1215 | | - |
---|
1216 | 1252 | System.out.println("Transfer = " + object + "; drop : " + target); |
---|
1217 | 1253 | // if( object instanceof java.io.File[]) |
---|
1218 | 1254 | // { |
---|
.. | .. |
---|
1220 | 1256 | // objEditor.DropFile((java.io.File[]) object, true); |
---|
1221 | 1257 | // return; |
---|
1222 | 1258 | // } |
---|
| 1259 | + |
---|
| 1260 | + String string = object.toString(); |
---|
1223 | 1261 | |
---|
1224 | 1262 | // File path for Mac and Windows |
---|
1225 | 1263 | if (string.charAt(0) == '/' || string.charAt(1) == ':') |
---|
.. | .. |
---|
1469 | 1507 | animationItem.addItemListener(this); |
---|
1470 | 1508 | animationItem.setState(Globals.ANIMATION); |
---|
1471 | 1509 | |
---|
| 1510 | + menu.add(archiveItem = new MenuItem("Archive3D...")); |
---|
| 1511 | + archiveItem.addActionListener(this); |
---|
| 1512 | + |
---|
1472 | 1513 | menu.add("-"); |
---|
1473 | 1514 | parseverticesItem = menu.add(new MenuItem("Multiplicity")); |
---|
1474 | 1515 | parseverticesItem.addActionListener(this); |
---|
.. | .. |
---|
1481 | 1522 | reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)")); |
---|
1482 | 1523 | reduce34MorphItem.addActionListener(this); |
---|
1483 | 1524 | menu.add("-"); |
---|
| 1525 | + menu.add(memoryItem = new MenuItem("Memory Usage")); |
---|
| 1526 | + memoryItem.addActionListener(this); |
---|
1484 | 1527 | menu.add(computeAOItem = new MenuItem("Compute AO")); |
---|
1485 | 1528 | computeAOItem.addActionListener(this); |
---|
1486 | 1529 | |
---|
.. | .. |
---|
1489 | 1532 | mirrorItem = menu.add(new MenuItem("Mirror Poses")); |
---|
1490 | 1533 | mirrorItem.addActionListener(this); |
---|
1491 | 1534 | menu.add("-"); |
---|
1492 | | - menu.add(memoryItem = new MenuItem("Memory Usage")); |
---|
1493 | | - memoryItem.addActionListener(this); |
---|
1494 | 1535 | menu.add(analyzeItem = new MenuItem("Analyze")); |
---|
1495 | 1536 | analyzeItem.addActionListener(this); |
---|
1496 | 1537 | menu.add(dumpItem = new MenuItem("Print")); |
---|
.. | .. |
---|
2213 | 2254 | } else |
---|
2214 | 2255 | if (source == undoButton) |
---|
2215 | 2256 | { |
---|
| 2257 | + // Go to previous version |
---|
| 2258 | + //if (!Undo()) |
---|
| 2259 | + //java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
2216 | 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(); |
---|
2217 | 2271 | } else |
---|
2218 | 2272 | if (source == redoButton) |
---|
2219 | 2273 | { |
---|
| 2274 | + // Go to next version |
---|
2220 | 2275 | Redo(); |
---|
2221 | 2276 | } else |
---|
2222 | 2277 | if (source == saveButton) |
---|
2223 | 2278 | { |
---|
2224 | | - Save(); |
---|
| 2279 | + // Save a new version |
---|
| 2280 | + if (!Save(true)) |
---|
| 2281 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
2225 | 2282 | } else |
---|
2226 | 2283 | if (source == oneStepButton) |
---|
2227 | 2284 | { |
---|
.. | .. |
---|
2230 | 2287 | } else |
---|
2231 | 2288 | if (source == screenfitButton) |
---|
2232 | 2289 | { |
---|
2233 | | - //Reload(lastConverter, lastFilename, true); |
---|
2234 | 2290 | ScreenFit(); |
---|
2235 | 2291 | } else |
---|
2236 | 2292 | if (source == screenfitpointButton) |
---|
2237 | 2293 | { |
---|
2238 | | - //Reload(lastConverter, lastFilename, true); |
---|
2239 | 2294 | ScreenFitPoint(); |
---|
2240 | 2295 | } else |
---|
2241 | 2296 | if (source == snapobjectButton) |
---|
2242 | 2297 | { |
---|
2243 | | - //Reload(lastConverter, lastFilename, true); |
---|
2244 | 2298 | SnapObject(); |
---|
2245 | 2299 | } else |
---|
2246 | 2300 | // if (event.getSource() == recompileButton) |
---|
.. | .. |
---|
3468 | 3522 | } |
---|
3469 | 3523 | |
---|
3470 | 3524 | copy = group; |
---|
| 3525 | + |
---|
| 3526 | + SetUndoStates(); |
---|
| 3527 | + |
---|
3471 | 3528 | //Globals.theRenderer.object = group; |
---|
3472 | 3529 | if(!useclient) |
---|
3473 | 3530 | { |
---|
.. | .. |
---|
3496 | 3553 | radio.layout.doClick(); |
---|
3497 | 3554 | |
---|
3498 | 3555 | ClearUnpinned(); |
---|
| 3556 | + Grafreed.Assert(group != null); |
---|
| 3557 | + Grafreed.Assert(group.selection != null); |
---|
3499 | 3558 | SetPinStates(group.selection.size() > 0); |
---|
3500 | 3559 | if (group.selection.size() == 1) |
---|
3501 | 3560 | EditSelection(false); |
---|
.. | .. |
---|
4728 | 4787 | void refreshContents(boolean cp) |
---|
4729 | 4788 | { |
---|
4730 | 4789 | if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info")) |
---|
4731 | | - if (!Globals.MOUSEDRAGGED) // && !Globals.TIMERRUNNING) |
---|
| 4790 | + if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING) |
---|
4732 | 4791 | { |
---|
4733 | 4792 | objEditor.ClearInfo(); // .GetMaterial()); |
---|
4734 | 4793 | |
---|
.. | .. |
---|
4827 | 4886 | |
---|
4828 | 4887 | if (cut) |
---|
4829 | 4888 | { |
---|
4830 | | - if (Globals.SAVEONMAKE) |
---|
4831 | | - Save(); |
---|
| 4889 | +// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save. |
---|
| 4890 | +// Save(); |
---|
4832 | 4891 | //int indices[] = jList.getSelectedIndices(); |
---|
4833 | 4892 | //for (int i = indices.length - 1; i >= 0; i--) |
---|
4834 | 4893 | //jList.remove(indices[i]); |
---|
.. | .. |
---|
4931 | 4990 | |
---|
4932 | 4991 | void paste(boolean expand) |
---|
4933 | 4992 | { |
---|
| 4993 | + if (Globals.REPLACEONMAKE) |
---|
| 4994 | + Save(); |
---|
| 4995 | + boolean keep = Globals.REPLACEONMAKE; |
---|
| 4996 | + Globals.REPLACEONMAKE = false; |
---|
4934 | 4997 | // if (GrafreeD.clipboard == null) |
---|
4935 | 4998 | // return; |
---|
4936 | 4999 | boolean first = true; |
---|
.. | .. |
---|
4990 | 5053 | Grafreed.clipboard.get(0).parent = keepparent; |
---|
4991 | 5054 | } |
---|
4992 | 5055 | |
---|
| 5056 | + Globals.REPLACEONMAKE = keep; |
---|
4993 | 5057 | ResetModel(); |
---|
4994 | 5058 | refreshContents(); |
---|
4995 | 5059 | } |
---|
.. | .. |
---|
5125 | 5189 | |
---|
5126 | 5190 | void group(Object3D csg, boolean grab) |
---|
5127 | 5191 | { |
---|
| 5192 | + if (Globals.REPLACEONMAKE) |
---|
| 5193 | + Save(); |
---|
| 5194 | + boolean keep = Globals.REPLACEONMAKE; |
---|
| 5195 | + Globals.REPLACEONMAKE = false; |
---|
5128 | 5196 | if (//false) // why?? |
---|
5129 | 5197 | !group.selection.isEmpty()) |
---|
5130 | 5198 | { |
---|
.. | .. |
---|
5238 | 5306 | //node.add(csg); |
---|
5239 | 5307 | //makeSomething(node); |
---|
5240 | 5308 | makeSomething(csg); |
---|
| 5309 | + Globals.REPLACEONMAKE = keep; |
---|
5241 | 5310 | } |
---|
5242 | 5311 | |
---|
5243 | 5312 | void Ungroup(Object3D g) |
---|
5244 | 5313 | { |
---|
| 5314 | + if (Globals.REPLACEONMAKE) |
---|
| 5315 | + Save(); |
---|
| 5316 | + boolean keep = Globals.REPLACEONMAKE; |
---|
| 5317 | + Globals.REPLACEONMAKE = false; |
---|
5245 | 5318 | if (g instanceof HiddenObject) |
---|
5246 | 5319 | { |
---|
5247 | 5320 | HiddenObject h = (HiddenObject) g; |
---|
.. | .. |
---|
5258 | 5331 | objEditor.makeSomething(g.get(i), false); |
---|
5259 | 5332 | } |
---|
5260 | 5333 | } |
---|
| 5334 | + Globals.REPLACEONMAKE = keep; |
---|
5261 | 5335 | } |
---|
5262 | 5336 | |
---|
5263 | 5337 | void ungroup() |
---|