diff --git a/app/src/processing/app/ui/EditorStatus.java b/app/src/processing/app/ui/EditorStatus.java index 93c625928..42b906ec8 100644 --- a/app/src/processing/app/ui/EditorStatus.java +++ b/app/src/processing/app/ui/EditorStatus.java @@ -32,9 +32,7 @@ import java.awt.FontMetrics; import java.awt.Graphics; import java.awt.datatransfer.Clipboard; import java.awt.datatransfer.StringSelection; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.event.MouseMotionListener; +import java.awt.event.*; import javax.swing.*; import javax.swing.plaf.basic.BasicSplitPaneDivider; @@ -88,10 +86,16 @@ public class EditorStatus extends BasicSplitPaneDivider { Color urlRolloverColor; Color urlPressedColor; + boolean shiftDown; + ImageIcon clipboardEnabledIcon; ImageIcon clipboardRolloverIcon; ImageIcon clipboardPressedIcon; + ImageIcon searchEnabledIcon; + ImageIcon searchRolloverIcon; + ImageIcon searchPressedIcon; + ImageIcon collapseEnabledIcon; ImageIcon collapseRolloverIcon; ImageIcon collapsePressedIcon; @@ -119,12 +123,12 @@ public class EditorStatus extends BasicSplitPaneDivider { @Override public void mouseEntered(MouseEvent e) { - updateMouse(e.getX(), false); + updateMouse(e, false); } @Override public void mousePressed(MouseEvent e) { - updateMouse(e.getX(), true); + updateMouse(e, true); } @Override @@ -149,12 +153,12 @@ public class EditorStatus extends BasicSplitPaneDivider { } else if (mouseState == COLLAPSE_PRESSED) { setCollapsed(!collapsed); } - updateMouse(e.getX(), false); // no longer pressed + updateMouse(e, false); // no longer pressed } @Override public void mouseExited(MouseEvent e) { - updateMouse(-100, false); + updateMouse(null, false); } }); @@ -166,12 +170,12 @@ public class EditorStatus extends BasicSplitPaneDivider { // or the button wouldn't work. setCollapsed(false); - updateMouse(e.getX(), true); + updateMouse(e, true); } @Override public void mouseMoved(MouseEvent e) { - updateMouse(e.getX(), false); + updateMouse(e, false); } }); } @@ -186,17 +190,24 @@ public class EditorStatus extends BasicSplitPaneDivider { } - void updateMouse(int mouseX, boolean pressed) { + void updateMouse(MouseEvent e, boolean pressed) { mouseState = NONE; - if (mouseX > sizeW - buttonEach && mouseX < sizeW) { - mouseState = pressed ? COLLAPSE_PRESSED : COLLAPSE_ROLLOVER; + shiftDown = false; - } else if (message != null && !message.isEmpty()) { - if (sizeW - 2* buttonEach < mouseX) { - mouseState = pressed ? CLIPBOARD_PRESSED : CLIPBOARD_ROLLOVER; + if (e != null) { + int mouseX = e.getX(); + shiftDown = e.isShiftDown(); - } else if (url != null && mouseX > LEFT_MARGIN && mouseX < messageRight) { - mouseState = pressed ? URL_PRESSED : URL_ROLLOVER; + if (mouseX > sizeW - buttonEach && mouseX < sizeW) { + mouseState = pressed ? COLLAPSE_PRESSED : COLLAPSE_ROLLOVER; + + } else if (message != null && !message.isEmpty()) { + if (sizeW - 2 * buttonEach < mouseX) { + mouseState = pressed ? CLIPBOARD_PRESSED : CLIPBOARD_ROLLOVER; + + } else if (url != null && mouseX > LEFT_MARGIN && mouseX < messageRight) { + mouseState = pressed ? URL_PRESSED : URL_ROLLOVER; + } } } @@ -238,6 +249,11 @@ public class EditorStatus extends BasicSplitPaneDivider { clipboardRolloverIcon = Toolkit.renderIcon("status/copy-to-clipboard", buttonRolloverColor, ICON_SIZE); clipboardPressedIcon = Toolkit.renderIcon("status/copy-to-clipboard", buttonPressedColor, ICON_SIZE); + // just borrowing the search icon from the manager + searchEnabledIcon = Toolkit.renderIcon("manager/search", buttonEnabledColor, ICON_SIZE); + searchRolloverIcon = Toolkit.renderIcon("manager/search", buttonRolloverColor, ICON_SIZE); + searchPressedIcon = Toolkit.renderIcon("manager/search", buttonPressedColor, ICON_SIZE); + collapseEnabledIcon = Toolkit.renderIcon("status/console-collapse", buttonEnabledColor, ICON_SIZE); collapseRolloverIcon = Toolkit.renderIcon("status/console-collapse", buttonRolloverColor, ICON_SIZE); collapsePressedIcon = Toolkit.renderIcon("status/console-collapse", buttonPressedColor, ICON_SIZE); @@ -371,11 +387,23 @@ public class EditorStatus extends BasicSplitPaneDivider { } } else if (message != null && !message.isEmpty()) { - ImageIcon glyph = clipboardEnabledIcon; - if (mouseState == CLIPBOARD_ROLLOVER) { - glyph = clipboardRolloverIcon; - } else if (mouseState == CLIPBOARD_PRESSED) { - glyph = clipboardPressedIcon; + ImageIcon glyph; + if (shiftDown) { + if (mouseState == CLIPBOARD_ROLLOVER) { + glyph = searchRolloverIcon; + } else if (mouseState == CLIPBOARD_PRESSED) { + glyph = searchPressedIcon; + } else { + glyph = searchEnabledIcon; + } + } else { + if (mouseState == CLIPBOARD_ROLLOVER) { + glyph = clipboardRolloverIcon; + } else if (mouseState == CLIPBOARD_PRESSED) { + glyph = clipboardPressedIcon; + } else { + glyph = clipboardEnabledIcon; + } } drawButton(g, glyph, 1); g.setFont(font); diff --git a/todo.txt b/todo.txt index 6a85124b0..b321a27b1 100755 --- a/todo.txt +++ b/todo.txt @@ -319,8 +319,9 @@ _ 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) -_ sort out hover/press states here (only hovers atm) _ naming options? _ remove underscore and use half space for tabs? _ reset the theme because of significant changes