From 9574246038234d171e71f92e60a43fce84fac3bc Mon Sep 17 00:00:00 2001 From: Ben Fry Date: Tue, 29 Sep 2015 23:13:43 -0400 Subject: [PATCH] fix font/colors in completion dialog (#3906) --- .../mode/java/pdex/CompletionPanel.java | 18 +++++++++++++++++- todo.txt | 8 ++++++-- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/java/src/processing/mode/java/pdex/CompletionPanel.java b/java/src/processing/mode/java/pdex/CompletionPanel.java index 138d18a50..736d8851b 100644 --- a/java/src/processing/mode/java/pdex/CompletionPanel.java +++ b/java/src/processing/mode/java/pdex/CompletionPanel.java @@ -21,6 +21,7 @@ along with this program; if not, write to the Free Software Foundation, Inc. package processing.mode.java.pdex; import java.awt.BorderLayout; +import java.awt.Color; import java.awt.Component; import java.awt.Font; import java.awt.FontMetrics; @@ -40,6 +41,7 @@ import javax.swing.text.BadLocationException; import processing.app.Base; import processing.app.Messages; +import processing.app.Mode; import processing.app.syntax.JEditTextArea; import processing.app.ui.Toolkit; import processing.mode.java.JavaEditor; @@ -84,6 +86,9 @@ public class CompletionPanel { static public ImageIcon methodIcon; static public ImageIcon localVarIcon; + static Color selectionBgColor; + static Color textColor; + /** * Triggers the completion popup @@ -108,11 +113,17 @@ public class CompletionPanel { } if (classIcon == null) { - File dir = new File(editor.getMode().getFolder(), "theme/completion"); + 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"); + + //selectionBgColor = mode.getColor(""); // no theme.txt for Java Mode + selectionBgColor = new Color(0xffF0F0F0); + textColor = new Color(0xff222222); } popupMenu = new JPopupMenu(); @@ -560,6 +571,11 @@ public class CompletionPanel { index, isSelected, cellHasFocus); + if (isSelected) { + label.setBackground(selectionBgColor); + } + label.setForeground(textColor); + if (value instanceof CompletionCandidate) { CompletionCandidate cc = (CompletionCandidate) value; switch (cc.getType()) { diff --git a/todo.txt b/todo.txt index a7133ffa6..6846ae85c 100644 --- a/todo.txt +++ b/todo.txt @@ -89,12 +89,16 @@ _ mouse events (i.e. toggle breakpoint) seem to be firing twice 3.0 final _ https://github.com/processing/processing/milestones/3.0%20final +_ completion panel +_ what should the background color be? +_ test fg/bg color on other operating systems +_ fix icon sizes/design _ fix the design of the completions window X remove extra border around the outside -_ change font +X change font +X add 2x version of the icons _ change selection highlight color _ put some margin around it -X add 2x version of the icons _ https://github.com/processing/processing/issues/3906 _ import suggestions box needs design review _ https://github.com/processing/processing/issues/3407