FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

resolve 2px line at top of editor, clean up old EditorHeader code · processing/processing4@a3ea311 · GitHub

Repository navigation

Commit a3ea311

Browse files
committed
resolve 2px line at top of editor, clean up old EditorHeader code
1 parent f11b210 commit a3ea311

2 files changed

Lines changed: 10 additions & 73 deletions

File tree

‎app/src/processing/app/ui/EditorHeader.java‎

Lines changed: 9 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -254,16 +254,18 @@ public void paintComponent(Graphics screen) {
254254
menuRight = menuLeft + ARROW_TAB_WIDTH;
255255
}
256256

257+
/*
257258
// draw the two pixel line that extends left/right below the tabs
258259
g.setColor(tabColor[SELECTED]);
259260
// can't be done with lines, b/c retina leaves tiny hairlines
260261
g.fillRect(Editor.LEFT_GUTTER, TAB_BOTTOM,
261262
editor.getTextArea().getWidth() - Editor.LEFT_GUTTER,
262263
Toolkit.zoom(2));
264+
*/
263265

264266
// draw the tab for the menu
265267
g.setColor(tabColor[UNSELECTED]);
266-
drawTab(g, menuLeft, menuRight, false, true);
268+
drawTab(g, menuLeft, menuRight, false, true, false);
267269

268270
// draw the arrow on the menu tab
269271
g.setColor(arrowColor);
@@ -284,116 +286,51 @@ private boolean placeTabs(int left, int right, Graphics2D g) {
284286
Sketch sketch = editor.getSketch();
285287
int x = left;
286288

287-
// final int bottom = getHeight(); // - TAB_STRETCH;
288-
// final int top = bottom - TAB_HEIGHT;
289-
// GeneralPath path = null;
290-
291289
for (int i = 0; i < sketch.getCodeCount(); i++) {
292290
SketchCode code = sketch.getCode(i);
293291
Tab tab = tabs[i];
294292

295-
// int pieceCount = 2 + (tab.textWidth / PIECE_WIDTH);
296-
// if (tab.textVisible == false) {
297-
// pieceCount = 4;
298-
// }
299-
// int pieceWidth = pieceCount * PIECE_WIDTH;
300-
301293
int state = (code == sketch.getCurrentCode()) ? SELECTED : UNSELECTED;
302-
// if (g != null) {
303-
// //g.drawImage(pieces[state][LEFT], x, 0, PIECE_WIDTH, PIECE_HEIGHT, null);
304-
// path = new GeneralPath();
305-
// path.moveTo(x, bottom);
306-
// path.lineTo(x, top + NOTCH);
307-
// path.lineTo(x + NOTCH, top);
308-
// }
309294
tab.left = x;
310295
x += TEXT_MARGIN;
311-
// x += PIECE_WIDTH;
312-
313-
// int contentLeft = x;
314-
// for (int j = 0; j < pieceCount; j++) {
315-
// if (g != null) {
316-
// g.drawImage(pieces[state][MIDDLE], x, 0, PIECE_WIDTH, PIECE_HEIGHT, null);
317-
// }
318-
// x += PIECE_WIDTH;
319-
// }
320-
// if (g != null) {
296+
321297
int drawWidth = tab.textVisible ? tab.textWidth : NO_TEXT_WIDTH;
322298
x += drawWidth + TEXT_MARGIN;
323-
// path.moveTo(x, top);
324-
// }
325299
tab.right = x;
326300

327301
if (g != null && tab.right < right) {
328302
g.setColor(tabColor[state]);
329-
drawTab(g, tab.left, tab.right, i == 0, false);
330-
// path.lineTo(x - NOTCH, top);
331-
// path.lineTo(x, top + NOTCH);
332-
// path.lineTo(x, bottom);
333-
// path.closePath();
334-
// g.setColor(tabColor[state]);
335-
// g.fill(path);
336-
// // have to draw an extra outline to make things line up on retina
337-
// g.draw(path);
338-
// //g.drawImage(pieces[state][RIGHT], x, 0, PIECE_WIDTH, PIECE_HEIGHT, null);
303+
drawTab(g, tab.left, tab.right, i == 0, false, state == SELECTED);
339304

340305
if (tab.textVisible) {
341306
int textLeft = tab.left + ((tab.right - tab.left) - tab.textWidth) / 2;
342307
g.setColor(textColor[state]);
343-
// int baseline = (int) Math.ceil((sizeH + fontAscent) / 2.0);
344-
//int baseline = bottom - (TAB_HEIGHT - fontAscent)/2;
345308
int tabHeight = TAB_BOTTOM - TAB_TOP;
346309
int baseline = TAB_TOP + (tabHeight + fontAscent) / 2;
347-
//g.drawString(sketch.code[i].name, textLeft, baseline);
348310
g.drawString(tab.text, textLeft, baseline);
349-
// g.drawLine(tab.left, baseline-fontAscent, tab.right, baseline-fontAscent);
350-
// g.drawLine(tab.left, baseline, tab.right, baseline);
351311
}
352312

353313
if (code.isModified()) {
354314
g.setColor(modifiedColor);
355-
//g.drawLine(tab.left + NOTCH, top, tab.right - NOTCH, top);
356-
//g.drawLine(tab.left + (i == 0 ? CURVE_RADIUS : 0), TAB_TOP, tab.right-1, TAB_TOP);
357315
g.drawLine(tab.right, TAB_TOP, tab.right, TAB_BOTTOM);
358316
}
359317
}
360-
361-
// if (g != null) {
362-
// g.drawImage(pieces[state][RIGHT], x, 0, PIECE_WIDTH, PIECE_HEIGHT, null);
363-
// }
364-
// x += PIECE_WIDTH - 1; // overlap by 1 pixel
365318
x += TAB_BETWEEN;
366319
}
367-
368-
// removed 150130
369-
// // Draw this last because of half-pixel overlaps on retina displays
370-
// if (g != null) {
371-
// g.setColor(tabColor[SELECTED]);
372-
// g.fillRect(0, bottom, getWidth(), TAB_STRETCH);
373-
// }
374-
375320
return x <= right;
376321
}
377322

378323

379324
private void drawTab(Graphics g, int left, int right,
380-
boolean leftNotch, boolean rightNotch) {
381-
// final int bottom = getHeight(); // - TAB_STRETCH;
382-
// final int top = bottom - TAB_HEIGHT;
383-
// g.fillRect(left, top, right - left, bottom - top);
384-
325+
boolean leftNotch, boolean rightNotch,
326+
boolean selected) {
385327
Graphics2D g2 = (Graphics2D) g;
328+
final int bottom = TAB_BOTTOM + (selected ? 2 : 0);
386329
g2.fill(Toolkit.createRoundRect(left, TAB_TOP,
387-
right, TAB_BOTTOM,
330+
right, bottom,
388331
leftNotch ? CURVE_RADIUS : 0,
389332
rightNotch ? CURVE_RADIUS : 0,
390333
0, 0));
391-
392-
// path.moveTo(left, TAB_BOTTOM);
393-
// if (left == MARGIN_WIDTH) { // first tab on the left
394-
// path.lineTo(left, TAB_TOP - CURVE_RADIUS);
395-
// }
396-
397334
}
398335

399336

‎todo.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ X update the mode selector colors
5656
X remove background color from console text
5757
X make sure repaint is happening
5858
X white corner on the scroll bar
59+
X single line at top of editor (editor bg color?)
5960
_ line numbers extending into the horizontal scroll bar
60-
_ single line at top of editor (editor bg color?)
6161
_ put themes in folders by name
6262
_ selector for theme that uses tiny images
6363
_ add notes about params to the wiki

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL