alpha for urls in the status bar

This commit is contained in:
Ben Fry
2022-08-03 15:29:14 -04:00
parent e468e80b30
commit 23b9cb1897
3 changed files with 75 additions and 64 deletions

View File

@@ -85,9 +85,6 @@ public class EditorStatus extends BasicSplitPaneDivider {
FontMetrics metrics;
int ascent;
Color urlRolloverColor;
Color urlPressedColor;
boolean shiftDown;
/*
@@ -113,9 +110,13 @@ public class EditorStatus extends BasicSplitPaneDivider {
ImageIcon[] collapseIcon;
ImageIcon[] expandIcon;
float enabledAlpha;
float rolloverAlpha;
float pressedAlpha;
float btnEnabledAlpha;
float btnRolloverAlpha;
float btnPressedAlpha;
int urlEnabledAlpha;
int urlRolloverAlpha;
int urlPressedAlpha;
int sizeW, sizeH;
// size of the glyph buttons (width and height are identical)
@@ -251,8 +252,9 @@ public class EditorStatus extends BasicSplitPaneDivider {
protected void updateTheme() {
urlRolloverColor = Theme.getColor("status.url.rollover.color");
urlPressedColor = Theme.getColor("status.url.pressed.color");
urlEnabledAlpha = 255 * Theme.getInteger("status.url.enabled.alpha") / 100;
urlRolloverAlpha = 255 * Theme.getInteger("status.url.rollover.alpha") / 100;
urlPressedAlpha = 255 * Theme.getInteger("status.url.pressed.alpha") / 100;
// status.button.enabled.color = #FFFF00
// status.button.rollover.color = #FF00FF
@@ -275,9 +277,9 @@ public class EditorStatus extends BasicSplitPaneDivider {
collapseIcon = renderIcons("status/console-collapse", stateColors);
expandIcon = renderIcons("status/console-expand", stateColors);
enabledAlpha = Theme.getInteger("status.button.enabled.alpha") / 100f;
rolloverAlpha = Theme.getInteger("status.button.rollover.alpha") / 100f;
pressedAlpha = Theme.getInteger("status.button.pressed.alpha") / 100f;
btnEnabledAlpha = Theme.getInteger("status.button.enabled.alpha") / 100f;
btnRolloverAlpha = Theme.getInteger("status.button.rollover.alpha") / 100f;
btnPressedAlpha = Theme.getInteger("status.button.pressed.alpha") / 100f;
/*
clipboardEnabledIcon = Toolkit.renderIcon("status/copy-to-clipboard", buttonEnabledColor, ICON_SIZE);
@@ -403,19 +405,27 @@ public class EditorStatus extends BasicSplitPaneDivider {
if (message != null) {
// font needs to be set each time on osx
g.setFont(font);
// set the highlight color on rollover so that the user's not surprised
// to see the web browser open when they click
if (mouseState == URL_ROLLOVER) {
g.setColor(urlRolloverColor);
} else if (mouseState == URL_PRESSED) {
g.setColor(urlPressedColor);
} else {
g.setColor(fgColor[mode]);
}
// calculate right edge of the text for rollovers (otherwise the pane
// cannot be resized up or down whenever a URL is being displayed)
messageRight += g.getFontMetrics().stringWidth(message);
// set the highlight color on rollover so that the user is
// not surprised to see the web browser open when they click
int alpha = 255;
if (url != null) {
if (mouseState == URL_ROLLOVER) {
alpha = urlRolloverAlpha;
} else if (mouseState == URL_PRESSED) {
alpha = urlPressedAlpha;
} else {
alpha = urlEnabledAlpha;
}
}
if (alpha == 255) {
g.setColor(fgColor[mode]);
} else {
g.setColor(new Color((alpha << 24) | (fgColor[mode].getRGB() & 0xFFFFFF), true));
}
g.drawString(message, LEFT_MARGIN, (sizeH / 2) + (ascent / 4) + 1);
}
@@ -438,25 +448,25 @@ public class EditorStatus extends BasicSplitPaneDivider {
glyph = searchIcon[mode];
if (mouseState == CLIPBOARD_ROLLOVER) {
//glyph = searchRolloverIcon;
alpha = rolloverAlpha;
alpha = btnRolloverAlpha;
} else if (mouseState == CLIPBOARD_PRESSED) {
//glyph = searchPressedIcon;
alpha = pressedAlpha;
alpha = btnPressedAlpha;
} else {
//glyph = searchEnabledIcon;
alpha = enabledAlpha;
alpha = btnEnabledAlpha;
}
} else {
glyph = clipboardIcon[mode];
if (mouseState == CLIPBOARD_ROLLOVER) {
//glyph = clipboardRolloverIcon;
alpha = rolloverAlpha;
alpha = btnRolloverAlpha;
} else if (mouseState == CLIPBOARD_PRESSED) {
//glyph = clipboardPressedIcon;
alpha = pressedAlpha;
alpha = btnPressedAlpha;
} else {
//glyph = clipboardEnabledIcon;
alpha = enabledAlpha;
alpha = btnEnabledAlpha;
}
}
drawButton(g, 1, glyph, alpha);
@@ -470,25 +480,25 @@ public class EditorStatus extends BasicSplitPaneDivider {
glyph = expandIcon[mode];
if (mouseState == COLLAPSE_ROLLOVER) {
//glyph = expandRolloverIcon;
alpha = rolloverAlpha;
alpha = btnRolloverAlpha;
} else if (mouseState == COLLAPSE_PRESSED) {
//glyph = expandPressedIcon;
alpha = pressedAlpha;
alpha = btnPressedAlpha;
} else {
//glyph = expandEnabledIcon;
alpha = enabledAlpha;
alpha = btnEnabledAlpha;
}
} else {
glyph = collapseIcon[mode];
if (mouseState == COLLAPSE_ROLLOVER) {
//glyph = collapseRolloverIcon;
alpha = rolloverAlpha;
alpha = btnRolloverAlpha;
} else if (mouseState == COLLAPSE_PRESSED) {
//glyph = collapsePressedIcon;
alpha = pressedAlpha;
alpha = btnPressedAlpha;
} else {
//glyph = collapseEnabledIcon;
alpha = enabledAlpha;
alpha = btnEnabledAlpha;
}
}
drawButton(g, 0, glyph, alpha);

View File

@@ -73,13 +73,10 @@ status.error.bgcolor = #BF0019
status.warning.bgcolor = #003775
status.warning.fgcolor = #00DFFF
# if the status is a url, the entire status text changes to this color
status.url.rollover.color = #00D4FF
status.url.pressed.color = #00FFFF
#status.button.enabled.color = #FFFF00
#status.button.rollover.color = #FF00FF
#status.button.pressed.color = #0000FF
# applies to the entire status text if it contains url
status.url.enabled.alpha = 70
status.url.rollover.alpha = 90
status.url.pressed.alpha = 100
status.button.enabled.alpha = 50
status.button.rollover.alpha = 70

View File

@@ -81,6 +81,20 @@ X move all (formerly Lucida) dialog formatting into Messages
X currently a couple other classes that use it
/ create a version that works nicely with FlatLaf
X implemented in one place; still needs to just be redone
X two tier dialog box (defaulting back to Lucida)
X font for stack trace dialogs is too small (and wrong)
X dialog box with stack trace (font is too small)
X actually fix the stack trace dialog with 12pt font size change
X text gutter doesn't seem to be hidpi
X or is it b/c screen not quite 2x? (nope)
X try to tweak the line numbers in the gutter a bit
X finally found the problem: Source Code Pro not hinting below 12pt (!?#$@(*)
X change to 12pt, add alpha params to theme.txt
X editor.gutter.linehighlight.color -> editor.gutter.highlight.color
X # transparency (0..100) for line numbers in gutter
X editor.gutter.text.active.alpha = 70
X # transparency for lines not currently in use
X editor.gutter.text.inactive.alpha = 30
export application
X fix Export to Application on macOS with Apple Silicon
@@ -148,7 +162,6 @@ X menu crustiness, console background color not getting set, others?
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
@@ -159,14 +172,6 @@ X weirdness with gaps in tabs (editor too big, manager too small)
X contrib mgr: filter/dropdown vertical centering is too high
/ fake bold being used for tab name? (Windows only?)
X should be resolved with both fonts now being installed
X two tier dialog box (defaulting back to Lucida)
X dialog box with stack trace (font is too small)
X actually fix the stack trace dialog with 12pt font size change
X text gutter doesn't seem to be hidpi
X or is it b/c screen not quite 2x? (nope)
X try to tweak the line numbers in the gutter a bit
X finally found the problem: Source Code Pro not hinting below 12pt (!?#$@(*)
X change to 12pt, add alpha params to theme.txt
design/selector
X updated 4x4 for themes, foundation svg icon tweaks
@@ -267,9 +272,6 @@ X only really need for the bold font
X improved 'close' icon (thicker x)
X better 'search' icon (search.svg with a less enormous eyeglass)
X replace foundation-16, foundation-32, foundation-64 in lib/icons
X icons in the status bar (using emojis at the moment, now out of place)
X console collapse/expand button
X copy to clipboard button
X contribs exclamation looks like an error, not "update available"
X clean up the updates panel in the manager
X fix column widths in 'updates' tab of contrib manager
@@ -301,6 +303,18 @@ X https://github.com/processing/processing4/pull/481
X Update PDE_de.properties
X https://github.com/processing/processing4/pull/483
status
X replace emoji buttons in status bar
X re-save svg files using svg 1.0
X sort out hover/press states here (only hovers atm)
X also add state for shift-click to search
X theme colors for emoji buttons (new themes across the board)
X icons in the status bar (using emojis at the moment, now out of place)
X console collapse/expand button
X copy to clipboard button
X implement alpha for url (70, 90, 100)
X remove the color
cleaning
o should default to the local Java on Windows and Linux
o have export apps default to the local JRE
@@ -351,11 +365,6 @@ _ https://github.com/processing/processing4-javafx/issues/15
fixes/changes before beta 9
X replace emoji buttons in status bar
X re-save svg files using svg 1.0
X sort out hover/press states here (only hovers atm)
X also add state for shift-click to search
_ theme colors for emoji buttons (new themes across the board)
_ code completion icon updates (class, field, protected, method)
_ these go into CompletionPanel.java
_ also set the color and font with updateTheme()
@@ -367,14 +376,9 @@ _ (selecting a new theme will rename that file, but not replace a theme.txt
_ check on text width calculation in the code completion popup
_ also, applyMatrix() sometimes ... and sometimes not
_ change array() -> toArray() in the list classes
_ implement alpha for url (70, 90, 100)
_ remove the color
editor.gutter.linehighlight.color -> editor.gutter.highlight.color
# transparency (0..100) for line numbers in gutter
editor.gutter.text.active.alpha = 70
# transparency for lines not currently in use
editor.gutter.text.inactive.alpha = 30
_ thicker version of the search icon for the status panel
_ copy the icon over from the manager
_ get shift down from the editor window and pass to status
during release of beta 9