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,8 +1478,8 @@
14721478 animationItem.addItemListener(this);
14731479 animationItem.setState(Globals.ANIMATION);
14741480
1475
- menu.add(archiveItem = new CheckboxMenuItem("Archive3D..."));
1476
- archiveItem.addItemListener(this);
1481
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1482
+ archiveItem.addActionListener(this);
14771483
14781484 menu.add("-");
14791485 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
....@@ -1487,6 +1493,8 @@
14871493 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
14881494 reduce34MorphItem.addActionListener(this);
14891495 menu.add("-");
1496
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1497
+ memoryItem.addActionListener(this);
14901498 menu.add(computeAOItem = new MenuItem("Compute AO"));
14911499 computeAOItem.addActionListener(this);
14921500
....@@ -1495,8 +1503,6 @@
14951503 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
14961504 mirrorItem.addActionListener(this);
14971505 menu.add("-");
1498
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1499
- memoryItem.addActionListener(this);
15001506 menu.add(analyzeItem = new MenuItem("Analyze"));
15011507 analyzeItem.addActionListener(this);
15021508 menu.add(dumpItem = new MenuItem("Print"));
....@@ -2219,7 +2225,8 @@
22192225 } else
22202226 if (source == undoButton)
22212227 {
2222
- Undo();
2228
+ if (!Undo())
2229
+ java.awt.Toolkit.getDefaultToolkit().beep();
22232230 } else
22242231 if (source == redoButton)
22252232 {
....@@ -2227,7 +2234,8 @@
22272234 } else
22282235 if (source == saveButton)
22292236 {
2230
- Save();
2237
+ if (!Save(true))
2238
+ java.awt.Toolkit.getDefaultToolkit().beep();
22312239 } else
22322240 if (source == oneStepButton)
22332241 {
....@@ -2236,17 +2244,14 @@
22362244 } else
22372245 if (source == screenfitButton)
22382246 {
2239
- //Reload(lastConverter, lastFilename, true);
22402247 ScreenFit();
22412248 } else
22422249 if (source == screenfitpointButton)
22432250 {
2244
- //Reload(lastConverter, lastFilename, true);
22452251 ScreenFitPoint();
22462252 } else
22472253 if (source == snapobjectButton)
22482254 {
2249
- //Reload(lastConverter, lastFilename, true);
22502255 SnapObject();
22512256 } else
22522257 // if (event.getSource() == recompileButton)
....@@ -4734,7 +4739,7 @@
47344739 void refreshContents(boolean cp)
47354740 {
47364741 if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4737
- if (!Globals.MOUSEDRAGGED) // && !Globals.TIMERRUNNING)
4742
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
47384743 {
47394744 objEditor.ClearInfo(); // .GetMaterial());
47404745
....@@ -4833,8 +4838,8 @@
48334838
48344839 if (cut)
48354840 {
4836
- if (Globals.SAVEONMAKE)
4837
- Save();
4841
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4842
+// Save();
48384843 //int indices[] = jList.getSelectedIndices();
48394844 //for (int i = indices.length - 1; i >= 0; i--)
48404845 //jList.remove(indices[i]);
....@@ -4937,6 +4942,10 @@
49374942
49384943 void paste(boolean expand)
49394944 {
4945
+ if (Globals.SAVEONMAKE)
4946
+ Save();
4947
+ boolean keep = Globals.SAVEONMAKE;
4948
+ Globals.SAVEONMAKE = false;
49404949 // if (GrafreeD.clipboard == null)
49414950 // return;
49424951 boolean first = true;
....@@ -4996,6 +5005,7 @@
49965005 Grafreed.clipboard.get(0).parent = keepparent;
49975006 }
49985007
5008
+ Globals.SAVEONMAKE = keep;
49995009 ResetModel();
50005010 refreshContents();
50015011 }
....@@ -5131,6 +5141,10 @@
51315141
51325142 void group(Object3D csg, boolean grab)
51335143 {
5144
+ if (Globals.SAVEONMAKE)
5145
+ Save();
5146
+ boolean keep = Globals.SAVEONMAKE;
5147
+ Globals.SAVEONMAKE = false;
51345148 if (//false) // why??
51355149 !group.selection.isEmpty())
51365150 {
....@@ -5244,10 +5258,15 @@
52445258 //node.add(csg);
52455259 //makeSomething(node);
52465260 makeSomething(csg);
5261
+ Globals.SAVEONMAKE = keep;
52475262 }
52485263
52495264 void Ungroup(Object3D g)
52505265 {
5266
+ if (Globals.SAVEONMAKE)
5267
+ Save();
5268
+ boolean keep = Globals.SAVEONMAKE;
5269
+ Globals.SAVEONMAKE = false;
52515270 if (g instanceof HiddenObject)
52525271 {
52535272 HiddenObject h = (HiddenObject) g;
....@@ -5264,6 +5283,7 @@
52645283 objEditor.makeSomething(g.get(i), false);
52655284 }
52665285 }
5286
+ Globals.SAVEONMAKE = keep;
52675287 }
52685288
52695289 void ungroup()