Changeset 720
- Timestamp:
- 01/20/14 11:06:05 (10 years ago)
- Location:
- trunk/src/org/expeditee
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/gui/AttributeUtils.java
r707 r720 195 195 _Attrib.put("BorderColor", Item.class.getMethod("getBorderColor"), 196 196 Item.class.getMethod("setBorderColor", pColor)); 197 _Attrib.put("AnchorLeft", Item.class.getMethod("getAnchorLeft"), 198 Item.class.getMethod("setAnchorLeft", pFloatO)); 197 199 _Attrib.put("AnchorRight", Item.class.getMethod("getAnchorRight"), 198 200 Item.class.getMethod("setAnchorRight", pFloatO)); 201 _Attrib.put("AnchorTop", Item.class.getMethod("getAnchorTop"), 202 Item.class.getMethod("setAnchorTop", pFloatO)); 199 203 _Attrib.put("AnchorBottom", Item.class.getMethod("getAnchorBottom"), 200 204 Item.class.getMethod("setAnchorBottom", pFloatO)); … … 288 292 _Attrib.alias("s", "size"); 289 293 _Attrib.alias("l", "link"); 294 _Attrib.alias("at", "anchortop"); 290 295 _Attrib.alias("ab", "anchorbottom"); 296 _Attrib.alias("al", "anchorleft"); 291 297 _Attrib.alias("ar", "anchorright"); 292 298 _Attrib.alias("t", "thickness"); -
trunk/src/org/expeditee/gui/Frame.java
r717 r720 805 805 boolean bReparse = false; 806 806 for (Item i : getItems()) { 807 Float anchorLeft = i.getAnchorLeft(); 808 Float anchorRight = i.getAnchorRight(); 809 Float anchorTop = i.getAnchorTop(); 807 810 Float anchorBottom = i.getAnchorBottom(); 808 Float anchorRight = i.getAnchorRight(); 811 812 813 if (anchorLeft != null) { 814 i.setAnchorLeft(anchorLeft); 815 if (i.hasVector()) { 816 bReparse = true; 817 } 818 } 819 809 820 if (anchorRight != null) { 810 821 i.setAnchorRight(anchorRight); … … 813 824 } 814 825 } 826 827 if (anchorTop != null) { 828 i.setAnchorTop(anchorTop); 829 if (i.hasVector()) { 830 bReparse = true; 831 } 832 } 833 815 834 if (anchorBottom != null) { 816 835 i.setAnchorBottom(anchorBottom); -
trunk/src/org/expeditee/io/DefaultFrameReader.java
r676 r720 77 77 _ItemTags.put('K', Item.class.getMethod("setBorderColor", 78 78 pColor)); 79 80 _ItemTags.put('R', Item.class.getMethod("setAnchorLeft", pFloatO)); 79 81 _ItemTags.put('H', Item.class.getMethod("setAnchorRight", pFloatO)); 82 _ItemTags.put('N', Item.class.getMethod("setAnchorTop", pFloatO)); 80 83 _ItemTags.put('I', Item.class.getMethod("setAnchorBottom", pFloatO)); 84 81 85 _ItemTags.put('P', Item.class.getMethod("setPosition", pPoint)); 82 86 _ItemTags.put('F', Item.class.getMethod("setLink", pString)); -
trunk/src/org/expeditee/io/DefaultFrameWriter.java
r707 r720 71 71 _ItemTags.put("G", Item.class.getMethod("getBackgroundColor", param)); 72 72 _ItemTags.put("K", Item.class.getMethod("getBorderColor", param)); 73 74 _ItemTags.put("R", Item.class.getMethod("getAnchorLeft", param)); 73 75 _ItemTags.put("H", Item.class.getMethod("getAnchorRight", param)); 76 _ItemTags.put("N", Item.class.getMethod("getAnchorTop", param)); 74 77 _ItemTags.put("I", Item.class.getMethod("getAnchorBottom", param)); 78 75 79 _ItemTags.put("P", Item.class.getMethod("getPosition", param)); 76 80 _ItemTags.put("T", Text.class.getMethod("getText", param)); -
trunk/src/org/expeditee/items/Dot.java
r427 r720 61 61 62 62 @Override 63 public void setAnchorTop(Float anchor) { 64 if (!isLineEnd()) { 65 super.setAnchorTop(anchor); 66 return; 67 } 68 invalidateFill(); 69 invalidateCommonTrait(ItemAppearence.PreMoved); 70 int oldY = getY(); 71 if (anchor != null) { 72 float deltaY = anchor - oldY; 73 anchorConnected(AnchorEdgeType.Top, deltaY); 74 } 75 this._anchorTop = anchor; 76 this._anchorBottom = null; 77 invalidateCommonTrait(ItemAppearence.PostMoved); 78 invalidateFill(); 79 } 80 81 @Override 63 82 public void setAnchorBottom(Float anchor) { 64 83 if (!isLineEnd()) { … … 72 91 float deltaY = FrameGraphics.getMaxFrameSize().height - anchor 73 92 - getBoundsHeight() - oldY; 74 anchorConnected( null, deltaY);93 anchorConnected(AnchorEdgeType.Bottom, deltaY); 75 94 } 76 95 this._anchorBottom = anchor; 96 this._anchorTop = null; 97 invalidateCommonTrait(ItemAppearence.PostMoved); 98 invalidateFill(); 99 } 100 101 102 @Override 103 public void setAnchorLeft(Float anchor) { 104 if (!isLineEnd()) { 105 super.setAnchorLeft(anchor); 106 return; 107 } 108 invalidateFill(); 109 invalidateCommonTrait(ItemAppearence.PreMoved); 110 int oldX = getX(); 111 if (anchor != null) { 112 float deltaX = anchor - oldX; 113 114 anchorConnected(AnchorEdgeType.Left, deltaX); 115 } 116 this._anchorLeft = anchor; 117 this._anchorRight = null; 118 77 119 invalidateCommonTrait(ItemAppearence.PostMoved); 78 120 invalidateFill(); … … 92 134 - getBoundsWidth() - oldX; 93 135 94 anchorConnected( deltaX, null);136 anchorConnected(AnchorEdgeType.Right, deltaX); 95 137 } 96 138 this._anchorRight = anchor; 139 this._anchorLeft = null; 97 140 invalidateCommonTrait(ItemAppearence.PostMoved); 98 141 invalidateFill(); -
trunk/src/org/expeditee/items/Item.java
r711 r720 164 164 private static Item _tooltipOwner = null; 165 165 166 public enum AnchorEdgeType { 167 None, Left, Right, Top, Bottom 168 } 169 166 170 public static void DuplicateItem(Item source, Item dest) { 167 171 dest.setX(source.getX()); … … 212 216 * the user uses backspace to delete a text line end 213 217 */ 218 // dest._anchorLeft = source._anchorLeft; 219 // dest._anchorRight = source._anchorRight; 220 // dest._anchorTop = source._anchorTop; 214 221 // dest._anchorBottom = source._anchorBottom; 215 // dest._anchorRight = source._anchorRight;216 222 dest.setFormula(source.getFormula()); 217 223 dest._overlay = source._overlay; … … 276 282 } 277 283 284 protected Float _anchorLeft = null; 278 285 protected Float _anchorRight = null; 279 286 287 protected Float _anchorTop = null; 280 288 protected Float _anchorBottom = null; 281 289 … … 285 293 286 294 protected float _x; 287 288 295 protected float _y; 289 296 … … 2824 2831 } 2825 2832 2833 public void setAnchorLeft(Float anchor) { 2834 this._anchorLeft = anchor; 2835 this._anchorRight = null; 2836 if (anchor != null) { 2837 setX(anchor); 2838 } 2839 } 2840 2826 2841 public void setAnchorRight(Float anchor) { 2827 2842 this._anchorRight = anchor; 2843 this._anchorLeft = null; 2828 2844 if (anchor != null) 2829 2845 setX(FrameGraphics.getMaxFrameSize().width - anchor … … 2831 2847 } 2832 2848 2849 public void setAnchorTop(Float anchor) { 2850 this._anchorTop = anchor; 2851 this._anchorBottom = null; 2852 if (anchor != null) 2853 setY(anchor); 2854 } 2855 2856 2857 public void setAnchorBottom(Float anchor) { 2858 this._anchorBottom = anchor; 2859 this._anchorTop = null; 2860 if (anchor != null) 2861 setY(FrameGraphics.getMaxFrameSize().height - anchor); 2862 } 2863 2864 2865 public Float getAnchorLeft() { 2866 return _anchorLeft; 2867 } 2868 2833 2869 public Float getAnchorRight() { 2834 2870 return _anchorRight; 2835 2871 } 2836 2872 2837 public void setAnchorBottom(Float anchor) { 2838 this._anchorBottom = anchor; 2839 if (anchor != null) 2840 setY(FrameGraphics.getMaxFrameSize().height - anchor); 2873 public Float getAnchorTop() { 2874 return _anchorTop; 2841 2875 } 2842 2876 … … 2898 2932 } 2899 2933 2900 protected void anchorConnected (Float deltaX, Float deltaY) {2934 protected void anchorConnectedRefactored(AnchorEdgeType anchorEdgeType, Float delta) { 2901 2935 // Check for a more efficient way to do this!! 2902 2936 // Invalidate all the items … … 2907 2941 for (Item i : this.getAllConnected()) { 2908 2942 if (i.isLineEnd()) { 2909 if (deltaX != null) { 2910 i.setAnchorRight(null); 2911 i.setXY(i.getX() + deltaX, i.getY()); 2912 } 2913 if (deltaY != null) { 2914 i.setAnchorBottom(null); 2915 i.setXY(i.getX(), i.getY() + deltaY); 2943 if (delta != null) { 2944 if ((anchorEdgeType == AnchorEdgeType.Left) || (anchorEdgeType == AnchorEdgeType.Right)) { 2945 // 'delta' encodes a horizontal (x) move 2946 if (anchorEdgeType == AnchorEdgeType.Left) { 2947 i.setAnchorLeft(null); 2948 } 2949 else { 2950 // must be Right 2951 i.setAnchorRight(null); 2952 } 2953 2954 i.setXY(i.getX() + delta, i.getY()); 2955 } 2956 if ((anchorEdgeType == AnchorEdgeType.Top) || (anchorEdgeType == AnchorEdgeType.Bottom)) { 2957 // 'delta; encodes a vertical (y) move 2958 if (anchorEdgeType == AnchorEdgeType.Top) { 2959 i.setAnchorTop(null); 2960 } 2961 else { 2962 // must be Bottom 2963 i.setAnchorBottom(null); 2964 } 2965 i.setXY(i.getX(), i.getY() + delta); 2966 } 2967 2916 2968 } 2917 2969 } … … 2924 2976 } 2925 2977 2978 2979 protected void anchorConnected(AnchorEdgeType anchorEdgeType, Float delta) { 2980 // Check for a more efficient way to do this!! 2981 // Invalidate all the items 2982 for (Item i : this.getAllConnected()) { 2983 i.invalidateAll(); 2984 } 2985 2986 // Move the items 2987 for (Item i : this.getAllConnected()) { 2988 if (i.isLineEnd()) { 2989 if (delta != null) { 2990 if ((anchorEdgeType == AnchorEdgeType.Left) || (anchorEdgeType == AnchorEdgeType.Right)) { 2991 // 'delta' encodes a horizontal (x) move 2992 if (anchorEdgeType == AnchorEdgeType.Left) { 2993 // Processing a Left anchor 2994 // => Anything connected that is *not* anchored to the right should be moved by 'delta' 2995 if (i.getAnchorRight()==null) { 2996 i.setXY(i.getX() + delta, i.getY()); 2997 } 2998 } 2999 else { 3000 // Processing a Right anchor 3001 // => Anything connected that is *not* anchored to the left should be moved by 'delta' 3002 if (i.getAnchorLeft()==null) { 3003 i.setXY(i.getX() + delta, i.getY()); 3004 } 3005 } 3006 3007 } 3008 if ((anchorEdgeType == AnchorEdgeType.Top) || (anchorEdgeType == AnchorEdgeType.Bottom)) { 3009 // 'delta; encodes a vertical (y) move 3010 if (anchorEdgeType == AnchorEdgeType.Top) { 3011 // Processing a Top anchor 3012 // => Anything connected that is *not* anchored to the bottom should be moved by 'delta' 3013 if (i.getAnchorBottom()==null) { 3014 i.setXY(i.getX(), i.getY() + delta); 3015 } 3016 } 3017 else { 3018 // Processing a Bottom anchor 3019 // => Anything connected that is *not* anchored to the top should be moved by 'delta' 3020 if (i.getAnchorTop()==null) { 3021 // must be Bottom 3022 i.setAnchorBottom(null); 3023 } 3024 } 3025 } 3026 } 3027 } 3028 } 3029 3030 // Invalidate them again!! 3031 for (Item i : this.getAllConnected()) { 3032 i.updatePolygon(); 3033 i.invalidateAll(); 3034 } 3035 } 2926 3036 /** 2927 3037 * Sets the item to pickup when the user attempts to pick this item up. -
trunk/src/org/expeditee/items/Text.java
r669 r720 2397 2397 2398 2398 @Override 2399 public void setAnchorLeft(Float anchor) { 2400 if (!isLineEnd()) { 2401 super.setAnchorLeft(anchor); 2402 // Subtract off the link width 2403 if (anchor != null) { 2404 setX(anchor + getLeftMargin()); 2405 } 2406 return; 2407 } 2408 invalidateFill(); 2409 invalidateCommonTrait(ItemAppearence.PreMoved); 2410 int oldX = getX(); 2411 if (anchor != null) { 2412 float deltaX = anchor + getLeftMargin() - oldX; 2413 anchorConnected(AnchorEdgeType.Left, deltaX); 2414 } 2415 this._anchorLeft = anchor; 2416 this._anchorRight = null; 2417 invalidateCommonTrait(ItemAppearence.PostMoved); 2418 invalidateFill(); 2419 } 2420 2421 @Override 2399 2422 public void setAnchorRight(Float anchor) { 2400 2423 if (!isLineEnd()) { … … 2413 2436 float deltaX = FrameGraphics.getMaxFrameSize().width - anchor 2414 2437 - getBoundsWidth() + getLeftMargin() - oldX; 2415 anchorConnected( deltaX, null);2438 anchorConnected(AnchorEdgeType.Right, deltaX); 2416 2439 } 2417 2440 this._anchorRight = anchor; 2441 this._anchorLeft = null; 2442 invalidateCommonTrait(ItemAppearence.PostMoved); 2443 invalidateFill(); 2444 } 2445 2446 2447 2448 @Override 2449 public void setAnchorTop(Float anchor) { 2450 if (!isLineEnd()) { 2451 super.setAnchorTop(anchor); 2452 if (anchor != null) { 2453 setY(anchor + getBoundsHeight()); 2454 } 2455 return; 2456 } 2457 invalidateFill(); 2458 invalidateCommonTrait(ItemAppearence.PreMoved); 2459 int oldY = getY(); 2460 if (anchor != null) { 2461 float deltaY = anchor - oldY; 2462 anchorConnected(AnchorEdgeType.Top, deltaY); 2463 } 2464 this._anchorTop = anchor; 2465 this._anchorBottom = null; 2418 2466 invalidateCommonTrait(ItemAppearence.PostMoved); 2419 2467 invalidateFill(); … … 2430 2478 int oldY = getY(); 2431 2479 if (anchor != null) { 2480 2432 2481 float deltaY = FrameGraphics.getMaxFrameSize().height - anchor 2433 2482 - oldY; 2434 anchorConnected( null, deltaY);2483 anchorConnected(AnchorEdgeType.Bottom, deltaY); 2435 2484 } 2436 2485 this._anchorBottom = anchor; 2486 this._anchorTop = null; 2437 2487 invalidateCommonTrait(ItemAppearence.PostMoved); 2438 2488 invalidateFill(); -
trunk/src/org/expeditee/items/XRayable.java
r707 r720 135 135 136 136 @Override 137 public Float getAnchorLeft() { 138 return _source.getAnchorLeft(); 139 } 140 141 @Override 142 public Float getAnchorRight() { 143 return _source.getAnchorRight(); 144 } 145 146 @Override 147 public Float getAnchorTop() { 148 return _source.getAnchorTop(); 149 } 150 151 @Override 137 152 public Float getAnchorBottom() { 138 153 return _source.getAnchorBottom(); 139 154 } 140 155 141 @Override142 public Float getAnchorRight() {143 return _source.getAnchorRight();144 }145 156 146 157 @Override … … 235 246 236 247 @Override 248 public void setAnchorTop(Float anchor) { 249 _source.setAnchorTop(anchor); 250 if (anchor != null) 251 _source.setY(anchor + getHeight()); 252 } 253 254 @Override 237 255 public void setAnchorBottom(Float anchor) { 238 256 _source.setAnchorBottom(anchor); … … 240 258 _source.setY(FrameGraphics.getMaxFrameSize().height - getHeight() - anchor); 241 259 } 242 260 261 262 @Override 263 public void setAnchorLeft(Float anchor) { 264 _source.setAnchorLeft(anchor); 265 } 266 243 267 @Override 244 268 public void setAnchorRight(Float anchor) { -
trunk/src/org/expeditee/items/widgets/InteractiveWidget.java
r626 r720 1705 1705 } 1706 1706 1707 public void setAnchorTop(Float anchor) { 1708 setPosition(getX(),Math.round(anchor)); 1709 getSource().setAnchorTop(anchor); 1710 } 1711 1707 1712 public void setAnchorBottom(Float anchor) { 1708 1713 setPosition(getX(), 1709 1714 Math.round(FrameGraphics.getMaxFrameSize().height - anchor - getHeight())); 1710 1715 getSource().setAnchorBottom(anchor); 1711 1716 } 1712 1717 1718 public void setAnchorLeft(Float anchor) { 1719 setPosition(Math.round(anchor), 1720 getY()); 1721 getSource().setAnchorLeft(anchor); 1722 } 1723 1713 1724 public void setAnchorRight(Float anchor) { 1714 setPosition( 1715 Math.round(FrameGraphics.getMaxFrameSize().width - anchor - getWidth()), 1716 getY()); 1725 setPosition(Math.round(FrameGraphics.getMaxFrameSize().width - anchor - getWidth()), 1726 getY()); 1717 1727 getSource().setAnchorRight(anchor); 1718 1728 } -
trunk/src/org/expeditee/items/widgets/WidgetCorner.java
r474 r720 150 150 151 151 @Override 152 public void setAnchorTop(Float anchor) { 153 _widgetSource.setAnchorTop(anchor); 154 } 155 156 @Override 152 157 public void setAnchorBottom(Float anchor) { 153 158 _widgetSource.setAnchorBottom(anchor); … … 155 160 156 161 @Override 162 public void setAnchorLeft(Float anchor) { 163 _widgetSource.setAnchorLeft(anchor); 164 } 165 166 @Override 157 167 public void setAnchorRight(Float anchor) { 158 168 _widgetSource.setAnchorRight(anchor); … … 160 170 161 171 @Override 172 public Float getAnchorTop() { 173 return _widgetSource.getSource().getAnchorTop(); 174 } 175 176 @Override 162 177 public Float getAnchorBottom() { 163 178 return _widgetSource.getSource().getAnchorBottom(); 179 } 180 181 @Override 182 public Float getAnchorLeft() { 183 return _widgetSource.getSource().getAnchorLeft(); 164 184 } 165 185 -
trunk/src/org/expeditee/items/widgets/WidgetEdge.java
r474 r720 103 103 104 104 @Override 105 public void setAnchorTop(Float anchor) { 106 _widgetSource.setAnchorTop(anchor); 107 } 108 109 @Override 105 110 public void setAnchorBottom(Float anchor) { 106 111 _widgetSource.setAnchorBottom(anchor); … … 108 113 109 114 @Override 115 public void setAnchorLeft(Float anchor) { 116 _widgetSource.setAnchorLeft(anchor); 117 } 118 119 @Override 110 120 public void setAnchorRight(Float anchor) { 111 121 _widgetSource.setAnchorRight(anchor); … … 113 123 114 124 @Override 125 public Float getAnchorTop() { 126 return _widgetSource.getSource().getAnchorTop(); 127 } 128 129 @Override 115 130 public Float getAnchorBottom() { 116 131 return _widgetSource.getSource().getAnchorBottom(); 117 132 } 118 133 134 @Override 135 public Float getAnchorLeft() { 136 return _widgetSource.getSource().getAnchorLeft(); 137 } 138 119 139 @Override 120 140 public Float getAnchorRight() {
Note:
See TracChangeset
for help on using the changeset viewer.