.. | .. |
---|
15 | 15 | //import javax.swing.plaf.ColorUIResource; |
---|
16 | 16 | //import javax.swing.plaf.metal.DefaultMetalTheme; |
---|
17 | 17 | |
---|
| 18 | +import javax.swing.plaf.basic.BasicSplitPaneDivider; |
---|
| 19 | +import javax.swing.plaf.basic.BasicSplitPaneUI; |
---|
| 20 | + |
---|
18 | 21 | //import javax.media.opengl.GLCanvas; |
---|
19 | 22 | |
---|
20 | 23 | import //weka.core. |
---|
.. | .. |
---|
207 | 210 | |
---|
208 | 211 | objEditor.ctrlPanel.remove(namePanel); |
---|
209 | 212 | |
---|
210 | | - if (!GroupEditor.allparams) |
---|
| 213 | + if (!allparams) |
---|
211 | 214 | return; |
---|
212 | 215 | |
---|
213 | 216 | // objEditor.ctrlPanel.remove(liveCB); |
---|
.. | .. |
---|
337 | 340 | return frame.action(event, obj); |
---|
338 | 341 | } |
---|
339 | 342 | |
---|
| 343 | + // Cannot work without static |
---|
| 344 | + static boolean allparams = true; |
---|
| 345 | + |
---|
| 346 | + static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>(); |
---|
| 347 | + |
---|
340 | 348 | void SetupMenu() |
---|
341 | 349 | { |
---|
342 | 350 | frame.setMenuBar(menuBar = new MenuBar()); |
---|
.. | .. |
---|
383 | 391 | closeItem.addActionListener(this); |
---|
384 | 392 | |
---|
385 | 393 | objectPanel = new JTabbedPane(); |
---|
| 394 | + |
---|
| 395 | + ChangeListener changeListener = new ChangeListener() |
---|
| 396 | + { |
---|
| 397 | + public void stateChanged(ChangeEvent changeEvent) |
---|
| 398 | + { |
---|
| 399 | +// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed) |
---|
| 400 | +// { |
---|
| 401 | +// if (latestObject != null) |
---|
| 402 | +// { |
---|
| 403 | +// refreshContents(true); |
---|
| 404 | +// SetMaterial(latestObject); |
---|
| 405 | +// } |
---|
| 406 | +// |
---|
| 407 | +// materialFlushed = true; |
---|
| 408 | +// } |
---|
| 409 | +// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Edit")) |
---|
| 410 | +// { |
---|
| 411 | +// if (listUI.size() == 0) |
---|
| 412 | +// EditSelection(false); |
---|
| 413 | +// } |
---|
| 414 | + |
---|
| 415 | + refreshContents(false); // To refresh Info tab |
---|
| 416 | + } |
---|
| 417 | + }; |
---|
| 418 | + objectPanel.addChangeListener(changeListener); |
---|
| 419 | + |
---|
386 | 420 | toolbarPanel = new JPanel(); |
---|
387 | 421 | toolbarPanel.setName("Toolbar"); |
---|
388 | 422 | treePanel = new cGridBag(); |
---|
.. | .. |
---|
427 | 461 | mainPanel.setDividerSize(9); |
---|
428 | 462 | mainPanel.setDividerLocation(0.5); //1.0); |
---|
429 | 463 | mainPanel.setResizeWeight(0.5); |
---|
430 | | - |
---|
| 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 | + |
---|
431 | 472 | //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5)); |
---|
432 | 473 | //mainPanel.setLayout(new GridBagLayout()); |
---|
433 | 474 | toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); |
---|
.. | .. |
---|
702 | 743 | |
---|
703 | 744 | void ToggleFullScreen() |
---|
704 | 745 | { |
---|
705 | | - if (CameraPane.FULLSCREEN) |
---|
| 746 | + cameraView.ToggleFullScreen(); |
---|
| 747 | + |
---|
| 748 | + if (!CameraPane.FULLSCREEN) |
---|
706 | 749 | { |
---|
707 | 750 | device.setFullScreenWindow(null); |
---|
708 | 751 | //frame.setVisible(false); |
---|
.. | .. |
---|
742 | 785 | radio.layout.doClick(); |
---|
743 | 786 | //frame.setVisible(true); |
---|
744 | 787 | } |
---|
745 | | - |
---|
746 | | - cameraView.ToggleFullScreen(); |
---|
747 | 788 | } |
---|
748 | 789 | |
---|
749 | 790 | private JTextPane createTextPane() |
---|
.. | .. |
---|
884 | 925 | JCheckBox speedupCB; |
---|
885 | 926 | JCheckBox rewindCB; |
---|
886 | 927 | JCheckBox flipVCB; |
---|
| 928 | + |
---|
| 929 | + cCheckBox toggleTextureCB; |
---|
| 930 | + cCheckBox toggleSwitchCB; |
---|
| 931 | + |
---|
887 | 932 | JComboBox texresMenu; |
---|
| 933 | + |
---|
888 | 934 | JButton resetButton; |
---|
889 | 935 | JButton stepButton; |
---|
890 | 936 | JButton stepAllButton; |
---|
.. | .. |
---|
1076 | 1122 | |
---|
1077 | 1123 | oe.ctrlPanel.Return(); |
---|
1078 | 1124 | |
---|
1079 | | - if (!GroupEditor.allparams) |
---|
| 1125 | + if (!allparams) |
---|
1080 | 1126 | return; |
---|
1081 | 1127 | |
---|
1082 | 1128 | setupPanel = new cGridBag().setVertical(false); |
---|
.. | .. |
---|
1089 | 1135 | hideCB = AddCheckBox(setupPanel, "Hide", copy.hide); |
---|
1090 | 1136 | hideCB.setToolTipText("Hide object"); |
---|
1091 | 1137 | markCB = AddCheckBox(setupPanel, "Mark", copy.marked); |
---|
1092 | | - markCB.setToolTipText("Set the animation target transform"); |
---|
| 1138 | + markCB.setToolTipText("As animation target transform"); |
---|
1093 | 1139 | |
---|
1094 | 1140 | setupPanel2 = new cGridBag().setVertical(false); |
---|
1095 | 1141 | |
---|
.. | .. |
---|
1097 | 1143 | rewindCB.setToolTipText("Rewind animation"); |
---|
1098 | 1144 | |
---|
1099 | 1145 | randomCB = AddCheckBox(setupPanel2, "Rand", copy.random); |
---|
1100 | | - randomCB.setToolTipText("Randomly Rewind or Go back and forth"); |
---|
| 1146 | + randomCB.setToolTipText("Randomly Rewind (or Go back and forth)"); |
---|
1101 | 1147 | |
---|
1102 | 1148 | if (Globals.ADVANCED) |
---|
1103 | 1149 | { |
---|
.. | .. |
---|
1412 | 1458 | |
---|
1413 | 1459 | //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); |
---|
1414 | 1460 | //tmp.setName("Edit"); |
---|
1415 | | - objectPanel.add(toolboxPanel); |
---|
1416 | 1461 | objectPanel.add(materialPanel); |
---|
1417 | 1462 | // JPanel north = new JPanel(new BorderLayout()); |
---|
1418 | 1463 | // north.setName("Edit"); |
---|
.. | .. |
---|
1420 | 1465 | // objectPanel.add(north); |
---|
1421 | 1466 | objectPanel.add(editPanel); |
---|
1422 | 1467 | objectPanel.add(infoPanel); |
---|
| 1468 | + objectPanel.add(toolboxPanel); |
---|
1423 | 1469 | |
---|
1424 | 1470 | /* |
---|
1425 | 1471 | aConstraints.gridx = 0; |
---|
.. | .. |
---|
1428 | 1474 | aConstraints.gridy += 1; |
---|
1429 | 1475 | aConstraints.gridwidth = 1; |
---|
1430 | 1476 | mainPanel.add(objectPanel, aConstraints); |
---|
1431 | | - */ |
---|
| 1477 | + */ |
---|
1432 | 1478 | |
---|
1433 | 1479 | scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS, |
---|
1434 | 1480 | VERTICAL_SCROLLBAR_AS_NEEDED, |
---|
.. | .. |
---|
1445 | 1491 | JTabbedPane tabbedPane = new JTabbedPane(); |
---|
1446 | 1492 | tabbedPane.add(scrollpane); |
---|
1447 | 1493 | |
---|
1448 | | - tabbedPane.add(FSPane = new cFileSystemPane(this)); |
---|
1449 | | - |
---|
1450 | | - optionsPanel = new cGridBag().setVertical(true); |
---|
| 1494 | + optionsPanel = new cGridBag().setVertical(false); |
---|
1451 | 1495 | |
---|
1452 | 1496 | optionsPanel.setName("Options"); |
---|
1453 | 1497 | |
---|
.. | .. |
---|
1455 | 1499 | |
---|
1456 | 1500 | tabbedPane.add(optionsPanel); |
---|
1457 | 1501 | |
---|
| 1502 | + tabbedPane.add(FSPane = new cFileSystemPane(this)); |
---|
| 1503 | + |
---|
1458 | 1504 | scenePanel.add(tabbedPane); |
---|
1459 | 1505 | |
---|
1460 | 1506 | /* |
---|
.. | .. |
---|
1547 | 1593 | // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc); |
---|
1548 | 1594 | |
---|
1549 | 1595 | frame.setSize(1280, 860); |
---|
| 1596 | + |
---|
| 1597 | + frame.validate(); |
---|
1550 | 1598 | frame.setVisible(true); |
---|
1551 | 1599 | |
---|
1552 | 1600 | cameraView.requestFocusInWindow(); |
---|
.. | .. |
---|
2866 | 2914 | |
---|
2867 | 2915 | void SetMaterial(Object3D object) |
---|
2868 | 2916 | { |
---|
| 2917 | + latestObject = object; |
---|
| 2918 | + |
---|
2869 | 2919 | cMaterial mat = object.material; |
---|
2870 | 2920 | |
---|
2871 | 2921 | if (mat == null) |
---|
.. | .. |
---|
2977 | 3027 | // } |
---|
2978 | 3028 | |
---|
2979 | 3029 | /**/ |
---|
2980 | | - if (deselect) |
---|
| 3030 | + if (deselect || child == null) |
---|
2981 | 3031 | { |
---|
2982 | 3032 | //group.deselectAll(); |
---|
2983 | 3033 | //freeze = true; |
---|
2984 | 3034 | GetTree().clearSelection(); |
---|
2985 | 3035 | //freeze = false; |
---|
| 3036 | + |
---|
| 3037 | + if (child == null) |
---|
| 3038 | + { |
---|
| 3039 | + return; |
---|
| 3040 | + } |
---|
2986 | 3041 | } |
---|
2987 | 3042 | |
---|
2988 | 3043 | //group.addSelectee(child); |
---|
.. | .. |
---|
3051 | 3106 | cameraView.ToggleDL(); |
---|
3052 | 3107 | cameraView.repaint(); |
---|
3053 | 3108 | return; |
---|
3054 | | - } else if (event.getSource() == toggleTextureItem) |
---|
| 3109 | + } else if (event.getSource() == toggleTextureItem || event.getSource() == toggleTextureCB) |
---|
3055 | 3110 | { |
---|
3056 | 3111 | cameraView.ToggleTexture(); |
---|
3057 | 3112 | // june 2013 copy.HardTouch(); |
---|
.. | .. |
---|
3090 | 3145 | frame.validate(); |
---|
3091 | 3146 | |
---|
3092 | 3147 | return; |
---|
3093 | | - } else if (event.getSource() == toggleSwitchItem) |
---|
| 3148 | + } else if (event.getSource() == toggleSwitchItem || event.getSource() == toggleSwitchCB) |
---|
3094 | 3149 | { |
---|
3095 | 3150 | cameraView.ToggleSwitch(); |
---|
3096 | 3151 | cameraView.repaint(); |
---|
.. | .. |
---|
3497 | 3552 | tab.graphs[i] = null; |
---|
3498 | 3553 | } |
---|
3499 | 3554 | |
---|
| 3555 | + SetUndoStates(); |
---|
| 3556 | + |
---|
3500 | 3557 | // test save |
---|
3501 | 3558 | if (false) |
---|
3502 | 3559 | { |
---|
.. | .. |
---|
3519 | 3576 | |
---|
3520 | 3577 | void CopyChanged(Object3D obj) |
---|
3521 | 3578 | { |
---|
| 3579 | + SetUndoStates(); |
---|
| 3580 | + |
---|
3522 | 3581 | boolean temp = CameraPane.SWITCH; |
---|
3523 | 3582 | CameraPane.SWITCH = false; |
---|
3524 | 3583 | |
---|
.. | .. |
---|
3556 | 3615 | } |
---|
3557 | 3616 | |
---|
3558 | 3617 | 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); |
---|
3559 | 3629 | } |
---|
3560 | 3630 | |
---|
3561 | 3631 | public void Undo() |
---|
.. | .. |
---|
4735 | 4805 | String filename = browser.getFile(); |
---|
4736 | 4806 | if (filename != null && filename.length() > 0) |
---|
4737 | 4807 | { |
---|
| 4808 | + if (!filename.endsWith(".gfd")) |
---|
| 4809 | + filename += ".gfd"; |
---|
4738 | 4810 | lastname = browser.getDirectory() + filename; |
---|
4739 | 4811 | save(); |
---|
4740 | 4812 | } |
---|
.. | .. |
---|
4945 | 5017 | cGridBag optionsPanel; |
---|
4946 | 5018 | |
---|
4947 | 5019 | JTabbedPane objectPanel; |
---|
| 5020 | + boolean materialFlushed; |
---|
| 5021 | + Object3D latestObject; |
---|
4948 | 5022 | |
---|
4949 | 5023 | cGridBag XYZPanel; |
---|
4950 | 5024 | |
---|