From 68289a9315aa485ae0dbb98e842591b2d936be6f Mon Sep 17 00:00:00 2001 From: Ben Fry Date: Sat, 30 Jul 2022 19:13:48 -0400 Subject: [PATCH] finish up icons for debug toolbar --- .../mode/java/debug/VariableInspector.java | 118 ++++-------------- java/theme/variables-1x.png | Bin 2408 -> 0 bytes java/theme/variables-2x.png | Bin 4751 -> 0 bytes todo.txt | 20 +-- 4 files changed, 37 insertions(+), 101 deletions(-) delete mode 100644 java/theme/variables-1x.png delete mode 100644 java/theme/variables-2x.png diff --git a/java/src/processing/mode/java/debug/VariableInspector.java b/java/src/processing/mode/java/debug/VariableInspector.java index fa92a7c39..619e4d47b 100644 --- a/java/src/processing/mode/java/debug/VariableInspector.java +++ b/java/src/processing/mode/java/debug/VariableInspector.java @@ -2,7 +2,7 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2012-15 The Processing Foundation + Copyright (c) 2012-22 The Processing Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 @@ -21,7 +21,6 @@ package processing.mode.java.debug; import java.awt.*; -import java.awt.image.BufferedImage; import java.io.File; import java.util.ArrayList; import java.util.Arrays; @@ -39,7 +38,6 @@ import com.sun.jdi.Value; import processing.app.Language; import processing.app.Messages; -import processing.app.Mode; import processing.app.ui.Toolkit; import processing.mode.java.JavaEditor; @@ -169,10 +167,11 @@ public class VariableInspector extends JDialog { /** * Model for a Outline Row (excluding the tree column). Column 0 is "Value". - * Column 1 is "Type". Handles setting and getting values. TODO: Maybe use a - * TableCellRenderer instead of this to also have a different icon based on - * expanded state. See: - * http://kickjava.com/src/org/netbeans/swing/outline/DefaultOutlineCellRenderer.java.htm + * Column 1 is "Type". Handles setting and getting values. + * + * TODO: Maybe use a TableCellRenderer instead of this to also have a + * different icon based on expanded state, for instance: + * http://kickjava.com/src/org/netbeans/swing/outline/DefaultOutlineCellRenderer.java.htm */ protected class VariableRowModel implements RowModel { final String column0 = Language.text("debugger.value"); @@ -301,77 +300,35 @@ public class VariableInspector extends JDialog { static final int ICON_SIZE = 16; // Indices correspond to VariableNode.TYPE_OBJECT...TYPE_SHORT - static final String[] TYPE_NAMES = { + final String[] TYPE_NAMES = { "object", "array", "integer", "float", "boolean", "char", "string", "long", "double", "byte", "short" }; + final int TYPE_COUNT = TYPE_NAMES.length; - Icon[][] icons; + Icon[] enabledIcons; + Icon[] disabledIcons; OutlineRenderer() { - icons = new Icon[][] { - renderIcons("object"), - renderIcons("array"), - renderIcons("integer"), - renderIcons("float"), - renderIcons("boolean"), - renderIcons("char"), - renderIcons("string"), - renderIcons("long"), - renderIcons("double"), - renderIcons("byte"), - renderIcons("short") - }; - } + enabledIcons = new Icon[TYPE_COUNT]; + disabledIcons = new Icon[TYPE_COUNT]; - - private ImageIcon[] renderIcons(String type) { - File file = editor.getMode().getContentFile("theme/variables/" + type + ".svg"); - return new ImageIcon[] { - Toolkit.renderIcon(file, ENABLED_COLOR, ICON_SIZE), - Toolkit.renderIcon(file, DISABLED_COLOR, ICON_SIZE) - }; - } - - - /** - * Load multiple icons (horizontal) with multiple states (vertical) from - * a single file. - * - * @param fileName file path in the mode folder. - * @return a nested array (first index: icon, second index: state) or - * null if the file wasn't found. - */ - private ImageIcon[][] loadIcons(String fileName) { - Mode mode = editor.getMode(); - File file = mode.getContentFile(fileName); - if (!file.exists()) { - Messages.log(getClass().getName(), "icon file not found: " + file.getAbsolutePath()); - return null; + for (int i = 0; i < TYPE_COUNT; i++) { + String type = TYPE_NAMES[i]; + File file = editor.getMode().getContentFile("theme/variables/" + type + ".svg"); + enabledIcons[i] = Toolkit.renderIcon(file, ENABLED_COLOR, ICON_SIZE); + disabledIcons[i] = Toolkit.renderIcon(file, DISABLED_COLOR, ICON_SIZE); } - Image allIcons = mode.loadImage(fileName); - int cols = allIcons.getWidth(null) / ICON_SIZE; - int rows = allIcons.getHeight(null) / ICON_SIZE; - ImageIcon[][] iconImages = new ImageIcon[cols][rows]; - - for (int i = 0; i < cols; i++) { - for (int j = 0; j < rows; j++) { - Image image = new BufferedImage(ICON_SIZE, ICON_SIZE, BufferedImage.TYPE_INT_ARGB); - Graphics g = image.getGraphics(); - g.drawImage(allIcons, -i * ICON_SIZE, -j * ICON_SIZE, null); - iconImages[i][j] = new ImageIcon(image); - } - } - return iconImages; } protected Icon getIcon(int type, boolean enabled) { + Icon[] icons = enabled ? enabledIcons : disabledIcons; if (type < 0 || type > icons.length - 1) { return null; } - return icons[type][enabled ? 0 : 1]; + return icons[type]; } @@ -459,13 +416,12 @@ public class VariableInspector extends JDialog { // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . - // TODO: could probably extend the simpler DefaultTableCellRenderer here /** * Renderer for the value column. Uses an italic font for null values and - * Object values ("instance of ..."). Uses a gray color when tree is not - * enabled. + * Object values ("instance of ..."). Uses a gray color when tree disabled. + * TODO: could probably extend the simpler DefaultTableCellRenderer here */ - protected class ValueCellRenderer extends DefaultOutlineCellRenderer { + static protected class ValueCellRenderer extends DefaultOutlineCellRenderer { public ValueCellRenderer() { super(); @@ -502,7 +458,7 @@ public class VariableInspector extends JDialog { * Editor for the value column. Will show an empty string when editing * String values that are null. */ - protected class ValueCellEditor extends DefaultCellEditor { + static protected class ValueCellEditor extends DefaultCellEditor { public ValueCellEditor() { super(new JTextField()); @@ -590,24 +546,6 @@ public class VariableInspector extends JDialog { // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . - // removed in 3.0a9, doesn't seem to be used? -// protected static void run(final VariableInspector vi) { -// EventQueue.invokeLater(new Runnable() { -// @Override -// public void run() { -// vi.setVisible(true); -// } -// }); -// } - - - /* - public DefaultMutableTreeNode getRootNode() { - return rootNode; - } - */ - - /** * Unlock the inspector window. Rebuild after this to avoid ... dots in the * trees labels @@ -729,8 +667,6 @@ public class VariableInspector extends JDialog { path = synthesizePath(path); if (path != null) { tree.expandPath(path); - } else { - //System.out.println("couldn't synthesize path"); } } @@ -804,7 +740,7 @@ public class VariableInspector extends JDialog { public interface VariableNodeFilter { /** Check whether the filter accepts a {@link VariableNode}. */ - public boolean accept(VariableNode var); + boolean accept(VariableNode var); } @@ -812,7 +748,7 @@ public class VariableInspector extends JDialog { * A {@link VariableNodeFilter} that accepts Processing built-in variable * names. */ - public class P5BuiltinsFilter implements VariableNodeFilter { + static public class P5BuiltinsFilter implements VariableNodeFilter { protected String[] p5Builtins = { "focused", @@ -842,7 +778,7 @@ public class VariableInspector extends JDialog { * A {@link VariableNodeFilter} that rejects implicit this references. * (Names starting with "this$") */ - public class ThisFilter implements VariableNodeFilter { + static public class ThisFilter implements VariableNodeFilter { @Override public boolean accept(VariableNode var) { @@ -858,7 +794,7 @@ public class VariableInspector extends JDialog { * A {@link VariableNodeFilter} that either rejects this-fields if hidden by * a local, or prefixes its name with "this." */ - public class LocalHidesThisFilter implements VariableNodeFilter { + static public class LocalHidesThisFilter implements VariableNodeFilter { // Reject a this-field if hidden by a local. public static final int MODE_HIDE = 0; // don't show hidden this fields diff --git a/java/theme/variables-1x.png b/java/theme/variables-1x.png deleted file mode 100644 index b20038b48fd7807477265fb1d2fc8b83d72ade28..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2408 zcmbVOc~BF17LKCCqZm+T1Vtc5XQOB?LJ|@aVkBJ3B?JWqNIFRa5ptNc5D?^WN0#!4 z3Kot*L>-111yKYML1bkW0R@8&mnDiUmkxwOE`zWg6=(ji=8x^F?%(yk_ulV)->d3$ zUvD>)Wowop5C{_wca9%CUV~rM5@YyVtR1z6ht-fvAmlF#hhhN*h+vCk0ubdP0U|&@ z5D>-fs{Q?F1sxh3rV6y3jZ-E*t{U6{dwckM)o$AwVhw=VOcE*q^a3e~YC%D?k8}DY!CO z^t=juBV~|G87Y&aoSi?ij@sx22*pyv<|YGCpYF{872+6BVkTTu~+#fLpOY_6)~kF&a{wJw&mmohj6h2dE%io zuWTKJiKdV$NE%#wg(jt|H)fL5^oZ2ND65z()CAvUdlK{fc5>teKenhNtuK`Fe+PnD zC5>^XFTd8IPmTxYB(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oZp{U9u>M)zU4jT z)i<(yN=mRWz@VRm9JyQaElNb{Xbc;Malj=(WG}69!ypIyg4eQlbE4@?pMrZMzhlnQ z)v>MwFs%Q!>8f&Aet^rrn9k+rO{u2k~xpj?4Tqb>qRFZr(e%zWSQ5 z0YSs4W-w;c?eTLgQ$n%x&+%;GIHTlM%#+lF~R^LM7``Tr1 znID%soaX{?uR`|clyi~Bj%a+Tb#waxL2A2fY0TG0$jDIuFtK!uq*4r3R(5^k)>CD| z_c7+vm~WhiOL#5QlX`Ha*8OV9N(6V}=jy5ot&$QIP55_((h_2>S;rH~pJbugJd-~k zZ4EKLj7QLA5eP)b+2?1ickwq|H{|K=e&%g+Rg7Qi;~axRQA|b**RppI-&BM^%>Uxw zA{k;tPSUFwjK;;s-!IzI z1?&lxoM8klKl+P(-4dp@+w60YKi@&4K@yChglUd?%!;SSG3pLX|U^gGFaz-U7y^% zkwwd*sp^mayx}}Um^sENmdB6Y?)HA0FwBFM_vtINo1k6y#m%I( zGN{;d`c9%(lF}mTrQG^{(>@l}qKIO?xz$tJGu8j&CPxwjNJTw;-?>XqyJkU^ZJs5i dbZ+rTa+Jn=b{!CKN!b2GWTbD3DLL&N{x53LxOo5o diff --git a/todo.txt b/todo.txt index 69eb610b9..da11fc1bb 100755 --- a/todo.txt +++ b/todo.txt @@ -72,6 +72,12 @@ X need to check on an actual Linux device, not a VM X this was caused by Nimbus interactions with FlatLaf X command key symbol missing in pop up menus X font for stack trace dialogs is too small (and wrong) +X overall layout/spacing/proportion +X icons for debug toolbar (VariableInspector.java) +X replace variables-1x and -2x with separate SVG files in debug +_ code completion icon updates (class, field, protected, method) +_ these go into CompletionPanel.java + design/selector X updated 4x4 for themes, foundation svg icon tweaks @@ -81,6 +87,8 @@ X add buttons for 'reload theme' and 'how to create themes' to theme fella X remove the 'reload theme' tool X both sets working, loading from folders X fixed up html wiring for styles +X gradients +X add a couple with gradients to the selector box? design/errors X errors table theme @@ -221,7 +229,7 @@ _ can't ship before ui.font and language bits sorted out _ otherwise the override to use Source Sans Pro will hose other languages _ using other JavaFX classes now that they're modules _ https://github.com/processing/processing4-javafx/issues/15 -_ update theme instructions andt +_ update theme instructions _ https://github.com/processing/processing4/wiki/Themes @@ -312,6 +320,7 @@ housekeeping _ replace bug numbers _ http://dev.processing.org/bugs/show_bug.cgi?id=1188 _ with http://processing.org/bugs/bugzilla/1188.html +_ or better yet, https://download.processing.org/bugzilla/1188.html _ also code.google.com URLs with Github URLs (numbers are sorta in sync) @@ -406,15 +415,6 @@ _ add rank for libraries/modes/tools (use unicode chars?) _ probably not sort by default to avoid confusion -design -X gradients -X add a couple with gradients to the selector box? -_ icons for debug toolbar -_ replace variables-1x and -2x with separate SVG files in debug -_ code completion icon updates (class, field, protected, method) -_ overall layout/spacing/proportion - - design/implementation _ updateTheme() in Theme Selector _ theme_selector.combo_box.enabled.bgcolor