.. | .. |
---|
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 | + cCheckBox GetCheckBox(String name, boolean border) |
---|
| 56 | + { |
---|
| 57 | + try |
---|
| 58 | + { |
---|
| 59 | + ImageIcon icon = GetIcon(name); |
---|
| 60 | + return new cCheckBox(icon, border); |
---|
| 61 | + } |
---|
| 62 | + catch (Exception e) |
---|
| 63 | + { |
---|
| 64 | + return new cCheckBox(name, border); |
---|
| 65 | + } |
---|
| 66 | + } |
---|
| 67 | + |
---|
| 68 | + private ImageIcon GetIcon(String name) throws IOException |
---|
| 69 | + { |
---|
| 70 | + BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name)); |
---|
| 71 | + |
---|
| 72 | + if (image.getWidth() != 24 && image.getHeight() != 24) |
---|
| 73 | + { |
---|
| 74 | + BufferedImage resized = new BufferedImage(24, 24, image.getType()); |
---|
| 75 | + Graphics2D g = resized.createGraphics(); |
---|
| 76 | + g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); |
---|
| 77 | + //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); |
---|
| 78 | + g.drawImage(image, 0, 0, 24, 24, 0, 0, image.getWidth(), image.getHeight(), null); |
---|
| 79 | + g.dispose(); |
---|
| 80 | + |
---|
| 81 | + image = resized; |
---|
| 82 | + } |
---|
| 83 | + |
---|
| 84 | + javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image); |
---|
| 85 | + return icon; |
---|
| 86 | + } |
---|
38 | 87 | |
---|
39 | 88 | // SCRIPT |
---|
40 | 89 | |
---|
.. | .. |
---|
169 | 218 | |
---|
170 | 219 | objEditor.ctrlPanel.remove(setupPanel); |
---|
171 | 220 | objEditor.ctrlPanel.remove(setupPanel2); |
---|
172 | | - objEditor.ctrlPanel.remove(commandsPanel); |
---|
| 221 | + objEditor.ctrlPanel.remove(objectCommandsPanel); |
---|
173 | 222 | objEditor.ctrlPanel.remove(pushPanel); |
---|
174 | 223 | //objEditor.ctrlPanel.remove(fillPanel); |
---|
175 | 224 | |
---|
.. | .. |
---|
244 | 293 | //localCopy.parent = null; |
---|
245 | 294 | |
---|
246 | 295 | frame = new JFrame(); |
---|
| 296 | + frame.setUndecorated(true); |
---|
247 | 297 | objEditor = this; |
---|
248 | 298 | this.callee = callee; |
---|
249 | 299 | |
---|
.. | .. |
---|
324 | 374 | toolbarPanel.setName("Toolbar"); |
---|
325 | 375 | treePanel = new cGridBag(); |
---|
326 | 376 | treePanel.setName("Tree"); |
---|
| 377 | + |
---|
| 378 | + editPanel = new cGridBag().setVertical(true); |
---|
| 379 | + editPanel.setName("Edit"); |
---|
| 380 | + |
---|
327 | 381 | ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout()); |
---|
328 | | - ctrlPanel.setName("Edit"); |
---|
| 382 | + |
---|
| 383 | + editCommandsPanel = new cGridBag(); |
---|
| 384 | + editPanel.add(editCommandsPanel); |
---|
| 385 | + editPanel.add(ctrlPanel); |
---|
| 386 | + |
---|
329 | 387 | materialPanel = new cGridBag().setVertical(true); |
---|
| 388 | + |
---|
330 | 389 | materialPanel.setName("Material"); |
---|
331 | 390 | /*JTextPane*/ |
---|
332 | 391 | infoarea = createTextPane(); |
---|
.. | .. |
---|
583 | 642 | } |
---|
584 | 643 | } |
---|
585 | 644 | |
---|
| 645 | +static GraphicsDevice device = GraphicsEnvironment |
---|
| 646 | + .getLocalGraphicsEnvironment().getScreenDevices()[0]; |
---|
| 647 | + |
---|
| 648 | + Rectangle keeprect; |
---|
| 649 | + cRadio radio; |
---|
| 650 | + |
---|
| 651 | +cButton keepButton; |
---|
| 652 | + cButton twoButton; // Full 3D |
---|
| 653 | + cButton sixButton; |
---|
| 654 | + cButton threeButton; |
---|
| 655 | + cButton sevenButton; |
---|
| 656 | + cButton fourButton; // full panel |
---|
| 657 | + cButton oneButton; // full XYZ |
---|
| 658 | + //cButton currentLayout; |
---|
| 659 | + |
---|
| 660 | + boolean maximized; |
---|
| 661 | + |
---|
| 662 | + void Minimize() |
---|
| 663 | + { |
---|
| 664 | + frame.setState(Frame.ICONIFIED); |
---|
| 665 | + } |
---|
| 666 | + |
---|
| 667 | + void Maximize() |
---|
| 668 | + { |
---|
| 669 | + if (maximized) |
---|
| 670 | + { |
---|
| 671 | + frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height); |
---|
| 672 | + } |
---|
| 673 | + else |
---|
| 674 | + { |
---|
| 675 | + keeprect = frame.getBounds(); |
---|
| 676 | + Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); |
---|
| 677 | + Dimension rect2 = frame.getToolkit().getScreenSize(); |
---|
| 678 | + frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height); |
---|
| 679 | +// frame.setState(Frame.MAXIMIZED_BOTH); |
---|
| 680 | + } |
---|
| 681 | + |
---|
| 682 | + maximized ^= true; |
---|
| 683 | + } |
---|
| 684 | + |
---|
586 | 685 | void ToggleFullScreen() |
---|
587 | 686 | { |
---|
588 | 687 | if (CameraPane.FULLSCREEN) |
---|
589 | 688 | { |
---|
590 | | - frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
591 | | - framePanel.add(bigThree); |
---|
592 | | - frame.getContentPane().add(/*"Center",*/framePanel); |
---|
| 689 | + device.setFullScreenWindow(null); |
---|
| 690 | + //frame.setVisible(false); |
---|
| 691 | +// frame.removeNotify(); |
---|
| 692 | +// frame.setUndecorated(false); |
---|
| 693 | +// frame.addNotify(); |
---|
| 694 | + //frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height); |
---|
| 695 | + |
---|
| 696 | +// X frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
| 697 | +// X framePanel.add(bigThree); |
---|
| 698 | +// X frame.getContentPane().add(/*"Center",*/framePanel); |
---|
| 699 | + framePanel.setDividerLocation(1); |
---|
| 700 | + |
---|
| 701 | + //frame.setVisible(true); |
---|
| 702 | + radio.layout = keepButton; |
---|
| 703 | + //theFrame = null; |
---|
| 704 | + keepButton = null; |
---|
| 705 | + radio.layout.doClick(); |
---|
| 706 | + |
---|
593 | 707 | } else |
---|
594 | 708 | { |
---|
595 | | - frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
596 | | - framePanel.remove(bigThree); |
---|
597 | | - frame.getContentPane().add(/*"Center",*/bigThree); |
---|
| 709 | + keepButton = radio.layout; |
---|
| 710 | + //keeprect = frame.getBounds(); |
---|
| 711 | +// frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width, |
---|
| 712 | +// frame.getToolkit().getScreenSize().height); |
---|
| 713 | + //frame.setVisible(false); |
---|
| 714 | + device.setFullScreenWindow(frame); |
---|
| 715 | +// frame.removeNotify(); |
---|
| 716 | +// frame.setUndecorated(true); |
---|
| 717 | +// frame.addNotify(); |
---|
| 718 | +// X frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
| 719 | +// X framePanel.remove(bigThree); |
---|
| 720 | +// X frame.getContentPane().add(/*"Center",*/bigThree); |
---|
| 721 | + framePanel.setDividerLocation(0); |
---|
| 722 | + |
---|
| 723 | + radio.layout = twoButton; |
---|
| 724 | + radio.layout.doClick(); |
---|
| 725 | + //frame.setVisible(true); |
---|
598 | 726 | } |
---|
| 727 | + |
---|
599 | 728 | cameraView.ToggleFullScreen(); |
---|
600 | 729 | } |
---|
601 | 730 | |
---|
.. | .. |
---|
746 | 875 | JButton fasterButton; |
---|
747 | 876 | JButton remarkButton; |
---|
748 | 877 | |
---|
| 878 | + cGridBag editPanel; |
---|
| 879 | + cGridBag editCommandsPanel; |
---|
| 880 | + |
---|
749 | 881 | cGridBag namePanel; |
---|
750 | 882 | cGridBag setupPanel; |
---|
751 | 883 | cGridBag setupPanel2; |
---|
752 | | - cGridBag commandsPanel; |
---|
| 884 | + cGridBag objectCommandsPanel; |
---|
753 | 885 | cGridBag pushPanel; |
---|
754 | 886 | cGridBag fillPanel; |
---|
755 | 887 | |
---|
.. | .. |
---|
947 | 1079 | rewindCB.setToolTipText("Rewind animation"); |
---|
948 | 1080 | |
---|
949 | 1081 | randomCB = AddCheckBox(setupPanel2, "Rand", copy.random); |
---|
950 | | - randomCB.setToolTipText("Rewind or Go back and forth randomly"); |
---|
| 1082 | + randomCB.setToolTipText("Randomly Rewind or Go back and forth"); |
---|
951 | 1083 | |
---|
952 | 1084 | if (Globals.ADVANCED) |
---|
953 | 1085 | { |
---|
.. | .. |
---|
962 | 1094 | oe.ctrlPanel.add(setupPanel2); |
---|
963 | 1095 | oe.ctrlPanel.Return(); |
---|
964 | 1096 | |
---|
965 | | - commandsPanel = new cGridBag().setVertical(false); |
---|
| 1097 | + objectCommandsPanel = new cGridBag().setVertical(false); |
---|
966 | 1098 | |
---|
967 | | - resetButton = AddButton(commandsPanel, "Reset"); |
---|
| 1099 | + resetButton = AddButton(objectCommandsPanel, "Reset"); |
---|
968 | 1100 | resetButton.setToolTipText("Jump to frame zero"); |
---|
969 | | - stepButton = AddButton(commandsPanel, "Step"); |
---|
| 1101 | + stepButton = AddButton(objectCommandsPanel, "Step"); |
---|
970 | 1102 | stepButton.setToolTipText("Step one frame"); |
---|
971 | 1103 | // resetAllButton = AddButton(oe, "Reset All"); |
---|
972 | 1104 | // stepAllButton = AddButton(oe, "Step All"); |
---|
973 | 1105 | // Return(); |
---|
974 | | - slowerButton = AddButton(commandsPanel, "Slow"); |
---|
| 1106 | + slowerButton = AddButton(objectCommandsPanel, "Slow"); |
---|
975 | 1107 | slowerButton.setToolTipText("Decrease animation speed"); |
---|
976 | | - fasterButton = AddButton(commandsPanel, "Fast"); |
---|
| 1108 | + fasterButton = AddButton(objectCommandsPanel, "Fast"); |
---|
977 | 1109 | fasterButton.setToolTipText("Increase animation speed"); |
---|
978 | | - remarkButton = AddButton(commandsPanel, "Remark"); |
---|
| 1110 | + remarkButton = AddButton(objectCommandsPanel, "Remark"); |
---|
979 | 1111 | remarkButton.setToolTipText("Set the current transform as the target"); |
---|
980 | 1112 | |
---|
981 | | - oe.ctrlPanel.add(commandsPanel); |
---|
| 1113 | + oe.ctrlPanel.add(objectCommandsPanel); |
---|
982 | 1114 | oe.ctrlPanel.Return(); |
---|
983 | 1115 | |
---|
984 | 1116 | pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons |
---|
.. | .. |
---|
1184 | 1316 | //worldPanel.setName("World"); |
---|
1185 | 1317 | centralPanel = new cGridBag(); |
---|
1186 | 1318 | centralPanel.preferredWidth = 20; |
---|
1187 | | - timelinePanel = new JPanel(new BorderLayout()); |
---|
1188 | | - timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel); |
---|
| 1319 | + |
---|
| 1320 | + if (Globals.ADVANCED) |
---|
| 1321 | + { |
---|
| 1322 | + timelinePanel = new JPanel(new BorderLayout()); |
---|
| 1323 | + timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel); |
---|
1189 | 1324 | |
---|
1190 | 1325 | cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel); |
---|
1191 | 1326 | cameraPanel.setContinuousLayout(true); |
---|
.. | .. |
---|
1194 | 1329 | // cameraPanel.setDividerSize(9); |
---|
1195 | 1330 | cameraPanel.setResizeWeight(1.0); |
---|
1196 | 1331 | |
---|
| 1332 | + } |
---|
| 1333 | + |
---|
1197 | 1334 | centralPanel.add(cameraView); |
---|
| 1335 | + centralPanel.setFocusable(true); |
---|
1198 | 1336 | //frame.setJMenuBar(timelineMenubar); |
---|
1199 | 1337 | //centralPanel.add(timelinePanel); |
---|
1200 | 1338 | |
---|
.. | .. |
---|
1261 | 1399 | // north.setName("Edit"); |
---|
1262 | 1400 | // north.add(ctrlPanel, BorderLayout.NORTH); |
---|
1263 | 1401 | // objectPanel.add(north); |
---|
1264 | | - objectPanel.add(ctrlPanel); |
---|
| 1402 | + objectPanel.add(editPanel); |
---|
1265 | 1403 | objectPanel.add(infoPanel); |
---|
1266 | 1404 | |
---|
1267 | 1405 | /* |
---|
.. | .. |
---|
1392 | 1530 | frame.setSize(1280, 860); |
---|
1393 | 1531 | frame.setVisible(true); |
---|
1394 | 1532 | |
---|
| 1533 | + cameraView.requestFocusInWindow(); |
---|
| 1534 | + |
---|
1395 | 1535 | gridPanel.setDividerLocation(1.0); |
---|
1396 | 1536 | |
---|
1397 | 1537 | frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); |
---|
.. | .. |
---|
3315 | 3455 | |
---|
3316 | 3456 | public void Save() |
---|
3317 | 3457 | { |
---|
| 3458 | + System.err.println("Save"); |
---|
| 3459 | + |
---|
3318 | 3460 | cRadio tab = GetCurrentTab(); |
---|
3319 | 3461 | |
---|
3320 | 3462 | boolean temp = CameraPane.SWITCH; |
---|
.. | .. |
---|
3399 | 3541 | |
---|
3400 | 3542 | public void Undo() |
---|
3401 | 3543 | { |
---|
| 3544 | + System.err.println("Undo"); |
---|
| 3545 | + |
---|
3402 | 3546 | cRadio tab = GetCurrentTab(); |
---|
3403 | 3547 | |
---|
3404 | 3548 | if (tab.undoindex == 0) |
---|
.. | .. |
---|
4077 | 4221 | |
---|
4078 | 4222 | void makeSomething(Object3D thing, boolean resetmodel) // deselect) |
---|
4079 | 4223 | { |
---|
4080 | | - Save(); |
---|
| 4224 | + if (Globals.SAVEONMAKE) |
---|
| 4225 | + Save(); |
---|
4081 | 4226 | //Tween.set(thing, 0).target(1).start(tweenManager); |
---|
4082 | 4227 | //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager); |
---|
4083 | 4228 | // if (thing instanceof GenericJointDemo) |
---|
.. | .. |
---|
4386 | 4531 | |
---|
4387 | 4532 | if (readobj != null) |
---|
4388 | 4533 | { |
---|
| 4534 | + if (Globals.SAVEONMAKE) |
---|
4389 | 4535 | Save(); |
---|
4390 | 4536 | try |
---|
4391 | 4537 | { |
---|