.. | .. |
---|
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); |
---|
.. | .. |
---|
169 | 234 | |
---|
170 | 235 | objEditor.ctrlPanel.remove(setupPanel); |
---|
171 | 236 | objEditor.ctrlPanel.remove(setupPanel2); |
---|
172 | | - objEditor.ctrlPanel.remove(commandsPanel); |
---|
| 237 | + objEditor.ctrlPanel.remove(objectCommandsPanel); |
---|
173 | 238 | objEditor.ctrlPanel.remove(pushPanel); |
---|
174 | 239 | //objEditor.ctrlPanel.remove(fillPanel); |
---|
175 | 240 | |
---|
.. | .. |
---|
244 | 309 | //localCopy.parent = null; |
---|
245 | 310 | |
---|
246 | 311 | frame = new JFrame(); |
---|
| 312 | + frame.setUndecorated(true); |
---|
247 | 313 | objEditor = this; |
---|
248 | 314 | this.callee = callee; |
---|
249 | 315 | |
---|
.. | .. |
---|
273 | 339 | { |
---|
274 | 340 | return frame.action(event, obj); |
---|
275 | 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>(); |
---|
276 | 347 | |
---|
277 | 348 | void SetupMenu() |
---|
278 | 349 | { |
---|
.. | .. |
---|
320 | 391 | closeItem.addActionListener(this); |
---|
321 | 392 | |
---|
322 | 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 | + |
---|
323 | 420 | toolbarPanel = new JPanel(); |
---|
324 | 421 | toolbarPanel.setName("Toolbar"); |
---|
325 | 422 | treePanel = new cGridBag(); |
---|
326 | 423 | treePanel.setName("Tree"); |
---|
| 424 | + |
---|
| 425 | + editPanel = new cGridBag().setVertical(true); |
---|
| 426 | + editPanel.setName("Edit"); |
---|
| 427 | + |
---|
327 | 428 | ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout()); |
---|
328 | | - 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 | + |
---|
329 | 437 | materialPanel = new cGridBag().setVertical(true); |
---|
330 | 438 | materialPanel.setName("Material"); |
---|
| 439 | + |
---|
331 | 440 | /*JTextPane*/ |
---|
332 | 441 | infoarea = createTextPane(); |
---|
333 | 442 | doc = infoarea.getStyledDocument(); |
---|
.. | .. |
---|
352 | 461 | mainPanel.setDividerSize(9); |
---|
353 | 462 | mainPanel.setDividerLocation(0.5); //1.0); |
---|
354 | 463 | mainPanel.setResizeWeight(0.5); |
---|
355 | | - |
---|
| 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 | + |
---|
356 | 472 | //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5)); |
---|
357 | 473 | //mainPanel.setLayout(new GridBagLayout()); |
---|
358 | 474 | toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); |
---|
.. | .. |
---|
583 | 699 | } |
---|
584 | 700 | } |
---|
585 | 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 | + |
---|
586 | 744 | void ToggleFullScreen() |
---|
587 | 745 | { |
---|
588 | | - if (CameraPane.FULLSCREEN) |
---|
| 746 | + cameraView.ToggleFullScreen(); |
---|
| 747 | + |
---|
| 748 | + if (!CameraPane.FULLSCREEN) |
---|
589 | 749 | { |
---|
590 | | - frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
591 | | - framePanel.add(bigThree); |
---|
592 | | - 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 | + |
---|
593 | 768 | } else |
---|
594 | 769 | { |
---|
595 | | - frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
596 | | - framePanel.remove(bigThree); |
---|
597 | | - 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); |
---|
598 | 787 | } |
---|
599 | | - cameraView.ToggleFullScreen(); |
---|
600 | 788 | } |
---|
601 | 789 | |
---|
602 | 790 | private JTextPane createTextPane() |
---|
.. | .. |
---|
737 | 925 | JCheckBox speedupCB; |
---|
738 | 926 | JCheckBox rewindCB; |
---|
739 | 927 | JCheckBox flipVCB; |
---|
| 928 | + |
---|
| 929 | + cCheckBox toggleTextureCB; |
---|
| 930 | + cCheckBox toggleSwitchCB; |
---|
| 931 | + |
---|
740 | 932 | JComboBox texresMenu; |
---|
| 933 | + |
---|
741 | 934 | JButton resetButton; |
---|
742 | 935 | JButton stepButton; |
---|
743 | 936 | JButton stepAllButton; |
---|
.. | .. |
---|
746 | 939 | JButton fasterButton; |
---|
747 | 940 | JButton remarkButton; |
---|
748 | 941 | |
---|
| 942 | + cGridBag editPanel; |
---|
| 943 | + cGridBag editCommandsPanel; |
---|
| 944 | + |
---|
749 | 945 | cGridBag namePanel; |
---|
750 | 946 | cGridBag setupPanel; |
---|
751 | 947 | cGridBag setupPanel2; |
---|
752 | | - cGridBag commandsPanel; |
---|
| 948 | + cGridBag objectCommandsPanel; |
---|
753 | 949 | cGridBag pushPanel; |
---|
754 | 950 | cGridBag fillPanel; |
---|
755 | 951 | |
---|
.. | .. |
---|
926 | 1122 | |
---|
927 | 1123 | oe.ctrlPanel.Return(); |
---|
928 | 1124 | |
---|
929 | | - if (!GroupEditor.allparams) |
---|
| 1125 | + if (!allparams) |
---|
930 | 1126 | return; |
---|
931 | 1127 | |
---|
932 | 1128 | setupPanel = new cGridBag().setVertical(false); |
---|
.. | .. |
---|
939 | 1135 | hideCB = AddCheckBox(setupPanel, "Hide", copy.hide); |
---|
940 | 1136 | hideCB.setToolTipText("Hide object"); |
---|
941 | 1137 | markCB = AddCheckBox(setupPanel, "Mark", copy.marked); |
---|
942 | | - markCB.setToolTipText("Set the animation target transform"); |
---|
| 1138 | + markCB.setToolTipText("As animation target transform"); |
---|
943 | 1139 | |
---|
944 | 1140 | setupPanel2 = new cGridBag().setVertical(false); |
---|
945 | 1141 | |
---|
.. | .. |
---|
947 | 1143 | rewindCB.setToolTipText("Rewind animation"); |
---|
948 | 1144 | |
---|
949 | 1145 | randomCB = AddCheckBox(setupPanel2, "Rand", copy.random); |
---|
950 | | - randomCB.setToolTipText("Rewind or Go back and forth randomly"); |
---|
| 1146 | + randomCB.setToolTipText("Randomly Rewind (or Go back and forth)"); |
---|
951 | 1147 | |
---|
952 | 1148 | if (Globals.ADVANCED) |
---|
953 | 1149 | { |
---|
.. | .. |
---|
962 | 1158 | oe.ctrlPanel.add(setupPanel2); |
---|
963 | 1159 | oe.ctrlPanel.Return(); |
---|
964 | 1160 | |
---|
965 | | - commandsPanel = new cGridBag().setVertical(false); |
---|
| 1161 | + objectCommandsPanel = new cGridBag().setVertical(false); |
---|
966 | 1162 | |
---|
967 | | - resetButton = AddButton(commandsPanel, "Reset"); |
---|
| 1163 | + resetButton = AddButton(objectCommandsPanel, "Reset"); |
---|
968 | 1164 | resetButton.setToolTipText("Jump to frame zero"); |
---|
969 | | - stepButton = AddButton(commandsPanel, "Step"); |
---|
| 1165 | + stepButton = AddButton(objectCommandsPanel, "Step"); |
---|
970 | 1166 | stepButton.setToolTipText("Step one frame"); |
---|
971 | 1167 | // resetAllButton = AddButton(oe, "Reset All"); |
---|
972 | 1168 | // stepAllButton = AddButton(oe, "Step All"); |
---|
973 | 1169 | // Return(); |
---|
974 | | - slowerButton = AddButton(commandsPanel, "Slow"); |
---|
| 1170 | + slowerButton = AddButton(objectCommandsPanel, "Slow"); |
---|
975 | 1171 | slowerButton.setToolTipText("Decrease animation speed"); |
---|
976 | | - fasterButton = AddButton(commandsPanel, "Fast"); |
---|
| 1172 | + fasterButton = AddButton(objectCommandsPanel, "Fast"); |
---|
977 | 1173 | fasterButton.setToolTipText("Increase animation speed"); |
---|
978 | | - remarkButton = AddButton(commandsPanel, "Remark"); |
---|
| 1174 | + remarkButton = AddButton(objectCommandsPanel, "Remark"); |
---|
979 | 1175 | remarkButton.setToolTipText("Set the current transform as the target"); |
---|
980 | 1176 | |
---|
981 | | - oe.ctrlPanel.add(commandsPanel); |
---|
| 1177 | + oe.ctrlPanel.add(objectCommandsPanel); |
---|
982 | 1178 | oe.ctrlPanel.Return(); |
---|
983 | 1179 | |
---|
984 | 1180 | pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons |
---|
.. | .. |
---|
1184 | 1380 | //worldPanel.setName("World"); |
---|
1185 | 1381 | centralPanel = new cGridBag(); |
---|
1186 | 1382 | centralPanel.preferredWidth = 20; |
---|
1187 | | - timelinePanel = new JPanel(new BorderLayout()); |
---|
1188 | | - 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); |
---|
1189 | 1388 | |
---|
1190 | 1389 | cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel); |
---|
1191 | 1390 | cameraPanel.setContinuousLayout(true); |
---|
.. | .. |
---|
1194 | 1393 | // cameraPanel.setDividerSize(9); |
---|
1195 | 1394 | cameraPanel.setResizeWeight(1.0); |
---|
1196 | 1395 | |
---|
| 1396 | + } |
---|
| 1397 | + |
---|
1197 | 1398 | centralPanel.add(cameraView); |
---|
| 1399 | + centralPanel.setFocusable(true); |
---|
1198 | 1400 | //frame.setJMenuBar(timelineMenubar); |
---|
1199 | 1401 | //centralPanel.add(timelinePanel); |
---|
1200 | 1402 | |
---|
.. | .. |
---|
1261 | 1463 | // north.setName("Edit"); |
---|
1262 | 1464 | // north.add(ctrlPanel, BorderLayout.NORTH); |
---|
1263 | 1465 | // objectPanel.add(north); |
---|
1264 | | - objectPanel.add(ctrlPanel); |
---|
| 1466 | + objectPanel.add(editPanel); |
---|
1265 | 1467 | objectPanel.add(infoPanel); |
---|
| 1468 | + objectPanel.add(toolboxPanel); |
---|
1266 | 1469 | |
---|
1267 | 1470 | /* |
---|
1268 | 1471 | aConstraints.gridx = 0; |
---|
.. | .. |
---|
1271 | 1474 | aConstraints.gridy += 1; |
---|
1272 | 1475 | aConstraints.gridwidth = 1; |
---|
1273 | 1476 | mainPanel.add(objectPanel, aConstraints); |
---|
1274 | | - */ |
---|
| 1477 | + */ |
---|
1275 | 1478 | |
---|
1276 | 1479 | scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS, |
---|
1277 | 1480 | VERTICAL_SCROLLBAR_AS_NEEDED, |
---|
.. | .. |
---|
1288 | 1491 | JTabbedPane tabbedPane = new JTabbedPane(); |
---|
1289 | 1492 | tabbedPane.add(scrollpane); |
---|
1290 | 1493 | |
---|
1291 | | - tabbedPane.add(FSPane = new cFileSystemPane(this)); |
---|
1292 | | - |
---|
1293 | | - optionsPanel = new cGridBag().setVertical(true); |
---|
| 1494 | + optionsPanel = new cGridBag().setVertical(false); |
---|
1294 | 1495 | |
---|
1295 | 1496 | optionsPanel.setName("Options"); |
---|
1296 | 1497 | |
---|
.. | .. |
---|
1298 | 1499 | |
---|
1299 | 1500 | tabbedPane.add(optionsPanel); |
---|
1300 | 1501 | |
---|
| 1502 | + tabbedPane.add(FSPane = new cFileSystemPane(this)); |
---|
| 1503 | + |
---|
1301 | 1504 | scenePanel.add(tabbedPane); |
---|
1302 | 1505 | |
---|
1303 | 1506 | /* |
---|
.. | .. |
---|
1390 | 1593 | // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc); |
---|
1391 | 1594 | |
---|
1392 | 1595 | frame.setSize(1280, 860); |
---|
| 1596 | + |
---|
| 1597 | + frame.validate(); |
---|
1393 | 1598 | frame.setVisible(true); |
---|
1394 | 1599 | |
---|
| 1600 | + cameraView.requestFocusInWindow(); |
---|
| 1601 | + |
---|
1395 | 1602 | gridPanel.setDividerLocation(1.0); |
---|
1396 | 1603 | |
---|
1397 | 1604 | frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); |
---|
.. | .. |
---|
2707 | 2914 | |
---|
2708 | 2915 | void SetMaterial(Object3D object) |
---|
2709 | 2916 | { |
---|
| 2917 | + latestObject = object; |
---|
| 2918 | + |
---|
2710 | 2919 | cMaterial mat = object.material; |
---|
2711 | 2920 | |
---|
2712 | 2921 | if (mat == null) |
---|
.. | .. |
---|
2818 | 3027 | // } |
---|
2819 | 3028 | |
---|
2820 | 3029 | /**/ |
---|
2821 | | - if (deselect) |
---|
| 3030 | + if (deselect || child == null) |
---|
2822 | 3031 | { |
---|
2823 | 3032 | //group.deselectAll(); |
---|
2824 | 3033 | //freeze = true; |
---|
2825 | 3034 | GetTree().clearSelection(); |
---|
2826 | 3035 | //freeze = false; |
---|
| 3036 | + |
---|
| 3037 | + if (child == null) |
---|
| 3038 | + { |
---|
| 3039 | + return; |
---|
| 3040 | + } |
---|
2827 | 3041 | } |
---|
2828 | 3042 | |
---|
2829 | 3043 | //group.addSelectee(child); |
---|
.. | .. |
---|
2892 | 3106 | cameraView.ToggleDL(); |
---|
2893 | 3107 | cameraView.repaint(); |
---|
2894 | 3108 | return; |
---|
2895 | | - } else if (event.getSource() == toggleTextureItem) |
---|
| 3109 | + } else if (event.getSource() == toggleTextureItem || event.getSource() == toggleTextureCB) |
---|
2896 | 3110 | { |
---|
2897 | 3111 | cameraView.ToggleTexture(); |
---|
2898 | 3112 | // june 2013 copy.HardTouch(); |
---|
.. | .. |
---|
2931 | 3145 | frame.validate(); |
---|
2932 | 3146 | |
---|
2933 | 3147 | return; |
---|
2934 | | - } else if (event.getSource() == toggleSwitchItem) |
---|
| 3148 | + } else if (event.getSource() == toggleSwitchItem || event.getSource() == toggleSwitchCB) |
---|
2935 | 3149 | { |
---|
2936 | 3150 | cameraView.ToggleSwitch(); |
---|
2937 | 3151 | cameraView.repaint(); |
---|
.. | .. |
---|
3315 | 3529 | |
---|
3316 | 3530 | public void Save() |
---|
3317 | 3531 | { |
---|
| 3532 | + System.err.println("Save"); |
---|
| 3533 | + |
---|
3318 | 3534 | cRadio tab = GetCurrentTab(); |
---|
3319 | 3535 | |
---|
3320 | 3536 | boolean temp = CameraPane.SWITCH; |
---|
.. | .. |
---|
3336 | 3552 | tab.graphs[i] = null; |
---|
3337 | 3553 | } |
---|
3338 | 3554 | |
---|
| 3555 | + SetUndoStates(); |
---|
| 3556 | + |
---|
3339 | 3557 | // test save |
---|
3340 | 3558 | if (false) |
---|
3341 | 3559 | { |
---|
.. | .. |
---|
3358 | 3576 | |
---|
3359 | 3577 | void CopyChanged(Object3D obj) |
---|
3360 | 3578 | { |
---|
| 3579 | + SetUndoStates(); |
---|
| 3580 | + |
---|
3361 | 3581 | boolean temp = CameraPane.SWITCH; |
---|
3362 | 3582 | CameraPane.SWITCH = false; |
---|
3363 | 3583 | |
---|
.. | .. |
---|
3397 | 3617 | refreshContents(); |
---|
3398 | 3618 | } |
---|
3399 | 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 | + |
---|
3400 | 3631 | public void Undo() |
---|
3401 | 3632 | { |
---|
| 3633 | + System.err.println("Undo"); |
---|
| 3634 | + |
---|
3402 | 3635 | cRadio tab = GetCurrentTab(); |
---|
3403 | 3636 | |
---|
3404 | 3637 | if (tab.undoindex == 0) |
---|
.. | .. |
---|
3582 | 3815 | assert false; |
---|
3583 | 3816 | } |
---|
3584 | 3817 | |
---|
3585 | | - void EditSelection() |
---|
| 3818 | + void EditSelection(boolean newWindow) |
---|
3586 | 3819 | { |
---|
3587 | 3820 | } |
---|
3588 | 3821 | |
---|
.. | .. |
---|
4077 | 4310 | |
---|
4078 | 4311 | void makeSomething(Object3D thing, boolean resetmodel) // deselect) |
---|
4079 | 4312 | { |
---|
4080 | | - Save(); |
---|
| 4313 | + if (Globals.SAVEONMAKE) // && resetmodel) |
---|
| 4314 | + Save(); |
---|
4081 | 4315 | //Tween.set(thing, 0).target(1).start(tweenManager); |
---|
4082 | 4316 | //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager); |
---|
4083 | 4317 | // if (thing instanceof GenericJointDemo) |
---|
.. | .. |
---|
4164 | 4398 | { |
---|
4165 | 4399 | ResetModel(); |
---|
4166 | 4400 | Select(thing.GetTreePath(), true, false); // unselect... false); |
---|
| 4401 | + |
---|
| 4402 | + if (thing.Size() == 0) |
---|
| 4403 | + { |
---|
| 4404 | + //EditSelection(false); |
---|
| 4405 | + } |
---|
| 4406 | + |
---|
4167 | 4407 | refreshContents(); |
---|
4168 | 4408 | } |
---|
4169 | 4409 | |
---|
.. | .. |
---|
4386 | 4626 | |
---|
4387 | 4627 | if (readobj != null) |
---|
4388 | 4628 | { |
---|
| 4629 | + if (Globals.SAVEONMAKE) |
---|
4389 | 4630 | Save(); |
---|
4390 | 4631 | try |
---|
4391 | 4632 | { |
---|
.. | .. |
---|
4564 | 4805 | String filename = browser.getFile(); |
---|
4565 | 4806 | if (filename != null && filename.length() > 0) |
---|
4566 | 4807 | { |
---|
| 4808 | + if (!filename.endsWith(".gfd")) |
---|
| 4809 | + filename += ".gfd"; |
---|
4567 | 4810 | lastname = browser.getDirectory() + filename; |
---|
4568 | 4811 | save(); |
---|
4569 | 4812 | } |
---|
.. | .. |
---|
4757 | 5000 | CheckboxMenuItem togglePaintItem; |
---|
4758 | 5001 | JSplitPane mainPanel; |
---|
4759 | 5002 | JScrollPane scrollpane; |
---|
| 5003 | + |
---|
4760 | 5004 | JPanel toolbarPanel; |
---|
| 5005 | + |
---|
4761 | 5006 | cGridBag treePanel; |
---|
| 5007 | + |
---|
4762 | 5008 | JPanel radioPanel; |
---|
4763 | 5009 | ButtonGroup buttonGroup; |
---|
4764 | | - cGridBag ctrlPanel; |
---|
| 5010 | + |
---|
| 5011 | + cGridBag toolboxPanel; |
---|
4765 | 5012 | cGridBag materialPanel; |
---|
| 5013 | + cGridBag ctrlPanel; |
---|
| 5014 | + |
---|
4766 | 5015 | JScrollPane infoPanel; |
---|
| 5016 | + |
---|
4767 | 5017 | cGridBag optionsPanel; |
---|
| 5018 | + |
---|
4768 | 5019 | JTabbedPane objectPanel; |
---|
| 5020 | + boolean materialFlushed; |
---|
| 5021 | + Object3D latestObject; |
---|
| 5022 | + |
---|
4769 | 5023 | cGridBag XYZPanel; |
---|
| 5024 | + |
---|
4770 | 5025 | JSplitPane gridPanel; |
---|
4771 | 5026 | JSplitPane bigPanel; |
---|
| 5027 | + |
---|
4772 | 5028 | cGridBag bigThree; |
---|
4773 | 5029 | cGridBag scenePanel; |
---|
4774 | 5030 | cGridBag centralPanel; |
---|
.. | .. |
---|
4883 | 5139 | cNumberSlider fogField; |
---|
4884 | 5140 | JLabel opacityPowerLabel; |
---|
4885 | 5141 | cNumberSlider opacityPowerField; |
---|
4886 | | - JTree jTree; |
---|
| 5142 | + cTree jTree; |
---|
4887 | 5143 | //ObjectUI parent; |
---|
4888 | 5144 | |
---|
4889 | 5145 | cNumberSlider normalpushField; |
---|