Changeset 286 for trunk/src/org/expeditee/gui/FrameKeyboardActions.java
- Timestamp:
- 08/29/08 08:17:54 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/gui/FrameKeyboardActions.java
r284 r286 10 10 import java.awt.event.KeyListener; 11 11 import java.awt.geom.Point2D; 12 import java.text.NumberFormat; 12 13 import java.util.ArrayList; 13 14 import java.util.Collection; … … 39 40 40 41 private static Collection<Item> _enclosedItems = null; 41 42 42 43 public static void resetEnclosedItems() { 43 44 _enclosedItems = null; … … 330 331 public void keyPressed(KeyEvent e) { 331 332 int keyCode = e.getKeyCode(); 332 333 if (keyCode != KeyEvent.VK_F1 && keyCode != KeyEvent.VK_F2){333 334 if (keyCode != KeyEvent.VK_F1 && keyCode != KeyEvent.VK_F2) { 334 335 resetEnclosedItems(); 335 336 } 336 337 337 338 SessionStats.AddFrameEvent("k" + KeyEvent.getKeyText(keyCode)); 338 339 … … 526 527 527 528 } 528 529 529 530 530 public void keyReleased(KeyEvent e) { … … 1114 1114 public static final String SHORT_DATE_FORMAT = "ddMMMyyyy"; 1115 1115 1116 public static final String TIME_DATE_FORMAT = "[HH:mm]"; 1117 1116 1118 public static final String LONG_DATE_FORMAT = "ddMMMyyyy[HH:mm]"; 1117 1119 … … 1181 1183 dummyItem.setText(newItemText + dummyItem.getText()); 1182 1184 } 1183 1185 1184 1186 dummyItem = createText(); 1185 1187 if (FreeItems.textOnlyAttachedToCursor()) { … … 1199 1201 if (column.size() == 0) { 1200 1202 Frame current = DisplayIO.getCurrentFrame(); 1201 // Item itemTemplate = current.getItemTemplate();1203 // Item itemTemplate = current.getItemTemplate(); 1202 1204 int xPos = title.getX() + FrameCreator.INDENT_FROM_TITLE; 1203 1205 int yPos = FrameCreator.getYStart(title); … … 1509 1511 // check permissions 1510 1512 if (!item.hasPermission(Permission.full)) { 1511 MessageBay 1512 .displayMessage("Insufficient permission to change the size of that item"); 1513 return; 1513 Item editTarget = item.getEditTarget(); 1514 if (editTarget != item 1515 && editTarget.hasPermission(Permission.full)) { 1516 item = editTarget; 1517 } else { 1518 MessageBay 1519 .displayMessage("Insufficient permission to change the size of that item"); 1520 return; 1521 } 1514 1522 } 1515 1523 toSet = item; … … 1569 1577 i.setThickness((float) (i.getThickness() * ratio)); 1570 1578 } else if (i instanceof XRayable) { 1579 XRayable xRay = (XRayable) i; 1580 Text source = xRay.getSource(); 1581 // Ensure that the source is done before the XRayable 1582 if (!done.contains(source)) { 1583 scaleText(origin, ratio, done, source); 1584 } 1585 1571 1586 i.translate(origin, ratio); 1572 1587 i.setThickness((float) (i.getThickness() * ratio)); 1573 1588 done.add(i); 1589 } else if (i.hasVector()) { 1590 // TODO Improve the effiency of resizing vectors... ie... 1591 // dont want to have to reparse all the time 1592 assert (i instanceof Text); 1593 Text text = (Text) i; 1594 AttributeValuePair avp = new AttributeValuePair(text 1595 .getText()); 1596 double scale = 1F; 1597 try { 1598 scale = avp.getDoubleValue(); 1599 } catch (Exception e) { 1600 } 1601 scale *= ratio; 1602 NumberFormat nf = Vector.getNumberFormatter(); 1603 text.setAttributeValue(nf.format(scale)); 1604 text.translate(origin, ratio); 1605 item.getParent().parse(); 1574 1606 } else if (i instanceof Text) { 1575 i.translate(origin, ratio); 1576 i.setSize((float) (i.getSize() * ratio)); 1577 done.add(i); 1607 scaleText(origin, ratio, done, (Text) i); 1578 1608 } 1579 1609 } … … 1598 1628 current = Math.max(current + diff, Item.MINIMUM_THICKNESS); 1599 1629 dot.setThickness(current); 1630 } else if (i.hasVector()) { 1631 assert (item instanceof Text); 1632 Text text = (Text) item; 1633 AttributeValuePair avp = new AttributeValuePair(text.getText()); 1634 double scale = 1F; 1635 try { 1636 scale = avp.getDoubleValue(); 1637 } catch (Exception e) { 1638 } 1639 scale *= ratio; 1640 NumberFormat nf = Vector.getNumberFormatter(); 1641 text.setAttributeValue(nf.format(scale)); 1642 text.translate(origin, ratio); 1643 item.getParent().parse(); 1600 1644 } else { 1601 1645 float oldSize = Math.abs(i.getSize()); … … 1620 1664 } 1621 1665 1666 /** 1667 * @param origin 1668 * @param ratio 1669 * @param done 1670 * @param source 1671 */ 1672 private static void scaleText(Point2D origin, double ratio, 1673 Collection<Item> done, Text source) { 1674 source.translate(origin, ratio); 1675 source.setSize((float) (source.getSize() * ratio)); 1676 done.add(source); 1677 } 1678 1622 1679 private static void SetFillColor(Item item, boolean setTransparent) { 1623 1680 if (item == null) … … 1716 1773 // check permissions 1717 1774 if (!item.hasPermission(Permission.full)) { 1718 MessageBay 1719 .displayMessage("Insufficient permission to change that item's color"); 1720 return; 1775 Item editTarget = item.getEditTarget(); 1776 if (editTarget != item 1777 && editTarget.hasPermission(Permission.full)) { 1778 item = editTarget; 1779 } else { 1780 MessageBay 1781 .displayMessage("Insufficient permission to change color"); 1782 return; 1783 } 1721 1784 } 1722 1785 // Toggling color of circle center changes the circle fill color
Note:
See TracChangeset
for help on using the changeset viewer.