.. | .. |
---|
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.*; |
---|
.. | .. |
---|
37 | 38 | JFrame frame; |
---|
38 | 39 | |
---|
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 | + } |
---|
40 | 100 | |
---|
41 | 101 | // SCRIPT |
---|
42 | 102 | |
---|
.. | .. |
---|
171 | 231 | |
---|
172 | 232 | objEditor.ctrlPanel.remove(setupPanel); |
---|
173 | 233 | objEditor.ctrlPanel.remove(setupPanel2); |
---|
174 | | - objEditor.ctrlPanel.remove(commandsPanel); |
---|
| 234 | + objEditor.ctrlPanel.remove(objectCommandsPanel); |
---|
175 | 235 | objEditor.ctrlPanel.remove(pushPanel); |
---|
176 | 236 | //objEditor.ctrlPanel.remove(fillPanel); |
---|
177 | 237 | |
---|
.. | .. |
---|
327 | 387 | toolbarPanel.setName("Toolbar"); |
---|
328 | 388 | treePanel = new cGridBag(); |
---|
329 | 389 | treePanel.setName("Tree"); |
---|
| 390 | + |
---|
| 391 | + editPanel = new cGridBag().setVertical(true); |
---|
| 392 | + editPanel.setName("Edit"); |
---|
| 393 | + |
---|
330 | 394 | ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout()); |
---|
331 | | - 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 | + |
---|
332 | 403 | materialPanel = new cGridBag().setVertical(true); |
---|
333 | 404 | materialPanel.setName("Material"); |
---|
| 405 | + |
---|
334 | 406 | /*JTextPane*/ |
---|
335 | 407 | infoarea = createTextPane(); |
---|
336 | 408 | doc = infoarea.getStyledDocument(); |
---|
.. | .. |
---|
603 | 675 | |
---|
604 | 676 | boolean maximized; |
---|
605 | 677 | |
---|
| 678 | + cButton fullscreenLayout; |
---|
| 679 | + |
---|
606 | 680 | void Minimize() |
---|
607 | 681 | { |
---|
608 | 682 | frame.setState(Frame.ICONIFIED); |
---|
.. | .. |
---|
664 | 738 | // X frame.getContentPane().add(/*"Center",*/bigThree); |
---|
665 | 739 | framePanel.setDividerLocation(0); |
---|
666 | 740 | |
---|
667 | | - radio.layout = twoButton; |
---|
| 741 | + radio.layout = fullscreenLayout; |
---|
668 | 742 | radio.layout.doClick(); |
---|
669 | 743 | //frame.setVisible(true); |
---|
670 | 744 | } |
---|
.. | .. |
---|
819 | 893 | JButton fasterButton; |
---|
820 | 894 | JButton remarkButton; |
---|
821 | 895 | |
---|
| 896 | + cGridBag editPanel; |
---|
| 897 | + cGridBag editCommandsPanel; |
---|
| 898 | + |
---|
822 | 899 | cGridBag namePanel; |
---|
823 | 900 | cGridBag setupPanel; |
---|
824 | 901 | cGridBag setupPanel2; |
---|
825 | | - cGridBag commandsPanel; |
---|
| 902 | + cGridBag objectCommandsPanel; |
---|
826 | 903 | cGridBag pushPanel; |
---|
827 | 904 | cGridBag fillPanel; |
---|
828 | 905 | |
---|
.. | .. |
---|
1035 | 1112 | oe.ctrlPanel.add(setupPanel2); |
---|
1036 | 1113 | oe.ctrlPanel.Return(); |
---|
1037 | 1114 | |
---|
1038 | | - commandsPanel = new cGridBag().setVertical(false); |
---|
| 1115 | + objectCommandsPanel = new cGridBag().setVertical(false); |
---|
1039 | 1116 | |
---|
1040 | | - resetButton = AddButton(commandsPanel, "Reset"); |
---|
| 1117 | + resetButton = AddButton(objectCommandsPanel, "Reset"); |
---|
1041 | 1118 | resetButton.setToolTipText("Jump to frame zero"); |
---|
1042 | | - stepButton = AddButton(commandsPanel, "Step"); |
---|
| 1119 | + stepButton = AddButton(objectCommandsPanel, "Step"); |
---|
1043 | 1120 | stepButton.setToolTipText("Step one frame"); |
---|
1044 | 1121 | // resetAllButton = AddButton(oe, "Reset All"); |
---|
1045 | 1122 | // stepAllButton = AddButton(oe, "Step All"); |
---|
1046 | 1123 | // Return(); |
---|
1047 | | - slowerButton = AddButton(commandsPanel, "Slow"); |
---|
| 1124 | + slowerButton = AddButton(objectCommandsPanel, "Slow"); |
---|
1048 | 1125 | slowerButton.setToolTipText("Decrease animation speed"); |
---|
1049 | | - fasterButton = AddButton(commandsPanel, "Fast"); |
---|
| 1126 | + fasterButton = AddButton(objectCommandsPanel, "Fast"); |
---|
1050 | 1127 | fasterButton.setToolTipText("Increase animation speed"); |
---|
1051 | | - remarkButton = AddButton(commandsPanel, "Remark"); |
---|
| 1128 | + remarkButton = AddButton(objectCommandsPanel, "Remark"); |
---|
1052 | 1129 | remarkButton.setToolTipText("Set the current transform as the target"); |
---|
1053 | 1130 | |
---|
1054 | | - oe.ctrlPanel.add(commandsPanel); |
---|
| 1131 | + oe.ctrlPanel.add(objectCommandsPanel); |
---|
1055 | 1132 | oe.ctrlPanel.Return(); |
---|
1056 | 1133 | |
---|
1057 | 1134 | pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons |
---|
.. | .. |
---|
1335 | 1412 | |
---|
1336 | 1413 | //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); |
---|
1337 | 1414 | //tmp.setName("Edit"); |
---|
| 1415 | + objectPanel.add(toolboxPanel); |
---|
1338 | 1416 | objectPanel.add(materialPanel); |
---|
1339 | 1417 | // JPanel north = new JPanel(new BorderLayout()); |
---|
1340 | 1418 | // north.setName("Edit"); |
---|
1341 | 1419 | // north.add(ctrlPanel, BorderLayout.NORTH); |
---|
1342 | 1420 | // objectPanel.add(north); |
---|
1343 | | - objectPanel.add(ctrlPanel); |
---|
| 1421 | + objectPanel.add(editPanel); |
---|
1344 | 1422 | objectPanel.add(infoPanel); |
---|
1345 | 1423 | |
---|
1346 | 1424 | /* |
---|
.. | .. |
---|
3396 | 3474 | |
---|
3397 | 3475 | public void Save() |
---|
3398 | 3476 | { |
---|
| 3477 | + System.err.println("Save"); |
---|
| 3478 | + |
---|
3399 | 3479 | cRadio tab = GetCurrentTab(); |
---|
3400 | 3480 | |
---|
3401 | 3481 | boolean temp = CameraPane.SWITCH; |
---|
.. | .. |
---|
3480 | 3560 | |
---|
3481 | 3561 | public void Undo() |
---|
3482 | 3562 | { |
---|
| 3563 | + System.err.println("Undo"); |
---|
| 3564 | + |
---|
3483 | 3565 | cRadio tab = GetCurrentTab(); |
---|
3484 | 3566 | |
---|
3485 | 3567 | if (tab.undoindex == 0) |
---|
.. | .. |
---|
3663 | 3745 | assert false; |
---|
3664 | 3746 | } |
---|
3665 | 3747 | |
---|
3666 | | - void EditSelection() |
---|
| 3748 | + void EditSelection(boolean newWindow) |
---|
3667 | 3749 | { |
---|
3668 | 3750 | } |
---|
3669 | 3751 | |
---|
.. | .. |
---|
4158 | 4240 | |
---|
4159 | 4241 | void makeSomething(Object3D thing, boolean resetmodel) // deselect) |
---|
4160 | 4242 | { |
---|
4161 | | - Save(); |
---|
| 4243 | + if (Globals.SAVEONMAKE) // && resetmodel) |
---|
| 4244 | + Save(); |
---|
4162 | 4245 | //Tween.set(thing, 0).target(1).start(tweenManager); |
---|
4163 | 4246 | //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager); |
---|
4164 | 4247 | // if (thing instanceof GenericJointDemo) |
---|
.. | .. |
---|
4245 | 4328 | { |
---|
4246 | 4329 | ResetModel(); |
---|
4247 | 4330 | Select(thing.GetTreePath(), true, false); // unselect... false); |
---|
| 4331 | + |
---|
| 4332 | + if (thing.Size() == 0) |
---|
| 4333 | + { |
---|
| 4334 | + //EditSelection(false); |
---|
| 4335 | + } |
---|
| 4336 | + |
---|
4248 | 4337 | refreshContents(); |
---|
4249 | 4338 | } |
---|
4250 | 4339 | |
---|
.. | .. |
---|
4467 | 4556 | |
---|
4468 | 4557 | if (readobj != null) |
---|
4469 | 4558 | { |
---|
| 4559 | + if (Globals.SAVEONMAKE) |
---|
4470 | 4560 | Save(); |
---|
4471 | 4561 | try |
---|
4472 | 4562 | { |
---|
.. | .. |
---|
4838 | 4928 | CheckboxMenuItem togglePaintItem; |
---|
4839 | 4929 | JSplitPane mainPanel; |
---|
4840 | 4930 | JScrollPane scrollpane; |
---|
| 4931 | + |
---|
4841 | 4932 | JPanel toolbarPanel; |
---|
| 4933 | + |
---|
4842 | 4934 | cGridBag treePanel; |
---|
| 4935 | + |
---|
4843 | 4936 | JPanel radioPanel; |
---|
4844 | 4937 | ButtonGroup buttonGroup; |
---|
4845 | | - cGridBag ctrlPanel; |
---|
| 4938 | + |
---|
| 4939 | + cGridBag toolboxPanel; |
---|
4846 | 4940 | cGridBag materialPanel; |
---|
| 4941 | + cGridBag ctrlPanel; |
---|
| 4942 | + |
---|
4847 | 4943 | JScrollPane infoPanel; |
---|
| 4944 | + |
---|
4848 | 4945 | cGridBag optionsPanel; |
---|
| 4946 | + |
---|
4849 | 4947 | JTabbedPane objectPanel; |
---|
| 4948 | + |
---|
4850 | 4949 | cGridBag XYZPanel; |
---|
| 4950 | + |
---|
4851 | 4951 | JSplitPane gridPanel; |
---|
4852 | 4952 | JSplitPane bigPanel; |
---|
| 4953 | + |
---|
4853 | 4954 | cGridBag bigThree; |
---|
4854 | 4955 | cGridBag scenePanel; |
---|
4855 | 4956 | cGridBag centralPanel; |
---|
.. | .. |
---|
4964 | 5065 | cNumberSlider fogField; |
---|
4965 | 5066 | JLabel opacityPowerLabel; |
---|
4966 | 5067 | cNumberSlider opacityPowerField; |
---|
4967 | | - JTree jTree; |
---|
| 5068 | + cTree jTree; |
---|
4968 | 5069 | //ObjectUI parent; |
---|
4969 | 5070 | |
---|
4970 | 5071 | cNumberSlider normalpushField; |
---|