.. | .. |
---|
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. |
---|
.. | .. |
---|
49 | 52 | catch (Exception e) |
---|
50 | 53 | { |
---|
51 | 54 | return new cButton(name, border); |
---|
| 55 | + } |
---|
| 56 | + } |
---|
| 57 | + |
---|
| 58 | + cToggleButton GetToggleButton(String name, boolean border) |
---|
| 59 | + { |
---|
| 60 | + try |
---|
| 61 | + { |
---|
| 62 | + ImageIcon icon = GetIcon(name); |
---|
| 63 | + return new cToggleButton(icon, border); |
---|
| 64 | + } |
---|
| 65 | + catch (Exception e) |
---|
| 66 | + { |
---|
| 67 | + return new cToggleButton(name, border); |
---|
52 | 68 | } |
---|
53 | 69 | } |
---|
54 | 70 | |
---|
.. | .. |
---|
194 | 210 | |
---|
195 | 211 | objEditor.ctrlPanel.remove(namePanel); |
---|
196 | 212 | |
---|
197 | | - if (!GroupEditor.allparams) |
---|
| 213 | + if (!allparams) |
---|
198 | 214 | return; |
---|
199 | 215 | |
---|
200 | 216 | // objEditor.ctrlPanel.remove(liveCB); |
---|
.. | .. |
---|
324 | 340 | return frame.action(event, obj); |
---|
325 | 341 | } |
---|
326 | 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 | + |
---|
327 | 348 | void SetupMenu() |
---|
328 | 349 | { |
---|
329 | 350 | frame.setMenuBar(menuBar = new MenuBar()); |
---|
.. | .. |
---|
370 | 391 | closeItem.addActionListener(this); |
---|
371 | 392 | |
---|
372 | 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 | + |
---|
373 | 420 | toolbarPanel = new JPanel(); |
---|
374 | 421 | toolbarPanel.setName("Toolbar"); |
---|
375 | 422 | treePanel = new cGridBag(); |
---|
.. | .. |
---|
384 | 431 | editPanel.add(editCommandsPanel); |
---|
385 | 432 | editPanel.add(ctrlPanel); |
---|
386 | 433 | |
---|
387 | | - materialPanel = new cGridBag().setVertical(true); |
---|
| 434 | + toolboxPanel = new cGridBag().setVertical(false); |
---|
| 435 | + toolboxPanel.setName("Toolbox"); |
---|
388 | 436 | |
---|
| 437 | + materialPanel = new cGridBag().setVertical(true); |
---|
389 | 438 | materialPanel.setName("Material"); |
---|
| 439 | + |
---|
390 | 440 | /*JTextPane*/ |
---|
391 | 441 | infoarea = createTextPane(); |
---|
392 | 442 | doc = infoarea.getStyledDocument(); |
---|
.. | .. |
---|
411 | 461 | mainPanel.setDividerSize(9); |
---|
412 | 462 | mainPanel.setDividerLocation(0.5); //1.0); |
---|
413 | 463 | mainPanel.setResizeWeight(0.5); |
---|
414 | | - |
---|
| 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 | + |
---|
415 | 472 | //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5)); |
---|
416 | 473 | //mainPanel.setLayout(new GridBagLayout()); |
---|
417 | 474 | toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); |
---|
.. | .. |
---|
659 | 716 | |
---|
660 | 717 | boolean maximized; |
---|
661 | 718 | |
---|
| 719 | + cButton fullscreenLayout; |
---|
| 720 | + |
---|
662 | 721 | void Minimize() |
---|
663 | 722 | { |
---|
664 | 723 | frame.setState(Frame.ICONIFIED); |
---|
.. | .. |
---|
684 | 743 | |
---|
685 | 744 | void ToggleFullScreen() |
---|
686 | 745 | { |
---|
687 | | - if (CameraPane.FULLSCREEN) |
---|
| 746 | + cameraView.ToggleFullScreen(); |
---|
| 747 | + |
---|
| 748 | + if (!CameraPane.FULLSCREEN) |
---|
688 | 749 | { |
---|
689 | 750 | device.setFullScreenWindow(null); |
---|
690 | 751 | //frame.setVisible(false); |
---|
.. | .. |
---|
720 | 781 | // X frame.getContentPane().add(/*"Center",*/bigThree); |
---|
721 | 782 | framePanel.setDividerLocation(0); |
---|
722 | 783 | |
---|
723 | | - radio.layout = twoButton; |
---|
| 784 | + radio.layout = fullscreenLayout; |
---|
724 | 785 | radio.layout.doClick(); |
---|
725 | 786 | //frame.setVisible(true); |
---|
726 | 787 | } |
---|
727 | | - |
---|
728 | | - cameraView.ToggleFullScreen(); |
---|
729 | 788 | } |
---|
730 | 789 | |
---|
731 | 790 | private JTextPane createTextPane() |
---|
.. | .. |
---|
866 | 925 | JCheckBox speedupCB; |
---|
867 | 926 | JCheckBox rewindCB; |
---|
868 | 927 | JCheckBox flipVCB; |
---|
| 928 | + |
---|
| 929 | + cCheckBox toggleTextureCB; |
---|
| 930 | + cCheckBox toggleSwitchCB; |
---|
| 931 | + |
---|
869 | 932 | JComboBox texresMenu; |
---|
| 933 | + |
---|
870 | 934 | JButton resetButton; |
---|
871 | 935 | JButton stepButton; |
---|
872 | 936 | JButton stepAllButton; |
---|
.. | .. |
---|
1058 | 1122 | |
---|
1059 | 1123 | oe.ctrlPanel.Return(); |
---|
1060 | 1124 | |
---|
1061 | | - if (!GroupEditor.allparams) |
---|
| 1125 | + if (!allparams) |
---|
1062 | 1126 | return; |
---|
1063 | 1127 | |
---|
1064 | 1128 | setupPanel = new cGridBag().setVertical(false); |
---|
.. | .. |
---|
1071 | 1135 | hideCB = AddCheckBox(setupPanel, "Hide", copy.hide); |
---|
1072 | 1136 | hideCB.setToolTipText("Hide object"); |
---|
1073 | 1137 | markCB = AddCheckBox(setupPanel, "Mark", copy.marked); |
---|
1074 | | - markCB.setToolTipText("Set the animation target transform"); |
---|
| 1138 | + markCB.setToolTipText("As animation target transform"); |
---|
1075 | 1139 | |
---|
1076 | 1140 | setupPanel2 = new cGridBag().setVertical(false); |
---|
1077 | 1141 | |
---|
.. | .. |
---|
1079 | 1143 | rewindCB.setToolTipText("Rewind animation"); |
---|
1080 | 1144 | |
---|
1081 | 1145 | randomCB = AddCheckBox(setupPanel2, "Rand", copy.random); |
---|
1082 | | - randomCB.setToolTipText("Randomly Rewind or Go back and forth"); |
---|
| 1146 | + randomCB.setToolTipText("Randomly Rewind (or Go back and forth)"); |
---|
1083 | 1147 | |
---|
1084 | 1148 | if (Globals.ADVANCED) |
---|
1085 | 1149 | { |
---|
.. | .. |
---|
1401 | 1465 | // objectPanel.add(north); |
---|
1402 | 1466 | objectPanel.add(editPanel); |
---|
1403 | 1467 | objectPanel.add(infoPanel); |
---|
| 1468 | + objectPanel.add(toolboxPanel); |
---|
1404 | 1469 | |
---|
1405 | 1470 | /* |
---|
1406 | 1471 | aConstraints.gridx = 0; |
---|
.. | .. |
---|
1409 | 1474 | aConstraints.gridy += 1; |
---|
1410 | 1475 | aConstraints.gridwidth = 1; |
---|
1411 | 1476 | mainPanel.add(objectPanel, aConstraints); |
---|
1412 | | - */ |
---|
| 1477 | + */ |
---|
1413 | 1478 | |
---|
1414 | 1479 | scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS, |
---|
1415 | 1480 | VERTICAL_SCROLLBAR_AS_NEEDED, |
---|
.. | .. |
---|
1426 | 1491 | JTabbedPane tabbedPane = new JTabbedPane(); |
---|
1427 | 1492 | tabbedPane.add(scrollpane); |
---|
1428 | 1493 | |
---|
1429 | | - tabbedPane.add(FSPane = new cFileSystemPane(this)); |
---|
1430 | | - |
---|
1431 | | - optionsPanel = new cGridBag().setVertical(true); |
---|
| 1494 | + optionsPanel = new cGridBag().setVertical(false); |
---|
1432 | 1495 | |
---|
1433 | 1496 | optionsPanel.setName("Options"); |
---|
1434 | 1497 | |
---|
.. | .. |
---|
1436 | 1499 | |
---|
1437 | 1500 | tabbedPane.add(optionsPanel); |
---|
1438 | 1501 | |
---|
| 1502 | + tabbedPane.add(FSPane = new cFileSystemPane(this)); |
---|
| 1503 | + |
---|
1439 | 1504 | scenePanel.add(tabbedPane); |
---|
1440 | 1505 | |
---|
1441 | 1506 | /* |
---|
.. | .. |
---|
1528 | 1593 | // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc); |
---|
1529 | 1594 | |
---|
1530 | 1595 | frame.setSize(1280, 860); |
---|
| 1596 | + |
---|
| 1597 | + frame.validate(); |
---|
1531 | 1598 | frame.setVisible(true); |
---|
1532 | 1599 | |
---|
1533 | 1600 | cameraView.requestFocusInWindow(); |
---|
.. | .. |
---|
2847 | 2914 | |
---|
2848 | 2915 | void SetMaterial(Object3D object) |
---|
2849 | 2916 | { |
---|
| 2917 | + latestObject = object; |
---|
| 2918 | + |
---|
2850 | 2919 | cMaterial mat = object.material; |
---|
2851 | 2920 | |
---|
2852 | 2921 | if (mat == null) |
---|
.. | .. |
---|
2958 | 3027 | // } |
---|
2959 | 3028 | |
---|
2960 | 3029 | /**/ |
---|
2961 | | - if (deselect) |
---|
| 3030 | + if (deselect || child == null) |
---|
2962 | 3031 | { |
---|
2963 | 3032 | //group.deselectAll(); |
---|
2964 | 3033 | //freeze = true; |
---|
2965 | 3034 | GetTree().clearSelection(); |
---|
2966 | 3035 | //freeze = false; |
---|
| 3036 | + |
---|
| 3037 | + if (child == null) |
---|
| 3038 | + { |
---|
| 3039 | + return; |
---|
| 3040 | + } |
---|
2967 | 3041 | } |
---|
2968 | 3042 | |
---|
2969 | 3043 | //group.addSelectee(child); |
---|
.. | .. |
---|
3032 | 3106 | cameraView.ToggleDL(); |
---|
3033 | 3107 | cameraView.repaint(); |
---|
3034 | 3108 | return; |
---|
3035 | | - } else if (event.getSource() == toggleTextureItem) |
---|
| 3109 | + } else if (event.getSource() == toggleTextureItem || event.getSource() == toggleTextureCB) |
---|
3036 | 3110 | { |
---|
3037 | 3111 | cameraView.ToggleTexture(); |
---|
3038 | 3112 | // june 2013 copy.HardTouch(); |
---|
.. | .. |
---|
3071 | 3145 | frame.validate(); |
---|
3072 | 3146 | |
---|
3073 | 3147 | return; |
---|
3074 | | - } else if (event.getSource() == toggleSwitchItem) |
---|
| 3148 | + } else if (event.getSource() == toggleSwitchItem || event.getSource() == toggleSwitchCB) |
---|
3075 | 3149 | { |
---|
3076 | 3150 | cameraView.ToggleSwitch(); |
---|
3077 | 3151 | cameraView.repaint(); |
---|
.. | .. |
---|
3478 | 3552 | tab.graphs[i] = null; |
---|
3479 | 3553 | } |
---|
3480 | 3554 | |
---|
| 3555 | + SetUndoStates(); |
---|
| 3556 | + |
---|
3481 | 3557 | // test save |
---|
3482 | 3558 | if (false) |
---|
3483 | 3559 | { |
---|
.. | .. |
---|
3500 | 3576 | |
---|
3501 | 3577 | void CopyChanged(Object3D obj) |
---|
3502 | 3578 | { |
---|
| 3579 | + SetUndoStates(); |
---|
| 3580 | + |
---|
3503 | 3581 | boolean temp = CameraPane.SWITCH; |
---|
3504 | 3582 | CameraPane.SWITCH = false; |
---|
3505 | 3583 | |
---|
.. | .. |
---|
3537 | 3615 | } |
---|
3538 | 3616 | |
---|
3539 | 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); |
---|
3540 | 3629 | } |
---|
3541 | 3630 | |
---|
3542 | 3631 | public void Undo() |
---|
.. | .. |
---|
3726 | 3815 | assert false; |
---|
3727 | 3816 | } |
---|
3728 | 3817 | |
---|
3729 | | - void EditSelection() |
---|
| 3818 | + void EditSelection(boolean newWindow) |
---|
3730 | 3819 | { |
---|
3731 | 3820 | } |
---|
3732 | 3821 | |
---|
.. | .. |
---|
4221 | 4310 | |
---|
4222 | 4311 | void makeSomething(Object3D thing, boolean resetmodel) // deselect) |
---|
4223 | 4312 | { |
---|
4224 | | - if (Globals.SAVEONMAKE) |
---|
| 4313 | + if (Globals.SAVEONMAKE) // && resetmodel) |
---|
4225 | 4314 | Save(); |
---|
4226 | 4315 | //Tween.set(thing, 0).target(1).start(tweenManager); |
---|
4227 | 4316 | //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager); |
---|
.. | .. |
---|
4309 | 4398 | { |
---|
4310 | 4399 | ResetModel(); |
---|
4311 | 4400 | Select(thing.GetTreePath(), true, false); // unselect... false); |
---|
| 4401 | + |
---|
| 4402 | + if (thing.Size() == 0) |
---|
| 4403 | + { |
---|
| 4404 | + //EditSelection(false); |
---|
| 4405 | + } |
---|
| 4406 | + |
---|
4312 | 4407 | refreshContents(); |
---|
4313 | 4408 | } |
---|
4314 | 4409 | |
---|
.. | .. |
---|
4710 | 4805 | String filename = browser.getFile(); |
---|
4711 | 4806 | if (filename != null && filename.length() > 0) |
---|
4712 | 4807 | { |
---|
| 4808 | + if (!filename.endsWith(".gfd")) |
---|
| 4809 | + filename += ".gfd"; |
---|
4713 | 4810 | lastname = browser.getDirectory() + filename; |
---|
4714 | 4811 | save(); |
---|
4715 | 4812 | } |
---|
.. | .. |
---|
4903 | 5000 | CheckboxMenuItem togglePaintItem; |
---|
4904 | 5001 | JSplitPane mainPanel; |
---|
4905 | 5002 | JScrollPane scrollpane; |
---|
| 5003 | + |
---|
4906 | 5004 | JPanel toolbarPanel; |
---|
| 5005 | + |
---|
4907 | 5006 | cGridBag treePanel; |
---|
| 5007 | + |
---|
4908 | 5008 | JPanel radioPanel; |
---|
4909 | 5009 | ButtonGroup buttonGroup; |
---|
4910 | | - cGridBag ctrlPanel; |
---|
| 5010 | + |
---|
| 5011 | + cGridBag toolboxPanel; |
---|
4911 | 5012 | cGridBag materialPanel; |
---|
| 5013 | + cGridBag ctrlPanel; |
---|
| 5014 | + |
---|
4912 | 5015 | JScrollPane infoPanel; |
---|
| 5016 | + |
---|
4913 | 5017 | cGridBag optionsPanel; |
---|
| 5018 | + |
---|
4914 | 5019 | JTabbedPane objectPanel; |
---|
| 5020 | + boolean materialFlushed; |
---|
| 5021 | + Object3D latestObject; |
---|
| 5022 | + |
---|
4915 | 5023 | cGridBag XYZPanel; |
---|
| 5024 | + |
---|
4916 | 5025 | JSplitPane gridPanel; |
---|
4917 | 5026 | JSplitPane bigPanel; |
---|
| 5027 | + |
---|
4918 | 5028 | cGridBag bigThree; |
---|
4919 | 5029 | cGridBag scenePanel; |
---|
4920 | 5030 | cGridBag centralPanel; |
---|
.. | .. |
---|
5029 | 5139 | cNumberSlider fogField; |
---|
5030 | 5140 | JLabel opacityPowerLabel; |
---|
5031 | 5141 | cNumberSlider opacityPowerField; |
---|
5032 | | - JTree jTree; |
---|
| 5142 | + cTree jTree; |
---|
5033 | 5143 | //ObjectUI parent; |
---|
5034 | 5144 | |
---|
5035 | 5145 | cNumberSlider normalpushField; |
---|