Changeset 86 for trunk/src/org/expeditee/items/Text.java
- Timestamp:
- 06/05/08 10:11:18 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/items/Text.java
r80 r86 353 353 } 354 354 355 public Point getEnd LinePosition(int mouseY) {355 public Point getEndPosition(int mouseY) { 356 356 return getEdgePosition(getLinePosition(mouseY), false); 357 357 } 358 358 359 public Point getStart LinePosition(int mouseY) {359 public Point getStartPosition(int mouseY) { 360 360 return getEdgePosition(getLinePosition(mouseY), true); 361 361 } … … 363 363 public Point getEndParagraphPosition() { 364 364 return getEdgePosition(_textLayouts.size() - 1, false); 365 } 366 367 public Point getStartParagraphPosition() { 368 return getEdgePosition(0, true); 365 369 } 366 370 … … 520 524 // Text length greater than 1 signals a backwards tab 521 525 if (text.length() > 1) { 522 //Find the first non space char to see if its a bullet526 // Find the first non space char to see if its a bullet 523 527 int index = 0; 524 528 for (index = 0; index < _text.length(); index++) { … … 527 531 } 528 532 // Check if there is a space after the bullet 529 if (index < _text.length() - 1 && _text.charAt(index + 1) == ' ') { 533 if (index < _text.length() - 1 534 && _text.charAt(index + 1) == ' ') { 530 535 // Change the bullet 531 _text.setCharAt(index, getPreviousBullet(_text.charAt(index))); 536 _text.setCharAt(index, getPreviousBullet(_text 537 .charAt(index))); 532 538 } 533 539 // Remove the spacing at the start 534 540 for (int i = 0; i < TAB_STRING.length(); i++) { 535 if (_text.length() > 0 && Character.isSpaceChar(_text.charAt(0))){ 541 if (_text.length() > 0 542 && Character.isSpaceChar(_text.charAt(0))) { 536 543 deleteChar(0, false); 537 544 pos--; … … 612 619 // check for home or end keys 613 620 if (direction == HOME) 614 return getStart LinePosition(mouseY);621 return getStartParagraphPosition(); 615 622 616 623 if (direction == END) 617 return getEnd LinePosition(mouseY);624 return getEndParagraphPosition(); 618 625 619 626 TextHitInfo hit; … … 640 647 641 648 if (direction == LEFT) { 642 if (hit.getInsertionIndex() > 0) 649 if (hit.getInsertionIndex() > 0) { 643 650 hit = _textLayouts.get(line).getNextLeftHit(hit); 644 645 if (line > 0 646 && _text.charAt(hit.getInsertionIndex() 647 + _lineOffsets.get(line)) == '\n') { 651 //This takes care of the case where the user has put a hard line break in 652 if (line > 0 653 && _text.charAt(hit.getInsertionIndex() 654 + _lineOffsets.get(line)) == '\n') { 655 line--; 656 hit = _textLayouts.get(line).getNextRightHit( 657 _textLayouts.get(line).getCharacterCount() - 1); 658 } 659 //This takes care of soft line breaks. 660 } else if (line > 0) { 648 661 line--; 649 662 hit = _textLayouts.get(line).getNextRightHit( 650 663 _textLayouts.get(line).getCharacterCount() - 1); 664 while (hit.getCharIndex() > 0 665 && _text.charAt(_lineOffsets.get(line) 666 + hit.getCharIndex()- 1) == ' '){ 667 hit = _textLayouts.get(line).getNextLeftHit(hit); 668 } 651 669 } 652 670 } else if (direction == RIGHT) { … … 1232 1250 // the background is only cleared if required 1233 1251 if (getBackgroundColor() != null) { 1234 g.setColor(getBackgroundColor()); 1252 Color bgc = getBackgroundColor(); 1253 if (_alpha > 0) 1254 bgc = new Color(bgc.getRed(), bgc.getGreen(), bgc.getBlue(), 1255 _alpha); 1256 g.setColor(bgc); 1235 1257 g.fill(getPolygon()); 1236 1258 }
Note:
See TracChangeset
for help on using the changeset viewer.