Skip to content

Commit 92bbfb6

Browse files
committed
more with tweaking the gui
1 parent 5d0470e commit 92bbfb6

File tree

3 files changed

+46
-31
lines changed

3 files changed

+46
-31
lines changed

app/src/processing/app/EditorHeader.java

Lines changed: 36 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -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

app/src/processing/app/EditorToolbar.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public abstract class EditorToolbar extends JComponent implements MouseInputList
3939
/** Width of each toolbar button. */
4040
static final int BUTTON_WIDTH = 27;
4141
/** Height of each toolbar button. */
42-
static final int BUTTON_HEIGHT = 32;
42+
// static final int BUTTON_HEIGHT = 32;
4343
/** The amount of space between groups of buttons on the toolbar. */
4444
static final int BUTTON_GAP = 5;
4545
/** Size (both width and height) of the buttons in the source image. */
@@ -149,7 +149,7 @@ public Image[][] loadImages() {
149149

150150
for (int i = 0; i < count; i++) {
151151
for (int state = 0; state < 3; state++) {
152-
Image image = new BufferedImage(BUTTON_WIDTH*res, BUTTON_HEIGHT*res, BufferedImage.TYPE_INT_ARGB);
152+
Image image = new BufferedImage(BUTTON_WIDTH*res, Preferences.GRID_SIZE*res, BufferedImage.TYPE_INT_ARGB);
153153
Graphics g = image.getGraphics();
154154
g.drawImage(allButtons,
155155
-(i*BUTTON_IMAGE_SIZE*res) - 3,
@@ -223,7 +223,7 @@ public void paintComponent(Graphics screen) {
223223
// g.drawImage(stateImage[i], x1[i], y1, null);
224224
// }
225225
for (Button b : buttons) {
226-
g.drawImage(b.stateImage, b.left, 0, BUTTON_WIDTH, BUTTON_HEIGHT, null);
226+
g.drawImage(b.stateImage, b.left, 0, BUTTON_WIDTH, Preferences.GRID_SIZE, null);
227227
}
228228

229229
g.setColor(statusColor);
@@ -242,7 +242,7 @@ public void paintComponent(Graphics screen) {
242242
// if (currentRollover != -1) {
243243
if (rollover != null) {
244244
//int statusY = (BUTTON_HEIGHT + g.getFontMetrics().getAscent()) / 2;
245-
int statusY = (BUTTON_HEIGHT + statusAscent) / 2;
245+
int statusY = (Preferences.GRID_SIZE + statusAscent) / 2;
246246
//String status = shiftPressed ? titleShift[currentRollover] : title[currentRollover];
247247
String status = shiftPressed ? rollover.titleShift : rollover.title;
248248
g.drawString(status, buttons.size() * BUTTON_WIDTH + 3 * BUTTON_GAP, statusY);
@@ -503,12 +503,12 @@ public Dimension getPreferredSize() {
503503

504504

505505
public Dimension getMinimumSize() {
506-
return new Dimension((buttons.size() + 1)*BUTTON_WIDTH, BUTTON_HEIGHT);
506+
return new Dimension((buttons.size() + 1)*BUTTON_WIDTH, Preferences.GRID_SIZE);
507507
}
508508

509509

510510
public Dimension getMaximumSize() {
511-
return new Dimension(3000, BUTTON_HEIGHT);
511+
return new Dimension(3000, Preferences.GRID_SIZE);
512512
}
513513

514514

app/src/processing/app/Preferences.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,10 @@ public class Preferences {
8989
* inside a static block.
9090
*/
9191
static public int BUTTON_HEIGHT = 24;
92-
93-
// value for the size bars, buttons, etc
94-
95-
static final int GRID_SIZE = 33;
96-
92+
93+
/** height of the EditorHeader, EditorToolbar, and EditorStatus */
94+
static final int GRID_SIZE = 32;
95+
//static final int GRID_SIZE = 33;
9796

9897
// indents and spacing standards. these probably need to be modified
9998
// per platform as well, since macosx is so huge, windows is smaller,

0 commit comments

Comments
 (0)