.. | .. |
---|
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 | |
---|
.. | .. |
---|
35 | 39 | |
---|
36 | 40 | GroupEditor callee; |
---|
37 | 41 | JFrame frame; |
---|
| 42 | + |
---|
| 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 | + } |
---|
38 | 103 | |
---|
39 | 104 | // SCRIPT |
---|
40 | 105 | |
---|
.. | .. |
---|
145 | 210 | |
---|
146 | 211 | objEditor.ctrlPanel.remove(namePanel); |
---|
147 | 212 | |
---|
148 | | - if (!GroupEditor.allparams) |
---|
| 213 | + if (!allparams) |
---|
149 | 214 | return; |
---|
150 | 215 | |
---|
151 | 216 | // objEditor.ctrlPanel.remove(liveCB); |
---|
.. | .. |
---|
168 | 233 | // objEditor.ctrlPanel.remove(remarkButton); |
---|
169 | 234 | |
---|
170 | 235 | objEditor.ctrlPanel.remove(setupPanel); |
---|
171 | | - objEditor.ctrlPanel.remove(commandsPanel); |
---|
| 236 | + objEditor.ctrlPanel.remove(setupPanel2); |
---|
| 237 | + objEditor.ctrlPanel.remove(objectCommandsPanel); |
---|
172 | 238 | objEditor.ctrlPanel.remove(pushPanel); |
---|
173 | 239 | //objEditor.ctrlPanel.remove(fillPanel); |
---|
174 | 240 | |
---|
.. | .. |
---|
243 | 309 | //localCopy.parent = null; |
---|
244 | 310 | |
---|
245 | 311 | frame = new JFrame(); |
---|
| 312 | + frame.setUndecorated(true); |
---|
246 | 313 | objEditor = this; |
---|
247 | 314 | this.callee = callee; |
---|
248 | 315 | |
---|
.. | .. |
---|
272 | 339 | { |
---|
273 | 340 | return frame.action(event, obj); |
---|
274 | 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>(); |
---|
275 | 347 | |
---|
276 | 348 | void SetupMenu() |
---|
277 | 349 | { |
---|
.. | .. |
---|
319 | 391 | closeItem.addActionListener(this); |
---|
320 | 392 | |
---|
321 | 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 | + |
---|
322 | 420 | toolbarPanel = new JPanel(); |
---|
323 | 421 | toolbarPanel.setName("Toolbar"); |
---|
324 | 422 | treePanel = new cGridBag(); |
---|
325 | 423 | treePanel.setName("Tree"); |
---|
| 424 | + |
---|
| 425 | + editPanel = new cGridBag().setVertical(true); |
---|
| 426 | + editPanel.setName("Edit"); |
---|
| 427 | + |
---|
326 | 428 | ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout()); |
---|
327 | | - 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 | + |
---|
328 | 437 | materialPanel = new cGridBag().setVertical(true); |
---|
329 | 438 | materialPanel.setName("Material"); |
---|
| 439 | + |
---|
330 | 440 | /*JTextPane*/ |
---|
331 | 441 | infoarea = createTextPane(); |
---|
332 | 442 | doc = infoarea.getStyledDocument(); |
---|
.. | .. |
---|
351 | 461 | mainPanel.setDividerSize(9); |
---|
352 | 462 | mainPanel.setDividerLocation(0.5); //1.0); |
---|
353 | 463 | mainPanel.setResizeWeight(0.5); |
---|
354 | | - |
---|
| 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 | + |
---|
355 | 472 | //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5)); |
---|
356 | 473 | //mainPanel.setLayout(new GridBagLayout()); |
---|
357 | 474 | toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); |
---|
.. | .. |
---|
419 | 536 | e.printStackTrace(); |
---|
420 | 537 | } |
---|
421 | 538 | |
---|
422 | | - String selection = infoarea.getText(); |
---|
423 | | - java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection); |
---|
424 | | - java.awt.datatransfer.Clipboard clipboard = |
---|
425 | | - Toolkit.getDefaultToolkit().getSystemClipboard(); |
---|
| 539 | +// String selection = infoarea.getText(); |
---|
| 540 | +// java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection); |
---|
| 541 | +// java.awt.datatransfer.Clipboard clipboard = |
---|
| 542 | +// Toolkit.getDefaultToolkit().getSystemClipboard(); |
---|
426 | 543 | //clipboard.setContents(data, data); |
---|
427 | 544 | } |
---|
428 | 545 | |
---|
.. | .. |
---|
582 | 699 | } |
---|
583 | 700 | } |
---|
584 | 701 | |
---|
| 702 | +static GraphicsDevice device = GraphicsEnvironment |
---|
| 703 | + .getLocalGraphicsEnvironment().getScreenDevices()[0]; |
---|
| 704 | + |
---|
| 705 | + Rectangle keeprect; |
---|
| 706 | + cRadio radio; |
---|
| 707 | + |
---|
| 708 | +cButton keepButton; |
---|
| 709 | + cButton twoButton; // Full 3D |
---|
| 710 | + cButton sixButton; |
---|
| 711 | + cButton threeButton; |
---|
| 712 | + cButton sevenButton; |
---|
| 713 | + cButton fourButton; // full panel |
---|
| 714 | + cButton oneButton; // full XYZ |
---|
| 715 | + //cButton currentLayout; |
---|
| 716 | + |
---|
| 717 | + boolean maximized; |
---|
| 718 | + |
---|
| 719 | + cButton fullscreenLayout; |
---|
| 720 | + |
---|
| 721 | + void Minimize() |
---|
| 722 | + { |
---|
| 723 | + frame.setState(Frame.ICONIFIED); |
---|
| 724 | + } |
---|
| 725 | + |
---|
| 726 | + void Maximize() |
---|
| 727 | + { |
---|
| 728 | + if (maximized) |
---|
| 729 | + { |
---|
| 730 | + frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height); |
---|
| 731 | + } |
---|
| 732 | + else |
---|
| 733 | + { |
---|
| 734 | + keeprect = frame.getBounds(); |
---|
| 735 | + Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); |
---|
| 736 | + Dimension rect2 = frame.getToolkit().getScreenSize(); |
---|
| 737 | + frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height); |
---|
| 738 | +// frame.setState(Frame.MAXIMIZED_BOTH); |
---|
| 739 | + } |
---|
| 740 | + |
---|
| 741 | + maximized ^= true; |
---|
| 742 | + } |
---|
| 743 | + |
---|
585 | 744 | void ToggleFullScreen() |
---|
586 | 745 | { |
---|
587 | | - if (CameraPane.FULLSCREEN) |
---|
| 746 | + cameraView.ToggleFullScreen(); |
---|
| 747 | + |
---|
| 748 | + if (!CameraPane.FULLSCREEN) |
---|
588 | 749 | { |
---|
589 | | - frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
590 | | - framePanel.add(bigThree); |
---|
591 | | - frame.getContentPane().add(/*"Center",*/framePanel); |
---|
| 750 | + device.setFullScreenWindow(null); |
---|
| 751 | + //frame.setVisible(false); |
---|
| 752 | +// frame.removeNotify(); |
---|
| 753 | +// frame.setUndecorated(false); |
---|
| 754 | +// frame.addNotify(); |
---|
| 755 | + //frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height); |
---|
| 756 | + |
---|
| 757 | +// X frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
| 758 | +// X framePanel.add(bigThree); |
---|
| 759 | +// X frame.getContentPane().add(/*"Center",*/framePanel); |
---|
| 760 | + framePanel.setDividerLocation(1); |
---|
| 761 | + |
---|
| 762 | + //frame.setVisible(true); |
---|
| 763 | + radio.layout = keepButton; |
---|
| 764 | + //theFrame = null; |
---|
| 765 | + keepButton = null; |
---|
| 766 | + radio.layout.doClick(); |
---|
| 767 | + |
---|
592 | 768 | } else |
---|
593 | 769 | { |
---|
594 | | - frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
595 | | - framePanel.remove(bigThree); |
---|
596 | | - frame.getContentPane().add(/*"Center",*/bigThree); |
---|
| 770 | + keepButton = radio.layout; |
---|
| 771 | + //keeprect = frame.getBounds(); |
---|
| 772 | +// frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width, |
---|
| 773 | +// frame.getToolkit().getScreenSize().height); |
---|
| 774 | + //frame.setVisible(false); |
---|
| 775 | + device.setFullScreenWindow(frame); |
---|
| 776 | +// frame.removeNotify(); |
---|
| 777 | +// frame.setUndecorated(true); |
---|
| 778 | +// frame.addNotify(); |
---|
| 779 | +// X frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
| 780 | +// X framePanel.remove(bigThree); |
---|
| 781 | +// X frame.getContentPane().add(/*"Center",*/bigThree); |
---|
| 782 | + framePanel.setDividerLocation(0); |
---|
| 783 | + |
---|
| 784 | + radio.layout = fullscreenLayout; |
---|
| 785 | + radio.layout.doClick(); |
---|
| 786 | + //frame.setVisible(true); |
---|
597 | 787 | } |
---|
598 | | - cameraView.ToggleFullScreen(); |
---|
599 | 788 | } |
---|
600 | 789 | |
---|
601 | 790 | private JTextPane createTextPane() |
---|
.. | .. |
---|
736 | 925 | JCheckBox speedupCB; |
---|
737 | 926 | JCheckBox rewindCB; |
---|
738 | 927 | JCheckBox flipVCB; |
---|
| 928 | + |
---|
| 929 | + cCheckBox toggleTextureCB; |
---|
| 930 | + cCheckBox toggleSwitchCB; |
---|
| 931 | + |
---|
739 | 932 | JComboBox texresMenu; |
---|
| 933 | + |
---|
740 | 934 | JButton resetButton; |
---|
741 | 935 | JButton stepButton; |
---|
742 | 936 | JButton stepAllButton; |
---|
.. | .. |
---|
745 | 939 | JButton fasterButton; |
---|
746 | 940 | JButton remarkButton; |
---|
747 | 941 | |
---|
| 942 | + cGridBag editPanel; |
---|
| 943 | + cGridBag editCommandsPanel; |
---|
| 944 | + |
---|
748 | 945 | cGridBag namePanel; |
---|
749 | 946 | cGridBag setupPanel; |
---|
750 | | - cGridBag commandsPanel; |
---|
| 947 | + cGridBag setupPanel2; |
---|
| 948 | + cGridBag objectCommandsPanel; |
---|
751 | 949 | cGridBag pushPanel; |
---|
752 | 950 | cGridBag fillPanel; |
---|
753 | 951 | |
---|
.. | .. |
---|
924 | 1122 | |
---|
925 | 1123 | oe.ctrlPanel.Return(); |
---|
926 | 1124 | |
---|
927 | | - if (!GroupEditor.allparams) |
---|
| 1125 | + if (!allparams) |
---|
928 | 1126 | return; |
---|
929 | 1127 | |
---|
930 | 1128 | setupPanel = new cGridBag().setVertical(false); |
---|
.. | .. |
---|
937 | 1135 | hideCB = AddCheckBox(setupPanel, "Hide", copy.hide); |
---|
938 | 1136 | hideCB.setToolTipText("Hide object"); |
---|
939 | 1137 | markCB = AddCheckBox(setupPanel, "Mark", copy.marked); |
---|
940 | | - markCB.setToolTipText("Set the animation target transform"); |
---|
| 1138 | + markCB.setToolTipText("As animation target transform"); |
---|
941 | 1139 | |
---|
942 | | - rewindCB = AddCheckBox(setupPanel, "Rewind", copy.rewind); |
---|
| 1140 | + setupPanel2 = new cGridBag().setVertical(false); |
---|
| 1141 | + |
---|
| 1142 | + rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind); |
---|
943 | 1143 | rewindCB.setToolTipText("Rewind animation"); |
---|
944 | 1144 | |
---|
945 | | - randomCB = AddCheckBox(setupPanel, "Random", copy.random); |
---|
946 | | - randomCB.setToolTipText("Option for switch node"); |
---|
| 1145 | + randomCB = AddCheckBox(setupPanel2, "Rand", copy.random); |
---|
| 1146 | + randomCB.setToolTipText("Randomly Rewind (or Go back and forth)"); |
---|
947 | 1147 | |
---|
948 | 1148 | if (Globals.ADVANCED) |
---|
949 | 1149 | { |
---|
950 | | - link2masterCB = AddCheckBox(setupPanel, "Support", copy.link2master); |
---|
| 1150 | + link2masterCB = AddCheckBox(setupPanel2, "Supp", copy.link2master); |
---|
951 | 1151 | link2masterCB.setToolTipText("Attach to support"); |
---|
952 | | - speedupCB = AddCheckBox(setupPanel, "Speed", copy.speedup); |
---|
| 1152 | + speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup); |
---|
953 | 1153 | speedupCB.setToolTipText("Option motion capture"); |
---|
954 | 1154 | } |
---|
955 | 1155 | |
---|
956 | 1156 | oe.ctrlPanel.add(setupPanel); |
---|
957 | 1157 | oe.ctrlPanel.Return(); |
---|
| 1158 | + oe.ctrlPanel.add(setupPanel2); |
---|
| 1159 | + oe.ctrlPanel.Return(); |
---|
958 | 1160 | |
---|
959 | | - commandsPanel = new cGridBag().setVertical(false); |
---|
| 1161 | + objectCommandsPanel = new cGridBag().setVertical(false); |
---|
960 | 1162 | |
---|
961 | | - resetButton = AddButton(commandsPanel, "Reset"); |
---|
| 1163 | + resetButton = AddButton(objectCommandsPanel, "Reset"); |
---|
962 | 1164 | resetButton.setToolTipText("Jump to frame zero"); |
---|
963 | | - stepButton = AddButton(commandsPanel, "Step"); |
---|
| 1165 | + stepButton = AddButton(objectCommandsPanel, "Step"); |
---|
964 | 1166 | stepButton.setToolTipText("Step one frame"); |
---|
965 | 1167 | // resetAllButton = AddButton(oe, "Reset All"); |
---|
966 | 1168 | // stepAllButton = AddButton(oe, "Step All"); |
---|
967 | 1169 | // Return(); |
---|
968 | | - slowerButton = AddButton(commandsPanel, "Slow"); |
---|
| 1170 | + slowerButton = AddButton(objectCommandsPanel, "Slow"); |
---|
969 | 1171 | slowerButton.setToolTipText("Decrease animation speed"); |
---|
970 | | - fasterButton = AddButton(commandsPanel, "Fast"); |
---|
| 1172 | + fasterButton = AddButton(objectCommandsPanel, "Fast"); |
---|
971 | 1173 | fasterButton.setToolTipText("Increase animation speed"); |
---|
972 | | - remarkButton = AddButton(commandsPanel, "Remark"); |
---|
| 1174 | + remarkButton = AddButton(objectCommandsPanel, "Remark"); |
---|
973 | 1175 | remarkButton.setToolTipText("Set the current transform as the target"); |
---|
974 | 1176 | |
---|
975 | | - oe.ctrlPanel.add(commandsPanel); |
---|
| 1177 | + oe.ctrlPanel.add(objectCommandsPanel); |
---|
976 | 1178 | oe.ctrlPanel.Return(); |
---|
977 | 1179 | |
---|
978 | 1180 | pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons |
---|
.. | .. |
---|
1178 | 1380 | //worldPanel.setName("World"); |
---|
1179 | 1381 | centralPanel = new cGridBag(); |
---|
1180 | 1382 | centralPanel.preferredWidth = 20; |
---|
1181 | | - timelinePanel = new JPanel(new BorderLayout()); |
---|
1182 | | - timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel); |
---|
| 1383 | + |
---|
| 1384 | + if (Globals.ADVANCED) |
---|
| 1385 | + { |
---|
| 1386 | + timelinePanel = new JPanel(new BorderLayout()); |
---|
| 1387 | + timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel); |
---|
1183 | 1388 | |
---|
1184 | 1389 | cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel); |
---|
1185 | 1390 | cameraPanel.setContinuousLayout(true); |
---|
.. | .. |
---|
1188 | 1393 | // cameraPanel.setDividerSize(9); |
---|
1189 | 1394 | cameraPanel.setResizeWeight(1.0); |
---|
1190 | 1395 | |
---|
| 1396 | + } |
---|
| 1397 | + |
---|
1191 | 1398 | centralPanel.add(cameraView); |
---|
| 1399 | + centralPanel.setFocusable(true); |
---|
1192 | 1400 | //frame.setJMenuBar(timelineMenubar); |
---|
1193 | 1401 | //centralPanel.add(timelinePanel); |
---|
1194 | 1402 | |
---|
.. | .. |
---|
1255 | 1463 | // north.setName("Edit"); |
---|
1256 | 1464 | // north.add(ctrlPanel, BorderLayout.NORTH); |
---|
1257 | 1465 | // objectPanel.add(north); |
---|
1258 | | - objectPanel.add(ctrlPanel); |
---|
| 1466 | + objectPanel.add(editPanel); |
---|
1259 | 1467 | objectPanel.add(infoPanel); |
---|
| 1468 | + objectPanel.add(toolboxPanel); |
---|
1260 | 1469 | |
---|
1261 | 1470 | /* |
---|
1262 | 1471 | aConstraints.gridx = 0; |
---|
.. | .. |
---|
1265 | 1474 | aConstraints.gridy += 1; |
---|
1266 | 1475 | aConstraints.gridwidth = 1; |
---|
1267 | 1476 | mainPanel.add(objectPanel, aConstraints); |
---|
1268 | | - */ |
---|
| 1477 | + */ |
---|
1269 | 1478 | |
---|
1270 | 1479 | scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS, |
---|
1271 | 1480 | VERTICAL_SCROLLBAR_AS_NEEDED, |
---|
.. | .. |
---|
1282 | 1491 | JTabbedPane tabbedPane = new JTabbedPane(); |
---|
1283 | 1492 | tabbedPane.add(scrollpane); |
---|
1284 | 1493 | |
---|
1285 | | - tabbedPane.add(FSPane = new cFileSystemPane(this)); |
---|
1286 | | - |
---|
1287 | | - optionsPanel = new cGridBag().setVertical(true); |
---|
| 1494 | + optionsPanel = new cGridBag().setVertical(false); |
---|
1288 | 1495 | |
---|
1289 | 1496 | optionsPanel.setName("Options"); |
---|
1290 | 1497 | |
---|
.. | .. |
---|
1292 | 1499 | |
---|
1293 | 1500 | tabbedPane.add(optionsPanel); |
---|
1294 | 1501 | |
---|
| 1502 | + tabbedPane.add(FSPane = new cFileSystemPane(this)); |
---|
| 1503 | + |
---|
1295 | 1504 | scenePanel.add(tabbedPane); |
---|
1296 | 1505 | |
---|
1297 | 1506 | /* |
---|
.. | .. |
---|
1384 | 1593 | // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc); |
---|
1385 | 1594 | |
---|
1386 | 1595 | frame.setSize(1280, 860); |
---|
| 1596 | + |
---|
| 1597 | + frame.validate(); |
---|
1387 | 1598 | frame.setVisible(true); |
---|
1388 | 1599 | |
---|
| 1600 | + cameraView.requestFocusInWindow(); |
---|
| 1601 | + |
---|
1389 | 1602 | gridPanel.setDividerLocation(1.0); |
---|
1390 | 1603 | |
---|
1391 | 1604 | frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); |
---|
.. | .. |
---|
2701 | 2914 | |
---|
2702 | 2915 | void SetMaterial(Object3D object) |
---|
2703 | 2916 | { |
---|
| 2917 | + latestObject = object; |
---|
| 2918 | + |
---|
2704 | 2919 | cMaterial mat = object.material; |
---|
2705 | 2920 | |
---|
2706 | 2921 | if (mat == null) |
---|
.. | .. |
---|
2812 | 3027 | // } |
---|
2813 | 3028 | |
---|
2814 | 3029 | /**/ |
---|
2815 | | - if (deselect) |
---|
| 3030 | + if (deselect || child == null) |
---|
2816 | 3031 | { |
---|
2817 | 3032 | //group.deselectAll(); |
---|
2818 | 3033 | //freeze = true; |
---|
2819 | 3034 | GetTree().clearSelection(); |
---|
2820 | 3035 | //freeze = false; |
---|
| 3036 | + |
---|
| 3037 | + if (child == null) |
---|
| 3038 | + { |
---|
| 3039 | + return; |
---|
| 3040 | + } |
---|
2821 | 3041 | } |
---|
2822 | 3042 | |
---|
2823 | 3043 | //group.addSelectee(child); |
---|
.. | .. |
---|
2886 | 3106 | cameraView.ToggleDL(); |
---|
2887 | 3107 | cameraView.repaint(); |
---|
2888 | 3108 | return; |
---|
2889 | | - } else if (event.getSource() == toggleTextureItem) |
---|
| 3109 | + } else if (event.getSource() == toggleTextureItem || event.getSource() == toggleTextureCB) |
---|
2890 | 3110 | { |
---|
2891 | 3111 | cameraView.ToggleTexture(); |
---|
2892 | 3112 | // june 2013 copy.HardTouch(); |
---|
.. | .. |
---|
2925 | 3145 | frame.validate(); |
---|
2926 | 3146 | |
---|
2927 | 3147 | return; |
---|
2928 | | - } else if (event.getSource() == toggleSwitchItem) |
---|
| 3148 | + } else if (event.getSource() == toggleSwitchItem || event.getSource() == toggleSwitchCB) |
---|
2929 | 3149 | { |
---|
2930 | 3150 | cameraView.ToggleSwitch(); |
---|
2931 | 3151 | cameraView.repaint(); |
---|
.. | .. |
---|
3309 | 3529 | |
---|
3310 | 3530 | public void Save() |
---|
3311 | 3531 | { |
---|
| 3532 | + System.err.println("Save"); |
---|
| 3533 | + |
---|
3312 | 3534 | cRadio tab = GetCurrentTab(); |
---|
3313 | 3535 | |
---|
3314 | 3536 | boolean temp = CameraPane.SWITCH; |
---|
.. | .. |
---|
3330 | 3552 | tab.graphs[i] = null; |
---|
3331 | 3553 | } |
---|
3332 | 3554 | |
---|
| 3555 | + SetUndoStates(); |
---|
| 3556 | + |
---|
3333 | 3557 | // test save |
---|
3334 | 3558 | if (false) |
---|
3335 | 3559 | { |
---|
.. | .. |
---|
3352 | 3576 | |
---|
3353 | 3577 | void CopyChanged(Object3D obj) |
---|
3354 | 3578 | { |
---|
| 3579 | + SetUndoStates(); |
---|
| 3580 | + |
---|
3355 | 3581 | boolean temp = CameraPane.SWITCH; |
---|
3356 | 3582 | CameraPane.SWITCH = false; |
---|
3357 | 3583 | |
---|
.. | .. |
---|
3391 | 3617 | refreshContents(); |
---|
3392 | 3618 | } |
---|
3393 | 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); |
---|
| 3629 | + } |
---|
| 3630 | + |
---|
3394 | 3631 | public void Undo() |
---|
3395 | 3632 | { |
---|
| 3633 | + System.err.println("Undo"); |
---|
| 3634 | + |
---|
3396 | 3635 | cRadio tab = GetCurrentTab(); |
---|
3397 | 3636 | |
---|
3398 | 3637 | if (tab.undoindex == 0) |
---|
.. | .. |
---|
3576 | 3815 | assert false; |
---|
3577 | 3816 | } |
---|
3578 | 3817 | |
---|
3579 | | - void EditSelection() |
---|
| 3818 | + void EditSelection(boolean newWindow) |
---|
3580 | 3819 | { |
---|
3581 | 3820 | } |
---|
3582 | 3821 | |
---|
.. | .. |
---|
4071 | 4310 | |
---|
4072 | 4311 | void makeSomething(Object3D thing, boolean resetmodel) // deselect) |
---|
4073 | 4312 | { |
---|
4074 | | - Save(); |
---|
| 4313 | + if (Globals.SAVEONMAKE) // && resetmodel) |
---|
| 4314 | + Save(); |
---|
4075 | 4315 | //Tween.set(thing, 0).target(1).start(tweenManager); |
---|
4076 | 4316 | //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager); |
---|
4077 | 4317 | // if (thing instanceof GenericJointDemo) |
---|
.. | .. |
---|
4158 | 4398 | { |
---|
4159 | 4399 | ResetModel(); |
---|
4160 | 4400 | Select(thing.GetTreePath(), true, false); // unselect... false); |
---|
| 4401 | + |
---|
| 4402 | + if (thing.Size() == 0) |
---|
| 4403 | + { |
---|
| 4404 | + //EditSelection(false); |
---|
| 4405 | + } |
---|
| 4406 | + |
---|
4161 | 4407 | refreshContents(); |
---|
4162 | 4408 | } |
---|
4163 | 4409 | |
---|
.. | .. |
---|
4295 | 4541 | |
---|
4296 | 4542 | try |
---|
4297 | 4543 | { |
---|
| 4544 | + // Try compressed version first. |
---|
4298 | 4545 | java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
4299 | 4546 | java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream); |
---|
4300 | 4547 | java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream); |
---|
.. | .. |
---|
4364 | 4611 | |
---|
4365 | 4612 | void LoadIt(Object obj) |
---|
4366 | 4613 | { |
---|
| 4614 | + if (obj == null) |
---|
| 4615 | + { |
---|
| 4616 | + // Invalid file |
---|
| 4617 | + return; |
---|
| 4618 | + } |
---|
| 4619 | + |
---|
4367 | 4620 | System.out.println("Loaded " + obj); |
---|
4368 | 4621 | //new Exception().printStackTrace(); |
---|
4369 | 4622 | Object3D readobj = (Object3D) obj; |
---|
.. | .. |
---|
4373 | 4626 | |
---|
4374 | 4627 | if (readobj != null) |
---|
4375 | 4628 | { |
---|
| 4629 | + if (Globals.SAVEONMAKE) |
---|
4376 | 4630 | Save(); |
---|
4377 | 4631 | try |
---|
4378 | 4632 | { |
---|
.. | .. |
---|
4551 | 4805 | String filename = browser.getFile(); |
---|
4552 | 4806 | if (filename != null && filename.length() > 0) |
---|
4553 | 4807 | { |
---|
| 4808 | + if (!filename.endsWith(".gfd")) |
---|
| 4809 | + filename += ".gfd"; |
---|
4554 | 4810 | lastname = browser.getDirectory() + filename; |
---|
4555 | 4811 | save(); |
---|
4556 | 4812 | } |
---|
.. | .. |
---|
4744 | 5000 | CheckboxMenuItem togglePaintItem; |
---|
4745 | 5001 | JSplitPane mainPanel; |
---|
4746 | 5002 | JScrollPane scrollpane; |
---|
| 5003 | + |
---|
4747 | 5004 | JPanel toolbarPanel; |
---|
| 5005 | + |
---|
4748 | 5006 | cGridBag treePanel; |
---|
| 5007 | + |
---|
4749 | 5008 | JPanel radioPanel; |
---|
4750 | 5009 | ButtonGroup buttonGroup; |
---|
4751 | | - cGridBag ctrlPanel; |
---|
| 5010 | + |
---|
| 5011 | + cGridBag toolboxPanel; |
---|
4752 | 5012 | cGridBag materialPanel; |
---|
| 5013 | + cGridBag ctrlPanel; |
---|
| 5014 | + |
---|
4753 | 5015 | JScrollPane infoPanel; |
---|
| 5016 | + |
---|
4754 | 5017 | cGridBag optionsPanel; |
---|
| 5018 | + |
---|
4755 | 5019 | JTabbedPane objectPanel; |
---|
| 5020 | + boolean materialFlushed; |
---|
| 5021 | + Object3D latestObject; |
---|
| 5022 | + |
---|
4756 | 5023 | cGridBag XYZPanel; |
---|
| 5024 | + |
---|
4757 | 5025 | JSplitPane gridPanel; |
---|
4758 | 5026 | JSplitPane bigPanel; |
---|
| 5027 | + |
---|
4759 | 5028 | cGridBag bigThree; |
---|
4760 | 5029 | cGridBag scenePanel; |
---|
4761 | 5030 | cGridBag centralPanel; |
---|
.. | .. |
---|
4870 | 5139 | cNumberSlider fogField; |
---|
4871 | 5140 | JLabel opacityPowerLabel; |
---|
4872 | 5141 | cNumberSlider opacityPowerField; |
---|
4873 | | - JTree jTree; |
---|
| 5142 | + cTree jTree; |
---|
4874 | 5143 | //ObjectUI parent; |
---|
4875 | 5144 | |
---|
4876 | 5145 | cNumberSlider normalpushField; |
---|