(int left, int right, Graphics2D g)
| 284 | |
| 285 | |
| 286 | private boolean placeTabs(int left, int right, Graphics2D g) { |
| 287 | Sketch sketch = editor.getSketch(); |
| 288 | int x = left; |
| 289 | |
| 290 | // final int bottom = getHeight(); // - TAB_STRETCH; |
| 291 | // final int top = bottom - TAB_HEIGHT; |
| 292 | // GeneralPath path = null; |
| 293 | |
| 294 | for (int i = 0; i < sketch.getCodeCount(); i++) { |
| 295 | SketchCode code = sketch.getCode(i); |
| 296 | Tab tab = tabs[i]; |
| 297 | |
| 298 | // int pieceCount = 2 + (tab.textWidth / PIECE_WIDTH); |
| 299 | // if (tab.textVisible == false) { |
| 300 | // pieceCount = 4; |
| 301 | // } |
| 302 | // int pieceWidth = pieceCount * PIECE_WIDTH; |
| 303 | |
| 304 | int state = (code == sketch.getCurrentCode()) ? SELECTED : UNSELECTED; |
| 305 | // if (g != null) { |
| 306 | // //g.drawImage(pieces[state][LEFT], x, 0, PIECE_WIDTH, PIECE_HEIGHT, null); |
| 307 | // path = new GeneralPath(); |
| 308 | // path.moveTo(x, bottom); |
| 309 | // path.lineTo(x, top + NOTCH); |
| 310 | // path.lineTo(x + NOTCH, top); |
| 311 | // } |
| 312 | tab.left = x; |
| 313 | x += TEXT_MARGIN; |
| 314 | // x += PIECE_WIDTH; |
| 315 | |
| 316 | // int contentLeft = x; |
| 317 | // for (int j = 0; j < pieceCount; j++) { |
| 318 | // if (g != null) { |
| 319 | // g.drawImage(pieces[state][MIDDLE], x, 0, PIECE_WIDTH, PIECE_HEIGHT, null); |
| 320 | // } |
| 321 | // x += PIECE_WIDTH; |
| 322 | // } |
| 323 | // if (g != null) { |
| 324 | int drawWidth = tab.textVisible ? tab.textWidth : NO_TEXT_WIDTH; |
| 325 | x += drawWidth + TEXT_MARGIN; |
| 326 | // path.moveTo(x, top); |
| 327 | // } |
| 328 | tab.right = x; |
| 329 | |
| 330 | if (g != null && tab.right < right) { |
| 331 | g.setColor(tabColor[state]); |
| 332 | drawTab(g, tab.left, tab.right, i == 0, false); |
| 333 | // path.lineTo(x - NOTCH, top); |
| 334 | // path.lineTo(x, top + NOTCH); |
| 335 | // path.lineTo(x, bottom); |
| 336 | // path.closePath(); |
| 337 | // g.setColor(tabColor[state]); |
| 338 | // g.fill(path); |
| 339 | // // have to draw an extra outline to make things line up on retina |
| 340 | // g.draw(path); |
| 341 | // //g.drawImage(pieces[state][RIGHT], x, 0, PIECE_WIDTH, PIECE_HEIGHT, null); |
| 342 | |
| 343 | if (tab.textVisible) { |
no test coverage detected