.. | .. |
---|
309 | 309 | //localCopy.parent = null; |
---|
310 | 310 | |
---|
311 | 311 | frame = new JFrame(); |
---|
312 | | - frame.setUndecorated(true); |
---|
| 312 | + frame.setUndecorated(false); |
---|
313 | 313 | objEditor = this; |
---|
314 | 314 | this.callee = callee; |
---|
315 | 315 | |
---|
.. | .. |
---|
350 | 350 | frame.setMenuBar(menuBar = new MenuBar()); |
---|
351 | 351 | menuBar.add(fileMenu = new Menu("File")); |
---|
352 | 352 | fileMenu.add(newItem = new MenuItem("New")); |
---|
353 | | - fileMenu.add(loadItem = new MenuItem("Open...")); |
---|
| 353 | + fileMenu.add(openItem = new MenuItem("Open...")); |
---|
354 | 354 | |
---|
355 | 355 | //oe.menuBar.add(menu = new Menu("Include")); |
---|
356 | 356 | Menu menu = new Menu("Import"); |
---|
.. | .. |
---|
382 | 382 | } |
---|
383 | 383 | |
---|
384 | 384 | newItem.addActionListener(this); |
---|
385 | | - loadItem.addActionListener(this); |
---|
| 385 | + openItem.addActionListener(this); |
---|
386 | 386 | saveItem.addActionListener(this); |
---|
387 | 387 | saveAsItem.addActionListener(this); |
---|
388 | 388 | exportAsItem.addActionListener(this); |
---|
.. | .. |
---|
449 | 449 | // TEXTAREA infoarea.setLineWrap(true); |
---|
450 | 450 | // TEXTAREA infoarea.setWrapStyleWord(true); |
---|
451 | 451 | infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED); |
---|
452 | | - //infoPanel.setPreferredSize(new Dimension(50, 200)); |
---|
| 452 | + infoPanel.setPreferredSize(new Dimension(1, 1)); |
---|
453 | 453 | infoPanel.setName("Info"); |
---|
454 | 454 | //infoPanel.setLayout(new BorderLayout()); |
---|
455 | 455 | //infoPanel.add(createTextPane()); |
---|
.. | .. |
---|
699 | 699 | } |
---|
700 | 700 | } |
---|
701 | 701 | |
---|
702 | | -static GraphicsDevice device = GraphicsEnvironment |
---|
703 | | - .getLocalGraphicsEnvironment().getScreenDevices()[0]; |
---|
| 702 | +//static GraphicsDevice device = GraphicsEnvironment |
---|
| 703 | +// .getLocalGraphicsEnvironment().getScreenDevices()[0]; |
---|
704 | 704 | |
---|
705 | 705 | Rectangle keeprect; |
---|
706 | 706 | cRadio radio; |
---|
.. | .. |
---|
741 | 741 | else |
---|
742 | 742 | { |
---|
743 | 743 | keeprect = frame.getBounds(); |
---|
744 | | - Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); |
---|
745 | | - Dimension rect2 = frame.getToolkit().getScreenSize(); |
---|
746 | | - frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height); |
---|
| 744 | +// Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); |
---|
| 745 | +// Dimension rect2 = frame.getToolkit().getScreenSize(); |
---|
| 746 | +// frame.setBounds(0, rect2.height - rect.height, rect.width, rect.height); |
---|
747 | 747 | // frame.setState(Frame.MAXIMIZED_BOTH); |
---|
| 748 | + frame.setBounds(frame.getGraphicsConfiguration().getBounds()); |
---|
748 | 749 | } |
---|
749 | 750 | |
---|
750 | 751 | maximized ^= true; |
---|
.. | .. |
---|
758 | 759 | |
---|
759 | 760 | void ToggleFullScreen() |
---|
760 | 761 | { |
---|
| 762 | +GraphicsDevice device = frame.getGraphicsConfiguration().getDevice(); |
---|
| 763 | + |
---|
761 | 764 | cameraView.ToggleFullScreen(); |
---|
762 | 765 | |
---|
763 | 766 | if (!CameraPane.FULLSCREEN) |
---|
764 | 767 | { |
---|
765 | 768 | device.setFullScreenWindow(null); |
---|
| 769 | + frame.dispose(); |
---|
| 770 | + frame.setUndecorated(false); |
---|
766 | 771 | frame.validate(); |
---|
| 772 | + frame.setVisible(true); |
---|
767 | 773 | |
---|
768 | 774 | //frame.setVisible(false); |
---|
769 | 775 | // frame.removeNotify(); |
---|
.. | .. |
---|
774 | 780 | // X frame.getContentPane().remove(/*"Center",*/bigThree); |
---|
775 | 781 | // X framePanel.add(bigThree); |
---|
776 | 782 | // X frame.getContentPane().add(/*"Center",*/framePanel); |
---|
777 | | - framePanel.setDividerLocation(1); |
---|
| 783 | + framePanel.setDividerLocation(46); |
---|
778 | 784 | |
---|
779 | 785 | //frame.setVisible(true); |
---|
780 | 786 | radio.layout = keepButton; |
---|
.. | .. |
---|
789 | 795 | // frame.setBounds(0, 0, frame.getToolkit().getScreenSize().width, |
---|
790 | 796 | // frame.getToolkit().getScreenSize().height); |
---|
791 | 797 | //frame.setVisible(false); |
---|
| 798 | + |
---|
| 799 | + frame.dispose(); |
---|
| 800 | + frame.setUndecorated(true); |
---|
792 | 801 | device.setFullScreenWindow(frame); |
---|
793 | 802 | frame.validate(); |
---|
| 803 | + frame.setVisible(true); |
---|
794 | 804 | // frame.removeNotify(); |
---|
795 | 805 | // frame.setUndecorated(true); |
---|
796 | 806 | // frame.addNotify(); |
---|
.. | .. |
---|
805 | 815 | } |
---|
806 | 816 | frame.validate(); |
---|
807 | 817 | } |
---|
| 818 | + |
---|
| 819 | + private byte[] CompressCopy() |
---|
| 820 | + { |
---|
| 821 | + boolean temp = CameraPane.SWITCH; |
---|
| 822 | + CameraPane.SWITCH = false; |
---|
| 823 | + |
---|
| 824 | + copy.ExtractBigData(versiontable); |
---|
| 825 | + // if (copy == client) |
---|
| 826 | + |
---|
| 827 | + byte[] versions[] = copy.versions; |
---|
| 828 | + copy.versions = null; |
---|
| 829 | + |
---|
| 830 | + byte[] compress = Compress(copy); |
---|
| 831 | + |
---|
| 832 | + copy.versions = versions; |
---|
| 833 | + |
---|
| 834 | + copy.RestoreBigData(versiontable); |
---|
| 835 | + |
---|
| 836 | + CameraPane.SWITCH = temp; |
---|
| 837 | + |
---|
| 838 | + return compress; |
---|
| 839 | + } |
---|
808 | 840 | |
---|
809 | 841 | private JTextPane createTextPane() |
---|
810 | 842 | { |
---|
.. | .. |
---|
1164 | 1196 | randomCB = AddCheckBox(setupPanel2, "Random", copy.random); |
---|
1165 | 1197 | randomCB.setToolTipText("Randomly Rewind (or Go back and forth)"); |
---|
1166 | 1198 | |
---|
| 1199 | + link2masterCB = AddCheckBox(setupPanel2, "Support", copy.link2master); |
---|
| 1200 | + link2masterCB.setToolTipText("Attach to support"); |
---|
| 1201 | + |
---|
1167 | 1202 | if (Globals.ADVANCED) |
---|
1168 | 1203 | { |
---|
1169 | | - link2masterCB = AddCheckBox(setupPanel2, "Supp", copy.link2master); |
---|
1170 | | - link2masterCB.setToolTipText("Attach to support"); |
---|
1171 | 1204 | speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup); |
---|
1172 | 1205 | speedupCB.setToolTipText("Option motion capture"); |
---|
1173 | 1206 | } |
---|
.. | .. |
---|
1483 | 1516 | // north.add(ctrlPanel, BorderLayout.NORTH); |
---|
1484 | 1517 | // objectPanel.add(north); |
---|
1485 | 1518 | objectPanel.add(editPanel); |
---|
1486 | | - objectPanel.add(infoPanel); |
---|
| 1519 | + |
---|
| 1520 | + //if (Globals.ADVANCED) |
---|
| 1521 | + objectPanel.add(infoPanel); |
---|
| 1522 | + |
---|
1487 | 1523 | objectPanel.add(toolboxPanel); |
---|
1488 | 1524 | |
---|
1489 | 1525 | /* |
---|
.. | .. |
---|
1592 | 1628 | // aConstraints.gridheight = 1; |
---|
1593 | 1629 | |
---|
1594 | 1630 | framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree); |
---|
1595 | | - framePanel.setContinuousLayout(true); |
---|
1596 | | - framePanel.setOneTouchExpandable(true); |
---|
1597 | | - framePanel.setDividerLocation(0.8); |
---|
| 1631 | + framePanel.setContinuousLayout(false); |
---|
| 1632 | + framePanel.setOneTouchExpandable(false); |
---|
| 1633 | + //.setDividerLocation(0.8); |
---|
1598 | 1634 | //framePanel.setDividerSize(15); |
---|
1599 | 1635 | //framePanel.setResizeWeight(0.15); |
---|
1600 | 1636 | framePanel.setName("Frame"); |
---|
.. | .. |
---|
1613 | 1649 | |
---|
1614 | 1650 | frame.setSize(1280, 860); |
---|
1615 | 1651 | |
---|
1616 | | - frame.validate(); |
---|
1617 | | - frame.setVisible(true); |
---|
1618 | | - |
---|
1619 | 1652 | cameraView.requestFocusInWindow(); |
---|
1620 | 1653 | |
---|
1621 | 1654 | gridPanel.setDividerLocation(1.0); |
---|
| 1655 | + |
---|
| 1656 | + frame.validate(); |
---|
| 1657 | + |
---|
| 1658 | + frame.setVisible(true); |
---|
1622 | 1659 | |
---|
1623 | 1660 | frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); |
---|
1624 | 1661 | frame.addWindowListener(new WindowAdapter() |
---|
.. | .. |
---|
1965 | 2002 | // 3D models |
---|
1966 | 2003 | if (filename.endsWith(".3ds") || filename.endsWith(".3DS")) |
---|
1967 | 2004 | { |
---|
1968 | | - lastConverter = new com.jmex.model.converters.MaxToJme(); |
---|
1969 | | - LoadFile(filename, lastConverter); |
---|
| 2005 | + //lastConverter = new com.jmex.model.converters.MaxToJme(); |
---|
| 2006 | + //LoadFile(filename, lastConverter); |
---|
| 2007 | + LoadObjFile(filename); // New 3ds loader |
---|
1970 | 2008 | continue; |
---|
1971 | 2009 | } |
---|
1972 | 2010 | if (filename.endsWith(".dae") || filename.endsWith(".DAE")) |
---|
.. | .. |
---|
2692 | 2730 | LA.matXRotate(((Object3D) group.get(group.size() - 1)).toParent, -Math.PI / 2); |
---|
2693 | 2731 | LA.matXRotate(((Object3D) group.get(group.size() - 1)).fromParent, Math.PI / 2); |
---|
2694 | 2732 | } |
---|
| 2733 | + |
---|
2695 | 2734 | //cJME.count++; |
---|
2696 | 2735 | //cJME.count %= 12; |
---|
2697 | 2736 | if (gc) |
---|
.. | .. |
---|
2875 | 2914 | } |
---|
2876 | 2915 | } |
---|
2877 | 2916 | } |
---|
| 2917 | + |
---|
2878 | 2918 | cFileSystemPane FSPane; |
---|
2879 | 2919 | |
---|
2880 | 2920 | void SetMaterial(cMaterial mat, Object3D.cVector2[] others) |
---|
.. | .. |
---|
2928 | 2968 | } |
---|
2929 | 2969 | } |
---|
2930 | 2970 | } |
---|
| 2971 | + |
---|
2931 | 2972 | freezematerial = false; |
---|
2932 | 2973 | } |
---|
2933 | 2974 | |
---|
.. | .. |
---|
3380 | 3421 | { |
---|
3381 | 3422 | Close(); |
---|
3382 | 3423 | //return true; |
---|
3383 | | - } else if (source == loadItem) |
---|
| 3424 | + } else if (source == openItem) |
---|
3384 | 3425 | { |
---|
3385 | | - load(); |
---|
| 3426 | + Open(); |
---|
3386 | 3427 | //return true; |
---|
3387 | 3428 | } else if (source == newItem) |
---|
3388 | 3429 | { |
---|
.. | .. |
---|
3407 | 3448 | { |
---|
3408 | 3449 | generatePOV(); |
---|
3409 | 3450 | //return true; |
---|
| 3451 | + } else if (event.getSource() == archiveItem) |
---|
| 3452 | + { |
---|
| 3453 | + cTools.Archive(frame); |
---|
| 3454 | + return; |
---|
3410 | 3455 | } else if (source == zBufferItem) |
---|
3411 | 3456 | { |
---|
3412 | 3457 | try |
---|
.. | .. |
---|
3458 | 3503 | try |
---|
3459 | 3504 | { |
---|
3460 | 3505 | ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
---|
3461 | | - java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos); |
---|
3462 | | - ObjectOutputStream out = new ObjectOutputStream(zstream); |
---|
| 3506 | +// java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos); |
---|
| 3507 | + ObjectOutputStream out = new ObjectOutputStream(baos); //zstream); |
---|
3463 | 3508 | |
---|
3464 | 3509 | Object3D parent = o.parent; |
---|
3465 | 3510 | o.parent = null; |
---|
.. | .. |
---|
3470 | 3515 | |
---|
3471 | 3516 | out.flush(); |
---|
3472 | 3517 | |
---|
3473 | | - zstream.close(); |
---|
| 3518 | + baos //zstream |
---|
| 3519 | + .close(); |
---|
3474 | 3520 | out.close(); |
---|
3475 | 3521 | |
---|
3476 | | - return baos.toByteArray(); |
---|
| 3522 | + byte[] bytes = baos.toByteArray(); |
---|
| 3523 | + |
---|
| 3524 | + System.out.println("save #bytes = " + bytes.length); |
---|
| 3525 | + return bytes; |
---|
3477 | 3526 | } catch (Exception e) |
---|
3478 | 3527 | { |
---|
3479 | 3528 | System.err.println(e); |
---|
.. | .. |
---|
3483 | 3532 | |
---|
3484 | 3533 | static public Object Uncompress(byte[] bytes) |
---|
3485 | 3534 | { |
---|
3486 | | - System.out.println("#bytes = " + bytes.length); |
---|
| 3535 | + System.out.println("restore #bytes = " + bytes.length); |
---|
3487 | 3536 | try |
---|
3488 | 3537 | { |
---|
3489 | 3538 | ByteArrayInputStream bais = new ByteArrayInputStream(bytes); |
---|
3490 | | - java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais); |
---|
3491 | | - ObjectInputStream in = new ObjectInputStream(istream); |
---|
| 3539 | + //java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais); |
---|
| 3540 | + ObjectInputStream in = new ObjectInputStream(bais); // istream); |
---|
3492 | 3541 | Object obj = in.readObject(); |
---|
| 3542 | + |
---|
| 3543 | + bais //istream |
---|
| 3544 | + .close(); |
---|
3493 | 3545 | in.close(); |
---|
3494 | 3546 | |
---|
3495 | 3547 | return obj; |
---|
.. | .. |
---|
3544 | 3596 | return null; |
---|
3545 | 3597 | } |
---|
3546 | 3598 | |
---|
3547 | | - java.util.Hashtable<java.util.UUID, Object3D> hashtable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
3548 | 3599 | |
---|
3549 | 3600 | public void Save() |
---|
| 3601 | + { |
---|
| 3602 | + //Save(true); |
---|
| 3603 | + Replace(); |
---|
| 3604 | + } |
---|
| 3605 | + |
---|
| 3606 | + private boolean Equal(byte[] compress, byte[] name) |
---|
| 3607 | + { |
---|
| 3608 | + if (compress.length != name.length) |
---|
| 3609 | + { |
---|
| 3610 | + return false; |
---|
| 3611 | + } |
---|
| 3612 | + |
---|
| 3613 | + for (int i=compress.length; --i>=0;) |
---|
| 3614 | + { |
---|
| 3615 | + if (compress[i] != name[i]) |
---|
| 3616 | + return false; |
---|
| 3617 | + } |
---|
| 3618 | + |
---|
| 3619 | + return true; |
---|
| 3620 | + } |
---|
| 3621 | + |
---|
| 3622 | + java.util.Hashtable<java.util.UUID, Object3D> versiontable = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
| 3623 | + |
---|
| 3624 | + public boolean Save(boolean user) |
---|
3550 | 3625 | { |
---|
3551 | 3626 | System.err.println("Save"); |
---|
3552 | 3627 | |
---|
3553 | 3628 | cRadio tab = GetCurrentTab(); |
---|
3554 | 3629 | |
---|
3555 | | - boolean temp = CameraPane.SWITCH; |
---|
3556 | | - CameraPane.SWITCH = false; |
---|
| 3630 | + byte[] compress = CompressCopy(); |
---|
3557 | 3631 | |
---|
3558 | | - copy.ExtractBigData(hashtable); |
---|
| 3632 | + boolean thesame = false; |
---|
3559 | 3633 | |
---|
3560 | | - byte[] compress = Compress(copy); |
---|
| 3634 | + // Quick heuristic using length. Works only when stream is compressed. |
---|
| 3635 | + if (copy.versionindex > 0 && copy.versions[copy.versionindex-1] != null && Equal(compress, copy.versions[copy.versionindex-1])) |
---|
| 3636 | + { |
---|
| 3637 | + thesame = true; |
---|
| 3638 | + } |
---|
3561 | 3639 | |
---|
3562 | 3640 | //EditorFrame.m_MainFrame.requestFocusInWindow(); |
---|
3563 | | - tab.graphs[tab.undoindex++] = compress; |
---|
| 3641 | + if (!thesame) |
---|
| 3642 | + { |
---|
| 3643 | + //tab.user[tab.versionindex] = user; |
---|
| 3644 | + //boolean increment = true; // tab.graphs[tab.versionindex] == null; |
---|
| 3645 | + |
---|
| 3646 | + copy.versions[++copy.versionindex] = compress; |
---|
| 3647 | + |
---|
| 3648 | + // if (increment) |
---|
| 3649 | + // tab.versionindex++; |
---|
| 3650 | + } |
---|
3564 | 3651 | |
---|
3565 | | - copy.RestoreBigData(hashtable); |
---|
| 3652 | + //copy.RestoreBigData(versiontable); |
---|
3566 | 3653 | |
---|
3567 | | - CameraPane.SWITCH = temp; |
---|
3568 | | - |
---|
3569 | 3654 | //assert(hashtable.isEmpty()); |
---|
3570 | 3655 | |
---|
3571 | | - for (int i = tab.undoindex; i < tab.graphs.length; i++) |
---|
| 3656 | + for (int i = copy.versionindex+1; i < copy.versions.length; i++) |
---|
3572 | 3657 | { |
---|
3573 | | - tab.graphs[i] = null; |
---|
| 3658 | + //tab.user[i] = false; |
---|
| 3659 | + copy.versions[i] = null; |
---|
3574 | 3660 | } |
---|
3575 | 3661 | |
---|
3576 | 3662 | SetUndoStates(); |
---|
.. | .. |
---|
3580 | 3666 | { |
---|
3581 | 3667 | try |
---|
3582 | 3668 | { |
---|
3583 | | - FileOutputStream ostream = new FileOutputStream("save" + tab.undoindex); |
---|
| 3669 | + FileOutputStream ostream = new FileOutputStream("save" + copy.versionindex); |
---|
3584 | 3670 | ObjectOutputStream p = new ObjectOutputStream(ostream); |
---|
3585 | 3671 | |
---|
3586 | 3672 | p.writeObject(copy); |
---|
.. | .. |
---|
3593 | 3679 | e.printStackTrace(); |
---|
3594 | 3680 | } |
---|
3595 | 3681 | } |
---|
| 3682 | + |
---|
| 3683 | + return !thesame; |
---|
3596 | 3684 | } |
---|
3597 | 3685 | |
---|
3598 | 3686 | void CopyChanged(Object3D obj) |
---|
.. | .. |
---|
3602 | 3690 | boolean temp = CameraPane.SWITCH; |
---|
3603 | 3691 | CameraPane.SWITCH = false; |
---|
3604 | 3692 | |
---|
3605 | | - copy.ExtractBigData(hashtable); |
---|
| 3693 | + copy.ExtractBigData(versiontable); |
---|
3606 | 3694 | |
---|
3607 | 3695 | copy.clear(); |
---|
3608 | 3696 | |
---|
.. | .. |
---|
3611 | 3699 | copy.add(obj.get(i)); |
---|
3612 | 3700 | } |
---|
3613 | 3701 | |
---|
3614 | | - copy.RestoreBigData(hashtable); |
---|
| 3702 | + copy.RestoreBigData(versiontable); |
---|
3615 | 3703 | |
---|
3616 | 3704 | CameraPane.SWITCH = temp; |
---|
3617 | 3705 | |
---|
.. | .. |
---|
3639 | 3727 | } |
---|
3640 | 3728 | |
---|
3641 | 3729 | cButton undoButton; |
---|
| 3730 | + cButton restoreButton; |
---|
| 3731 | + cButton replaceButton; |
---|
3642 | 3732 | cButton redoButton; |
---|
3643 | 3733 | |
---|
3644 | 3734 | void SetUndoStates() |
---|
3645 | 3735 | { |
---|
3646 | 3736 | cRadio tab = GetCurrentTab(); |
---|
3647 | 3737 | |
---|
3648 | | - undoButton.setEnabled(tab.undoindex > 0); |
---|
3649 | | - redoButton.setEnabled(tab.graphs[tab.undoindex + 1] != null); |
---|
| 3738 | + restoreButton.setEnabled(copy.versionindex != -1); |
---|
| 3739 | + replaceButton.setEnabled(copy.versionindex != -1); |
---|
| 3740 | + undoButton.setEnabled(copy.versionindex > 0); |
---|
| 3741 | + redoButton.setEnabled(copy.versions[copy.versionindex + 1] != null); |
---|
3650 | 3742 | } |
---|
3651 | 3743 | |
---|
3652 | | - public void Undo() |
---|
| 3744 | + public boolean Undo() |
---|
3653 | 3745 | { |
---|
3654 | 3746 | System.err.println("Undo"); |
---|
3655 | 3747 | |
---|
3656 | 3748 | cRadio tab = GetCurrentTab(); |
---|
3657 | 3749 | |
---|
3658 | | - if (tab.undoindex == 0) |
---|
| 3750 | + if (copy.versionindex == 0) |
---|
3659 | 3751 | { |
---|
3660 | 3752 | java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
3661 | | - return; |
---|
| 3753 | + return false; |
---|
3662 | 3754 | } |
---|
3663 | 3755 | |
---|
3664 | | - if (tab.graphs[tab.undoindex] == null) |
---|
| 3756 | +// if (tab.graphs[tab.versionindex] == null) // || !tab.user[tab.versionindex]) |
---|
| 3757 | +// { |
---|
| 3758 | +// if (Save(false)) |
---|
| 3759 | +// tab.versionindex -= 1; |
---|
| 3760 | +// else |
---|
| 3761 | +// { |
---|
| 3762 | +// if (tab.versionindex <= 0) |
---|
| 3763 | +// return false; |
---|
| 3764 | +// else |
---|
| 3765 | +// tab.versionindex -= 1; |
---|
| 3766 | +// } |
---|
| 3767 | +// } |
---|
| 3768 | + |
---|
| 3769 | + copy.versionindex -= 1; |
---|
| 3770 | + |
---|
| 3771 | + CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 3772 | + |
---|
| 3773 | + return true; |
---|
| 3774 | + } |
---|
| 3775 | + |
---|
| 3776 | + public boolean Restore() |
---|
| 3777 | + { |
---|
| 3778 | + System.err.println("Restore"); |
---|
| 3779 | + |
---|
| 3780 | + cRadio tab = GetCurrentTab(); |
---|
| 3781 | + |
---|
| 3782 | + if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null) |
---|
3665 | 3783 | { |
---|
3666 | | - Save(); |
---|
3667 | | - tab.undoindex -= 1; |
---|
| 3784 | + java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 3785 | + return false; |
---|
3668 | 3786 | } |
---|
3669 | 3787 | |
---|
3670 | | - tab.undoindex -= 1; |
---|
| 3788 | + CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 3789 | + |
---|
| 3790 | + return true; |
---|
| 3791 | + } |
---|
3671 | 3792 | |
---|
3672 | | - CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex])); |
---|
| 3793 | + public boolean Replace() |
---|
| 3794 | + { |
---|
| 3795 | + System.err.println("Replace"); |
---|
| 3796 | + |
---|
| 3797 | + cRadio tab = GetCurrentTab(); |
---|
| 3798 | + |
---|
| 3799 | + if (copy.versionindex == -1 || copy.versions[copy.versionindex] == null) |
---|
| 3800 | + { |
---|
| 3801 | + // No version yet. OK. java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 3802 | + return false; |
---|
| 3803 | + } |
---|
| 3804 | + |
---|
| 3805 | + copy.versions[copy.versionindex] = CompressCopy(); |
---|
| 3806 | + |
---|
| 3807 | + return true; |
---|
3673 | 3808 | } |
---|
3674 | 3809 | |
---|
3675 | 3810 | public void Redo() |
---|
3676 | 3811 | { |
---|
3677 | 3812 | cRadio tab = GetCurrentTab(); |
---|
3678 | 3813 | |
---|
3679 | | - if (tab.graphs[tab.undoindex + 1] == null) |
---|
| 3814 | + if (copy.versions[copy.versionindex + 1] == null) |
---|
3680 | 3815 | { |
---|
3681 | 3816 | java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
3682 | 3817 | return; |
---|
3683 | 3818 | } |
---|
3684 | 3819 | |
---|
3685 | | - tab.undoindex += 1; |
---|
| 3820 | + copy.versionindex += 1; |
---|
3686 | 3821 | |
---|
3687 | | - CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex])); |
---|
| 3822 | + CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex])); |
---|
| 3823 | + |
---|
| 3824 | + //if (!tab.user[tab.versionindex]) |
---|
| 3825 | + // tab.graphs[tab.versionindex] = null; |
---|
3688 | 3826 | } |
---|
3689 | 3827 | |
---|
3690 | 3828 | void ImportGFD() |
---|
.. | .. |
---|
3980 | 4118 | //copy.Touch(); |
---|
3981 | 4119 | } |
---|
3982 | 4120 | |
---|
| 4121 | + cNumberSlider versionField; |
---|
| 4122 | + |
---|
3983 | 4123 | public void stateChanged(ChangeEvent e) |
---|
3984 | 4124 | { |
---|
3985 | 4125 | // assert(false); |
---|
| 4126 | + if (e.getSource() == versionField) |
---|
| 4127 | + { |
---|
| 4128 | + int version = versionField.getInteger(); |
---|
| 4129 | + |
---|
| 4130 | + if (copy.versions[version] != null) |
---|
| 4131 | + { |
---|
| 4132 | + CopyChanged((Object3D)Uncompress(copy.versions[copy.versionindex = version])); |
---|
| 4133 | + } |
---|
| 4134 | + |
---|
| 4135 | + return; |
---|
| 4136 | + } |
---|
3986 | 4137 | |
---|
3987 | 4138 | if (freezematerial) |
---|
3988 | 4139 | { |
---|
.. | .. |
---|
4331 | 4482 | |
---|
4332 | 4483 | void makeSomething(Object3D thing, boolean resetmodel) // deselect) |
---|
4333 | 4484 | { |
---|
4334 | | - if (Globals.SAVEONMAKE) // && resetmodel) |
---|
| 4485 | + if (Globals.REPLACEONMAKE) // && resetmodel) |
---|
4335 | 4486 | Save(); |
---|
4336 | 4487 | //Tween.set(thing, 0).target(1).start(tweenManager); |
---|
4337 | 4488 | //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager); |
---|
.. | .. |
---|
4647 | 4798 | |
---|
4648 | 4799 | if (readobj != null) |
---|
4649 | 4800 | { |
---|
4650 | | - if (Globals.SAVEONMAKE) |
---|
4651 | | - Save(); |
---|
| 4801 | + //if (Globals.SAVEONMAKE) // A new object cannot share meshes |
---|
| 4802 | + // Save(); |
---|
4652 | 4803 | try |
---|
4653 | 4804 | { |
---|
4654 | 4805 | //readobj.deepCopySelf(copy); |
---|
.. | .. |
---|
4703 | 4854 | c.addChild(csg); |
---|
4704 | 4855 | } |
---|
4705 | 4856 | |
---|
| 4857 | + copy.versions = readobj.versions; |
---|
| 4858 | + copy.versionindex = readobj.versionindex; |
---|
| 4859 | + |
---|
| 4860 | + SetUndoStates(); |
---|
| 4861 | + |
---|
4706 | 4862 | ResetModel(); |
---|
4707 | 4863 | copy.HardTouch(); // recompile? |
---|
4708 | 4864 | refreshContents(); |
---|
4709 | 4865 | } |
---|
4710 | 4866 | } |
---|
4711 | 4867 | |
---|
4712 | | - void load() // throws ClassNotFoundException |
---|
| 4868 | + void Open() // throws ClassNotFoundException |
---|
4713 | 4869 | { |
---|
4714 | 4870 | if (Grafreed.standAlone) |
---|
4715 | 4871 | { |
---|
.. | .. |
---|
4994 | 5150 | MenuBar menuBar; |
---|
4995 | 5151 | Menu fileMenu; |
---|
4996 | 5152 | MenuItem newItem; |
---|
4997 | | - MenuItem loadItem; |
---|
| 5153 | + MenuItem openItem; |
---|
4998 | 5154 | MenuItem saveItem; |
---|
4999 | 5155 | MenuItem saveAsItem; |
---|
5000 | 5156 | MenuItem exportAsItem; |
---|
.. | .. |
---|
5017 | 5173 | CheckboxMenuItem toggleSwitchItem; |
---|
5018 | 5174 | CheckboxMenuItem toggleRootItem; |
---|
5019 | 5175 | CheckboxMenuItem animationItem; |
---|
| 5176 | + MenuItem archiveItem; |
---|
5020 | 5177 | CheckboxMenuItem toggleHandleItem; |
---|
5021 | 5178 | CheckboxMenuItem togglePaintItem; |
---|
5022 | 5179 | JSplitPane mainPanel; |
---|