(Graphics g)
| 152 | |
| 153 | |
| 154 | public void paintComponent(Graphics g) { |
| 155 | if (g == null) return; |
| 156 | Sketch sketch = editor.getSketch(); |
| 157 | if (sketch == null) return; // is this even possible? |
| 158 | |
| 159 | g.setFont(font); // need to set this each time through |
| 160 | if (fontAscent == 0) { |
| 161 | fontAscent = (int) Toolkit.getAscent(g); |
| 162 | } |
| 163 | |
| 164 | Graphics2D g2 = Toolkit.prepareGraphics(g, false); |
| 165 | |
| 166 | /* |
| 167 | Graphics2D g2 = (Graphics2D) g; |
| 168 | |
| 169 | if (!Toolkit.isRetina()) { |
| 170 | g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, |
| 171 | RenderingHints.VALUE_ANTIALIAS_ON); |
| 172 | g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, |
| 173 | RenderingHints.VALUE_INTERPOLATION_BICUBIC); |
| 174 | g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, |
| 175 | RenderingHints.VALUE_TEXT_ANTIALIAS_ON); |
| 176 | // g2.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, |
| 177 | // RenderingHints.VALUE_FRACTIONALMETRICS_ON); |
| 178 | } |
| 179 | */ |
| 180 | |
| 181 | g.drawImage(gradient, 0, 0, getWidth(), getHeight(), this); |
| 182 | |
| 183 | if (tabs.length != sketch.getCodeCount()) { |
| 184 | tabs = new Tab[sketch.getCodeCount()]; |
| 185 | for (int i = 0; i < tabs.length; i++) { |
| 186 | tabs[i] = new Tab(i); |
| 187 | } |
| 188 | visitOrder = new Tab[sketch.getCodeCount() - 1]; |
| 189 | } |
| 190 | |
| 191 | int leftover = TAB_BETWEEN + ARROW_TAB_WIDTH; |
| 192 | int tabMax = getWidth() - leftover; |
| 193 | |
| 194 | // reset all tab positions |
| 195 | for (Tab tab : tabs) { |
| 196 | SketchCode code = sketch.getCode(tab.index); |
| 197 | tab.textVisible = true; |
| 198 | tab.lastVisited = code.lastVisited(); |
| 199 | |
| 200 | tab.text = code.getFileName(); |
| 201 | // hide extensions for .pde files |
| 202 | if (editor.getMode().hideExtension(code.getExtension())) { |
| 203 | tab.text = code.getPrettyName(); |
| 204 | if (Preferences.getBoolean("sketch.name.replace_underscore")) { |
| 205 | tab.text = tab.text.replace('_', ' '); |
| 206 | } |
| 207 | } |
| 208 | |
| 209 | tab.textWidth = (int) |
| 210 | font.getStringBounds(tab.text, g2.getFontRenderContext()).getWidth(); |
| 211 | } |
nothing calls this directly
no test coverage detected