From a76491b66a2e304d9ae27a162f407b98c70fbafa Mon Sep 17 00:00:00 2001 From: Normand Briere <nbriere@noware.ca> Date: Wed, 01 May 2019 20:30:24 -0400 Subject: [PATCH] Fix flush UI. --- ObjEditor.java | 161 +++++++++++++++++++++++++++++++---------------------- 1 files changed, 95 insertions(+), 66 deletions(-) diff --git a/ObjEditor.java b/ObjEditor.java index 98cec4e..b81d8f2 100644 --- a/ObjEditor.java +++ b/ObjEditor.java @@ -143,6 +143,8 @@ //nameField.removeActionListener(this); // objEditor.ctrlPanel.remove(nameField); + objEditor.ctrlPanel.remove(namePanel); + if (!GroupEditor.allparams) return; @@ -165,7 +167,6 @@ // objEditor.ctrlPanel.remove(fasterButton); // objEditor.ctrlPanel.remove(remarkButton); - objEditor.ctrlPanel.remove(namePanel); objEditor.ctrlPanel.remove(setupPanel); objEditor.ctrlPanel.remove(commandsPanel); objEditor.ctrlPanel.remove(pushPanel); @@ -359,7 +360,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 +368,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 +387,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 +435,7 @@ static String newline = "\n"; protected static final String buttonString = "JButton"; StyledDocument doc; - JTextArea infoarea; + JTextPane infoarea; void ClearInfo() { @@ -499,7 +502,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 +603,9 @@ { CameraPane.pointflow = (PointFlow) sel; } + + si.SendInfo("_____________________", "regular"); + si.SendInfo("", "regular"); } } @@ -628,52 +637,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) @@ -943,10 +952,6 @@ void SetupUI2(ObjEditor oe) { -// oe.aConstraints.weightx = 0; -// oe.aConstraints.weighty = 0; -// oe.aConstraints.gridx = 0; -// oe.aConstraints.gridy = 0; //SetupName(oe); namePanel = new cGridBag(); @@ -963,27 +968,45 @@ setupPanel = new cGridBag().setVertical(false); liveCB = AddCheckBox(setupPanel, "Live", copy.live); - link2masterCB = AddCheckBox(setupPanel, "Supp", copy.link2master); + liveCB.setToolTipText("Animate object"); hideCB = AddCheckBox(setupPanel, "Hide", copy.hide); + hideCB.setToolTipText("Hide object"); // Return(); markCB = AddCheckBox(setupPanel, "Mark", copy.marked); - rewindCB = AddCheckBox(setupPanel, "Rew", copy.rewind); - randomCB = AddCheckBox(setupPanel, "Rand", copy.random); + markCB.setToolTipText("Set the animation target transform"); + + rewindCB = AddCheckBox(setupPanel, "Rewind", copy.rewind); + rewindCB.setToolTipText("Rewind animation"); + + randomCB = AddCheckBox(setupPanel, "Random", copy.random); + randomCB.setToolTipText("Option for switch node"); + if (Globals.ADVANCED) + { + link2masterCB = AddCheckBox(setupPanel, "Support", copy.link2master); + link2masterCB.setToolTipText("Attach to support"); + speedupCB = AddCheckBox(setupPanel, "Speed", copy.speedup); + speedupCB.setToolTipText("Option motion capture"); + } + oe.ctrlPanel.add(setupPanel); oe.ctrlPanel.Return(); commandsPanel = new cGridBag().setVertical(false); resetButton = AddButton(commandsPanel, "Reset"); + resetButton.setToolTipText("Jump to frame zero"); stepButton = AddButton(commandsPanel, "Step"); + stepButton.setToolTipText("Step one frame"); // resetAllButton = AddButton(oe, "Reset All"); // stepAllButton = AddButton(oe, "Step All"); - speedupCB = AddCheckBox(commandsPanel, "Speed", copy.speedup); // Return(); slowerButton = AddButton(commandsPanel, "Slow"); + slowerButton.setToolTipText("Decrease animation speed"); fasterButton = AddButton(commandsPanel, "Fast"); + fasterButton.setToolTipText("Increase animation speed"); remarkButton = AddButton(commandsPanel, "Remark"); + remarkButton.setToolTipText("Set the current transform as the target"); oe.ctrlPanel.add(commandsPanel); oe.ctrlPanel.Return(); @@ -1436,17 +1459,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); /**/ @@ -2969,6 +2997,7 @@ if (event.getSource() == randomCB) { copy.random ^= true; + objEditor.refreshContents(); return; } if (event.getSource() == speedupCB) @@ -3192,7 +3221,7 @@ if (!Globals.ANIMATION) { FileDialog browser = new FileDialog(frame, "Save Animation As...", FileDialog.SAVE); - browser.show(); + browser.setVisible(true); String filename = browser.getFile(); if (filename != null && filename.length() > 0) { @@ -4425,7 +4454,7 @@ JSplitPane mainPanel; JScrollPane scrollpane; JPanel toolbarPanel; - JPanel treePanel; + cGridBag treePanel; JPanel radioPanel; ButtonGroup buttonGroup; cGridBag ctrlPanel; -- Gitblit v1.6.2