Changeset 116
- Timestamp:
- 07/02/08 17:26:51 (16 years ago)
- Location:
- trunk/src/org/expeditee
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/actions/Simple.java
r115 r116 323 323 // an item without a link signals to run the current frame 324 324 if (current.getLink() == null) { 325 // Make a copy but hide it325 // Make a copy but hide it 326 326 current = current.copy(); 327 327 current.setLink(DisplayIO.getCurrentFrame().getName()); … … 352 352 */ 353 353 public static void DebugFrame(Text current, float pause, Color color) { 354 if (isProgramRunning()){354 if (isProgramRunning()) { 355 355 stop(); 356 356 } … … 412 412 context.getPointers().setObject(SPointer.framePrefix + varName, 413 413 frame); 414 context.getPointers().setObject(SPointer.itemPrefix + varName, 415 frame.getTitleItem()); 414 416 context.getPrimitives().add(SString.prefix + varName, 415 417 new SString(frame.getName())); … … 481 483 if (_step) { 482 484 DisplayIO.removeFromBack(); 483 if (DisplayIO.getCurrentFrame() != current.getParent())485 if (DisplayIO.getCurrentFrame() != current.getParent()) 484 486 DisplayIO.setCurrentFrame(current.getParent()); 485 487 } … … 766 768 // Check if the user wants to display a message 767 769 // Check for set statements 770 } else if (tokens[0].startsWith("search")) { 771 if (tokens[0].equals("searchstr")) { 772 assertExactParametreCount(tokens, 5); 773 String searchStr = context.getPrimitives().getStringValue( 774 tokens[1]); 775 String pattern = context.getPrimitives().getStringValue( 776 tokens[2]); 777 String[] result = searchStr.split(pattern, 2); 778 boolean bFound = result.length > 1; 779 context.getPrimitives().setValue(tokens[3], 780 new SBoolean(bFound)); 781 if (bFound) { 782 context.getPrimitives().setValue(tokens[4], 783 new SInteger(result[0].length() + 1)); 784 context.getPrimitives().setValue(tokens[5], 785 new SInteger(searchStr.length() - result[1].length())); 786 } 787 }else if (tokens[0].equals("searchitem")) { 788 assertExactParametreCount(tokens, 5); 789 assertVariableType(tokens[1], 1, SPointer.itemPrefix); 790 Text searchItem = (Text)context.getPointers().getVariable(tokens[1]).getValue(); 791 String searchStr = searchItem.getText(); 792 String pattern = context.getPrimitives().getStringValue( 793 tokens[2]); 794 String[] result = searchStr.split(pattern, 2); 795 boolean bFound = result.length > 1; 796 context.getPrimitives().setValue(tokens[3], 797 new SBoolean(bFound)); 798 if (bFound) { 799 // context.getPrimitives().setValue(tokens[4], 800 // new SInteger(1)); 801 context.getPrimitives().setValue(tokens[4], 802 new SInteger(result[0].length() + 1)); 803 // context.getPrimitives().setValue(tokens[6], 804 // new SInteger(1)); 805 context.getPrimitives().setValue(tokens[5], 806 new SInteger(searchStr.length() - result[1].length())); 807 } 808 } 768 809 } else if (tokens[0].startsWith("set")) { 769 810 if (tokens[0].equals("set")) { … … 794 835 assertExactParametreCount(tokens, 3); 795 836 796 Map<String, String> map = (Map<String,String>) context.getPointers().getVariable(tokens[1])797 .get Value();837 Map<String, String> map = (Map<String, String>) context 838 .getPointers().getVariable(tokens[1]).getValue(); 798 839 String attribute = context.getPrimitives().getStringValue( 799 840 tokens[2]); -
trunk/src/org/expeditee/gui/DisplayIO.java
r115 r116 60 60 * The title to display in the Title bar. 61 61 */ 62 public static final String TITLE = "Exp 28Jun2008A";62 public static final String TITLE = "Exp02Jul2008A"; 63 63 64 64 private DisplayIO() { -
trunk/src/org/expeditee/gui/Frame.java
r115 r116 750 750 public void undo() { 751 751 Item undo = null; 752 boolean bReparse = false; 752 753 753 754 if (_undo.size() <= 0) … … 755 756 756 757 undo = _undo.pop(); 757 758 758 759 // if the change was to characteristics 759 760 if (undo.isVisible() && _body.contains(undo)) { … … 786 787 787 788 for (Item i : toRestore) { 789 bReparse |= i.hasOverlay(); 788 790 if (i instanceof Line) { 789 791 Line line = (Line) i; … … 798 800 change(); 799 801 FrameMouseActions.getInstance().refreshHighlights(); 802 if(bReparse) 803 FrameUtils.Parse(this, false); 800 804 FrameGraphics.Repaint(); 801 805 ItemUtils.EnclosedCheck(_body); -
trunk/src/org/expeditee/gui/FrameMouseActions.java
r115 r116 2073 2073 updateCursor(); 2074 2074 ItemUtils.EnclosedCheck(current.getItems()); 2075 if (toDelete.hasOverlay()) 2076 FrameUtils.Parse(current, false); 2075 2077 FrameGraphics.Repaint(); 2076 2078 } … … 2080 2082 2081 2083 private static void deleteItems(Collection<Item> itemList) { 2084 boolean bReparse = false; 2082 2085 SessionStats.DeletedItems(itemList); 2083 2086 List<Frame> modifiedFrames = new LinkedList<Frame>(); … … 2088 2091 modifiedFrames.add(parent); 2089 2092 i.setHighlightMode(HighlightMode.None); 2093 bReparse |= i.hasOverlay(); 2090 2094 } 2091 2095 // If they are all free items then add the current frame … … 2119 2123 // TODO: How should undelete deal with undo when items are removed from 2120 2124 // the current frame as well as the overlay frame 2121 DisplayIO.getCurrentFrame().addAllToUndo(itemList); 2125 Frame currentFrame = DisplayIO.getCurrentFrame(); 2126 currentFrame.addAllToUndo(itemList); 2122 2127 itemList.clear(); 2128 if (bReparse) 2129 FrameUtils.Parse(currentFrame, false); 2130 2123 2131 } 2124 2132 … … 2374 2382 2375 2383 public static void pickup(Collection<Item> toGrab) { 2376 2384 boolean bReparse = false; 2377 2385 String currentFrame = DisplayIO.getCurrentFrame().getName(); 2378 2386 Iterator<Item> iter = toGrab.iterator(); … … 2396 2404 Frame.FreeItems.add(i); 2397 2405 i.setFloating(true); 2406 if (i.hasVector()) { 2407 bReparse = true; 2408 // Frame overlayFrame = FrameIO.LoadFrame(i.getAbsoluteLink()); 2409 // Collection<Item> copies = ItemUtils.CopyItems(overlayFrame 2410 // .getNonAnnotationItems(), i.getVector()); 2411 // Frame.FreeItems.addAll(copies); 2412 // TODO add the copies to the free items so they are visible 2413 // when the cursor is moving around but are not anchored 2414 } 2398 2415 } 2399 2416 _lastHighlightedItem = null; … … 2434 2451 .DisplayMessage("Insufficient permission pickup the items"); 2435 2452 } 2453 if (bReparse) 2454 FrameUtils.Parse(DisplayIO.getCurrentFrame(), false); 2455 2436 2456 FrameGraphics.Repaint(); 2437 2457 } … … 2487 2507 2488 2508 public static void anchor(Collection<Item> toAnchor) { 2509 boolean bReparse = false; 2489 2510 // Need to make sure we check enclosure for overlays etc 2490 2511 Set<Frame> checkEnclosure = new HashSet<Frame>(); … … 2492 2513 anchor(i, false); 2493 2514 checkEnclosure.add(i.getParentOrCurrentFrame()); 2515 bReparse |= i.hasOverlay(); 2494 2516 } 2495 2517 toAnchor.clear(); … … 2498 2520 ItemUtils.EnclosedCheck(f.getItems()); 2499 2521 } 2522 if (bReparse) 2523 FrameUtils.Parse(DisplayIO.getCurrentFrame(), false); 2500 2524 FrameGraphics.Repaint(); 2501 2525 } -
trunk/src/org/expeditee/gui/FrameUtils.java
r115 r116 889 889 } catch (Exception e) { 890 890 } 891 vectors.add(new Vector(vector, vectorPermission, i891 Vector newVector = new Vector(vector, vectorPermission, i 892 892 .getPosition(), scale, i.getColor(), i 893 .getBackgroundColor())); 893 .getBackgroundColor()); 894 i.setOverlay(newVector); 895 vectors.add(newVector); 894 896 } 895 897 } … … 946 948 // If it wasnt in the list create it and add it. 947 949 if (!found) { 948 overlays.add(new Overlay(overlay, 949 permissionLevel)); 950 Overlay newOverlay = new Overlay(overlay, 951 permissionLevel); 952 i.setOverlay(newOverlay); 953 overlays.add(newOverlay); 950 954 } 951 955 } -
trunk/src/org/expeditee/items/Item.java
r115 r116 29 29 import org.expeditee.gui.FrameIO; 30 30 import org.expeditee.gui.FrameUtils; 31 import org.expeditee.gui.Overlay; 32 import org.expeditee.gui.Vector; 31 33 import org.expeditee.io.Conversion; 32 34 import org.expeditee.io.Logger; … … 114 116 new Color(150, 150, 255), new Color(150, 255, 150), 115 117 new Color(255, 150, 255), new Color(255, 255, 100), Color.WHITE, 116 Color.BLACK}; 117 /* Color.GRAY, 118 * Color.DARK_GRAY, 119 */ 118 Color.BLACK }; 119 120 /* 121 * Color.GRAY, Color.DARK_GRAY, 122 */ 120 123 121 124 public static final int UNCHANGED_CURSOR = -100; … … 236 239 237 240 public Permission _permission = Permission.full; 238 239 public void setPermission(Permission permission) {241 242 public void setPermission(Permission permission) { 240 243 _permission = permission; 241 244 } 242 243 public boolean hasPermission(Permission permission) {245 246 public boolean hasPermission(Permission permission) { 244 247 return _permission.ordinal() >= permission.ordinal(); 245 248 } … … 315 318 } 316 319 317 if (_actions == null) {320 if (_actions == null) { 318 321 _poly = null; 319 322 _actions = new LinkedList<String>(); … … 931 934 Color fillColor = getFillColor(); 932 935 if (fillColor != null && getEnclosingDots() != null) { 933 if(isFloating()){ 934 //TODO experiment with adding alpha when picking up filled items... 935 //Slows things down quite alot!! 936 fillColor = new Color(fillColor.getRed(), fillColor.getGreen(), fillColor.getBlue()); 937 } 936 if (isFloating()) { 937 // TODO experiment with adding alpha when picking up filled 938 // items... 939 // Slows things down quite alot!! 940 fillColor = new Color(fillColor.getRed(), fillColor.getGreen(), 941 fillColor.getBlue()); 942 } 938 943 g.setColor(fillColor); 939 944 // The painting is not efficient enough for gradients... … … 1039 1044 // Check if all the characters are digits and hence it is a relative 1040 1045 // link 1041 if (!FrameIO.isPositiveInteger(link))1046 if (!FrameIO.isPositiveInteger(link)) 1042 1047 return; 1043 1048 … … 1054 1059 1055 1060 /** 1056 * Sets any action code that should be associated with 1057 * this Item Each entryin the list is one line of code1061 * Sets any action code that should be associated with this Item Each entry 1062 * in the list is one line of code 1058 1063 * 1059 1064 * @param actions … … 1061 1066 */ 1062 1067 public void setActions(List<String> actions) { 1063 //Want to resize the highlight box for text items if actions have been added 1068 // Want to resize the highlight box for text items if actions have been 1069 // added 1064 1070 _poly = null; 1065 1071 if (actions == null || actions.size() == 0) … … 1420 1426 return; 1421 1427 assert (_parent != null); 1422 1423 if (FrameIO.isPositiveInteger(link))1428 1429 if (FrameIO.isPositiveInteger(link)) 1424 1430 return; 1425 1431 1426 1432 // Check if the link is for the current frameset 1427 1433 if (_parent.getFramesetName().equalsIgnoreCase( … … 1440 1446 /** 1441 1447 * Sets the thickness of the item. 1448 * 1442 1449 * @param thick 1443 1450 */ 1444 public void setThickness(float thick) {1451 public void setThickness(float thick) { 1445 1452 setThickness(thick, true); 1446 1453 } 1447 1454 1448 1455 /** 1449 1456 * Sets the thickness of this item. 1450 * @param thick the new thickness for the item 1451 * @param setConnectedThickness true if all items connected to this item should also have their thickness set 1457 * 1458 * @param thick 1459 * the new thickness for the item 1460 * @param setConnectedThickness 1461 * true if all items connected to this item should also have 1462 * their thickness set 1452 1463 */ 1453 1464 public void setThickness(float thick, boolean setConnectedThickness) { … … 1555 1566 this._visible = !state; 1556 1567 } 1557 1558 1568 1559 1569 public void setVisible(boolean state) { … … 1700 1710 return _lines.size() > 0; 1701 1711 } 1702 1703 public boolean hasEnclosures() {1712 1713 public boolean hasEnclosures() { 1704 1714 return _enclosures.size() > 0; 1705 1715 } … … 1759 1769 1760 1770 public void setAction(String string) { 1761 //Want to resize the highlight box for text items if actions are been added 1762 if(_actions == null || _actions.size() == 0){ 1771 // Want to resize the highlight box for text items if actions are been 1772 // added 1773 if (_actions == null || _actions.size() == 0) { 1763 1774 _poly = null; 1764 1775 } … … 1857 1868 // if parent is null it is an item on the message box 1858 1869 // so it must already be absolute 1859 // assert (!FrameIO.isPositiveInteger(link));1860 // return link;1861 1870 // assert (!FrameIO.isPositiveInteger(link)); 1871 // return link; 1872 1862 1873 } 1863 1874 … … 1961 1972 * @param ratio 1962 1973 */ 1963 public void translate(Point2D origin, double ratio) { 1974 public void translate(Point2D origin, double ratio) { 1964 1975 _x = (float) (origin.getX() + ratio * (_x - origin.getX())); 1965 1976 _y = (float) (origin.getY() + ratio * (_y - origin.getY())); … … 2003 2014 private boolean _deleted = false; 2004 2015 2016 private Overlay _overlay = null; 2017 2005 2018 /** 2006 2019 * For now there can only be one enclosure per item 2020 * 2007 2021 * @param enclosure 2008 2022 */ … … 2024 2038 return _deleted; 2025 2039 } 2040 2041 public boolean hasVector() { 2042 return _overlay instanceof Vector; 2043 } 2044 2045 public boolean hasOverlay() { 2046 return _overlay != null; 2047 } 2048 2049 public Vector getVector() { 2050 if (_overlay instanceof Vector) 2051 return (Vector) _overlay; 2052 return null; 2053 } 2054 2055 public void setOverlay(Overlay overlay) { 2056 _overlay = overlay; 2057 } 2026 2058 } -
trunk/src/org/expeditee/items/Text.java
r115 r116 1717 1717 return c== '*' || c == '+' || c == '>' || c == '-' || c == 'o'; 1718 1718 } 1719 1720 public boolean hasOverlay() { 1721 if(!isAnnotation() || getLink()==null) 1722 return false; 1723 return ItemUtils.startsWithTag(this, "@ao") ||ItemUtils.startsWithTag(this, "@v"); 1724 } 1719 1725 }
Note:
See TracChangeset
for help on using the changeset viewer.