Ignore:
Timestamp:
08/29/08 08:17:54 (16 years ago)
Author:
ra33
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/gui/FrameKeyboardActions.java

    r284 r286  
    1010import java.awt.event.KeyListener;
    1111import java.awt.geom.Point2D;
     12import java.text.NumberFormat;
    1213import java.util.ArrayList;
    1314import java.util.Collection;
     
    3940
    4041        private static Collection<Item> _enclosedItems = null;
    41        
     42
    4243        public static void resetEnclosedItems() {
    4344                _enclosedItems = null;
     
    330331        public void keyPressed(KeyEvent e) {
    331332                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) {
    334335                        resetEnclosedItems();
    335336                }
    336                
     337
    337338                SessionStats.AddFrameEvent("k" + KeyEvent.getKeyText(keyCode));
    338339
     
    526527
    527528        }
    528 
    529529
    530530        public void keyReleased(KeyEvent e) {
     
    11141114        public static final String SHORT_DATE_FORMAT = "ddMMMyyyy";
    11151115
     1116        public static final String TIME_DATE_FORMAT = "[HH:mm]";
     1117
    11161118        public static final String LONG_DATE_FORMAT = "ddMMMyyyy[HH:mm]";
    11171119
     
    11811183                                dummyItem.setText(newItemText + dummyItem.getText());
    11821184                        }
    1183                        
     1185
    11841186                        dummyItem = createText();
    11851187                        if (FreeItems.textOnlyAttachedToCursor()) {
     
    11991201                        if (column.size() == 0) {
    12001202                                Frame current = DisplayIO.getCurrentFrame();
    1201                                 //Item itemTemplate = current.getItemTemplate();
     1203                                // Item itemTemplate = current.getItemTemplate();
    12021204                                int xPos = title.getX() + FrameCreator.INDENT_FROM_TITLE;
    12031205                                int yPos = FrameCreator.getYStart(title);
     
    15091511                        // check permissions
    15101512                        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                                }
    15141522                        }
    15151523                        toSet = item;
     
    15691577                                        i.setThickness((float) (i.getThickness() * ratio));
    15701578                                } 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
    15711586                                        i.translate(origin, ratio);
    15721587                                        i.setThickness((float) (i.getThickness() * ratio));
    15731588                                        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();
    15741606                                } 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);
    15781608                                }
    15791609                        }
     
    15981628                                current = Math.max(current + diff, Item.MINIMUM_THICKNESS);
    15991629                                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();
    16001644                        } else {
    16011645                                float oldSize = Math.abs(i.getSize());
     
    16201664        }
    16211665
     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
    16221679        private static void SetFillColor(Item item, boolean setTransparent) {
    16231680                if (item == null)
     
    17161773                        // check permissions
    17171774                        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                                }
    17211784                        }
    17221785                        // Toggling color of circle center changes the circle fill color
Note: See TracChangeset for help on using the changeset viewer.