From 47cd0f0a3870d843cb758535316060d30f15c811 Mon Sep 17 00:00:00 2001
From: Normand Briere <nbriere@noware.ca>
Date: Mon, 24 Jun 2019 19:10:13 -0400
Subject: [PATCH] Toolbox + DnD
---
ObjEditor.java | 48 ++++++
MandelBulb.java | 56 ++++++++
icons/particles.png | 0
cTree.java | 36 ++++-
icons/sphere.png | 0
icons/torus.png | 0
icons/close-icon.png | 0
icons/cone.png | 0
icons/box.png | 0
CameraPane.java | 4
GroupEditor.java | 179 +++++++++++++++++++------
icons/grid.png | 0
Checker.java | 2
icons/flash-light.png | 0
icons/overlay.png | 0
icons/super.png | 0
icons/write.png | 0
cFileSystemPane.java | 2
cButton.java | 4
cToggleButton.java | 41 +++++
20 files changed, 308 insertions(+), 64 deletions(-)
diff --git a/CameraPane.java b/CameraPane.java
index c1f5c9b..3697e29 100644
--- a/CameraPane.java
+++ b/CameraPane.java
@@ -14377,7 +14377,7 @@
info.camera = renderCamera;
info.x = x;
info.y = y;
- object.manipWindow.copy
+ object.GetWindow().copy
.doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0);
} else
{
@@ -15378,7 +15378,7 @@
}
*/
- object.editWindow.EditSelection();
+ object.editWindow.EditSelection(false);
}
void SelectParent()
diff --git a/Checker.java b/Checker.java
index d1fffe7..1c59d2c 100644
--- a/Checker.java
+++ b/Checker.java
@@ -2,7 +2,7 @@
{
Checker()
{
- this("Checker");
+ this("Overlay");
}
Checker(String name)
diff --git a/GroupEditor.java b/GroupEditor.java
index cce9b1b..9b1b9d3 100644
--- a/GroupEditor.java
+++ b/GroupEditor.java
@@ -150,6 +150,8 @@
void SetupMenu2(GroupEditor oe)
{
+ oe.jTree = new cTree();
+
Menu menu;
oe.menuBar.add(menu = new Menu("Edit"));
//editItem = menu.add(new MenuItem("Edit"));
@@ -160,7 +162,7 @@
// redoItem = menu.add(new MenuItem("Redo"));
// redoItem.addActionListener(this);
// menu.add("-");
- duplicateItem = menu.add(new MenuItem("Duplicate"));
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
duplicateItem.addActionListener(this);
cloneItem = menu.add(new MenuItem("Clone"));
cloneItem.addActionListener(this);
@@ -334,13 +336,21 @@
frontItem.addActionListener(this);
compositeItem = menu.add(new MenuItem("Composite"));
compositeItem.addActionListener(this);
+
+ if (Globals.ADVANCED)
+ {
hideItem = menu.add(new MenuItem("Hidden Group"));
hideItem.addActionListener(this);
+ }
ungroupItem = menu.add(new MenuItem("Ungroup"));
ungroupItem.addActionListener(this);
+
menu.add("-");
+
randomItem = menu.add(new MenuItem("Switch node"));
randomItem.addActionListener(this);
+ if (Globals.ADVANCED)
+ {
switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
switchGeoItem.addActionListener(this);
switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
@@ -348,8 +358,6 @@
morphItem = menu.add(new MenuItem("Morph Group"));
morphItem.addActionListener(this);
- if (Globals.ADVANCED)
- {
menu.add("-");
physicsItem = menu.add(new MenuItem("Physics"));
physicsItem.addActionListener(this);
@@ -588,35 +596,37 @@
fullButton.setToolTipText("Full-screen window");
fullButton.addActionListener(this);
- oe.toolbarPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
+ oe.toolboxPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
undoButton.setToolTipText("Undo changes");
undoButton.addActionListener(this);
- oe.toolbarPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
+ oe.toolboxPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
redoButton.setToolTipText("Redo changes");
redoButton.addActionListener(this);
- oe.toolbarPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
+ oe.toolboxPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
saveButton.setToolTipText("Save changes");
saveButton.addActionListener(this);
- oe.toolbarPanel.add(liveCB = GetCheckBox("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
+ oe.toolboxPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
liveCB.setToolTipText("Enable animation");
liveCB.addItemListener(this);
- oe.toolbarPanel.add(fastCB = GetCheckBox("icons/runfast.png", CameraPane.FAST)); //, constraints);
- fastCB.setToolTipText("Fast mode");
- fastCB.addItemListener(this);
-
- oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
+ oe.toolboxPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
oneStepButton.setToolTipText("Animate one step forward");
oneStepButton.addActionListener(this);
- oe.toolbarPanel.add(trackCB = GetCheckBox("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
+ oe.toolboxPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
+ fastCB.setToolTipText("Fast mode");
+ fastCB.addItemListener(this);
+
+ oe.toolboxPanel.Return();
+
+ oe.toolboxPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
trackCB.setToolTipText("Enable tracking");
trackCB.addItemListener(this);
- oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
+ oe.toolboxPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
screenfitButton.setToolTipText("Screen fit");
screenfitButton.addActionListener(this);
@@ -630,15 +640,17 @@
snapobjectButton.setToolTipText("Snap Object");
}
- oe.toolbarPanel.add(flashSelectionButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
+ oe.toolboxPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
flashSelectionButton.setToolTipText("Highlight selection");
flashSelectionButton.addActionListener(this);
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
twoButton.setToolTipText("Show center view only");
twoButton.addActionListener(this);
+ this.fullscreenLayout = twoButton;
+
oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
fourButton.addActionListener(this);
fourButton.setToolTipText("Show left panel only");
@@ -653,16 +665,63 @@
sevenButton.addActionListener(this);
//
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
+ oe.toolbarPanel.add(rootButton = GetButton("icons/write.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
rootButton.setToolTipText("Edit selection in new tab");
rootButton.addActionListener(this);
- oe.toolbarPanel.add(closeButton = new cButton("X", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
closeButton.setToolTipText("Close tab");
closeButton.addActionListener(this);
//oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
//clearButton.addActionListener(this);
-
+
+ // INSERT
+ oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
+ gridButton.setToolTipText("Create grid");
+ gridButton.addActionListener(this);
+
+ oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
+ boxButton.setToolTipText("Create box");
+ boxButton.addActionListener(this);
+
+ oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
+ sphereButton.setToolTipText("Create sphere");
+ sphereButton.addActionListener(this);
+
+ oe.toolboxPanel.Return();
+
+ oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
+ coneButton.setToolTipText("Create cone");
+ coneButton.addActionListener(this);
+
+ oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
+ torusButton.setToolTipText("Create torus");
+ torusButton.addActionListener(this);
+
+ oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
+ superButton.setToolTipText("Create superellipsoid");
+ superButton.addActionListener(this);
+
+ if (Globals.ADVANCED)
+ {
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
+ kleinButton.setToolTipText("Create Klein bottle");
+ kleinButton.addActionListener(this);
+ }
+
+ oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
+ particlesButton.setToolTipText("Create particle system");
+ particlesButton.addActionListener(this);
+
+ oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
+ overlayButton.setToolTipText("Create overlay");
+ overlayButton.addActionListener(this);
+
+ oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
+ lightButton.setToolTipText("Create light");
+ lightButton.addActionListener(this);
+
+ // EDIT panel
editCommandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
editButton.setToolTipText("Edit selection");
editButton.addActionListener(this);
@@ -703,7 +762,7 @@
JScrollPane jSP;
//ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
ResetModel();
oe.treePanel.add(jSPPanel);
@@ -868,16 +927,16 @@
/*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
}
- cCheckBox liveCB;
+ cToggleButton liveCB;
cCheckBox supportCB;
cCheckBox localCB;
cCheckBox crowdCB;
cCheckBox smoothCB;
- cCheckBox fastCB;
+ cToggleButton fastCB;
cCheckBox slowCB;
cCheckBox boxCB;
cCheckBox zoomBoxCB;
- cCheckBox trackCB;
+ cToggleButton trackCB;
cCheckBox smoothfocusCB;
// JCheckBox speakerMocapCB;
cCheckBox speakerCameraCB;
@@ -1014,7 +1073,8 @@
/**/
//DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
+ TreePath path = objEditor.jTree.getSelectionPath();
if ((path == null) || (path.getPathCount() <= 1)) {
// We can't move the root node or an empty selection
return;
@@ -1138,16 +1198,16 @@
return;
}
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
- {
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
+// {
loadClipboard(true);
objEditor.jTree.setSelectionPath(destinationPath);
pasteInto(false, false);
- } else {
- loadClipboard(false);
- objEditor.jTree.setSelectionPath(destinationPath);
- pasteInto(false, false); // true); // ???
- }
+// } else {
+// loadClipboard(false);
+// objEditor.jTree.setSelectionPath(destinationPath);
+// pasteInto(false, false); // true); // ???
+// }
}
public void dropActionChanged(DropTargetDragEvent dtde)
// Called if the user has modified the current drop gesture
@@ -1739,11 +1799,11 @@
objEditor.cameraView.renderCamera.setAim(v2, v1);
objEditor.cameraView.repaint();
} else
- if (source == rectoidItem)
+ if (source == rectoidItem || source == boxButton)
{
makeSomething(new Box());
} else
- if (source == particleItem)
+ if (source == particleItem || source == particlesButton)
{
ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
ParticleController particleController = new ParticleController(particleGeom);
@@ -1822,27 +1882,27 @@
makeSomething(obj);
} else
- if (source == gridItem)
+ if (source == gridItem || source == gridButton)
{
makeSomething(new Grid());
} else
- if (source == ellipsoidItem)
+ if (source == ellipsoidItem || source == sphereButton)
{
makeSomething(new Sphere());
} else
- if (source == coneItem)
+ if (source == coneItem || source == coneButton)
{
makeSomething(new Cone());
} else
- if (source == torusItem)
+ if (source == torusItem || source == torusButton)
{
makeSomething(new Torus());
} else
- if (source == superItem)
+ if (source == superItem || source == superButton)
{
makeSomething(new Superellipsoid());
} else
- if (source == kleinItem)
+ if (source == kleinItem || source == kleinButton)
{
makeSomething(new Klein());
} else
@@ -1862,7 +1922,7 @@
{
makeSomething(new BezierSurface());
} else
- if (source == overlayItem)
+ if (source == overlayItem || source == overlayButton)
{
/*
Object3D obj = new BezierSurface(5,8);
@@ -1910,7 +1970,7 @@
s.setup();
makeSomething(s);
} else
- if (source == lightItem)
+ if (source == lightItem || source == lightButton)
{
makeSomething(new Light());
} else
@@ -2596,7 +2656,7 @@
{
CastShadow(2);
} else
- if (source == ungroupItem)
+ if (source == ungroupItem || source == ungroupButton)
{
//ungroup();
for (int i=0; i<group.selection.size(); i++)
@@ -2934,6 +2994,10 @@
if (source == twoButton)
{
radio.layout = twoButton;
+
+ if (CameraPane.FULLSCREEN)
+ fullscreenLayout = radio.layout;
+
// bug
//gridPanel.setDividerLocation(1.0);
//bigPanel.setDividerLocation(0.0);
@@ -2989,6 +3053,9 @@
{
radio.layout = threeButton;
+ if (CameraPane.FULLSCREEN)
+ fullscreenLayout = radio.layout;
+
// bigThree.remove(scenePanel);
// bigThree.remove(centralPanel);
// bigThree.remove(XYZPanel);
@@ -3027,6 +3094,9 @@
{
radio.layout = fourButton;
+ if (CameraPane.FULLSCREEN)
+ fullscreenLayout = radio.layout;
+
// bigThree.remove(scenePanel);
// bigThree.remove(centralPanel);
// bigThree.remove(XYZPanel);
@@ -3063,6 +3133,9 @@
if (source == sixButton)
{
radio.layout = sixButton;
+
+ if (CameraPane.FULLSCREEN)
+ fullscreenLayout = radio.layout;
// bigThree.remove(scenePanel);
// bigThree.remove(centralPanel);
@@ -3101,6 +3174,9 @@
if (source == sevenButton)
{
radio.layout = sevenButton;
+
+ if (CameraPane.FULLSCREEN)
+ fullscreenLayout = radio.layout;
// bigThree.remove(scenePanel);
// bigThree.remove(centralPanel);
@@ -4369,7 +4445,7 @@
{
//System.out.println("edit : " + objectPanel.indexOfTab("Material"));
//objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
Object3D elem = (Object3D)group.selection.elementAt(i);
if(elem != group || !newWindow)
@@ -5333,6 +5409,21 @@
cButton saveButton;
cButton oneStepButton;
+ cButton groupButton;
+ cButton ungroupButton;
+ cButton compositeButton;
+
+ cButton gridButton;
+ cButton boxButton;
+ cButton sphereButton;
+ cButton coneButton;
+ cButton torusButton;
+ cButton superButton;
+ cButton kleinButton;
+ cButton particlesButton;
+ cButton overlayButton;
+ cButton lightButton;
+
cButton screenfitButton;
cButton screenfitpointButton;
cButton snapobjectButton;
@@ -5357,7 +5448,7 @@
private MenuItem cutItem;
private MenuItem undoItem;
private MenuItem redoItem;
- private MenuItem duplicateItem;
+ private JMenuItem duplicateItem;
private MenuItem cloneItem;
private MenuItem cloneSupportItem;
private MenuItem overwriteGeoItem;
diff --git a/MandelBulb.java b/MandelBulb.java
new file mode 100644
index 0000000..cfffb85
--- /dev/null
+++ b/MandelBulb.java
@@ -0,0 +1,56 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+/**
+ *
+ * @author nbriere
+ */
+public class MandelBulb extends Object3D
+{
+ public boolean inside(double x, double y, double z, boolean transform) // , double d)
+ {
+ double d = 1; // Oops not so easy
+
+ double posX = x;
+ double posY = y;
+ double posZ = z;
+
+ double dr = 1.0;
+ double r = 0.0;
+
+ for (int i = 0; i < 10; i++)
+ {
+ double dist2xy = x*x + y*y;
+ r = Math.sqrt(dist2xy + z*z);
+ if (r > 10000)
+ {
+ break;
+ }
+
+ // convert to polar coordinates
+ //double theta = Math.acos(z / r);
+ double theta = Math.atan2(-z, Math.sqrt(dist2xy));
+ double phi = Math.atan2(y, x);
+ double zr = Math.pow(r, 8);
+ dr = zr / r * 8 * dr + 1.0;
+
+ // scale and rotate the point
+ theta = theta * 8;
+ phi = phi * 8;
+
+ // convert back to cartesian coordinates
+ double sintheta = zr * Math.sin(theta);
+ x = sintheta * Math.cos(phi);
+ y = Math.sin(phi) * sintheta;
+ z = zr * Math.cos(theta);
+
+ x += posX;
+ y += posY;
+ z += posZ;
+ }
+
+ return ((0.5 * Math.log(r) * r / dr) < d);
+ }
+}
diff --git a/ObjEditor.java b/ObjEditor.java
index a1683f8..fdd2815 100644
--- a/ObjEditor.java
+++ b/ObjEditor.java
@@ -52,6 +52,19 @@
}
}
+ cToggleButton GetToggleButton(String name, boolean border)
+ {
+ try
+ {
+ ImageIcon icon = GetIcon(name);
+ return new cToggleButton(icon, border);
+ }
+ catch (Exception e)
+ {
+ return new cToggleButton(name, border);
+ }
+ }
+
cCheckBox GetCheckBox(String name, boolean border)
{
try
@@ -384,9 +397,12 @@
editPanel.add(editCommandsPanel);
editPanel.add(ctrlPanel);
- materialPanel = new cGridBag().setVertical(true);
+ toolboxPanel = new cGridBag().setVertical(false);
+ toolboxPanel.setName("Toolbox");
+ materialPanel = new cGridBag().setVertical(true);
materialPanel.setName("Material");
+
/*JTextPane*/
infoarea = createTextPane();
doc = infoarea.getStyledDocument();
@@ -659,6 +675,8 @@
boolean maximized;
+ cButton fullscreenLayout;
+
void Minimize()
{
frame.setState(Frame.ICONIFIED);
@@ -720,7 +738,7 @@
// X frame.getContentPane().add(/*"Center",*/bigThree);
framePanel.setDividerLocation(0);
- radio.layout = twoButton;
+ radio.layout = fullscreenLayout;
radio.layout.doClick();
//frame.setVisible(true);
}
@@ -1394,6 +1412,7 @@
//JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
//tmp.setName("Edit");
+ objectPanel.add(toolboxPanel);
objectPanel.add(materialPanel);
// JPanel north = new JPanel(new BorderLayout());
// north.setName("Edit");
@@ -3726,7 +3745,7 @@
assert false;
}
- void EditSelection()
+ void EditSelection(boolean newWindow)
{
}
@@ -4221,7 +4240,7 @@
void makeSomething(Object3D thing, boolean resetmodel) // deselect)
{
- if (Globals.SAVEONMAKE)
+ if (Globals.SAVEONMAKE) // && resetmodel)
Save();
//Tween.set(thing, 0).target(1).start(tweenManager);
//Tween.to(thing, 0, 0.5f).target(0).start(tweenManager);
@@ -4309,6 +4328,12 @@
{
ResetModel();
Select(thing.GetTreePath(), true, false); // unselect... false);
+
+ if (thing.Size() == 0)
+ {
+ //EditSelection(false);
+ }
+
refreshContents();
}
@@ -4903,18 +4928,29 @@
CheckboxMenuItem togglePaintItem;
JSplitPane mainPanel;
JScrollPane scrollpane;
+
JPanel toolbarPanel;
+
cGridBag treePanel;
+
JPanel radioPanel;
ButtonGroup buttonGroup;
- cGridBag ctrlPanel;
+
+ cGridBag toolboxPanel;
cGridBag materialPanel;
+ cGridBag ctrlPanel;
+
JScrollPane infoPanel;
+
cGridBag optionsPanel;
+
JTabbedPane objectPanel;
+
cGridBag XYZPanel;
+
JSplitPane gridPanel;
JSplitPane bigPanel;
+
cGridBag bigThree;
cGridBag scenePanel;
cGridBag centralPanel;
@@ -5029,7 +5065,7 @@
cNumberSlider fogField;
JLabel opacityPowerLabel;
cNumberSlider opacityPowerField;
- JTree jTree;
+ cTree jTree;
//ObjectUI parent;
cNumberSlider normalpushField;
diff --git a/cButton.java b/cButton.java
index 6755475..faeb185 100644
--- a/cButton.java
+++ b/cButton.java
@@ -12,7 +12,7 @@
{
super(name);
- setMargin(new java.awt.Insets(1, 1, 1, 1));
+ setMargin(new java.awt.Insets(1, -8, 1, -8));
if (border)
setBorder(new javax.swing.border.EtchedBorder());
@@ -26,7 +26,7 @@
{
super(icon);
- setMargin(new java.awt.Insets(1, 1, 1, 1));
+ setMargin(new java.awt.Insets(-1, -8, -1, -8));
//result = new JButton( icon );
//result.setBorderPainted( false );
diff --git a/cFileSystemPane.java b/cFileSystemPane.java
index 56bc5ea..cbc4ddf 100644
--- a/cFileSystemPane.java
+++ b/cFileSystemPane.java
@@ -14,7 +14,7 @@
//DragSourceListener,
DropTargetListener
{
- cTree jTree = new cTree(null);
+ cTree jTree = new cTree();
iCallBack owner;
JButton refreshButton;
diff --git a/cToggleButton.java b/cToggleButton.java
new file mode 100644
index 0000000..7f9252b
--- /dev/null
+++ b/cToggleButton.java
@@ -0,0 +1,41 @@
+import java.awt.Color;
+import javax.swing.ImageIcon;
+import javax.swing.border.EtchedBorder;
+
+public class cToggleButton extends javax.swing.JToggleButton
+{
+ cToggleButton(String name, boolean enabled)
+ {
+ super(name, enabled);
+
+ //setBorder(new javax.swing.border.EmptyBorder(0, 0, 0, 0));
+ setBorder(new javax.swing.border.EtchedBorder(8));
+ }
+
+ cToggleButton(ImageIcon icon, boolean enabled)
+ {
+ super("", enabled);
+
+ this.image = icon.getImage();
+ iconWidth = icon.getIconWidth();
+
+ //setBorder(new javax.swing.border.EmptyBorder(8, 0, 8, 24)); // top, left, bottom, right
+ setBorder(new javax.swing.border.EtchedBorder(EtchedBorder.RAISED, Color.BLACK, Color.BLACK));
+ }
+
+ private java.awt.Image image;
+ private int iconWidth;
+
+ @Override
+ protected void paintComponent(java.awt.Graphics g)
+ {
+ super.paintComponent(g);
+ if (image != null)
+ {
+ //if (getWidth() > image.getWidth(null) + 8)
+ {
+ g.drawImage(image, this.getWidth()/2 - 12, this.getHeight()/2 - 12, this);
+ }
+ }
+ }
+}
diff --git a/cTree.java b/cTree.java
index 198376c..2632e2b 100644
--- a/cTree.java
+++ b/cTree.java
@@ -2,17 +2,29 @@
/**/
import java.awt.*;
import java.awt.dnd.*;
-import javax.swing.JTree;
-import javax.swing.tree.TreeModel;
+import javax.swing.*;
+import javax.swing.tree.*;
+import java.awt.event.*;
class cTree extends JTree implements Autoscroll //, DragGestureListener
{
+ JPopupMenu popup = new JPopupMenu();
- public cTree(TreeModel newModel)
+ public cTree() // TreeModel newModel)
{
- super(newModel);
-
+ //super(newModel);
+
//setRootVisible(false);
+
+ addMouseListener(new MouseAdapter()
+ {
+ public void mousePressed(MouseEvent e)
+ {
+ if (e.isPopupTrigger()) {
+ popup.show((JComponent) e.getSource(), e.getX(), e.getY());
+ }
+ }
+ });
}
/*
@@ -46,8 +58,17 @@
Rectangle inner = getParent().getBounds();
return new Insets(inner.y - outer.y + margin, inner.x - outer.x + margin, outer.height - inner.height - inner.y + outer.y + margin, outer.width - inner.width - inner.x + outer.x + margin);
}
-
- // Use this method if you want to see the boundaries of the
+//@Override
+//public void mouseClicked(java.awt.event.MouseEvent e) {
+//
+// if (SwingUtilities.isRightMouseButton(e)) {
+//
+// int row = getClosestRowForLocation(e.getX(), e.getY());
+// setSelectionRow(row);
+// popupMenu.show(e.getComponent(), e.getX(), e.getY());
+// }
+//}
+// Use this method if you want to see the boundaries of the
// autoscroll active region
/* bug
@@ -62,4 +83,3 @@
/**/
}
/**/
-
diff --git a/icons/box.png b/icons/box.png
new file mode 100644
index 0000000..497d7c8
--- /dev/null
+++ b/icons/box.png
Binary files differ
diff --git a/icons/close-icon.png b/icons/close-icon.png
new file mode 100644
index 0000000..4654a31
--- /dev/null
+++ b/icons/close-icon.png
Binary files differ
diff --git a/icons/cone.png b/icons/cone.png
new file mode 100644
index 0000000..7080e0b
--- /dev/null
+++ b/icons/cone.png
Binary files differ
diff --git a/icons/flash-light.png b/icons/flash-light.png
new file mode 100644
index 0000000..81ba154
--- /dev/null
+++ b/icons/flash-light.png
Binary files differ
diff --git a/icons/grid.png b/icons/grid.png
new file mode 100644
index 0000000..a911884
--- /dev/null
+++ b/icons/grid.png
Binary files differ
diff --git a/icons/overlay.png b/icons/overlay.png
new file mode 100644
index 0000000..8c71876
--- /dev/null
+++ b/icons/overlay.png
Binary files differ
diff --git a/icons/particles.png b/icons/particles.png
new file mode 100644
index 0000000..2fee0fd
--- /dev/null
+++ b/icons/particles.png
Binary files differ
diff --git a/icons/sphere.png b/icons/sphere.png
new file mode 100644
index 0000000..06d2363
--- /dev/null
+++ b/icons/sphere.png
Binary files differ
diff --git a/icons/super.png b/icons/super.png
new file mode 100644
index 0000000..d3a80cc
--- /dev/null
+++ b/icons/super.png
Binary files differ
diff --git a/icons/torus.png b/icons/torus.png
new file mode 100644
index 0000000..d9e943f
--- /dev/null
+++ b/icons/torus.png
Binary files differ
diff --git a/icons/write.png b/icons/write.png
new file mode 100644
index 0000000..ec8d8fc
--- /dev/null
+++ b/icons/write.png
Binary files differ
--
Gitblit v1.6.2