.. | .. |
---|
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.*; |
---|
.. | .. |
---|
35 | 36 | |
---|
36 | 37 | GroupEditor callee; |
---|
37 | 38 | JFrame frame; |
---|
| 39 | + |
---|
| 40 | + static ObjEditor theFrame; |
---|
| 41 | + |
---|
| 42 | + cButton GetButton(String name, boolean border) |
---|
| 43 | + { |
---|
| 44 | + try |
---|
| 45 | + { |
---|
| 46 | + ImageIcon icon = GetIcon(name); |
---|
| 47 | + return new cButton(icon, border); |
---|
| 48 | + } |
---|
| 49 | + catch (Exception e) |
---|
| 50 | + { |
---|
| 51 | + return new cButton(name, border); |
---|
| 52 | + } |
---|
| 53 | + } |
---|
| 54 | + |
---|
| 55 | + cToggleButton GetToggleButton(String name, boolean border) |
---|
| 56 | + { |
---|
| 57 | + try |
---|
| 58 | + { |
---|
| 59 | + ImageIcon icon = GetIcon(name); |
---|
| 60 | + return new cToggleButton(icon, border); |
---|
| 61 | + } |
---|
| 62 | + catch (Exception e) |
---|
| 63 | + { |
---|
| 64 | + return new cToggleButton(name, border); |
---|
| 65 | + } |
---|
| 66 | + } |
---|
| 67 | + |
---|
| 68 | + cCheckBox GetCheckBox(String name, boolean border) |
---|
| 69 | + { |
---|
| 70 | + try |
---|
| 71 | + { |
---|
| 72 | + ImageIcon icon = GetIcon(name); |
---|
| 73 | + return new cCheckBox(icon, border); |
---|
| 74 | + } |
---|
| 75 | + catch (Exception e) |
---|
| 76 | + { |
---|
| 77 | + return new cCheckBox(name, border); |
---|
| 78 | + } |
---|
| 79 | + } |
---|
| 80 | + |
---|
| 81 | + private ImageIcon GetIcon(String name) throws IOException |
---|
| 82 | + { |
---|
| 83 | + BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name)); |
---|
| 84 | + |
---|
| 85 | + if (image.getWidth() != 24 && image.getHeight() != 24) |
---|
| 86 | + { |
---|
| 87 | + BufferedImage resized = new BufferedImage(24, 24, image.getType()); |
---|
| 88 | + Graphics2D g = resized.createGraphics(); |
---|
| 89 | + g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); |
---|
| 90 | + //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); |
---|
| 91 | + g.drawImage(image, 0, 0, 24, 24, 0, 0, image.getWidth(), image.getHeight(), null); |
---|
| 92 | + g.dispose(); |
---|
| 93 | + |
---|
| 94 | + image = resized; |
---|
| 95 | + } |
---|
| 96 | + |
---|
| 97 | + javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image); |
---|
| 98 | + return icon; |
---|
| 99 | + } |
---|
38 | 100 | |
---|
39 | 101 | // SCRIPT |
---|
40 | 102 | |
---|
.. | .. |
---|
169 | 231 | |
---|
170 | 232 | objEditor.ctrlPanel.remove(setupPanel); |
---|
171 | 233 | objEditor.ctrlPanel.remove(setupPanel2); |
---|
172 | | - objEditor.ctrlPanel.remove(commandsPanel); |
---|
| 234 | + objEditor.ctrlPanel.remove(objectCommandsPanel); |
---|
173 | 235 | objEditor.ctrlPanel.remove(pushPanel); |
---|
174 | 236 | //objEditor.ctrlPanel.remove(fillPanel); |
---|
175 | 237 | |
---|
.. | .. |
---|
244 | 306 | //localCopy.parent = null; |
---|
245 | 307 | |
---|
246 | 308 | frame = new JFrame(); |
---|
| 309 | + frame.setUndecorated(true); |
---|
247 | 310 | objEditor = this; |
---|
248 | 311 | this.callee = callee; |
---|
249 | 312 | |
---|
.. | .. |
---|
324 | 387 | toolbarPanel.setName("Toolbar"); |
---|
325 | 388 | treePanel = new cGridBag(); |
---|
326 | 389 | treePanel.setName("Tree"); |
---|
| 390 | + |
---|
| 391 | + editPanel = new cGridBag().setVertical(true); |
---|
| 392 | + editPanel.setName("Edit"); |
---|
| 393 | + |
---|
327 | 394 | ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout()); |
---|
328 | | - ctrlPanel.setName("Edit"); |
---|
| 395 | + |
---|
| 396 | + editCommandsPanel = new cGridBag(); |
---|
| 397 | + editPanel.add(editCommandsPanel); |
---|
| 398 | + editPanel.add(ctrlPanel); |
---|
| 399 | + |
---|
| 400 | + toolboxPanel = new cGridBag().setVertical(false); |
---|
| 401 | + toolboxPanel.setName("Toolbox"); |
---|
| 402 | + |
---|
329 | 403 | materialPanel = new cGridBag().setVertical(true); |
---|
330 | 404 | materialPanel.setName("Material"); |
---|
| 405 | + |
---|
331 | 406 | /*JTextPane*/ |
---|
332 | 407 | infoarea = createTextPane(); |
---|
333 | 408 | doc = infoarea.getStyledDocument(); |
---|
.. | .. |
---|
583 | 658 | } |
---|
584 | 659 | } |
---|
585 | 660 | |
---|
| 661 | +static GraphicsDevice device = GraphicsEnvironment |
---|
| 662 | + .getLocalGraphicsEnvironment().getScreenDevices()[0]; |
---|
| 663 | + |
---|
| 664 | + Rectangle keeprect; |
---|
| 665 | + cRadio radio; |
---|
| 666 | + |
---|
| 667 | +cButton keepButton; |
---|
| 668 | + cButton twoButton; // Full 3D |
---|
| 669 | + cButton sixButton; |
---|
| 670 | + cButton threeButton; |
---|
| 671 | + cButton sevenButton; |
---|
| 672 | + cButton fourButton; // full panel |
---|
| 673 | + cButton oneButton; // full XYZ |
---|
| 674 | + //cButton currentLayout; |
---|
| 675 | + |
---|
| 676 | + boolean maximized; |
---|
| 677 | + |
---|
| 678 | + cButton fullscreenLayout; |
---|
| 679 | + |
---|
| 680 | + void Minimize() |
---|
| 681 | + { |
---|
| 682 | + frame.setState(Frame.ICONIFIED); |
---|
| 683 | + } |
---|
| 684 | + |
---|
| 685 | + void Maximize() |
---|
| 686 | + { |
---|
| 687 | + if (maximized) |
---|
| 688 | + { |
---|
| 689 | + frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height); |
---|
| 690 | + } |
---|
| 691 | + else |
---|
| 692 | + { |
---|
| 693 | + keeprect = frame.getBounds(); |
---|
| 694 | + Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); |
---|
| 695 | + Dimension rect2 = frame.getToolkit().getScreenSize(); |
---|
| 696 | + frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height); |
---|
| 697 | +// frame.setState(Frame.MAXIMIZED_BOTH); |
---|
| 698 | + } |
---|
| 699 | + |
---|
| 700 | + maximized ^= true; |
---|
| 701 | + } |
---|
| 702 | + |
---|
586 | 703 | void ToggleFullScreen() |
---|
587 | 704 | { |
---|
588 | 705 | if (CameraPane.FULLSCREEN) |
---|
589 | 706 | { |
---|
590 | | - frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
591 | | - framePanel.add(bigThree); |
---|
592 | | - frame.getContentPane().add(/*"Center",*/framePanel); |
---|
| 707 | + device.setFullScreenWindow(null); |
---|
| 708 | + //frame.setVisible(false); |
---|
| 709 | +// frame.removeNotify(); |
---|
| 710 | +// frame.setUndecorated(false); |
---|
| 711 | +// frame.addNotify(); |
---|
| 712 | + //frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height); |
---|
| 713 | + |
---|
| 714 | +// X frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
| 715 | +// X framePanel.add(bigThree); |
---|
| 716 | +// X frame.getContentPane().add(/*"Center",*/framePanel); |
---|
| 717 | + framePanel.setDividerLocation(1); |
---|
| 718 | + |
---|
| 719 | + //frame.setVisible(true); |
---|
| 720 | + radio.layout = keepButton; |
---|
| 721 | + //theFrame = null; |
---|
| 722 | + keepButton = null; |
---|
| 723 | + radio.layout.doClick(); |
---|
| 724 | + |
---|
593 | 725 | } else |
---|
594 | 726 | { |
---|
595 | | - frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
596 | | - framePanel.remove(bigThree); |
---|
597 | | - frame.getContentPane().add(/*"Center",*/bigThree); |
---|
| 727 | + keepButton = radio.layout; |
---|
| 728 | + //keeprect = frame.getBounds(); |
---|
| 729 | +// frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width, |
---|
| 730 | +// frame.getToolkit().getScreenSize().height); |
---|
| 731 | + //frame.setVisible(false); |
---|
| 732 | + device.setFullScreenWindow(frame); |
---|
| 733 | +// frame.removeNotify(); |
---|
| 734 | +// frame.setUndecorated(true); |
---|
| 735 | +// frame.addNotify(); |
---|
| 736 | +// X frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
| 737 | +// X framePanel.remove(bigThree); |
---|
| 738 | +// X frame.getContentPane().add(/*"Center",*/bigThree); |
---|
| 739 | + framePanel.setDividerLocation(0); |
---|
| 740 | + |
---|
| 741 | + radio.layout = fullscreenLayout; |
---|
| 742 | + radio.layout.doClick(); |
---|
| 743 | + //frame.setVisible(true); |
---|
598 | 744 | } |
---|
| 745 | + |
---|
599 | 746 | cameraView.ToggleFullScreen(); |
---|
600 | 747 | } |
---|
601 | 748 | |
---|
.. | .. |
---|
746 | 893 | JButton fasterButton; |
---|
747 | 894 | JButton remarkButton; |
---|
748 | 895 | |
---|
| 896 | + cGridBag editPanel; |
---|
| 897 | + cGridBag editCommandsPanel; |
---|
| 898 | + |
---|
749 | 899 | cGridBag namePanel; |
---|
750 | 900 | cGridBag setupPanel; |
---|
751 | 901 | cGridBag setupPanel2; |
---|
752 | | - cGridBag commandsPanel; |
---|
| 902 | + cGridBag objectCommandsPanel; |
---|
753 | 903 | cGridBag pushPanel; |
---|
754 | 904 | cGridBag fillPanel; |
---|
755 | 905 | |
---|
.. | .. |
---|
947 | 1097 | rewindCB.setToolTipText("Rewind animation"); |
---|
948 | 1098 | |
---|
949 | 1099 | randomCB = AddCheckBox(setupPanel2, "Rand", copy.random); |
---|
950 | | - randomCB.setToolTipText("Rewind or Go back and forth randomly"); |
---|
| 1100 | + randomCB.setToolTipText("Randomly Rewind or Go back and forth"); |
---|
951 | 1101 | |
---|
952 | 1102 | if (Globals.ADVANCED) |
---|
953 | 1103 | { |
---|
.. | .. |
---|
962 | 1112 | oe.ctrlPanel.add(setupPanel2); |
---|
963 | 1113 | oe.ctrlPanel.Return(); |
---|
964 | 1114 | |
---|
965 | | - commandsPanel = new cGridBag().setVertical(false); |
---|
| 1115 | + objectCommandsPanel = new cGridBag().setVertical(false); |
---|
966 | 1116 | |
---|
967 | | - resetButton = AddButton(commandsPanel, "Reset"); |
---|
| 1117 | + resetButton = AddButton(objectCommandsPanel, "Reset"); |
---|
968 | 1118 | resetButton.setToolTipText("Jump to frame zero"); |
---|
969 | | - stepButton = AddButton(commandsPanel, "Step"); |
---|
| 1119 | + stepButton = AddButton(objectCommandsPanel, "Step"); |
---|
970 | 1120 | stepButton.setToolTipText("Step one frame"); |
---|
971 | 1121 | // resetAllButton = AddButton(oe, "Reset All"); |
---|
972 | 1122 | // stepAllButton = AddButton(oe, "Step All"); |
---|
973 | 1123 | // Return(); |
---|
974 | | - slowerButton = AddButton(commandsPanel, "Slow"); |
---|
| 1124 | + slowerButton = AddButton(objectCommandsPanel, "Slow"); |
---|
975 | 1125 | slowerButton.setToolTipText("Decrease animation speed"); |
---|
976 | | - fasterButton = AddButton(commandsPanel, "Fast"); |
---|
| 1126 | + fasterButton = AddButton(objectCommandsPanel, "Fast"); |
---|
977 | 1127 | fasterButton.setToolTipText("Increase animation speed"); |
---|
978 | | - remarkButton = AddButton(commandsPanel, "Remark"); |
---|
| 1128 | + remarkButton = AddButton(objectCommandsPanel, "Remark"); |
---|
979 | 1129 | remarkButton.setToolTipText("Set the current transform as the target"); |
---|
980 | 1130 | |
---|
981 | | - oe.ctrlPanel.add(commandsPanel); |
---|
| 1131 | + oe.ctrlPanel.add(objectCommandsPanel); |
---|
982 | 1132 | oe.ctrlPanel.Return(); |
---|
983 | 1133 | |
---|
984 | 1134 | pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons |
---|
.. | .. |
---|
1184 | 1334 | //worldPanel.setName("World"); |
---|
1185 | 1335 | centralPanel = new cGridBag(); |
---|
1186 | 1336 | centralPanel.preferredWidth = 20; |
---|
1187 | | - timelinePanel = new JPanel(new BorderLayout()); |
---|
1188 | | - timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel); |
---|
| 1337 | + |
---|
| 1338 | + if (Globals.ADVANCED) |
---|
| 1339 | + { |
---|
| 1340 | + timelinePanel = new JPanel(new BorderLayout()); |
---|
| 1341 | + timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel); |
---|
1189 | 1342 | |
---|
1190 | 1343 | cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel); |
---|
1191 | 1344 | cameraPanel.setContinuousLayout(true); |
---|
.. | .. |
---|
1194 | 1347 | // cameraPanel.setDividerSize(9); |
---|
1195 | 1348 | cameraPanel.setResizeWeight(1.0); |
---|
1196 | 1349 | |
---|
| 1350 | + } |
---|
| 1351 | + |
---|
1197 | 1352 | centralPanel.add(cameraView); |
---|
| 1353 | + centralPanel.setFocusable(true); |
---|
1198 | 1354 | //frame.setJMenuBar(timelineMenubar); |
---|
1199 | 1355 | //centralPanel.add(timelinePanel); |
---|
1200 | 1356 | |
---|
.. | .. |
---|
1256 | 1412 | |
---|
1257 | 1413 | //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); |
---|
1258 | 1414 | //tmp.setName("Edit"); |
---|
| 1415 | + objectPanel.add(toolboxPanel); |
---|
1259 | 1416 | objectPanel.add(materialPanel); |
---|
1260 | 1417 | // JPanel north = new JPanel(new BorderLayout()); |
---|
1261 | 1418 | // north.setName("Edit"); |
---|
1262 | 1419 | // north.add(ctrlPanel, BorderLayout.NORTH); |
---|
1263 | 1420 | // objectPanel.add(north); |
---|
1264 | | - objectPanel.add(ctrlPanel); |
---|
| 1421 | + objectPanel.add(editPanel); |
---|
1265 | 1422 | objectPanel.add(infoPanel); |
---|
1266 | 1423 | |
---|
1267 | 1424 | /* |
---|
.. | .. |
---|
1392 | 1549 | frame.setSize(1280, 860); |
---|
1393 | 1550 | frame.setVisible(true); |
---|
1394 | 1551 | |
---|
| 1552 | + cameraView.requestFocusInWindow(); |
---|
| 1553 | + |
---|
1395 | 1554 | gridPanel.setDividerLocation(1.0); |
---|
1396 | 1555 | |
---|
1397 | 1556 | frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); |
---|
.. | .. |
---|
3315 | 3474 | |
---|
3316 | 3475 | public void Save() |
---|
3317 | 3476 | { |
---|
| 3477 | + System.err.println("Save"); |
---|
| 3478 | + |
---|
3318 | 3479 | cRadio tab = GetCurrentTab(); |
---|
3319 | 3480 | |
---|
3320 | 3481 | boolean temp = CameraPane.SWITCH; |
---|
.. | .. |
---|
3399 | 3560 | |
---|
3400 | 3561 | public void Undo() |
---|
3401 | 3562 | { |
---|
| 3563 | + System.err.println("Undo"); |
---|
| 3564 | + |
---|
3402 | 3565 | cRadio tab = GetCurrentTab(); |
---|
3403 | 3566 | |
---|
3404 | 3567 | if (tab.undoindex == 0) |
---|
.. | .. |
---|
3582 | 3745 | assert false; |
---|
3583 | 3746 | } |
---|
3584 | 3747 | |
---|
3585 | | - void EditSelection() |
---|
| 3748 | + void EditSelection(boolean newWindow) |
---|
3586 | 3749 | { |
---|
3587 | 3750 | } |
---|
3588 | 3751 | |
---|
.. | .. |
---|
4077 | 4240 | |
---|
4078 | 4241 | void makeSomething(Object3D thing, boolean resetmodel) // deselect) |
---|
4079 | 4242 | { |
---|
4080 | | - Save(); |
---|
| 4243 | + if (Globals.SAVEONMAKE) // && resetmodel) |
---|
| 4244 | + Save(); |
---|
4081 | 4245 | //Tween.set(thing, 0).target(1).start(tweenManager); |
---|
4082 | 4246 | //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager); |
---|
4083 | 4247 | // if (thing instanceof GenericJointDemo) |
---|
.. | .. |
---|
4164 | 4328 | { |
---|
4165 | 4329 | ResetModel(); |
---|
4166 | 4330 | Select(thing.GetTreePath(), true, false); // unselect... false); |
---|
| 4331 | + |
---|
| 4332 | + if (thing.Size() == 0) |
---|
| 4333 | + { |
---|
| 4334 | + //EditSelection(false); |
---|
| 4335 | + } |
---|
| 4336 | + |
---|
4167 | 4337 | refreshContents(); |
---|
4168 | 4338 | } |
---|
4169 | 4339 | |
---|
.. | .. |
---|
4386 | 4556 | |
---|
4387 | 4557 | if (readobj != null) |
---|
4388 | 4558 | { |
---|
| 4559 | + if (Globals.SAVEONMAKE) |
---|
4389 | 4560 | Save(); |
---|
4390 | 4561 | try |
---|
4391 | 4562 | { |
---|
.. | .. |
---|
4757 | 4928 | CheckboxMenuItem togglePaintItem; |
---|
4758 | 4929 | JSplitPane mainPanel; |
---|
4759 | 4930 | JScrollPane scrollpane; |
---|
| 4931 | + |
---|
4760 | 4932 | JPanel toolbarPanel; |
---|
| 4933 | + |
---|
4761 | 4934 | cGridBag treePanel; |
---|
| 4935 | + |
---|
4762 | 4936 | JPanel radioPanel; |
---|
4763 | 4937 | ButtonGroup buttonGroup; |
---|
4764 | | - cGridBag ctrlPanel; |
---|
| 4938 | + |
---|
| 4939 | + cGridBag toolboxPanel; |
---|
4765 | 4940 | cGridBag materialPanel; |
---|
| 4941 | + cGridBag ctrlPanel; |
---|
| 4942 | + |
---|
4766 | 4943 | JScrollPane infoPanel; |
---|
| 4944 | + |
---|
4767 | 4945 | cGridBag optionsPanel; |
---|
| 4946 | + |
---|
4768 | 4947 | JTabbedPane objectPanel; |
---|
| 4948 | + |
---|
4769 | 4949 | cGridBag XYZPanel; |
---|
| 4950 | + |
---|
4770 | 4951 | JSplitPane gridPanel; |
---|
4771 | 4952 | JSplitPane bigPanel; |
---|
| 4953 | + |
---|
4772 | 4954 | cGridBag bigThree; |
---|
4773 | 4955 | cGridBag scenePanel; |
---|
4774 | 4956 | cGridBag centralPanel; |
---|
.. | .. |
---|
4883 | 5065 | cNumberSlider fogField; |
---|
4884 | 5066 | JLabel opacityPowerLabel; |
---|
4885 | 5067 | cNumberSlider opacityPowerField; |
---|
4886 | | - JTree jTree; |
---|
| 5068 | + cTree jTree; |
---|
4887 | 5069 | //ObjectUI parent; |
---|
4888 | 5070 | |
---|
4889 | 5071 | cNumberSlider normalpushField; |
---|