Skip to content

Commit d80943f

Browse files
committed
incorporate svg versions of completion icons
1 parent 984b536 commit d80943f

10 files changed

Lines changed: 29 additions & 12 deletions

java/src/processing/mode/java/CompletionPanel.java

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,13 @@
4343
import processing.app.Messages;
4444
import processing.app.Mode;
4545
import processing.app.syntax.JEditTextArea;
46+
import processing.app.ui.Theme;
4647
import processing.app.ui.Toolkit;
4748

4849

4950
public class CompletionPanel {
5051
static final int MAX_HEIGHT = 300;
52+
static final int ICON_SIZE = 16;
5153

5254
/** The completion list generated by ASTGenerator */
5355
final private JList<CompletionCandidate> completionList;
@@ -72,7 +74,7 @@ public class CompletionPanel {
7274
static public ImageIcon classIcon;
7375
static public ImageIcon fieldIcon;
7476
static public ImageIcon methodIcon;
75-
static public ImageIcon localVarIcon;
77+
static public ImageIcon localIcon;
7678

7779
static Color selectionBgColor;
7880
static Color textColor;
@@ -98,12 +100,17 @@ public CompletionPanel(JavaEditor editor, int caret, String subWord,
98100

99101
if (classIcon == null) {
100102
Mode mode = editor.getMode();
101-
102103
File dir = new File(mode.getFolder(), "theme/completion");
103-
classIcon = Toolkit.getIconX(dir, "class_obj");
104-
methodIcon = Toolkit.getIconX(dir, "methpub_obj");
105-
fieldIcon = Toolkit.getIconX(dir, "field_protected_obj");
106-
localVarIcon = Toolkit.getIconX(dir, "field_default_obj");
104+
105+
classIcon = renderIcon(dir, "class");
106+
fieldIcon = renderIcon(dir, "field");
107+
localIcon = renderIcon(dir, "local");
108+
methodIcon = renderIcon(dir, "method");
109+
110+
// String classHex = Theme.get("editor.completion.class.color");
111+
// classIcon = Toolkit.renderIcon(new File(dir, "class.svg"), classHex, ICON_SIZE);
112+
// String fieldHex = Theme.get("editor.completion.field.color");
113+
// classIcon = Toolkit.renderIcon(new File(dir, "class.svg"), classHex, ICON_SIZE);
107114

108115
selectionBgColor = new Color(0xffF0F0F0);
109116
textColor = new Color(0xff222222);
@@ -151,6 +158,12 @@ public void mouseClicked(MouseEvent e) {
151158
}
152159

153160

161+
static private ImageIcon renderIcon(File dir, String word) {
162+
String hexColor = Theme.get("editor.completion." + word + ".color");
163+
return Toolkit.renderIcon(new File(dir, word + ".svg"), hexColor, ICON_SIZE);
164+
}
165+
166+
154167
public boolean isVisible() {
155168
return popupMenu.isVisible();
156169
}
@@ -369,7 +382,7 @@ public Component getListCellRendererComponent(JList<?> list, Object value,
369382
CompletionCandidate cc = (CompletionCandidate) value;
370383
switch (cc.getType()) {
371384
case CompletionCandidate.LOCAL_VAR:
372-
label.setIcon(localVarIcon);
385+
label.setIcon(localIcon);
373386
break;
374387
case CompletionCandidate.LOCAL_FIELD:
375388
case CompletionCandidate.PREDEF_FIELD:
-1.19 KB
Binary file not shown.
-1.38 KB
Binary file not shown.
-1.11 KB
Binary file not shown.
-1.22 KB
Binary file not shown.
-1.11 KB
Binary file not shown.
-1.19 KB
Binary file not shown.
-1.17 KB
Binary file not shown.
-1.38 KB
Binary file not shown.

todo.txt

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -365,20 +365,24 @@ _ https://github.com/processing/processing4-javafx/issues/15
365365

366366

367367
fixes/changes before beta 9
368-
_ code completion icon updates (class, field, protected, method)
369-
_ these go into CompletionPanel.java
368+
_ thicker version of the search icon for the status panel
369+
_ copy the icon over from the manager
370+
X code completion icon updates (class, field, protected, method)
371+
X these go into CompletionPanel.java
370372
_ also set the color and font with updateTheme()
373+
_ waiting on final colors from theme
371374
_ reset the theme because of significant changes
372375
_ move away from writing theme.txt?
373376
_ instead store the theme name, for easier updating
374377
_ and a version in the sketchbook will always override
375378
_ (selecting a new theme will rename that file, but not replace a theme.txt file)
376379
_ check on text width calculation in the code completion popup
377-
_ also, applyMatrix() sometimes ... and sometimes not
380+
_ applyMatrix() sometimes ... and sometimes not
378381
_ change array() -> toArray() in the list classes
379-
_ thicker version of the search icon for the status panel
380-
_ copy the icon over from the manager
381382
_ get shift down from the editor window and pass to status
383+
_ changing between themes not updating the combo box text (though arrow trigger works)
384+
_ switching between alloys and minerals will properly update
385+
_ completion mode pop-up not following dark and light mode conventions
382386

383387

384388
during release of beta 9

0 commit comments

Comments
 (0)