Changeset 286 for trunk/src/org/expeditee/gui/FrameMouseActions.java
- Timestamp:
- 08/29/08 08:17:54 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/gui/FrameMouseActions.java
r284 r286 2 2 3 3 import java.awt.Point; 4 import java.awt.Rectangle; 4 5 import java.awt.event.ActionEvent; 5 6 import java.awt.event.ActionListener; … … 10 11 import java.awt.event.MouseWheelEvent; 11 12 import java.awt.event.MouseWheelListener; 13 import java.text.NumberFormat; 12 14 import java.util.ArrayList; 13 15 import java.util.Collection; … … 683 685 // check item permissions 684 686 if (!clicked.hasPermission(Permission.followLinks)) { 685 MessageBay 686 .displayMessage("Insufficient permissions to perform action on item"); 687 return; 687 Item editTarget = clicked.getEditTarget(); 688 if (editTarget != clicked 689 && editTarget.hasPermission(Permission.followLinks)) { 690 clicked = editTarget; 691 } else { 692 MessageBay 693 .displayMessage("Insufficient permission to perform action on item"); 694 return; 695 } 688 696 } 689 697 … … 869 877 // check permissions 870 878 if (!clicked.hasPermission(Permission.full)) { 871 MessageBay 872 .displayMessage("Insufficient permission to pick up item"); 873 return; 879 Item editTarget = clicked.getEditTarget(); 880 if (editTarget != clicked 881 && editTarget.hasPermission(Permission.full)) { 882 clicked = editTarget; 883 } else { 884 MessageBay 885 .displayMessage("Insufficient permission to pick up item"); 886 return; 887 } 874 888 } 875 889 … … 1250 1264 } 1251 1265 } else if (!clicked.hasPermission(Permission.copy)) { 1252 MessageBay 1253 .displayMessage("Insufficient permission to copy"); 1254 return; 1266 Item editTarget = clicked.getEditTarget(); 1267 if (editTarget != clicked 1268 && editTarget.hasPermission(Permission.copy)) { 1269 clicked = editTarget; 1270 } else { 1271 MessageBay 1272 .displayMessage("Insufficient permission to copy"); 1273 return; 1274 } 1255 1275 } 1256 1276 … … 1548 1568 1549 1569 private static boolean _controlDown; 1550 1570 1551 1571 public static boolean isControlDown() { 1552 1572 return _controlDown; … … 1596 1616 MouseX = e.getX(); 1597 1617 MouseY = e.getY(); 1598 // System.out.println(MouseX + "," + MouseY);1618 // System.out.println(MouseX + "," + MouseY); 1599 1619 1600 1620 // Moving the mouse a certain distance removes the last edited text if … … 1813 1833 // Item.SelectedMode.Connected); 1814 1834 // TODO: The method below is for the most part redundant 1815 on = FrameGraphics.Highlight(on );1835 on = FrameGraphics.Highlight(on.getEditTarget()); 1816 1836 } 1817 1837 // if the last item highlighted is still highlighted, clear it … … 2001 2021 */ 2002 2022 public static boolean tdfc(Item linker) throws RuntimeException { 2003 // if (linker instanceof Line)2004 // return false;2005 2006 2023 // if this is a non-usable item 2007 2024 if (linker.getID() < 0) 2008 2025 return false; 2026 2027 // Check if its an image that can be resized to fit a box 2028 // around it 2029 String text = linker.getText(); 2030 if (text.equals("@v") || text.equals("@f")) { 2031 Collection<Item> enclosure = FrameUtils.getEnclosingLineEnds(linker 2032 .getPosition()); 2033 if (enclosure != null) { 2034 for (Item i : enclosure) { 2035 if (i.isLineEnd() && i.isEnclosed()) { 2036 DisplayIO.getCurrentFrame().removeAllItems(enclosure); 2037 Rectangle rect = i.getEnclosedRectangle(); 2038 long width = Math.round(rect.getWidth()); 2039 if (text.equals("@v")) { 2040 NumberFormat nf = Vector.getNumberFormatter(); 2041 linker.setText("@v: " 2042 + nf.format((width / FrameGraphics 2043 .getMaxFrameSize().getWidth()))); 2044 } else { 2045 linker.setText("@f: " + width); 2046 } 2047 2048 linker.setPosition(new Point(rect.x, rect.y)); 2049 linker.setThickness(i.getThickness()); 2050 linker.setBorderColor(i.getColor()); 2051 break; 2052 } 2053 } 2054 FrameMouseActions.deleteItems(enclosure, false); 2055 } 2056 } 2009 2057 2010 2058 boolean mouseMoved; … … 2178 2226 // check permissions 2179 2227 if (!toDelete.hasPermission(Permission.full)) { 2180 MessageBay 2181 .displayMessage("Insufficient permission to delete item"); 2182 return; 2228 Item editTarget = toDelete.getEditTarget(); 2229 if (editTarget != toDelete 2230 && editTarget.hasPermission(Permission.full)) { 2231 toDelete = editTarget; 2232 } else { 2233 MessageBay 2234 .displayMessage("Insufficient permission to delete item"); 2235 return; 2236 } 2183 2237 } 2184 2238 … … 2532 2586 2533 2587 if (!toGrab.hasPermission(Permission.full)) { 2534 MessageBay 2535 .displayMessage("Insufficient permission pickup the item"); 2588 if (toGrab.getEditTarget() != toGrab) { 2589 pickup(toGrab.getEditTarget()); 2590 } else { 2591 MessageBay 2592 .displayMessage("Insufficient permission pickup the item"); 2593 } 2536 2594 return; 2537 2595 } … … 2539 2597 if (toGrab instanceof Circle) 2540 2598 toGrab.setHighlightMode(HighlightMode.Connected); 2541 else 2599 //Dont set the highlight mode if a vector is being picked up 2600 else if(toGrab.isVisible()){ 2542 2601 toGrab.setHighlightMode(HighlightMode.Normal); 2602 } 2543 2603 2544 2604 // Brook: If the widget corner is being picked up. Instead refer to … … 2559 2619 2560 2620 public static void pickup(Collection<Item> toGrab) { 2561 if (toGrab == null || toGrab.size() == 0)2621 if (toGrab == null || toGrab.size() == 0) 2562 2622 return; 2563 2623 2564 2624 boolean bReparse = false; 2565 2625 Frame frame = DisplayIO.getCurrentFrame(); … … 2594 2654 for (Item copy : copies) { 2595 2655 FreeItems.getInstance().add(copy); 2656 copy.setEditTarget(i); 2596 2657 copy.setFloating(true); 2597 2658 copy.setParent(null); 2659 //copy.setHighlightMode(HighlightMode.Connected); 2598 2660 } 2599 2661 } … … 2636 2698 } else { 2637 2699 MessageBay 2638 .displayMessage("Insufficient permission pickup the items");2700 .displayMessage("Insufficient permission to pickup the items"); 2639 2701 } 2640 2702 if (bReparse)
Note:
See TracChangeset
for help on using the changeset viewer.