Normand Briere
2019-07-07 46dbce888e7c3eff8969f1ddbe22e144410b67f4
ObjEditor.java
....@@ -15,6 +15,9 @@
1515 //import javax.swing.plaf.ColorUIResource;
1616 //import javax.swing.plaf.metal.DefaultMetalTheme;
1717
18
+import javax.swing.plaf.basic.BasicSplitPaneDivider;
19
+import javax.swing.plaf.basic.BasicSplitPaneUI;
20
+
1821 //import javax.media.opengl.GLCanvas;
1922
2023 import //weka.core.
....@@ -207,7 +210,7 @@
207210
208211 objEditor.ctrlPanel.remove(namePanel);
209212
210
- if (!GroupEditor.allparams)
213
+ if (!allparams)
211214 return;
212215
213216 // objEditor.ctrlPanel.remove(liveCB);
....@@ -306,7 +309,7 @@
306309 //localCopy.parent = null;
307310
308311 frame = new JFrame();
309
- frame.setUndecorated(true);
312
+ frame.setUndecorated(false);
310313 objEditor = this;
311314 this.callee = callee;
312315
....@@ -337,12 +340,17 @@
337340 return frame.action(event, obj);
338341 }
339342
343
+ // Cannot work without static
344
+ static boolean allparams = true;
345
+
346
+ static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>();
347
+
340348 void SetupMenu()
341349 {
342350 frame.setMenuBar(menuBar = new MenuBar());
343351 menuBar.add(fileMenu = new Menu("File"));
344352 fileMenu.add(newItem = new MenuItem("New"));
345
- fileMenu.add(loadItem = new MenuItem("Open..."));
353
+ fileMenu.add(openItem = new MenuItem("Open..."));
346354
347355 //oe.menuBar.add(menu = new Menu("Include"));
348356 Menu menu = new Menu("Import");
....@@ -374,7 +382,7 @@
374382 }
375383
376384 newItem.addActionListener(this);
377
- loadItem.addActionListener(this);
385
+ openItem.addActionListener(this);
378386 saveItem.addActionListener(this);
379387 saveAsItem.addActionListener(this);
380388 exportAsItem.addActionListener(this);
....@@ -397,6 +405,11 @@
397405 // }
398406 //
399407 // materialFlushed = true;
408
+// }
409
+// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Edit"))
410
+// {
411
+// if (listUI.size() == 0)
412
+// EditSelection(false);
400413 // }
401414
402415 refreshContents(false); // To refresh Info tab
....@@ -436,7 +449,7 @@
436449 // TEXTAREA infoarea.setLineWrap(true);
437450 // TEXTAREA infoarea.setWrapStyleWord(true);
438451 infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
439
- infoPanel.setPreferredSize(new Dimension(50, 200));
452
+ infoPanel.setPreferredSize(new Dimension(1, 1));
440453 infoPanel.setName("Info");
441454 //infoPanel.setLayout(new BorderLayout());
442455 //infoPanel.add(createTextPane());
....@@ -448,7 +461,14 @@
448461 mainPanel.setDividerSize(9);
449462 mainPanel.setDividerLocation(0.5); //1.0);
450463 mainPanel.setResizeWeight(0.5);
451
-
464
+
465
+//mainPanel.setDividerSize((int) (mainPanel.getDividerSize() * 1.5));
466
+ BasicSplitPaneDivider divider = ( (BasicSplitPaneUI) mainPanel.getUI()).getDivider();
467
+ divider.setDividerSize(15);
468
+ divider.setBorder(BorderFactory.createTitledBorder(divider.getBorder(), "Custom border title -- gets rid of the one-touch arrows!"));
469
+
470
+ mainPanel.setUI(new BasicSplitPaneUI());
471
+
452472 //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5));
453473 //mainPanel.setLayout(new GridBagLayout());
454474 toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
....@@ -679,8 +699,8 @@
679699 }
680700 }
681701
682
-static GraphicsDevice device = GraphicsEnvironment
683
- .getLocalGraphicsEnvironment().getScreenDevices()[0];
702
+//static GraphicsDevice device = GraphicsEnvironment
703
+// .getLocalGraphicsEnvironment().getScreenDevices()[0];
684704
685705 Rectangle keeprect;
686706 cRadio radio;
....@@ -701,10 +721,19 @@
701721 void Minimize()
702722 {
703723 frame.setState(Frame.ICONIFIED);
724
+ frame.validate();
704725 }
705726
727
+// artifactURI=null, type=0, property=${file.reference.jfxrt.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@6767876f, broken=false, additional={}
728
+// artifactURI=null, type=0, property=${file.reference.mac-ui.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@16bdc817, broken=false, additional={}
729
+// artifactURI=null, type=0, property=${file.reference.classes.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@9daa9c17, broken=false, additional={}
706730 void Maximize()
707731 {
732
+ if (CameraPane.FULLSCREEN)
733
+ {
734
+ ToggleFullScreen();
735
+ }
736
+
708737 if (maximized)
709738 {
710739 frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
....@@ -712,20 +741,36 @@
712741 else
713742 {
714743 keeprect = frame.getBounds();
715
- Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
716
- Dimension rect2 = frame.getToolkit().getScreenSize();
717
- frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height);
744
+// Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
745
+// Dimension rect2 = frame.getToolkit().getScreenSize();
746
+// frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height);
718747 // frame.setState(Frame.MAXIMIZED_BOTH);
748
+ frame.setBounds(frame.getGraphicsConfiguration().getBounds());
719749 }
720750
721751 maximized ^= true;
752
+
753
+ frame.validate();
722754 }
755
+
756
+ cButton minButton;
757
+ cButton maxButton;
758
+ cButton fullButton;
723759
724760 void ToggleFullScreen()
725761 {
726
- if (CameraPane.FULLSCREEN)
762
+GraphicsDevice device = frame.getGraphicsConfiguration().getDevice();
763
+
764
+ cameraView.ToggleFullScreen();
765
+
766
+ if (!CameraPane.FULLSCREEN)
727767 {
728768 device.setFullScreenWindow(null);
769
+ frame.dispose();
770
+ frame.setUndecorated(false);
771
+ frame.validate();
772
+ frame.setVisible(true);
773
+
729774 //frame.setVisible(false);
730775 // frame.removeNotify();
731776 // frame.setUndecorated(false);
....@@ -735,7 +780,7 @@
735780 // X frame.getContentPane().remove(/*"Center",*/bigThree);
736781 // X framePanel.add(bigThree);
737782 // X frame.getContentPane().add(/*"Center",*/framePanel);
738
- framePanel.setDividerLocation(1);
783
+ framePanel.setDividerLocation(46);
739784
740785 //frame.setVisible(true);
741786 radio.layout = keepButton;
....@@ -750,7 +795,12 @@
750795 // frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width,
751796 // frame.getToolkit().getScreenSize().height);
752797 //frame.setVisible(false);
798
+
799
+ frame.dispose();
800
+ frame.setUndecorated(true);
753801 device.setFullScreenWindow(frame);
802
+ frame.validate();
803
+ frame.setVisible(true);
754804 // frame.removeNotify();
755805 // frame.setUndecorated(true);
756806 // frame.addNotify();
....@@ -763,8 +813,7 @@
763813 radio.layout.doClick();
764814 //frame.setVisible(true);
765815 }
766
-
767
- cameraView.ToggleFullScreen();
816
+ frame.validate();
768817 }
769818
770819 private JTextPane createTextPane()
....@@ -1097,12 +1146,12 @@
10971146 namePanel = new cGridBag();
10981147
10991148 nameField = AddText(namePanel, copy.GetName());
1100
- namePanel.add(nameField);
1149
+ namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER));
11011150 oe.ctrlPanel.add(namePanel);
11021151
11031152 oe.ctrlPanel.Return();
11041153
1105
- if (!GroupEditor.allparams)
1154
+ if (!allparams)
11061155 return;
11071156
11081157 setupPanel = new cGridBag().setVertical(false);
....@@ -1115,15 +1164,15 @@
11151164 hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
11161165 hideCB.setToolTipText("Hide object");
11171166 markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
1118
- markCB.setToolTipText("Set the animation target transform");
1167
+ markCB.setToolTipText("As animation target transform");
11191168
11201169 setupPanel2 = new cGridBag().setVertical(false);
11211170
11221171 rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind);
11231172 rewindCB.setToolTipText("Rewind animation");
11241173
1125
- randomCB = AddCheckBox(setupPanel2, "Rand", copy.random);
1126
- randomCB.setToolTipText("Randomly Rewind or Go back and forth");
1174
+ randomCB = AddCheckBox(setupPanel2, "Random", copy.random);
1175
+ randomCB.setToolTipText("Randomly Rewind (or Go back and forth)");
11271176
11281177 if (Globals.ADVANCED)
11291178 {
....@@ -1439,13 +1488,16 @@
14391488 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
14401489 //tmp.setName("Edit");
14411490 objectPanel.add(materialPanel);
1442
- objectPanel.add(toolboxPanel);
14431491 // JPanel north = new JPanel(new BorderLayout());
14441492 // north.setName("Edit");
14451493 // north.add(ctrlPanel, BorderLayout.NORTH);
14461494 // objectPanel.add(north);
14471495 objectPanel.add(editPanel);
1448
- objectPanel.add(infoPanel);
1496
+
1497
+ //if (Globals.ADVANCED)
1498
+ objectPanel.add(infoPanel);
1499
+
1500
+ objectPanel.add(toolboxPanel);
14491501
14501502 /*
14511503 aConstraints.gridx = 0;
....@@ -1454,7 +1506,7 @@
14541506 aConstraints.gridy += 1;
14551507 aConstraints.gridwidth = 1;
14561508 mainPanel.add(objectPanel, aConstraints);
1457
- */
1509
+ */
14581510
14591511 scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS,
14601512 VERTICAL_SCROLLBAR_AS_NEEDED,
....@@ -1553,9 +1605,9 @@
15531605 // aConstraints.gridheight = 1;
15541606
15551607 framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree);
1556
- framePanel.setContinuousLayout(true);
1557
- framePanel.setOneTouchExpandable(true);
1558
- framePanel.setDividerLocation(0.8);
1608
+ framePanel.setContinuousLayout(false);
1609
+ framePanel.setOneTouchExpandable(false);
1610
+ //.setDividerLocation(0.8);
15591611 //framePanel.setDividerSize(15);
15601612 //framePanel.setResizeWeight(0.15);
15611613 framePanel.setName("Frame");
....@@ -1574,12 +1626,13 @@
15741626
15751627 frame.setSize(1280, 860);
15761628
1577
- frame.validate();
1578
- frame.setVisible(true);
1579
-
15801629 cameraView.requestFocusInWindow();
15811630
15821631 gridPanel.setDividerLocation(1.0);
1632
+
1633
+ frame.validate();
1634
+
1635
+ frame.setVisible(true);
15831636
15841637 frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
15851638 frame.addWindowListener(new WindowAdapter()
....@@ -1666,24 +1719,6 @@
16661719 texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
16671720 colorSection.add(texture);
16681721
1669
- cGridBag anisoU = new cGridBag();
1670
- anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
1671
- anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1672
- anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1673
- colorSection.add(anisoU);
1674
-
1675
- cGridBag anisoV = new cGridBag();
1676
- anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
1677
- anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1678
- anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1679
- colorSection.add(anisoV);
1680
-
1681
- cGridBag shadowbias = new cGridBag();
1682
- shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
1683
- shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1684
- shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1685
- colorSection.add(shadowbias);
1686
-
16871722 panel.add(new JSeparator());
16881723
16891724 panel.add(colorSection);
....@@ -1733,6 +1768,12 @@
17331768 fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
17341769 fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
17351770 diffuseSection.add(fakedepth);
1771
+
1772
+ cGridBag shadowbias = new cGridBag();
1773
+ shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
1774
+ shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1775
+ shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1776
+ diffuseSection.add(shadowbias);
17361777
17371778 panel.add(new JSeparator());
17381779
....@@ -1784,6 +1825,18 @@
17841825 // aConstraints.gridy += 1;
17851826 // aConstraints.gridwidth = 1;
17861827
1828
+ cGridBag anisoU = new cGridBag();
1829
+ anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
1830
+ anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1831
+ anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1832
+ specularSection.add(anisoU);
1833
+
1834
+ cGridBag anisoV = new cGridBag();
1835
+ anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
1836
+ anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1837
+ anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1838
+ specularSection.add(anisoV);
1839
+
17871840
17881841 panel.add(new JSeparator());
17891842
....@@ -1791,35 +1844,35 @@
17911844
17921845 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
17931846
1794
- cGridBag globalSection = new cGridBag().setVertical(true);
1847
+ //cGridBag globalSection = new cGridBag().setVertical(true);
17951848
17961849 cGridBag camera = new cGridBag();
17971850 camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints);
17981851 cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
17991852 camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1800
- globalSection.add(camera);
1853
+ colorSection.add(camera);
18011854
18021855 cGridBag ambient = new cGridBag();
18031856 ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints);
18041857 ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
18051858 ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1806
- globalSection.add(ambient);
1859
+ colorSection.add(ambient);
18071860
18081861 cGridBag backlit = new cGridBag();
18091862 backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints);
18101863 backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
18111864 backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1812
- globalSection.add(backlit);
1865
+ colorSection.add(backlit);
18131866
18141867 cGridBag opacity = new cGridBag();
18151868 opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
18161869 opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
18171870 opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1818
- globalSection.add(opacity);
1871
+ colorSection.add(opacity);
18191872
1820
- panel.add(new JSeparator());
1873
+ //panel.add(new JSeparator());
18211874
1822
- panel.add(globalSection);
1875
+ //panel.add(globalSection);
18231876
18241877 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
18251878
....@@ -1926,8 +1979,9 @@
19261979 // 3D models
19271980 if (filename.endsWith(".3ds") || filename.endsWith(".3DS"))
19281981 {
1929
- lastConverter = new com.jmex.model.converters.MaxToJme();
1930
- LoadFile(filename, lastConverter);
1982
+ //lastConverter = new com.jmex.model.converters.MaxToJme();
1983
+ //LoadFile(filename, lastConverter);
1984
+ LoadObjFile(filename); // New 3ds loader
19311985 continue;
19321986 }
19331987 if (filename.endsWith(".dae") || filename.endsWith(".DAE"))
....@@ -2653,6 +2707,7 @@
26532707 LA.matXRotate(((Object3D) group.get(group.size() - 1)).toParent, -Math.PI / 2);
26542708 LA.matXRotate(((Object3D) group.get(group.size() - 1)).fromParent, Math.PI / 2);
26552709 }
2710
+
26562711 //cJME.count++;
26572712 //cJME.count %= 12;
26582713 if (gc)
....@@ -2836,6 +2891,7 @@
28362891 }
28372892 }
28382893 }
2894
+
28392895 cFileSystemPane FSPane;
28402896
28412897 void SetMaterial(cMaterial mat, Object3D.cVector2[] others)
....@@ -2889,6 +2945,7 @@
28892945 }
28902946 }
28912947 }
2948
+
28922949 freezematerial = false;
28932950 }
28942951
....@@ -3007,12 +3064,17 @@
30073064 // }
30083065
30093066 /**/
3010
- if (deselect)
3067
+ if (deselect || child == null)
30113068 {
30123069 //group.deselectAll();
30133070 //freeze = true;
30143071 GetTree().clearSelection();
30153072 //freeze = false;
3073
+
3074
+ if (child == null)
3075
+ {
3076
+ return;
3077
+ }
30163078 }
30173079
30183080 //group.addSelectee(child);
....@@ -3336,9 +3398,9 @@
33363398 {
33373399 Close();
33383400 //return true;
3339
- } else if (source == loadItem)
3401
+ } else if (source == openItem)
33403402 {
3341
- load();
3403
+ Open();
33423404 //return true;
33433405 } else if (source == newItem)
33443406 {
....@@ -3363,6 +3425,10 @@
33633425 {
33643426 generatePOV();
33653427 //return true;
3428
+ } else if (event.getSource() == archiveItem)
3429
+ {
3430
+ cTools.Archive(frame);
3431
+ return;
33663432 } else if (source == zBufferItem)
33673433 {
33683434 try
....@@ -3504,6 +3570,28 @@
35043570
35053571 public void Save()
35063572 {
3573
+ // Default reduces the probability of heuristics errors.
3574
+ Save(true);
3575
+ }
3576
+
3577
+ private boolean Equal(byte[] compress, byte[] name)
3578
+ {
3579
+ if (compress.length != name.length)
3580
+ {
3581
+ return false;
3582
+ }
3583
+
3584
+ for (int i=compress.length; --i>=0;)
3585
+ {
3586
+ if (compress[i] != name[i])
3587
+ return false;
3588
+ }
3589
+
3590
+ return true;
3591
+ }
3592
+
3593
+ public boolean Save(boolean user)
3594
+ {
35073595 System.err.println("Save");
35083596
35093597 cRadio tab = GetCurrentTab();
....@@ -3513,20 +3601,37 @@
35133601
35143602 copy.ExtractBigData(hashtable);
35153603
3516
- //EditorFrame.m_MainFrame.requestFocusInWindow();
3517
- tab.graphs[tab.undoindex++] = Compress(copy);
3518
-
3519
- copy.RestoreBigData(hashtable);
3604
+ byte[] compress = Compress(copy);
35203605
35213606 CameraPane.SWITCH = temp;
35223607
3608
+ boolean thesame = false;
3609
+
3610
+ // Quick heuristic using length. Works only when stream is compressed.
3611
+ if (tab.undoindex > 0 && tab.graphs[tab.undoindex-1] != null && Equal(compress, tab.graphs[tab.undoindex-1]))
3612
+ {
3613
+ thesame = true;
3614
+ }
3615
+
3616
+ //EditorFrame.m_MainFrame.requestFocusInWindow();
3617
+ if (!thesame)
3618
+ {
3619
+ tab.user[tab.undoindex] = user;
3620
+ tab.graphs[tab.undoindex++] = compress;
3621
+ }
3622
+
3623
+ copy.RestoreBigData(hashtable);
3624
+
35233625 //assert(hashtable.isEmpty());
35243626
35253627 for (int i = tab.undoindex; i < tab.graphs.length; i++)
35263628 {
3629
+ tab.user[i] = false;
35273630 tab.graphs[i] = null;
35283631 }
35293632
3633
+ SetUndoStates();
3634
+
35303635 // test save
35313636 if (false)
35323637 {
....@@ -3545,10 +3650,14 @@
35453650 e.printStackTrace();
35463651 }
35473652 }
3653
+
3654
+ return !thesame;
35483655 }
35493656
35503657 void CopyChanged(Object3D obj)
35513658 {
3659
+ SetUndoStates();
3660
+
35523661 boolean temp = CameraPane.SWITCH;
35533662 CameraPane.SWITCH = false;
35543663
....@@ -3588,7 +3697,18 @@
35883697 refreshContents();
35893698 }
35903699
3591
- public void Undo()
3700
+ cButton undoButton;
3701
+ cButton redoButton;
3702
+
3703
+ void SetUndoStates()
3704
+ {
3705
+ cRadio tab = GetCurrentTab();
3706
+
3707
+ undoButton.setEnabled(tab.undoindex > 0);
3708
+ redoButton.setEnabled(tab.graphs[tab.undoindex + 1] != null);
3709
+ }
3710
+
3711
+ public boolean Undo()
35923712 {
35933713 System.err.println("Undo");
35943714
....@@ -3597,18 +3717,27 @@
35973717 if (tab.undoindex == 0)
35983718 {
35993719 java.awt.Toolkit.getDefaultToolkit().beep();
3600
- return;
3720
+ return false;
36013721 }
36023722
3603
- if (tab.graphs[tab.undoindex] == null)
3723
+ if (tab.graphs[tab.undoindex] == null || !tab.user[tab.undoindex])
36043724 {
3605
- Save();
3606
- tab.undoindex -= 1;
3725
+ if (Save(false))
3726
+ tab.undoindex -= 1;
3727
+ else
3728
+ {
3729
+ if (tab.undoindex <= 0)
3730
+ return false;
3731
+ else
3732
+ tab.undoindex -= 1;
3733
+ }
36073734 }
36083735
36093736 tab.undoindex -= 1;
36103737
36113738 CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
3739
+
3740
+ return true;
36123741 }
36133742
36143743 public void Redo()
....@@ -3624,6 +3753,9 @@
36243753 tab.undoindex += 1;
36253754
36263755 CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
3756
+
3757
+ if (!tab.user[tab.undoindex])
3758
+ tab.graphs[tab.undoindex] = null;
36273759 }
36283760
36293761 void ImportGFD()
....@@ -4648,7 +4780,7 @@
46484780 }
46494781 }
46504782
4651
- void load() // throws ClassNotFoundException
4783
+ void Open() // throws ClassNotFoundException
46524784 {
46534785 if (Grafreed.standAlone)
46544786 {
....@@ -4765,6 +4897,8 @@
47654897 String filename = browser.getFile();
47664898 if (filename != null && filename.length() > 0)
47674899 {
4900
+ if (!filename.endsWith(".gfd"))
4901
+ filename += ".gfd";
47684902 lastname = browser.getDirectory() + filename;
47694903 save();
47704904 }
....@@ -4931,7 +5065,7 @@
49315065 MenuBar menuBar;
49325066 Menu fileMenu;
49335067 MenuItem newItem;
4934
- MenuItem loadItem;
5068
+ MenuItem openItem;
49355069 MenuItem saveItem;
49365070 MenuItem saveAsItem;
49375071 MenuItem exportAsItem;
....@@ -4954,6 +5088,7 @@
49545088 CheckboxMenuItem toggleSwitchItem;
49555089 CheckboxMenuItem toggleRootItem;
49565090 CheckboxMenuItem animationItem;
5091
+ MenuItem archiveItem;
49575092 CheckboxMenuItem toggleHandleItem;
49585093 CheckboxMenuItem togglePaintItem;
49595094 JSplitPane mainPanel;