@@ -42,18 +42,21 @@ public class EditorHeader extends JComponent {
4242 // distance from the righthand side of a tab to the drop-down arrow
4343 static final int ARROW_GAP_WIDTH = 8 ;
4444 // indent x/y for notch on the tab
45- static final int NOTCH = 4 ;
45+ static final int NOTCH = 0 ;
4646 // how far to raise the tab from the bottom of this Component
47- static final int TAB_HEIGHT = 27 ;
47+ static final int TAB_HEIGHT = 25 ;
48+ // line that continues across all of the tabs for the current one
49+ static final int TAB_STRETCH = 3 ;
4850 // amount of margin on the left/right for the text on the tab
49- static final int TEXT_MARGIN = 5 ;
51+ static final int TEXT_MARGIN = 10 ;
5052 // width of the tab when no text visible
5153 // (total tab width will be this plus TEXT_MARGIN*2)
5254 static final int NO_TEXT_WIDTH = 10 ;
5355
5456 Color backgroundColor ;
5557 Color textColor [] = new Color [2 ];
5658 Color tabColor [] = new Color [2 ];
59+ Color modifiedColor ;
5760
5861 Editor editor ;
5962
@@ -196,6 +199,8 @@ public void updateMode() {
196199
197200 tabColor [SELECTED ] = mode .getColor ("header.tab.selected.color" );
198201 tabColor [UNSELECTED ] = mode .getColor ("header.tab.unselected.color" );
202+
203+ modifiedColor = mode .getColor ("editor.selection.color" );
199204 }
200205
201206
@@ -262,7 +267,8 @@ public void paintComponent(Graphics screen) {
262267// EditorToolbar.BACKGROUND_WIDTH,
263268// EditorToolbar.BACKGROUND_HEIGHT, null);
264269// }
265- editor .getMode ().drawBackground (g , EditorToolbar .BUTTON_HEIGHT );
270+ //editor.getMode().drawBackground(g, EditorToolbar.BUTTON_HEIGHT);
271+ editor .getMode ().drawBackground (g , Preferences .GRID_SIZE );
266272
267273// int codeCount = sketch.getCodeCount();
268274// if ((tabLeft == null) || (tabLeft.length < codeCount)) {
@@ -292,10 +298,12 @@ public void paintComponent(Graphics screen) {
292298
293299 // hide extensions for .pde files (or whatever else is the norm elsewhere
294300 boolean hide = editor .getMode ().hideExtension (code .getExtension ());
295- String codeName = hide ? code .getPrettyName () : code .getFileName ();
301+ // String codeName = hide ? code.getPrettyName() : code.getFileName();
296302 // if modified, add the li'l glyph next to the name
297- tab .text = " " + codeName + (code .isModified () ? " \u00A7 " : " " );
298-
303+ // tab.text = " " + codeName + (code.isModified() ? " \u00A7" : " ");
304+ // tab.text = " " + codeName + " ";
305+ tab .text = hide ? code .getPrettyName () : code .getFileName ();
306+
299307 tab .textWidth = (int )
300308 font .getStringBounds (tab .text , g2 .getFontRenderContext ()).getWidth ();
301309 }
@@ -345,9 +353,14 @@ private boolean placeTabs(int left, int right, Graphics2D g) {
345353 Sketch sketch = editor .getSketch ();
346354 int x = left ;
347355
348- final int bottom = getHeight ();
356+ final int bottom = getHeight () - TAB_STRETCH ;
349357 final int top = bottom - TAB_HEIGHT ;
350358 GeneralPath path = null ;
359+
360+ if (g != null ) {
361+ g .setColor (tabColor [SELECTED ]);
362+ g .fillRect (0 , bottom , getWidth (), TAB_STRETCH );
363+ }
351364
352365 for (int i = 0 ; i < sketch .getCodeCount (); i ++) {
353366 SketchCode code = sketch .getCode (i );
@@ -393,11 +406,8 @@ private boolean placeTabs(int left, int right, Graphics2D g) {
393406 g .setColor (tabColor [state ]);
394407 g .fill (path );
395408 //g.drawImage(pieces[state][RIGHT], x, 0, PIECE_WIDTH, PIECE_HEIGHT, null);
396- }
397409
398- if (tab .textVisible ) {
399- // int textLeft = contentLeft + (pieceWidth - tab.textWidth) / 2;
400- if (g != null ) {
410+ if (tab .textVisible ) {
401411 int textLeft = tab .left + ((tab .right - tab .left ) - tab .textWidth ) / 2 ;
402412 g .setColor (textColor [state ]);
403413// int baseline = (int) Math.ceil((sizeH + fontAscent) / 2.0);
@@ -409,13 +419,19 @@ private boolean placeTabs(int left, int right, Graphics2D g) {
409419// g.drawLine(tab.left, baseline-fontAscent, tab.right, baseline-fontAscent);
410420// g.drawLine(tab.left, baseline, tab.right, baseline);
411421 }
422+
423+ if (code .isModified ()) {
424+ g .setColor (modifiedColor );
425+ g .drawLine (tab .left + NOTCH , top , tab .right - NOTCH , top );
426+ }
412427 }
413428
414429// if (g != null) {
415430// g.drawImage(pieces[state][RIGHT], x, 0, PIECE_WIDTH, PIECE_HEIGHT, null);
416431// }
417432// x += PIECE_WIDTH - 1; // overlap by 1 pixel
418433 x += 1 ;
434+
419435 }
420436 return x <= right ;
421437 }
@@ -590,18 +606,18 @@ public Dimension getPreferredSize() {
590606
591607
592608 public Dimension getMinimumSize () {
593- if (Base .isMacOS ()) {
594- return new Dimension (300 , Preferences .GRID_SIZE );
595- }
596- return new Dimension (300 , Preferences .GRID_SIZE - 1 );
609+ // if (Base.isMacOS()) {
610+ return new Dimension (300 , Preferences .GRID_SIZE );
611+ // }
612+ // return new Dimension(300, Preferences.GRID_SIZE - 1);
597613 }
598614
599615
600616 public Dimension getMaximumSize () {
601- if (Base .isMacOS ()) {
602- return new Dimension (3000 , Preferences .GRID_SIZE );
603- }
604- return new Dimension (3000 , Preferences .GRID_SIZE - 1 );
617+ // if (Base.isMacOS()) {
618+ return new Dimension (3000 , Preferences .GRID_SIZE );
619+ // }
620+ // return new Dimension(3000, Preferences.GRID_SIZE - 1);
605621 }
606622
607623
0 commit comments