.. | .. |
---|
4 | 4 | |
---|
5 | 5 | import java.awt.*; |
---|
6 | 6 | import java.awt.event.*; |
---|
| 7 | +import java.awt.image.BufferedImage; |
---|
7 | 8 | import javax.swing.*; |
---|
8 | 9 | import javax.swing.event.*; |
---|
9 | 10 | import javax.swing.text.*; |
---|
.. | .. |
---|
13 | 14 | import javax.swing.plaf.metal.MetalLookAndFeel; |
---|
14 | 15 | //import javax.swing.plaf.ColorUIResource; |
---|
15 | 16 | //import javax.swing.plaf.metal.DefaultMetalTheme; |
---|
| 17 | + |
---|
| 18 | +import javax.swing.plaf.basic.BasicSplitPaneDivider; |
---|
| 19 | +import javax.swing.plaf.basic.BasicSplitPaneUI; |
---|
16 | 20 | |
---|
17 | 21 | //import javax.media.opengl.GLCanvas; |
---|
18 | 22 | |
---|
.. | .. |
---|
37 | 41 | JFrame frame; |
---|
38 | 42 | |
---|
39 | 43 | static ObjEditor theFrame; |
---|
| 44 | + |
---|
| 45 | + cButton GetButton(String name, boolean border) |
---|
| 46 | + { |
---|
| 47 | + try |
---|
| 48 | + { |
---|
| 49 | + ImageIcon icon = GetIcon(name); |
---|
| 50 | + return new cButton(icon, border); |
---|
| 51 | + } |
---|
| 52 | + catch (Exception e) |
---|
| 53 | + { |
---|
| 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); |
---|
| 68 | + } |
---|
| 69 | + } |
---|
| 70 | + |
---|
| 71 | + cCheckBox GetCheckBox(String name, boolean border) |
---|
| 72 | + { |
---|
| 73 | + try |
---|
| 74 | + { |
---|
| 75 | + ImageIcon icon = GetIcon(name); |
---|
| 76 | + return new cCheckBox(icon, border); |
---|
| 77 | + } |
---|
| 78 | + catch (Exception e) |
---|
| 79 | + { |
---|
| 80 | + return new cCheckBox(name, border); |
---|
| 81 | + } |
---|
| 82 | + } |
---|
| 83 | + |
---|
| 84 | + private ImageIcon GetIcon(String name) throws IOException |
---|
| 85 | + { |
---|
| 86 | + BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name)); |
---|
| 87 | + |
---|
| 88 | + if (image.getWidth() != 24 && image.getHeight() != 24) |
---|
| 89 | + { |
---|
| 90 | + BufferedImage resized = new BufferedImage(24, 24, image.getType()); |
---|
| 91 | + Graphics2D g = resized.createGraphics(); |
---|
| 92 | + g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); |
---|
| 93 | + //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); |
---|
| 94 | + g.drawImage(image, 0, 0, 24, 24, 0, 0, image.getWidth(), image.getHeight(), null); |
---|
| 95 | + g.dispose(); |
---|
| 96 | + |
---|
| 97 | + image = resized; |
---|
| 98 | + } |
---|
| 99 | + |
---|
| 100 | + javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image); |
---|
| 101 | + return icon; |
---|
| 102 | + } |
---|
40 | 103 | |
---|
41 | 104 | // SCRIPT |
---|
42 | 105 | |
---|
.. | .. |
---|
147 | 210 | |
---|
148 | 211 | objEditor.ctrlPanel.remove(namePanel); |
---|
149 | 212 | |
---|
150 | | - if (!GroupEditor.allparams) |
---|
| 213 | + if (!allparams) |
---|
151 | 214 | return; |
---|
152 | 215 | |
---|
153 | 216 | // objEditor.ctrlPanel.remove(liveCB); |
---|
.. | .. |
---|
171 | 234 | |
---|
172 | 235 | objEditor.ctrlPanel.remove(setupPanel); |
---|
173 | 236 | objEditor.ctrlPanel.remove(setupPanel2); |
---|
174 | | - objEditor.ctrlPanel.remove(commandsPanel); |
---|
| 237 | + objEditor.ctrlPanel.remove(objectCommandsPanel); |
---|
175 | 238 | objEditor.ctrlPanel.remove(pushPanel); |
---|
176 | 239 | //objEditor.ctrlPanel.remove(fillPanel); |
---|
177 | 240 | |
---|
.. | .. |
---|
246 | 309 | //localCopy.parent = null; |
---|
247 | 310 | |
---|
248 | 311 | frame = new JFrame(); |
---|
249 | | - frame.setUndecorated(true); |
---|
| 312 | + frame.setUndecorated(false); |
---|
250 | 313 | objEditor = this; |
---|
251 | 314 | this.callee = callee; |
---|
252 | 315 | |
---|
.. | .. |
---|
276 | 339 | { |
---|
277 | 340 | return frame.action(event, obj); |
---|
278 | 341 | } |
---|
| 342 | + |
---|
| 343 | + // Cannot work without static |
---|
| 344 | + static boolean allparams = true; |
---|
| 345 | + |
---|
| 346 | + static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>(); |
---|
279 | 347 | |
---|
280 | 348 | void SetupMenu() |
---|
281 | 349 | { |
---|
.. | .. |
---|
323 | 391 | closeItem.addActionListener(this); |
---|
324 | 392 | |
---|
325 | 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 | + |
---|
326 | 420 | toolbarPanel = new JPanel(); |
---|
327 | 421 | toolbarPanel.setName("Toolbar"); |
---|
328 | 422 | treePanel = new cGridBag(); |
---|
329 | 423 | treePanel.setName("Tree"); |
---|
| 424 | + |
---|
| 425 | + editPanel = new cGridBag().setVertical(true); |
---|
| 426 | + editPanel.setName("Edit"); |
---|
| 427 | + |
---|
330 | 428 | ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout()); |
---|
331 | | - ctrlPanel.setName("Edit"); |
---|
| 429 | + |
---|
| 430 | + editCommandsPanel = new cGridBag(); |
---|
| 431 | + editPanel.add(editCommandsPanel); |
---|
| 432 | + editPanel.add(ctrlPanel); |
---|
| 433 | + |
---|
| 434 | + toolboxPanel = new cGridBag().setVertical(false); |
---|
| 435 | + toolboxPanel.setName("Toolbox"); |
---|
| 436 | + |
---|
332 | 437 | materialPanel = new cGridBag().setVertical(true); |
---|
333 | 438 | materialPanel.setName("Material"); |
---|
| 439 | + |
---|
334 | 440 | /*JTextPane*/ |
---|
335 | 441 | infoarea = createTextPane(); |
---|
336 | 442 | doc = infoarea.getStyledDocument(); |
---|
.. | .. |
---|
343 | 449 | // TEXTAREA infoarea.setLineWrap(true); |
---|
344 | 450 | // TEXTAREA infoarea.setWrapStyleWord(true); |
---|
345 | 451 | infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED); |
---|
346 | | - infoPanel.setPreferredSize(new Dimension(50, 200)); |
---|
| 452 | + //infoPanel.setPreferredSize(new Dimension(50, 200)); |
---|
347 | 453 | infoPanel.setName("Info"); |
---|
348 | 454 | //infoPanel.setLayout(new BorderLayout()); |
---|
349 | 455 | //infoPanel.add(createTextPane()); |
---|
.. | .. |
---|
355 | 461 | mainPanel.setDividerSize(9); |
---|
356 | 462 | mainPanel.setDividerLocation(0.5); //1.0); |
---|
357 | 463 | mainPanel.setResizeWeight(0.5); |
---|
358 | | - |
---|
| 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 | + |
---|
359 | 472 | //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5)); |
---|
360 | 473 | //mainPanel.setLayout(new GridBagLayout()); |
---|
361 | 474 | toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); |
---|
.. | .. |
---|
586 | 699 | } |
---|
587 | 700 | } |
---|
588 | 701 | |
---|
589 | | -static GraphicsDevice device = GraphicsEnvironment |
---|
590 | | - .getLocalGraphicsEnvironment().getScreenDevices()[0]; |
---|
| 702 | +//static GraphicsDevice device = GraphicsEnvironment |
---|
| 703 | +// .getLocalGraphicsEnvironment().getScreenDevices()[0]; |
---|
591 | 704 | |
---|
592 | 705 | Rectangle keeprect; |
---|
593 | 706 | cRadio radio; |
---|
.. | .. |
---|
603 | 716 | |
---|
604 | 717 | boolean maximized; |
---|
605 | 718 | |
---|
| 719 | + cButton fullscreenLayout; |
---|
| 720 | + |
---|
606 | 721 | void Minimize() |
---|
607 | 722 | { |
---|
608 | 723 | frame.setState(Frame.ICONIFIED); |
---|
| 724 | + frame.validate(); |
---|
609 | 725 | } |
---|
610 | 726 | |
---|
| 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={} |
---|
611 | 730 | void Maximize() |
---|
612 | 731 | { |
---|
| 732 | + if (CameraPane.FULLSCREEN) |
---|
| 733 | + { |
---|
| 734 | + ToggleFullScreen(); |
---|
| 735 | + } |
---|
| 736 | + |
---|
613 | 737 | if (maximized) |
---|
614 | 738 | { |
---|
615 | 739 | frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height); |
---|
.. | .. |
---|
617 | 741 | else |
---|
618 | 742 | { |
---|
619 | 743 | keeprect = frame.getBounds(); |
---|
620 | | - Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); |
---|
621 | | - Dimension rect2 = frame.getToolkit().getScreenSize(); |
---|
622 | | - 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); |
---|
623 | 747 | // frame.setState(Frame.MAXIMIZED_BOTH); |
---|
| 748 | + frame.setBounds(frame.getGraphicsConfiguration().getBounds()); |
---|
624 | 749 | } |
---|
625 | 750 | |
---|
626 | 751 | maximized ^= true; |
---|
| 752 | + |
---|
| 753 | + frame.validate(); |
---|
627 | 754 | } |
---|
| 755 | + |
---|
| 756 | + cButton minButton; |
---|
| 757 | + cButton maxButton; |
---|
| 758 | + cButton fullButton; |
---|
628 | 759 | |
---|
629 | 760 | void ToggleFullScreen() |
---|
630 | 761 | { |
---|
631 | | - if (CameraPane.FULLSCREEN) |
---|
| 762 | +GraphicsDevice device = frame.getGraphicsConfiguration().getDevice(); |
---|
| 763 | + |
---|
| 764 | + cameraView.ToggleFullScreen(); |
---|
| 765 | + |
---|
| 766 | + if (!CameraPane.FULLSCREEN) |
---|
632 | 767 | { |
---|
633 | 768 | device.setFullScreenWindow(null); |
---|
| 769 | + frame.dispose(); |
---|
| 770 | + frame.setUndecorated(false); |
---|
| 771 | + frame.validate(); |
---|
| 772 | + frame.setVisible(true); |
---|
| 773 | + |
---|
634 | 774 | //frame.setVisible(false); |
---|
635 | 775 | // frame.removeNotify(); |
---|
636 | 776 | // frame.setUndecorated(false); |
---|
.. | .. |
---|
655 | 795 | // frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width, |
---|
656 | 796 | // frame.getToolkit().getScreenSize().height); |
---|
657 | 797 | //frame.setVisible(false); |
---|
| 798 | + |
---|
| 799 | + frame.dispose(); |
---|
| 800 | + frame.setUndecorated(true); |
---|
658 | 801 | device.setFullScreenWindow(frame); |
---|
| 802 | + frame.validate(); |
---|
| 803 | + frame.setVisible(true); |
---|
659 | 804 | // frame.removeNotify(); |
---|
660 | 805 | // frame.setUndecorated(true); |
---|
661 | 806 | // frame.addNotify(); |
---|
.. | .. |
---|
664 | 809 | // X frame.getContentPane().add(/*"Center",*/bigThree); |
---|
665 | 810 | framePanel.setDividerLocation(0); |
---|
666 | 811 | |
---|
667 | | - radio.layout = twoButton; |
---|
| 812 | + radio.layout = fullscreenLayout; |
---|
668 | 813 | radio.layout.doClick(); |
---|
669 | 814 | //frame.setVisible(true); |
---|
670 | 815 | } |
---|
671 | | - |
---|
672 | | - cameraView.ToggleFullScreen(); |
---|
| 816 | + frame.validate(); |
---|
673 | 817 | } |
---|
674 | 818 | |
---|
675 | 819 | private JTextPane createTextPane() |
---|
.. | .. |
---|
810 | 954 | JCheckBox speedupCB; |
---|
811 | 955 | JCheckBox rewindCB; |
---|
812 | 956 | JCheckBox flipVCB; |
---|
| 957 | + |
---|
| 958 | + cCheckBox toggleTextureCB; |
---|
| 959 | + cCheckBox toggleSwitchCB; |
---|
| 960 | + |
---|
813 | 961 | JComboBox texresMenu; |
---|
| 962 | + |
---|
814 | 963 | JButton resetButton; |
---|
815 | 964 | JButton stepButton; |
---|
816 | 965 | JButton stepAllButton; |
---|
.. | .. |
---|
819 | 968 | JButton fasterButton; |
---|
820 | 969 | JButton remarkButton; |
---|
821 | 970 | |
---|
| 971 | + cGridBag editPanel; |
---|
| 972 | + cGridBag editCommandsPanel; |
---|
| 973 | + |
---|
822 | 974 | cGridBag namePanel; |
---|
823 | 975 | cGridBag setupPanel; |
---|
824 | 976 | cGridBag setupPanel2; |
---|
825 | | - cGridBag commandsPanel; |
---|
| 977 | + cGridBag objectCommandsPanel; |
---|
826 | 978 | cGridBag pushPanel; |
---|
827 | 979 | cGridBag fillPanel; |
---|
828 | 980 | |
---|
.. | .. |
---|
994 | 1146 | namePanel = new cGridBag(); |
---|
995 | 1147 | |
---|
996 | 1148 | nameField = AddText(namePanel, copy.GetName()); |
---|
997 | | - namePanel.add(nameField); |
---|
| 1149 | + namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER)); |
---|
998 | 1150 | oe.ctrlPanel.add(namePanel); |
---|
999 | 1151 | |
---|
1000 | 1152 | oe.ctrlPanel.Return(); |
---|
1001 | 1153 | |
---|
1002 | | - if (!GroupEditor.allparams) |
---|
| 1154 | + if (!allparams) |
---|
1003 | 1155 | return; |
---|
1004 | 1156 | |
---|
1005 | 1157 | setupPanel = new cGridBag().setVertical(false); |
---|
.. | .. |
---|
1012 | 1164 | hideCB = AddCheckBox(setupPanel, "Hide", copy.hide); |
---|
1013 | 1165 | hideCB.setToolTipText("Hide object"); |
---|
1014 | 1166 | markCB = AddCheckBox(setupPanel, "Mark", copy.marked); |
---|
1015 | | - markCB.setToolTipText("Set the animation target transform"); |
---|
| 1167 | + markCB.setToolTipText("As animation target transform"); |
---|
1016 | 1168 | |
---|
1017 | 1169 | setupPanel2 = new cGridBag().setVertical(false); |
---|
1018 | 1170 | |
---|
1019 | 1171 | rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind); |
---|
1020 | 1172 | rewindCB.setToolTipText("Rewind animation"); |
---|
1021 | 1173 | |
---|
1022 | | - randomCB = AddCheckBox(setupPanel2, "Rand", copy.random); |
---|
1023 | | - 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)"); |
---|
1024 | 1176 | |
---|
1025 | 1177 | if (Globals.ADVANCED) |
---|
1026 | 1178 | { |
---|
.. | .. |
---|
1035 | 1187 | oe.ctrlPanel.add(setupPanel2); |
---|
1036 | 1188 | oe.ctrlPanel.Return(); |
---|
1037 | 1189 | |
---|
1038 | | - commandsPanel = new cGridBag().setVertical(false); |
---|
| 1190 | + objectCommandsPanel = new cGridBag().setVertical(false); |
---|
1039 | 1191 | |
---|
1040 | | - resetButton = AddButton(commandsPanel, "Reset"); |
---|
| 1192 | + resetButton = AddButton(objectCommandsPanel, "Reset"); |
---|
1041 | 1193 | resetButton.setToolTipText("Jump to frame zero"); |
---|
1042 | | - stepButton = AddButton(commandsPanel, "Step"); |
---|
| 1194 | + stepButton = AddButton(objectCommandsPanel, "Step"); |
---|
1043 | 1195 | stepButton.setToolTipText("Step one frame"); |
---|
1044 | 1196 | // resetAllButton = AddButton(oe, "Reset All"); |
---|
1045 | 1197 | // stepAllButton = AddButton(oe, "Step All"); |
---|
1046 | 1198 | // Return(); |
---|
1047 | | - slowerButton = AddButton(commandsPanel, "Slow"); |
---|
| 1199 | + slowerButton = AddButton(objectCommandsPanel, "Slow"); |
---|
1048 | 1200 | slowerButton.setToolTipText("Decrease animation speed"); |
---|
1049 | | - fasterButton = AddButton(commandsPanel, "Fast"); |
---|
| 1201 | + fasterButton = AddButton(objectCommandsPanel, "Fast"); |
---|
1050 | 1202 | fasterButton.setToolTipText("Increase animation speed"); |
---|
1051 | | - remarkButton = AddButton(commandsPanel, "Remark"); |
---|
| 1203 | + remarkButton = AddButton(objectCommandsPanel, "Remark"); |
---|
1052 | 1204 | remarkButton.setToolTipText("Set the current transform as the target"); |
---|
1053 | 1205 | |
---|
1054 | | - oe.ctrlPanel.add(commandsPanel); |
---|
| 1206 | + oe.ctrlPanel.add(objectCommandsPanel); |
---|
1055 | 1207 | oe.ctrlPanel.Return(); |
---|
1056 | 1208 | |
---|
1057 | 1209 | pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons |
---|
.. | .. |
---|
1340 | 1492 | // north.setName("Edit"); |
---|
1341 | 1493 | // north.add(ctrlPanel, BorderLayout.NORTH); |
---|
1342 | 1494 | // objectPanel.add(north); |
---|
1343 | | - objectPanel.add(ctrlPanel); |
---|
| 1495 | + objectPanel.add(editPanel); |
---|
1344 | 1496 | objectPanel.add(infoPanel); |
---|
| 1497 | + objectPanel.add(toolboxPanel); |
---|
1345 | 1498 | |
---|
1346 | 1499 | /* |
---|
1347 | 1500 | aConstraints.gridx = 0; |
---|
.. | .. |
---|
1350 | 1503 | aConstraints.gridy += 1; |
---|
1351 | 1504 | aConstraints.gridwidth = 1; |
---|
1352 | 1505 | mainPanel.add(objectPanel, aConstraints); |
---|
1353 | | - */ |
---|
| 1506 | + */ |
---|
1354 | 1507 | |
---|
1355 | 1508 | scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS, |
---|
1356 | 1509 | VERTICAL_SCROLLBAR_AS_NEEDED, |
---|
.. | .. |
---|
1367 | 1520 | JTabbedPane tabbedPane = new JTabbedPane(); |
---|
1368 | 1521 | tabbedPane.add(scrollpane); |
---|
1369 | 1522 | |
---|
1370 | | - tabbedPane.add(FSPane = new cFileSystemPane(this)); |
---|
1371 | | - |
---|
1372 | | - optionsPanel = new cGridBag().setVertical(true); |
---|
| 1523 | + optionsPanel = new cGridBag().setVertical(false); |
---|
1373 | 1524 | |
---|
1374 | 1525 | optionsPanel.setName("Options"); |
---|
1375 | 1526 | |
---|
.. | .. |
---|
1377 | 1528 | |
---|
1378 | 1529 | tabbedPane.add(optionsPanel); |
---|
1379 | 1530 | |
---|
| 1531 | + tabbedPane.add(FSPane = new cFileSystemPane(this)); |
---|
| 1532 | + |
---|
1380 | 1533 | scenePanel.add(tabbedPane); |
---|
1381 | 1534 | |
---|
1382 | 1535 | /* |
---|
.. | .. |
---|
1469 | 1622 | // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc); |
---|
1470 | 1623 | |
---|
1471 | 1624 | frame.setSize(1280, 860); |
---|
1472 | | - frame.setVisible(true); |
---|
1473 | | - |
---|
| 1625 | + |
---|
1474 | 1626 | cameraView.requestFocusInWindow(); |
---|
1475 | 1627 | |
---|
1476 | 1628 | gridPanel.setDividerLocation(1.0); |
---|
| 1629 | + |
---|
| 1630 | + frame.validate(); |
---|
| 1631 | + |
---|
| 1632 | + frame.setVisible(true); |
---|
1477 | 1633 | |
---|
1478 | 1634 | frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); |
---|
1479 | 1635 | frame.addWindowListener(new WindowAdapter() |
---|
.. | .. |
---|
1560 | 1716 | texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1561 | 1717 | colorSection.add(texture); |
---|
1562 | 1718 | |
---|
1563 | | - cGridBag anisoU = new cGridBag(); |
---|
1564 | | - anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints); |
---|
1565 | | - anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1566 | | - anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1567 | | - colorSection.add(anisoU); |
---|
1568 | | - |
---|
1569 | | - cGridBag anisoV = new cGridBag(); |
---|
1570 | | - anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints); |
---|
1571 | | - anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1572 | | - anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1573 | | - colorSection.add(anisoV); |
---|
1574 | | - |
---|
1575 | | - cGridBag shadowbias = new cGridBag(); |
---|
1576 | | - shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints); |
---|
1577 | | - shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1578 | | - shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1579 | | - colorSection.add(shadowbias); |
---|
1580 | | - |
---|
1581 | 1719 | panel.add(new JSeparator()); |
---|
1582 | 1720 | |
---|
1583 | 1721 | panel.add(colorSection); |
---|
.. | .. |
---|
1627 | 1765 | fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1628 | 1766 | fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1629 | 1767 | diffuseSection.add(fakedepth); |
---|
| 1768 | + |
---|
| 1769 | + cGridBag shadowbias = new cGridBag(); |
---|
| 1770 | + shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints); |
---|
| 1771 | + shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1772 | + shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
| 1773 | + diffuseSection.add(shadowbias); |
---|
1630 | 1774 | |
---|
1631 | 1775 | panel.add(new JSeparator()); |
---|
1632 | 1776 | |
---|
.. | .. |
---|
1678 | 1822 | // aConstraints.gridy += 1; |
---|
1679 | 1823 | // aConstraints.gridwidth = 1; |
---|
1680 | 1824 | |
---|
| 1825 | + cGridBag anisoU = new cGridBag(); |
---|
| 1826 | + anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints); |
---|
| 1827 | + anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1828 | + anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 1829 | + specularSection.add(anisoU); |
---|
| 1830 | + |
---|
| 1831 | + cGridBag anisoV = new cGridBag(); |
---|
| 1832 | + anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints); |
---|
| 1833 | + anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1834 | + anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 1835 | + specularSection.add(anisoV); |
---|
| 1836 | + |
---|
1681 | 1837 | |
---|
1682 | 1838 | panel.add(new JSeparator()); |
---|
1683 | 1839 | |
---|
.. | .. |
---|
1685 | 1841 | |
---|
1686 | 1842 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1687 | 1843 | |
---|
1688 | | - cGridBag globalSection = new cGridBag().setVertical(true); |
---|
| 1844 | + //cGridBag globalSection = new cGridBag().setVertical(true); |
---|
1689 | 1845 | |
---|
1690 | 1846 | cGridBag camera = new cGridBag(); |
---|
1691 | 1847 | camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints); |
---|
1692 | 1848 | cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1693 | 1849 | camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1694 | | - globalSection.add(camera); |
---|
| 1850 | + colorSection.add(camera); |
---|
1695 | 1851 | |
---|
1696 | 1852 | cGridBag ambient = new cGridBag(); |
---|
1697 | 1853 | ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints); |
---|
1698 | 1854 | ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1699 | 1855 | ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1700 | | - globalSection.add(ambient); |
---|
| 1856 | + colorSection.add(ambient); |
---|
1701 | 1857 | |
---|
1702 | 1858 | cGridBag backlit = new cGridBag(); |
---|
1703 | 1859 | backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints); |
---|
1704 | 1860 | backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1705 | 1861 | backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1706 | | - globalSection.add(backlit); |
---|
| 1862 | + colorSection.add(backlit); |
---|
1707 | 1863 | |
---|
1708 | 1864 | cGridBag opacity = new cGridBag(); |
---|
1709 | 1865 | opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints); |
---|
1710 | 1866 | opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1711 | 1867 | opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1712 | | - globalSection.add(opacity); |
---|
| 1868 | + colorSection.add(opacity); |
---|
1713 | 1869 | |
---|
1714 | | - panel.add(new JSeparator()); |
---|
| 1870 | + //panel.add(new JSeparator()); |
---|
1715 | 1871 | |
---|
1716 | | - panel.add(globalSection); |
---|
| 1872 | + //panel.add(globalSection); |
---|
1717 | 1873 | |
---|
1718 | 1874 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1719 | 1875 | |
---|
.. | .. |
---|
2788 | 2944 | |
---|
2789 | 2945 | void SetMaterial(Object3D object) |
---|
2790 | 2946 | { |
---|
| 2947 | + latestObject = object; |
---|
| 2948 | + |
---|
2791 | 2949 | cMaterial mat = object.material; |
---|
2792 | 2950 | |
---|
2793 | 2951 | if (mat == null) |
---|
.. | .. |
---|
2899 | 3057 | // } |
---|
2900 | 3058 | |
---|
2901 | 3059 | /**/ |
---|
2902 | | - if (deselect) |
---|
| 3060 | + if (deselect || child == null) |
---|
2903 | 3061 | { |
---|
2904 | 3062 | //group.deselectAll(); |
---|
2905 | 3063 | //freeze = true; |
---|
2906 | 3064 | GetTree().clearSelection(); |
---|
2907 | 3065 | //freeze = false; |
---|
| 3066 | + |
---|
| 3067 | + if (child == null) |
---|
| 3068 | + { |
---|
| 3069 | + return; |
---|
| 3070 | + } |
---|
2908 | 3071 | } |
---|
2909 | 3072 | |
---|
2910 | 3073 | //group.addSelectee(child); |
---|
.. | .. |
---|
2973 | 3136 | cameraView.ToggleDL(); |
---|
2974 | 3137 | cameraView.repaint(); |
---|
2975 | 3138 | return; |
---|
2976 | | - } else if (event.getSource() == toggleTextureItem) |
---|
| 3139 | + } else if (event.getSource() == toggleTextureItem || event.getSource() == toggleTextureCB) |
---|
2977 | 3140 | { |
---|
2978 | 3141 | cameraView.ToggleTexture(); |
---|
2979 | 3142 | // june 2013 copy.HardTouch(); |
---|
.. | .. |
---|
3012 | 3175 | frame.validate(); |
---|
3013 | 3176 | |
---|
3014 | 3177 | return; |
---|
3015 | | - } else if (event.getSource() == toggleSwitchItem) |
---|
| 3178 | + } else if (event.getSource() == toggleSwitchItem || event.getSource() == toggleSwitchCB) |
---|
3016 | 3179 | { |
---|
3017 | 3180 | cameraView.ToggleSwitch(); |
---|
3018 | 3181 | cameraView.repaint(); |
---|
.. | .. |
---|
3396 | 3559 | |
---|
3397 | 3560 | public void Save() |
---|
3398 | 3561 | { |
---|
| 3562 | + System.err.println("Save"); |
---|
| 3563 | + |
---|
3399 | 3564 | cRadio tab = GetCurrentTab(); |
---|
3400 | 3565 | |
---|
3401 | 3566 | boolean temp = CameraPane.SWITCH; |
---|
.. | .. |
---|
3403 | 3568 | |
---|
3404 | 3569 | copy.ExtractBigData(hashtable); |
---|
3405 | 3570 | |
---|
| 3571 | + byte[] compress = Compress(copy); |
---|
| 3572 | + |
---|
3406 | 3573 | //EditorFrame.m_MainFrame.requestFocusInWindow(); |
---|
3407 | | - tab.graphs[tab.undoindex++] = Compress(copy); |
---|
| 3574 | + tab.graphs[tab.undoindex++] = compress; |
---|
3408 | 3575 | |
---|
3409 | 3576 | copy.RestoreBigData(hashtable); |
---|
3410 | 3577 | |
---|
.. | .. |
---|
3417 | 3584 | tab.graphs[i] = null; |
---|
3418 | 3585 | } |
---|
3419 | 3586 | |
---|
| 3587 | + SetUndoStates(); |
---|
| 3588 | + |
---|
3420 | 3589 | // test save |
---|
3421 | 3590 | if (false) |
---|
3422 | 3591 | { |
---|
.. | .. |
---|
3439 | 3608 | |
---|
3440 | 3609 | void CopyChanged(Object3D obj) |
---|
3441 | 3610 | { |
---|
| 3611 | + SetUndoStates(); |
---|
| 3612 | + |
---|
3442 | 3613 | boolean temp = CameraPane.SWITCH; |
---|
3443 | 3614 | CameraPane.SWITCH = false; |
---|
3444 | 3615 | |
---|
.. | .. |
---|
3478 | 3649 | refreshContents(); |
---|
3479 | 3650 | } |
---|
3480 | 3651 | |
---|
| 3652 | + cButton undoButton; |
---|
| 3653 | + cButton redoButton; |
---|
| 3654 | + |
---|
| 3655 | + void SetUndoStates() |
---|
| 3656 | + { |
---|
| 3657 | + cRadio tab = GetCurrentTab(); |
---|
| 3658 | + |
---|
| 3659 | + undoButton.setEnabled(tab.undoindex > 0); |
---|
| 3660 | + redoButton.setEnabled(tab.graphs[tab.undoindex + 1] != null); |
---|
| 3661 | + } |
---|
| 3662 | + |
---|
3481 | 3663 | public void Undo() |
---|
3482 | 3664 | { |
---|
| 3665 | + System.err.println("Undo"); |
---|
| 3666 | + |
---|
3483 | 3667 | cRadio tab = GetCurrentTab(); |
---|
3484 | 3668 | |
---|
3485 | 3669 | if (tab.undoindex == 0) |
---|
.. | .. |
---|
3663 | 3847 | assert false; |
---|
3664 | 3848 | } |
---|
3665 | 3849 | |
---|
3666 | | - void EditSelection() |
---|
| 3850 | + void EditSelection(boolean newWindow) |
---|
3667 | 3851 | { |
---|
3668 | 3852 | } |
---|
3669 | 3853 | |
---|
.. | .. |
---|
4158 | 4342 | |
---|
4159 | 4343 | void makeSomething(Object3D thing, boolean resetmodel) // deselect) |
---|
4160 | 4344 | { |
---|
4161 | | - Save(); |
---|
| 4345 | + if (Globals.SAVEONMAKE) // && resetmodel) |
---|
| 4346 | + Save(); |
---|
4162 | 4347 | //Tween.set(thing, 0).target(1).start(tweenManager); |
---|
4163 | 4348 | //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager); |
---|
4164 | 4349 | // if (thing instanceof GenericJointDemo) |
---|
.. | .. |
---|
4245 | 4430 | { |
---|
4246 | 4431 | ResetModel(); |
---|
4247 | 4432 | Select(thing.GetTreePath(), true, false); // unselect... false); |
---|
| 4433 | + |
---|
| 4434 | + if (thing.Size() == 0) |
---|
| 4435 | + { |
---|
| 4436 | + //EditSelection(false); |
---|
| 4437 | + } |
---|
| 4438 | + |
---|
4248 | 4439 | refreshContents(); |
---|
4249 | 4440 | } |
---|
4250 | 4441 | |
---|
.. | .. |
---|
4467 | 4658 | |
---|
4468 | 4659 | if (readobj != null) |
---|
4469 | 4660 | { |
---|
| 4661 | + if (Globals.SAVEONMAKE) |
---|
4470 | 4662 | Save(); |
---|
4471 | 4663 | try |
---|
4472 | 4664 | { |
---|
.. | .. |
---|
4645 | 4837 | String filename = browser.getFile(); |
---|
4646 | 4838 | if (filename != null && filename.length() > 0) |
---|
4647 | 4839 | { |
---|
| 4840 | + if (!filename.endsWith(".gfd")) |
---|
| 4841 | + filename += ".gfd"; |
---|
4648 | 4842 | lastname = browser.getDirectory() + filename; |
---|
4649 | 4843 | save(); |
---|
4650 | 4844 | } |
---|
.. | .. |
---|
4838 | 5032 | CheckboxMenuItem togglePaintItem; |
---|
4839 | 5033 | JSplitPane mainPanel; |
---|
4840 | 5034 | JScrollPane scrollpane; |
---|
| 5035 | + |
---|
4841 | 5036 | JPanel toolbarPanel; |
---|
| 5037 | + |
---|
4842 | 5038 | cGridBag treePanel; |
---|
| 5039 | + |
---|
4843 | 5040 | JPanel radioPanel; |
---|
4844 | 5041 | ButtonGroup buttonGroup; |
---|
4845 | | - cGridBag ctrlPanel; |
---|
| 5042 | + |
---|
| 5043 | + cGridBag toolboxPanel; |
---|
4846 | 5044 | cGridBag materialPanel; |
---|
| 5045 | + cGridBag ctrlPanel; |
---|
| 5046 | + |
---|
4847 | 5047 | JScrollPane infoPanel; |
---|
| 5048 | + |
---|
4848 | 5049 | cGridBag optionsPanel; |
---|
| 5050 | + |
---|
4849 | 5051 | JTabbedPane objectPanel; |
---|
| 5052 | + boolean materialFlushed; |
---|
| 5053 | + Object3D latestObject; |
---|
| 5054 | + |
---|
4850 | 5055 | cGridBag XYZPanel; |
---|
| 5056 | + |
---|
4851 | 5057 | JSplitPane gridPanel; |
---|
4852 | 5058 | JSplitPane bigPanel; |
---|
| 5059 | + |
---|
4853 | 5060 | cGridBag bigThree; |
---|
4854 | 5061 | cGridBag scenePanel; |
---|
4855 | 5062 | cGridBag centralPanel; |
---|
.. | .. |
---|
4964 | 5171 | cNumberSlider fogField; |
---|
4965 | 5172 | JLabel opacityPowerLabel; |
---|
4966 | 5173 | cNumberSlider opacityPowerField; |
---|
4967 | | - JTree jTree; |
---|
| 5174 | + cTree jTree; |
---|
4968 | 5175 | //ObjectUI parent; |
---|
4969 | 5176 | |
---|
4970 | 5177 | cNumberSlider normalpushField; |
---|