Normand Briere
2019-07-22 c570e1e38f2ff8622a71f81436654bad01cfdd5b
ObjEditor.java
....@@ -44,61 +44,47 @@
4444
4545 cButton GetButton(String name, boolean border)
4646 {
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);
5649 }
5750
5851 cToggleButton GetToggleButton(String name, boolean border)
5952 {
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);
6955 }
7056
7157 cCheckBox GetCheckBox(String name, boolean border)
7258 {
59
+ ImageIcon icon = GetIcon(name);
60
+ return new cCheckBox(icon, border);
61
+ }
62
+
63
+ private ImageIcon GetIcon(String name)
64
+ {
7365 try
7466 {
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;
7783 }
7884 catch (Exception e)
7985 {
80
- return new cCheckBox(name, border);
86
+ return null;
8187 }
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;
10288 }
10389
10490 // SCRIPT
....@@ -282,6 +268,12 @@
282268 client = inClient;
283269 copy = client;
284270
271
+ if (copy.versions == null)
272
+ {
273
+ copy.versions = new byte[100][];
274
+ copy.versionindex = -1;
275
+ }
276
+
285277 // "this" is not called: SetupUI2(objEditor);
286278 }
287279
....@@ -295,6 +287,12 @@
295287 client = inClient;
296288 copy = client;
297289
290
+ if (copy.versions == null)
291
+ {
292
+ copy.versions = new byte[100][];
293
+ copy.versionindex = -1;
294
+ }
295
+
298296 SetupUI2(callee.GetEditor());
299297 }
300298
....@@ -327,6 +325,12 @@
327325 copy = localCopy;
328326 copy.editWindow = this;
329327
328
+ if (copy.versions == null)
329
+ {
330
+// copy.versions = new byte[100][];
331
+// copy.versionindex = -1;
332
+ }
333
+
330334 SetupMenu();
331335
332336 //SetupName(objEditor); // new
....@@ -419,11 +423,12 @@
419423
420424 toolbarPanel = new JPanel();
421425 toolbarPanel.setName("Toolbar");
426
+
422427 treePanel = new cGridBag();
423428 treePanel.setName("Tree");
424429
425430 editPanel = new cGridBag().setVertical(true);
426
- editPanel.setName("Edit");
431
+ //editPanel.setName("Edit");
427432
428433 ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout());
429434
....@@ -432,10 +437,10 @@
432437 editPanel.add(ctrlPanel);
433438
434439 toolboxPanel = new cGridBag().setVertical(false);
435
- toolboxPanel.setName("Toolbox");
440
+ //toolboxPanel.setName("Toolbox");
436441
437442 materialPanel = new cGridBag().setVertical(true);
438
- materialPanel.setName("Material");
443
+ //materialPanel.setName("Material");
439444
440445 /*JTextPane*/
441446 infoarea = createTextPane();
....@@ -443,6 +448,7 @@
443448
444449 infoarea.setEditable(true);
445450 SetText();
451
+
446452 // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f));
447453 // infoarea.setOpaque(false);
448454 // //infoarea.setForeground(textcolor);
....@@ -450,7 +456,7 @@
450456 // TEXTAREA infoarea.setWrapStyleWord(true);
451457 infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
452458 infoPanel.setPreferredSize(new Dimension(1, 1));
453
- infoPanel.setName("Info");
459
+ //infoPanel.setName("Info");
454460 //infoPanel.setLayout(new BorderLayout());
455461 //infoPanel.add(createTextPane());
456462
....@@ -816,6 +822,28 @@
816822 frame.validate();
817823 }
818824
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
+ }
846
+
819847 private JTextPane createTextPane()
820848 {
821849 // TEXTAREA String[] initString =
....@@ -946,7 +974,7 @@
946974 // NumberSlider vDivsField;
947975 // JCheckBox endcaps;
948976 JCheckBox liveCB;
949
- JCheckBox selectCB;
977
+ JCheckBox selectableCB;
950978 JCheckBox hideCB;
951979 JCheckBox link2masterCB;
952980 JCheckBox markCB;
....@@ -1158,9 +1186,10 @@
11581186
11591187 liveCB = AddCheckBox(setupPanel, "Live", copy.live);
11601188 liveCB.setToolTipText("Animate object");
1161
- selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
1162
- selectCB.setToolTipText("Make object selectable");
1189
+ selectableCB = AddCheckBox(setupPanel, "Select", !copy.dontselect);
1190
+ selectableCB.setToolTipText("Make object selectable");
11631191 // Return();
1192
+
11641193 hideCB = AddCheckBox(setupPanel, "Hide", copy.hide);
11651194 hideCB.setToolTipText("Hide object");
11661195 markCB = AddCheckBox(setupPanel, "Mark", copy.marked);
....@@ -1174,10 +1203,11 @@
11741203 randomCB = AddCheckBox(setupPanel2, "Random", copy.random);
11751204 randomCB.setToolTipText("Randomly Rewind (or Go back and forth)");
11761205
1206
+ link2masterCB = AddCheckBox(setupPanel2, "Support", copy.link2master);
1207
+ link2masterCB.setToolTipText("Attach to support");
1208
+
11771209 if (Globals.ADVANCED)
11781210 {
1179
- link2masterCB = AddCheckBox(setupPanel2, "Supp", copy.link2master);
1180
- link2masterCB.setToolTipText("Attach to support");
11811211 speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup);
11821212 speedupCB.setToolTipText("Option motion capture");
11831213 }
....@@ -1451,6 +1481,7 @@
14511481 XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll);
14521482 XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll);
14531483 XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll);
1484
+ //XYZPanel.setName("XYZ");
14541485
14551486 /*
14561487 gridPanel = new JPanel(); //new BorderLayout());
....@@ -1488,16 +1519,23 @@
14881519 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
14891520 //tmp.setName("Edit");
14901521 objectPanel.add(materialPanel);
1522
+ objectPanel.setIconAt(0, GetIcon("icons/material.png"));
14911523 // JPanel north = new JPanel(new BorderLayout());
14921524 // north.setName("Edit");
14931525 // north.add(ctrlPanel, BorderLayout.NORTH);
14941526 // objectPanel.add(north);
14951527 objectPanel.add(editPanel);
1528
+ objectPanel.setIconAt(1, GetIcon("icons/write.png"));
14961529
14971530 //if (Globals.ADVANCED)
14981531 objectPanel.add(infoPanel);
1532
+ objectPanel.setIconAt(2, GetIcon("icons/info.png"));
1533
+
1534
+ objectPanel.add(XYZPanel);
1535
+ objectPanel.setIconAt(3, GetIcon("icons/XYZ.png"));
14991536
15001537 objectPanel.add(toolboxPanel);
1538
+ objectPanel.setIconAt(4, GetIcon("icons/primitives.png"));
15011539
15021540 /*
15031541 aConstraints.gridx = 0;
....@@ -1518,7 +1556,7 @@
15181556 scrollpane.addMouseWheelListener(this); // Default not fast enough
15191557
15201558 /*JTabbedPane*/ scenePanel = new cGridBag();
1521
- scenePanel.preferredWidth = 6;
1559
+ scenePanel.preferredWidth = 5;
15221560
15231561 JTabbedPane tabbedPane = new JTabbedPane();
15241562 tabbedPane.add(scrollpane);
....@@ -1596,7 +1634,7 @@
15961634 bigThree = new cGridBag();
15971635 bigThree.addComponent(scenePanel);
15981636 bigThree.addComponent(centralPanel);
1599
- bigThree.addComponent(XYZPanel);
1637
+ //bigThree.addComponent(XYZPanel);
16001638
16011639 // // SIDE EFFECT!!!
16021640 // aConstraints.gridx = 0;
....@@ -3213,7 +3251,7 @@
32133251 {
32143252 copy.live ^= true;
32153253 return;
3216
- } else if (event.getSource() == selectCB)
3254
+ } else if (event.getSource() == selectableCB)
32173255 {
32183256 copy.dontselect ^= true;
32193257 return;
....@@ -3480,8 +3518,8 @@
34803518 try
34813519 {
34823520 ByteArrayOutputStream baos = new ByteArrayOutputStream();
3483
- java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
3484
- ObjectOutputStream out = new ObjectOutputStream(zstream);
3521
+// java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
3522
+ ObjectOutputStream out = new ObjectOutputStream(baos); //zstream);
34853523
34863524 Object3D parent = o.parent;
34873525 o.parent = null;
....@@ -3492,10 +3530,14 @@
34923530
34933531 out.flush();
34943532
3495
- zstream.close();
3533
+ baos //zstream
3534
+ .close();
34963535 out.close();
34973536
3498
- return baos.toByteArray();
3537
+ byte[] bytes = baos.toByteArray();
3538
+
3539
+ System.out.println("save #bytes = " + bytes.length);
3540
+ return bytes;
34993541 } catch (Exception e)
35003542 {
35013543 System.err.println(e);
....@@ -3505,13 +3547,16 @@
35053547
35063548 static public Object Uncompress(byte[] bytes)
35073549 {
3508
- System.out.println("#bytes = " + bytes.length);
3550
+ System.out.println("restore #bytes = " + bytes.length);
35093551 try
35103552 {
35113553 ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3512
- java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
3513
- ObjectInputStream in = new ObjectInputStream(istream);
3554
+ //java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
3555
+ ObjectInputStream in = new ObjectInputStream(bais); // istream);
35143556 Object obj = in.readObject();
3557
+
3558
+ bais //istream
3559
+ .close();
35153560 in.close();
35163561
35173562 return obj;
....@@ -3566,12 +3611,11 @@
35663611 return null;
35673612 }
35683613
3569
- java.util.Hashtable<java.util.UUID, Object3D> hashtable = new java.util.Hashtable<java.util.UUID, Object3D>();
35703614
35713615 public void Save()
35723616 {
3573
- // Default reduces the probability of heuristics errors.
3574
- Save(true);
3617
+ //Save(true);
3618
+ Replace();
35753619 }
35763620
35773621 private boolean Equal(byte[] compress, byte[] name)
....@@ -3590,25 +3634,20 @@
35903634 return true;
35913635 }
35923636
3637
+ java.util.Hashtable<java.util.UUID, Object3D> versiontable = new java.util.Hashtable<java.util.UUID, Object3D>();
3638
+
35933639 public boolean Save(boolean user)
35943640 {
35953641 System.err.println("Save");
35963642
35973643 cRadio tab = GetCurrentTab();
35983644
3599
- boolean temp = CameraPane.SWITCH;
3600
- CameraPane.SWITCH = false;
3601
-
3602
- copy.ExtractBigData(hashtable);
3603
-
3604
- byte[] compress = Compress(copy);
3605
-
3606
- CameraPane.SWITCH = temp;
3645
+ byte[] compress = CompressCopy();
36073646
36083647 boolean thesame = false;
36093648
36103649 // Quick heuristic using length. Works only when stream is compressed.
3611
- if (tab.undoindex > 0 && tab.graphs[tab.undoindex-1] != null && Equal(compress, tab.graphs[tab.undoindex-1]))
3650
+ if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1]))
36123651 {
36133652 thesame = true;
36143653 }
....@@ -3616,18 +3655,23 @@
36163655 //EditorFrame.m_MainFrame.requestFocusInWindow();
36173656 if (!thesame)
36183657 {
3619
- tab.user[tab.undoindex] = user;
3620
- tab.graphs[tab.undoindex++] = compress;
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++;
36213665 }
36223666
3623
- copy.RestoreBigData(hashtable);
3667
+ //copy.RestoreBigData(versiontable);
36243668
36253669 //assert(hashtable.isEmpty());
36263670
3627
- for (int i = tab.undoindex; i < tab.graphs.length; i++)
3671
+ for (int i = copy.versionindex+1; i < copy.versions.length; i++)
36283672 {
3629
- tab.user[i] = false;
3630
- tab.graphs[i] = null;
3673
+ //tab.user[i] = false;
3674
+ copy.versions[i] = null;
36313675 }
36323676
36333677 SetUndoStates();
....@@ -3637,7 +3681,7 @@
36373681 {
36383682 try
36393683 {
3640
- FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex);
3684
+ FileOutputStream ostream = new FileOutputStream("save" + copy.versionindex);
36413685 ObjectOutputStream p = new ObjectOutputStream(ostream);
36423686
36433687 p.writeObject(copy);
....@@ -3661,7 +3705,7 @@
36613705 boolean temp = CameraPane.SWITCH;
36623706 CameraPane.SWITCH = false;
36633707
3664
- copy.ExtractBigData(hashtable);
3708
+ copy.ExtractBigData(versiontable);
36653709
36663710 copy.clear();
36673711
....@@ -3670,7 +3714,7 @@
36703714 copy.add(obj.get(i));
36713715 }
36723716
3673
- copy.RestoreBigData(hashtable);
3717
+ copy.RestoreBigData(versiontable);
36743718
36753719 CameraPane.SWITCH = temp;
36763720
....@@ -3698,64 +3742,129 @@
36983742 }
36993743
37003744 cButton undoButton;
3745
+ cButton restoreButton;
3746
+ cButton replaceButton;
37013747 cButton redoButton;
37023748
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
+
37033764 void SetUndoStates()
37043765 {
37053766 cRadio tab = GetCurrentTab();
37063767
3707
- undoButton.setEnabled(tab.undoindex > 0);
3708
- 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;
37093778 }
37103779
37113780 public boolean Undo()
37123781 {
3782
+ // Option?
3783
+ Replace();
3784
+
37133785 System.err.println("Undo");
37143786
37153787 cRadio tab = GetCurrentTab();
37163788
3717
- if (tab.undoindex == 0)
3789
+ if (copy.versionindex == 0)
37183790 {
37193791 java.awt.Toolkit.getDefaultToolkit().beep();
37203792 return false;
37213793 }
37223794
3723
- if (tab.graphs[tab.undoindex] == null || !tab.user[tab.undoindex])
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)
37243822 {
3725
- if (Save(false))
3726
- tab.undoindex -= 1;
3727
- else
3728
- {
3729
- if (tab.undoindex <= 0)
3730
- return false;
3731
- else
3732
- tab.undoindex -= 1;
3733
- }
3823
+ java.awt.Toolkit.getDefaultToolkit().beep();
3824
+ return false;
37343825 }
37353826
3736
- tab.undoindex -= 1;
3827
+ CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
3828
+
3829
+ return true;
3830
+ }
37373831
3738
- 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();
37393845
37403846 return true;
37413847 }
37423848
37433849 public void Redo()
37443850 {
3851
+ // Option?
3852
+ Replace();
3853
+
37453854 cRadio tab = GetCurrentTab();
37463855
3747
- if (tab.graphs[tab.undoindex + 1] == null)
3856
+ if (copy.versions[copy.versionindex + 1] == null)
37483857 {
37493858 java.awt.Toolkit.getDefaultToolkit().beep();
37503859 return;
37513860 }
37523861
3753
- tab.undoindex += 1;
3862
+ copy.versionindex += 1;
37543863
3755
- CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
3864
+ CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex]));
37563865
3757
- if (!tab.user[tab.undoindex])
3758
- tab.graphs[tab.undoindex] = null;
3866
+ //if (!tab.user[tab.versionindex])
3867
+ // tab.graphs[tab.versionindex] = null;
37593868 }
37603869
37613870 void ImportGFD()
....@@ -4051,9 +4160,25 @@
40514160 //copy.Touch();
40524161 }
40534162
4163
+ cNumberSlider versionSlider;
4164
+
40544165 public void stateChanged(ChangeEvent e)
40554166 {
40564167 // 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
+ }
40574182
40584183 if (freezematerial)
40594184 {
....@@ -4402,7 +4527,7 @@
44024527
44034528 void makeSomething(Object3D thing, boolean resetmodel) // deselect)
44044529 {
4405
- if (Globals.SAVEONMAKE) // && resetmodel)
4530
+ if (Globals.REPLACEONMAKE) // && resetmodel)
44064531 Save();
44074532 //Tween.set(thing, 0).target(1).start(tweenManager);
44084533 //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
....@@ -4644,7 +4769,7 @@
46444769 readobj.ResetDisplayList();
46454770 } catch (Exception e)
46464771 {
4647
- //e.printStackTrace();
4772
+ e.printStackTrace();
46484773 try
46494774 {
46504775 java.io.FileInputStream istream = new java.io.FileInputStream(fullname);
....@@ -4718,8 +4843,8 @@
47184843
47194844 if (readobj != null)
47204845 {
4721
- if (Globals.SAVEONMAKE)
4722
- Save();
4846
+ //if (Globals.SAVEONMAKE) // A new object cannot share meshes
4847
+ // Save();
47234848 try
47244849 {
47254850 //readobj.deepCopySelf(copy);
....@@ -4774,6 +4899,17 @@
47744899 c.addChild(csg);
47754900 }
47764901
4902
+ copy.versions = readobj.versions;
4903
+ copy.versionindex = readobj.versionindex;
4904
+
4905
+ if (copy.versions == null)
4906
+ {
4907
+ copy.versions = new byte[100][];
4908
+ copy.versionindex = -1;
4909
+ }
4910
+
4911
+ //? SetUndoStates();
4912
+
47774913 ResetModel();
47784914 copy.HardTouch(); // recompile?
47794915 refreshContents();
....@@ -4883,6 +5019,7 @@
48835019 //ps.print(buffer.toString());
48845020 } catch (IOException e)
48855021 {
5022
+ e.printStackTrace();
48865023 }
48875024 }
48885025