.. | .. |
---|
44 | 44 | |
---|
45 | 45 | cButton GetButton(String name, boolean border) |
---|
46 | 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 | | - } |
---|
| 47 | + ImageIcon icon = GetIcon(name); |
---|
| 48 | + return new cButton(icon, border); |
---|
56 | 49 | } |
---|
57 | 50 | |
---|
58 | 51 | cToggleButton GetToggleButton(String name, boolean border) |
---|
59 | 52 | { |
---|
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 | | - } |
---|
| 53 | + ImageIcon icon = GetIcon(name); |
---|
| 54 | + return new cToggleButton(icon, border); |
---|
69 | 55 | } |
---|
70 | 56 | |
---|
71 | 57 | cCheckBox GetCheckBox(String name, boolean border) |
---|
72 | 58 | { |
---|
| 59 | + ImageIcon icon = GetIcon(name); |
---|
| 60 | + return new cCheckBox(icon, border); |
---|
| 61 | + } |
---|
| 62 | + |
---|
| 63 | + private ImageIcon GetIcon(String name) |
---|
| 64 | + { |
---|
73 | 65 | try |
---|
74 | 66 | { |
---|
75 | | - ImageIcon icon = GetIcon(name); |
---|
76 | | - 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; |
---|
77 | 83 | } |
---|
78 | 84 | catch (Exception e) |
---|
79 | 85 | { |
---|
80 | | - return new cCheckBox(name, border); |
---|
| 86 | + return null; |
---|
81 | 87 | } |
---|
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 | 88 | } |
---|
103 | 89 | |
---|
104 | 90 | // SCRIPT |
---|
.. | .. |
---|
282 | 268 | client = inClient; |
---|
283 | 269 | copy = client; |
---|
284 | 270 | |
---|
| 271 | + if (copy.versions == null) |
---|
| 272 | + { |
---|
| 273 | + copy.versions = new byte[100][]; |
---|
| 274 | + copy.versionindex = -1; |
---|
| 275 | + } |
---|
| 276 | + |
---|
285 | 277 | // "this" is not called: SetupUI2(objEditor); |
---|
286 | 278 | } |
---|
287 | 279 | |
---|
.. | .. |
---|
295 | 287 | client = inClient; |
---|
296 | 288 | copy = client; |
---|
297 | 289 | |
---|
| 290 | + if (copy.versions == null) |
---|
| 291 | + { |
---|
| 292 | + copy.versions = new byte[100][]; |
---|
| 293 | + copy.versionindex = -1; |
---|
| 294 | + } |
---|
| 295 | + |
---|
298 | 296 | SetupUI2(callee.GetEditor()); |
---|
299 | 297 | } |
---|
300 | 298 | |
---|
.. | .. |
---|
309 | 307 | //localCopy.parent = null; |
---|
310 | 308 | |
---|
311 | 309 | frame = new JFrame(); |
---|
312 | | - frame.setUndecorated(true); |
---|
| 310 | + frame.setUndecorated(false); |
---|
313 | 311 | objEditor = this; |
---|
314 | 312 | this.callee = callee; |
---|
315 | 313 | |
---|
.. | .. |
---|
327 | 325 | copy = localCopy; |
---|
328 | 326 | copy.editWindow = this; |
---|
329 | 327 | |
---|
| 328 | + if (copy.versions == null) |
---|
| 329 | + { |
---|
| 330 | +// copy.versions = new byte[100][]; |
---|
| 331 | +// copy.versionindex = -1; |
---|
| 332 | + } |
---|
| 333 | + |
---|
330 | 334 | SetupMenu(); |
---|
331 | 335 | |
---|
332 | 336 | //SetupName(objEditor); // new |
---|
.. | .. |
---|
350 | 354 | frame.setMenuBar(menuBar = new MenuBar()); |
---|
351 | 355 | menuBar.add(fileMenu = new Menu("File")); |
---|
352 | 356 | fileMenu.add(newItem = new MenuItem("New")); |
---|
353 | | - fileMenu.add(loadItem = new MenuItem("Open...")); |
---|
| 357 | + fileMenu.add(openItem = new MenuItem("Open...")); |
---|
354 | 358 | |
---|
355 | 359 | //oe.menuBar.add(menu = new Menu("Include")); |
---|
356 | 360 | Menu menu = new Menu("Import"); |
---|
.. | .. |
---|
382 | 386 | } |
---|
383 | 387 | |
---|
384 | 388 | newItem.addActionListener(this); |
---|
385 | | - loadItem.addActionListener(this); |
---|
| 389 | + openItem.addActionListener(this); |
---|
386 | 390 | saveItem.addActionListener(this); |
---|
387 | 391 | saveAsItem.addActionListener(this); |
---|
388 | 392 | exportAsItem.addActionListener(this); |
---|
.. | .. |
---|
419 | 423 | |
---|
420 | 424 | toolbarPanel = new JPanel(); |
---|
421 | 425 | toolbarPanel.setName("Toolbar"); |
---|
| 426 | + |
---|
422 | 427 | treePanel = new cGridBag(); |
---|
423 | 428 | treePanel.setName("Tree"); |
---|
424 | 429 | |
---|
425 | 430 | editPanel = new cGridBag().setVertical(true); |
---|
426 | | - editPanel.setName("Edit"); |
---|
| 431 | + //editPanel.setName("Edit"); |
---|
427 | 432 | |
---|
428 | 433 | ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout()); |
---|
429 | 434 | |
---|
.. | .. |
---|
432 | 437 | editPanel.add(ctrlPanel); |
---|
433 | 438 | |
---|
434 | 439 | toolboxPanel = new cGridBag().setVertical(false); |
---|
435 | | - toolboxPanel.setName("Toolbox"); |
---|
| 440 | + //toolboxPanel.setName("Toolbox"); |
---|
436 | 441 | |
---|
437 | 442 | materialPanel = new cGridBag().setVertical(true); |
---|
438 | | - materialPanel.setName("Material"); |
---|
| 443 | + //materialPanel.setName("Material"); |
---|
439 | 444 | |
---|
440 | 445 | /*JTextPane*/ |
---|
441 | 446 | infoarea = createTextPane(); |
---|
.. | .. |
---|
443 | 448 | |
---|
444 | 449 | infoarea.setEditable(true); |
---|
445 | 450 | SetText(); |
---|
| 451 | + |
---|
446 | 452 | // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f)); |
---|
447 | 453 | // infoarea.setOpaque(false); |
---|
448 | 454 | // //infoarea.setForeground(textcolor); |
---|
449 | 455 | // TEXTAREA infoarea.setLineWrap(true); |
---|
450 | 456 | // TEXTAREA infoarea.setWrapStyleWord(true); |
---|
451 | 457 | infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED); |
---|
452 | | - infoPanel.setPreferredSize(new Dimension(50, 200)); |
---|
453 | | - infoPanel.setName("Info"); |
---|
| 458 | + infoPanel.setPreferredSize(new Dimension(1, 1)); |
---|
| 459 | + //infoPanel.setName("Info"); |
---|
454 | 460 | //infoPanel.setLayout(new BorderLayout()); |
---|
455 | 461 | //infoPanel.add(createTextPane()); |
---|
456 | 462 | |
---|
.. | .. |
---|
463 | 469 | mainPanel.setResizeWeight(0.5); |
---|
464 | 470 | |
---|
465 | 471 | //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!")); |
---|
| 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!")); |
---|
469 | 475 | |
---|
| 476 | + mainPanel.setUI(new BasicSplitPaneUI()); |
---|
470 | 477 | |
---|
471 | 478 | //ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5)); |
---|
472 | 479 | //mainPanel.setLayout(new GridBagLayout()); |
---|
.. | .. |
---|
698 | 705 | } |
---|
699 | 706 | } |
---|
700 | 707 | |
---|
701 | | -static GraphicsDevice device = GraphicsEnvironment |
---|
702 | | - .getLocalGraphicsEnvironment().getScreenDevices()[0]; |
---|
| 708 | +//static GraphicsDevice device = GraphicsEnvironment |
---|
| 709 | +// .getLocalGraphicsEnvironment().getScreenDevices()[0]; |
---|
703 | 710 | |
---|
704 | 711 | Rectangle keeprect; |
---|
705 | 712 | cRadio radio; |
---|
.. | .. |
---|
720 | 727 | void Minimize() |
---|
721 | 728 | { |
---|
722 | 729 | frame.setState(Frame.ICONIFIED); |
---|
| 730 | + frame.validate(); |
---|
723 | 731 | } |
---|
724 | 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={} |
---|
725 | 736 | void Maximize() |
---|
726 | 737 | { |
---|
| 738 | + if (CameraPane.FULLSCREEN) |
---|
| 739 | + { |
---|
| 740 | + ToggleFullScreen(); |
---|
| 741 | + } |
---|
| 742 | + |
---|
727 | 743 | if (maximized) |
---|
728 | 744 | { |
---|
729 | 745 | frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height); |
---|
.. | .. |
---|
731 | 747 | else |
---|
732 | 748 | { |
---|
733 | 749 | keeprect = frame.getBounds(); |
---|
734 | | - Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); |
---|
735 | | - Dimension rect2 = frame.getToolkit().getScreenSize(); |
---|
736 | | - 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); |
---|
737 | 753 | // frame.setState(Frame.MAXIMIZED_BOTH); |
---|
| 754 | + frame.setBounds(frame.getGraphicsConfiguration().getBounds()); |
---|
738 | 755 | } |
---|
739 | 756 | |
---|
740 | 757 | maximized ^= true; |
---|
| 758 | + |
---|
| 759 | + frame.validate(); |
---|
741 | 760 | } |
---|
| 761 | + |
---|
| 762 | + cButton minButton; |
---|
| 763 | + cButton maxButton; |
---|
| 764 | + cButton fullButton; |
---|
742 | 765 | |
---|
743 | 766 | void ToggleFullScreen() |
---|
744 | 767 | { |
---|
| 768 | +GraphicsDevice device = frame.getGraphicsConfiguration().getDevice(); |
---|
| 769 | + |
---|
745 | 770 | cameraView.ToggleFullScreen(); |
---|
746 | 771 | |
---|
747 | 772 | if (!CameraPane.FULLSCREEN) |
---|
748 | 773 | { |
---|
749 | 774 | device.setFullScreenWindow(null); |
---|
| 775 | + frame.dispose(); |
---|
| 776 | + frame.setUndecorated(false); |
---|
| 777 | + frame.validate(); |
---|
| 778 | + frame.setVisible(true); |
---|
| 779 | + |
---|
750 | 780 | //frame.setVisible(false); |
---|
751 | 781 | // frame.removeNotify(); |
---|
752 | 782 | // frame.setUndecorated(false); |
---|
.. | .. |
---|
756 | 786 | // X frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
757 | 787 | // X framePanel.add(bigThree); |
---|
758 | 788 | // X frame.getContentPane().add(/*"Center",*/framePanel); |
---|
759 | | - framePanel.setDividerLocation(1); |
---|
| 789 | + framePanel.setDividerLocation(46); |
---|
760 | 790 | |
---|
761 | 791 | //frame.setVisible(true); |
---|
762 | 792 | radio.layout = keepButton; |
---|
.. | .. |
---|
771 | 801 | // frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width, |
---|
772 | 802 | // frame.getToolkit().getScreenSize().height); |
---|
773 | 803 | //frame.setVisible(false); |
---|
| 804 | + |
---|
| 805 | + frame.dispose(); |
---|
| 806 | + frame.setUndecorated(true); |
---|
774 | 807 | device.setFullScreenWindow(frame); |
---|
| 808 | + frame.validate(); |
---|
| 809 | + frame.setVisible(true); |
---|
775 | 810 | // frame.removeNotify(); |
---|
776 | 811 | // frame.setUndecorated(true); |
---|
777 | 812 | // frame.addNotify(); |
---|
.. | .. |
---|
784 | 819 | radio.layout.doClick(); |
---|
785 | 820 | //frame.setVisible(true); |
---|
786 | 821 | } |
---|
| 822 | + frame.validate(); |
---|
787 | 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 | + } |
---|
788 | 846 | |
---|
789 | 847 | private JTextPane createTextPane() |
---|
790 | 848 | { |
---|
.. | .. |
---|
916 | 974 | // NumberSlider vDivsField; |
---|
917 | 975 | // JCheckBox endcaps; |
---|
918 | 976 | JCheckBox liveCB; |
---|
919 | | - JCheckBox selectCB; |
---|
| 977 | + JCheckBox selectableCB; |
---|
920 | 978 | JCheckBox hideCB; |
---|
921 | 979 | JCheckBox link2masterCB; |
---|
922 | 980 | JCheckBox markCB; |
---|
.. | .. |
---|
1116 | 1174 | namePanel = new cGridBag(); |
---|
1117 | 1175 | |
---|
1118 | 1176 | nameField = AddText(namePanel, copy.GetName()); |
---|
1119 | | - namePanel.add(nameField); |
---|
| 1177 | + namePanel.add(new JScrollPane(nameField, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER)); |
---|
1120 | 1178 | oe.ctrlPanel.add(namePanel); |
---|
1121 | 1179 | |
---|
1122 | 1180 | oe.ctrlPanel.Return(); |
---|
.. | .. |
---|
1128 | 1186 | |
---|
1129 | 1187 | liveCB = AddCheckBox(setupPanel, "Live", copy.live); |
---|
1130 | 1188 | liveCB.setToolTipText("Animate object"); |
---|
1131 | | - selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect); |
---|
1132 | | - selectCB.setToolTipText("Make object selectable"); |
---|
| 1189 | + selectableCB = AddCheckBox(setupPanel, "Select", !copy.dontselect); |
---|
| 1190 | + selectableCB.setToolTipText("Make object selectable"); |
---|
1133 | 1191 | // Return(); |
---|
| 1192 | + |
---|
1134 | 1193 | hideCB = AddCheckBox(setupPanel, "Hide", copy.hide); |
---|
1135 | 1194 | hideCB.setToolTipText("Hide object"); |
---|
1136 | 1195 | markCB = AddCheckBox(setupPanel, "Mark", copy.marked); |
---|
.. | .. |
---|
1141 | 1200 | rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind); |
---|
1142 | 1201 | rewindCB.setToolTipText("Rewind animation"); |
---|
1143 | 1202 | |
---|
1144 | | - randomCB = AddCheckBox(setupPanel2, "Rand", copy.random); |
---|
| 1203 | + randomCB = AddCheckBox(setupPanel2, "Random", copy.random); |
---|
1145 | 1204 | randomCB.setToolTipText("Randomly Rewind (or Go back and forth)"); |
---|
1146 | 1205 | |
---|
| 1206 | + link2masterCB = AddCheckBox(setupPanel2, "Support", copy.link2master); |
---|
| 1207 | + link2masterCB.setToolTipText("Attach to support"); |
---|
| 1208 | + |
---|
1147 | 1209 | if (Globals.ADVANCED) |
---|
1148 | 1210 | { |
---|
1149 | | - link2masterCB = AddCheckBox(setupPanel2, "Supp", copy.link2master); |
---|
1150 | | - link2masterCB.setToolTipText("Attach to support"); |
---|
1151 | 1211 | speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup); |
---|
1152 | 1212 | speedupCB.setToolTipText("Option motion capture"); |
---|
1153 | 1213 | } |
---|
.. | .. |
---|
1421 | 1481 | XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll); |
---|
1422 | 1482 | XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll); |
---|
1423 | 1483 | XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll); |
---|
| 1484 | + //XYZPanel.setName("XYZ"); |
---|
1424 | 1485 | |
---|
1425 | 1486 | /* |
---|
1426 | 1487 | gridPanel = new JPanel(); //new BorderLayout()); |
---|
.. | .. |
---|
1458 | 1519 | //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); |
---|
1459 | 1520 | //tmp.setName("Edit"); |
---|
1460 | 1521 | objectPanel.add(materialPanel); |
---|
| 1522 | + objectPanel.setIconAt(0, GetIcon("icons/material.png")); |
---|
1461 | 1523 | // JPanel north = new JPanel(new BorderLayout()); |
---|
1462 | 1524 | // north.setName("Edit"); |
---|
1463 | 1525 | // north.add(ctrlPanel, BorderLayout.NORTH); |
---|
1464 | 1526 | // objectPanel.add(north); |
---|
1465 | 1527 | objectPanel.add(editPanel); |
---|
1466 | | - 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 | + |
---|
1467 | 1537 | objectPanel.add(toolboxPanel); |
---|
| 1538 | + objectPanel.setIconAt(4, GetIcon("icons/primitives.png")); |
---|
1468 | 1539 | |
---|
1469 | 1540 | /* |
---|
1470 | 1541 | aConstraints.gridx = 0; |
---|
.. | .. |
---|
1485 | 1556 | scrollpane.addMouseWheelListener(this); // Default not fast enough |
---|
1486 | 1557 | |
---|
1487 | 1558 | /*JTabbedPane*/ scenePanel = new cGridBag(); |
---|
1488 | | - scenePanel.preferredWidth = 6; |
---|
| 1559 | + scenePanel.preferredWidth = 5; |
---|
1489 | 1560 | |
---|
1490 | 1561 | JTabbedPane tabbedPane = new JTabbedPane(); |
---|
1491 | 1562 | tabbedPane.add(scrollpane); |
---|
.. | .. |
---|
1561 | 1632 | /**/ |
---|
1562 | 1633 | |
---|
1563 | 1634 | bigThree = new cGridBag(); |
---|
1564 | | - bigThree.addComponent(scenePanel); |
---|
1565 | 1635 | bigThree.addComponent(centralPanel); |
---|
1566 | | - bigThree.addComponent(XYZPanel); |
---|
| 1636 | + bigThree.addComponent(scenePanel); |
---|
| 1637 | + //bigThree.addComponent(XYZPanel); |
---|
1567 | 1638 | |
---|
1568 | 1639 | // // SIDE EFFECT!!! |
---|
1569 | 1640 | // aConstraints.gridx = 0; |
---|
.. | .. |
---|
1572 | 1643 | // aConstraints.gridheight = 1; |
---|
1573 | 1644 | |
---|
1574 | 1645 | framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree); |
---|
1575 | | - framePanel.setContinuousLayout(true); |
---|
1576 | | - framePanel.setOneTouchExpandable(true); |
---|
1577 | | - framePanel.setDividerLocation(0.8); |
---|
| 1646 | + framePanel.setContinuousLayout(false); |
---|
| 1647 | + framePanel.setOneTouchExpandable(false); |
---|
| 1648 | + //.setDividerLocation(0.8); |
---|
1578 | 1649 | //framePanel.setDividerSize(15); |
---|
1579 | 1650 | //framePanel.setResizeWeight(0.15); |
---|
1580 | 1651 | framePanel.setName("Frame"); |
---|
.. | .. |
---|
1593 | 1664 | |
---|
1594 | 1665 | frame.setSize(1280, 860); |
---|
1595 | 1666 | |
---|
1596 | | - frame.validate(); |
---|
1597 | | - frame.setVisible(true); |
---|
1598 | | - |
---|
1599 | 1667 | cameraView.requestFocusInWindow(); |
---|
1600 | 1668 | |
---|
1601 | 1669 | gridPanel.setDividerLocation(1.0); |
---|
| 1670 | + |
---|
| 1671 | + frame.validate(); |
---|
| 1672 | + |
---|
| 1673 | + frame.setVisible(true); |
---|
1602 | 1674 | |
---|
1603 | 1675 | frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); |
---|
1604 | 1676 | frame.addWindowListener(new WindowAdapter() |
---|
.. | .. |
---|
1685 | 1757 | texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1686 | 1758 | colorSection.add(texture); |
---|
1687 | 1759 | |
---|
1688 | | - cGridBag anisoU = new cGridBag(); |
---|
1689 | | - anisoU.add(anisoLabel = new JLabel("AnisoU")); // , aConstraints); |
---|
1690 | | - anisoLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1691 | | - anisoU.add(anisoField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1692 | | - colorSection.add(anisoU); |
---|
1693 | | - |
---|
1694 | | - cGridBag anisoV = new cGridBag(); |
---|
1695 | | - anisoV.add(anisoVLabel = new JLabel("AnisoV")); // , aConstraints); |
---|
1696 | | - anisoVLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1697 | | - anisoV.add(anisoVField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1698 | | - colorSection.add(anisoV); |
---|
1699 | | - |
---|
1700 | | - cGridBag shadowbias = new cGridBag(); |
---|
1701 | | - shadowbias.add(shadowbiasLabel = new JLabel("Shadowbias")); // , aConstraints); |
---|
1702 | | - shadowbiasLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1703 | | - shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1704 | | - colorSection.add(shadowbias); |
---|
1705 | | - |
---|
1706 | 1760 | panel.add(new JSeparator()); |
---|
1707 | 1761 | |
---|
1708 | 1762 | panel.add(colorSection); |
---|
.. | .. |
---|
1752 | 1806 | fakedepthLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1753 | 1807 | fakedepth.add(fakedepthField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1754 | 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); |
---|
1755 | 1815 | |
---|
1756 | 1816 | panel.add(new JSeparator()); |
---|
1757 | 1817 | |
---|
.. | .. |
---|
1803 | 1863 | // aConstraints.gridy += 1; |
---|
1804 | 1864 | // aConstraints.gridwidth = 1; |
---|
1805 | 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 | + |
---|
1806 | 1878 | |
---|
1807 | 1879 | panel.add(new JSeparator()); |
---|
1808 | 1880 | |
---|
.. | .. |
---|
1810 | 1882 | |
---|
1811 | 1883 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1812 | 1884 | |
---|
1813 | | - cGridBag globalSection = new cGridBag().setVertical(true); |
---|
| 1885 | + //cGridBag globalSection = new cGridBag().setVertical(true); |
---|
1814 | 1886 | |
---|
1815 | 1887 | cGridBag camera = new cGridBag(); |
---|
1816 | 1888 | camera.add(cameraLabel = new JLabel("GlobalLight")); // , aConstraints); |
---|
1817 | 1889 | cameraLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1818 | 1890 | camera.add(cameraField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1819 | | - globalSection.add(camera); |
---|
| 1891 | + colorSection.add(camera); |
---|
1820 | 1892 | |
---|
1821 | 1893 | cGridBag ambient = new cGridBag(); |
---|
1822 | 1894 | ambient.add(ambientLabel = new JLabel("Ambient")); // , aConstraints); |
---|
1823 | 1895 | ambientLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1824 | 1896 | ambient.add(ambientField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1825 | | - globalSection.add(ambient); |
---|
| 1897 | + colorSection.add(ambient); |
---|
1826 | 1898 | |
---|
1827 | 1899 | cGridBag backlit = new cGridBag(); |
---|
1828 | 1900 | backlit.add(backlitLabel = new JLabel("Backlit")); // , aConstraints); |
---|
1829 | 1901 | backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1830 | 1902 | backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1831 | | - globalSection.add(backlit); |
---|
| 1903 | + colorSection.add(backlit); |
---|
1832 | 1904 | |
---|
1833 | 1905 | cGridBag opacity = new cGridBag(); |
---|
1834 | 1906 | opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints); |
---|
1835 | 1907 | opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1836 | 1908 | opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1837 | | - globalSection.add(opacity); |
---|
| 1909 | + colorSection.add(opacity); |
---|
1838 | 1910 | |
---|
1839 | | - panel.add(new JSeparator()); |
---|
| 1911 | + //panel.add(new JSeparator()); |
---|
1840 | 1912 | |
---|
1841 | | - panel.add(globalSection); |
---|
| 1913 | + //panel.add(globalSection); |
---|
1842 | 1914 | |
---|
1843 | 1915 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1844 | 1916 | |
---|
.. | .. |
---|
1945 | 2017 | // 3D models |
---|
1946 | 2018 | if (filename.endsWith(".3ds") || filename.endsWith(".3DS")) |
---|
1947 | 2019 | { |
---|
1948 | | - lastConverter = new com.jmex.model.converters.MaxToJme(); |
---|
1949 | | - LoadFile(filename, lastConverter); |
---|
| 2020 | + //lastConverter = new com.jmex.model.converters.MaxToJme(); |
---|
| 2021 | + //LoadFile(filename, lastConverter); |
---|
| 2022 | + LoadObjFile(filename); // New 3ds loader |
---|
1950 | 2023 | continue; |
---|
1951 | 2024 | } |
---|
1952 | 2025 | if (filename.endsWith(".dae") || filename.endsWith(".DAE")) |
---|
.. | .. |
---|
2672 | 2745 | LA.matXRotate(((Object3D) group.get(group.size() - 1)).toParent, -Math.PI / 2); |
---|
2673 | 2746 | LA.matXRotate(((Object3D) group.get(group.size() - 1)).fromParent, Math.PI / 2); |
---|
2674 | 2747 | } |
---|
| 2748 | + |
---|
2675 | 2749 | //cJME.count++; |
---|
2676 | 2750 | //cJME.count %= 12; |
---|
2677 | 2751 | if (gc) |
---|
.. | .. |
---|
2855 | 2929 | } |
---|
2856 | 2930 | } |
---|
2857 | 2931 | } |
---|
| 2932 | + |
---|
2858 | 2933 | cFileSystemPane FSPane; |
---|
2859 | 2934 | |
---|
2860 | 2935 | void SetMaterial(cMaterial mat, Object3D.cVector2[] others) |
---|
.. | .. |
---|
2908 | 2983 | } |
---|
2909 | 2984 | } |
---|
2910 | 2985 | } |
---|
| 2986 | + |
---|
2911 | 2987 | freezematerial = false; |
---|
2912 | 2988 | } |
---|
2913 | 2989 | |
---|
.. | .. |
---|
3175 | 3251 | { |
---|
3176 | 3252 | copy.live ^= true; |
---|
3177 | 3253 | return; |
---|
3178 | | - } else if (event.getSource() == selectCB) |
---|
| 3254 | + } else if (event.getSource() == selectableCB) |
---|
3179 | 3255 | { |
---|
3180 | 3256 | copy.dontselect ^= true; |
---|
3181 | 3257 | return; |
---|
.. | .. |
---|
3360 | 3436 | { |
---|
3361 | 3437 | Close(); |
---|
3362 | 3438 | //return true; |
---|
3363 | | - } else if (source == loadItem) |
---|
| 3439 | + } else if (source == openItem) |
---|
3364 | 3440 | { |
---|
3365 | | - load(); |
---|
| 3441 | + Open(); |
---|
3366 | 3442 | //return true; |
---|
3367 | 3443 | } else if (source == newItem) |
---|
3368 | 3444 | { |
---|
.. | .. |
---|
3387 | 3463 | { |
---|
3388 | 3464 | generatePOV(); |
---|
3389 | 3465 | //return true; |
---|
| 3466 | + } else if (event.getSource() == archiveItem) |
---|
| 3467 | + { |
---|
| 3468 | + cTools.Archive(frame); |
---|
| 3469 | + return; |
---|
3390 | 3470 | } else if (source == zBufferItem) |
---|
3391 | 3471 | { |
---|
3392 | 3472 | try |
---|
.. | .. |
---|
3438 | 3518 | try |
---|
3439 | 3519 | { |
---|
3440 | 3520 | ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
3441 | | - java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos); |
---|
3442 | | - ObjectOutputStream out = new ObjectOutputStream(zstream); |
---|
| 3521 | +// java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos); |
---|
| 3522 | + ObjectOutputStream out = new ObjectOutputStream(baos); //zstream); |
---|
3443 | 3523 | |
---|
3444 | 3524 | Object3D parent = o.parent; |
---|
3445 | 3525 | o.parent = null; |
---|
.. | .. |
---|
3450 | 3530 | |
---|
3451 | 3531 | out.flush(); |
---|
3452 | 3532 | |
---|
3453 | | - zstream.close(); |
---|
| 3533 | + baos //zstream |
---|
| 3534 | + .close(); |
---|
3454 | 3535 | out.close(); |
---|
3455 | 3536 | |
---|
3456 | | - return baos.toByteArray(); |
---|
| 3537 | + byte[] bytes = baos.toByteArray(); |
---|
| 3538 | + |
---|
| 3539 | + System.out.println("save #bytes = " + bytes.length); |
---|
| 3540 | + return bytes; |
---|
3457 | 3541 | } catch (Exception e) |
---|
3458 | 3542 | { |
---|
3459 | 3543 | System.err.println(e); |
---|
.. | .. |
---|
3463 | 3547 | |
---|
3464 | 3548 | static public Object Uncompress(byte[] bytes) |
---|
3465 | 3549 | { |
---|
3466 | | - System.out.println("#bytes = " + bytes.length); |
---|
| 3550 | + System.out.println("restore #bytes = " + bytes.length); |
---|
3467 | 3551 | try |
---|
3468 | 3552 | { |
---|
3469 | 3553 | ByteArrayInputStream bais = new ByteArrayInputStream(bytes); |
---|
3470 | | - java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais); |
---|
3471 | | - ObjectInputStream in = new ObjectInputStream(istream); |
---|
| 3554 | + //java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais); |
---|
| 3555 | + ObjectInputStream in = new ObjectInputStream(bais); // istream); |
---|
3472 | 3556 | Object obj = in.readObject(); |
---|
| 3557 | + |
---|
| 3558 | + bais //istream |
---|
| 3559 | + .close(); |
---|
3473 | 3560 | in.close(); |
---|
3474 | 3561 | |
---|
3475 | 3562 | return obj; |
---|
.. | .. |
---|
3524 | 3611 | return null; |
---|
3525 | 3612 | } |
---|
3526 | 3613 | |
---|
3527 | | - java.util.Hashtable<java.util.UUID, Object3D> hashtable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
3528 | 3614 | |
---|
3529 | 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) |
---|
3530 | 3640 | { |
---|
3531 | 3641 | System.err.println("Save"); |
---|
3532 | 3642 | |
---|
3533 | 3643 | cRadio tab = GetCurrentTab(); |
---|
3534 | 3644 | |
---|
3535 | | - boolean temp = CameraPane.SWITCH; |
---|
3536 | | - CameraPane.SWITCH = false; |
---|
| 3645 | + byte[] compress = CompressCopy(); |
---|
3537 | 3646 | |
---|
3538 | | - 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 | + } |
---|
3539 | 3654 | |
---|
3540 | 3655 | //EditorFrame.m_MainFrame.requestFocusInWindow(); |
---|
3541 | | - tab.graphs[tab.undoindex++] = Compress(copy); |
---|
| 3656 | + if (!thesame) |
---|
| 3657 | + { |
---|
| 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++; |
---|
| 3665 | + } |
---|
3542 | 3666 | |
---|
3543 | | - copy.RestoreBigData(hashtable); |
---|
| 3667 | + //copy.RestoreBigData(versiontable); |
---|
3544 | 3668 | |
---|
3545 | | - CameraPane.SWITCH = temp; |
---|
3546 | | - |
---|
3547 | 3669 | //assert(hashtable.isEmpty()); |
---|
3548 | 3670 | |
---|
3549 | | - for (int i = tab.undoindex; i < tab.graphs.length; i++) |
---|
| 3671 | + for (int i = copy.versionindex+1; i < copy.versions.length; i++) |
---|
3550 | 3672 | { |
---|
3551 | | - tab.graphs[i] = null; |
---|
| 3673 | + //tab.user[i] = false; |
---|
| 3674 | + copy.versions[i] = null; |
---|
3552 | 3675 | } |
---|
3553 | 3676 | |
---|
3554 | 3677 | SetUndoStates(); |
---|
.. | .. |
---|
3558 | 3681 | { |
---|
3559 | 3682 | try |
---|
3560 | 3683 | { |
---|
3561 | | - FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex); |
---|
| 3684 | + FileOutputStream ostream = new FileOutputStream("save" + copy.versionindex); |
---|
3562 | 3685 | ObjectOutputStream p = new ObjectOutputStream(ostream); |
---|
3563 | 3686 | |
---|
3564 | 3687 | p.writeObject(copy); |
---|
.. | .. |
---|
3571 | 3694 | e.printStackTrace(); |
---|
3572 | 3695 | } |
---|
3573 | 3696 | } |
---|
| 3697 | + |
---|
| 3698 | + return !thesame; |
---|
3574 | 3699 | } |
---|
3575 | 3700 | |
---|
3576 | 3701 | void CopyChanged(Object3D obj) |
---|
.. | .. |
---|
3580 | 3705 | boolean temp = CameraPane.SWITCH; |
---|
3581 | 3706 | CameraPane.SWITCH = false; |
---|
3582 | 3707 | |
---|
3583 | | - copy.ExtractBigData(hashtable); |
---|
| 3708 | + copy.ExtractBigData(versiontable); |
---|
3584 | 3709 | |
---|
3585 | 3710 | copy.clear(); |
---|
3586 | 3711 | |
---|
.. | .. |
---|
3589 | 3714 | copy.add(obj.get(i)); |
---|
3590 | 3715 | } |
---|
3591 | 3716 | |
---|
3592 | | - copy.RestoreBigData(hashtable); |
---|
| 3717 | + copy.RestoreBigData(versiontable); |
---|
3593 | 3718 | |
---|
3594 | 3719 | CameraPane.SWITCH = temp; |
---|
3595 | 3720 | |
---|
.. | .. |
---|
3617 | 3742 | } |
---|
3618 | 3743 | |
---|
3619 | 3744 | cButton undoButton; |
---|
| 3745 | + cButton restoreButton; |
---|
| 3746 | + cButton replaceButton; |
---|
3620 | 3747 | cButton redoButton; |
---|
3621 | 3748 | |
---|
| 3749 | + boolean muteSlider; |
---|
| 3750 | + |
---|
| 3751 | + int VersionCount() |
---|
| 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 | + |
---|
3622 | 3764 | void SetUndoStates() |
---|
3623 | 3765 | { |
---|
3624 | 3766 | cRadio tab = GetCurrentTab(); |
---|
3625 | 3767 | |
---|
3626 | | - undoButton.setEnabled(tab.undoindex > 0); |
---|
3627 | | - redoButton.setEnabled(tab.graphs[tab.undoindex + 1] != null); |
---|
| 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; |
---|
3628 | 3778 | } |
---|
3629 | 3779 | |
---|
3630 | | - public void Undo() |
---|
| 3780 | + public boolean Undo() |
---|
3631 | 3781 | { |
---|
| 3782 | + // Option? |
---|
| 3783 | + Replace(); |
---|
| 3784 | + |
---|
3632 | 3785 | System.err.println("Undo"); |
---|
3633 | 3786 | |
---|
3634 | 3787 | cRadio tab = GetCurrentTab(); |
---|
3635 | 3788 | |
---|
3636 | | - if (tab.undoindex == 0) |
---|
| 3789 | + if (copy.versionindex == 0) |
---|
3637 | 3790 | { |
---|
3638 | 3791 | java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
3639 | | - return; |
---|
| 3792 | + return false; |
---|
3640 | 3793 | } |
---|
3641 | 3794 | |
---|
3642 | | - 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) |
---|
3643 | 3822 | { |
---|
3644 | | - Save(); |
---|
3645 | | - tab.undoindex -= 1; |
---|
| 3823 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 3824 | + return false; |
---|
3646 | 3825 | } |
---|
3647 | 3826 | |
---|
3648 | | - tab.undoindex -= 1; |
---|
| 3827 | + CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 3828 | + |
---|
| 3829 | + return true; |
---|
| 3830 | + } |
---|
3649 | 3831 | |
---|
3650 | | - 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; |
---|
3651 | 3847 | } |
---|
3652 | 3848 | |
---|
3653 | 3849 | public void Redo() |
---|
3654 | 3850 | { |
---|
| 3851 | + // Option? |
---|
| 3852 | + Replace(); |
---|
| 3853 | + |
---|
3655 | 3854 | cRadio tab = GetCurrentTab(); |
---|
3656 | 3855 | |
---|
3657 | | - if (tab.graphs[tab.undoindex + 1] == null) |
---|
| 3856 | + if (copy.versions[copy.versionindex + 1] == null) |
---|
3658 | 3857 | { |
---|
3659 | 3858 | java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
3660 | 3859 | return; |
---|
3661 | 3860 | } |
---|
3662 | 3861 | |
---|
3663 | | - tab.undoindex += 1; |
---|
| 3862 | + copy.versionindex += 1; |
---|
3664 | 3863 | |
---|
3665 | | - 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; |
---|
3666 | 3868 | } |
---|
3667 | 3869 | |
---|
3668 | 3870 | void ImportGFD() |
---|
.. | .. |
---|
3958 | 4160 | //copy.Touch(); |
---|
3959 | 4161 | } |
---|
3960 | 4162 | |
---|
| 4163 | + cNumberSlider versionSlider; |
---|
| 4164 | + |
---|
3961 | 4165 | public void stateChanged(ChangeEvent e) |
---|
3962 | 4166 | { |
---|
3963 | 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 | + } |
---|
3964 | 4182 | |
---|
3965 | 4183 | if (freezematerial) |
---|
3966 | 4184 | { |
---|
.. | .. |
---|
4309 | 4527 | |
---|
4310 | 4528 | void makeSomething(Object3D thing, boolean resetmodel) // deselect) |
---|
4311 | 4529 | { |
---|
4312 | | - if (Globals.SAVEONMAKE) // && resetmodel) |
---|
| 4530 | + if (Globals.REPLACEONMAKE) // && resetmodel) |
---|
4313 | 4531 | Save(); |
---|
4314 | 4532 | //Tween.set(thing, 0).target(1).start(tweenManager); |
---|
4315 | 4533 | //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager); |
---|
.. | .. |
---|
4551 | 4769 | readobj.ResetDisplayList(); |
---|
4552 | 4770 | } catch (Exception e) |
---|
4553 | 4771 | { |
---|
4554 | | - //e.printStackTrace(); |
---|
| 4772 | + if (!e.toString().contains("GZIP")) |
---|
| 4773 | + e.printStackTrace(); |
---|
| 4774 | + |
---|
4555 | 4775 | try |
---|
4556 | 4776 | { |
---|
4557 | 4777 | java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
.. | .. |
---|
4625 | 4845 | |
---|
4626 | 4846 | if (readobj != null) |
---|
4627 | 4847 | { |
---|
4628 | | - if (Globals.SAVEONMAKE) |
---|
4629 | | - Save(); |
---|
| 4848 | + //if (Globals.SAVEONMAKE) // A new object cannot share meshes |
---|
| 4849 | + // Save(); |
---|
4630 | 4850 | try |
---|
4631 | 4851 | { |
---|
4632 | 4852 | //readobj.deepCopySelf(copy); |
---|
.. | .. |
---|
4671 | 4891 | } |
---|
4672 | 4892 | } catch (ClassCastException e) |
---|
4673 | 4893 | { |
---|
| 4894 | + e.printStackTrace(); |
---|
4674 | 4895 | assert (false); |
---|
4675 | 4896 | Composite c = (Composite) copy; |
---|
4676 | 4897 | c.children.clear(); |
---|
.. | .. |
---|
4681 | 4902 | c.addChild(csg); |
---|
4682 | 4903 | } |
---|
4683 | 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 | + |
---|
4684 | 4916 | ResetModel(); |
---|
4685 | 4917 | copy.HardTouch(); // recompile? |
---|
4686 | 4918 | refreshContents(); |
---|
4687 | 4919 | } |
---|
4688 | 4920 | } |
---|
4689 | 4921 | |
---|
4690 | | - void load() // throws ClassNotFoundException |
---|
| 4922 | + void Open() // throws ClassNotFoundException |
---|
4691 | 4923 | { |
---|
4692 | 4924 | if (Grafreed.standAlone) |
---|
4693 | 4925 | { |
---|
.. | .. |
---|
4790 | 5022 | //ps.print(buffer.toString()); |
---|
4791 | 5023 | } catch (IOException e) |
---|
4792 | 5024 | { |
---|
| 5025 | + e.printStackTrace(); |
---|
4793 | 5026 | } |
---|
4794 | 5027 | } |
---|
4795 | 5028 | |
---|
.. | .. |
---|
4972 | 5205 | MenuBar menuBar; |
---|
4973 | 5206 | Menu fileMenu; |
---|
4974 | 5207 | MenuItem newItem; |
---|
4975 | | - MenuItem loadItem; |
---|
| 5208 | + MenuItem openItem; |
---|
4976 | 5209 | MenuItem saveItem; |
---|
4977 | 5210 | MenuItem saveAsItem; |
---|
4978 | 5211 | MenuItem exportAsItem; |
---|
.. | .. |
---|
4995 | 5228 | CheckboxMenuItem toggleSwitchItem; |
---|
4996 | 5229 | CheckboxMenuItem toggleRootItem; |
---|
4997 | 5230 | CheckboxMenuItem animationItem; |
---|
| 5231 | + MenuItem archiveItem; |
---|
4998 | 5232 | CheckboxMenuItem toggleHandleItem; |
---|
4999 | 5233 | CheckboxMenuItem togglePaintItem; |
---|
5000 | 5234 | JSplitPane mainPanel; |
---|