.. | .. |
---|
36 | 36 | GroupEditor callee; |
---|
37 | 37 | JFrame frame; |
---|
38 | 38 | |
---|
| 39 | + static ObjEditor theFrame; |
---|
| 40 | + |
---|
39 | 41 | // SCRIPT |
---|
40 | 42 | |
---|
41 | 43 | transient JFrame textpanel = null; |
---|
.. | .. |
---|
168 | 170 | // objEditor.ctrlPanel.remove(remarkButton); |
---|
169 | 171 | |
---|
170 | 172 | objEditor.ctrlPanel.remove(setupPanel); |
---|
171 | | - objEditor.ctrlPanel.remove(commandsPanel); |
---|
| 173 | + objEditor.ctrlPanel.remove(setupPanel2); |
---|
| 174 | + objEditor.ctrlPanel.remove(objectCommandsPanel); |
---|
172 | 175 | objEditor.ctrlPanel.remove(pushPanel); |
---|
173 | 176 | //objEditor.ctrlPanel.remove(fillPanel); |
---|
174 | 177 | |
---|
.. | .. |
---|
243 | 246 | //localCopy.parent = null; |
---|
244 | 247 | |
---|
245 | 248 | frame = new JFrame(); |
---|
| 249 | + frame.setUndecorated(true); |
---|
246 | 250 | objEditor = this; |
---|
247 | 251 | this.callee = callee; |
---|
248 | 252 | |
---|
.. | .. |
---|
278 | 282 | frame.setMenuBar(menuBar = new MenuBar()); |
---|
279 | 283 | menuBar.add(fileMenu = new Menu("File")); |
---|
280 | 284 | fileMenu.add(newItem = new MenuItem("New")); |
---|
281 | | - fileMenu.add(loadItem = new MenuItem("Load...")); |
---|
| 285 | + fileMenu.add(loadItem = new MenuItem("Open...")); |
---|
282 | 286 | |
---|
283 | 287 | //oe.menuBar.add(menu = new Menu("Include")); |
---|
284 | 288 | Menu menu = new Menu("Import"); |
---|
.. | .. |
---|
323 | 327 | toolbarPanel.setName("Toolbar"); |
---|
324 | 328 | treePanel = new cGridBag(); |
---|
325 | 329 | treePanel.setName("Tree"); |
---|
| 330 | + |
---|
| 331 | + editPanel = new cGridBag().setVertical(true); |
---|
| 332 | + editPanel.setName("Edit"); |
---|
| 333 | + |
---|
326 | 334 | ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout()); |
---|
327 | | - ctrlPanel.setName("Edit"); |
---|
| 335 | + |
---|
| 336 | + editCommandsPanel = new cGridBag(); |
---|
| 337 | + editPanel.add(editCommandsPanel); |
---|
| 338 | + editPanel.add(ctrlPanel); |
---|
| 339 | + |
---|
328 | 340 | materialPanel = new cGridBag().setVertical(true); |
---|
| 341 | + |
---|
329 | 342 | materialPanel.setName("Material"); |
---|
330 | 343 | /*JTextPane*/ |
---|
331 | 344 | infoarea = createTextPane(); |
---|
.. | .. |
---|
419 | 432 | e.printStackTrace(); |
---|
420 | 433 | } |
---|
421 | 434 | |
---|
422 | | - String selection = infoarea.getText(); |
---|
423 | | - java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection); |
---|
424 | | - java.awt.datatransfer.Clipboard clipboard = |
---|
425 | | - Toolkit.getDefaultToolkit().getSystemClipboard(); |
---|
| 435 | +// String selection = infoarea.getText(); |
---|
| 436 | +// java.awt.datatransfer.StringSelection data = new java.awt.datatransfer.StringSelection(selection); |
---|
| 437 | +// java.awt.datatransfer.Clipboard clipboard = |
---|
| 438 | +// Toolkit.getDefaultToolkit().getSystemClipboard(); |
---|
426 | 439 | //clipboard.setContents(data, data); |
---|
427 | 440 | } |
---|
428 | 441 | |
---|
.. | .. |
---|
582 | 595 | } |
---|
583 | 596 | } |
---|
584 | 597 | |
---|
| 598 | +static GraphicsDevice device = GraphicsEnvironment |
---|
| 599 | + .getLocalGraphicsEnvironment().getScreenDevices()[0]; |
---|
| 600 | + |
---|
| 601 | + Rectangle keeprect; |
---|
| 602 | + cRadio radio; |
---|
| 603 | + |
---|
| 604 | +cButton keepButton; |
---|
| 605 | + cButton twoButton; // Full 3D |
---|
| 606 | + cButton sixButton; |
---|
| 607 | + cButton threeButton; |
---|
| 608 | + cButton sevenButton; |
---|
| 609 | + cButton fourButton; // full panel |
---|
| 610 | + cButton oneButton; // full XYZ |
---|
| 611 | + //cButton currentLayout; |
---|
| 612 | + |
---|
| 613 | + boolean maximized; |
---|
| 614 | + |
---|
| 615 | + void Minimize() |
---|
| 616 | + { |
---|
| 617 | + frame.setState(Frame.ICONIFIED); |
---|
| 618 | + } |
---|
| 619 | + |
---|
| 620 | + void Maximize() |
---|
| 621 | + { |
---|
| 622 | + if (maximized) |
---|
| 623 | + { |
---|
| 624 | + frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height); |
---|
| 625 | + } |
---|
| 626 | + else |
---|
| 627 | + { |
---|
| 628 | + keeprect = frame.getBounds(); |
---|
| 629 | + Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); |
---|
| 630 | + Dimension rect2 = frame.getToolkit().getScreenSize(); |
---|
| 631 | + frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height); |
---|
| 632 | +// frame.setState(Frame.MAXIMIZED_BOTH); |
---|
| 633 | + } |
---|
| 634 | + |
---|
| 635 | + maximized ^= true; |
---|
| 636 | + } |
---|
| 637 | + |
---|
585 | 638 | void ToggleFullScreen() |
---|
586 | 639 | { |
---|
587 | 640 | if (CameraPane.FULLSCREEN) |
---|
588 | 641 | { |
---|
589 | | - frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
590 | | - framePanel.add(bigThree); |
---|
591 | | - frame.getContentPane().add(/*"Center",*/framePanel); |
---|
| 642 | + device.setFullScreenWindow(null); |
---|
| 643 | + //frame.setVisible(false); |
---|
| 644 | +// frame.removeNotify(); |
---|
| 645 | +// frame.setUndecorated(false); |
---|
| 646 | +// frame.addNotify(); |
---|
| 647 | + //frame.setBounds(keeprect.x, keeprect.y, keeprect.width, keeprect.height); |
---|
| 648 | + |
---|
| 649 | +// X frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
| 650 | +// X framePanel.add(bigThree); |
---|
| 651 | +// X frame.getContentPane().add(/*"Center",*/framePanel); |
---|
| 652 | + framePanel.setDividerLocation(1); |
---|
| 653 | + |
---|
| 654 | + //frame.setVisible(true); |
---|
| 655 | + radio.layout = keepButton; |
---|
| 656 | + //theFrame = null; |
---|
| 657 | + keepButton = null; |
---|
| 658 | + radio.layout.doClick(); |
---|
| 659 | + |
---|
592 | 660 | } else |
---|
593 | 661 | { |
---|
594 | | - frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
595 | | - framePanel.remove(bigThree); |
---|
596 | | - frame.getContentPane().add(/*"Center",*/bigThree); |
---|
| 662 | + keepButton = radio.layout; |
---|
| 663 | + //keeprect = frame.getBounds(); |
---|
| 664 | +// frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width, |
---|
| 665 | +// frame.getToolkit().getScreenSize().height); |
---|
| 666 | + //frame.setVisible(false); |
---|
| 667 | + device.setFullScreenWindow(frame); |
---|
| 668 | +// frame.removeNotify(); |
---|
| 669 | +// frame.setUndecorated(true); |
---|
| 670 | +// frame.addNotify(); |
---|
| 671 | +// X frame.getContentPane().remove(/*"Center",*/framePanel); |
---|
| 672 | +// X framePanel.remove(bigThree); |
---|
| 673 | +// X frame.getContentPane().add(/*"Center",*/bigThree); |
---|
| 674 | + framePanel.setDividerLocation(0); |
---|
| 675 | + |
---|
| 676 | + radio.layout = twoButton; |
---|
| 677 | + radio.layout.doClick(); |
---|
| 678 | + //frame.setVisible(true); |
---|
597 | 679 | } |
---|
| 680 | + |
---|
598 | 681 | cameraView.ToggleFullScreen(); |
---|
599 | 682 | } |
---|
600 | 683 | |
---|
.. | .. |
---|
745 | 828 | JButton fasterButton; |
---|
746 | 829 | JButton remarkButton; |
---|
747 | 830 | |
---|
| 831 | + cGridBag editPanel; |
---|
| 832 | + cGridBag editCommandsPanel; |
---|
| 833 | + |
---|
748 | 834 | cGridBag namePanel; |
---|
749 | 835 | cGridBag setupPanel; |
---|
750 | | - cGridBag commandsPanel; |
---|
| 836 | + cGridBag setupPanel2; |
---|
| 837 | + cGridBag objectCommandsPanel; |
---|
751 | 838 | cGridBag pushPanel; |
---|
752 | 839 | cGridBag fillPanel; |
---|
753 | 840 | |
---|
.. | .. |
---|
939 | 1026 | markCB = AddCheckBox(setupPanel, "Mark", copy.marked); |
---|
940 | 1027 | markCB.setToolTipText("Set the animation target transform"); |
---|
941 | 1028 | |
---|
942 | | - rewindCB = AddCheckBox(setupPanel, "Rewind", copy.rewind); |
---|
| 1029 | + setupPanel2 = new cGridBag().setVertical(false); |
---|
| 1030 | + |
---|
| 1031 | + rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind); |
---|
943 | 1032 | rewindCB.setToolTipText("Rewind animation"); |
---|
944 | 1033 | |
---|
945 | | - randomCB = AddCheckBox(setupPanel, "Random", copy.random); |
---|
946 | | - randomCB.setToolTipText("Option for switch node"); |
---|
| 1034 | + randomCB = AddCheckBox(setupPanel2, "Rand", copy.random); |
---|
| 1035 | + randomCB.setToolTipText("Randomly Rewind or Go back and forth"); |
---|
947 | 1036 | |
---|
948 | 1037 | if (Globals.ADVANCED) |
---|
949 | 1038 | { |
---|
950 | | - link2masterCB = AddCheckBox(setupPanel, "Support", copy.link2master); |
---|
| 1039 | + link2masterCB = AddCheckBox(setupPanel2, "Supp", copy.link2master); |
---|
951 | 1040 | link2masterCB.setToolTipText("Attach to support"); |
---|
952 | | - speedupCB = AddCheckBox(setupPanel, "Speed", copy.speedup); |
---|
| 1041 | + speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup); |
---|
953 | 1042 | speedupCB.setToolTipText("Option motion capture"); |
---|
954 | 1043 | } |
---|
955 | 1044 | |
---|
956 | 1045 | oe.ctrlPanel.add(setupPanel); |
---|
957 | 1046 | oe.ctrlPanel.Return(); |
---|
| 1047 | + oe.ctrlPanel.add(setupPanel2); |
---|
| 1048 | + oe.ctrlPanel.Return(); |
---|
958 | 1049 | |
---|
959 | | - commandsPanel = new cGridBag().setVertical(false); |
---|
| 1050 | + objectCommandsPanel = new cGridBag().setVertical(false); |
---|
960 | 1051 | |
---|
961 | | - resetButton = AddButton(commandsPanel, "Reset"); |
---|
| 1052 | + resetButton = AddButton(objectCommandsPanel, "Reset"); |
---|
962 | 1053 | resetButton.setToolTipText("Jump to frame zero"); |
---|
963 | | - stepButton = AddButton(commandsPanel, "Step"); |
---|
| 1054 | + stepButton = AddButton(objectCommandsPanel, "Step"); |
---|
964 | 1055 | stepButton.setToolTipText("Step one frame"); |
---|
965 | 1056 | // resetAllButton = AddButton(oe, "Reset All"); |
---|
966 | 1057 | // stepAllButton = AddButton(oe, "Step All"); |
---|
967 | 1058 | // Return(); |
---|
968 | | - slowerButton = AddButton(commandsPanel, "Slow"); |
---|
| 1059 | + slowerButton = AddButton(objectCommandsPanel, "Slow"); |
---|
969 | 1060 | slowerButton.setToolTipText("Decrease animation speed"); |
---|
970 | | - fasterButton = AddButton(commandsPanel, "Fast"); |
---|
| 1061 | + fasterButton = AddButton(objectCommandsPanel, "Fast"); |
---|
971 | 1062 | fasterButton.setToolTipText("Increase animation speed"); |
---|
972 | | - remarkButton = AddButton(commandsPanel, "Remark"); |
---|
| 1063 | + remarkButton = AddButton(objectCommandsPanel, "Remark"); |
---|
973 | 1064 | remarkButton.setToolTipText("Set the current transform as the target"); |
---|
974 | 1065 | |
---|
975 | | - oe.ctrlPanel.add(commandsPanel); |
---|
| 1066 | + oe.ctrlPanel.add(objectCommandsPanel); |
---|
976 | 1067 | oe.ctrlPanel.Return(); |
---|
977 | 1068 | |
---|
978 | 1069 | pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons |
---|
.. | .. |
---|
1178 | 1269 | //worldPanel.setName("World"); |
---|
1179 | 1270 | centralPanel = new cGridBag(); |
---|
1180 | 1271 | centralPanel.preferredWidth = 20; |
---|
1181 | | - timelinePanel = new JPanel(new BorderLayout()); |
---|
1182 | | - timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel); |
---|
| 1272 | + |
---|
| 1273 | + if (Globals.ADVANCED) |
---|
| 1274 | + { |
---|
| 1275 | + timelinePanel = new JPanel(new BorderLayout()); |
---|
| 1276 | + timelineMenubar = new timeflow.app.TimeflowApp().TimeFlowWindow(timelinePanel); |
---|
1183 | 1277 | |
---|
1184 | 1278 | cameraPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, cameraView, timelinePanel); |
---|
1185 | 1279 | cameraPanel.setContinuousLayout(true); |
---|
.. | .. |
---|
1188 | 1282 | // cameraPanel.setDividerSize(9); |
---|
1189 | 1283 | cameraPanel.setResizeWeight(1.0); |
---|
1190 | 1284 | |
---|
| 1285 | + } |
---|
| 1286 | + |
---|
1191 | 1287 | centralPanel.add(cameraView); |
---|
| 1288 | + centralPanel.setFocusable(true); |
---|
1192 | 1289 | //frame.setJMenuBar(timelineMenubar); |
---|
1193 | 1290 | //centralPanel.add(timelinePanel); |
---|
1194 | 1291 | |
---|
.. | .. |
---|
1255 | 1352 | // north.setName("Edit"); |
---|
1256 | 1353 | // north.add(ctrlPanel, BorderLayout.NORTH); |
---|
1257 | 1354 | // objectPanel.add(north); |
---|
1258 | | - objectPanel.add(ctrlPanel); |
---|
| 1355 | + objectPanel.add(editPanel); |
---|
1259 | 1356 | objectPanel.add(infoPanel); |
---|
1260 | 1357 | |
---|
1261 | 1358 | /* |
---|
.. | .. |
---|
1386 | 1483 | frame.setSize(1280, 860); |
---|
1387 | 1484 | frame.setVisible(true); |
---|
1388 | 1485 | |
---|
| 1486 | + cameraView.requestFocusInWindow(); |
---|
| 1487 | + |
---|
1389 | 1488 | gridPanel.setDividerLocation(1.0); |
---|
1390 | 1489 | |
---|
1391 | 1490 | frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); |
---|
.. | .. |
---|
1935 | 2034 | e2.printStackTrace(); |
---|
1936 | 2035 | } |
---|
1937 | 2036 | } |
---|
| 2037 | + |
---|
1938 | 2038 | LoadJMEThread loadThread; |
---|
1939 | 2039 | |
---|
1940 | 2040 | class LoadJMEThread extends Thread |
---|
.. | .. |
---|
1992 | 2092 | //LoadFile0(filename, converter); |
---|
1993 | 2093 | } |
---|
1994 | 2094 | } |
---|
| 2095 | + |
---|
1995 | 2096 | LoadOBJThread loadObjThread; |
---|
1996 | 2097 | |
---|
1997 | 2098 | class LoadOBJThread extends Thread |
---|
.. | .. |
---|
2070 | 2171 | |
---|
2071 | 2172 | void LoadObjFile(String fullname) |
---|
2072 | 2173 | { |
---|
2073 | | - /* |
---|
| 2174 | + System.out.println("Loading " + fullname); |
---|
| 2175 | + /**/ |
---|
2074 | 2176 | //lastFilename = fullname; |
---|
2075 | 2177 | if(loadObjThread == null) |
---|
2076 | 2178 | { |
---|
2077 | | - loadObjThread = new LoadOBJThread(); |
---|
2078 | | - loadObjThread.start(); |
---|
| 2179 | + loadObjThread = new LoadOBJThread(); |
---|
| 2180 | + loadObjThread.start(); |
---|
2079 | 2181 | } |
---|
2080 | 2182 | |
---|
2081 | 2183 | loadObjThread.add(fullname); |
---|
2082 | | - */ |
---|
| 2184 | + /**/ |
---|
2083 | 2185 | |
---|
2084 | | - System.out.println("Loading " + fullname); |
---|
2085 | | - makeSomething(new FileObject(fullname, true), true); |
---|
| 2186 | + //makeSomething(new FileObject(fullname, true), true); |
---|
2086 | 2187 | } |
---|
2087 | 2188 | |
---|
2088 | 2189 | void LoadGFDFile(String fullname) |
---|
.. | .. |
---|
2925 | 3026 | return; |
---|
2926 | 3027 | } else if (event.getSource() == toggleSwitchItem) |
---|
2927 | 3028 | { |
---|
2928 | | - cameraView.ToggleRandom(); |
---|
| 3029 | + cameraView.ToggleSwitch(); |
---|
2929 | 3030 | cameraView.repaint(); |
---|
2930 | 3031 | return; |
---|
2931 | 3032 | } else if (event.getSource() == toggleHandleItem) |
---|
.. | .. |
---|
3212 | 3313 | objEditor.refreshContents(); |
---|
3213 | 3314 | } |
---|
3214 | 3315 | |
---|
3215 | | - Object3D graphs[] = new Object3D[10000]; |
---|
3216 | | - int undoindex = 0; |
---|
3217 | | - |
---|
3218 | | - static public Object clone(Object o) |
---|
| 3316 | + static public byte[] Compress(Object3D o) |
---|
3219 | 3317 | { |
---|
3220 | 3318 | try |
---|
3221 | 3319 | { |
---|
3222 | 3320 | ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
3223 | | - ObjectOutputStream out = new ObjectOutputStream(baos); |
---|
| 3321 | + java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos); |
---|
| 3322 | + ObjectOutputStream out = new ObjectOutputStream(zstream); |
---|
3224 | 3323 | |
---|
| 3324 | + Object3D parent = o.parent; |
---|
| 3325 | + o.parent = null; |
---|
| 3326 | + |
---|
3225 | 3327 | out.writeObject(o); |
---|
| 3328 | + |
---|
| 3329 | + o.parent = parent; |
---|
| 3330 | + |
---|
| 3331 | + out.flush(); |
---|
3226 | 3332 | |
---|
3227 | | - ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); |
---|
3228 | | - ObjectInputStream in = new ObjectInputStream(bais); |
---|
| 3333 | + zstream.close(); |
---|
| 3334 | + out.close(); |
---|
| 3335 | + |
---|
| 3336 | + return baos.toByteArray(); |
---|
| 3337 | + } catch (Exception e) |
---|
| 3338 | + { |
---|
| 3339 | + System.err.println(e); |
---|
| 3340 | + return null; |
---|
| 3341 | + } |
---|
| 3342 | + } |
---|
| 3343 | + |
---|
| 3344 | + static public Object Uncompress(byte[] bytes) |
---|
| 3345 | + { |
---|
| 3346 | + System.out.println("#bytes = " + bytes.length); |
---|
| 3347 | + try |
---|
| 3348 | + { |
---|
| 3349 | + ByteArrayInputStream bais = new ByteArrayInputStream(bytes); |
---|
| 3350 | + java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais); |
---|
| 3351 | + ObjectInputStream in = new ObjectInputStream(istream); |
---|
3229 | 3352 | Object obj = in.readObject(); |
---|
3230 | 3353 | in.close(); |
---|
3231 | | - out.close(); |
---|
| 3354 | + |
---|
3232 | 3355 | return obj; |
---|
3233 | 3356 | } catch (Exception e) |
---|
3234 | 3357 | { |
---|
.. | .. |
---|
3237 | 3360 | } |
---|
3238 | 3361 | } |
---|
3239 | 3362 | |
---|
| 3363 | + static public Object clone(Object o) |
---|
| 3364 | + { |
---|
| 3365 | + try |
---|
| 3366 | + { |
---|
| 3367 | + ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
| 3368 | + ObjectOutputStream out = new ObjectOutputStream(baos); |
---|
| 3369 | + |
---|
| 3370 | + out.writeObject(o); |
---|
| 3371 | + |
---|
| 3372 | + out.flush(); |
---|
| 3373 | + out.close(); |
---|
| 3374 | + |
---|
| 3375 | + byte[] bytes = baos.toByteArray(); |
---|
| 3376 | + |
---|
| 3377 | + System.out.println("clone = " + bytes.length); |
---|
| 3378 | + |
---|
| 3379 | + ByteArrayInputStream bais = new ByteArrayInputStream(bytes); |
---|
| 3380 | + ObjectInputStream in = new ObjectInputStream(bais); |
---|
| 3381 | + Object obj = in.readObject(); |
---|
| 3382 | + in.close(); |
---|
| 3383 | + |
---|
| 3384 | + return obj; |
---|
| 3385 | + } catch (Exception e) |
---|
| 3386 | + { |
---|
| 3387 | + System.err.println(e); |
---|
| 3388 | + return null; |
---|
| 3389 | + } |
---|
| 3390 | + } |
---|
| 3391 | + |
---|
| 3392 | + cRadio GetCurrentTab() |
---|
| 3393 | + { |
---|
| 3394 | + cRadio ab; |
---|
| 3395 | + for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();) |
---|
| 3396 | + { |
---|
| 3397 | + ab = (cRadio)e.nextElement(); |
---|
| 3398 | + if(ab.GetObject() == copy) |
---|
| 3399 | + { |
---|
| 3400 | + return ab; |
---|
| 3401 | + } |
---|
| 3402 | + } |
---|
| 3403 | + |
---|
| 3404 | + return null; |
---|
| 3405 | + } |
---|
| 3406 | + |
---|
| 3407 | + java.util.Hashtable<java.util.UUID, Object3D> hashtable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
| 3408 | + |
---|
3240 | 3409 | public void Save() |
---|
3241 | 3410 | { |
---|
3242 | | - if (true) return; |
---|
| 3411 | + cRadio tab = GetCurrentTab(); |
---|
| 3412 | + |
---|
| 3413 | + boolean temp = CameraPane.SWITCH; |
---|
| 3414 | + CameraPane.SWITCH = false; |
---|
| 3415 | + |
---|
| 3416 | + copy.ExtractBigData(hashtable); |
---|
3243 | 3417 | |
---|
3244 | 3418 | //EditorFrame.m_MainFrame.requestFocusInWindow(); |
---|
3245 | | - graphs[undoindex++] = (Object3D)clone(copy); |
---|
| 3419 | + tab.graphs[tab.undoindex++] = Compress(copy); |
---|
3246 | 3420 | |
---|
3247 | | - for (int i = undoindex; i < graphs.length; i++) |
---|
| 3421 | + copy.RestoreBigData(hashtable); |
---|
| 3422 | + |
---|
| 3423 | + CameraPane.SWITCH = temp; |
---|
| 3424 | + |
---|
| 3425 | + //assert(hashtable.isEmpty()); |
---|
| 3426 | + |
---|
| 3427 | + for (int i = tab.undoindex; i < tab.graphs.length; i++) |
---|
3248 | 3428 | { |
---|
3249 | | - graphs[i] = null; |
---|
| 3429 | + tab.graphs[i] = null; |
---|
3250 | 3430 | } |
---|
3251 | 3431 | |
---|
3252 | 3432 | // test save |
---|
.. | .. |
---|
3254 | 3434 | { |
---|
3255 | 3435 | try |
---|
3256 | 3436 | { |
---|
3257 | | - FileOutputStream ostream = new FileOutputStream("save" + undoindex); |
---|
| 3437 | + FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex); |
---|
3258 | 3438 | ObjectOutputStream p = new ObjectOutputStream(ostream); |
---|
3259 | 3439 | |
---|
3260 | 3440 | p.writeObject(copy); |
---|
.. | .. |
---|
3269 | 3449 | } |
---|
3270 | 3450 | } |
---|
3271 | 3451 | |
---|
| 3452 | + void CopyChanged(Object3D obj) |
---|
| 3453 | + { |
---|
| 3454 | + boolean temp = CameraPane.SWITCH; |
---|
| 3455 | + CameraPane.SWITCH = false; |
---|
| 3456 | + |
---|
| 3457 | + copy.ExtractBigData(hashtable); |
---|
| 3458 | + |
---|
| 3459 | + copy.clear(); |
---|
| 3460 | + |
---|
| 3461 | + for (int i=0; i<obj.Size(); i++) |
---|
| 3462 | + { |
---|
| 3463 | + copy.add(obj.get(i)); |
---|
| 3464 | + } |
---|
| 3465 | + |
---|
| 3466 | + copy.RestoreBigData(hashtable); |
---|
| 3467 | + |
---|
| 3468 | + CameraPane.SWITCH = temp; |
---|
| 3469 | + |
---|
| 3470 | + //assert(hashtable.isEmpty()); |
---|
| 3471 | + |
---|
| 3472 | + copy.Touch(); |
---|
| 3473 | + |
---|
| 3474 | + ResetModel(); |
---|
| 3475 | + copy.HardTouch(); // recompile? |
---|
| 3476 | + |
---|
| 3477 | + cRadio ab; |
---|
| 3478 | + for (java.util.Enumeration e = buttonGroup.getElements(); e.hasMoreElements();) |
---|
| 3479 | + { |
---|
| 3480 | + ab = (cRadio)e.nextElement(); |
---|
| 3481 | + Object3D test = copy.GetObject(ab.object.GetUUID()); |
---|
| 3482 | + //ab.camera = (Camera)copy.GetObject(ab.camera.GetUUID()); |
---|
| 3483 | + if (test != null) |
---|
| 3484 | + { |
---|
| 3485 | + test.editWindow = ab.object.editWindow; |
---|
| 3486 | + ab.object = test; |
---|
| 3487 | + } |
---|
| 3488 | + } |
---|
| 3489 | + |
---|
| 3490 | + refreshContents(); |
---|
| 3491 | + } |
---|
| 3492 | + |
---|
3272 | 3493 | public void Undo() |
---|
3273 | 3494 | { |
---|
3274 | | - if (undoindex == 0) |
---|
| 3495 | + cRadio tab = GetCurrentTab(); |
---|
| 3496 | + |
---|
| 3497 | + if (tab.undoindex == 0) |
---|
3275 | 3498 | { |
---|
3276 | 3499 | java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
3277 | 3500 | return; |
---|
3278 | 3501 | } |
---|
3279 | 3502 | |
---|
3280 | | - if (graphs[undoindex] == null) |
---|
| 3503 | + if (tab.graphs[tab.undoindex] == null) |
---|
3281 | 3504 | { |
---|
3282 | 3505 | Save(); |
---|
3283 | | - undoindex -= 1; |
---|
| 3506 | + tab.undoindex -= 1; |
---|
3284 | 3507 | } |
---|
3285 | 3508 | |
---|
3286 | | - undoindex -= 1; |
---|
| 3509 | + tab.undoindex -= 1; |
---|
3287 | 3510 | |
---|
3288 | | - copy = graphs[undoindex]; |
---|
3289 | | - |
---|
3290 | | - cameraView.object = copy; |
---|
3291 | | - copy.Touch(); |
---|
3292 | | - |
---|
3293 | | - ResetModel(); |
---|
3294 | | - refreshContents(); |
---|
| 3511 | + CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex])); |
---|
3295 | 3512 | } |
---|
3296 | 3513 | |
---|
3297 | 3514 | public void Redo() |
---|
3298 | 3515 | { |
---|
3299 | | - if (graphs[undoindex + 1] == null) |
---|
| 3516 | + cRadio tab = GetCurrentTab(); |
---|
| 3517 | + |
---|
| 3518 | + if (tab.graphs[tab.undoindex + 1] == null) |
---|
3300 | 3519 | { |
---|
3301 | 3520 | java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
3302 | 3521 | return; |
---|
3303 | 3522 | } |
---|
3304 | 3523 | |
---|
3305 | | - undoindex += 1; |
---|
| 3524 | + tab.undoindex += 1; |
---|
3306 | 3525 | |
---|
3307 | | - copy = graphs[undoindex]; |
---|
3308 | | - |
---|
3309 | | - cameraView.object = copy; |
---|
3310 | | - copy.Touch(); |
---|
3311 | | - |
---|
3312 | | - ResetModel(); |
---|
3313 | | - refreshContents(); |
---|
| 3526 | + CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex])); |
---|
3314 | 3527 | } |
---|
3315 | 3528 | |
---|
3316 | 3529 | void ImportGFD() |
---|
.. | .. |
---|
4181 | 4394 | |
---|
4182 | 4395 | try |
---|
4183 | 4396 | { |
---|
| 4397 | + // Try compressed version first. |
---|
4184 | 4398 | java.io.FileInputStream istream = new java.io.FileInputStream(fullname); |
---|
4185 | 4399 | java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream); |
---|
4186 | 4400 | java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream); |
---|
.. | .. |
---|
4250 | 4464 | |
---|
4251 | 4465 | void LoadIt(Object obj) |
---|
4252 | 4466 | { |
---|
| 4467 | + if (obj == null) |
---|
| 4468 | + { |
---|
| 4469 | + // Invalid file |
---|
| 4470 | + return; |
---|
| 4471 | + } |
---|
| 4472 | + |
---|
4253 | 4473 | System.out.println("Loaded " + obj); |
---|
4254 | 4474 | //new Exception().printStackTrace(); |
---|
4255 | 4475 | Object3D readobj = (Object3D) obj; |
---|
.. | .. |
---|
4259 | 4479 | |
---|
4260 | 4480 | if (readobj != null) |
---|
4261 | 4481 | { |
---|
| 4482 | + Save(); |
---|
4262 | 4483 | try |
---|
4263 | 4484 | { |
---|
4264 | 4485 | //readobj.deepCopySelf(copy); |
---|