Normand Briere
2019-08-18 480ad70047e54b2b92f974e6c2ac5a6c0bdc5a5c
Fix new + checkbox
5 files modified
2 files added
107 ■■■■■ changed files
Camera.java 2 ●●● patch | view | raw | blame | history
CameraPane.java 2 ●●● patch | view | raw | blame | history
Grafreed.java 40 ●●●● patch | view | raw | blame | history
GroupEditor.java 2 ●●● patch | view | raw | blame | history
ObjEditor.java 61 ●●●● patch | view | raw | blame | history
icons/checkbox.png patch | view | raw | blame | history
icons/writewhite.png patch | view | raw | blame | history
Camera.java
....@@ -71,7 +71,7 @@
7171 perspective = false;
7272 break;
7373 case 4: // Default light
74
- location = LA.newVector(-10, 30, 20);
74
+ location = LA.newVector(-5, 20, 10);
7575 perspective = false;
7676 break;
7777 }
CameraPane.java
....@@ -10699,7 +10699,7 @@
1069910699 if (patchMaterial.patchMaterial)
1070010700 {
1070110701 patchMaterial.patchMaterial = false;
10702
- patchMaterial.objectPanel.setSelectedIndex(0);
10702
+ patchMaterial.objectPanel.setSelectedIndex(1);
1070310703 }
1070410704
1070510705 if (Grafreed.savesound && Grafreed.hassound)
Grafreed.java
....@@ -881,7 +881,6 @@
881881 // try{Thread.sleep(5000);}catch(Exception e){}
882882 // PlayAudio("/Users/nbriere/Downloads/Footsteps-6.wav", 4, 1);
883883
884
-
885884 /**/
886885 if (Globals.NIMBUSLAF)
887886 {
....@@ -934,6 +933,8 @@
934933
935934 ui = UIManager.getDefaults();
936935
936
+ x = ui.get("RadioButton.icon");
937
+
937938 ArrayList gradient = new java.util.ArrayList(5);
938939 gradient.add(1.0);
939940 gradient.add(0.0);
....@@ -943,9 +944,9 @@
943944
944945 ui.put("Button.gradient", gradient);
945946
946
- //ui.put("RadioButton.icon", ObjEditor.GetIcon("icons/white-sphere-icon.png"));
947
- //ui.put("RadioButtonMenuItem.checkIcon", ObjEditor.GetIcon("icons/fit.png"));
948
- //ui.put("RadioButtonMenuItem.arrowIcon", ObjEditor.GetIcon("icons/fit.png"));
947
+ //ui.put("RadioButton.icon", new CheckBox()); //ObjEditor.GetIcon("icons/white-sphere-icon.png")));
948
+ ui.put("CheckBox.icon", new CheckBox()); //ObjEditor.GetIcon("icons/white-sphere-icon.png")));
949
+ //ui.put("CheckBoxMenuItem.checkIcon", ObjEditor.GetIcon("icons/white-sphere-icon.png"));
949950
950951 ui.put("Slider.foreground", new javax.swing.plaf.ColorUIResource(0,0,0));
951952 ui.put("Slider.horizontalThumbIcon", ObjEditor.GetIcon("icons/white-sphere-icon.png"));
....@@ -1015,7 +1016,9 @@
10151016
10161017 //Monitor mon=MonitorFactory.start("myFirstMonitor");
10171018 standAlone = true;
1018
- grafreed = new Grafreed();
1019
+
1020
+ grafreed = new Grafreed();
1021
+
10191022 grafreed.materials = ReadGFD(grafreed.getClass().getClassLoader().getResourceAsStream("gfd/materials.gfd"));
10201023
10211024 grafreed.universe = new cGroup();
....@@ -1035,6 +1038,33 @@
10351038 javax.swing.ToolTipManager.sharedInstance().setEnabled(Globals.TOOLTIPS);
10361039 }
10371040
1041
+ static class CheckBox extends javax.swing.plaf.metal.MetalCheckBoxIcon
1042
+ {
1043
+ java.awt.image.BufferedImage image;
1044
+
1045
+ CheckBox()
1046
+ {
1047
+ try
1048
+ {
1049
+ image = javax.imageio.ImageIO.read(ObjEditor.class.getClassLoader().getResourceAsStream("icons/checkbox.png"));
1050
+ }
1051
+ catch (Exception e)
1052
+ {
1053
+ }
1054
+ }
1055
+
1056
+ protected void drawCheck(Component c, Graphics g, int x, int y)
1057
+ {
1058
+ super.drawCheck(c, g, x, y);
1059
+ }
1060
+
1061
+ public void paintIcon(Component c, Graphics g, int x, int y)
1062
+ {
1063
+ g.drawImage(image, x-1, y-1, 19, 19, null);
1064
+ super.paintIcon(c, g, x+2, y+2);
1065
+ }
1066
+ }
1067
+
10381068 static Object3D materials;
10391069
10401070 static Object3D ReadGFD(java.io.InputStream istream)
GroupEditor.java
....@@ -347,7 +347,7 @@
347347
348348 public void CreateSkyboxPanel(cGridBag skyboxPanel)
349349 {
350
- JTabbedPane skyboxpane = new JTabbedPane();
350
+ JTabbedPane skyboxpane = new JTabbedPane(JTabbedPane.LEFT);
351351
352352 AddSkyboxTab0(skyboxpane);
353353 AddSkyboxTab1(skyboxpane);
ObjEditor.java
....@@ -72,6 +72,21 @@
7272 }
7373 }
7474
75
+ public Composite CreateCameras()
76
+ {
77
+ Composite cams = new cTemplate();
78
+ cams.name = "Cameras";
79
+ copy.insertElementAt(cams, 0);
80
+
81
+ cams.addChild(new Camera());
82
+ cams.addChild(new Camera(1));
83
+ cams.addChild(new Camera(2));
84
+ cams.addChild(new Camera(3));
85
+ cams.addChild(new Camera(4));
86
+
87
+ return cams;
88
+ }
89
+
7590 public cGridBag GetSeparator()
7691 {
7792 cGridBag separator = new cGridBag();
....@@ -1550,23 +1565,9 @@
15501565
15511566 if (cam == null || !(copy.get(0) instanceof cGroup))
15521567 {
1553
- if (Globals.DEBUG)
1554
- System.out.println("CREATE CAMERAS");
1555
- cams = new cTemplate();
1556
- cams.name = "Cameras";
1557
- copy.insertElementAt(cams, 0);
1558
- //cams.parent = copy;
1559
-
1560
- cam = new Camera(); // LA.newVector(3, 2, 1));
1561
- cams.addChild(cam);
1562
- cam = new Camera(1);
1563
- cams.addChild(cam);
1564
- cam = new Camera(2);
1565
- cams.addChild(cam);
1566
- cam = new Camera(3);
1567
- cams.addChild(cam);
1568
- cam = new Camera(4); // Light
1569
- cams.addChild(cam);
1568
+ if (Globals.DEBUG)
1569
+ System.out.println("CREATE CAMERAS");
1570
+ cams = CreateCameras();
15701571 } else
15711572 {
15721573 cams = (cGroup) copy.get(0);
....@@ -1718,24 +1719,24 @@
17181719
17191720 //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
17201721 //tmp.setName("Edit");
1722
+ objectPanel.add(skyboxPanel);
1723
+ objectPanel.setIconAt(0, GetIcon("icons/skybox.jpg"));
1724
+ objectPanel.setToolTipTextAt(0, "Backgrounds");
1725
+
17211726 objectPanel.add(toolboxPanel);
1722
- objectPanel.setIconAt(0, GetIcon("icons/primitives.png"));
1723
- objectPanel.setToolTipTextAt(0, "Objects & textures");
1727
+ objectPanel.setIconAt(1, GetIcon("icons/primitives.png"));
1728
+ objectPanel.setToolTipTextAt(1, "Objects & textures");
17241729
17251730 objectPanel.add(materialPanel);
1726
- objectPanel.setIconAt(1, GetIcon("icons/material.png"));
1727
- objectPanel.setToolTipTextAt(1, "Material");
1731
+ objectPanel.setIconAt(2, GetIcon("icons/material.png"));
1732
+ objectPanel.setToolTipTextAt(2, "Material");
17281733
1729
- objectPanel.add(skyboxPanel);
1730
- objectPanel.setIconAt(2, GetIcon("icons/skybox.jpg"));
1731
- objectPanel.setToolTipTextAt(2, "Backgrounds");
1732
-
17331734 // JPanel north = new JPanel(new BorderLayout());
17341735 // north.setName("Edit");
17351736 // north.add(ctrlPanel, BorderLayout.NORTH);
17361737 // objectPanel.add(north);
17371738 objectPanel.add(editPanel);
1738
- objectPanel.setIconAt(3, GetIcon("icons/write.png"));
1739
+ objectPanel.setIconAt(3, GetIcon("icons/writewhite.png"));
17391740 objectPanel.setToolTipTextAt(3, "Edit controls");
17401741
17411742 objectPanel.add(transformPanel);
....@@ -1744,7 +1745,7 @@
17441745
17451746 patchMaterial = true;
17461747 cameraView.patchMaterial = this;
1747
- objectPanel.setSelectedIndex(1);
1748
+ objectPanel.setSelectedIndex(2);
17481749
17491750 /*
17501751 aConstraints.gridx = 0;
....@@ -4206,8 +4207,12 @@
42064207
42074208 copy.selection.clear();
42084209
4210
+ if (copy == Grafreed.grafreed.universe)
4211
+ {
4212
+ CreateCameras();
4213
+ cameraView.SetCamera(GetCamera(copy, 0));
4214
+ }
42094215 ResetModel();
4210
- SetupViews();
42114216 objEditor.refreshContents();
42124217 }
42134218
icons/checkbox.png
Binary files differ
icons/writewhite.png
Binary files differ