incorporate svg versions of completion icons

This commit is contained in:
Ben Fry
2022-08-03 18:24:46 -04:00
parent 984b5368e1
commit d80943f386
10 changed files with 29 additions and 12 deletions

View File

@@ -43,11 +43,13 @@ import processing.app.Base;
import processing.app.Messages;
import processing.app.Mode;
import processing.app.syntax.JEditTextArea;
import processing.app.ui.Theme;
import processing.app.ui.Toolkit;
public class CompletionPanel {
static final int MAX_HEIGHT = 300;
static final int ICON_SIZE = 16;
/** The completion list generated by ASTGenerator */
final private JList<CompletionCandidate> completionList;
@@ -72,7 +74,7 @@ public class CompletionPanel {
static public ImageIcon classIcon;
static public ImageIcon fieldIcon;
static public ImageIcon methodIcon;
static public ImageIcon localVarIcon;
static public ImageIcon localIcon;
static Color selectionBgColor;
static Color textColor;
@@ -98,12 +100,17 @@ public class CompletionPanel {
if (classIcon == null) {
Mode mode = editor.getMode();
File dir = new File(mode.getFolder(), "theme/completion");
classIcon = Toolkit.getIconX(dir, "class_obj");
methodIcon = Toolkit.getIconX(dir, "methpub_obj");
fieldIcon = Toolkit.getIconX(dir, "field_protected_obj");
localVarIcon = Toolkit.getIconX(dir, "field_default_obj");
classIcon = renderIcon(dir, "class");
fieldIcon = renderIcon(dir, "field");
localIcon = renderIcon(dir, "local");
methodIcon = renderIcon(dir, "method");
// String classHex = Theme.get("editor.completion.class.color");
// classIcon = Toolkit.renderIcon(new File(dir, "class.svg"), classHex, ICON_SIZE);
// String fieldHex = Theme.get("editor.completion.field.color");
// classIcon = Toolkit.renderIcon(new File(dir, "class.svg"), classHex, ICON_SIZE);
selectionBgColor = new Color(0xffF0F0F0);
textColor = new Color(0xff222222);
@@ -151,6 +158,12 @@ public class CompletionPanel {
}
static private ImageIcon renderIcon(File dir, String word) {
String hexColor = Theme.get("editor.completion." + word + ".color");
return Toolkit.renderIcon(new File(dir, word + ".svg"), hexColor, ICON_SIZE);
}
public boolean isVisible() {
return popupMenu.isVisible();
}
@@ -369,7 +382,7 @@ public class CompletionPanel {
CompletionCandidate cc = (CompletionCandidate) value;
switch (cc.getType()) {
case CompletionCandidate.LOCAL_VAR:
label.setIcon(localVarIcon);
label.setIcon(localIcon);
break;
case CompletionCandidate.LOCAL_FIELD:
case CompletionCandidate.PREDEF_FIELD:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB