From b1585b5b2b60c4165be400636c787fae24428c6a Mon Sep 17 00:00:00 2001
From: Normand Briere <nbriere@noware.ca>
Date: Wed, 01 May 2019 14:26:22 -0400
Subject: [PATCH] Fix info panel
---
ObjEditor.java | 125 +++++++++++++-----------
GroupEditor.java | 116 +++++++++++-----------
GrafreeD.java | 2
MocapEditor.java | 21 +++-
Mocap.java | 2
5 files changed, 143 insertions(+), 123 deletions(-)
diff --git a/GrafreeD.java b/GrafreeD.java
index 075e813..d82d57e 100644
--- a/GrafreeD.java
+++ b/GrafreeD.java
@@ -15,7 +15,7 @@
//import com.jamonapi.*;
public class GrafreeD extends Applet implements ActionListener
{
- static boolean NIMBUSLAF = false;
+ static boolean NIMBUSLAF = true;
static int RENDERME = 0;
diff --git a/GroupEditor.java b/GroupEditor.java
index 60a98fd..93258aa 100644
--- a/GroupEditor.java
+++ b/GroupEditor.java
@@ -436,11 +436,11 @@
*/
//this.AddOptions(oe.toolbarPanel, oe.aConstraints);
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE()), oe.aConstraints);
+ oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
liveCB.setToolTipText("Enabled animation");
liveCB.addItemListener(this);
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK), oe.aConstraints);
+ oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
trackCB.setToolTipText("Enable tracking");
trackCB.addItemListener(this);
@@ -485,47 +485,42 @@
//
oe.toolbarPanel.add(rootButton = new cButton("o o o", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
- rootButton.setToolTipText("Edit object in new tab");
+ rootButton.setToolTipText("Edit selection in new tab");
rootButton.addActionListener(this);
- oe.aConstraints.gridx += 1;
- oe.toolbarPanel.add(closeButton = new cButton("X", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
+
+ oe.toolbarPanel.add(closeButton = new cButton("X", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
closeButton.setToolTipText("Close tab");
closeButton.addActionListener(this);
//oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
//clearButton.addActionListener(this);
- oe.aConstraints.gridx += 1;
- oe.aConstraints.gridx = 1; //
- oe.treePanel.add(editButton = new cButton("+"), oe.aConstraints);
+ cGridBag commandsPanel = new cGridBag();
+
+ commandsPanel.add(editButton = new cButton("+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
+ editButton.setToolTipText("Edit selection");
editButton.addActionListener(this);
- oe.aConstraints.gridx += 1;
- oe.aConstraints.weighty = 0;
- oe.aConstraints.gridwidth = 1;
- oe.treePanel.add(uneditButton = new cButton("-"), oe.aConstraints);
+ commandsPanel.add(uneditButton = new cButton("-", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
+ uneditButton.setToolTipText("Unedit selection");
uneditButton.addActionListener(this);
- oe.aConstraints.gridx += 1;
- oe.aConstraints.weighty = 0;
- oe.aConstraints.gridwidth = 1;
-
- oe.treePanel.add(clearPanelButton = new cButton("C"), oe.aConstraints);
+ commandsPanel.add(clearPanelButton = new cButton("C", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
+ clearPanelButton.setToolTipText("Clear edit panel");
clearPanelButton.addActionListener(this);
- oe.aConstraints.gridx += 1;
- oe.aConstraints.weighty = 0;
- oe.aConstraints.gridwidth = 1;
-
- oe.treePanel.add(allParamsButton = new cButton("A"), oe.aConstraints);
+ commandsPanel.add(allParamsButton = new cButton("A", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
+ allParamsButton.setToolTipText("All params??");
allParamsButton.addActionListener(this);
- oe.aConstraints.gridx += 1;
- oe.aConstraints.weighty = 0;
- oe.aConstraints.gridwidth = 1;
-
- oe.treePanel.add(unselectButton = new cButton("U"), oe.aConstraints);
+ commandsPanel.add(unselectButton = new cButton("U", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
+ unselectButton.setToolTipText("Unselect");
unselectButton.addActionListener(this);
+ commandsPanel.preferredHeight = 1;
+
+ oe.treePanel.add(commandsPanel);
+ oe.treePanel.Return();
+
// oe.aConstraints.gridx += 1;
// oe.aConstraints.weighty = 0;
// oe.aConstraints.gridwidth = 1;
@@ -537,40 +532,37 @@
// oe.treePanel.add(gcButton = new cButton("GC"), oe.aConstraints);
// gcButton.addActionListener(this);
- oe.aConstraints.gridx = 0;
- oe.aConstraints.gridy += 1;
-
- //ctrlPanel.add(objList = new List(5, true));
- oe.aConstraints.gridwidth = 100;
- // oe.aConstraints.gridheight = 100;
- oe.aConstraints.fill = GridBagConstraints.BOTH; // HORIZONTAL;
- oe.aConstraints.gridheight = 1;
- oe.aConstraints.weighty = 0.5;
- oe.aConstraints.gridx = 0;
- JScrollPane jSP;
+ cGridBag jSPPanel = new cGridBag();
+
+ JScrollPane jSP;
//ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
- oe.treePanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null)), oe.aConstraints);
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
ResetModel();
- oe.aConstraints.weighty = 0.5;
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
- oe.aConstraints.gridy += 1;
- oe.aConstraints.gridwidth = 1;
+
+ oe.treePanel.add(jSPPanel);
+ oe.treePanel.Return();
- oe.aConstraints.weighty = 0;
- oe.aConstraints.gridwidth = 2;
-
- oe.treePanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0), oe.aConstraints);
+ cGridBag copyOptionsPanel = new cGridBag();
+
+ copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
+ colorCB.setToolTipText("Copy color when dropped");
colorCB.addItemListener(this);
- oe.aConstraints.gridx += 2;
- oe.treePanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0), oe.aConstraints);
+
+ copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
+ materialCB.setToolTipText("Copy material when dropped");
materialCB.addItemListener(this);
- oe.aConstraints.gridx += 2;
- oe.treePanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0), oe.aConstraints);
+
+ copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
+ textureCB.setToolTipText("Copy texture when dropped");
textureCB.addItemListener(this);
- oe.aConstraints.gridx = 0;
- oe.aConstraints.gridy += 1;
+ copyOptionsPanel.preferredHeight = 1;
+ oe.treePanel.add(copyOptionsPanel);
+ oe.treePanel.Return();
+// mainPanel.setDividerLocation(0.5); //1.0);
+// mainPanel.setResizeWeight(0.5);
+
//jList.addListSelectionListener(this);
oe.jTree.addTreeSelectionListener(this);
//jTree.setRootVisible(false);
@@ -664,6 +656,12 @@
panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
lookAtCB.setToolTipText("Look-at target");
lookAtCB.addItemListener(this);
+
+ cGridBag fill = new cGridBag();
+
+ fill.preferredHeight = 200;
+
+ panel.add(fill);
}
@@ -4113,12 +4111,12 @@
System.err.println("info : " + child.GetPath());
}
}
- else
- {
- objEditor.SetMaterial(group); // .GetMaterial());
- objEditor.AddInfo(group, this, true); // .GetMaterial());
- System.err.println("info : " + group.GetPath());
- }
+// else
+// {
+// objEditor.SetMaterial(group); // .GetMaterial());
+// objEditor.AddInfo(group, this, true); // .GetMaterial());
+// System.err.println("info : " + group.GetPath());
+// }
objEditor.SetText(); // jan 2014
diff --git a/Mocap.java b/Mocap.java
index 9760bbb..82ff7f8 100644
--- a/Mocap.java
+++ b/Mocap.java
@@ -2267,7 +2267,7 @@
}
if (!smoothed)
- for (int i=0; --i>=0;)
+ for (int i=1; --i>=0;)
SmoothAnimData(); // much reduces shakiness
smoothed = true;
diff --git a/MocapEditor.java b/MocapEditor.java
index a03ea39..74a1069 100644
--- a/MocapEditor.java
+++ b/MocapEditor.java
@@ -9,6 +9,9 @@
class MocapEditor extends ObjEditor implements //ItemListener,
ChangeListener, ObjectUI, ActionListener
{
+ cGridBag firstPanel;
+ cGridBag framePanel;
+ cGridBag lastPanel;
MocapEditor(Mocap inBP, GroupEditor callee)
{
super(inBP,callee);
@@ -69,12 +72,15 @@
oe.aConstraints.gridwidth = 1;
*/
super.SetupUI2(oe);
+ framePanel = AddSlider(oe.ctrlPanel, "Frame:", 0, mocap.bvh.animation.getNumFrames()-1, mocap.frame);
- frameField = (cNumberSlider)AddSlider(oe.ctrlPanel, "Frame:", 0, mocap.bvh.animation.getNumFrames()-1, mocap.frame).getComponent(1);
+ frameField = (cNumberSlider)framePanel.getComponent(1);
oe.ctrlPanel.Return();
- firstField = (cNumberSlider)AddSlider(oe.ctrlPanel, "First:", 0, mocap.bvh.animation.getNumFrames()-1, mocap.firstframe).getComponent(1);
+ firstPanel = AddSlider(oe.ctrlPanel, "First:", 0, mocap.bvh.animation.getNumFrames()-1, mocap.firstframe);
+ firstField = (cNumberSlider)firstPanel.getComponent(1);
oe.ctrlPanel.Return();
- lastField = (cNumberSlider)AddSlider(oe.ctrlPanel, "Last:", 0, mocap.bvh.animation.getNumFrames()-1, mocap.lastframe).getComponent(1);
+ lastPanel = AddSlider(oe.ctrlPanel, "Last:", 0, mocap.bvh.animation.getNumFrames()-1, mocap.lastframe);
+ lastField = (cNumberSlider)lastPanel.getComponent(1);
oe.ctrlPanel.Return();
// oe.aConstraints.gridx = 0;
@@ -241,15 +247,18 @@
{
ObjEditor oe = objEditor;
- Remove(frameField);
- Remove(firstField);
- Remove(lastField);
+// Remove(frameField);
+// Remove(firstField);
+// Remove(lastField);
// frameField.removeChangeListener(this);
// oe.ctrlPanel.remove(frameField);
// oe.ctrlPanel.remove(frameLabel);
// oe.ctrlPanel.remove(speedField);
// oe.ctrlPanel.remove(speedLabel);
//oe.ctrlPanel.repaint();
+ oe.ctrlPanel.remove(framePanel);
+ oe.ctrlPanel.remove(firstPanel);
+ oe.ctrlPanel.remove(lastPanel);
super.closeUI();
}
diff --git a/ObjEditor.java b/ObjEditor.java
index 98cec4e..565390e 100644
--- a/ObjEditor.java
+++ b/ObjEditor.java
@@ -359,7 +359,7 @@
objectPanel = new JTabbedPane();
toolbarPanel = new JPanel();
toolbarPanel.setName("Toolbar");
- treePanel = new JPanel();
+ treePanel = new cGridBag();
treePanel.setName("Tree");
ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout());
ctrlPanel.setName("Edit");
@@ -367,13 +367,15 @@
materialPanel.setName("Material");
/*JTextPane*/
infoarea = createTextPane();
+ doc = infoarea.getStyledDocument();
+
infoarea.setEditable(true);
SetText();
// infoarea.setFont(infoarea.getFont().deriveFont(10, 14f));
// infoarea.setOpaque(false);
// //infoarea.setForeground(textcolor);
- infoarea.setLineWrap(true);
- infoarea.setWrapStyleWord(true);
+// TEXTAREA infoarea.setLineWrap(true);
+// TEXTAREA infoarea.setWrapStyleWord(true);
infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED);
infoPanel.setPreferredSize(new Dimension(50, 200));
infoPanel.setName("Info");
@@ -384,14 +386,14 @@
mainPanel.setName("Main");
mainPanel.setContinuousLayout(true);
mainPanel.setOneTouchExpandable(true);
- mainPanel.setDividerLocation(1.0);
mainPanel.setDividerSize(9);
- mainPanel.setResizeWeight(0);
+ mainPanel.setDividerLocation(0.5); //1.0);
+ mainPanel.setResizeWeight(0.5);
//ctrlPanel.setLayout(new GridLayout(4, 1, 5, 5));
//mainPanel.setLayout(new GridBagLayout());
toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
- treePanel.setLayout(new GridBagLayout());
+// treePanel.setLayout(new GridBagLayout());
//ctrlPanel.setLayout(new GridBagLayout());
//materialPanel.setLayout(new GridBagLayout());
@@ -432,7 +434,7 @@
static String newline = "\n";
protected static final String buttonString = "JButton";
StyledDocument doc;
- JTextArea infoarea;
+ JTextPane infoarea;
void ClearInfo()
{
@@ -499,7 +501,10 @@
}
if (full)
- si.SendInfo(" BBox: " + minima + " - " + maxima, "regular");
+ {
+ si.SendInfo(" BBox min: " + minima, "regular");
+ si.SendInfo(" BBox max: " + maxima, "regular");
+ }
if (sel.bRep != null)
{
@@ -597,6 +602,9 @@
{
CameraPane.pointflow = (PointFlow) sel;
}
+
+ si.SendInfo("_____________________", "regular");
+ si.SendInfo("", "regular");
}
}
@@ -628,52 +636,52 @@
cameraView.ToggleFullScreen();
}
- private JTextArea createTextPane()
+ private JTextPane createTextPane()
{
- String[] initString =
- {
- "This is an editable JTextPane, ", //regular
- "another ", //italic
- "styled ", //bold
- "text ", //small
- "component, ", //large
- "which supports embedded components..." + newline,//regular
- " " + newline, //button
- "...and embedded icons..." + newline, //regular
- " ", //icon
- newline + "JTextPane is a subclass of JEditorPane that "
- + "uses a StyledEditorKit and StyledDocument, and provides "
- + "cover methods for interacting with those objects."
- };
+// TEXTAREA String[] initString =
+// {
+// "This is an editable JTextPane, ", //regular
+// "another ", //italic
+// "styled ", //bold
+// "text ", //small
+// "component, ", //large
+// "which supports embedded components..." + newline,//regular
+// " " + newline, //button
+// "...and embedded icons..." + newline, //regular
+// " ", //icon
+// newline + "JTextPane is a subclass of JEditorPane that "
+// + "uses a StyledEditorKit and StyledDocument, and provides "
+// + "cover methods for interacting with those objects."
+// };
+//
+// String[] initStyles =
+// {
+// "regular", "italic", "bold", "small", "large",
+// "regular", "button", "regular", "icon",
+// "regular"
+// };
+//
+// JTextPane textPane = new JTextPane();
+// textPane.setEditable(true);
+// /*StyledDocument*/ doc = textPane.getStyledDocument();
+// addStylesToDocument(doc);
+//
+// try
+// {
+// for (int j = 0; j < 2; j++)
+// {
+// for (int i = 0; i < initString.length; i++)
+// {
+// doc.insertString(doc.getLength(), initString[i],
+// doc.getStyle(initStyles[i]));
+// }
+// }
+// } catch (BadLocationException ble)
+// {
+// System.err.println("Couldn't insert initial text into text pane.");
+// }
- String[] initStyles =
- {
- "regular", "italic", "bold", "small", "large",
- "regular", "button", "regular", "icon",
- "regular"
- };
-
- JTextPane textPane = new JTextPane();
- textPane.setEditable(true);
- /*StyledDocument*/ doc = textPane.getStyledDocument();
- addStylesToDocument(doc);
-
- try
- {
- for (int j = 0; j < 2; j++)
- {
- for (int i = 0; i < initString.length; i++)
- {
- doc.insertString(doc.getLength(), initString[i],
- doc.getStyle(initStyles[i]));
- }
- }
- } catch (BadLocationException ble)
- {
- System.err.println("Couldn't insert initial text into text pane.");
- }
-
- return new JTextArea(); // textPane;
+ return new JTextPane(); // textPane;
}
protected void addStylesToDocument(StyledDocument doc)
@@ -1436,17 +1444,22 @@
cGridBag editBar = new cGridBag().setVertical(false);
- editBar.add(createMaterialButton = new cButton("Create")); // , aConstraints);
+ editBar.add(createMaterialButton = new cButton("Create", !GrafreeD.NIMBUSLAF)); // , aConstraints);
+ createMaterialButton.setToolTipText("Create material");
/*
ctrlPanel.add(resetSlidersButton = new cButton("Reset All"), aConstraints);
*/
- editBar.add(clearMaterialButton = new cButton("Clear")); // , aConstraints);
- editBar.add(resetSlidersButton = new cButton("Reset")); // , aConstraints);
+ editBar.add(clearMaterialButton = new cButton("Clear", !GrafreeD.NIMBUSLAF)); // , aConstraints);
+ clearMaterialButton.setToolTipText("Clear material");
+
+ editBar.add(resetSlidersButton = new cButton("Reset", !GrafreeD.NIMBUSLAF)); // , aConstraints);
editBar.add(propagateToggle = new cCheckBox("Prop", propagate)); // , aConstraints);
editBar.add(multiplyToggle = new cCheckBox("Mult", false)); // , aConstraints);
+ editBar.preferredHeight = 15;
+
panel.add(editBar);
/**/
@@ -4425,7 +4438,7 @@
JSplitPane mainPanel;
JScrollPane scrollpane;
JPanel toolbarPanel;
- JPanel treePanel;
+ cGridBag treePanel;
JPanel radioPanel;
ButtonGroup buttonGroup;
cGridBag ctrlPanel;
--
Gitblit v1.6.2