Normand Briere
2019-06-27 1807e7752960ac229cddd34b100e92cadbac9459
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);
....@@ -337,6 +340,11 @@
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());
....@@ -398,6 +406,11 @@
398406 //
399407 // materialFlushed = true;
400408 // }
409
+// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Edit"))
410
+// {
411
+// if (listUI.size() == 0)
412
+// EditSelection(false);
413
+// }
401414
402415 refreshContents(false); // To refresh Info tab
403416 }
....@@ -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));
....@@ -723,7 +743,9 @@
723743
724744 void ToggleFullScreen()
725745 {
726
- if (CameraPane.FULLSCREEN)
746
+ cameraView.ToggleFullScreen();
747
+
748
+ if (!CameraPane.FULLSCREEN)
727749 {
728750 device.setFullScreenWindow(null);
729751 //frame.setVisible(false);
....@@ -763,8 +785,6 @@
763785 radio.layout.doClick();
764786 //frame.setVisible(true);
765787 }
766
-
767
- cameraView.ToggleFullScreen();
768788 }
769789
770790 private JTextPane createTextPane()
....@@ -1102,7 +1122,7 @@
11021122
11031123 oe.ctrlPanel.Return();
11041124
1105
- if (!GroupEditor.allparams)
1125
+ if (!allparams)
11061126 return;
11071127
11081128 setupPanel = new cGridBag().setVertical(false);
....@@ -1115,7 +1135,7 @@
11151135 hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
11161136 hideCB.setToolTipText("Hide object");
11171137 markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
1118
- markCB.setToolTipText("Set the animation target transform");
1138
+ markCB.setToolTipText("As animation target transform");
11191139
11201140 setupPanel2 = new cGridBag().setVertical(false);
11211141
....@@ -1123,7 +1143,7 @@
11231143 rewindCB.setToolTipText("Rewind animation");
11241144
11251145 randomCB = AddCheckBox(setupPanel2, "Rand", copy.random);
1126
- randomCB.setToolTipText("Randomly Rewind or Go back and forth");
1146
+ randomCB.setToolTipText("Randomly Rewind (or Go back and forth)");
11271147
11281148 if (Globals.ADVANCED)
11291149 {
....@@ -1439,13 +1459,13 @@
14391459 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
14401460 //tmp.setName("Edit");
14411461 objectPanel.add(materialPanel);
1442
- objectPanel.add(toolboxPanel);
14431462 // JPanel north = new JPanel(new BorderLayout());
14441463 // north.setName("Edit");
14451464 // north.add(ctrlPanel, BorderLayout.NORTH);
14461465 // objectPanel.add(north);
14471466 objectPanel.add(editPanel);
14481467 objectPanel.add(infoPanel);
1468
+ objectPanel.add(toolboxPanel);
14491469
14501470 /*
14511471 aConstraints.gridx = 0;
....@@ -1454,7 +1474,7 @@
14541474 aConstraints.gridy += 1;
14551475 aConstraints.gridwidth = 1;
14561476 mainPanel.add(objectPanel, aConstraints);
1457
- */
1477
+ */
14581478
14591479 scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS,
14601480 VERTICAL_SCROLLBAR_AS_NEEDED,
....@@ -3007,12 +3027,17 @@
30073027 // }
30083028
30093029 /**/
3010
- if (deselect)
3030
+ if (deselect || child == null)
30113031 {
30123032 //group.deselectAll();
30133033 //freeze = true;
30143034 GetTree().clearSelection();
30153035 //freeze = false;
3036
+
3037
+ if (child == null)
3038
+ {
3039
+ return;
3040
+ }
30163041 }
30173042
30183043 //group.addSelectee(child);
....@@ -3527,6 +3552,8 @@
35273552 tab.graphs[i] = null;
35283553 }
35293554
3555
+ SetUndoStates();
3556
+
35303557 // test save
35313558 if (false)
35323559 {
....@@ -3549,6 +3576,8 @@
35493576
35503577 void CopyChanged(Object3D obj)
35513578 {
3579
+ SetUndoStates();
3580
+
35523581 boolean temp = CameraPane.SWITCH;
35533582 CameraPane.SWITCH = false;
35543583
....@@ -3586,6 +3615,17 @@
35863615 }
35873616
35883617 refreshContents();
3618
+ }
3619
+
3620
+ cButton undoButton;
3621
+ cButton redoButton;
3622
+
3623
+ void SetUndoStates()
3624
+ {
3625
+ cRadio tab = GetCurrentTab();
3626
+
3627
+ undoButton.setEnabled(tab.undoindex > 0);
3628
+ redoButton.setEnabled(tab.graphs[tab.undoindex + 1] != null);
35893629 }
35903630
35913631 public void Undo()
....@@ -4765,6 +4805,8 @@
47654805 String filename = browser.getFile();
47664806 if (filename != null && filename.length() > 0)
47674807 {
4808
+ if (!filename.endsWith(".gfd"))
4809
+ filename += ".gfd";
47684810 lastname = browser.getDirectory() + filename;
47694811 save();
47704812 }