Changeset 131


Ignore:
Timestamp:
07/10/08 12:32:54 (16 years ago)
Author:
ra33
Message:

Fixed a couple of minor repaint issues such problems when TwoEnclosed areas of identical size where on a vector frame

Also fixed cutting and pasting...

Added functionality to be able to cut and paste a selected region in a text item

Location:
trunk/src/org/expeditee
Files:
6 edited

Legend:

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

    r130 r131  
    2424import org.expeditee.items.ItemUtils;
    2525import org.expeditee.items.Line;
     26import org.expeditee.items.Permission;
    2627import org.expeditee.items.WidgetEdge;
    2728import org.expeditee.items.XRayable;
     
    599600                                int cmp = aArea.compareTo(bArea);
    600601                                if (cmp == 0) {
    601                                         return new Integer(a.getID()).compareTo(b.getID());
     602                                        //System.out.println(a.getEnclosureID() + " " + b.getID());
     603                                        return new Integer(a.getEnclosureID()).compareTo(b.getEnclosureID());
    602604                                }
    603605                                return cmp * -1;
     
    662664                        // For polygons need to make sure all other endpoints are
    663665                        // unHighlighted
    664                         changeHighlightMode(i, Item.HighlightMode.Normal,
    665                                         Item.HighlightMode.None);
     666                        if(i.hasPermission(Permission.full))
     667                                changeHighlightMode(i, Item.HighlightMode.Normal,
     668                                                Item.HighlightMode.None);
     669                        else
     670                                changeHighlightMode(i, Item.HighlightMode.Connected,
     671                                                Item.HighlightMode.Connected);
    666672                }
    667673                Repaint();
  • trunk/src/org/expeditee/gui/FrameKeyboardActions.java

    r130 r131  
    476476                        return;
    477477
    478                 String text = "";
    479 
    480                 List<String> lines = ((Text) on).getTextList();
    481                 for (String s : lines)
    482                         text += s + "\n";
    483                 // remove the last '\n'
    484                 text = text.substring(0, text.length() - 1);
    485 
     478                Text text = (Text)on;
     479                String string = text.copySelectedText();
     480               
     481                if(string.length() == 0)
     482                        string = text.getText();
     483               
    486484                // add the text of the item to the clipboard
    487                 StringSelection selection = new StringSelection(text);
     485                StringSelection selection = new StringSelection(string);
    488486                Toolkit.getDefaultToolkit().getSystemClipboard().setContents(selection,
    489487                                null);
     
    589587                                        List<Item> clipboard = new ArrayList<Item>();
    590588                                        clipboard.add(text);
    591                                         Collection<Item> left = FrameMouseActions.merge(clipboard,
     589                                        FrameMouseActions.merge(clipboard,
    592590                                                        clicked);
    593                                         FrameMouseActions.anchor(left);
     591                                        text.delete();
    594592                                } else {
    595593
     
    665663                        }
    666664                        copyItemToClipboard(current);
     665                        if(current instanceof Text && ((Text)current).hasSelection()){
     666                                ((Text)current).cutSelectedText();
     667                                ((Text)current).clearSelection();
     668                        }else{
    667669                        FrameMouseActions.delete(current);
     670                        }
    668671                        return;
    669672                } else if (key == KeyEvent.VK_M) {
  • trunk/src/org/expeditee/gui/FrameMouseActions.java

    r130 r131  
    387387
    388388                        if (depressTime < MINIMUM_RANGE_DEPRESS_TIME
    389                                         || lastRanged.getSelectedSize() <= 0) {// Text.MINIMUM_RANGED_CHARS)
     389                                        || lastRanged.getSelectionSize() <= 0) {// Text.MINIMUM_RANGED_CHARS)
    390390                                // {
    391391                                lastRanged.clearSelection();
     
    516516                                }
    517517                                // if the entire text is selected then pickup the item
    518                                 if (lastRanged.getSelectedSize() == lastRanged.getLength()) {
     518                                if (lastRanged.getSelectionSize() == lastRanged.getLength()) {
    519519                                        pickup(lastRanged);
    520520                                        lastRanged.clearSelection();
  • trunk/src/org/expeditee/items/Item.java

    r130 r131  
    760760
    761761        protected Color getPaintHighlightColor() {
     762                Color highlightColor = _highlightColor;
     763                if (getPaintBackgroundColor().equals(highlightColor))
     764                        highlightColor = ALTERNATE_HIGHLIGHT;
    762765                if (getParent() != null
    763                                 && getParent().getPaintBackgroundColor()
    764                                                 .equals(_highlightColor))
    765                         return getParent().getPaintForegroundColor();
    766 
    767                 return _highlightColor;
     766                                && getParent().getPaintBackgroundColor().equals(highlightColor))
     767                        highlightColor = getParent().getPaintForegroundColor();
     768
     769                return highlightColor;
    768770        }
    769771
     
    11111113
    11121114        public void setActionMark(boolean val) {
     1115                if (!val)
     1116                        invalidateCommonTrait(ItemAppearence.LinkChanged);
    11131117                _poly = null;
    11141118                _actionMark = val;
    1115                 invalidateCommonTrait(ItemAppearence.LinkChanged);
     1119                if (val)
     1120                        invalidateCommonTrait(ItemAppearence.LinkChanged);
    11161121        }
    11171122
     
    18911896                        invalidateCommonTrait(ItemAppearence.LinkChanged);
    18921897                }
    1893                 if(_actions == null || _actions.size() == 0) {
     1898                if (_actions == null || _actions.size() == 0) {
    18941899                        _poly = null;
    18951900                        _actions = new LinkedList<String>();
    1896                 }else{
     1901                } else {
    18971902                        _actions.clear();
    18981903                }
     
    20792084                return box.getWidth() * box.getHeight();
    20802085        }
     2086       
     2087        public int getEnclosureID(){
     2088                return _enclosure.hashCode();
     2089        }
    20812090
    20822091        /**
  • trunk/src/org/expeditee/items/Line.java

    r130 r131  
    2121import org.expeditee.gui.Frame;
    2222
     23import sun.misc.Perf.GetPerfAction;
     24
    2325/**
    2426 * Implements a line that is drawn on the screen. A line is represented as two
     
    494496
    495497        public Item getEndPointToDisconnect(int x, int y) {
     498                if(!hasPermission(Permission.full))
     499                        return null;
     500               
    496501                Item start = getStartItem();
    497502                Item end = getEndItem();
  • trunk/src/org/expeditee/items/Text.java

    r130 r131  
    490490        }
    491491
    492         public int getSelectedSize() {
     492        public int getSelectionSize() {
    493493                if (_selectionEnd < 0 || _selectionStart < 0)
    494494                        return 0;
     
    17601760                return ItemUtils.startsWithTag(this, "@ao") ||ItemUtils.startsWithTag(this, "@v");
    17611761        }
     1762
     1763        public boolean hasSelection() {
     1764                return getSelectionSize() > 0;
     1765        }
    17621766}
Note: See TracChangeset for help on using the changeset viewer.