Changeset 72 for trunk/src/org/expeditee/items/Text.java
- Timestamp:
- 05/23/08 09:02:59 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/items/Text.java
r71 r72 22 22 import java.util.List; 23 23 24 import org.expeditee.gui.DisplayIO; 24 25 import org.expeditee.gui.FrameGraphics; 26 import org.expeditee.gui.FrameKeyboardActions; 25 27 import org.expeditee.gui.FrameMouseActions; 26 28 … … 745 747 } 746 748 749 public static final String MONOSPACED_FONT = "monospaced"; 750 747 751 public static final String[] FONT_WHEEL = { "sansserif", "monospaced", 748 752 "serif", "dialog", "dialoginput" }; … … 751 755 752 756 private static final int NEARBY_GRAVITY = 2; 757 758 private static final int MINIMUM_FONT_SIZE = 8; 753 759 754 760 public void toggleFontFamily() { … … 939 945 } 940 946 941 // check if the cursor is on the left border of the bounding box942 if (Math.abs(mouseX - LEFT_MARGIN - outline.x) <= gravity) {943 return true;944 }945 946 947 for (TextLayout text : _textLayouts) { 947 948 // check left and right of each box … … 953 954 if (mouseY - textY > textOutline.y 954 955 && mouseY - textY < textOutline.y + textOutline.height 955 && mouseX - textX < textOutline.width + gravity) 956 && mouseX - textX < textOutline.width + gravity 957 + Item.MARGIN_RIGHT) 956 958 return true; 957 959 textY += getLineDrop(text); … … 999 1001 } 1000 1002 1001 minX -= Item.MARGIN_RIGHT; 1002 1003 if (getWidth() > 0) 1004 maxX = getWidth(); 1003 minX -= getLeftMargin(); 1004 maxX += Item.MARGIN_RIGHT; 1005 1005 1006 1006 _poly.addPoint(minX - getGravity(), minY - getGravity()); … … 1008 1008 _poly.addPoint(maxX + getGravity(), maxY + getGravity()); 1009 1009 _poly.addPoint(minX - getGravity(), maxY + getGravity()); 1010 1011 // _poly.addPoint(minX, minY); 1012 // _poly.addPoint(maxX, minY); 1013 // _poly.addPoint(maxX, maxY); 1014 // _poly.addPoint(minX, maxY); 1010 } 1011 1012 /** 1013 * Gets the distance between the start of the text and the left border of 1014 * the item. This distance changes depending on whether or not the item is 1015 * linked or has an associated action. 1016 * 1017 * @return the gap size in pixels 1018 */ 1019 private int getLeftMargin() { 1020 return ((getLinkMark() && getLink() != null) 1021 || (getActionMark() && getAction() != null) ? Item.MARGIN_LEFT 1022 - Item.MARGIN_RIGHT : Item.MARGIN_RIGHT); 1015 1023 } 1016 1024 … … 1389 1397 @Override 1390 1398 public void setSize(int size) { 1391 setFont(getPaintFont().deriveFont((float) size)); 1399 if (size >= MINIMUM_FONT_SIZE) 1400 setFont(getPaintFont().deriveFont((float) size)); 1392 1401 } 1393 1402 … … 1399 1408 return; 1400 1409 1401 /*1402 * // Remove 'a: ' from the begining if it is there if1403 * (_text.length() > 3 && _text.charAt(0) == 'a' && _text.charAt(1) ==1404 * ':') { _text.delete(0, 2); while (_text.charAt(0) == ' ')1405 * _text.delete(0, 1); }1406 */1407 1410 _text.insert(0, "@"); 1408 1411 … … 1418 1421 return; 1419 1422 1423 if (_text.length() == 1) { 1424 // Remove and replace with a dot 1425 FrameKeyboardActions.replaceText(this); 1426 1427 DisplayIO.setCursorPosition(this.getPosition()); 1428 return; 1429 } 1430 1420 1431 _text.deleteCharAt(0); 1421 1432 … … 1432 1443 @Override 1433 1444 public boolean isAnnotation() { 1434 if (_text != null && _text.length() > 0 && _text. indexOf("@") == 0)1445 if (_text != null && _text.length() > 0 && _text.charAt(0) == '@') 1435 1446 return true; 1436 1447
Note:
See TracChangeset
for help on using the changeset viewer.