.. | .. |
---|
41 | 41 | JFrame frame; |
---|
42 | 42 | |
---|
43 | 43 | static ObjEditor theFrame; |
---|
| 44 | + |
---|
| 45 | + public cGridBag GetSeparator() |
---|
| 46 | + { |
---|
| 47 | + cGridBag separator = new cGridBag(); |
---|
| 48 | + separator.add(new JSeparator()); |
---|
| 49 | + separator.preferredHeight = 5; |
---|
| 50 | + return separator; |
---|
| 51 | + } |
---|
44 | 52 | |
---|
45 | 53 | cButton GetButton(String name, boolean border) |
---|
46 | 54 | { |
---|
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 | | - } |
---|
| 55 | + ImageIcon icon = GetIcon(name); |
---|
| 56 | + return new cButton(icon, border); |
---|
| 57 | + } |
---|
| 58 | + |
---|
| 59 | + cLabel GetLabel(String name, boolean border) |
---|
| 60 | + { |
---|
| 61 | + //ImageIcon icon = GetIcon(name); |
---|
| 62 | + return new cLabel(GetImage(name), border); |
---|
56 | 63 | } |
---|
57 | 64 | |
---|
58 | 65 | cToggleButton GetToggleButton(String name, boolean border) |
---|
59 | 66 | { |
---|
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 | | - } |
---|
| 67 | + ImageIcon icon = GetIcon(name); |
---|
| 68 | + return new cToggleButton(icon, border); |
---|
69 | 69 | } |
---|
70 | 70 | |
---|
71 | 71 | cCheckBox GetCheckBox(String name, boolean border) |
---|
72 | 72 | { |
---|
| 73 | + ImageIcon icon = GetIcon(name); |
---|
| 74 | + return new cCheckBox(icon, border); |
---|
| 75 | + } |
---|
| 76 | + |
---|
| 77 | + ImageIcon GetIcon(String name) |
---|
| 78 | + { |
---|
73 | 79 | try |
---|
74 | 80 | { |
---|
75 | | - ImageIcon icon = GetIcon(name); |
---|
76 | | - return new cCheckBox(icon, border); |
---|
| 81 | + BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name)); |
---|
| 82 | + |
---|
| 83 | +// if (image.getWidth() > 48 && image.getHeight() > 48) |
---|
| 84 | +// { |
---|
| 85 | +// BufferedImage resized = new BufferedImage(48, 48, image.getType()); |
---|
| 86 | +// Graphics2D g = resized.createGraphics(); |
---|
| 87 | +// g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); |
---|
| 88 | +// //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); |
---|
| 89 | +// g.drawImage(image, 0, 0, 48, 48, 0, 0, image.getWidth(), image.getHeight(), null); |
---|
| 90 | +// g.dispose(); |
---|
| 91 | +// |
---|
| 92 | +// image = resized; |
---|
| 93 | +// } |
---|
| 94 | + |
---|
| 95 | + javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image); |
---|
| 96 | + return icon; |
---|
77 | 97 | } |
---|
78 | 98 | catch (Exception e) |
---|
79 | 99 | { |
---|
80 | | - return new cCheckBox(name, border); |
---|
| 100 | + return null; |
---|
81 | 101 | } |
---|
82 | 102 | } |
---|
83 | | - |
---|
84 | | - private ImageIcon GetIcon(String name) throws IOException |
---|
| 103 | + |
---|
| 104 | + BufferedImage GetImage(String name) |
---|
85 | 105 | { |
---|
86 | | - BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name)); |
---|
87 | | - |
---|
88 | | - if (image.getWidth() != 24 && image.getHeight() != 24) |
---|
| 106 | + try |
---|
89 | 107 | { |
---|
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; |
---|
| 108 | + BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name)); |
---|
| 109 | + |
---|
| 110 | + return image; |
---|
98 | 111 | } |
---|
99 | | - |
---|
100 | | - javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image); |
---|
101 | | - return icon; |
---|
| 112 | + catch (Exception e) |
---|
| 113 | + { |
---|
| 114 | + return null; |
---|
| 115 | + } |
---|
102 | 116 | } |
---|
103 | 117 | |
---|
104 | 118 | // SCRIPT |
---|
.. | .. |
---|
282 | 296 | client = inClient; |
---|
283 | 297 | copy = client; |
---|
284 | 298 | |
---|
| 299 | + if (copy.versions == null) |
---|
| 300 | + { |
---|
| 301 | + copy.versions = new byte[100][]; |
---|
| 302 | + copy.versionindex = -1; |
---|
| 303 | + } |
---|
| 304 | + |
---|
285 | 305 | // "this" is not called: SetupUI2(objEditor); |
---|
286 | 306 | } |
---|
287 | 307 | |
---|
.. | .. |
---|
295 | 315 | client = inClient; |
---|
296 | 316 | copy = client; |
---|
297 | 317 | |
---|
| 318 | + if (copy.versions == null) |
---|
| 319 | + { |
---|
| 320 | + copy.versions = new byte[100][]; |
---|
| 321 | + copy.versionindex = -1; |
---|
| 322 | + } |
---|
| 323 | + |
---|
298 | 324 | SetupUI2(callee.GetEditor()); |
---|
299 | 325 | } |
---|
300 | 326 | |
---|
.. | .. |
---|
327 | 353 | copy = localCopy; |
---|
328 | 354 | copy.editWindow = this; |
---|
329 | 355 | |
---|
| 356 | + if (copy.versions == null) |
---|
| 357 | + { |
---|
| 358 | +// copy.versions = new byte[100][]; |
---|
| 359 | +// copy.versionindex = -1; |
---|
| 360 | + } |
---|
| 361 | + |
---|
330 | 362 | SetupMenu(); |
---|
331 | 363 | |
---|
332 | 364 | //SetupName(objEditor); // new |
---|
.. | .. |
---|
419 | 451 | |
---|
420 | 452 | toolbarPanel = new JPanel(); |
---|
421 | 453 | toolbarPanel.setName("Toolbar"); |
---|
| 454 | + |
---|
422 | 455 | treePanel = new cGridBag(); |
---|
423 | 456 | treePanel.setName("Tree"); |
---|
424 | 457 | |
---|
425 | 458 | editPanel = new cGridBag().setVertical(true); |
---|
426 | | - editPanel.setName("Edit"); |
---|
| 459 | + //editPanel.setName("Edit"); |
---|
427 | 460 | |
---|
428 | 461 | ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout()); |
---|
429 | 462 | |
---|
.. | .. |
---|
431 | 464 | editPanel.add(editCommandsPanel); |
---|
432 | 465 | editPanel.add(ctrlPanel); |
---|
433 | 466 | |
---|
434 | | - toolboxPanel = new cGridBag().setVertical(false); |
---|
435 | | - toolboxPanel.setName("Toolbox"); |
---|
| 467 | + toolboxPanel = new cGridBag().setVertical(true); |
---|
| 468 | + //toolboxPanel.setName("Toolbox"); |
---|
436 | 469 | |
---|
437 | 470 | materialPanel = new cGridBag().setVertical(true); |
---|
438 | | - materialPanel.setName("Material"); |
---|
| 471 | + //materialPanel.setName("Material"); |
---|
439 | 472 | |
---|
440 | 473 | /*JTextPane*/ |
---|
441 | 474 | infoarea = createTextPane(); |
---|
.. | .. |
---|
443 | 476 | |
---|
444 | 477 | infoarea.setEditable(true); |
---|
445 | 478 | SetText(); |
---|
| 479 | + |
---|
446 | 480 | // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f)); |
---|
447 | 481 | // infoarea.setOpaque(false); |
---|
448 | 482 | // //infoarea.setForeground(textcolor); |
---|
.. | .. |
---|
450 | 484 | // TEXTAREA infoarea.setWrapStyleWord(true); |
---|
451 | 485 | infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED); |
---|
452 | 486 | infoPanel.setPreferredSize(new Dimension(1, 1)); |
---|
453 | | - infoPanel.setName("Info"); |
---|
| 487 | + //infoPanel.setName("Info"); |
---|
454 | 488 | //infoPanel.setLayout(new BorderLayout()); |
---|
455 | 489 | //infoPanel.add(createTextPane()); |
---|
456 | 490 | |
---|
.. | .. |
---|
968 | 1002 | // NumberSlider vDivsField; |
---|
969 | 1003 | // JCheckBox endcaps; |
---|
970 | 1004 | JCheckBox liveCB; |
---|
971 | | - JCheckBox selectCB; |
---|
| 1005 | + JCheckBox selectableCB; |
---|
972 | 1006 | JCheckBox hideCB; |
---|
973 | 1007 | JCheckBox link2masterCB; |
---|
974 | 1008 | JCheckBox markCB; |
---|
.. | .. |
---|
1180 | 1214 | |
---|
1181 | 1215 | liveCB = AddCheckBox(setupPanel, "Live", copy.live); |
---|
1182 | 1216 | liveCB.setToolTipText("Animate object"); |
---|
1183 | | - selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect); |
---|
1184 | | - selectCB.setToolTipText("Make object selectable"); |
---|
| 1217 | + selectableCB = AddCheckBox(setupPanel, "Select", !copy.dontselect); |
---|
| 1218 | + selectableCB.setToolTipText("Make object selectable"); |
---|
1185 | 1219 | // Return(); |
---|
| 1220 | + |
---|
1186 | 1221 | hideCB = AddCheckBox(setupPanel, "Hide", copy.hide); |
---|
1187 | 1222 | hideCB.setToolTipText("Hide object"); |
---|
1188 | 1223 | markCB = AddCheckBox(setupPanel, "Mark", copy.marked); |
---|
1189 | 1224 | markCB.setToolTipText("As animation target transform"); |
---|
| 1225 | + |
---|
| 1226 | + ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false); |
---|
1190 | 1227 | |
---|
1191 | 1228 | setupPanel2 = new cGridBag().setVertical(false); |
---|
1192 | 1229 | |
---|
.. | .. |
---|
1474 | 1511 | XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll); |
---|
1475 | 1512 | XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll); |
---|
1476 | 1513 | XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll); |
---|
| 1514 | + //XYZPanel.setName("XYZ"); |
---|
1477 | 1515 | |
---|
1478 | 1516 | /* |
---|
1479 | 1517 | gridPanel = new JPanel(); //new BorderLayout()); |
---|
.. | .. |
---|
1511 | 1549 | //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); |
---|
1512 | 1550 | //tmp.setName("Edit"); |
---|
1513 | 1551 | objectPanel.add(materialPanel); |
---|
| 1552 | + objectPanel.setIconAt(0, GetIcon("icons/material.png")); |
---|
| 1553 | + objectPanel.setToolTipTextAt(0, "Material panel"); |
---|
| 1554 | + |
---|
1514 | 1555 | // JPanel north = new JPanel(new BorderLayout()); |
---|
1515 | 1556 | // north.setName("Edit"); |
---|
1516 | 1557 | // north.add(ctrlPanel, BorderLayout.NORTH); |
---|
1517 | 1558 | // objectPanel.add(north); |
---|
1518 | 1559 | objectPanel.add(editPanel); |
---|
| 1560 | + objectPanel.setIconAt(1, GetIcon("icons/write.png")); |
---|
| 1561 | + objectPanel.setToolTipTextAt(1, "Edit panel"); |
---|
1519 | 1562 | |
---|
1520 | 1563 | //if (Globals.ADVANCED) |
---|
1521 | 1564 | objectPanel.add(infoPanel); |
---|
| 1565 | + objectPanel.setIconAt(2, GetIcon("icons/info.png")); |
---|
| 1566 | + objectPanel.setToolTipTextAt(2, "Info panel"); |
---|
| 1567 | + |
---|
| 1568 | + objectPanel.add(XYZPanel); |
---|
| 1569 | + objectPanel.setIconAt(3, GetIcon("icons/XYZ.png")); |
---|
| 1570 | + objectPanel.setToolTipTextAt(3, "XYZ/RGB panel"); |
---|
1522 | 1571 | |
---|
1523 | 1572 | objectPanel.add(toolboxPanel); |
---|
| 1573 | + objectPanel.setIconAt(4, GetIcon("icons/primitives.png")); |
---|
| 1574 | + objectPanel.setToolTipTextAt(4, "Objects/backgrounds panel"); |
---|
1524 | 1575 | |
---|
1525 | 1576 | /* |
---|
1526 | 1577 | aConstraints.gridx = 0; |
---|
.. | .. |
---|
1541 | 1592 | scrollpane.addMouseWheelListener(this); // Default not fast enough |
---|
1542 | 1593 | |
---|
1543 | 1594 | /*JTabbedPane*/ scenePanel = new cGridBag(); |
---|
1544 | | - scenePanel.preferredWidth = 6; |
---|
| 1595 | + scenePanel.preferredWidth = 5; |
---|
1545 | 1596 | |
---|
1546 | 1597 | JTabbedPane tabbedPane = new JTabbedPane(); |
---|
1547 | 1598 | tabbedPane.add(scrollpane); |
---|
.. | .. |
---|
1619 | 1670 | bigThree = new cGridBag(); |
---|
1620 | 1671 | bigThree.addComponent(scenePanel); |
---|
1621 | 1672 | bigThree.addComponent(centralPanel); |
---|
1622 | | - bigThree.addComponent(XYZPanel); |
---|
| 1673 | + //bigThree.addComponent(XYZPanel); |
---|
1623 | 1674 | |
---|
1624 | 1675 | // // SIDE EFFECT!!! |
---|
1625 | 1676 | // aConstraints.gridx = 0; |
---|
.. | .. |
---|
1660 | 1711 | frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); |
---|
1661 | 1712 | frame.addWindowListener(new WindowAdapter() |
---|
1662 | 1713 | { |
---|
1663 | | - |
---|
1664 | 1714 | public void windowClosing(WindowEvent e) |
---|
1665 | 1715 | { |
---|
1666 | 1716 | Close(); |
---|
.. | .. |
---|
1722 | 1772 | //ctrlPanel.add(new JLabel("----------------------------------")); // , aConstraints); |
---|
1723 | 1773 | |
---|
1724 | 1774 | cGridBag colorSection = new cGridBag().setVertical(true); |
---|
| 1775 | + |
---|
| 1776 | + cGridBag huepanel = new cGridBag(); |
---|
| 1777 | + cGridBag huelabel = new cGridBag(); |
---|
| 1778 | + huelabel.add(GetLabel("icons/hue.png", false)); |
---|
| 1779 | + huelabel.preferredWidth = 20; |
---|
| 1780 | + huepanel.add(new cGridBag()); // Label |
---|
| 1781 | + huepanel.add(huelabel); // Field/slider |
---|
| 1782 | + |
---|
| 1783 | + huepanel.preferredHeight = 7; |
---|
| 1784 | + |
---|
| 1785 | + colorSection.add(huepanel); |
---|
1725 | 1786 | |
---|
1726 | 1787 | cGridBag color = new cGridBag(); |
---|
1727 | | - color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints); |
---|
1728 | | - colorLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1729 | | - color.add(colorField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 1788 | + |
---|
| 1789 | + color.add(colorLabel = new JLabel("Color/hue")); // , aConstraints); |
---|
| 1790 | + colorLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1791 | + color.add(colorField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
| 1792 | + |
---|
1730 | 1793 | //colorField.preferredWidth = 200; |
---|
1731 | 1794 | colorSection.add(color); |
---|
1732 | 1795 | |
---|
1733 | 1796 | cGridBag modulation = new cGridBag(); |
---|
1734 | 1797 | modulation.add(modulationLabel = new JLabel("Saturation")); // , aConstraints); |
---|
1735 | 1798 | modulationLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1736 | | - modulation.add(modulationField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
| 1799 | + modulation.add(modulationField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
1737 | 1800 | colorSection.add(modulation); |
---|
1738 | 1801 | |
---|
| 1802 | + cGridBag opacity = new cGridBag(); |
---|
| 1803 | + opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints); |
---|
| 1804 | + opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
| 1805 | + opacity.add(opacityField = new cNumberSlider(this, 0.001, 1)); // , aConstraints); |
---|
| 1806 | + colorSection.add(opacity); |
---|
| 1807 | + |
---|
| 1808 | + colorSection.add(GetSeparator()); |
---|
| 1809 | + |
---|
1739 | 1810 | cGridBag texture = new cGridBag(); |
---|
1740 | 1811 | texture.add(textureLabel = new JLabel("Texture")); // , aConstraints); |
---|
1741 | 1812 | textureLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1742 | 1813 | texture.add(textureField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1743 | 1814 | colorSection.add(texture); |
---|
1744 | 1815 | |
---|
1745 | | - panel.add(new JSeparator()); |
---|
| 1816 | + panel.add(GetSeparator()); |
---|
1746 | 1817 | |
---|
1747 | 1818 | panel.add(colorSection); |
---|
1748 | 1819 | |
---|
.. | .. |
---|
1798 | 1869 | shadowbias.add(shadowbiasField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1799 | 1870 | diffuseSection.add(shadowbias); |
---|
1800 | 1871 | |
---|
1801 | | - panel.add(new JSeparator()); |
---|
| 1872 | + panel.add(GetSeparator()); |
---|
1802 | 1873 | |
---|
1803 | 1874 | panel.add(diffuseSection); |
---|
1804 | 1875 | |
---|
.. | .. |
---|
1861 | 1932 | specularSection.add(anisoV); |
---|
1862 | 1933 | |
---|
1863 | 1934 | |
---|
1864 | | - panel.add(new JSeparator()); |
---|
| 1935 | + panel.add(GetSeparator()); |
---|
1865 | 1936 | |
---|
1866 | 1937 | panel.add(specularSection); |
---|
1867 | 1938 | |
---|
.. | .. |
---|
1886 | 1957 | backlitLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1887 | 1958 | backlit.add(backlitField = new cNumberSlider(this, 0.001, 50, -1)); // , aConstraints); |
---|
1888 | 1959 | colorSection.add(backlit); |
---|
1889 | | - |
---|
1890 | | - cGridBag opacity = new cGridBag(); |
---|
1891 | | - opacity.add(opacityLabel = new JLabel("Opacity")); // , aConstraints); |
---|
1892 | | - opacityLabel.setHorizontalAlignment(SwingConstants.TRAILING); |
---|
1893 | | - opacity.add(opacityField = new cNumberSlider(this, 0.001, 1, -0.5)); // , aConstraints); |
---|
1894 | | - colorSection.add(opacity); |
---|
1895 | 1960 | |
---|
1896 | 1961 | //panel.add(new JSeparator()); |
---|
1897 | 1962 | |
---|
.. | .. |
---|
1937 | 2002 | opacityPower.add(opacityPowerField = new cNumberSlider(this, 0.0, 10 /*10 dec 2013*/)); // , aConstraints); |
---|
1938 | 2003 | textureSection.add(opacityPower); |
---|
1939 | 2004 | |
---|
1940 | | - panel.add(new JSeparator()); |
---|
| 2005 | + panel.add(GetSeparator()); |
---|
1941 | 2006 | |
---|
1942 | 2007 | panel.add(textureSection); |
---|
1943 | 2008 | |
---|
.. | .. |
---|
3236 | 3301 | { |
---|
3237 | 3302 | copy.live ^= true; |
---|
3238 | 3303 | return; |
---|
3239 | | - } else if (event.getSource() == selectCB) |
---|
| 3304 | + } else if (event.getSource() == selectableCB) |
---|
3240 | 3305 | { |
---|
3241 | 3306 | copy.dontselect ^= true; |
---|
3242 | 3307 | return; |
---|
.. | .. |
---|
3627 | 3692 | |
---|
3628 | 3693 | cRadio tab = GetCurrentTab(); |
---|
3629 | 3694 | |
---|
3630 | | - byte[] compress = CompressCopy(); |
---|
| 3695 | + byte[] compress = CompressCopy(); // Saved version. No need for "Replace". |
---|
3631 | 3696 | |
---|
3632 | 3697 | boolean thesame = false; |
---|
3633 | 3698 | |
---|
.. | .. |
---|
3694 | 3759 | |
---|
3695 | 3760 | copy.clear(); |
---|
3696 | 3761 | |
---|
| 3762 | + copy.skyboxname = obj.skyboxname; |
---|
| 3763 | + copy.skyboxext = obj.skyboxext; |
---|
| 3764 | + |
---|
3697 | 3765 | for (int i=0; i<obj.Size(); i++) |
---|
3698 | 3766 | { |
---|
3699 | 3767 | copy.add(obj.get(i)); |
---|
.. | .. |
---|
3731 | 3799 | cButton replaceButton; |
---|
3732 | 3800 | cButton redoButton; |
---|
3733 | 3801 | |
---|
| 3802 | + boolean muteSlider; |
---|
| 3803 | + |
---|
| 3804 | + int VersionCount() |
---|
| 3805 | + { |
---|
| 3806 | + int count = 0; |
---|
| 3807 | + |
---|
| 3808 | + for (int i = copy.versions.length; --i >= 0;) |
---|
| 3809 | + { |
---|
| 3810 | + if (copy.versions[i] != null) |
---|
| 3811 | + count++; |
---|
| 3812 | + } |
---|
| 3813 | + |
---|
| 3814 | + return count; |
---|
| 3815 | + } |
---|
| 3816 | + |
---|
3734 | 3817 | void SetUndoStates() |
---|
3735 | 3818 | { |
---|
3736 | 3819 | cRadio tab = GetCurrentTab(); |
---|
3737 | 3820 | |
---|
3738 | 3821 | restoreButton.setEnabled(copy.versionindex != -1); |
---|
3739 | 3822 | replaceButton.setEnabled(copy.versionindex != -1); |
---|
| 3823 | + |
---|
3740 | 3824 | undoButton.setEnabled(copy.versionindex > 0); |
---|
3741 | 3825 | redoButton.setEnabled(copy.versions[copy.versionindex + 1] != null); |
---|
| 3826 | + |
---|
| 3827 | + muteSlider = true; |
---|
| 3828 | + versionSlider.setMaximum(VersionCount() - 1); |
---|
| 3829 | + versionSlider.setInteger(copy.versionindex); |
---|
| 3830 | + muteSlider = false; |
---|
3742 | 3831 | } |
---|
3743 | 3832 | |
---|
3744 | 3833 | public boolean Undo() |
---|
3745 | 3834 | { |
---|
| 3835 | + // Option? |
---|
| 3836 | + Replace(); |
---|
| 3837 | + |
---|
3746 | 3838 | System.err.println("Undo"); |
---|
3747 | 3839 | |
---|
3748 | 3840 | cRadio tab = GetCurrentTab(); |
---|
.. | .. |
---|
3809 | 3901 | |
---|
3810 | 3902 | public void Redo() |
---|
3811 | 3903 | { |
---|
| 3904 | + // Option? |
---|
| 3905 | + Replace(); |
---|
| 3906 | + |
---|
3812 | 3907 | cRadio tab = GetCurrentTab(); |
---|
3813 | 3908 | |
---|
3814 | 3909 | if (copy.versions[copy.versionindex + 1] == null) |
---|
.. | .. |
---|
4118 | 4213 | //copy.Touch(); |
---|
4119 | 4214 | } |
---|
4120 | 4215 | |
---|
4121 | | - cNumberSlider versionField; |
---|
| 4216 | + cNumberSlider versionSlider; |
---|
4122 | 4217 | |
---|
4123 | 4218 | public void stateChanged(ChangeEvent e) |
---|
4124 | 4219 | { |
---|
4125 | 4220 | // assert(false); |
---|
4126 | | - if (e.getSource() == versionField) |
---|
| 4221 | + if (e.getSource() == versionSlider) |
---|
4127 | 4222 | { |
---|
4128 | | - int version = versionField.getInteger(); |
---|
| 4223 | + if (muteSlider) |
---|
| 4224 | + return; |
---|
| 4225 | + |
---|
| 4226 | + int version = versionSlider.getInteger(); |
---|
4129 | 4227 | |
---|
4130 | 4228 | if (copy.versions[version] != null) |
---|
4131 | 4229 | { |
---|
.. | .. |
---|
4724 | 4822 | readobj.ResetDisplayList(); |
---|
4725 | 4823 | } catch (Exception e) |
---|
4726 | 4824 | { |
---|
4727 | | - //e.printStackTrace(); |
---|
| 4825 | + if (!e.toString().contains("GZIP")) |
---|
| 4826 | + e.printStackTrace(); |
---|
| 4827 | + |
---|
4728 | 4828 | try |
---|
4729 | 4829 | { |
---|
4730 | 4830 | java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
.. | .. |
---|
4804 | 4904 | { |
---|
4805 | 4905 | //readobj.deepCopySelf(copy); |
---|
4806 | 4906 | copy.clear(); // june 2014 |
---|
| 4907 | + copy.skyboxname = readobj.skyboxname; |
---|
| 4908 | + copy.skyboxext = readobj.skyboxext; |
---|
4807 | 4909 | for (int i = 0; i < readobj.size(); i++) |
---|
4808 | 4910 | { |
---|
4809 | 4911 | Object3D child = readobj.get(i); // reserve(i); |
---|
.. | .. |
---|
4844 | 4946 | } |
---|
4845 | 4947 | } catch (ClassCastException e) |
---|
4846 | 4948 | { |
---|
| 4949 | + e.printStackTrace(); |
---|
4847 | 4950 | assert (false); |
---|
4848 | 4951 | Composite c = (Composite) copy; |
---|
4849 | 4952 | c.children.clear(); |
---|
.. | .. |
---|
4857 | 4960 | copy.versions = readobj.versions; |
---|
4858 | 4961 | copy.versionindex = readobj.versionindex; |
---|
4859 | 4962 | |
---|
4860 | | - SetUndoStates(); |
---|
| 4963 | + if (copy.versions == null) |
---|
| 4964 | + { |
---|
| 4965 | + copy.versions = new byte[100][]; |
---|
| 4966 | + copy.versionindex = -1; |
---|
| 4967 | + } |
---|
| 4968 | + |
---|
| 4969 | + //? SetUndoStates(); |
---|
4861 | 4970 | |
---|
4862 | 4971 | ResetModel(); |
---|
4863 | 4972 | copy.HardTouch(); // recompile? |
---|
.. | .. |
---|
4968 | 5077 | //ps.print(buffer.toString()); |
---|
4969 | 5078 | } catch (IOException e) |
---|
4970 | 5079 | { |
---|
| 5080 | + e.printStackTrace(); |
---|
4971 | 5081 | } |
---|
4972 | 5082 | } |
---|
4973 | 5083 | |
---|