.. | .. |
---|
15 | 15 | //import javax.swing.plaf.ColorUIResource; |
---|
16 | 16 | //import javax.swing.plaf.metal.DefaultMetalTheme; |
---|
17 | 17 | |
---|
| 18 | +import javax.swing.plaf.basic.BasicSplitPaneDivider; |
---|
| 19 | +import javax.swing.plaf.basic.BasicSplitPaneUI; |
---|
| 20 | + |
---|
18 | 21 | //import javax.media.opengl.GLCanvas; |
---|
19 | 22 | |
---|
20 | 23 | import //weka.core. |
---|
.. | .. |
---|
41 | 44 | |
---|
42 | 45 | cButton GetButton(String name, boolean border) |
---|
43 | 46 | { |
---|
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 | | - } |
---|
| 47 | + ImageIcon icon = GetIcon(name); |
---|
| 48 | + return new cButton(icon, border); |
---|
53 | 49 | } |
---|
54 | 50 | |
---|
55 | 51 | cToggleButton GetToggleButton(String name, boolean border) |
---|
56 | 52 | { |
---|
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 | | - } |
---|
| 53 | + ImageIcon icon = GetIcon(name); |
---|
| 54 | + return new cToggleButton(icon, border); |
---|
66 | 55 | } |
---|
67 | 56 | |
---|
68 | 57 | cCheckBox GetCheckBox(String name, boolean border) |
---|
69 | 58 | { |
---|
| 59 | + ImageIcon icon = GetIcon(name); |
---|
| 60 | + return new cCheckBox(icon, border); |
---|
| 61 | + } |
---|
| 62 | + |
---|
| 63 | + private ImageIcon GetIcon(String name) |
---|
| 64 | + { |
---|
70 | 65 | try |
---|
71 | 66 | { |
---|
72 | | - ImageIcon icon = GetIcon(name); |
---|
73 | | - return new cCheckBox(icon, border); |
---|
| 67 | + BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name)); |
---|
| 68 | + |
---|
| 69 | + if (image.getWidth() != 24 && image.getHeight() != 24) |
---|
| 70 | + { |
---|
| 71 | + BufferedImage resized = new BufferedImage(24, 24, image.getType()); |
---|
| 72 | + Graphics2D g = resized.createGraphics(); |
---|
| 73 | + g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); |
---|
| 74 | + //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); |
---|
| 75 | + g.drawImage(image, 0, 0, 24, 24, 0, 0, image.getWidth(), image.getHeight(), null); |
---|
| 76 | + g.dispose(); |
---|
| 77 | + |
---|
| 78 | + image = resized; |
---|
| 79 | + } |
---|
| 80 | + |
---|
| 81 | + javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image); |
---|
| 82 | + return icon; |
---|
74 | 83 | } |
---|
75 | 84 | catch (Exception e) |
---|
76 | 85 | { |
---|
77 | | - return new cCheckBox(name, border); |
---|
| 86 | + return null; |
---|
78 | 87 | } |
---|
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 | 88 | } |
---|
100 | 89 | |
---|
101 | 90 | // SCRIPT |
---|
.. | .. |
---|
207 | 196 | |
---|
208 | 197 | objEditor.ctrlPanel.remove(namePanel); |
---|
209 | 198 | |
---|
210 | | - if (!GroupEditor.allparams) |
---|
| 199 | + if (!allparams) |
---|
211 | 200 | return; |
---|
212 | 201 | |
---|
213 | 202 | // objEditor.ctrlPanel.remove(liveCB); |
---|
.. | .. |
---|
279 | 268 | client = inClient; |
---|
280 | 269 | copy = client; |
---|
281 | 270 | |
---|
| 271 | + if (copy.versions == null) |
---|
| 272 | + { |
---|
| 273 | + copy.versions = new byte[100][]; |
---|
| 274 | + copy.versionindex = -1; |
---|
| 275 | + } |
---|
| 276 | + |
---|
282 | 277 | // "this" is not called: SetupUI2(objEditor); |
---|
283 | 278 | } |
---|
284 | 279 | |
---|
.. | .. |
---|
292 | 287 | client = inClient; |
---|
293 | 288 | copy = client; |
---|
294 | 289 | |
---|
| 290 | + if (copy.versions == null) |
---|
| 291 | + { |
---|
| 292 | + copy.versions = new byte[100][]; |
---|
| 293 | + copy.versionindex = -1; |
---|
| 294 | + } |
---|
| 295 | + |
---|
295 | 296 | SetupUI2(callee.GetEditor()); |
---|
296 | 297 | } |
---|
297 | 298 | |
---|
.. | .. |
---|
306 | 307 | //localCopy.parent = null; |
---|
307 | 308 | |
---|
308 | 309 | frame = new JFrame(); |
---|
309 | | - frame.setUndecorated(true); |
---|
| 310 | + frame.setUndecorated(false); |
---|
310 | 311 | objEditor = this; |
---|
311 | 312 | this.callee = callee; |
---|
312 | 313 | |
---|
.. | .. |
---|
324 | 325 | copy = localCopy; |
---|
325 | 326 | copy.editWindow = this; |
---|
326 | 327 | |
---|
| 328 | + if (copy.versions == null) |
---|
| 329 | + { |
---|
| 330 | +// copy.versions = new byte[100][]; |
---|
| 331 | +// copy.versionindex = -1; |
---|
| 332 | + } |
---|
| 333 | + |
---|
327 | 334 | SetupMenu(); |
---|
328 | 335 | |
---|
329 | 336 | //SetupName(objEditor); // new |
---|
.. | .. |
---|
337 | 344 | return frame.action(event, obj); |
---|
338 | 345 | } |
---|
339 | 346 | |
---|
| 347 | + // Cannot work without static |
---|
| 348 | + static boolean allparams = true; |
---|
| 349 | + |
---|
| 350 | + static java.util.Vector<Object3D> listUI = new java.util.Vector<Object3D>(); |
---|
| 351 | + |
---|
340 | 352 | void SetupMenu() |
---|
341 | 353 | { |
---|
342 | 354 | frame.setMenuBar(menuBar = new MenuBar()); |
---|
343 | 355 | menuBar.add(fileMenu = new Menu("File")); |
---|
344 | 356 | fileMenu.add(newItem = new MenuItem("New")); |
---|
345 | | - fileMenu.add(loadItem = new MenuItem("Open...")); |
---|
| 357 | + fileMenu.add(openItem = new MenuItem("Open...")); |
---|
346 | 358 | |
---|
347 | 359 | //oe.menuBar.add(menu = new Menu("Include")); |
---|
348 | 360 | Menu menu = new Menu("Import"); |
---|
.. | .. |
---|
374 | 386 | } |
---|
375 | 387 | |
---|
376 | 388 | newItem.addActionListener(this); |
---|
377 | | - loadItem.addActionListener(this); |
---|
| 389 | + openItem.addActionListener(this); |
---|
378 | 390 | saveItem.addActionListener(this); |
---|
379 | 391 | saveAsItem.addActionListener(this); |
---|
380 | 392 | exportAsItem.addActionListener(this); |
---|
.. | .. |
---|
398 | 410 | // |
---|
399 | 411 | // materialFlushed = true; |
---|
400 | 412 | // } |
---|
| 413 | +// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Edit")) |
---|
| 414 | +// { |
---|
| 415 | +// if (listUI.size() == 0) |
---|
| 416 | +// EditSelection(false); |
---|
| 417 | +// } |
---|
401 | 418 | |
---|
402 | 419 | refreshContents(false); // To refresh Info tab |
---|
403 | 420 | } |
---|
.. | .. |
---|
406 | 423 | |
---|
407 | 424 | toolbarPanel = new JPanel(); |
---|
408 | 425 | toolbarPanel.setName("Toolbar"); |
---|
| 426 | + |
---|
409 | 427 | treePanel = new cGridBag(); |
---|
410 | 428 | treePanel.setName("Tree"); |
---|
411 | 429 | |
---|
412 | 430 | editPanel = new cGridBag().setVertical(true); |
---|
413 | | - editPanel.setName("Edit"); |
---|
| 431 | + //editPanel.setName("Edit"); |
---|
414 | 432 | |
---|
415 | 433 | ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout()); |
---|
416 | 434 | |
---|
.. | .. |
---|
419 | 437 | editPanel.add(ctrlPanel); |
---|
420 | 438 | |
---|
421 | 439 | toolboxPanel = new cGridBag().setVertical(false); |
---|
422 | | - toolboxPanel.setName("Toolbox"); |
---|
| 440 | + //toolboxPanel.setName("Toolbox"); |
---|
423 | 441 | |
---|
424 | 442 | materialPanel = new cGridBag().setVertical(true); |
---|
425 | | - materialPanel.setName("Material"); |
---|
| 443 | + //materialPanel.setName("Material"); |
---|
426 | 444 | |
---|
427 | 445 | /*JTextPane*/ |
---|
428 | 446 | infoarea = createTextPane(); |
---|
.. | .. |
---|
430 | 448 | |
---|
431 | 449 | infoarea.setEditable(true); |
---|
432 | 450 | SetText(); |
---|
| 451 | + |
---|
433 | 452 | // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f)); |
---|
434 | 453 | // infoarea.setOpaque(false); |
---|
435 | 454 | // //infoarea.setForeground(textcolor); |
---|
436 | 455 | // TEXTAREA infoarea.setLineWrap(true); |
---|
437 | 456 | // TEXTAREA infoarea.setWrapStyleWord(true); |
---|
438 | 457 | infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED); |
---|
439 | | - infoPanel.setPreferredSize(new Dimension(50, 200)); |
---|
440 | | - infoPanel.setName("Info"); |
---|
| 458 | + infoPanel.setPreferredSize(new Dimension(1, 1)); |
---|
| 459 | + //infoPanel.setName("Info"); |
---|
441 | 460 | //infoPanel.setLayout(new BorderLayout()); |
---|
442 | 461 | //infoPanel.add(createTextPane()); |
---|
443 | 462 | |
---|
.. | .. |
---|
448 | 467 | mainPanel.setDividerSize(9); |
---|
449 | 468 | mainPanel.setDividerLocation(0.5); //1.0); |
---|
450 | 469 | mainPanel.setResizeWeight(0.5); |
---|
451 | | - |
---|
| 470 | + |
---|
| 471 | +//mainPanel.setDividerSize((int) (mainPanel.getDividerSize() * 1.5)); |
---|
| 472 | + BasicSplitPaneDivider divider = ( (BasicSplitPaneUI) mainPanel.getUI()).getDivider(); |
---|
| 473 | + divider.setDividerSize(15); |
---|
| 474 | + divider.setBorder(BorderFactory.createTitledBorder(divider.getBorder(), "Custom border title -- gets rid of the one-touch arrows!")); |
---|
| 475 | + |
---|
| 476 | + mainPanel.setUI(new BasicSplitPaneUI()); |
---|
| 477 | + |
---|
452 | 478 | //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5)); |
---|
453 | 479 | //mainPanel.setLayout(new GridBagLayout()); |
---|
454 | 480 | toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); |
---|
.. | .. |
---|
679 | 705 | } |
---|
680 | 706 | } |
---|
681 | 707 | |
---|
682 | | -static GraphicsDevice device = GraphicsEnvironment |
---|
683 | | - .getLocalGraphicsEnvironment().getScreenDevices()[0]; |
---|
| 708 | +//static GraphicsDevice device = GraphicsEnvironment |
---|
| 709 | +// .getLocalGraphicsEnvironment().getScreenDevices()[0]; |
---|
684 | 710 | |
---|
685 | 711 | Rectangle keeprect; |
---|
686 | 712 | cRadio radio; |
---|
.. | .. |
---|
701 | 727 | void Minimize() |
---|
702 | 728 | { |
---|
703 | 729 | frame.setState(Frame.ICONIFIED); |
---|
| 730 | + frame.validate(); |
---|
704 | 731 | } |
---|
705 | 732 | |
---|
| 733 | +// artifactURI=null, type=0, property=${file.reference.jfxrt.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@6767876f, broken=false, additional={} |
---|
| 734 | +// artifactURI=null, type=0, property=${file.reference.mac-ui.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@16bdc817, broken=false, additional={} |
---|
| 735 | +// artifactURI=null, type=0, property=${file.reference.classes.jar}, object=org.netbeans.modules.java.api.common.classpath.ClassPathSupport$RelativePath@9daa9c17, broken=false, additional={} |
---|
706 | 736 | void Maximize() |
---|
707 | 737 | { |
---|
| 738 | + if (CameraPane.FULLSCREEN) |
---|
| 739 | + { |
---|
| 740 | + ToggleFullScreen(); |
---|
| 741 | + } |
---|
| 742 | + |
---|
708 | 743 | if (maximized) |
---|
709 | 744 | { |
---|
710 | 745 | frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height); |
---|
.. | .. |
---|
712 | 747 | else |
---|
713 | 748 | { |
---|
714 | 749 | keeprect = frame.getBounds(); |
---|
715 | | - Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); |
---|
716 | | - Dimension rect2 = frame.getToolkit().getScreenSize(); |
---|
717 | | - frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height); |
---|
| 750 | +// Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); |
---|
| 751 | +// Dimension rect2 = frame.getToolkit().getScreenSize(); |
---|
| 752 | +// frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height); |
---|
718 | 753 | // frame.setState(Frame.MAXIMIZED_BOTH); |
---|
| 754 | + frame.setBounds(frame.getGraphicsConfiguration().getBounds()); |
---|
719 | 755 | } |
---|
720 | 756 | |
---|
721 | 757 | maximized ^= true; |
---|
| 758 | + |
---|
| 759 | + frame.validate(); |
---|
722 | 760 | } |
---|
| 761 | + |
---|
| 762 | + cButton minButton; |
---|
| 763 | + cButton maxButton; |
---|
| 764 | + cButton fullButton; |
---|
723 | 765 | |
---|
724 | 766 | void ToggleFullScreen() |
---|
725 | 767 | { |
---|
726 | | - if (CameraPane.FULLSCREEN) |
---|
| 768 | +GraphicsDevice device = frame.getGraphicsConfiguration().getDevice(); |
---|
| 769 | + |
---|
| 770 | + cameraView.ToggleFullScreen(); |
---|
| 771 | + |
---|
| 772 | + if (!CameraPane.FULLSCREEN) |
---|
727 | 773 | { |
---|
728 | 774 | device.setFullScreenWindow(null); |
---|
| 775 | + frame.dispose(); |
---|
| 776 | + frame.setUndecorated(false); |
---|
| 777 | + frame.validate(); |
---|
| 778 | + frame.setVisible(true); |
---|
| 779 | + |
---|
729 | 780 | //frame.setVisible(false); |
---|
730 | 781 | // frame.removeNotify(); |
---|
731 | 782 | // frame.setUndecorated(false); |
---|
.. | .. |
---|
735 | 786 | // X frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
736 | 787 | // X framePanel.add(bigThree); |
---|
737 | 788 | // X frame.getContentPane().add(/*"Center",*/framePanel); |
---|
738 | | - framePanel.setDividerLocation(1); |
---|
| 789 | + framePanel.setDividerLocation(46); |
---|
739 | 790 | |
---|
740 | 791 | //frame.setVisible(true); |
---|
741 | 792 | radio.layout = keepButton; |
---|
.. | .. |
---|
750 | 801 | // frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width, |
---|
751 | 802 | // frame.getToolkit().getScreenSize().height); |
---|
752 | 803 | //frame.setVisible(false); |
---|
| 804 | + |
---|
| 805 | + frame.dispose(); |
---|
| 806 | + frame.setUndecorated(true); |
---|
753 | 807 | device.setFullScreenWindow(frame); |
---|
| 808 | + frame.validate(); |
---|
| 809 | + frame.setVisible(true); |
---|
754 | 810 | // frame.removeNotify(); |
---|
755 | 811 | // frame.setUndecorated(true); |
---|
756 | 812 | // frame.addNotify(); |
---|
.. | .. |
---|
763 | 819 | radio.layout.doClick(); |
---|
764 | 820 | //frame.setVisible(true); |
---|
765 | 821 | } |
---|
766 | | - |
---|
767 | | - cameraView.ToggleFullScreen(); |
---|
| 822 | + frame.validate(); |
---|
768 | 823 | } |
---|
| 824 | + |
---|
| 825 | + private byte[] CompressCopy() |
---|
| 826 | + { |
---|
| 827 | + boolean temp = CameraPane.SWITCH; |
---|
| 828 | + CameraPane.SWITCH = false; |
---|
| 829 | + |
---|
| 830 | + copy.ExtractBigData(versiontable); |
---|
| 831 | + // if (copy == client) |
---|
| 832 | + |
---|
| 833 | + byte[] versions[] = copy.versions; |
---|
| 834 | + copy.versions = null; |
---|
| 835 | + |
---|
| 836 | + byte[] compress = Compress(copy); |
---|
| 837 | + |
---|
| 838 | + copy.versions = versions; |
---|
| 839 | + |
---|
| 840 | + copy.RestoreBigData(versiontable); |
---|
| 841 | + |
---|
| 842 | + CameraPane.SWITCH = temp; |
---|
| 843 | + |
---|
| 844 | + return compress; |
---|
| 845 | + } |
---|
769 | 846 | |
---|
770 | 847 | private JTextPane createTextPane() |
---|
771 | 848 | { |
---|
.. | .. |
---|
897 | 974 | // NumberSlider vDivsField; |
---|
898 | 975 | // JCheckBox endcaps; |
---|
899 | 976 | JCheckBox liveCB; |
---|
900 | | - JCheckBox selectCB; |
---|
| 977 | + JCheckBox selectableCB; |
---|
901 | 978 | JCheckBox hideCB; |
---|
902 | 979 | JCheckBox link2masterCB; |
---|
903 | 980 | JCheckBox markCB; |
---|
.. | .. |
---|
1097 | 1174 | namePanel = new cGridBag(); |
---|
1098 | 1175 | |
---|
1099 | 1176 | nameField = AddText(namePanel, copy.GetName()); |
---|
1100 | | - namePanel.add(nameField); |
---|
| 1177 | + namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER)); |
---|
1101 | 1178 | oe.ctrlPanel.add(namePanel); |
---|
1102 | 1179 | |
---|
1103 | 1180 | oe.ctrlPanel.Return(); |
---|
1104 | 1181 | |
---|
1105 | | - if (!GroupEditor.allparams) |
---|
| 1182 | + if (!allparams) |
---|
1106 | 1183 | return; |
---|
1107 | 1184 | |
---|
1108 | 1185 | setupPanel = new cGridBag().setVertical(false); |
---|
1109 | 1186 | |
---|
1110 | 1187 | liveCB = AddCheckBox(setupPanel, "Live", copy.live); |
---|
1111 | 1188 | liveCB.setToolTipText("Animate object"); |
---|
1112 | | - selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect); |
---|
1113 | | - selectCB.setToolTipText("Make object selectable"); |
---|
| 1189 | + selectableCB = AddCheckBox(setupPanel, "Select", !copy.dontselect); |
---|
| 1190 | + selectableCB.setToolTipText("Make object selectable"); |
---|
1114 | 1191 | // Return(); |
---|
| 1192 | + |
---|
1115 | 1193 | hideCB = AddCheckBox(setupPanel, "Hide", copy.hide); |
---|
1116 | 1194 | hideCB.setToolTipText("Hide object"); |
---|
1117 | 1195 | markCB = AddCheckBox(setupPanel, "Mark", copy.marked); |
---|
1118 | | - markCB.setToolTipText("Set the animation target transform"); |
---|
| 1196 | + markCB.setToolTipText("As animation target transform"); |
---|
1119 | 1197 | |
---|
1120 | 1198 | setupPanel2 = new cGridBag().setVertical(false); |
---|
1121 | 1199 | |
---|
1122 | 1200 | rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind); |
---|
1123 | 1201 | rewindCB.setToolTipText("Rewind animation"); |
---|
1124 | 1202 | |
---|
1125 | | - randomCB = AddCheckBox(setupPanel2, "Rand", copy.random); |
---|
1126 | | - randomCB.setToolTipText("Randomly Rewind or Go back and forth"); |
---|
| 1203 | + randomCB = AddCheckBox(setupPanel2, "Random", copy.random); |
---|
| 1204 | + randomCB.setToolTipText("Randomly Rewind (or Go back and forth)"); |
---|
1127 | 1205 | |
---|
| 1206 | + link2masterCB = AddCheckBox(setupPanel2, "Support", copy.link2master); |
---|
| 1207 | + link2masterCB.setToolTipText("Attach to support"); |
---|
| 1208 | + |
---|
1128 | 1209 | if (Globals.ADVANCED) |
---|
1129 | 1210 | { |
---|
1130 | | - link2masterCB = AddCheckBox(setupPanel2, "Supp", copy.link2master); |
---|
1131 | | - link2masterCB.setToolTipText("Attach to support"); |
---|
1132 | 1211 | speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup); |
---|
1133 | 1212 | speedupCB.setToolTipText("Option motion capture"); |
---|
1134 | 1213 | } |
---|
.. | .. |
---|
1402 | 1481 | XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll); |
---|
1403 | 1482 | XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll); |
---|
1404 | 1483 | XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll); |
---|
| 1484 | + //XYZPanel.setName("XYZ"); |
---|
1405 | 1485 | |
---|
1406 | 1486 | /* |
---|
1407 | 1487 | gridPanel = new JPanel(); //new BorderLayout()); |
---|
.. | .. |
---|
1439 | 1519 | //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); |
---|
1440 | 1520 | //tmp.setName("Edit"); |
---|
1441 | 1521 | objectPanel.add(materialPanel); |
---|
1442 | | - objectPanel.add(toolboxPanel); |
---|
| 1522 | + objectPanel.setIconAt(0, GetIcon("icons/material.png")); |
---|
1443 | 1523 | // JPanel north = new JPanel(new BorderLayout()); |
---|
1444 | 1524 | // north.setName("Edit"); |
---|
1445 | 1525 | // north.add(ctrlPanel, BorderLayout.NORTH); |
---|
1446 | 1526 | // objectPanel.add(north); |
---|
1447 | 1527 | objectPanel.add(editPanel); |
---|
1448 | | - objectPanel.add(infoPanel); |
---|
| 1528 | + objectPanel.setIconAt(1, GetIcon("icons/write.png")); |
---|
| 1529 | + |
---|
| 1530 | + //if (Globals.ADVANCED) |
---|
| 1531 | + objectPanel.add(infoPanel); |
---|
| 1532 | + objectPanel.setIconAt(2, GetIcon("icons/info.png")); |
---|
| 1533 | + |
---|
| 1534 | + objectPanel.add(XYZPanel); |
---|
| 1535 | + objectPanel.setIconAt(3, GetIcon("icons/XYZ.png")); |
---|
| 1536 | + |
---|
| 1537 | + objectPanel.add(toolboxPanel); |
---|
| 1538 | + objectPanel.setIconAt(4, GetIcon("icons/primitives.png")); |
---|
1449 | 1539 | |
---|
1450 | 1540 | /* |
---|
1451 | 1541 | aConstraints.gridx = 0; |
---|
.. | .. |
---|
1454 | 1544 | aConstraints.gridy += 1; |
---|
1455 | 1545 | aConstraints.gridwidth = 1; |
---|
1456 | 1546 | mainPanel.add(objectPanel, aConstraints); |
---|
1457 | | - */ |
---|
| 1547 | + */ |
---|
1458 | 1548 | |
---|
1459 | 1549 | scrollpane = new JScrollPane(mainPanel, ScrollPaneConstants.// VERTICAL_SCROLLBAR_ALWAYS, |
---|
1460 | 1550 | VERTICAL_SCROLLBAR_AS_NEEDED, |
---|
.. | .. |
---|
1466 | 1556 | scrollpane.addMouseWheelListener(this); // Default not fast enough |
---|
1467 | 1557 | |
---|
1468 | 1558 | /*JTabbedPane*/ scenePanel = new cGridBag(); |
---|
1469 | | - scenePanel.preferredWidth = 6; |
---|
| 1559 | + scenePanel.preferredWidth = 5; |
---|
1470 | 1560 | |
---|
1471 | 1561 | JTabbedPane tabbedPane = new JTabbedPane(); |
---|
1472 | 1562 | tabbedPane.add(scrollpane); |
---|
.. | .. |
---|
1542 | 1632 | /**/ |
---|
1543 | 1633 | |
---|
1544 | 1634 | bigThree = new cGridBag(); |
---|
1545 | | - bigThree.addComponent(scenePanel); |
---|
1546 | 1635 | bigThree.addComponent(centralPanel); |
---|
1547 | | - bigThree.addComponent(XYZPanel); |
---|
| 1636 | + bigThree.addComponent(scenePanel); |
---|
| 1637 | + //bigThree.addComponent(XYZPanel); |
---|
1548 | 1638 | |
---|
1549 | 1639 | // // SIDE EFFECT!!! |
---|
1550 | 1640 | // aConstraints.gridx = 0; |
---|
.. | .. |
---|
1553 | 1643 | // aConstraints.gridheight = 1; |
---|
1554 | 1644 | |
---|
1555 | 1645 | framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree); |
---|
1556 | | - framePanel.setContinuousLayout(true); |
---|
1557 | | - framePanel.setOneTouchExpandable(true); |
---|
1558 | | - framePanel.setDividerLocation(0.8); |
---|
| 1646 | + framePanel.setContinuousLayout(false); |
---|
| 1647 | + framePanel.setOneTouchExpandable(false); |
---|
| 1648 | + //.setDividerLocation(0.8); |
---|
1559 | 1649 | //framePanel.setDividerSize(15); |
---|
1560 | 1650 | //framePanel.setResizeWeight(0.15); |
---|
1561 | 1651 | framePanel.setName("Frame"); |
---|
.. | .. |
---|
1574 | 1664 | |
---|
1575 | 1665 | frame.setSize(1280, 860); |
---|
1576 | 1666 | |
---|
1577 | | - frame.validate(); |
---|
1578 | | - frame.setVisible(true); |
---|
1579 | | - |
---|
1580 | 1667 | cameraView.requestFocusInWindow(); |
---|
1581 | 1668 | |
---|
1582 | 1669 | gridPanel.setDividerLocation(1.0); |
---|
| 1670 | + |
---|
| 1671 | + frame.validate(); |
---|
| 1672 | + |
---|
| 1673 | + frame.setVisible(true); |
---|
1583 | 1674 | |
---|
1584 | 1675 | frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); |
---|
1585 | 1676 | frame.addWindowListener(new WindowAdapter() |
---|
.. | .. |
---|
1666 | 1757 | texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1667 | 1758 | colorSection.add(texture); |
---|
1668 | 1759 | |
---|
1669 | | - cGridBag anisoU = new cGridBag(); |
---|
1670 | | - anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints); |
---|
1671 | | - anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1672 | | - anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1673 | | - colorSection.add(anisoU); |
---|
1674 | | - |
---|
1675 | | - cGridBag anisoV = new cGridBag(); |
---|
1676 | | - anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints); |
---|
1677 | | - anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1678 | | - anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1679 | | - colorSection.add(anisoV); |
---|
1680 | | - |
---|
1681 | | - cGridBag shadowbias = new cGridBag(); |
---|
1682 | | - shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints); |
---|
1683 | | - shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1684 | | - shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1685 | | - colorSection.add(shadowbias); |
---|
1686 | | - |
---|
1687 | 1760 | panel.add(new JSeparator()); |
---|
1688 | 1761 | |
---|
1689 | 1762 | panel.add(colorSection); |
---|
.. | .. |
---|
1733 | 1806 | fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1734 | 1807 | fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1735 | 1808 | diffuseSection.add(fakedepth); |
---|
| 1809 | + |
---|
| 1810 | + cGridBag shadowbias = new cGridBag(); |
---|
| 1811 | + shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints); |
---|
| 1812 | + shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1813 | + shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
| 1814 | + diffuseSection.add(shadowbias); |
---|
1736 | 1815 | |
---|
1737 | 1816 | panel.add(new JSeparator()); |
---|
1738 | 1817 | |
---|
.. | .. |
---|
1784 | 1863 | // aConstraints.gridy += 1; |
---|
1785 | 1864 | // aConstraints.gridwidth = 1; |
---|
1786 | 1865 | |
---|
| 1866 | + cGridBag anisoU = new cGridBag(); |
---|
| 1867 | + anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints); |
---|
| 1868 | + anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1869 | + anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 1870 | + specularSection.add(anisoU); |
---|
| 1871 | + |
---|
| 1872 | + cGridBag anisoV = new cGridBag(); |
---|
| 1873 | + anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints); |
---|
| 1874 | + anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1875 | + anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 1876 | + specularSection.add(anisoV); |
---|
| 1877 | + |
---|
1787 | 1878 | |
---|
1788 | 1879 | panel.add(new JSeparator()); |
---|
1789 | 1880 | |
---|
.. | .. |
---|
1791 | 1882 | |
---|
1792 | 1883 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1793 | 1884 | |
---|
1794 | | - cGridBag globalSection = new cGridBag().setVertical(true); |
---|
| 1885 | + //cGridBag globalSection = new cGridBag().setVertical(true); |
---|
1795 | 1886 | |
---|
1796 | 1887 | cGridBag camera = new cGridBag(); |
---|
1797 | 1888 | camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints); |
---|
1798 | 1889 | cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1799 | 1890 | camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1800 | | - globalSection.add(camera); |
---|
| 1891 | + colorSection.add(camera); |
---|
1801 | 1892 | |
---|
1802 | 1893 | cGridBag ambient = new cGridBag(); |
---|
1803 | 1894 | ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints); |
---|
1804 | 1895 | ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1805 | 1896 | ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1806 | | - globalSection.add(ambient); |
---|
| 1897 | + colorSection.add(ambient); |
---|
1807 | 1898 | |
---|
1808 | 1899 | cGridBag backlit = new cGridBag(); |
---|
1809 | 1900 | backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints); |
---|
1810 | 1901 | backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1811 | 1902 | backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1812 | | - globalSection.add(backlit); |
---|
| 1903 | + colorSection.add(backlit); |
---|
1813 | 1904 | |
---|
1814 | 1905 | cGridBag opacity = new cGridBag(); |
---|
1815 | 1906 | opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints); |
---|
1816 | 1907 | opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1817 | 1908 | opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1818 | | - globalSection.add(opacity); |
---|
| 1909 | + colorSection.add(opacity); |
---|
1819 | 1910 | |
---|
1820 | | - panel.add(new JSeparator()); |
---|
| 1911 | + //panel.add(new JSeparator()); |
---|
1821 | 1912 | |
---|
1822 | | - panel.add(globalSection); |
---|
| 1913 | + //panel.add(globalSection); |
---|
1823 | 1914 | |
---|
1824 | 1915 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1825 | 1916 | |
---|
.. | .. |
---|
1926 | 2017 | // 3D models |
---|
1927 | 2018 | if (filename.endsWith(".3ds") || filename.endsWith(".3DS")) |
---|
1928 | 2019 | { |
---|
1929 | | - lastConverter = new com.jmex.model.converters.MaxToJme(); |
---|
1930 | | - LoadFile(filename, lastConverter); |
---|
| 2020 | + //lastConverter = new com.jmex.model.converters.MaxToJme(); |
---|
| 2021 | + //LoadFile(filename, lastConverter); |
---|
| 2022 | + LoadObjFile(filename); // New 3ds loader |
---|
1931 | 2023 | continue; |
---|
1932 | 2024 | } |
---|
1933 | 2025 | if (filename.endsWith(".dae") || filename.endsWith(".DAE")) |
---|
.. | .. |
---|
2653 | 2745 | LA.matXRotate(((Object3D) group.get(group.size() - 1)).toParent, -Math.PI / 2); |
---|
2654 | 2746 | LA.matXRotate(((Object3D) group.get(group.size() - 1)).fromParent, Math.PI / 2); |
---|
2655 | 2747 | } |
---|
| 2748 | + |
---|
2656 | 2749 | //cJME.count++; |
---|
2657 | 2750 | //cJME.count %= 12; |
---|
2658 | 2751 | if (gc) |
---|
.. | .. |
---|
2836 | 2929 | } |
---|
2837 | 2930 | } |
---|
2838 | 2931 | } |
---|
| 2932 | + |
---|
2839 | 2933 | cFileSystemPane FSPane; |
---|
2840 | 2934 | |
---|
2841 | 2935 | void SetMaterial(cMaterial mat, Object3D.cVector2[] others) |
---|
.. | .. |
---|
2889 | 2983 | } |
---|
2890 | 2984 | } |
---|
2891 | 2985 | } |
---|
| 2986 | + |
---|
2892 | 2987 | freezematerial = false; |
---|
2893 | 2988 | } |
---|
2894 | 2989 | |
---|
.. | .. |
---|
3007 | 3102 | // } |
---|
3008 | 3103 | |
---|
3009 | 3104 | /**/ |
---|
3010 | | - if (deselect) |
---|
| 3105 | + if (deselect || child == null) |
---|
3011 | 3106 | { |
---|
3012 | 3107 | //group.deselectAll(); |
---|
3013 | 3108 | //freeze = true; |
---|
3014 | 3109 | GetTree().clearSelection(); |
---|
3015 | 3110 | //freeze = false; |
---|
| 3111 | + |
---|
| 3112 | + if (child == null) |
---|
| 3113 | + { |
---|
| 3114 | + return; |
---|
| 3115 | + } |
---|
3016 | 3116 | } |
---|
3017 | 3117 | |
---|
3018 | 3118 | //group.addSelectee(child); |
---|
.. | .. |
---|
3151 | 3251 | { |
---|
3152 | 3252 | copy.live ^= true; |
---|
3153 | 3253 | return; |
---|
3154 | | - } else if (event.getSource() == selectCB) |
---|
| 3254 | + } else if (event.getSource() == selectableCB) |
---|
3155 | 3255 | { |
---|
3156 | 3256 | copy.dontselect ^= true; |
---|
3157 | 3257 | return; |
---|
.. | .. |
---|
3336 | 3436 | { |
---|
3337 | 3437 | Close(); |
---|
3338 | 3438 | //return true; |
---|
3339 | | - } else if (source == loadItem) |
---|
| 3439 | + } else if (source == openItem) |
---|
3340 | 3440 | { |
---|
3341 | | - load(); |
---|
| 3441 | + Open(); |
---|
3342 | 3442 | //return true; |
---|
3343 | 3443 | } else if (source == newItem) |
---|
3344 | 3444 | { |
---|
.. | .. |
---|
3363 | 3463 | { |
---|
3364 | 3464 | generatePOV(); |
---|
3365 | 3465 | //return true; |
---|
| 3466 | + } else if (event.getSource() == archiveItem) |
---|
| 3467 | + { |
---|
| 3468 | + cTools.Archive(frame); |
---|
| 3469 | + return; |
---|
3366 | 3470 | } else if (source == zBufferItem) |
---|
3367 | 3471 | { |
---|
3368 | 3472 | try |
---|
.. | .. |
---|
3414 | 3518 | try |
---|
3415 | 3519 | { |
---|
3416 | 3520 | ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
3417 | | - java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos); |
---|
3418 | | - ObjectOutputStream out = new ObjectOutputStream(zstream); |
---|
| 3521 | +// java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos); |
---|
| 3522 | + ObjectOutputStream out = new ObjectOutputStream(baos); //zstream); |
---|
3419 | 3523 | |
---|
3420 | 3524 | Object3D parent = o.parent; |
---|
3421 | 3525 | o.parent = null; |
---|
.. | .. |
---|
3426 | 3530 | |
---|
3427 | 3531 | out.flush(); |
---|
3428 | 3532 | |
---|
3429 | | - zstream.close(); |
---|
| 3533 | + baos //zstream |
---|
| 3534 | + .close(); |
---|
3430 | 3535 | out.close(); |
---|
3431 | 3536 | |
---|
3432 | | - return baos.toByteArray(); |
---|
| 3537 | + byte[] bytes = baos.toByteArray(); |
---|
| 3538 | + |
---|
| 3539 | + System.out.println("save #bytes = " + bytes.length); |
---|
| 3540 | + return bytes; |
---|
3433 | 3541 | } catch (Exception e) |
---|
3434 | 3542 | { |
---|
3435 | 3543 | System.err.println(e); |
---|
.. | .. |
---|
3439 | 3547 | |
---|
3440 | 3548 | static public Object Uncompress(byte[] bytes) |
---|
3441 | 3549 | { |
---|
3442 | | - System.out.println("#bytes = " + bytes.length); |
---|
| 3550 | + System.out.println("restore #bytes = " + bytes.length); |
---|
3443 | 3551 | try |
---|
3444 | 3552 | { |
---|
3445 | 3553 | ByteArrayInputStream bais = new ByteArrayInputStream(bytes); |
---|
3446 | | - java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais); |
---|
3447 | | - ObjectInputStream in = new ObjectInputStream(istream); |
---|
| 3554 | + //java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais); |
---|
| 3555 | + ObjectInputStream in = new ObjectInputStream(bais); // istream); |
---|
3448 | 3556 | Object obj = in.readObject(); |
---|
| 3557 | + |
---|
| 3558 | + bais //istream |
---|
| 3559 | + .close(); |
---|
3449 | 3560 | in.close(); |
---|
3450 | 3561 | |
---|
3451 | 3562 | return obj; |
---|
.. | .. |
---|
3500 | 3611 | return null; |
---|
3501 | 3612 | } |
---|
3502 | 3613 | |
---|
3503 | | - java.util.Hashtable<java.util.UUID, Object3D> hashtable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
3504 | 3614 | |
---|
3505 | 3615 | public void Save() |
---|
| 3616 | + { |
---|
| 3617 | + //Save(true); |
---|
| 3618 | + Replace(); |
---|
| 3619 | + } |
---|
| 3620 | + |
---|
| 3621 | + private boolean Equal(byte[] compress, byte[] name) |
---|
| 3622 | + { |
---|
| 3623 | + if (compress.length != name.length) |
---|
| 3624 | + { |
---|
| 3625 | + return false; |
---|
| 3626 | + } |
---|
| 3627 | + |
---|
| 3628 | + for (int i=compress.length; --i>=0;) |
---|
| 3629 | + { |
---|
| 3630 | + if (compress[i] != name[i]) |
---|
| 3631 | + return false; |
---|
| 3632 | + } |
---|
| 3633 | + |
---|
| 3634 | + return true; |
---|
| 3635 | + } |
---|
| 3636 | + |
---|
| 3637 | + java.util.Hashtable<java.util.UUID, Object3D> versiontable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
| 3638 | + |
---|
| 3639 | + public boolean Save(boolean user) |
---|
3506 | 3640 | { |
---|
3507 | 3641 | System.err.println("Save"); |
---|
3508 | 3642 | |
---|
3509 | 3643 | cRadio tab = GetCurrentTab(); |
---|
3510 | 3644 | |
---|
3511 | | - boolean temp = CameraPane.SWITCH; |
---|
3512 | | - CameraPane.SWITCH = false; |
---|
| 3645 | + byte[] compress = CompressCopy(); |
---|
3513 | 3646 | |
---|
3514 | | - copy.ExtractBigData(hashtable); |
---|
| 3647 | + boolean thesame = false; |
---|
| 3648 | + |
---|
| 3649 | + // Quick heuristic using length. Works only when stream is compressed. |
---|
| 3650 | + if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1])) |
---|
| 3651 | + { |
---|
| 3652 | + thesame = true; |
---|
| 3653 | + } |
---|
3515 | 3654 | |
---|
3516 | 3655 | //EditorFrame.m_MainFrame.requestFocusInWindow(); |
---|
3517 | | - tab.graphs[tab.undoindex++] = Compress(copy); |
---|
3518 | | - |
---|
3519 | | - copy.RestoreBigData(hashtable); |
---|
3520 | | - |
---|
3521 | | - CameraPane.SWITCH = temp; |
---|
3522 | | - |
---|
3523 | | - //assert(hashtable.isEmpty()); |
---|
3524 | | - |
---|
3525 | | - for (int i = tab.undoindex; i < tab.graphs.length; i++) |
---|
| 3656 | + if (!thesame) |
---|
3526 | 3657 | { |
---|
3527 | | - tab.graphs[i] = null; |
---|
| 3658 | + //tab.user[tab.versionindex] = user; |
---|
| 3659 | + //boolean increment = true; // tab.graphs[tab.versionindex] == null; |
---|
| 3660 | + |
---|
| 3661 | + copy.versions[++copy.versionindex] = compress; |
---|
| 3662 | + |
---|
| 3663 | + // if (increment) |
---|
| 3664 | + // tab.versionindex++; |
---|
3528 | 3665 | } |
---|
3529 | 3666 | |
---|
| 3667 | + //copy.RestoreBigData(versiontable); |
---|
| 3668 | + |
---|
| 3669 | + //assert(hashtable.isEmpty()); |
---|
| 3670 | + |
---|
| 3671 | + for (int i = copy.versionindex+1; i < copy.versions.length; i++) |
---|
| 3672 | + { |
---|
| 3673 | + //tab.user[i] = false; |
---|
| 3674 | + copy.versions[i] = null; |
---|
| 3675 | + } |
---|
| 3676 | + |
---|
| 3677 | + SetUndoStates(); |
---|
| 3678 | + |
---|
3530 | 3679 | // test save |
---|
3531 | 3680 | if (false) |
---|
3532 | 3681 | { |
---|
3533 | 3682 | try |
---|
3534 | 3683 | { |
---|
3535 | | - FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex); |
---|
| 3684 | + FileOutputStream ostream = new FileOutputStream("save" + copy.versionindex); |
---|
3536 | 3685 | ObjectOutputStream p = new ObjectOutputStream(ostream); |
---|
3537 | 3686 | |
---|
3538 | 3687 | p.writeObject(copy); |
---|
.. | .. |
---|
3545 | 3694 | e.printStackTrace(); |
---|
3546 | 3695 | } |
---|
3547 | 3696 | } |
---|
| 3697 | + |
---|
| 3698 | + return !thesame; |
---|
3548 | 3699 | } |
---|
3549 | 3700 | |
---|
3550 | 3701 | void CopyChanged(Object3D obj) |
---|
3551 | 3702 | { |
---|
| 3703 | + SetUndoStates(); |
---|
| 3704 | + |
---|
3552 | 3705 | boolean temp = CameraPane.SWITCH; |
---|
3553 | 3706 | CameraPane.SWITCH = false; |
---|
3554 | 3707 | |
---|
3555 | | - copy.ExtractBigData(hashtable); |
---|
| 3708 | + copy.ExtractBigData(versiontable); |
---|
3556 | 3709 | |
---|
3557 | 3710 | copy.clear(); |
---|
3558 | 3711 | |
---|
.. | .. |
---|
3561 | 3714 | copy.add(obj.get(i)); |
---|
3562 | 3715 | } |
---|
3563 | 3716 | |
---|
3564 | | - copy.RestoreBigData(hashtable); |
---|
| 3717 | + copy.RestoreBigData(versiontable); |
---|
3565 | 3718 | |
---|
3566 | 3719 | CameraPane.SWITCH = temp; |
---|
3567 | 3720 | |
---|
.. | .. |
---|
3588 | 3741 | refreshContents(); |
---|
3589 | 3742 | } |
---|
3590 | 3743 | |
---|
3591 | | - public void Undo() |
---|
| 3744 | + cButton undoButton; |
---|
| 3745 | + cButton restoreButton; |
---|
| 3746 | + cButton replaceButton; |
---|
| 3747 | + cButton redoButton; |
---|
| 3748 | + |
---|
| 3749 | + boolean muteSlider; |
---|
| 3750 | + |
---|
| 3751 | + int VersionCount() |
---|
3592 | 3752 | { |
---|
| 3753 | + int count = 0; |
---|
| 3754 | + |
---|
| 3755 | + for (int i = copy.versions.length; --i >= 0;) |
---|
| 3756 | + { |
---|
| 3757 | + if (copy.versions[i] != null) |
---|
| 3758 | + count++; |
---|
| 3759 | + } |
---|
| 3760 | + |
---|
| 3761 | + return count; |
---|
| 3762 | + } |
---|
| 3763 | + |
---|
| 3764 | + void SetUndoStates() |
---|
| 3765 | + { |
---|
| 3766 | + cRadio tab = GetCurrentTab(); |
---|
| 3767 | + |
---|
| 3768 | + restoreButton.setEnabled(copy.versionindex != -1); |
---|
| 3769 | + replaceButton.setEnabled(copy.versionindex != -1); |
---|
| 3770 | + |
---|
| 3771 | + undoButton.setEnabled(copy.versionindex > 0); |
---|
| 3772 | + redoButton.setEnabled(copy.versions[copy.versionindex + 1] != null); |
---|
| 3773 | + |
---|
| 3774 | + muteSlider = true; |
---|
| 3775 | + versionSlider.setMaximum(VersionCount() - 1); |
---|
| 3776 | + versionSlider.setInteger(copy.versionindex); |
---|
| 3777 | + muteSlider = false; |
---|
| 3778 | + } |
---|
| 3779 | + |
---|
| 3780 | + public boolean Undo() |
---|
| 3781 | + { |
---|
| 3782 | + // Option? |
---|
| 3783 | + Replace(); |
---|
| 3784 | + |
---|
3593 | 3785 | System.err.println("Undo"); |
---|
3594 | 3786 | |
---|
3595 | 3787 | cRadio tab = GetCurrentTab(); |
---|
3596 | 3788 | |
---|
3597 | | - if (tab.undoindex == 0) |
---|
| 3789 | + if (copy.versionindex == 0) |
---|
3598 | 3790 | { |
---|
3599 | 3791 | java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
3600 | | - return; |
---|
| 3792 | + return false; |
---|
3601 | 3793 | } |
---|
3602 | 3794 | |
---|
3603 | | - if (tab.graphs[tab.undoindex] == null) |
---|
| 3795 | +// if (tab.graphs[tab.versionindex] == null) // || !tab.user[tab.versionindex]) |
---|
| 3796 | +// { |
---|
| 3797 | +// if (Save(false)) |
---|
| 3798 | +// tab.versionindex -= 1; |
---|
| 3799 | +// else |
---|
| 3800 | +// { |
---|
| 3801 | +// if (tab.versionindex <= 0) |
---|
| 3802 | +// return false; |
---|
| 3803 | +// else |
---|
| 3804 | +// tab.versionindex -= 1; |
---|
| 3805 | +// } |
---|
| 3806 | +// } |
---|
| 3807 | + |
---|
| 3808 | + copy.versionindex -= 1; |
---|
| 3809 | + |
---|
| 3810 | + CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 3811 | + |
---|
| 3812 | + return true; |
---|
| 3813 | + } |
---|
| 3814 | + |
---|
| 3815 | + public boolean Restore() |
---|
| 3816 | + { |
---|
| 3817 | + System.err.println("Restore"); |
---|
| 3818 | + |
---|
| 3819 | + cRadio tab = GetCurrentTab(); |
---|
| 3820 | + |
---|
| 3821 | + if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null) |
---|
3604 | 3822 | { |
---|
3605 | | - Save(); |
---|
3606 | | - tab.undoindex -= 1; |
---|
| 3823 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 3824 | + return false; |
---|
3607 | 3825 | } |
---|
3608 | 3826 | |
---|
3609 | | - tab.undoindex -= 1; |
---|
| 3827 | + CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 3828 | + |
---|
| 3829 | + return true; |
---|
| 3830 | + } |
---|
3610 | 3831 | |
---|
3611 | | - CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex])); |
---|
| 3832 | + public boolean Replace() |
---|
| 3833 | + { |
---|
| 3834 | + System.err.println("Replace"); |
---|
| 3835 | + |
---|
| 3836 | + cRadio tab = GetCurrentTab(); |
---|
| 3837 | + |
---|
| 3838 | + if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null) |
---|
| 3839 | + { |
---|
| 3840 | + // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 3841 | + return false; |
---|
| 3842 | + } |
---|
| 3843 | + |
---|
| 3844 | + copy.versions[copy.versionindex] = CompressCopy(); |
---|
| 3845 | + |
---|
| 3846 | + return true; |
---|
3612 | 3847 | } |
---|
3613 | 3848 | |
---|
3614 | 3849 | public void Redo() |
---|
3615 | 3850 | { |
---|
| 3851 | + // Option? |
---|
| 3852 | + Replace(); |
---|
| 3853 | + |
---|
3616 | 3854 | cRadio tab = GetCurrentTab(); |
---|
3617 | 3855 | |
---|
3618 | | - if (tab.graphs[tab.undoindex + 1] == null) |
---|
| 3856 | + if (copy.versions[copy.versionindex + 1] == null) |
---|
3619 | 3857 | { |
---|
3620 | 3858 | java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
3621 | 3859 | return; |
---|
3622 | 3860 | } |
---|
3623 | 3861 | |
---|
3624 | | - tab.undoindex += 1; |
---|
| 3862 | + copy.versionindex += 1; |
---|
3625 | 3863 | |
---|
3626 | | - CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex])); |
---|
| 3864 | + CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 3865 | + |
---|
| 3866 | + //if (!tab.user[tab.versionindex]) |
---|
| 3867 | + // tab.graphs[tab.versionindex] = null; |
---|
3627 | 3868 | } |
---|
3628 | 3869 | |
---|
3629 | 3870 | void ImportGFD() |
---|
.. | .. |
---|
3919 | 4160 | //copy.Touch(); |
---|
3920 | 4161 | } |
---|
3921 | 4162 | |
---|
| 4163 | + cNumberSlider versionSlider; |
---|
| 4164 | + |
---|
3922 | 4165 | public void stateChanged(ChangeEvent e) |
---|
3923 | 4166 | { |
---|
3924 | 4167 | // assert(false); |
---|
| 4168 | + if (e.getSource() == versionSlider) |
---|
| 4169 | + { |
---|
| 4170 | + if (muteSlider) |
---|
| 4171 | + return; |
---|
| 4172 | + |
---|
| 4173 | + int version = versionSlider.getInteger(); |
---|
| 4174 | + |
---|
| 4175 | + if (copy.versions[version] != null) |
---|
| 4176 | + { |
---|
| 4177 | + CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex = version])); |
---|
| 4178 | + } |
---|
| 4179 | + |
---|
| 4180 | + return; |
---|
| 4181 | + } |
---|
3925 | 4182 | |
---|
3926 | 4183 | if (freezematerial) |
---|
3927 | 4184 | { |
---|
.. | .. |
---|
4270 | 4527 | |
---|
4271 | 4528 | void makeSomething(Object3D thing, boolean resetmodel) // deselect) |
---|
4272 | 4529 | { |
---|
4273 | | - if (Globals.SAVEONMAKE) // && resetmodel) |
---|
| 4530 | + if (Globals.REPLACEONMAKE) // && resetmodel) |
---|
4274 | 4531 | Save(); |
---|
4275 | 4532 | //Tween.set(thing, 0).target(1).start(tweenManager); |
---|
4276 | 4533 | //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager); |
---|
.. | .. |
---|
4512 | 4769 | readobj.ResetDisplayList(); |
---|
4513 | 4770 | } catch (Exception e) |
---|
4514 | 4771 | { |
---|
4515 | | - //e.printStackTrace(); |
---|
| 4772 | + if (!e.toString().contains("GZIP")) |
---|
| 4773 | + e.printStackTrace(); |
---|
| 4774 | + |
---|
4516 | 4775 | try |
---|
4517 | 4776 | { |
---|
4518 | 4777 | java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
.. | .. |
---|
4586 | 4845 | |
---|
4587 | 4846 | if (readobj != null) |
---|
4588 | 4847 | { |
---|
4589 | | - if (Globals.SAVEONMAKE) |
---|
4590 | | - Save(); |
---|
| 4848 | + //if (Globals.SAVEONMAKE) // A new object cannot share meshes |
---|
| 4849 | + // Save(); |
---|
4591 | 4850 | try |
---|
4592 | 4851 | { |
---|
4593 | 4852 | //readobj.deepCopySelf(copy); |
---|
.. | .. |
---|
4632 | 4891 | } |
---|
4633 | 4892 | } catch (ClassCastException e) |
---|
4634 | 4893 | { |
---|
| 4894 | + e.printStackTrace(); |
---|
4635 | 4895 | assert (false); |
---|
4636 | 4896 | Composite c = (Composite) copy; |
---|
4637 | 4897 | c.children.clear(); |
---|
.. | .. |
---|
4642 | 4902 | c.addChild(csg); |
---|
4643 | 4903 | } |
---|
4644 | 4904 | |
---|
| 4905 | + copy.versions = readobj.versions; |
---|
| 4906 | + copy.versionindex = readobj.versionindex; |
---|
| 4907 | + |
---|
| 4908 | + if (copy.versions == null) |
---|
| 4909 | + { |
---|
| 4910 | + copy.versions = new byte[100][]; |
---|
| 4911 | + copy.versionindex = -1; |
---|
| 4912 | + } |
---|
| 4913 | + |
---|
| 4914 | + //? SetUndoStates(); |
---|
| 4915 | + |
---|
4645 | 4916 | ResetModel(); |
---|
4646 | 4917 | copy.HardTouch(); // recompile? |
---|
4647 | 4918 | refreshContents(); |
---|
4648 | 4919 | } |
---|
4649 | 4920 | } |
---|
4650 | 4921 | |
---|
4651 | | - void load() // throws ClassNotFoundException |
---|
| 4922 | + void Open() // throws ClassNotFoundException |
---|
4652 | 4923 | { |
---|
4653 | 4924 | if (Grafreed.standAlone) |
---|
4654 | 4925 | { |
---|
.. | .. |
---|
4751 | 5022 | //ps.print(buffer.toString()); |
---|
4752 | 5023 | } catch (IOException e) |
---|
4753 | 5024 | { |
---|
| 5025 | + e.printStackTrace(); |
---|
4754 | 5026 | } |
---|
4755 | 5027 | } |
---|
4756 | 5028 | |
---|
.. | .. |
---|
4765 | 5037 | String filename = browser.getFile(); |
---|
4766 | 5038 | if (filename != null && filename.length() > 0) |
---|
4767 | 5039 | { |
---|
| 5040 | + if (!filename.endsWith(".gfd")) |
---|
| 5041 | + filename += ".gfd"; |
---|
4768 | 5042 | lastname = browser.getDirectory() + filename; |
---|
4769 | 5043 | save(); |
---|
4770 | 5044 | } |
---|
.. | .. |
---|
4931 | 5205 | MenuBar menuBar; |
---|
4932 | 5206 | Menu fileMenu; |
---|
4933 | 5207 | MenuItem newItem; |
---|
4934 | | - MenuItem loadItem; |
---|
| 5208 | + MenuItem openItem; |
---|
4935 | 5209 | MenuItem saveItem; |
---|
4936 | 5210 | MenuItem saveAsItem; |
---|
4937 | 5211 | MenuItem exportAsItem; |
---|
.. | .. |
---|
4954 | 5228 | CheckboxMenuItem toggleSwitchItem; |
---|
4955 | 5229 | CheckboxMenuItem toggleRootItem; |
---|
4956 | 5230 | CheckboxMenuItem animationItem; |
---|
| 5231 | + MenuItem archiveItem; |
---|
4957 | 5232 | CheckboxMenuItem toggleHandleItem; |
---|
4958 | 5233 | CheckboxMenuItem togglePaintItem; |
---|
4959 | 5234 | JSplitPane mainPanel; |
---|