.. | .. |
---|
16 | 16 | //import buoy.widget.BFileChooser; |
---|
17 | 17 | |
---|
18 | 18 | class GroupEditor extends ObjEditor implements //iParse, //iCallBack, |
---|
| 19 | + Grafreed.iResourceCallBack, |
---|
19 | 20 | ObjectUI, |
---|
20 | 21 | Runnable, |
---|
21 | 22 | ActionListener, |
---|
.. | .. |
---|
41 | 42 | }); |
---|
42 | 43 | } |
---|
43 | 44 | |
---|
| 45 | + public void AddTextureButton(String f, String c, final String t, int count, cGridBag row) |
---|
| 46 | + { |
---|
| 47 | + cButton textureButton; |
---|
| 48 | + final String path = "textures/" + f + "/" + c + "/"; // + t; |
---|
| 49 | + row.add(textureButton = GetButton(path + "icons/" + t, !Grafreed.NIMBUSLAF)); |
---|
| 50 | + textureButton.setToolTipText(c + count); |
---|
| 51 | + textureButton.addActionListener(new ActionListener() |
---|
| 52 | + { |
---|
| 53 | + @Override |
---|
| 54 | + public void actionPerformed(ActionEvent e) |
---|
| 55 | + { |
---|
| 56 | + ChangeTexture(path + t); |
---|
| 57 | + } |
---|
| 58 | + }); |
---|
| 59 | + } |
---|
| 60 | + |
---|
44 | 61 | public void AddSkyboxTab0(JTabbedPane skyboxpanel) |
---|
45 | 62 | { |
---|
46 | 63 | cGridBag tab0 = new cGridBag().setVertical(true); |
---|
.. | .. |
---|
311 | 328 | } |
---|
312 | 329 | } |
---|
313 | 330 | |
---|
314 | | - public void ChangeSkybox(String name) |
---|
| 331 | + public void ChangeSkybox(String skybox) |
---|
315 | 332 | { |
---|
316 | 333 | //cameraView.envyoff = false; |
---|
317 | | - group.skyboxname = name; |
---|
| 334 | + group.skyboxname = skybox; |
---|
318 | 335 | group.skyboxext = "jpg"; |
---|
319 | 336 | cameraView.repaint(); |
---|
320 | 337 | } |
---|
| 338 | + |
---|
| 339 | + public void CreateSkyboxPanel(cGridBag skyboxPanel) |
---|
| 340 | + { |
---|
| 341 | + JTabbedPane skyboxpane = new JTabbedPane(); |
---|
| 342 | + |
---|
| 343 | + AddSkyboxTab0(skyboxpane); |
---|
| 344 | + AddSkyboxTab1(skyboxpane); |
---|
| 345 | + AddSkyboxTab2(skyboxpane); |
---|
| 346 | + AddSkyboxTab3(skyboxpane); |
---|
| 347 | + |
---|
| 348 | + skyboxPanel.add(skyboxpane); |
---|
| 349 | + } |
---|
321 | 350 | |
---|
| 351 | + public void ChangeTexture(String texture) |
---|
| 352 | + { |
---|
| 353 | + for (int i=0; i<group.selection.size(); i++) |
---|
| 354 | + { |
---|
| 355 | + Object3D obj = group.selection.get(i); |
---|
| 356 | + obj.SetPigmentTexture("@" + texture); |
---|
| 357 | + } |
---|
| 358 | + |
---|
| 359 | + refreshContents(); |
---|
| 360 | + } |
---|
| 361 | + |
---|
322 | 362 | //ObjEditor objEditor; |
---|
323 | 363 | public void closeUI2() |
---|
324 | 364 | { |
---|
.. | .. |
---|
859 | 899 | buildToolsMenu(menu); |
---|
860 | 900 | } |
---|
861 | 901 | |
---|
| 902 | + JTabbedPane resourcecontainer; |
---|
| 903 | + cGridBag currenttab; |
---|
| 904 | + boolean added; // patch for jar |
---|
| 905 | + |
---|
| 906 | + int tabcount = 0; |
---|
| 907 | + int colcount = 0; |
---|
| 908 | + int rowcount = 0; |
---|
| 909 | + int texturecount = 0; |
---|
| 910 | + |
---|
| 911 | + int columns = 5; |
---|
| 912 | + int rows = 7; |
---|
| 913 | + |
---|
| 914 | + public void ResourceCallBack(String[] path) |
---|
| 915 | + { |
---|
| 916 | +// for (int i = 0; i < path.length; i++) |
---|
| 917 | +// System.out.print(path[i] + "/"); |
---|
| 918 | +// System.out.println(); |
---|
| 919 | + |
---|
| 920 | + if (//rowcount == 0 || |
---|
| 921 | + path.length == 1) |
---|
| 922 | + { |
---|
| 923 | + currenttab = new cGridBag(); |
---|
| 924 | + added = false; |
---|
| 925 | + String tabname = path[0]; // String.valueOf((char)('A'+tabcount)); |
---|
| 926 | + currenttab.setName(tabname); |
---|
| 927 | + rowcount = 1; |
---|
| 928 | + colcount = 0; |
---|
| 929 | + texturecount = 0; |
---|
| 930 | + } |
---|
| 931 | + |
---|
| 932 | + if (path.length > 2 && path[2].toLowerCase().endsWith(".jpg")) |
---|
| 933 | + { |
---|
| 934 | + if (!added) |
---|
| 935 | + { |
---|
| 936 | + added = true; |
---|
| 937 | + resourcecontainer.add(currenttab); |
---|
| 938 | + String tabname = path[0]; // String.valueOf((char)('A'+tabcount)); |
---|
| 939 | + resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname); |
---|
| 940 | + } |
---|
| 941 | + |
---|
| 942 | + AddTextureButton(path[0], path[1], path[2], texturecount++, currenttab); |
---|
| 943 | + |
---|
| 944 | + if (++colcount >= columns) |
---|
| 945 | + { |
---|
| 946 | + colcount = 0; |
---|
| 947 | + currenttab.Return(); |
---|
| 948 | + |
---|
| 949 | + if (rowcount++ >= rows) |
---|
| 950 | + { |
---|
| 951 | + rowcount = 0; |
---|
| 952 | + } |
---|
| 953 | + } |
---|
| 954 | + } |
---|
| 955 | + else |
---|
| 956 | + { |
---|
| 957 | +// if (!path[path.length-1].equals("icons")) |
---|
| 958 | +// resourcecontainer.Return(); |
---|
| 959 | + } |
---|
| 960 | + } |
---|
| 961 | + |
---|
| 962 | + void CreateTexturePanel(cGridBag container) |
---|
| 963 | + { |
---|
| 964 | + resourcecontainer = new JTabbedPane(JTabbedPane.LEFT); |
---|
| 965 | + container.add(resourcecontainer); |
---|
| 966 | + |
---|
| 967 | + Grafreed.ParseResources("textures", this); |
---|
| 968 | + } |
---|
862 | 969 | |
---|
863 | 970 | void SetupUI2(ObjEditor oe) |
---|
864 | 971 | { |
---|
.. | .. |
---|
931 | 1038 | restoreCameraButton.setToolTipText("Restore viewpoint"); |
---|
932 | 1039 | restoreCameraButton.addActionListener(this); |
---|
933 | 1040 | |
---|
934 | | - copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
935 | | - saveButton.setToolTipText("Duplicate current version"); |
---|
936 | | - saveButton.addActionListener(this); |
---|
| 1041 | + copyOptionsPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1042 | + saveVersionButton.setToolTipText("Duplicate current version"); |
---|
| 1043 | + saveVersionButton.addActionListener(this); |
---|
937 | 1044 | |
---|
938 | | - copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
939 | | - undoButton.setToolTipText("Previous version"); |
---|
940 | | - undoButton.addActionListener(this); |
---|
941 | | - undoButton.setEnabled(false); |
---|
| 1045 | + copyOptionsPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1046 | + deleteVersionButton.setToolTipText("Delete current version"); |
---|
| 1047 | + deleteVersionButton.addActionListener(this); |
---|
| 1048 | + |
---|
| 1049 | + copyOptionsPanel.add(previousVersionButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1050 | + previousVersionButton.setToolTipText("Previous version"); |
---|
| 1051 | + previousVersionButton.addActionListener(this); |
---|
| 1052 | + previousVersionButton.setEnabled(false); |
---|
942 | 1053 | |
---|
943 | 1054 | cGridBag updown = new cGridBag().setVertical(true); |
---|
944 | 1055 | updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
945 | 1056 | restoreButton.setToolTipText("Undo (restore current version)"); |
---|
946 | 1057 | restoreButton.addActionListener(this); |
---|
947 | | - restoreButton.setEnabled(false); |
---|
| 1058 | + //restoreButton.setEnabled(false); |
---|
948 | 1059 | |
---|
949 | 1060 | updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
950 | 1061 | replaceButton.setToolTipText("Save (replace current version)"); |
---|
951 | 1062 | replaceButton.addActionListener(this); |
---|
952 | | - replaceButton.setEnabled(false); |
---|
| 1063 | + //replaceButton.setEnabled(false); |
---|
953 | 1064 | |
---|
954 | 1065 | copyOptionsPanel.add(updown); |
---|
955 | 1066 | |
---|
956 | | - copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
957 | | - redoButton.setToolTipText("Next version"); |
---|
958 | | - redoButton.addActionListener(this); |
---|
959 | | - redoButton.setEnabled(false); |
---|
| 1067 | + copyOptionsPanel.add(nextVersionButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1068 | + nextVersionButton.setToolTipText("Next version"); |
---|
| 1069 | + nextVersionButton.addActionListener(this); |
---|
| 1070 | + nextVersionButton.setEnabled(false); |
---|
960 | 1071 | |
---|
961 | 1072 | oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints); |
---|
962 | 1073 | liveCB.setToolTipText("Enable animation"); |
---|
.. | .. |
---|
1090 | 1201 | |
---|
1091 | 1202 | oe.toolboxPanel.add(row2); |
---|
1092 | 1203 | |
---|
1093 | | - // ENVYMAPS |
---|
1094 | | - cGridBag skyboxpane = new cGridBag(); |
---|
1095 | | - skyboxpane.preferredHeight = 100; |
---|
| 1204 | + cGridBag textures = new cGridBag(); |
---|
1096 | 1205 | |
---|
1097 | | - oe.toolboxPanel.add(skyboxpane); |
---|
| 1206 | + CreateTexturePanel(textures); |
---|
1098 | 1207 | |
---|
1099 | | - JTabbedPane skyboxpanel = new JTabbedPane(); |
---|
1100 | | - skyboxpane.add(skyboxpanel); |
---|
| 1208 | + oe.toolboxPanel.add(textures); |
---|
1101 | 1209 | |
---|
1102 | | - AddSkyboxTab0(skyboxpanel); |
---|
1103 | | - AddSkyboxTab1(skyboxpanel); |
---|
1104 | | - AddSkyboxTab2(skyboxpanel); |
---|
1105 | | - AddSkyboxTab3(skyboxpanel); |
---|
| 1210 | + textures.preferredHeight = 100; |
---|
| 1211 | + |
---|
| 1212 | + CreateSkyboxPanel(oe.skyboxPanel); |
---|
1106 | 1213 | |
---|
1107 | 1214 | // EDIT panel |
---|
1108 | 1215 | editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
.. | .. |
---|
1114 | 1221 | uneditButton.addActionListener(this); |
---|
1115 | 1222 | |
---|
1116 | 1223 | editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints); |
---|
1117 | | - allParamsButton.setToolTipText("Show all controle"); |
---|
| 1224 | + allParamsButton.setToolTipText("Show all controls"); |
---|
1118 | 1225 | allParamsButton.addActionListener(this); |
---|
1119 | 1226 | |
---|
1120 | 1227 | editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1121 | | - clearPanelButton.setToolTipText("Clear edit panel"); |
---|
| 1228 | + clearPanelButton.setToolTipText("Clear all controls"); |
---|
1122 | 1229 | clearPanelButton.addActionListener(this); |
---|
1123 | 1230 | |
---|
1124 | | - editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1125 | | - unselectButton.setToolTipText("Unselect"); |
---|
1126 | | - unselectButton.addActionListener(this); |
---|
| 1231 | + //editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1232 | + //unselectButton.setToolTipText("Unselect"); |
---|
| 1233 | + //unselectButton.addActionListener(this); |
---|
1127 | 1234 | |
---|
1128 | 1235 | editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1129 | 1236 | flashSelectionButton.setToolTipText("Highlight selection"); |
---|
.. | .. |
---|
2571 | 2678 | if (source == invariantsItem) |
---|
2572 | 2679 | { |
---|
2573 | 2680 | System.out.println("Invariants:"); |
---|
2574 | | - Grafreed.grafreeD.universe.invariants(); |
---|
| 2681 | + Grafreed.grafreed.universe.invariants(); |
---|
2575 | 2682 | } else |
---|
2576 | 2683 | if (source == memoryItem) |
---|
2577 | 2684 | { |
---|
.. | .. |
---|
2602 | 2709 | { |
---|
2603 | 2710 | ToggleFullScreen(); |
---|
2604 | 2711 | } else |
---|
2605 | | - if (source == undoButton) |
---|
| 2712 | + if (source == previousVersionButton) |
---|
2606 | 2713 | { |
---|
2607 | 2714 | // Go to previous version |
---|
2608 | 2715 | //if (!Undo()) |
---|
2609 | 2716 | //java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
2610 | | - Undo(); |
---|
| 2717 | + PreviousVersion(); |
---|
2611 | 2718 | } else |
---|
2612 | 2719 | if (source == restoreButton) |
---|
2613 | 2720 | { |
---|
2614 | 2721 | // Restore current version |
---|
2615 | 2722 | Restore(); |
---|
2616 | | - restoreButton.setEnabled(false); |
---|
| 2723 | + //restoreButton.setEnabled(false); |
---|
2617 | 2724 | } else |
---|
2618 | 2725 | if (source == replaceButton) |
---|
2619 | 2726 | { |
---|
2620 | 2727 | // Overwrite current version |
---|
2621 | 2728 | Replace(); |
---|
2622 | | - replaceButton.setEnabled(false); |
---|
| 2729 | + //replaceButton.setEnabled(false); |
---|
2623 | 2730 | } else |
---|
2624 | | - if (source == redoButton) |
---|
| 2731 | + if (source == nextVersionButton) |
---|
2625 | 2732 | { |
---|
2626 | 2733 | // Go to next version |
---|
2627 | | - Redo(); |
---|
| 2734 | + NextVersion(); |
---|
2628 | 2735 | } else |
---|
2629 | | - if (source == saveButton) |
---|
| 2736 | + if (source == saveVersionButton) |
---|
2630 | 2737 | { |
---|
2631 | 2738 | // Save a new version |
---|
2632 | 2739 | if (!Save(true)) |
---|
2633 | 2740 | java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 2741 | + } else |
---|
| 2742 | + if (source == deleteVersionButton) |
---|
| 2743 | + { |
---|
| 2744 | + // Delete a new version |
---|
| 2745 | + DeleteVersion(); |
---|
2634 | 2746 | } else |
---|
2635 | 2747 | if (source == oneStepButton) |
---|
2636 | 2748 | { |
---|
.. | .. |
---|
2685 | 2797 | } else |
---|
2686 | 2798 | if (source == undoItem) |
---|
2687 | 2799 | { |
---|
2688 | | - Undo(); |
---|
| 2800 | + PreviousVersion(); |
---|
2689 | 2801 | } else |
---|
2690 | 2802 | if (source == redoItem) |
---|
2691 | 2803 | { |
---|
2692 | | - Redo(); |
---|
| 2804 | + NextVersion(); |
---|
2693 | 2805 | } else |
---|
2694 | 2806 | if (source == duplicateItem) |
---|
2695 | 2807 | { |
---|
.. | .. |
---|
5160 | 5272 | { |
---|
5161 | 5273 | editButton.setEnabled(enabled); |
---|
5162 | 5274 | uneditButton.setEnabled(enabled); |
---|
5163 | | - unselectButton.setEnabled(enabled); |
---|
| 5275 | + //unselectButton.setEnabled(enabled); |
---|
5164 | 5276 | flashSelectionButton.setEnabled(enabled); |
---|
5165 | 5277 | |
---|
5166 | 5278 | clearPanelButton.setEnabled(!listUI.isEmpty()); |
---|
.. | .. |
---|
5168 | 5280 | |
---|
5169 | 5281 | void refreshContents(boolean cp) |
---|
5170 | 5282 | { |
---|
5171 | | - if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info")) |
---|
| 5283 | + //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info")) |
---|
5172 | 5284 | if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING) |
---|
5173 | 5285 | { |
---|
5174 | 5286 | objEditor.ClearInfo(); // .GetMaterial()); |
---|
.. | .. |
---|
6004 | 6116 | |
---|
6005 | 6117 | cButton restoreCameraButton; |
---|
6006 | 6118 | |
---|
6007 | | - cButton saveButton; |
---|
6008 | 6119 | cButton oneStepButton; |
---|
6009 | 6120 | |
---|
6010 | 6121 | cButton groupButton; |
---|