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"));
....@@ -590,14 +596,21 @@
590596 //minButton.setToolTipText("Minimize window");
591597 //minButton.addActionListener(this);
592598
593
- oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
594
- maxButton.setToolTipText("Maximize window");
595
- maxButton.addActionListener(this);
599
+ if (Globals.ADVANCED)
600
+ {
601
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
602
+ maxButton.setToolTipText("Maximize window");
603
+ maxButton.addActionListener(this);
604
+ }
596605
597606 oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
598607 fullButton.setToolTipText("Full-screen window");
599608 fullButton.addActionListener(this);
600609
610
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
611
+ screenfitButton.setToolTipText("Screen fit");
612
+ screenfitButton.addActionListener(this);
613
+
601614 oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
602615 restoreCameraButton.setToolTipText("Restore viewpoint");
603616 restoreCameraButton.addActionListener(this);
....@@ -630,10 +643,6 @@
630643
631644 //oe.toolboxPanel.Return();
632645
633
- copyOptionsPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
634
- screenfitButton.setToolTipText("Screen fit");
635
- screenfitButton.addActionListener(this);
636
-
637646 // copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
638647 // trackCB.setToolTipText("Enable tracking");
639648 // trackCB.addItemListener(this);
....@@ -967,7 +976,7 @@
967976 {
968977 cRadio radioButton = new cRadio(obj.name);
969978
970
- // Patch to avoid bug with transparency.
979
+ // June 2019. Patch to avoid bug with transparency.
971980 radioButton.hadMaterial = obj.material != null;
972981 if (!radioButton.hadMaterial)
973982 {
....@@ -1211,8 +1220,6 @@
12111220 }
12121221 }
12131222
1214
- String string = (String) object;
1215
-
12161223 System.out.println("Transfer = " + object + "; drop : " + target);
12171224 // if( object instanceof java.io.File[])
12181225 // {
....@@ -1220,6 +1227,8 @@
12201227 // objEditor.DropFile((java.io.File[]) object, true);
12211228 // return;
12221229 // }
1230
+
1231
+ String string = object.toString();
12231232
12241233 // File path for Mac and Windows
12251234 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -1469,6 +1478,9 @@
14691478 animationItem.addItemListener(this);
14701479 animationItem.setState(Globals.ANIMATION);
14711480
1481
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1482
+ archiveItem.addActionListener(this);
1483
+
14721484 menu.add("-");
14731485 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
14741486 parseverticesItem.addActionListener(this);
....@@ -1481,6 +1493,8 @@
14811493 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
14821494 reduce34MorphItem.addActionListener(this);
14831495 menu.add("-");
1496
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1497
+ memoryItem.addActionListener(this);
14841498 menu.add(computeAOItem = new MenuItem("Compute AO"));
14851499 computeAOItem.addActionListener(this);
14861500
....@@ -1489,8 +1503,6 @@
14891503 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
14901504 mirrorItem.addActionListener(this);
14911505 menu.add("-");
1492
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1493
- memoryItem.addActionListener(this);
14941506 menu.add(analyzeItem = new MenuItem("Analyze"));
14951507 analyzeItem.addActionListener(this);
14961508 menu.add(dumpItem = new MenuItem("Print"));
....@@ -2213,7 +2225,8 @@
22132225 } else
22142226 if (source == undoButton)
22152227 {
2216
- Undo();
2228
+ if (!Undo())
2229
+ java.awt.Toolkit.getDefaultToolkit().beep();
22172230 } else
22182231 if (source == redoButton)
22192232 {
....@@ -2221,7 +2234,8 @@
22212234 } else
22222235 if (source == saveButton)
22232236 {
2224
- Save();
2237
+ if (!Save(true))
2238
+ java.awt.Toolkit.getDefaultToolkit().beep();
22252239 } else
22262240 if (source == oneStepButton)
22272241 {
....@@ -2230,17 +2244,14 @@
22302244 } else
22312245 if (source == screenfitButton)
22322246 {
2233
- //Reload(lastConverter, lastFilename, true);
22342247 ScreenFit();
22352248 } else
22362249 if (source == screenfitpointButton)
22372250 {
2238
- //Reload(lastConverter, lastFilename, true);
22392251 ScreenFitPoint();
22402252 } else
22412253 if (source == snapobjectButton)
22422254 {
2243
- //Reload(lastConverter, lastFilename, true);
22442255 SnapObject();
22452256 } else
22462257 // if (event.getSource() == recompileButton)
....@@ -4728,7 +4739,7 @@
47284739 void refreshContents(boolean cp)
47294740 {
47304741 if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4731
- if (!Globals.MOUSEDRAGGED) // && !Globals.TIMERRUNNING)
4742
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
47324743 {
47334744 objEditor.ClearInfo(); // .GetMaterial());
47344745
....@@ -4827,8 +4838,8 @@
48274838
48284839 if (cut)
48294840 {
4830
- if (Globals.SAVEONMAKE)
4831
- Save();
4841
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4842
+// Save();
48324843 //int indices[] = jList.getSelectedIndices();
48334844 //for (int i = indices.length - 1; i >= 0; i--)
48344845 //jList.remove(indices[i]);
....@@ -4931,6 +4942,10 @@
49314942
49324943 void paste(boolean expand)
49334944 {
4945
+ if (Globals.SAVEONMAKE)
4946
+ Save();
4947
+ boolean keep = Globals.SAVEONMAKE;
4948
+ Globals.SAVEONMAKE = false;
49344949 // if (GrafreeD.clipboard == null)
49354950 // return;
49364951 boolean first = true;
....@@ -4990,6 +5005,7 @@
49905005 Grafreed.clipboard.get(0).parent = keepparent;
49915006 }
49925007
5008
+ Globals.SAVEONMAKE = keep;
49935009 ResetModel();
49945010 refreshContents();
49955011 }
....@@ -5125,6 +5141,10 @@
51255141
51265142 void group(Object3D csg, boolean grab)
51275143 {
5144
+ if (Globals.SAVEONMAKE)
5145
+ Save();
5146
+ boolean keep = Globals.SAVEONMAKE;
5147
+ Globals.SAVEONMAKE = false;
51285148 if (//false) // why??
51295149 !group.selection.isEmpty())
51305150 {
....@@ -5238,10 +5258,15 @@
52385258 //node.add(csg);
52395259 //makeSomething(node);
52405260 makeSomething(csg);
5261
+ Globals.SAVEONMAKE = keep;
52415262 }
52425263
52435264 void Ungroup(Object3D g)
52445265 {
5266
+ if (Globals.SAVEONMAKE)
5267
+ Save();
5268
+ boolean keep = Globals.SAVEONMAKE;
5269
+ Globals.SAVEONMAKE = false;
52455270 if (g instanceof HiddenObject)
52465271 {
52475272 HiddenObject h = (HiddenObject) g;
....@@ -5258,6 +5283,7 @@
52585283 objEditor.makeSomething(g.get(i), false);
52595284 }
52605285 }
5286
+ Globals.SAVEONMAKE = keep;
52615287 }
52625288
52635289 void ungroup()