From 914255f70cf047897212839cbf3a6722703f4457 Mon Sep 17 00:00:00 2001 From: Normand Briere <nbriere@noware.ca> Date: Mon, 24 Jun 2019 13:19:16 -0400 Subject: [PATCH] Fix manip window + new icons. --- ObjEditor.java | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 54 insertions(+), 1 deletions(-) diff --git a/ObjEditor.java b/ObjEditor.java index 9fcd4b1..a1683f8 100644 --- a/ObjEditor.java +++ b/ObjEditor.java @@ -4,6 +4,7 @@ import java.awt.*; import java.awt.event.*; +import java.awt.image.BufferedImage; import javax.swing.*; import javax.swing.event.*; import javax.swing.text.*; @@ -37,6 +38,52 @@ JFrame frame; static ObjEditor theFrame; + + cButton GetButton(String name, boolean border) + { + try + { + ImageIcon icon = GetIcon(name); + return new cButton(icon, border); + } + catch (Exception e) + { + return new cButton(name, border); + } + } + + cCheckBox GetCheckBox(String name, boolean border) + { + try + { + ImageIcon icon = GetIcon(name); + return new cCheckBox(icon, border); + } + catch (Exception e) + { + return new cCheckBox(name, border); + } + } + + 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 @@ -3408,6 +3455,8 @@ public void Save() { + System.err.println("Save"); + cRadio tab = GetCurrentTab(); boolean temp = CameraPane.SWITCH; @@ -3492,6 +3541,8 @@ public void Undo() { + System.err.println("Undo"); + cRadio tab = GetCurrentTab(); if (tab.undoindex == 0) @@ -4170,7 +4221,8 @@ void makeSomething(Object3D thing, boolean resetmodel) // deselect) { - Save(); + if (Globals.SAVEONMAKE) + Save(); //Tween.set(thing, 0).target(1).start(tweenManager); //Tween.to(thing, 0, 0.5f).target(0).start(tweenManager); // if (thing instanceof GenericJointDemo) @@ -4479,6 +4531,7 @@ if (readobj != null) { + if (Globals.SAVEONMAKE) Save(); try { -- Gitblit v1.6.2