Normand Briere
2019-07-14 bc829f47837b5a001f911542140b0b8e63c2bb0c
GroupEditor.java
....@@ -84,6 +84,10 @@
8484
8585 void CloneSelection(boolean supports)
8686 {
87
+ if (Globals.SAVEONMAKE)
88
+ Save();
89
+ boolean keep = Globals.SAVEONMAKE;
90
+ Globals.SAVEONMAKE = false;
8791 // Object3D keep = GrafreeD.clipboard;
8892 //Object3D obj;
8993 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -94,6 +98,7 @@
9498
9599 makeSomething(clone, i==group.selection.size()-1);
96100 }
101
+ Globals.SAVEONMAKE = keep;
97102 }
98103
99104 void CloneClipboard(boolean supports)
....@@ -380,13 +385,14 @@
380385 shadowYItem.addActionListener(this);
381386 shadowZItem = menu.add(new MenuItem("Shadow Blue"));
382387 shadowZItem.addActionListener(this);
388
+ attributeItem = menu.add(new MenuItem("Attribute"));
389
+ attributeItem.addActionListener(this);
390
+
383391 if (Globals.ADVANCED)
384392 {
385393 menu.add("-");
386394 linkerItem = menu.add(new MenuItem("Linker"));
387395 linkerItem.addActionListener(this);
388
- attributeItem = menu.add(new MenuItem("Attribute"));
389
- attributeItem.addActionListener(this);
390396 templateItem = menu.add(new MenuItem("Template"));
391397 templateItem.addActionListener(this);
392398 pointflowItem = menu.add(new MenuItem("Point Flow"));
....@@ -601,6 +607,10 @@
601607 fullButton.setToolTipText("Full-screen window");
602608 fullButton.addActionListener(this);
603609
610
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
611
+ screenfitButton.setToolTipText("Screen fit");
612
+ screenfitButton.addActionListener(this);
613
+
604614 oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
605615 restoreCameraButton.setToolTipText("Restore viewpoint");
606616 restoreCameraButton.addActionListener(this);
....@@ -633,10 +643,6 @@
633643
634644 //oe.toolboxPanel.Return();
635645
636
- copyOptionsPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
637
- screenfitButton.setToolTipText("Screen fit");
638
- screenfitButton.addActionListener(this);
639
-
640646 // copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
641647 // trackCB.setToolTipText("Enable tracking");
642648 // trackCB.addItemListener(this);
....@@ -970,7 +976,7 @@
970976 {
971977 cRadio radioButton = new cRadio(obj.name);
972978
973
- // Patch to avoid bug with transparency.
979
+ // June 2019. Patch to avoid bug with transparency.
974980 radioButton.hadMaterial = obj.material != null;
975981 if (!radioButton.hadMaterial)
976982 {
....@@ -1214,8 +1220,6 @@
12141220 }
12151221 }
12161222
1217
- String string = (String) object;
1218
-
12191223 System.out.println("Transfer = " + object + "; drop : " + target);
12201224 // if( object instanceof java.io.File[])
12211225 // {
....@@ -1223,6 +1227,8 @@
12231227 // objEditor.DropFile((java.io.File[]) object, true);
12241228 // return;
12251229 // }
1230
+
1231
+ String string = object.toString();
12261232
12271233 // File path for Mac and Windows
12281234 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -1472,6 +1478,9 @@
14721478 animationItem.addItemListener(this);
14731479 animationItem.setState(Globals.ANIMATION);
14741480
1481
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1482
+ archiveItem.addActionListener(this);
1483
+
14751484 menu.add("-");
14761485 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
14771486 parseverticesItem.addActionListener(this);
....@@ -1484,6 +1493,8 @@
14841493 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
14851494 reduce34MorphItem.addActionListener(this);
14861495 menu.add("-");
1496
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1497
+ memoryItem.addActionListener(this);
14871498 menu.add(computeAOItem = new MenuItem("Compute AO"));
14881499 computeAOItem.addActionListener(this);
14891500
....@@ -1492,8 +1503,6 @@
14921503 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
14931504 mirrorItem.addActionListener(this);
14941505 menu.add("-");
1495
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1496
- memoryItem.addActionListener(this);
14971506 menu.add(analyzeItem = new MenuItem("Analyze"));
14981507 analyzeItem.addActionListener(this);
14991508 menu.add(dumpItem = new MenuItem("Print"));
....@@ -2216,7 +2225,8 @@
22162225 } else
22172226 if (source == undoButton)
22182227 {
2219
- Undo();
2228
+ if (!Undo())
2229
+ java.awt.Toolkit.getDefaultToolkit().beep();
22202230 } else
22212231 if (source == redoButton)
22222232 {
....@@ -2224,7 +2234,8 @@
22242234 } else
22252235 if (source == saveButton)
22262236 {
2227
- Save();
2237
+ if (!Save(true))
2238
+ java.awt.Toolkit.getDefaultToolkit().beep();
22282239 } else
22292240 if (source == oneStepButton)
22302241 {
....@@ -2233,17 +2244,14 @@
22332244 } else
22342245 if (source == screenfitButton)
22352246 {
2236
- //Reload(lastConverter, lastFilename, true);
22372247 ScreenFit();
22382248 } else
22392249 if (source == screenfitpointButton)
22402250 {
2241
- //Reload(lastConverter, lastFilename, true);
22422251 ScreenFitPoint();
22432252 } else
22442253 if (source == snapobjectButton)
22452254 {
2246
- //Reload(lastConverter, lastFilename, true);
22472255 SnapObject();
22482256 } else
22492257 // if (event.getSource() == recompileButton)
....@@ -4731,7 +4739,7 @@
47314739 void refreshContents(boolean cp)
47324740 {
47334741 if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4734
- if (!Globals.MOUSEDRAGGED) // && !Globals.TIMERRUNNING)
4742
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
47354743 {
47364744 objEditor.ClearInfo(); // .GetMaterial());
47374745
....@@ -4830,8 +4838,8 @@
48304838
48314839 if (cut)
48324840 {
4833
- if (Globals.SAVEONMAKE)
4834
- Save();
4841
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4842
+// Save();
48354843 //int indices[] = jList.getSelectedIndices();
48364844 //for (int i = indices.length - 1; i >= 0; i--)
48374845 //jList.remove(indices[i]);
....@@ -4934,6 +4942,10 @@
49344942
49354943 void paste(boolean expand)
49364944 {
4945
+ if (Globals.SAVEONMAKE)
4946
+ Save();
4947
+ boolean keep = Globals.SAVEONMAKE;
4948
+ Globals.SAVEONMAKE = false;
49374949 // if (GrafreeD.clipboard == null)
49384950 // return;
49394951 boolean first = true;
....@@ -4993,6 +5005,7 @@
49935005 Grafreed.clipboard.get(0).parent = keepparent;
49945006 }
49955007
5008
+ Globals.SAVEONMAKE = keep;
49965009 ResetModel();
49975010 refreshContents();
49985011 }
....@@ -5128,6 +5141,10 @@
51285141
51295142 void group(Object3D csg, boolean grab)
51305143 {
5144
+ if (Globals.SAVEONMAKE)
5145
+ Save();
5146
+ boolean keep = Globals.SAVEONMAKE;
5147
+ Globals.SAVEONMAKE = false;
51315148 if (//false) // why??
51325149 !group.selection.isEmpty())
51335150 {
....@@ -5241,10 +5258,15 @@
52415258 //node.add(csg);
52425259 //makeSomething(node);
52435260 makeSomething(csg);
5261
+ Globals.SAVEONMAKE = keep;
52445262 }
52455263
52465264 void Ungroup(Object3D g)
52475265 {
5266
+ if (Globals.SAVEONMAKE)
5267
+ Save();
5268
+ boolean keep = Globals.SAVEONMAKE;
5269
+ Globals.SAVEONMAKE = false;
52485270 if (g instanceof HiddenObject)
52495271 {
52505272 HiddenObject h = (HiddenObject) g;
....@@ -5261,6 +5283,7 @@
52615283 objEditor.makeSomething(g.get(i), false);
52625284 }
52635285 }
5286
+ Globals.SAVEONMAKE = keep;
52645287 }
52655288
52665289 void ungroup()