.. | .. |
---|
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); |
---|
| 390 | + |
---|
383 | 391 | if (Globals.ADVANCED) |
---|
384 | 392 | { |
---|
385 | 393 | menu.add("-"); |
---|
386 | 394 | linkerItem = menu.add(new MenuItem("Linker")); |
---|
387 | 395 | linkerItem.addActionListener(this); |
---|
388 | | - attributeItem = menu.add(new MenuItem("Attribute")); |
---|
389 | | - attributeItem.addActionListener(this); |
---|
390 | 396 | templateItem = menu.add(new MenuItem("Template")); |
---|
391 | 397 | templateItem.addActionListener(this); |
---|
392 | 398 | pointflowItem = menu.add(new MenuItem("Point Flow")); |
---|
.. | .. |
---|
538 | 544 | buildToolsMenu(menu); |
---|
539 | 545 | } |
---|
540 | 546 | |
---|
| 547 | + |
---|
541 | 548 | void SetupUI2(ObjEditor oe) |
---|
542 | 549 | { |
---|
543 | 550 | // June 2019 |
---|
.. | .. |
---|
590 | 597 | //minButton.setToolTipText("Minimize window"); |
---|
591 | 598 | //minButton.addActionListener(this); |
---|
592 | 599 | |
---|
593 | | - oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
594 | | - maxButton.setToolTipText("Maximize window"); |
---|
595 | | - maxButton.addActionListener(this); |
---|
| 600 | + if (Globals.ADVANCED) |
---|
| 601 | + { |
---|
| 602 | + oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 603 | + maxButton.setToolTipText("Maximize window"); |
---|
| 604 | + maxButton.addActionListener(this); |
---|
| 605 | + } |
---|
596 | 606 | |
---|
597 | 607 | oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
598 | 608 | fullButton.setToolTipText("Full-screen window"); |
---|
599 | 609 | fullButton.addActionListener(this); |
---|
600 | 610 | |
---|
| 611 | + oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 612 | + screenfitButton.setToolTipText("Screen fit"); |
---|
| 613 | + screenfitButton.addActionListener(this); |
---|
| 614 | + |
---|
601 | 615 | oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
602 | 616 | restoreCameraButton.setToolTipText("Restore viewpoint"); |
---|
603 | 617 | restoreCameraButton.addActionListener(this); |
---|
604 | 618 | |
---|
| 619 | + copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 620 | + saveButton.setToolTipText("New version"); |
---|
| 621 | + saveButton.addActionListener(this); |
---|
| 622 | + |
---|
605 | 623 | copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
606 | | - undoButton.setToolTipText("Undo changes"); |
---|
| 624 | + undoButton.setToolTipText("Previous version"); |
---|
607 | 625 | undoButton.addActionListener(this); |
---|
608 | 626 | undoButton.setEnabled(false); |
---|
609 | 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 | + |
---|
610 | 641 | copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
611 | | - redoButton.setToolTipText("Redo changes"); |
---|
| 642 | + redoButton.setToolTipText("Next version"); |
---|
612 | 643 | redoButton.addActionListener(this); |
---|
613 | 644 | redoButton.setEnabled(false); |
---|
614 | 645 | |
---|
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); |
---|
| 646 | + oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints); |
---|
620 | 647 | liveCB.setToolTipText("Enable animation"); |
---|
621 | 648 | liveCB.addItemListener(this); |
---|
622 | 649 | |
---|
623 | | - copyOptionsPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 650 | + oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
624 | 651 | oneStepButton.setToolTipText("Animate one step forward"); |
---|
625 | 652 | oneStepButton.addActionListener(this); |
---|
626 | 653 | |
---|
627 | | - copyOptionsPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints); |
---|
| 654 | + oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints); |
---|
628 | 655 | fastCB.setToolTipText("Fast mode"); |
---|
629 | 656 | fastCB.addItemListener(this); |
---|
630 | 657 | |
---|
631 | 658 | //oe.toolboxPanel.Return(); |
---|
632 | 659 | |
---|
633 | | - copyOptionsPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
634 | | - screenfitButton.setToolTipText("Screen fit"); |
---|
635 | | - screenfitButton.addActionListener(this); |
---|
636 | | - |
---|
637 | 660 | // copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints); |
---|
638 | 661 | // trackCB.setToolTipText("Enable tracking"); |
---|
639 | 662 | // trackCB.addItemListener(this); |
---|
.. | .. |
---|
811 | 834 | |
---|
812 | 835 | oe.treePanel.add(copyOptionsPanel); |
---|
813 | 836 | oe.treePanel.Return(); |
---|
| 837 | + cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 10, 0); |
---|
| 838 | + versionField = (cNumberSlider)sliderPane.getComponent(1); |
---|
| 839 | + sliderPane.preferredHeight = 1; |
---|
814 | 840 | |
---|
815 | 841 | // mainPanel.setDividerLocation(0.5); //1.0); |
---|
816 | 842 | // mainPanel.setResizeWeight(0.5); |
---|
.. | .. |
---|
936 | 962 | toggleSwitchCB.setToolTipText("Choose a single item"); |
---|
937 | 963 | toggleSwitchCB.addItemListener(this); |
---|
938 | 964 | |
---|
939 | | - panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints); |
---|
940 | | - autosaveCB.setToolTipText("On structure change"); |
---|
941 | | - autosaveCB.addItemListener(this); |
---|
| 965 | + panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints); |
---|
| 966 | + autokeepCB.setToolTipText("On structure change"); |
---|
| 967 | + autokeepCB.addItemListener(this); |
---|
942 | 968 | |
---|
943 | 969 | panel.Return(); |
---|
944 | 970 | if (Globals.ADVANCED) |
---|
.. | .. |
---|
967 | 993 | { |
---|
968 | 994 | cRadio radioButton = new cRadio(obj.name); |
---|
969 | 995 | |
---|
970 | | - // Patch to avoid bug with transparency. |
---|
| 996 | + // June 2019. Patch to avoid bug with transparency. |
---|
971 | 997 | radioButton.hadMaterial = obj.material != null; |
---|
972 | 998 | if (!radioButton.hadMaterial) |
---|
973 | 999 | { |
---|
.. | .. |
---|
1015 | 1041 | |
---|
1016 | 1042 | cCheckBox oeilCB; |
---|
1017 | 1043 | cCheckBox shadowCB; |
---|
1018 | | - cCheckBox autosaveCB; |
---|
| 1044 | + cCheckBox autokeepCB; |
---|
1019 | 1045 | cCheckBox lookAtCB; |
---|
1020 | 1046 | |
---|
1021 | 1047 | // static int COLOR = 1; |
---|
.. | .. |
---|
1127 | 1153 | { |
---|
1128 | 1154 | Globals.FREEZEONMOVE ^= true; |
---|
1129 | 1155 | } |
---|
1130 | | - else if(e.getSource() == autosaveCB) |
---|
| 1156 | + else if(e.getSource() == autokeepCB) |
---|
1131 | 1157 | { |
---|
1132 | | - Globals.SAVEONMAKE ^= true; |
---|
| 1158 | + Globals.REPLACEONMAKE ^= true; |
---|
1133 | 1159 | } |
---|
1134 | 1160 | else if(e.getSource() == lookAtCB) |
---|
1135 | 1161 | { |
---|
.. | .. |
---|
1211 | 1237 | } |
---|
1212 | 1238 | } |
---|
1213 | 1239 | |
---|
1214 | | - String string = (String) object; |
---|
1215 | | - |
---|
1216 | 1240 | System.out.println("Transfer = " + object + "; drop : " + target); |
---|
1217 | 1241 | // if( object instanceof java.io.File[]) |
---|
1218 | 1242 | // { |
---|
.. | .. |
---|
1220 | 1244 | // objEditor.DropFile((java.io.File[]) object, true); |
---|
1221 | 1245 | // return; |
---|
1222 | 1246 | // } |
---|
| 1247 | + |
---|
| 1248 | + String string = object.toString(); |
---|
1223 | 1249 | |
---|
1224 | 1250 | // File path for Mac and Windows |
---|
1225 | 1251 | if (string.charAt(0) == '/' || string.charAt(1) == ':') |
---|
.. | .. |
---|
1469 | 1495 | animationItem.addItemListener(this); |
---|
1470 | 1496 | animationItem.setState(Globals.ANIMATION); |
---|
1471 | 1497 | |
---|
| 1498 | + menu.add(archiveItem = new MenuItem("Archive3D...")); |
---|
| 1499 | + archiveItem.addActionListener(this); |
---|
| 1500 | + |
---|
1472 | 1501 | menu.add("-"); |
---|
1473 | 1502 | parseverticesItem = menu.add(new MenuItem("Multiplicity")); |
---|
1474 | 1503 | parseverticesItem.addActionListener(this); |
---|
.. | .. |
---|
1481 | 1510 | reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)")); |
---|
1482 | 1511 | reduce34MorphItem.addActionListener(this); |
---|
1483 | 1512 | menu.add("-"); |
---|
| 1513 | + menu.add(memoryItem = new MenuItem("Memory Usage")); |
---|
| 1514 | + memoryItem.addActionListener(this); |
---|
1484 | 1515 | menu.add(computeAOItem = new MenuItem("Compute AO")); |
---|
1485 | 1516 | computeAOItem.addActionListener(this); |
---|
1486 | 1517 | |
---|
.. | .. |
---|
1489 | 1520 | mirrorItem = menu.add(new MenuItem("Mirror Poses")); |
---|
1490 | 1521 | mirrorItem.addActionListener(this); |
---|
1491 | 1522 | menu.add("-"); |
---|
1492 | | - menu.add(memoryItem = new MenuItem("Memory Usage")); |
---|
1493 | | - memoryItem.addActionListener(this); |
---|
1494 | 1523 | menu.add(analyzeItem = new MenuItem("Analyze")); |
---|
1495 | 1524 | analyzeItem.addActionListener(this); |
---|
1496 | 1525 | menu.add(dumpItem = new MenuItem("Print")); |
---|
.. | .. |
---|
2213 | 2242 | } else |
---|
2214 | 2243 | if (source == undoButton) |
---|
2215 | 2244 | { |
---|
| 2245 | + // Go to previous version |
---|
| 2246 | + //if (!Undo()) |
---|
| 2247 | + //java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
2216 | 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(); |
---|
2217 | 2259 | } else |
---|
2218 | 2260 | if (source == redoButton) |
---|
2219 | 2261 | { |
---|
| 2262 | + // Go to next version |
---|
2220 | 2263 | Redo(); |
---|
2221 | 2264 | } else |
---|
2222 | 2265 | if (source == saveButton) |
---|
2223 | 2266 | { |
---|
2224 | | - Save(); |
---|
| 2267 | + // Save a new version |
---|
| 2268 | + if (!Save(true)) |
---|
| 2269 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
2225 | 2270 | } else |
---|
2226 | 2271 | if (source == oneStepButton) |
---|
2227 | 2272 | { |
---|
.. | .. |
---|
2230 | 2275 | } else |
---|
2231 | 2276 | if (source == screenfitButton) |
---|
2232 | 2277 | { |
---|
2233 | | - //Reload(lastConverter, lastFilename, true); |
---|
2234 | 2278 | ScreenFit(); |
---|
2235 | 2279 | } else |
---|
2236 | 2280 | if (source == screenfitpointButton) |
---|
2237 | 2281 | { |
---|
2238 | | - //Reload(lastConverter, lastFilename, true); |
---|
2239 | 2282 | ScreenFitPoint(); |
---|
2240 | 2283 | } else |
---|
2241 | 2284 | if (source == snapobjectButton) |
---|
2242 | 2285 | { |
---|
2243 | | - //Reload(lastConverter, lastFilename, true); |
---|
2244 | 2286 | SnapObject(); |
---|
2245 | 2287 | } else |
---|
2246 | 2288 | // if (event.getSource() == recompileButton) |
---|
.. | .. |
---|
3468 | 3510 | } |
---|
3469 | 3511 | |
---|
3470 | 3512 | copy = group; |
---|
| 3513 | + |
---|
| 3514 | + SetUndoStates(); |
---|
| 3515 | + |
---|
3471 | 3516 | //Globals.theRenderer.object = group; |
---|
3472 | 3517 | if(!useclient) |
---|
3473 | 3518 | { |
---|
.. | .. |
---|
4728 | 4773 | void refreshContents(boolean cp) |
---|
4729 | 4774 | { |
---|
4730 | 4775 | if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info")) |
---|
4731 | | - if (!Globals.MOUSEDRAGGED) // && !Globals.TIMERRUNNING) |
---|
| 4776 | + if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING) |
---|
4732 | 4777 | { |
---|
4733 | 4778 | objEditor.ClearInfo(); // .GetMaterial()); |
---|
4734 | 4779 | |
---|
.. | .. |
---|
4827 | 4872 | |
---|
4828 | 4873 | if (cut) |
---|
4829 | 4874 | { |
---|
4830 | | - if (Globals.SAVEONMAKE) |
---|
4831 | | - Save(); |
---|
| 4875 | +// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save. |
---|
| 4876 | +// Save(); |
---|
4832 | 4877 | //int indices[] = jList.getSelectedIndices(); |
---|
4833 | 4878 | //for (int i = indices.length - 1; i >= 0; i--) |
---|
4834 | 4879 | //jList.remove(indices[i]); |
---|
.. | .. |
---|
4931 | 4976 | |
---|
4932 | 4977 | void paste(boolean expand) |
---|
4933 | 4978 | { |
---|
| 4979 | + if (Globals.REPLACEONMAKE) |
---|
| 4980 | + Save(); |
---|
| 4981 | + boolean keep = Globals.REPLACEONMAKE; |
---|
| 4982 | + Globals.REPLACEONMAKE = false; |
---|
4934 | 4983 | // if (GrafreeD.clipboard == null) |
---|
4935 | 4984 | // return; |
---|
4936 | 4985 | boolean first = true; |
---|
.. | .. |
---|
4990 | 5039 | Grafreed.clipboard.get(0).parent = keepparent; |
---|
4991 | 5040 | } |
---|
4992 | 5041 | |
---|
| 5042 | + Globals.REPLACEONMAKE = keep; |
---|
4993 | 5043 | ResetModel(); |
---|
4994 | 5044 | refreshContents(); |
---|
4995 | 5045 | } |
---|
.. | .. |
---|
5125 | 5175 | |
---|
5126 | 5176 | void group(Object3D csg, boolean grab) |
---|
5127 | 5177 | { |
---|
| 5178 | + if (Globals.REPLACEONMAKE) |
---|
| 5179 | + Save(); |
---|
| 5180 | + boolean keep = Globals.REPLACEONMAKE; |
---|
| 5181 | + Globals.REPLACEONMAKE = false; |
---|
5128 | 5182 | if (//false) // why?? |
---|
5129 | 5183 | !group.selection.isEmpty()) |
---|
5130 | 5184 | { |
---|
.. | .. |
---|
5238 | 5292 | //node.add(csg); |
---|
5239 | 5293 | //makeSomething(node); |
---|
5240 | 5294 | makeSomething(csg); |
---|
| 5295 | + Globals.REPLACEONMAKE = keep; |
---|
5241 | 5296 | } |
---|
5242 | 5297 | |
---|
5243 | 5298 | void Ungroup(Object3D g) |
---|
5244 | 5299 | { |
---|
| 5300 | + if (Globals.REPLACEONMAKE) |
---|
| 5301 | + Save(); |
---|
| 5302 | + boolean keep = Globals.REPLACEONMAKE; |
---|
| 5303 | + Globals.REPLACEONMAKE = false; |
---|
5245 | 5304 | if (g instanceof HiddenObject) |
---|
5246 | 5305 | { |
---|
5247 | 5306 | HiddenObject h = (HiddenObject) g; |
---|
.. | .. |
---|
5258 | 5317 | objEditor.makeSomething(g.get(i), false); |
---|
5259 | 5318 | } |
---|
5260 | 5319 | } |
---|
| 5320 | + Globals.REPLACEONMAKE = keep; |
---|
5261 | 5321 | } |
---|
5262 | 5322 | |
---|
5263 | 5323 | void ungroup() |
---|