From 480ad70047e54b2b92f974e6c2ac5a6c0bdc5a5c Mon Sep 17 00:00:00 2001
From: Normand Briere <nbriere@noware.ca>
Date: Sun, 18 Aug 2019 13:56:09 -0400
Subject: [PATCH] Fix new + checkbox
---
ObjEditor.java | 61 ++++++++++++++++--------------
icons/writewhite.png | 0
CameraPane.java | 2
Camera.java | 2
GroupEditor.java | 2
icons/checkbox.png | 0
Grafreed.java | 40 +++++++++++++++++--
7 files changed, 71 insertions(+), 36 deletions(-)
diff --git a/Camera.java b/Camera.java
index 4452e0e..4a67693 100644
--- a/Camera.java
+++ b/Camera.java
@@ -71,7 +71,7 @@
perspective = false;
break;
case 4: // Default light
- location = LA.newVector(-10, 30, 20);
+ location = LA.newVector(-5, 20, 10);
perspective = false;
break;
}
diff --git a/CameraPane.java b/CameraPane.java
index 4f834cb..298bf09 100644
--- a/CameraPane.java
+++ b/CameraPane.java
@@ -10699,7 +10699,7 @@
if (patchMaterial.patchMaterial)
{
patchMaterial.patchMaterial = false;
- patchMaterial.objectPanel.setSelectedIndex(0);
+ patchMaterial.objectPanel.setSelectedIndex(1);
}
if (Grafreed.savesound && Grafreed.hassound)
diff --git a/Grafreed.java b/Grafreed.java
index 2c1cfc9..8de12f4 100644
--- a/Grafreed.java
+++ b/Grafreed.java
@@ -881,7 +881,6 @@
// try{Thread.sleep(5000);}catch(Exception e){}
// PlayAudio("/Users/nbriere/Downloads/Footsteps-6.wav", 4, 1);
-
/**/
if (Globals.NIMBUSLAF)
{
@@ -934,6 +933,8 @@
ui = UIManager.getDefaults();
+ x = ui.get("RadioButton.icon");
+
ArrayList gradient = new java.util.ArrayList(5);
gradient.add(1.0);
gradient.add(0.0);
@@ -943,9 +944,9 @@
ui.put("Button.gradient", gradient);
- //ui.put("RadioButton.icon", ObjEditor.GetIcon("icons/white-sphere-icon.png"));
- //ui.put("RadioButtonMenuItem.checkIcon", ObjEditor.GetIcon("icons/fit.png"));
- //ui.put("RadioButtonMenuItem.arrowIcon", ObjEditor.GetIcon("icons/fit.png"));
+ //ui.put("RadioButton.icon", new CheckBox()); //ObjEditor.GetIcon("icons/white-sphere-icon.png")));
+ ui.put("CheckBox.icon", new CheckBox()); //ObjEditor.GetIcon("icons/white-sphere-icon.png")));
+ //ui.put("CheckBoxMenuItem.checkIcon", ObjEditor.GetIcon("icons/white-sphere-icon.png"));
ui.put("Slider.foreground", new javax.swing.plaf.ColorUIResource(0,0,0));
ui.put("Slider.horizontalThumbIcon", ObjEditor.GetIcon("icons/white-sphere-icon.png"));
@@ -1015,7 +1016,9 @@
//Monitor mon=MonitorFactory.start("myFirstMonitor");
standAlone = true;
- grafreed = new Grafreed();
+
+ grafreed = new Grafreed();
+
grafreed.materials = ReadGFD(grafreed.getClass().getClassLoader().getResourceAsStream("gfd/materials.gfd"));
grafreed.universe = new cGroup();
@@ -1035,6 +1038,33 @@
javax.swing.ToolTipManager.sharedInstance().setEnabled(Globals.TOOLTIPS);
}
+ static class CheckBox extends javax.swing.plaf.metal.MetalCheckBoxIcon
+ {
+ java.awt.image.BufferedImage image;
+
+ CheckBox()
+ {
+ try
+ {
+ image = javax.imageio.ImageIO.read(ObjEditor.class.getClassLoader().getResourceAsStream("icons/checkbox.png"));
+ }
+ catch (Exception e)
+ {
+ }
+ }
+
+ protected void drawCheck(Component c, Graphics g, int x, int y)
+ {
+ super.drawCheck(c, g, x, y);
+ }
+
+ public void paintIcon(Component c, Graphics g, int x, int y)
+ {
+ g.drawImage(image, x-1, y-1, 19, 19, null);
+ super.paintIcon(c, g, x+2, y+2);
+ }
+ }
+
static Object3D materials;
static Object3D ReadGFD(java.io.InputStream istream)
diff --git a/GroupEditor.java b/GroupEditor.java
index 615e02f..c86dd4d 100644
--- a/GroupEditor.java
+++ b/GroupEditor.java
@@ -347,7 +347,7 @@
public void CreateSkyboxPanel(cGridBag skyboxPanel)
{
- JTabbedPane skyboxpane = new JTabbedPane();
+ JTabbedPane skyboxpane = new JTabbedPane(JTabbedPane.LEFT);
AddSkyboxTab0(skyboxpane);
AddSkyboxTab1(skyboxpane);
diff --git a/ObjEditor.java b/ObjEditor.java
index 8108843..098f83d 100644
--- a/ObjEditor.java
+++ b/ObjEditor.java
@@ -72,6 +72,21 @@
}
}
+ public Composite CreateCameras()
+ {
+ Composite cams = new cTemplate();
+ cams.name = "Cameras";
+ copy.insertElementAt(cams, 0);
+
+ cams.addChild(new Camera());
+ cams.addChild(new Camera(1));
+ cams.addChild(new Camera(2));
+ cams.addChild(new Camera(3));
+ cams.addChild(new Camera(4));
+
+ return cams;
+ }
+
public cGridBag GetSeparator()
{
cGridBag separator = new cGridBag();
@@ -1550,23 +1565,9 @@
if (cam == null || !(copy.get(0) instanceof cGroup))
{
- if (Globals.DEBUG)
- System.out.println("CREATE CAMERAS");
- cams = new cTemplate();
- cams.name = "Cameras";
- copy.insertElementAt(cams, 0);
- //cams.parent = copy;
-
- cam = new Camera(); // LA.newVector(3, 2, 1));
- cams.addChild(cam);
- cam = new Camera(1);
- cams.addChild(cam);
- cam = new Camera(2);
- cams.addChild(cam);
- cam = new Camera(3);
- cams.addChild(cam);
- cam = new Camera(4); // Light
- cams.addChild(cam);
+ if (Globals.DEBUG)
+ System.out.println("CREATE CAMERAS");
+ cams = CreateCameras();
} else
{
cams = (cGroup) copy.get(0);
@@ -1718,24 +1719,24 @@
//JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
//tmp.setName("Edit");
+ objectPanel.add(skyboxPanel);
+ objectPanel.setIconAt(0, GetIcon("icons/skybox.jpg"));
+ objectPanel.setToolTipTextAt(0, "Backgrounds");
+
objectPanel.add(toolboxPanel);
- objectPanel.setIconAt(0, GetIcon("icons/primitives.png"));
- objectPanel.setToolTipTextAt(0, "Objects & textures");
+ objectPanel.setIconAt(1, GetIcon("icons/primitives.png"));
+ objectPanel.setToolTipTextAt(1, "Objects & textures");
objectPanel.add(materialPanel);
- objectPanel.setIconAt(1, GetIcon("icons/material.png"));
- objectPanel.setToolTipTextAt(1, "Material");
+ objectPanel.setIconAt(2, GetIcon("icons/material.png"));
+ objectPanel.setToolTipTextAt(2, "Material");
- objectPanel.add(skyboxPanel);
- objectPanel.setIconAt(2, GetIcon("icons/skybox.jpg"));
- objectPanel.setToolTipTextAt(2, "Backgrounds");
-
// JPanel north = new JPanel(new BorderLayout());
// north.setName("Edit");
// north.add(ctrlPanel, BorderLayout.NORTH);
// objectPanel.add(north);
objectPanel.add(editPanel);
- objectPanel.setIconAt(3, GetIcon("icons/write.png"));
+ objectPanel.setIconAt(3, GetIcon("icons/writewhite.png"));
objectPanel.setToolTipTextAt(3, "Edit controls");
objectPanel.add(transformPanel);
@@ -1744,7 +1745,7 @@
patchMaterial = true;
cameraView.patchMaterial = this;
- objectPanel.setSelectedIndex(1);
+ objectPanel.setSelectedIndex(2);
/*
aConstraints.gridx = 0;
@@ -4206,8 +4207,12 @@
copy.selection.clear();
+ if (copy == Grafreed.grafreed.universe)
+ {
+ CreateCameras();
+ cameraView.SetCamera(GetCamera(copy, 0));
+ }
ResetModel();
- SetupViews();
objEditor.refreshContents();
}
diff --git a/icons/checkbox.png b/icons/checkbox.png
new file mode 100644
index 0000000..ede16aa
--- /dev/null
+++ b/icons/checkbox.png
Binary files differ
diff --git a/icons/writewhite.png b/icons/writewhite.png
new file mode 100644
index 0000000..3c76931
--- /dev/null
+++ b/icons/writewhite.png
Binary files differ
--
Gitblit v1.6.2