Normand Briere
2019-07-01 6600d22461ccc1cb602f238a9ffa83cf07dd830e
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.
....@@ -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
....@@ -347,7 +350,7 @@
347350 frame.setMenuBar(menuBar = new MenuBar());
348351 menuBar.add(fileMenu = new Menu("File"));
349352 fileMenu.add(newItem = new MenuItem("New"));
350
- fileMenu.add(loadItem = new MenuItem("Open..."));
353
+ fileMenu.add(openItem = new MenuItem("Open..."));
351354
352355 //oe.menuBar.add(menu = new Menu("Include"));
353356 Menu menu = new Menu("Import");
....@@ -379,7 +382,7 @@
379382 }
380383
381384 newItem.addActionListener(this);
382
- loadItem.addActionListener(this);
385
+ openItem.addActionListener(this);
383386 saveItem.addActionListener(this);
384387 saveAsItem.addActionListener(this);
385388 exportAsItem.addActionListener(this);
....@@ -446,7 +449,7 @@
446449 // TEXTAREA infoarea.setLineWrap(true);
447450 // TEXTAREA infoarea.setWrapStyleWord(true);
448451 infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
449
- infoPanel.setPreferredSize(new Dimension(50, 200));
452
+ infoPanel.setPreferredSize(new Dimension(1, 1));
450453 infoPanel.setName("Info");
451454 //infoPanel.setLayout(new BorderLayout());
452455 //infoPanel.add(createTextPane());
....@@ -458,7 +461,14 @@
458461 mainPanel.setDividerSize(9);
459462 mainPanel.setDividerLocation(0.5); //1.0);
460463 mainPanel.setResizeWeight(0.5);
461
-
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
+
462472 //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5));
463473 //mainPanel.setLayout(new GridBagLayout());
464474 toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
....@@ -689,8 +699,8 @@
689699 }
690700 }
691701
692
-static GraphicsDevice device = GraphicsEnvironment
693
- .getLocalGraphicsEnvironment().getScreenDevices()[0];
702
+//static GraphicsDevice device = GraphicsEnvironment
703
+// .getLocalGraphicsEnvironment().getScreenDevices()[0];
694704
695705 Rectangle keeprect;
696706 cRadio radio;
....@@ -711,10 +721,19 @@
711721 void Minimize()
712722 {
713723 frame.setState(Frame.ICONIFIED);
724
+ frame.validate();
714725 }
715726
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={}
716730 void Maximize()
717731 {
732
+ if (CameraPane.FULLSCREEN)
733
+ {
734
+ ToggleFullScreen();
735
+ }
736
+
718737 if (maximized)
719738 {
720739 frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height);
....@@ -722,22 +741,36 @@
722741 else
723742 {
724743 keeprect = frame.getBounds();
725
- Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
726
- Dimension rect2 = frame.getToolkit().getScreenSize();
727
- 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);
728747 // frame.setState(Frame.MAXIMIZED_BOTH);
748
+ frame.setBounds(frame.getGraphicsConfiguration().getBounds());
729749 }
730750
731751 maximized ^= true;
752
+
753
+ frame.validate();
732754 }
755
+
756
+ cButton minButton;
757
+ cButton maxButton;
758
+ cButton fullButton;
733759
734760 void ToggleFullScreen()
735761 {
762
+GraphicsDevice device = frame.getGraphicsConfiguration().getDevice();
763
+
736764 cameraView.ToggleFullScreen();
737765
738766 if (!CameraPane.FULLSCREEN)
739767 {
740768 device.setFullScreenWindow(null);
769
+ frame.dispose();
770
+ frame.setUndecorated(false);
771
+ frame.validate();
772
+ frame.setVisible(true);
773
+
741774 //frame.setVisible(false);
742775 // frame.removeNotify();
743776 // frame.setUndecorated(false);
....@@ -747,7 +780,7 @@
747780 // X frame.getContentPane().remove(/*"Center",*/bigThree);
748781 // X framePanel.add(bigThree);
749782 // X frame.getContentPane().add(/*"Center",*/framePanel);
750
- framePanel.setDividerLocation(1);
783
+ framePanel.setDividerLocation(46);
751784
752785 //frame.setVisible(true);
753786 radio.layout = keepButton;
....@@ -762,7 +795,12 @@
762795 // frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width,
763796 // frame.getToolkit().getScreenSize().height);
764797 //frame.setVisible(false);
798
+
799
+ frame.dispose();
800
+ frame.setUndecorated(true);
765801 device.setFullScreenWindow(frame);
802
+ frame.validate();
803
+ frame.setVisible(true);
766804 // frame.removeNotify();
767805 // frame.setUndecorated(true);
768806 // frame.addNotify();
....@@ -775,6 +813,7 @@
775813 radio.layout.doClick();
776814 //frame.setVisible(true);
777815 }
816
+ frame.validate();
778817 }
779818
780819 private JTextPane createTextPane()
....@@ -1107,7 +1146,7 @@
11071146 namePanel = new cGridBag();
11081147
11091148 nameField = AddText(namePanel, copy.GetName());
1110
- namePanel.add(nameField);
1149
+ namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER));
11111150 oe.ctrlPanel.add(namePanel);
11121151
11131152 oe.ctrlPanel.Return();
....@@ -1125,15 +1164,15 @@
11251164 hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
11261165 hideCB.setToolTipText("Hide object");
11271166 markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
1128
- markCB.setToolTipText("Set the animation target transform");
1167
+ markCB.setToolTipText("As animation target transform");
11291168
11301169 setupPanel2 = new cGridBag().setVertical(false);
11311170
11321171 rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind);
11331172 rewindCB.setToolTipText("Rewind animation");
11341173
1135
- randomCB = AddCheckBox(setupPanel2, "Rand", copy.random);
1136
- 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)");
11371176
11381177 if (Globals.ADVANCED)
11391178 {
....@@ -1454,7 +1493,10 @@
14541493 // north.add(ctrlPanel, BorderLayout.NORTH);
14551494 // objectPanel.add(north);
14561495 objectPanel.add(editPanel);
1457
- objectPanel.add(infoPanel);
1496
+
1497
+ //if (Globals.ADVANCED)
1498
+ objectPanel.add(infoPanel);
1499
+
14581500 objectPanel.add(toolboxPanel);
14591501
14601502 /*
....@@ -1563,9 +1605,9 @@
15631605 // aConstraints.gridheight = 1;
15641606
15651607 framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree);
1566
- framePanel.setContinuousLayout(true);
1567
- framePanel.setOneTouchExpandable(true);
1568
- framePanel.setDividerLocation(0.8);
1608
+ framePanel.setContinuousLayout(false);
1609
+ framePanel.setOneTouchExpandable(false);
1610
+ //.setDividerLocation(0.8);
15691611 //framePanel.setDividerSize(15);
15701612 //framePanel.setResizeWeight(0.15);
15711613 framePanel.setName("Frame");
....@@ -1584,12 +1626,13 @@
15841626
15851627 frame.setSize(1280, 860);
15861628
1587
- frame.validate();
1588
- frame.setVisible(true);
1589
-
15901629 cameraView.requestFocusInWindow();
15911630
15921631 gridPanel.setDividerLocation(1.0);
1632
+
1633
+ frame.validate();
1634
+
1635
+ frame.setVisible(true);
15931636
15941637 frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
15951638 frame.addWindowListener(new WindowAdapter()
....@@ -1676,24 +1719,6 @@
16761719 texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
16771720 colorSection.add(texture);
16781721
1679
- cGridBag anisoU = new cGridBag();
1680
- anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints);
1681
- anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1682
- anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1683
- colorSection.add(anisoU);
1684
-
1685
- cGridBag anisoV = new cGridBag();
1686
- anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints);
1687
- anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1688
- anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1689
- colorSection.add(anisoV);
1690
-
1691
- cGridBag shadowbias = new cGridBag();
1692
- shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints);
1693
- shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING);
1694
- shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1695
- colorSection.add(shadowbias);
1696
-
16971722 panel.add(new JSeparator());
16981723
16991724 panel.add(colorSection);
....@@ -1743,6 +1768,12 @@
17431768 fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING);
17441769 fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
17451770 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);
17461777
17471778 panel.add(new JSeparator());
17481779
....@@ -1794,6 +1825,18 @@
17941825 // aConstraints.gridy += 1;
17951826 // aConstraints.gridwidth = 1;
17961827
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
+
17971840
17981841 panel.add(new JSeparator());
17991842
....@@ -1801,35 +1844,35 @@
18011844
18021845 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
18031846
1804
- cGridBag globalSection = new cGridBag().setVertical(true);
1847
+ //cGridBag globalSection = new cGridBag().setVertical(true);
18051848
18061849 cGridBag camera = new cGridBag();
18071850 camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints);
18081851 cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING);
18091852 camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1810
- globalSection.add(camera);
1853
+ colorSection.add(camera);
18111854
18121855 cGridBag ambient = new cGridBag();
18131856 ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints);
18141857 ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING);
18151858 ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1816
- globalSection.add(ambient);
1859
+ colorSection.add(ambient);
18171860
18181861 cGridBag backlit = new cGridBag();
18191862 backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints);
18201863 backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING);
18211864 backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints);
1822
- globalSection.add(backlit);
1865
+ colorSection.add(backlit);
18231866
18241867 cGridBag opacity = new cGridBag();
18251868 opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints);
18261869 opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING);
18271870 opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints);
1828
- globalSection.add(opacity);
1871
+ colorSection.add(opacity);
18291872
1830
- panel.add(new JSeparator());
1873
+ //panel.add(new JSeparator());
18311874
1832
- panel.add(globalSection);
1875
+ //panel.add(globalSection);
18331876
18341877 //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints);
18351878
....@@ -3017,12 +3060,17 @@
30173060 // }
30183061
30193062 /**/
3020
- if (deselect)
3063
+ if (deselect || child == null)
30213064 {
30223065 //group.deselectAll();
30233066 //freeze = true;
30243067 GetTree().clearSelection();
30253068 //freeze = false;
3069
+
3070
+ if (child == null)
3071
+ {
3072
+ return;
3073
+ }
30263074 }
30273075
30283076 //group.addSelectee(child);
....@@ -3346,9 +3394,9 @@
33463394 {
33473395 Close();
33483396 //return true;
3349
- } else if (source == loadItem)
3397
+ } else if (source == openItem)
33503398 {
3351
- load();
3399
+ Open();
33523400 //return true;
33533401 } else if (source == newItem)
33543402 {
....@@ -3373,6 +3421,10 @@
33733421 {
33743422 generatePOV();
33753423 //return true;
3424
+ } else if (event.getSource() == archiveItem)
3425
+ {
3426
+ cTools.Archive(frame);
3427
+ return;
33763428 } else if (source == zBufferItem)
33773429 {
33783430 try
....@@ -3523,8 +3575,10 @@
35233575
35243576 copy.ExtractBigData(hashtable);
35253577
3578
+ byte[] compress = Compress(copy);
3579
+
35263580 //EditorFrame.m_MainFrame.requestFocusInWindow();
3527
- tab.graphs[tab.undoindex++] = Compress(copy);
3581
+ tab.graphs[tab.undoindex++] = compress;
35283582
35293583 copy.RestoreBigData(hashtable);
35303584
....@@ -4673,7 +4727,7 @@
46734727 }
46744728 }
46754729
4676
- void load() // throws ClassNotFoundException
4730
+ void Open() // throws ClassNotFoundException
46774731 {
46784732 if (Grafreed.standAlone)
46794733 {
....@@ -4958,7 +5012,7 @@
49585012 MenuBar menuBar;
49595013 Menu fileMenu;
49605014 MenuItem newItem;
4961
- MenuItem loadItem;
5015
+ MenuItem openItem;
49625016 MenuItem saveItem;
49635017 MenuItem saveAsItem;
49645018 MenuItem exportAsItem;
....@@ -4981,6 +5035,7 @@
49815035 CheckboxMenuItem toggleSwitchItem;
49825036 CheckboxMenuItem toggleRootItem;
49835037 CheckboxMenuItem animationItem;
5038
+ MenuItem archiveItem;
49845039 CheckboxMenuItem toggleHandleItem;
49855040 CheckboxMenuItem togglePaintItem;
49865041 JSplitPane mainPanel;