.. | .. |
---|
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(); |
---|
.. | .. |
---|
1483 | 1493 | // north.add(ctrlPanel, BorderLayout.NORTH); |
---|
1484 | 1494 | // objectPanel.add(north); |
---|
1485 | 1495 | objectPanel.add(editPanel); |
---|
1486 | | - objectPanel.add(infoPanel); |
---|
| 1496 | + |
---|
| 1497 | + //if (Globals.ADVANCED) |
---|
| 1498 | + objectPanel.add(infoPanel); |
---|
| 1499 | + |
---|
1487 | 1500 | objectPanel.add(toolboxPanel); |
---|
1488 | 1501 | |
---|
1489 | 1502 | /* |
---|
.. | .. |
---|
1592 | 1605 | // aConstraints.gridheight = 1; |
---|
1593 | 1606 | |
---|
1594 | 1607 | framePanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, toolbarPanel, bigThree); |
---|
1595 | | - framePanel.setContinuousLayout(true); |
---|
1596 | | - framePanel.setOneTouchExpandable(true); |
---|
1597 | | - framePanel.setDividerLocation(0.8); |
---|
| 1608 | + framePanel.setContinuousLayout(false); |
---|
| 1609 | + framePanel.setOneTouchExpandable(false); |
---|
| 1610 | + //.setDividerLocation(0.8); |
---|
1598 | 1611 | //framePanel.setDividerSize(15); |
---|
1599 | 1612 | //framePanel.setResizeWeight(0.15); |
---|
1600 | 1613 | framePanel.setName("Frame"); |
---|
.. | .. |
---|
1613 | 1626 | |
---|
1614 | 1627 | frame.setSize(1280, 860); |
---|
1615 | 1628 | |
---|
1616 | | - frame.validate(); |
---|
1617 | | - frame.setVisible(true); |
---|
1618 | | - |
---|
1619 | 1629 | cameraView.requestFocusInWindow(); |
---|
1620 | 1630 | |
---|
1621 | 1631 | gridPanel.setDividerLocation(1.0); |
---|
| 1632 | + |
---|
| 1633 | + frame.validate(); |
---|
| 1634 | + |
---|
| 1635 | + frame.setVisible(true); |
---|
1622 | 1636 | |
---|
1623 | 1637 | frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); |
---|
1624 | 1638 | frame.addWindowListener(new WindowAdapter() |
---|
.. | .. |
---|
1965 | 1979 | // 3D models |
---|
1966 | 1980 | if (filename.endsWith(".3ds") || filename.endsWith(".3DS")) |
---|
1967 | 1981 | { |
---|
1968 | | - lastConverter = new com.jmex.model.converters.MaxToJme(); |
---|
1969 | | - LoadFile(filename, lastConverter); |
---|
| 1982 | + //lastConverter = new com.jmex.model.converters.MaxToJme(); |
---|
| 1983 | + //LoadFile(filename, lastConverter); |
---|
| 1984 | + LoadObjFile(filename); // New 3ds loader |
---|
1970 | 1985 | continue; |
---|
1971 | 1986 | } |
---|
1972 | 1987 | if (filename.endsWith(".dae") || filename.endsWith(".DAE")) |
---|
.. | .. |
---|
2692 | 2707 | LA.matXRotate(((Object3D) group.get(group.size() - 1)).toParent, -Math.PI / 2); |
---|
2693 | 2708 | LA.matXRotate(((Object3D) group.get(group.size() - 1)).fromParent, Math.PI / 2); |
---|
2694 | 2709 | } |
---|
| 2710 | + |
---|
2695 | 2711 | //cJME.count++; |
---|
2696 | 2712 | //cJME.count %= 12; |
---|
2697 | 2713 | if (gc) |
---|
.. | .. |
---|
2875 | 2891 | } |
---|
2876 | 2892 | } |
---|
2877 | 2893 | } |
---|
| 2894 | + |
---|
2878 | 2895 | cFileSystemPane FSPane; |
---|
2879 | 2896 | |
---|
2880 | 2897 | void SetMaterial(cMaterial mat, Object3D.cVector2[] others) |
---|
.. | .. |
---|
2928 | 2945 | } |
---|
2929 | 2946 | } |
---|
2930 | 2947 | } |
---|
| 2948 | + |
---|
2931 | 2949 | freezematerial = false; |
---|
2932 | 2950 | } |
---|
2933 | 2951 | |
---|
.. | .. |
---|
3380 | 3398 | { |
---|
3381 | 3399 | Close(); |
---|
3382 | 3400 | //return true; |
---|
3383 | | - } else if (source == loadItem) |
---|
| 3401 | + } else if (source == openItem) |
---|
3384 | 3402 | { |
---|
3385 | | - load(); |
---|
| 3403 | + Open(); |
---|
3386 | 3404 | //return true; |
---|
3387 | 3405 | } else if (source == newItem) |
---|
3388 | 3406 | { |
---|
.. | .. |
---|
3407 | 3425 | { |
---|
3408 | 3426 | generatePOV(); |
---|
3409 | 3427 | //return true; |
---|
| 3428 | + } else if (event.getSource() == archiveItem) |
---|
| 3429 | + { |
---|
| 3430 | + cTools.Archive(frame); |
---|
| 3431 | + return; |
---|
3410 | 3432 | } else if (source == zBufferItem) |
---|
3411 | 3433 | { |
---|
3412 | 3434 | try |
---|
.. | .. |
---|
3548 | 3570 | |
---|
3549 | 3571 | public void Save() |
---|
3550 | 3572 | { |
---|
| 3573 | + // Default reduces the probability of heuristics errors. |
---|
| 3574 | + Save(true); |
---|
| 3575 | + } |
---|
| 3576 | + |
---|
| 3577 | + private boolean Equal(byte[] compress, byte[] name) |
---|
| 3578 | + { |
---|
| 3579 | + if (compress.length != name.length) |
---|
| 3580 | + { |
---|
| 3581 | + return false; |
---|
| 3582 | + } |
---|
| 3583 | + |
---|
| 3584 | + for (int i=compress.length; --i>=0;) |
---|
| 3585 | + { |
---|
| 3586 | + if (compress[i] != name[i]) |
---|
| 3587 | + return false; |
---|
| 3588 | + } |
---|
| 3589 | + |
---|
| 3590 | + return true; |
---|
| 3591 | + } |
---|
| 3592 | + |
---|
| 3593 | + public boolean Save(boolean user) |
---|
| 3594 | + { |
---|
3551 | 3595 | System.err.println("Save"); |
---|
3552 | 3596 | |
---|
3553 | 3597 | cRadio tab = GetCurrentTab(); |
---|
.. | .. |
---|
3558 | 3602 | copy.ExtractBigData(hashtable); |
---|
3559 | 3603 | |
---|
3560 | 3604 | byte[] compress = Compress(copy); |
---|
3561 | | - |
---|
3562 | | - //EditorFrame.m_MainFrame.requestFocusInWindow(); |
---|
3563 | | - tab.graphs[tab.undoindex++] = compress; |
---|
3564 | | - |
---|
3565 | | - copy.RestoreBigData(hashtable); |
---|
3566 | 3605 | |
---|
3567 | 3606 | CameraPane.SWITCH = temp; |
---|
3568 | 3607 | |
---|
| 3608 | + boolean thesame = false; |
---|
| 3609 | + |
---|
| 3610 | + // 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])) |
---|
| 3612 | + { |
---|
| 3613 | + thesame = true; |
---|
| 3614 | + } |
---|
| 3615 | + |
---|
| 3616 | + //EditorFrame.m_MainFrame.requestFocusInWindow(); |
---|
| 3617 | + if (!thesame) |
---|
| 3618 | + { |
---|
| 3619 | + tab.user[tab.undoindex] = user; |
---|
| 3620 | + tab.graphs[tab.undoindex++] = compress; |
---|
| 3621 | + } |
---|
| 3622 | + |
---|
| 3623 | + copy.RestoreBigData(hashtable); |
---|
| 3624 | + |
---|
3569 | 3625 | //assert(hashtable.isEmpty()); |
---|
3570 | 3626 | |
---|
3571 | 3627 | for (int i = tab.undoindex; i < tab.graphs.length; i++) |
---|
3572 | 3628 | { |
---|
| 3629 | + tab.user[i] = false; |
---|
3573 | 3630 | tab.graphs[i] = null; |
---|
3574 | 3631 | } |
---|
3575 | 3632 | |
---|
.. | .. |
---|
3593 | 3650 | e.printStackTrace(); |
---|
3594 | 3651 | } |
---|
3595 | 3652 | } |
---|
| 3653 | + |
---|
| 3654 | + return !thesame; |
---|
3596 | 3655 | } |
---|
3597 | 3656 | |
---|
3598 | 3657 | void CopyChanged(Object3D obj) |
---|
.. | .. |
---|
3649 | 3708 | redoButton.setEnabled(tab.graphs[tab.undoindex + 1] != null); |
---|
3650 | 3709 | } |
---|
3651 | 3710 | |
---|
3652 | | - public void Undo() |
---|
| 3711 | + public boolean Undo() |
---|
3653 | 3712 | { |
---|
3654 | 3713 | System.err.println("Undo"); |
---|
3655 | 3714 | |
---|
.. | .. |
---|
3658 | 3717 | if (tab.undoindex == 0) |
---|
3659 | 3718 | { |
---|
3660 | 3719 | java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
3661 | | - return; |
---|
| 3720 | + return false; |
---|
3662 | 3721 | } |
---|
3663 | 3722 | |
---|
3664 | | - if (tab.graphs[tab.undoindex] == null) |
---|
| 3723 | + if (tab.graphs[tab.undoindex] == null || !tab.user[tab.undoindex]) |
---|
3665 | 3724 | { |
---|
3666 | | - Save(); |
---|
3667 | | - tab.undoindex -= 1; |
---|
| 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 | + } |
---|
3668 | 3734 | } |
---|
3669 | 3735 | |
---|
3670 | 3736 | tab.undoindex -= 1; |
---|
3671 | 3737 | |
---|
3672 | 3738 | CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex])); |
---|
| 3739 | + |
---|
| 3740 | + return true; |
---|
3673 | 3741 | } |
---|
3674 | 3742 | |
---|
3675 | 3743 | public void Redo() |
---|
.. | .. |
---|
3685 | 3753 | tab.undoindex += 1; |
---|
3686 | 3754 | |
---|
3687 | 3755 | CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex])); |
---|
| 3756 | + |
---|
| 3757 | + if (!tab.user[tab.undoindex]) |
---|
| 3758 | + tab.graphs[tab.undoindex] = null; |
---|
3688 | 3759 | } |
---|
3689 | 3760 | |
---|
3690 | 3761 | void ImportGFD() |
---|
.. | .. |
---|
4709 | 4780 | } |
---|
4710 | 4781 | } |
---|
4711 | 4782 | |
---|
4712 | | - void load() // throws ClassNotFoundException |
---|
| 4783 | + void Open() // throws ClassNotFoundException |
---|
4713 | 4784 | { |
---|
4714 | 4785 | if (Grafreed.standAlone) |
---|
4715 | 4786 | { |
---|
.. | .. |
---|
4994 | 5065 | MenuBar menuBar; |
---|
4995 | 5066 | Menu fileMenu; |
---|
4996 | 5067 | MenuItem newItem; |
---|
4997 | | - MenuItem loadItem; |
---|
| 5068 | + MenuItem openItem; |
---|
4998 | 5069 | MenuItem saveItem; |
---|
4999 | 5070 | MenuItem saveAsItem; |
---|
5000 | 5071 | MenuItem exportAsItem; |
---|
.. | .. |
---|
5017 | 5088 | CheckboxMenuItem toggleSwitchItem; |
---|
5018 | 5089 | CheckboxMenuItem toggleRootItem; |
---|
5019 | 5090 | CheckboxMenuItem animationItem; |
---|
| 5091 | + MenuItem archiveItem; |
---|
5020 | 5092 | CheckboxMenuItem toggleHandleItem; |
---|
5021 | 5093 | CheckboxMenuItem togglePaintItem; |
---|
5022 | 5094 | JSplitPane mainPanel; |
---|