Changeset 121 for trunk/src/org/expeditee/items/Text.java
- Timestamp:
- 07/03/08 16:48:09 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/items/Text.java
r116 r121 182 182 } 183 183 184 @Override 185 public Color getHighlightColor() { 186 if (_highlightColor.equals(getPaintBackgroundColor())) 187 return ALTERNATE_HIGHLIGHT; 188 return _highlightColor; 189 } 190 191 184 192 /** 185 193 * Sets the justification of this Text item. The given integer should … … 225 233 */ 226 234 public void setText(String text) { 235 // if (_text != null && text.length() < _text.length()) 236 // invalidateAll(); 227 237 _text = new StringBuffer(text); 228 238 rebuild(false); 239 // invalidateAll(); 229 240 } 230 241 … … 265 276 */ 266 277 public void removeText(String text) { 267 if (_text.length() > 0 && _text.indexOf(text) == 0) 278 279 if (_text.length() > 0 && _text.indexOf(text) == 0) { 280 //invalidateAll(); 268 281 _text.delete(0, text.length()); 282 } 283 269 284 270 285 } … … 273 288 int length = _text.length(); 274 289 if (length > 0) { 290 //invalidateAll(); 275 291 int pos = _text.indexOf(textToRemove); 276 292 int textToRemoveLength = textToRemove.length(); … … 279 295 } 280 296 } 297 281 298 } 282 299 … … 411 428 TextHitInfo hit = getCharPosition(line, mouseX); 412 429 _selectionStart = hit.getInsertionIndex() + _lineOffsets.get(line); 430 invalidateAll(); 413 431 } 414 432 … … 420 438 TextHitInfo hit = getCharPosition(line, mouseX); 421 439 _selectionEnd = hit.getInsertionIndex() + _lineOffsets.get(line); 440 invalidateAll(); 422 441 } 423 442 … … 425 444 _selectionStart = -1; 426 445 _selectionEnd = -1; 446 invalidateAll(); 427 447 } 428 448 429 449 public void clearSelectionEnd() { 430 450 _selectionEnd = -1; 451 invalidateAll(); 431 452 } 432 453 … … 448 469 if (_selectionStart < 0 || _selectionEnd < 0) 449 470 return null; 450 else if (_selectionEnd > _text.length()) 471 472 invalidateAll(); 473 474 if (_selectionEnd > _text.length()) 451 475 _selectionEnd = _text.length(); 452 476 … … 459 483 _text.insert(left, newText); 460 484 rebuild(true); 485 486 invalidateAll(); 461 487 462 488 return s; … … 493 519 TextLayout current = null; 494 520 int line; 521 522 invalidateAll(); 495 523 496 524 // check for empty string … … 635 663 x, 636 664 (getX() - Item.MARGIN_RIGHT - (2 * getGravity()) + getBoundsWidth())); 665 666 invalidateAll(); 667 637 668 return new Point2D.Float(Math.round(x), Math.round(getY() + y 638 669 + caret[1])); … … 777 808 public void setFont(Font font) { 778 809 // all decoding occurs in the Utils class 810 779 811 _font = font; 780 781 812 // rejustify(); 782 813 rebuild(false); … … 1105 1136 return; 1106 1137 } 1107 1138 1108 1139 AttributedString paragraphText = new AttributedString(_text.toString()); 1109 1140 paragraphText.addAttribute(TextAttribute.FONT, getPaintFont()); … … 1154 1185 1155 1186 updatePolygon(); 1187 1156 1188 } 1157 1189 … … 1515 1547 _lineBreaker.deleteChar(inserting.getIterator(), pos); 1516 1548 } 1549 1550 1551 1517 1552 } 1518 1553 … … 1682 1717 @Override 1683 1718 protected int getLinkYOffset() { 1719 if (_textLayouts.size() == 0) return 0; 1684 1720 return Math.round(-(_textLayouts.get(0).getAscent() / 2)); 1685 1721 }
Note:
See TracChangeset
for help on using the changeset viewer.