From e79247ef52a0bbb3864d46bb1e2c716005b3ecf3 Mon Sep 17 00:00:00 2001 From: Normand Briere <nbriere@noware.ca> Date: Thu, 18 Jul 2019 22:19:40 -0400 Subject: [PATCH] Move XYZ panel + icons. --- ObjEditor.java | 90 ++++++++++++++--------------- icons/material.gfd | 0 icons/material.png | 0 icons/primitives512.png | 0 icons/XYZ70.png | 0 icons/primitives.png | 0 icons/material600.png | 0 icons/material760.png | 0 icons/openwindow-200.png | 0 BoundaryRep.java | 2 icons/XYZ.png | 0 GroupEditor.java | 74 ++++++++++++++---------- cFileSystemModel.java | 2 icons/openwindow.png | 0 icons/info.png | 0 Object3D.java | 2 icons/XYZ100.png | 0 17 files changed, 89 insertions(+), 81 deletions(-) diff --git a/BoundaryRep.java b/BoundaryRep.java index 883e363..797e9f7 100644 --- a/BoundaryRep.java +++ b/BoundaryRep.java @@ -4001,7 +4001,7 @@ NormalGenerator ng; if (crease) - ng = new NormalGenerator(Math.PI/6); // default is 44 degrees (or Math.PI/3); // /4); + ng = new NormalGenerator(Math.PI/4); // default is 44 degrees (or Math.PI/3); // /4); else ng = new NormalGenerator(Math.PI); // (Math.PI / 3); // /4); diff --git a/GroupEditor.java b/GroupEditor.java index a08dc18..1e0e863 100644 --- a/GroupEditor.java +++ b/GroupEditor.java @@ -206,8 +206,8 @@ // pasteExpandItem = menu.add(new MenuItem("Paste expand")); // pasteExpandItem.addActionListener(this); menu.add("-"); - clearItem = menu.add(new MenuItem("Clear")); - clearItem.addActionListener(this); + deleteItem = menu.add(new MenuItem("Delete")); + deleteItem.addActionListener(this); if (Globals.ADVANCED) { @@ -433,7 +433,7 @@ genNormalsMESHItem.addActionListener(this); if (Globals.ADVANCED) { - genNormalsMINEItem = menu.add(new MenuItem("My Normals")); + genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals")); genNormalsMINEItem.addActionListener(this); } stripifyItem = menu.add(new MenuItem("Stripify")); @@ -685,27 +685,28 @@ //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"); + + oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + twoButton.setToolTipText("Show right view only"); + twoButton.addActionListener(this); + this.fullscreenLayout = twoButton; + oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); - sixButton.setToolTipText("2-column layout left"); + sixButton.setToolTipText("Show left and right"); sixButton.addActionListener(this); - oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); - threeButton.setToolTipText("2-column layout right"); - threeButton.addActionListener(this); - oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); - sevenButton.setToolTipText("3-column layout"); - sevenButton.addActionListener(this); +// oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); +// threeButton.setToolTipText("2-column layout right"); +// threeButton.addActionListener(this); +// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); +// sevenButton.setToolTipText("3-column layout"); +// sevenButton.addActionListener(this); // - oe.toolbarPanel.add(rootButton = GetButton("icons/write.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); - rootButton.setToolTipText("Edit selection in new tab"); + oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + rootButton.setToolTipText("Open selection in new tab"); rootButton.addActionListener(this); oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); @@ -871,7 +872,7 @@ dgr.addDragGestureListener(this); }catch(Exception e) {} */ - radio.layout = sevenButton; + radio.layout = sixButton; // sevenButton; oe.toolbarPanel.add(radioPanel); //, oe.aConstraints); } @@ -1013,7 +1014,7 @@ } radioButton.SetObject(obj); - radioButton.layout = sevenButton; + radioButton.layout = sixButton; // sevenButton; radioButton.SetCamera(cameraView.renderCamera, false); radioButton.addActionListener(this); radioPanel.add(radioButton); @@ -1692,6 +1693,16 @@ listUI.remove(i); } } + } + + private void EditElement(Object3D elem, boolean newWindow) + { + // if (!(elem instanceof Composite)) + // newWindow = false; + listUI.add(elem); + elem.openEditWindow(this, newWindow); //, false); + System.out.println("edit : " + elem); + elem.editWindow.refreshContents(true); // ? new } /** @@ -2658,7 +2669,7 @@ { StepAll(); } else - if (source == clearItem) // || event.getSource() == clearButton) + if (source == deleteItem) // || event.getSource() == clearButton) { //int indices[] = jList.getSelectedIndices(); //for (int i = indices.length - 1; i >= 0; i--) @@ -3553,10 +3564,10 @@ radio.layout.doClick(); ClearUnpinned(); - Grafreed.Assert(group != null); - Grafreed.Assert(group.selection != null); - SetPinStates(group.selection.size() > 0); - if (group.selection.size() == 1) + //Grafreed.Assert(group != null); + //Grafreed.Assert(group.selection != null); + SetPinStates(group.selection == null || group.selection.size() > 0); + if (group.selection == null || group.selection.size() == 1) EditSelection(false); keepparent = group.parent; // PARENT = NULL or not??? @@ -4627,6 +4638,12 @@ void EditSelection(boolean newWindow) { + if (group.selection == null) + { + EditElement(group, newWindow); // ? new + return; + } + // aConstraints.gridy = 0; for (int i=0; i<group.selection.size(); i++) { @@ -4637,12 +4654,7 @@ Object3D elem = (Object3D)group.selection.elementAt(i); if(elem != group || !newWindow) { - // if (!(elem instanceof Composite)) - // newWindow = false; - listUI.add(elem); - elem.openEditWindow(this, newWindow); //, false); - System.out.println("edit : " + elem); - elem.editWindow.refreshContents(true); // ? new + EditElement(elem, newWindow); // ? new } } } @@ -5695,7 +5707,7 @@ private MenuItem pasteLinkItem; private MenuItem pasteCloneItem; private MenuItem pasteExpandItem; - private MenuItem clearItem; + private MenuItem deleteItem; private MenuItem clearAllItem; private MenuItem genUVItem; private MenuItem genNormalsMESHItem; diff --git a/ObjEditor.java b/ObjEditor.java index 6e1560f..30d64e6 100644 --- a/ObjEditor.java +++ b/ObjEditor.java @@ -44,61 +44,47 @@ cButton GetButton(String name, boolean border) { - try - { - ImageIcon icon = GetIcon(name); - return new cButton(icon, border); - } - catch (Exception e) - { - return new cButton(name, border); - } + ImageIcon icon = GetIcon(name); + return new cButton(icon, border); } cToggleButton GetToggleButton(String name, boolean border) { - try - { - ImageIcon icon = GetIcon(name); - return new cToggleButton(icon, border); - } - catch (Exception e) - { - return new cToggleButton(name, border); - } + ImageIcon icon = GetIcon(name); + return new cToggleButton(icon, border); } cCheckBox GetCheckBox(String name, boolean border) { + ImageIcon icon = GetIcon(name); + return new cCheckBox(icon, border); + } + + private ImageIcon GetIcon(String name) + { try { - ImageIcon icon = GetIcon(name); - return new cCheckBox(icon, border); + BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name)); + + if (image.getWidth() != 24 && image.getHeight() != 24) + { + BufferedImage resized = new BufferedImage(24, 24, image.getType()); + Graphics2D g = resized.createGraphics(); + g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); + //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + g.drawImage(image, 0, 0, 24, 24, 0, 0, image.getWidth(), image.getHeight(), null); + g.dispose(); + + image = resized; + } + + javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image); + return icon; } catch (Exception e) { - return new cCheckBox(name, border); + return null; } - } - - private ImageIcon GetIcon(String name) throws IOException - { - BufferedImage image = javax.imageio.ImageIO.read(getClass().getClassLoader().getResourceAsStream(name)); - - if (image.getWidth() != 24 && image.getHeight() != 24) - { - BufferedImage resized = new BufferedImage(24, 24, image.getType()); - Graphics2D g = resized.createGraphics(); - g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); - //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); - g.drawImage(image, 0, 0, 24, 24, 0, 0, image.getWidth(), image.getHeight(), null); - g.dispose(); - - image = resized; - } - - javax.swing.ImageIcon icon = new javax.swing.ImageIcon(image); - return icon; } // SCRIPT @@ -437,11 +423,12 @@ toolbarPanel = new JPanel(); toolbarPanel.setName("Toolbar"); + treePanel = new cGridBag(); treePanel.setName("Tree"); editPanel = new cGridBag().setVertical(true); - editPanel.setName("Edit"); + //editPanel.setName("Edit"); ctrlPanel = new cGridBag().setVertical(false); // new GridBagLayout()); @@ -450,10 +437,10 @@ editPanel.add(ctrlPanel); toolboxPanel = new cGridBag().setVertical(false); - toolboxPanel.setName("Toolbox"); + //toolboxPanel.setName("Toolbox"); materialPanel = new cGridBag().setVertical(true); - materialPanel.setName("Material"); + //materialPanel.setName("Material"); /*JTextPane*/ infoarea = createTextPane(); @@ -461,6 +448,7 @@ infoarea.setEditable(true); SetText(); + // infoarea.setFont(infoarea.getFont().deriveFont(10, 14f)); // infoarea.setOpaque(false); // //infoarea.setForeground(textcolor); @@ -468,7 +456,7 @@ // TEXTAREA infoarea.setWrapStyleWord(true); infoPanel = new JScrollPane(infoarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //AS_NEEDED); infoPanel.setPreferredSize(new Dimension(1, 1)); - infoPanel.setName("Info"); + //infoPanel.setName("Info"); //infoPanel.setLayout(new BorderLayout()); //infoPanel.add(createTextPane()); @@ -1492,6 +1480,7 @@ XYZPanel.addComponent(/*BorderLayout.SOUTH,*/sideView); // Scroll); XYZPanel.addComponent(/*BorderLayout.CENTER,*/frontView); // Scroll); XYZPanel.addComponent(/*BorderLayout.NORTH,*/topView); // Scroll); + //XYZPanel.setName("XYZ"); /* gridPanel = new JPanel(); //new BorderLayout()); @@ -1529,16 +1518,23 @@ //JScrollPane tmp = new JScrollPane(ctrlPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); //tmp.setName("Edit"); objectPanel.add(materialPanel); + objectPanel.setIconAt(0, GetIcon("icons/material.png")); // JPanel north = new JPanel(new BorderLayout()); // north.setName("Edit"); // north.add(ctrlPanel, BorderLayout.NORTH); // objectPanel.add(north); objectPanel.add(editPanel); + objectPanel.setIconAt(1, GetIcon("icons/write.png")); //if (Globals.ADVANCED) objectPanel.add(infoPanel); + objectPanel.setIconAt(2, GetIcon("icons/info.png")); + + objectPanel.add(XYZPanel); + objectPanel.setIconAt(3, GetIcon("icons/XYZ.png")); objectPanel.add(toolboxPanel); + objectPanel.setIconAt(4, GetIcon("icons/primitives.png")); /* aConstraints.gridx = 0; @@ -1559,7 +1555,7 @@ scrollpane.addMouseWheelListener(this); // Default not fast enough /*JTabbedPane*/ scenePanel = new cGridBag(); - scenePanel.preferredWidth = 6; + scenePanel.preferredWidth = 5; JTabbedPane tabbedPane = new JTabbedPane(); tabbedPane.add(scrollpane); @@ -1637,7 +1633,7 @@ bigThree = new cGridBag(); bigThree.addComponent(scenePanel); bigThree.addComponent(centralPanel); - bigThree.addComponent(XYZPanel); + //bigThree.addComponent(XYZPanel); // // SIDE EFFECT!!! // aConstraints.gridx = 0; diff --git a/Object3D.java b/Object3D.java index f8d6c9c..94907db 100644 --- a/Object3D.java +++ b/Object3D.java @@ -3117,7 +3117,7 @@ { if (bRep != null) { - bRep.GenerateNormalsMINE(); + bRep.MergeNormals(); //.GenerateNormalsMINE(); Touch(); } } diff --git a/cFileSystemModel.java b/cFileSystemModel.java index 98d4aad..df86db6 100644 --- a/cFileSystemModel.java +++ b/cFileSystemModel.java @@ -118,7 +118,7 @@ // Small icons String valueTruncated = valueString.substring(0, valueString.length()-4); - System.out.println(valueTruncated); + //System.out.println("valueTruncated = " + valueTruncated); javax.swing.ImageIcon rendererIcon = icons.get(valueTruncated); diff --git a/icons/XYZ.png b/icons/XYZ.png new file mode 100644 index 0000000..6f1521b --- /dev/null +++ b/icons/XYZ.png Binary files differ diff --git a/icons/XYZ100.png b/icons/XYZ100.png new file mode 100644 index 0000000..d75239e --- /dev/null +++ b/icons/XYZ100.png Binary files differ diff --git a/icons/XYZ70.png b/icons/XYZ70.png new file mode 100644 index 0000000..863b8a0 --- /dev/null +++ b/icons/XYZ70.png Binary files differ diff --git a/icons/info.png b/icons/info.png new file mode 100644 index 0000000..258a6ca --- /dev/null +++ b/icons/info.png Binary files differ diff --git a/icons/material.gfd b/icons/material.gfd new file mode 100644 index 0000000..efad2be --- /dev/null +++ b/icons/material.gfd Binary files differ diff --git a/icons/material.png b/icons/material.png new file mode 100644 index 0000000..9793f33 --- /dev/null +++ b/icons/material.png Binary files differ diff --git a/icons/material600.png b/icons/material600.png new file mode 100644 index 0000000..c9e88d4 --- /dev/null +++ b/icons/material600.png Binary files differ diff --git a/icons/material760.png b/icons/material760.png new file mode 100644 index 0000000..e88ec97 --- /dev/null +++ b/icons/material760.png Binary files differ diff --git a/icons/openwindow-200.png b/icons/openwindow-200.png new file mode 100644 index 0000000..6113c13 --- /dev/null +++ b/icons/openwindow-200.png Binary files differ diff --git a/icons/openwindow.png b/icons/openwindow.png new file mode 100644 index 0000000..9cca056 --- /dev/null +++ b/icons/openwindow.png Binary files differ diff --git a/icons/primitives.png b/icons/primitives.png new file mode 100644 index 0000000..7570562 --- /dev/null +++ b/icons/primitives.png Binary files differ diff --git a/icons/primitives512.png b/icons/primitives512.png new file mode 100644 index 0000000..65914d7 --- /dev/null +++ b/icons/primitives512.png Binary files differ -- Gitblit v1.6.2