@@ -66,24 +66,26 @@ public class EditorStatus extends BasicSplitPaneDivider {
6666 static public final int CURSOR_LINE_WARNING = 4 ;
6767 static public final int NOTICE = 0 ;
6868
69- static final int YES = 1 ;
70- static final int NO = 2 ;
69+ static final int YES = 1 ;
70+ static final int NO = 2 ;
7171 static final int CANCEL = 3 ;
72- static final int OK = 4 ;
72+ static final int OK = 4 ;
7373
7474 Editor editor ;
7575
7676 int mode ;
7777 String message = "" ;
7878
7979 String url ;
80+
8081 int rightEdge ;
8182 int mouseX ;
82- int rolloverState ;
83- static final int ROLLOVER_NONE = 0 ;
84- static final int ROLLOVER_URL = 1 ;
85- static final int ROLLOVER_COLLAPSE = 2 ;
83+
84+ static final int ROLLOVER_NONE = 0 ;
85+ static final int ROLLOVER_URL = 1 ;
86+ static final int ROLLOVER_COLLAPSE = 2 ;
8687 static final int ROLLOVER_CLIPBOARD = 3 ;
88+ int rolloverState ;
8789
8890 Font font ;
8991 FontMetrics metrics ;
@@ -94,6 +96,7 @@ public class EditorStatus extends BasicSplitPaneDivider {
9496 // other apps seem to use this one as a hack
9597 static final String CLIPBOARD_GLYPH = "\u2398 " ;
9698
99+ // https://en.wikipedia.org/wiki/Geometric_Shapes
97100// static final String COLLAPSE_GLYPH = "\u25B3"; // large up
98101// static final String EXPAND_GLYPH = "\u25BD"; // large down
99102// static final String COLLAPSE_GLYPH = "\u25B5"; // small up (unavailable)
@@ -108,6 +111,7 @@ public class EditorStatus extends BasicSplitPaneDivider {
108111
109112 Image offscreen ;
110113 int sizeW , sizeH ;
114+ // size of the glyph buttons (width and height are identical)
111115 int buttonSize ;
112116 boolean collapsed = false ;
113117
@@ -334,7 +338,7 @@ public void paint(Graphics screen) {
334338 if (offscreen == null ) {
335339 sizeW = size .width ;
336340 sizeH = size .height ;
337- // buttonSize = sizeH;
341+ buttonSize = sizeH ;
338342 offscreen = Toolkit .offscreenGraphics (this , sizeW , sizeH );
339343 }
340344
@@ -349,27 +353,25 @@ public void paint(Graphics screen) {
349353
350354 g .drawImage (bgImage [mode ], 0 , 0 , sizeW , sizeH , this );
351355
352- // What's the mouse over?
353- if (sizeW - sizeH < mouseX && mouseX < sizeW ) {
356+ rolloverState = ROLLOVER_NONE ;
357+ if (mouseX > sizeW - buttonSize && mouseX < sizeW ) {
354358 rolloverState = ROLLOVER_COLLAPSE ;
359+
355360 } else if (message != null && !message .isEmpty ()) {
356- if (sizeW - 2 *sizeH < mouseX ) {
361+ if (sizeW - 2 *buttonSize < mouseX ) {
357362 rolloverState = ROLLOVER_CLIPBOARD ;
363+
358364 } else if (url != null && mouseX > LEFT_MARGIN &&
359365 // calculate right edge of the text for rollovers (otherwise the pane
360366 // cannot be resized up or down whenever a URL is being displayed)
361367 mouseX < (LEFT_MARGIN + g .getFontMetrics ().stringWidth (message ))) {
362368 rolloverState = ROLLOVER_URL ;
363- } else {
364- rolloverState = ROLLOVER_NONE ;
365369 }
366- } else {
367- rolloverState = ROLLOVER_NONE ;
368370 }
369371
370372 // https://github.com/processing/processing/issues/3265
371373 if (message != null ) {
372- // needs to be set each time on osx
374+ // font needs to be set each time on osx
373375 g .setFont (font );
374376 // set the highlight color on rollover so that the user's not surprised
375377 // to see the web browser open when they click
@@ -381,7 +383,7 @@ public void paint(Graphics screen) {
381383 //int x = cancelButton.getX();
382384 //int w = cancelButton.getWidth();
383385 int w = Toolkit .getButtonWidth ();
384- int x = getWidth () - Math .max (RIGHT_MARGIN , (int )(sizeH *1.2 )) - w ;
386+ int x = getWidth () - Math .max (RIGHT_MARGIN , (int )(buttonSize *1.2 )) - w ;
385387 int y = sizeH / 3 ;
386388 int h = sizeH / 3 ;
387389 g .setColor (new Color (0x80000000 , true ));
@@ -405,25 +407,26 @@ public void paint(Graphics screen) {
405407 }
406408
407409
408- private final Color whitishTint = new Color (0x20eeeeee , true );
410+ // private final Color whitishTint = new Color(0x20eeeeee, true);
409411
410412 /**
411- * @param pos A zero-based index with 0 on the right.
413+ * @param pos A zero-based button index with 0 as the rightmost button
412414 */
413415 private void drawButton (Graphics g , String symbol , int pos , boolean highlight ) {
414- int left = sizeW - (pos + 1 ) * sizeH ;
416+ int left = sizeW - (pos + 1 ) * buttonSize ;
415417 // Overlap very long errors
416- g .drawImage (bgImage [mode ], left , 0 , sizeH , sizeH , this );
418+ g .drawImage (bgImage [mode ], left , 0 , buttonSize , sizeH , this );
417419
418420 if (highlight ) {
419- g .setColor (whitishTint );
420- g .fillRect (left , 0 , sizeH , sizeH );
421+ // disabling since this doesn't match any of our other UI
422+ // g.setColor(whitishTint);
423+ // g.fillRect(left, 0, sizeH, sizeH);
421424 g .setColor (urlColor );
422425 } else {
423426 g .setColor (fgColor [mode ]);
424427 }
425428 g .drawString (symbol ,
426- left + (sizeH - g .getFontMetrics ().stringWidth (symbol ))/2 ,
429+ left + (buttonSize - g .getFontMetrics ().stringWidth (symbol ))/2 ,
427430 (sizeH + ascent ) / 2 );
428431 }
429432
0 commit comments