.. | .. |
---|
4 | 4 | |
---|
5 | 5 | import java.awt.*; |
---|
6 | 6 | import java.awt.event.*; |
---|
| 7 | +import java.awt.image.BufferedImage; |
---|
7 | 8 | import javax.swing.*; |
---|
8 | 9 | import javax.swing.event.*; |
---|
9 | 10 | import javax.swing.text.*; |
---|
.. | .. |
---|
37 | 38 | JFrame frame; |
---|
38 | 39 | |
---|
39 | 40 | static ObjEditor theFrame; |
---|
| 41 | + |
---|
| 42 | + cButton GetButton(String name, boolean border) |
---|
| 43 | + { |
---|
| 44 | + try |
---|
| 45 | + { |
---|
| 46 | + ImageIcon icon = GetIcon(name); |
---|
| 47 | + return new cButton(icon, border); |
---|
| 48 | + } |
---|
| 49 | + catch (Exception e) |
---|
| 50 | + { |
---|
| 51 | + return new cButton(name, border); |
---|
| 52 | + } |
---|
| 53 | + } |
---|
| 54 | + |
---|
| 55 | + cToggleButton GetToggleButton(String name, boolean border) |
---|
| 56 | + { |
---|
| 57 | + try |
---|
| 58 | + { |
---|
| 59 | + ImageIcon icon = GetIcon(name); |
---|
| 60 | + return new cToggleButton(icon, border); |
---|
| 61 | + } |
---|
| 62 | + catch (Exception e) |
---|
| 63 | + { |
---|
| 64 | + return new cToggleButton(name, border); |
---|
| 65 | + } |
---|
| 66 | + } |
---|
| 67 | + |
---|
| 68 | + cCheckBox GetCheckBox(String name, boolean border) |
---|
| 69 | + { |
---|
| 70 | + try |
---|
| 71 | + { |
---|
| 72 | + ImageIcon icon = GetIcon(name); |
---|
| 73 | + return new cCheckBox(icon, border); |
---|
| 74 | + } |
---|
| 75 | + catch (Exception e) |
---|
| 76 | + { |
---|
| 77 | + return new cCheckBox(name, border); |
---|
| 78 | + } |
---|
| 79 | + } |
---|
| 80 | + |
---|
| 81 | + private ImageIcon GetIcon(String name) throws IOException |
---|
| 82 | + { |
---|
| 83 | + BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name)); |
---|
| 84 | + |
---|
| 85 | + if (image.getWidth() != 24 && image.getHeight() != 24) |
---|
| 86 | + { |
---|
| 87 | + BufferedImage resized = new BufferedImage(24, 24, image.getType()); |
---|
| 88 | + Graphics2D g = resized.createGraphics(); |
---|
| 89 | + g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); |
---|
| 90 | + //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); |
---|
| 91 | + g.drawImage(image, 0, 0, 24, 24, 0, 0, image.getWidth(), image.getHeight(), null); |
---|
| 92 | + g.dispose(); |
---|
| 93 | + |
---|
| 94 | + image = resized; |
---|
| 95 | + } |
---|
| 96 | + |
---|
| 97 | + javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image); |
---|
| 98 | + return icon; |
---|
| 99 | + } |
---|
40 | 100 | |
---|
41 | 101 | // SCRIPT |
---|
42 | 102 | |
---|
.. | .. |
---|
323 | 383 | closeItem.addActionListener(this); |
---|
324 | 384 | |
---|
325 | 385 | objectPanel = new JTabbedPane(); |
---|
| 386 | + |
---|
| 387 | + ChangeListener changeListener = new ChangeListener() |
---|
| 388 | + { |
---|
| 389 | + public void stateChanged(ChangeEvent changeEvent) |
---|
| 390 | + { |
---|
| 391 | +// if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Material") && !materialFlushed) |
---|
| 392 | +// { |
---|
| 393 | +// if (latestObject != null) |
---|
| 394 | +// { |
---|
| 395 | +// refreshContents(true); |
---|
| 396 | +// SetMaterial(latestObject); |
---|
| 397 | +// } |
---|
| 398 | +// |
---|
| 399 | +// materialFlushed = true; |
---|
| 400 | +// } |
---|
| 401 | + |
---|
| 402 | + refreshContents(false); // To refresh Info tab |
---|
| 403 | + } |
---|
| 404 | + }; |
---|
| 405 | + objectPanel.addChangeListener(changeListener); |
---|
| 406 | + |
---|
326 | 407 | toolbarPanel = new JPanel(); |
---|
327 | 408 | toolbarPanel.setName("Toolbar"); |
---|
328 | 409 | treePanel = new cGridBag(); |
---|
.. | .. |
---|
337 | 418 | editPanel.add(editCommandsPanel); |
---|
338 | 419 | editPanel.add(ctrlPanel); |
---|
339 | 420 | |
---|
340 | | - materialPanel = new cGridBag().setVertical(true); |
---|
| 421 | + toolboxPanel = new cGridBag().setVertical(false); |
---|
| 422 | + toolboxPanel.setName("Toolbox"); |
---|
341 | 423 | |
---|
| 424 | + materialPanel = new cGridBag().setVertical(true); |
---|
342 | 425 | materialPanel.setName("Material"); |
---|
| 426 | + |
---|
343 | 427 | /*JTextPane*/ |
---|
344 | 428 | infoarea = createTextPane(); |
---|
345 | 429 | doc = infoarea.getStyledDocument(); |
---|
.. | .. |
---|
612 | 696 | |
---|
613 | 697 | boolean maximized; |
---|
614 | 698 | |
---|
| 699 | + cButton fullscreenLayout; |
---|
| 700 | + |
---|
615 | 701 | void Minimize() |
---|
616 | 702 | { |
---|
617 | 703 | frame.setState(Frame.ICONIFIED); |
---|
.. | .. |
---|
637 | 723 | |
---|
638 | 724 | void ToggleFullScreen() |
---|
639 | 725 | { |
---|
640 | | - if (CameraPane.FULLSCREEN) |
---|
| 726 | + cameraView.ToggleFullScreen(); |
---|
| 727 | + |
---|
| 728 | + if (!CameraPane.FULLSCREEN) |
---|
641 | 729 | { |
---|
642 | 730 | device.setFullScreenWindow(null); |
---|
643 | 731 | //frame.setVisible(false); |
---|
.. | .. |
---|
673 | 761 | // X frame.getContentPane().add(/*"Center",*/bigThree); |
---|
674 | 762 | framePanel.setDividerLocation(0); |
---|
675 | 763 | |
---|
676 | | - radio.layout = twoButton; |
---|
| 764 | + radio.layout = fullscreenLayout; |
---|
677 | 765 | radio.layout.doClick(); |
---|
678 | 766 | //frame.setVisible(true); |
---|
679 | 767 | } |
---|
680 | | - |
---|
681 | | - cameraView.ToggleFullScreen(); |
---|
682 | 768 | } |
---|
683 | 769 | |
---|
684 | 770 | private JTextPane createTextPane() |
---|
.. | .. |
---|
819 | 905 | JCheckBox speedupCB; |
---|
820 | 906 | JCheckBox rewindCB; |
---|
821 | 907 | JCheckBox flipVCB; |
---|
| 908 | + |
---|
| 909 | + cCheckBox toggleTextureCB; |
---|
| 910 | + cCheckBox toggleSwitchCB; |
---|
| 911 | + |
---|
822 | 912 | JComboBox texresMenu; |
---|
| 913 | + |
---|
823 | 914 | JButton resetButton; |
---|
824 | 915 | JButton stepButton; |
---|
825 | 916 | JButton stepAllButton; |
---|
.. | .. |
---|
1348 | 1439 | //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); |
---|
1349 | 1440 | //tmp.setName("Edit"); |
---|
1350 | 1441 | objectPanel.add(materialPanel); |
---|
| 1442 | + objectPanel.add(toolboxPanel); |
---|
1351 | 1443 | // JPanel north = new JPanel(new BorderLayout()); |
---|
1352 | 1444 | // north.setName("Edit"); |
---|
1353 | 1445 | // north.add(ctrlPanel, BorderLayout.NORTH); |
---|
.. | .. |
---|
1379 | 1471 | JTabbedPane tabbedPane = new JTabbedPane(); |
---|
1380 | 1472 | tabbedPane.add(scrollpane); |
---|
1381 | 1473 | |
---|
1382 | | - tabbedPane.add(FSPane = new cFileSystemPane(this)); |
---|
1383 | | - |
---|
1384 | | - optionsPanel = new cGridBag().setVertical(true); |
---|
| 1474 | + optionsPanel = new cGridBag().setVertical(false); |
---|
1385 | 1475 | |
---|
1386 | 1476 | optionsPanel.setName("Options"); |
---|
1387 | 1477 | |
---|
.. | .. |
---|
1389 | 1479 | |
---|
1390 | 1480 | tabbedPane.add(optionsPanel); |
---|
1391 | 1481 | |
---|
| 1482 | + tabbedPane.add(FSPane = new cFileSystemPane(this)); |
---|
| 1483 | + |
---|
1392 | 1484 | scenePanel.add(tabbedPane); |
---|
1393 | 1485 | |
---|
1394 | 1486 | /* |
---|
.. | .. |
---|
1481 | 1573 | // aConstraints = gbc; // (GridBagConstraints) GrafreeD.clone(gbc); |
---|
1482 | 1574 | |
---|
1483 | 1575 | frame.setSize(1280, 860); |
---|
| 1576 | + |
---|
| 1577 | + frame.validate(); |
---|
1484 | 1578 | frame.setVisible(true); |
---|
1485 | 1579 | |
---|
1486 | 1580 | cameraView.requestFocusInWindow(); |
---|
.. | .. |
---|
2800 | 2894 | |
---|
2801 | 2895 | void SetMaterial(Object3D object) |
---|
2802 | 2896 | { |
---|
| 2897 | + latestObject = object; |
---|
| 2898 | + |
---|
2803 | 2899 | cMaterial mat = object.material; |
---|
2804 | 2900 | |
---|
2805 | 2901 | if (mat == null) |
---|
.. | .. |
---|
2985 | 3081 | cameraView.ToggleDL(); |
---|
2986 | 3082 | cameraView.repaint(); |
---|
2987 | 3083 | return; |
---|
2988 | | - } else if (event.getSource() == toggleTextureItem) |
---|
| 3084 | + } else if (event.getSource() == toggleTextureItem || event.getSource() == toggleTextureCB) |
---|
2989 | 3085 | { |
---|
2990 | 3086 | cameraView.ToggleTexture(); |
---|
2991 | 3087 | // june 2013 copy.HardTouch(); |
---|
.. | .. |
---|
3024 | 3120 | frame.validate(); |
---|
3025 | 3121 | |
---|
3026 | 3122 | return; |
---|
3027 | | - } else if (event.getSource() == toggleSwitchItem) |
---|
| 3123 | + } else if (event.getSource() == toggleSwitchItem || event.getSource() == toggleSwitchCB) |
---|
3028 | 3124 | { |
---|
3029 | 3125 | cameraView.ToggleSwitch(); |
---|
3030 | 3126 | cameraView.repaint(); |
---|
.. | .. |
---|
3408 | 3504 | |
---|
3409 | 3505 | public void Save() |
---|
3410 | 3506 | { |
---|
| 3507 | + System.err.println("Save"); |
---|
| 3508 | + |
---|
3411 | 3509 | cRadio tab = GetCurrentTab(); |
---|
3412 | 3510 | |
---|
3413 | 3511 | boolean temp = CameraPane.SWITCH; |
---|
.. | .. |
---|
3492 | 3590 | |
---|
3493 | 3591 | public void Undo() |
---|
3494 | 3592 | { |
---|
| 3593 | + System.err.println("Undo"); |
---|
| 3594 | + |
---|
3495 | 3595 | cRadio tab = GetCurrentTab(); |
---|
3496 | 3596 | |
---|
3497 | 3597 | if (tab.undoindex == 0) |
---|
.. | .. |
---|
3675 | 3775 | assert false; |
---|
3676 | 3776 | } |
---|
3677 | 3777 | |
---|
3678 | | - void EditSelection() |
---|
| 3778 | + void EditSelection(boolean newWindow) |
---|
3679 | 3779 | { |
---|
3680 | 3780 | } |
---|
3681 | 3781 | |
---|
.. | .. |
---|
4170 | 4270 | |
---|
4171 | 4271 | void makeSomething(Object3D thing, boolean resetmodel) // deselect) |
---|
4172 | 4272 | { |
---|
4173 | | - Save(); |
---|
| 4273 | + if (Globals.SAVEONMAKE) // && resetmodel) |
---|
| 4274 | + Save(); |
---|
4174 | 4275 | //Tween.set(thing, 0).target(1).start(tweenManager); |
---|
4175 | 4276 | //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager); |
---|
4176 | 4277 | // if (thing instanceof GenericJointDemo) |
---|
.. | .. |
---|
4257 | 4358 | { |
---|
4258 | 4359 | ResetModel(); |
---|
4259 | 4360 | Select(thing.GetTreePath(), true, false); // unselect... false); |
---|
| 4361 | + |
---|
| 4362 | + if (thing.Size() == 0) |
---|
| 4363 | + { |
---|
| 4364 | + //EditSelection(false); |
---|
| 4365 | + } |
---|
| 4366 | + |
---|
4260 | 4367 | refreshContents(); |
---|
4261 | 4368 | } |
---|
4262 | 4369 | |
---|
.. | .. |
---|
4479 | 4586 | |
---|
4480 | 4587 | if (readobj != null) |
---|
4481 | 4588 | { |
---|
| 4589 | + if (Globals.SAVEONMAKE) |
---|
4482 | 4590 | Save(); |
---|
4483 | 4591 | try |
---|
4484 | 4592 | { |
---|
.. | .. |
---|
4850 | 4958 | CheckboxMenuItem togglePaintItem; |
---|
4851 | 4959 | JSplitPane mainPanel; |
---|
4852 | 4960 | JScrollPane scrollpane; |
---|
| 4961 | + |
---|
4853 | 4962 | JPanel toolbarPanel; |
---|
| 4963 | + |
---|
4854 | 4964 | cGridBag treePanel; |
---|
| 4965 | + |
---|
4855 | 4966 | JPanel radioPanel; |
---|
4856 | 4967 | ButtonGroup buttonGroup; |
---|
4857 | | - cGridBag ctrlPanel; |
---|
| 4968 | + |
---|
| 4969 | + cGridBag toolboxPanel; |
---|
4858 | 4970 | cGridBag materialPanel; |
---|
| 4971 | + cGridBag ctrlPanel; |
---|
| 4972 | + |
---|
4859 | 4973 | JScrollPane infoPanel; |
---|
| 4974 | + |
---|
4860 | 4975 | cGridBag optionsPanel; |
---|
| 4976 | + |
---|
4861 | 4977 | JTabbedPane objectPanel; |
---|
| 4978 | + boolean materialFlushed; |
---|
| 4979 | + Object3D latestObject; |
---|
| 4980 | + |
---|
4862 | 4981 | cGridBag XYZPanel; |
---|
| 4982 | + |
---|
4863 | 4983 | JSplitPane gridPanel; |
---|
4864 | 4984 | JSplitPane bigPanel; |
---|
| 4985 | + |
---|
4865 | 4986 | cGridBag bigThree; |
---|
4866 | 4987 | cGridBag scenePanel; |
---|
4867 | 4988 | cGridBag centralPanel; |
---|
.. | .. |
---|
4976 | 5097 | cNumberSlider fogField; |
---|
4977 | 5098 | JLabel opacityPowerLabel; |
---|
4978 | 5099 | cNumberSlider opacityPowerField; |
---|
4979 | | - JTree jTree; |
---|
| 5100 | + cTree jTree; |
---|
4980 | 5101 | //ObjectUI parent; |
---|
4981 | 5102 | |
---|
4982 | 5103 | cNumberSlider normalpushField; |
---|