| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -254,16 +254,18 @@ public void paintComponent(Graphics screen) { | |||
| 254 | 254 | menuRight = menuLeft + ARROW_TAB_WIDTH; | |
| 255 | 255 | } | |
| 256 | 256 | ||
| 257 | + /* | ||
| 257 | 258 | // draw the two pixel line that extends left/right below the tabs | |
| 258 | 259 | g.setColor(tabColor[SELECTED]); | |
| 259 | 260 | // can't be done with lines, b/c retina leaves tiny hairlines | |
| 260 | 261 | g.fillRect(Editor.LEFT_GUTTER, TAB_BOTTOM, | |
| 261 | 262 | editor.getTextArea().getWidth() - Editor.LEFT_GUTTER, | |
| 262 | 263 | Toolkit.zoom(2)); | |
| 264 | + */ | ||
| 263 | 265 | ||
| 264 | 266 | // draw the tab for the menu | |
| 265 | 267 | g.setColor(tabColor[UNSELECTED]); | |
| 266 | - drawTab(g, menuLeft, menuRight, false, true); | ||
| 268 | + drawTab(g, menuLeft, menuRight, false, true, false); | ||
| 267 | 269 | ||
| 268 | 270 | // draw the arrow on the menu tab | |
| 269 | 271 | g.setColor(arrowColor); | |
@@ -284,116 +286,51 @@ private boolean placeTabs(int left, int right, Graphics2D g) { | |||
| 284 | 286 | Sketch sketch = editor.getSketch(); | |
| 285 | 287 | int x = left; | |
| 286 | 288 | ||
| 287 | - // final int bottom = getHeight(); // - TAB_STRETCH; | ||
| 288 | - // final int top = bottom - TAB_HEIGHT; | ||
| 289 | - // GeneralPath path = null; | ||
| 290 | - | ||
| 291 | 289 | for (int i = 0; i < sketch.getCodeCount(); i++) { | |
| 292 | 290 | SketchCode code = sketch.getCode(i); | |
| 293 | 291 | Tab tab = tabs[i]; | |
| 294 | 292 | ||
| 295 | - // int pieceCount = 2 + (tab.textWidth / PIECE_WIDTH); | ||
| 296 | - // if (tab.textVisible == false) { | ||
| 297 | - // pieceCount = 4; | ||
| 298 | - // } | ||
| 299 | - // int pieceWidth = pieceCount * PIECE_WIDTH; | ||
| 300 | - | ||
| 301 | 293 | 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 | - // } | ||
| 309 | 294 | tab.left = x; | |
| 310 | 295 | 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 | + | ||
| 321 | 297 | int drawWidth = tab.textVisible ? tab.textWidth : NO_TEXT_WIDTH; | |
| 322 | 298 | x += drawWidth + TEXT_MARGIN; | |
| 323 | - // path.moveTo(x, top); | ||
| 324 | - // } | ||
| 325 | 299 | tab.right = x; | |
| 326 | 300 | ||
| 327 | 301 | if (g != null && tab.right < right) { | |
| 328 | 302 | 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); | ||
| 339 | 304 | ||
| 340 | 305 | if (tab.textVisible) { | |
| 341 | 306 | int textLeft = tab.left + ((tab.right - tab.left) - tab.textWidth) / 2; | |
| 342 | 307 | g.setColor(textColor[state]); | |
| 343 | - // int baseline = (int) Math.ceil((sizeH + fontAscent) / 2.0); | ||
| 344 | - //int baseline = bottom - (TAB_HEIGHT - fontAscent)/2; | ||
| 345 | 308 | int tabHeight = TAB_BOTTOM - TAB_TOP; | |
| 346 | 309 | int baseline = TAB_TOP + (tabHeight + fontAscent) / 2; | |
| 347 | - //g.drawString(sketch.code[i].name, textLeft, baseline); | ||
| 348 | 310 | 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); | ||
| 351 | 311 | } | |
| 352 | 312 | ||
| 353 | 313 | if (code.isModified()) { | |
| 354 | 314 | 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); | ||
| 357 | 315 | g.drawLine(tab.right, TAB_TOP, tab.right, TAB_BOTTOM); | |
| 358 | 316 | } | |
| 359 | 317 | } | |
| 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 | ||
| 365 | 318 | x += TAB_BETWEEN; | |
| 366 | 319 | } | |
| 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 | - | ||
| 375 | 320 | return x <= right; | |
| 376 | 321 | } | |
| 377 | 322 | ||
| 378 | 323 | ||
| 379 | 324 | 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) { | ||
| 385 | 327 | Graphics2D g2 = (Graphics2D) g; | |
| 328 | + final int bottom = TAB_BOTTOM + (selected ? 2 : 0); | ||
| 386 | 329 | g2.fill(Toolkit.createRoundRect(left, TAB_TOP, | |
| 387 | - right, TAB_BOTTOM, | ||
| 330 | + right, bottom, | ||
| 388 | 331 | leftNotch ? CURVE_RADIUS : 0, | |
| 389 | 332 | rightNotch ? CURVE_RADIUS : 0, | |
| 390 | 333 | 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 | - | ||
| 397 | 334 | } | |
| 398 | 335 | ||
| 399 | 336 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -56,8 +56,8 @@ X update the mode selector colors | |||
| 56 | 56 | X remove background color from console text | |
| 57 | 57 | X make sure repaint is happening | |
| 58 | 58 | X white corner on the scroll bar | |
| 59 | + X single line at top of editor (editor bg color?) | ||
| 59 | 60 | _ line numbers extending into the horizontal scroll bar | |
| 60 | - _ single line at top of editor (editor bg color?) | ||
| 61 | 61 | _ put themes in folders by name | |
| 62 | 62 | _ selector for theme that uses tiny images | |
| 63 | 63 | _ add notes about params to the wiki | |
| Back | FazBrowse Home | New Git URL |
0 commit comments