Changeset 154
- Timestamp:
- 07/22/08 10:05:32 (16 years ago)
- Location:
- trunk/src/org/expeditee
- Files:
-
- 1 added
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/actions/Actions.java
r143 r154 19 19 import org.expeditee.gui.DisplayIO; 20 20 import org.expeditee.gui.Frame; 21 import org.expeditee.gui.FrameGraphics; 21 22 import org.expeditee.gui.FrameIO; 22 23 import org.expeditee.gui.FrameUtils; … … 470 471 Logger.Log(e); 471 472 } 473 FrameGraphics.refresh(false); 472 474 473 475 return; -
trunk/src/org/expeditee/actions/Misc.java
r140 r154 103 103 String errorMessage = "Error deleting " + deletedFrame; 104 104 try { 105 if (FrameIO.DeleteFrame(toDelete)) { 105 String deletedFrameName = FrameIO.DeleteFrame(toDelete); 106 if (deletedFrameName != null) { 107 DisplayIO.Back(); 108 //Remove any links on the previous frame to the one being deleted 106 109 Frame current = DisplayIO.getCurrentFrame(); 107 110 for (Item i : current.getItems()) … … 111 114 i.setLink(null); 112 115 } 113 DisplayIO.Back();114 FrameGraphics.Repaint();115 MessageBay.displayMessage(deletedFrame + " deleted");116 MessageBay.displayMessage(deletedFrame + " renamed " 117 + deletedFrameName); 118 //FrameGraphics.Repaint(); 116 119 return; 117 120 } … … 302 305 303 306 public static void getUnicodeCharacters(int start, int finish) { 304 if (start < 0 && finish < 0){307 if (start < 0 && finish < 0) { 305 308 throw new RuntimeException("Parameters must be non negative"); 306 309 } 307 // Swap the start and finish if they are inthe wrong order308 if (start > finish){310 // Swap the start and finish if they are inthe wrong order 311 if (start > finish) { 309 312 start += finish; 310 finish = start -finish;313 finish = start - finish; 311 314 start = start - finish; 312 315 } 313 316 StringBuilder charList = new StringBuilder(); 314 317 int count = 0; 315 charList.append(String.format("Unicode block 0x%x - 0x%x", start, finish)); 318 charList.append(String.format("Unicode block 0x%x - 0x%x", start, 319 finish)); 316 320 System.out.println(); 317 //charList.append("Unicode block: ").append(String.format(format, args)) 318 for (char i = (char)start; i < (char)finish; i++) { 321 // charList.append("Unicode block: ").append(String.format(format, 322 // args)) 323 for (char i = (char) start; i < (char) finish; i++) { 319 324 if (Character.isDefined(i)) { 320 if (count++ % 64 == 0)325 if (count++ % 64 == 0) 321 326 charList.append(Text.LINE_SEPARATOR); 322 327 charList.append(Character.valueOf(i)); … … 325 330 attachTextToCursor(charList.toString()); 326 331 } 327 332 328 333 /** 329 334 * Gets a single block of Unicode characters. 330 * @param start the start of the block 335 * 336 * @param start 337 * the start of the block 331 338 */ 332 339 public static void getUnicodeCharacters(int start) { 333 getUnicodeCharacters(start, start + 256);334 } 335 340 getUnicodeCharacters(start, start + 256); 341 } 342 336 343 public static void getMathSymbols() { 337 getUnicodeCharacters('\u2200', '\u2300');344 getUnicodeCharacters('\u2200', '\u2300'); 338 345 } 339 346 … … 442 449 String frameName = ImageFrame(loaded, format, path); 443 450 if (frameName != null) 444 MessageBay.displayMessage("Frame successfully saved to " 445 + path +frameName);451 MessageBay.displayMessage("Frame successfully saved to " + path 452 + frameName); 446 453 else 447 454 MessageBay.errorMessage("Could not find image writer for " … … 471 478 // TODO is there a built in method which will do this faster? 472 479 473 MessageBay.displayMessage("Copying file " + existingFile 474 + " to " +newFileName + "...");480 MessageBay.displayMessage("Copying file " + existingFile + " to " 481 + newFileName + "..."); 475 482 FrameIO.copyFile(existingFile, newFileName); 476 483 MessageBay.displayMessage("File copied successfully"); -
trunk/src/org/expeditee/actions/Simple.java
r147 r154 429 429 if (_step) { 430 430 if (child != DisplayIO.getCurrentFrame()) { 431 DisplayIO.setCurrentFrame(child );431 DisplayIO.setCurrentFrame(child, true); 432 432 } 433 433 DisplayIO.addToBack(child); … … 493 493 DisplayIO.removeFromBack(); 494 494 if (DisplayIO.getCurrentFrame() != current.getParent()) 495 DisplayIO.setCurrentFrame(current.getParent() );495 DisplayIO.setCurrentFrame(current.getParent(), true); 496 496 } 497 497 … … 516 516 Frame parent = item.getParentOrCurrentFrame(); 517 517 if (!parent.equals(DisplayIO.getCurrentFrame())) { 518 DisplayIO.setCurrentFrame(parent );518 DisplayIO.setCurrentFrame(parent, true); 519 519 } 520 520 … … 1855 1855 boolean success = false; 1856 1856 try { 1857 success = FrameIO.DeleteFrame(frame) ;1857 success = FrameIO.DeleteFrame(frame) != null; 1858 1858 if (!success && _verbose) 1859 1859 MessageBay.warningMessage(errorMessage); … … 2119 2119 } 2120 2120 } 2121 DisplayIO.setCurrentFrame(frame );2121 DisplayIO.setCurrentFrame(frame, false); 2122 2122 pause(thisFramesPause); 2123 2123 -
trunk/src/org/expeditee/agents/ComputeTree.java
r108 r154 5 5 import org.expeditee.gui.AttributeUtils; 6 6 import org.expeditee.gui.Frame; 7 import org.expeditee.gui.FrameGraphics; 7 8 import org.expeditee.gui.FrameIO; 8 9 import org.expeditee.items.Item; … … 23 24 message("Nothing to compute!"); 24 25 } 25 26 26 27 return null; 27 28 } -
trunk/src/org/expeditee/agents/DefaultAgent.java
r133 r154 2 2 3 3 import org.expeditee.gui.Frame; 4 import org.expeditee.gui.FrameGraphics; 4 5 import org.expeditee.gui.MessageBay; 5 6 import org.expeditee.gui.TimeKeeper; … … 101 102 _running = false; 102 103 104 FrameGraphics.requestRefresh(true); 103 105 SessionStats.setEnabled(true); 104 106 } -
trunk/src/org/expeditee/agents/DisplayComet.java
r121 r154 53 53 if(_stop) 54 54 return null; 55 DisplayIO.setCurrentFrame(_frameList.pop() );55 DisplayIO.setCurrentFrame(_frameList.pop(), true); 56 56 _frameCount++; 57 57 pause(_delay); -
trunk/src/org/expeditee/agents/DisplayTree.java
r133 r154 3 3 import org.expeditee.gui.DisplayIO; 4 4 import org.expeditee.gui.Frame; 5 import org.expeditee.gui.FrameUtils; 5 6 import org.expeditee.gui.MessageBay; 6 7 import org.expeditee.items.Item; … … 62 63 // ignore loops 63 64 if (toProcess != DisplayIO.getCurrentFrame()) 64 DisplayIO.setCurrentFrame(toProcess); 65 // FrameUtils.DisplayFrame(toProcess,false); 65 DisplayIO.setCurrentFrame(toProcess, false); 66 66 // parse the frame for any pause settings 67 67 delay(toProcess); -
trunk/src/org/expeditee/agents/Format.java
r143 r154 46 46 //Check the position of the cursor and only format stuff inside the same box as the cursor 47 47 Collection<Text> itemsToFormat = FrameUtils.getCurrentTextItems(); 48 if(itemsToFormat.size() < =1){48 if(itemsToFormat.size() < 1){ 49 49 itemsToFormat = start.getBodyTextItems(true); 50 50 } -
trunk/src/org/expeditee/gui/AttributeUtils.java
r147 r154 436 436 List<String> values = attribs.getTextList(); 437 437 // if no pairs exist, we are done 438 if (values .size() == 0438 if (values == null || values.size() == 0 439 439 || (values.size() == 1 && values.get(0).length() == 0)) { 440 440 return false; -
trunk/src/org/expeditee/gui/Browser.java
r147 r154 54 54 private boolean _isExiting = false; 55 55 56 private static boolean _initComplete = false; 57 56 58 /** 57 59 * Constructs a new Browser object, then launches it … … 76 78 .getLocation().y 77 79 - _theBrowser.getOrigin().y; 80 _initComplete = true; 78 81 } 79 82 }); … … 97 100 public boolean isExisting() { 98 101 return _isExiting; 102 } 103 104 public static boolean isInitComplete() { 105 return _initComplete; 99 106 } 100 107 … … 167 174 EntitySaveManager.getInstance().addSaveStateChangedEventListener(this); 168 175 169 // Set the drag and drop handler 170 setTransferHandler(FrameDNDTransferHandler.getInstance()); 176 String version = System.getProperty("java.version"); 177 178 if (version.startsWith("1.6")) { 179 // Set the drag and drop handler 180 setTransferHandler(FrameDNDTransferHandler.getInstance()); 181 } else { 182 System.out.println("Upgrade to Java 1.6 to enable drag and drop"); 183 } 171 184 172 185 try { … … 373 386 MessageBay 374 387 .displayMessage("Stopping Simple programs..."); // TODO: 375 376 377 378 379 388 // Only 389 // stop 390 // if 391 // need 392 // to... 380 393 while (Simple.isProgramRunning()) { 381 394 Thread.sleep(100); // Brook: What purpose does this 382 395 // serve? 383 396 } 384 397 MessageBay.displayMessage("Stopping Agents..."); // TODO: 385 386 387 388 389 398 // Only 399 // stop 400 // if 401 // need 402 // to... 390 403 while (Actions.isAgentRunning()) { 391 404 Thread.sleep(100); // Brook: What purpose does this 392 405 // serve? 393 406 } 394 407 } catch (Exception e) { -
trunk/src/org/expeditee/gui/DisplayIO.java
r152 r154 251 251 } 252 252 253 private static boolean _typed = false;254 255 public static void setKeyTyped(boolean val) {256 _typed = val;257 }258 259 public static boolean getKeyTyped() {260 return _typed;261 }253 // private static boolean _typed = false; 254 // 255 // public static void setKeyTyped(boolean val) { 256 // _typed = val; 257 // } 258 // 259 // public static boolean getKeyTyped() { 260 // return _typed; 261 // } 262 262 263 263 /** … … 326 326 return null; 327 327 } 328 329 /** 330 * Sets the currently displayed Frame to the given Frame 331 * 332 * @param frame 333 * The Frame to display on the screen 334 */ 335 public static void setCurrentFrame(Frame frame) { 328 329 public static void setCurrentFrame(Frame frame, boolean incrementStats) { 336 330 if (frame == null) 337 331 return; … … 357 351 + " is already the current frame."); 358 352 return; 359 } else {353 } else if(incrementStats) { 360 354 SessionStats.AccessedFrame(); 361 355 } … … 654 648 if (_TwinFrames) { 655 649 // if this is the first time TwinFrames has been toggled on, 656 // load 657 // the user's first frame 650 // load the user's first frame 658 651 if (_VisitedFrames[opposite].size() == 0) { 659 652 FrameIO.SuspendCache(); 660 setCurrentFrame(FrameIO.LoadFrame(UserSettings.FirstFrame) );653 setCurrentFrame(FrameIO.LoadFrame(UserSettings.FirstFrame), true); 661 654 FrameIO.ResumeCache(); 662 655 } else { 663 656 // otherwise, restore the frame from the side's back-stack 664 657 setCurrentFrame(FrameIO.LoadFrame(_VisitedFrames[opposite] 665 .pop()) );658 .pop()), true); 666 659 } 667 660 … … 682 675 683 676 FrameGraphics.Clear(); 677 FrameGraphics.requestRefresh(false); 684 678 FrameGraphics.Repaint(); 685 679 } -
trunk/src/org/expeditee/gui/Frame.java
r147 r154 1352 1352 // Make it the width of the page 1353 1353 // t.setMaxWidth(FrameGraphics.getMaxFrameSize().width); 1354 if (t.getWidth() <= 0) {1354 //if (t.getWidth() <= 0) { 1355 1355 t.setRightMargin(FrameGraphics.getMaxFrameSize().width); 1356 }1356 //} 1357 1357 addItem(t); 1358 1358 return t; -
trunk/src/org/expeditee/gui/FrameGraphics.java
r147 r154 123 123 _MaxSize.setSize(max.width, newMaxHeight); 124 124 } 125 126 if (DisplayIO.getCurrentFrame() != null) { 127 DisplayIO.getCurrentFrame().setBuffer(null); 128 DisplayIO.getCurrentFrame().refreshSize(_MaxSize); 125 Frame current = DisplayIO.getCurrentFrame(); 126 if (current != null) { 127 current.setBuffer(null); 128 current.refreshSize(getMaxFrameSize()); 129 if (DisplayIO.isTwinFramesOn()) { 130 Frame opposite = DisplayIO.getOppositeFrame(); 131 //if (opposite != null) { 132 opposite.setBuffer(null); 133 opposite.refreshSize(getMaxFrameSize()); 134 //} 135 } 129 136 } 130 137 131 138 if (newMaxHeight > 0) { 132 MessageBay.updateSize(); 139 MessageBay.updateSize(); 133 140 } 134 141 } … … 398 405 if (toPaint == DisplayIO.getCurrentFrame()) { 399 406 // If exactly one end of the line is floating... 400 401 402 407 403 408 if (line.getEndItem().isFloating() 404 409 ^ line.getStartItem().isFloating()) { 405 // Line l = TransposeLine(line, line.getEndItem(), 406 // toPaint, 0, 0); 407 // if (l == null) 408 // l = TransposeLine(line, 409 // line.getStartItem(), toPaint, 0, 0); 410 // if (l == null) 411 // l = line; 412 // lines.add(l); 413 } else{ 414 //lines.add(line); 410 // Line l = TransposeLine(line, 411 // line.getEndItem(), 412 // toPaint, 0, 0); 413 // if (l == null) 414 // l = TransposeLine(line, 415 // line.getStartItem(), toPaint, 0, 0); 416 // if (l == null) 417 // l = line; 418 // lines.add(l); 419 } else { 420 // lines.add(line); 415 421 } 416 422 } else { 417 //if (line.getEndItem().isFloating()418 //^ line.getStartItem().isFloating()) {419 //lines.add(TransposeLine(line,420 //line.getEndItem(), toPaint,421 //FrameMouseActions.getY(), -DisplayIO422 //.getMiddle()));423 //lines.add(TransposeLine(line, line424 //.getStartItem(), toPaint,425 //FrameMouseActions.getY(), -DisplayIO426 //.getMiddle()));427 //}423 // if (line.getEndItem().isFloating() 424 // ^ line.getStartItem().isFloating()) { 425 // lines.add(TransposeLine(line, 426 // line.getEndItem(), toPaint, 427 // FrameMouseActions.getY(), -DisplayIO 428 // .getMiddle())); 429 // lines.add(TransposeLine(line, line 430 // .getStartItem(), toPaint, 431 // FrameMouseActions.getY(), -DisplayIO 432 // .getMiddle())); 433 // } 428 434 } 429 435 } -
trunk/src/org/expeditee/gui/FrameIO.java
r130 r154 292 292 if (_Cache.containsKey(fresh.getName().toLowerCase())) 293 293 addToCache(fresh); 294 DisplayIO.setCurrentFrame(fresh );294 DisplayIO.setCurrentFrame(fresh, false); 295 295 } 296 296 … … 421 421 * @param toDelete 422 422 * The Frame to be deleted 423 * @return The result of File.delete()424 */ 425 public static booleanDeleteFrame(Frame toDelete) throws IOException,423 * @return The name the deleted frame was changed to, or null if the delete failed 424 */ 425 public static String DeleteFrame(Frame toDelete) throws IOException, 426 426 SecurityException { 427 427 if (toDelete == null) 428 return false;428 return null; 429 429 430 430 // Dont delete the zero frame … … 458 458 toDelete.setFrameNumber(lastNumber + 1); 459 459 toDelete.path = framePath; 460 F rameIO.SaveFrame(toDelete);460 ForceSaveFrame(toDelete); 461 461 462 462 if (_Cache.containsKey(oldFrameName)) … … 468 468 ff.close(); 469 469 470 return del.delete(); 470 if( del.delete()){ 471 return toDelete.getName(); 472 } 473 474 return null; 471 475 } 472 476 -
trunk/src/org/expeditee/gui/FrameKeyboardActions.java
r147 r154 27 27 import org.expeditee.items.Line; 28 28 import org.expeditee.items.Permission; 29 import org.expeditee.items.StringUtils; 29 30 import org.expeditee.items.Text; 30 31 import org.expeditee.items.XRayable; … … 139 140 text = createText(ch); 140 141 justify(text); 141 142 142 143 FrameUtils.setLastEdited(text); 143 144 DisplayIO.setTextCursor(text, Text.NONE); … … 190 191 */ 191 192 private static void justify(Text text) { 192 // Check if that text item is inside an enclosing rectangle...193 // Set its max width accordingly193 // Check if that text item is inside an enclosing rectangle... 194 // Set its max width accordingly 194 195 Polygon enclosure = FrameUtils.getEnlosingPolygon(); 195 if (enclosure != null){196 if (enclosure != null) { 196 197 Rectangle bounds = enclosure.getBounds(); 197 198 text.setRightMargin(bounds.x + bounds.width); 198 } else{199 } else { 199 200 text.setRightMargin(FrameGraphics.getMaxFrameSize().width); 200 201 } … … 300 301 break; 301 302 case Text.HOME: 303 case Text.LINE_HOME: 302 304 NavigationActions.ZeroFrame(); 303 305 break; 304 306 case Text.END: 307 case Text.LINE_END: 305 308 NavigationActions.LastFrame(); 306 309 break; … … 673 676 .getSystemClipboard().getContents(null) 674 677 .getTransferData(DataFlavor.stringFlavor)); 678 // Covert the line separator char when pasting in 679 // windows (\r\n) or max (\r) 680 clip = StringUtils.convertNewLineChars(clip); 675 681 676 682 Item clicked = FrameUtils.getCurrentItem(); … … 812 818 return; 813 819 814 //if (text.getWidth() < 0)815 //text.setWidth(text.getBoundsWidth() - Item.MARGIN_RIGHT816 //- UserSettings.Gravity);820 // if (text.getWidth() < 0) 821 // text.setWidth(text.getBoundsWidth() - Item.MARGIN_RIGHT 822 // - UserSettings.Gravity); 817 823 justify(text); 818 824 break; … … 1160 1166 || Frame.itemAttachedToCursor()) 1161 1167 dummyItem.getParentOrCurrentFrame().removeItem(dummyItem); 1168 dummyItem.setRightMargin(FrameGraphics.getMaxFrameSize().width); 1162 1169 DisplayIO.resetCursorOffset(); 1163 1170 FrameGraphics.Repaint(); -
trunk/src/org/expeditee/gui/FrameUtils.java
r147 r154 385 385 386 386 Parse(toDisplay); 387 DisplayIO.setCurrentFrame(toDisplay );387 DisplayIO.setCurrentFrame(toDisplay, addToBack); 388 388 FrameMouseActions.updateCursor(); 389 389 // FrameMouseActions.getInstance().refreshHighlights(); … … 639 639 + UserSettings.FirstFrame); 640 640 UserSettings.FirstFrame = profile.getName(); 641 DisplayIO.setCurrentFrame(profile );641 DisplayIO.setCurrentFrame(profile, true); 642 642 } else { 643 DisplayIO.setCurrentFrame(firstFrame );643 DisplayIO.setCurrentFrame(firstFrame, true); 644 644 } 645 645 // } … … 866 866 && ItemUtils.startsWithTag(i, ItemUtils.TAG_VECTOR) 867 867 && i.getLink() != null) { 868 // TODO It is possible to get into an infinate loop if a 869 // frame contains an @ao which leads to a frame with an 870 // @v which points back to the frame with the @ao 871 Frame vector = FrameIO.LoadFrame(i.getAbsoluteLink()); 872 // Get the permission from off the vector frame 873 Permission vectorPermission = Permission.getPermission( 874 vector.getAnnotationValue("permission"), 875 Permission.none); 876 // If the frame permission is lower, use that 877 vectorPermission = Permission.min(vectorPermission, 878 permission); 879 // Highest permissable permission for vectors is copy 880 vectorPermission = Permission.min(vectorPermission, 881 Permission.copy); 882 if (vector != null) { 883 String scaleString = AttributeUtils 884 .getValue(((Text) i).getText()); 885 Float scale = 1F; 886 try { 887 scale = Float.parseFloat(scaleString); 888 } catch (Exception e) { 889 } 890 Vector newVector = new Vector(vector, 891 vectorPermission, i.getPosition(), scale, i 892 .getColor(), i.getBackgroundColor()); 893 i.setOverlay(newVector); 894 vectors.add(newVector); 895 } 868 addVector(vectors, Permission.none, permission, i); 869 } else if (!FrameGraphics.isXRayMode() 870 && ItemUtils.startsWithTag(i, 871 ItemUtils.TAG_ACTIVE_VECTOR) 872 && i.getLink() != null) { 873 addVector(vectors, Permission.followLinks, permission, 874 i); 896 875 } 897 876 // check for new OVERLAY items … … 907 886 } 908 887 909 Frame overlay = FrameIO.LoadFrame(i.getAbsoluteLink()); 888 Frame overlayFrame = FrameIO.LoadFrame(i 889 .getAbsoluteLink()); 910 890 // Parse(overlay); 911 if (overlay != null && !overlays.contains(overlay)) 912 overlays.add(new Overlay(overlay, Permission.none)); 891 if (overlayFrame != null 892 && Overlay.getOverlay(overlays, overlayFrame) == null) 893 overlays.add(new Overlay(overlayFrame, 894 Permission.none)); 913 895 } 914 896 // check for ACTIVE_OVERLAY items … … 924 906 continue; 925 907 } 926 Frame overlay = FrameIO.LoadFrame(link); 927 // Parse(overlay); 908 Frame overlayFrame = FrameIO.LoadFrame(link); 928 909 // get level if specified 929 910 String level = AttributeUtils.getValue(((Text) i) … … 933 914 level, Permission.followLinks); 934 915 935 if (overlay != null) { 936 // Add it if its a new overlay 937 boolean found = false; 938 // Check if this overlay is already in the list and 939 // adjust its permissions 940 for (Overlay o : overlays) { 941 if (o.Frame.equals(overlay)) { 942 o.Frame.setPermission(permissionLevel); 943 found = true; 944 break; 945 } 946 } 916 if (overlayFrame != null) { 917 Overlay existingOverlay = Overlay.getOverlay( 918 overlays, overlayFrame); 947 919 // If it wasnt in the list create it and add it. 948 if ( !found) {949 Overlay newOverlay = new Overlay(overlay ,920 if (existingOverlay == null) { 921 Overlay newOverlay = new Overlay(overlayFrame, 950 922 permissionLevel); 951 923 i.setOverlay(newOverlay); 952 924 overlays.add(newOverlay); 925 } else { 926 existingOverlay.Frame 927 .setPermission(permissionLevel); 953 928 } 954 929 } … … 1043 1018 1044 1019 /** 1020 * @param vectors 1021 * @param permission 1022 * @param i 1023 */ 1024 private static void addVector(List<Vector> vectors, 1025 Permission defaultPermission, Permission framePermission, Item i) { 1026 // TODO It is possible to get into an infinate loop if a 1027 // frame contains an @ao which leads to a frame with an 1028 // @v which points back to the frame with the @ao 1029 Frame vector = FrameIO.LoadFrame(i.getAbsoluteLink()); 1030 // Get the permission from off the vector frame 1031 Permission vectorPermission = Permission.getPermission(vector 1032 .getAnnotationValue("permission"), defaultPermission); 1033 // If the frame permission is lower, use that 1034 vectorPermission = Permission.min(vectorPermission, framePermission); 1035 // Highest permissable permission for vectors is copy 1036 vectorPermission = Permission.min(vectorPermission, Permission.copy); 1037 if (vector != null) { 1038 String scaleString = AttributeUtils.getValue(((Text) i).getText()); 1039 Float scale = 1F; 1040 try { 1041 scale = Float.parseFloat(scaleString); 1042 } catch (Exception e) { 1043 } 1044 Vector newVector = new Vector(vector, vectorPermission, i 1045 .getPosition(), scale, i.getColor(), i.getBackgroundColor()); 1046 i.setOverlay(newVector); 1047 vectors.add(newVector); 1048 } 1049 } 1050 1051 /** 1045 1052 * Searches through the list of items on this frame to find one at the given 1046 1053 * x,y coordinates. … … 1158 1165 } 1159 1166 1160 public static Polygon getEnlosingPolygon() {1167 public static Polygon getEnlosingPolygon() { 1161 1168 Collection<Item> enclosure = getEnclosingLineEnds(); 1162 1169 if (enclosure == null || enclosure.size() == 0) … … 1165 1172 return enclosure.iterator().next().getEnclosedShape(); 1166 1173 } 1167 1174 1168 1175 /** 1169 1176 * … … 1444 1451 1445 1452 public static void setLastEdited(Text lastEdited) { 1446 if (LastEdited != null && lastEdited != LastEdited 1447 && LastEdited.getText().length() == 0) { 1448 LastEdited.getParentOrCurrentFrame().removeItem(LastEdited); 1453 // If the lastEdited is being changed then check if its @i 1454 Frame toReparse = null; 1455 if (LastEdited != null) { 1456 if (lastEdited == null || lastEdited != LastEdited) { 1457 if (LastEdited.startsWith("@i")) { 1458 toReparse = LastEdited.getParent(); 1459 } 1460 } 1461 if (lastEdited != LastEdited && LastEdited.getText().length() == 0) { 1462 LastEdited.getParentOrCurrentFrame().removeItem(LastEdited); 1463 } 1449 1464 } 1450 1465 LastEdited = lastEdited; 1466 1467 if (toReparse != null) { 1468 Parse(toReparse, false); 1469 } 1451 1470 } 1452 1471 … … 1460 1479 if (currentItems != null) { 1461 1480 for (Item i : getCurrentItems(null)) { 1462 if (i instanceof Text ) {1481 if (i instanceof Text && !i.isLineEnd()) { 1463 1482 currentTextItems.add((Text) i); 1464 1483 } -
trunk/src/org/expeditee/gui/Overlay.java
r115 r154 1 1 package org.expeditee.gui; 2 3 import java.util.Collection; 2 4 3 5 import org.expeditee.items.Permission; … … 25 27 return 0; 26 28 } 29 30 public static Overlay getOverlay(Collection<Overlay>overlays, Frame frame){ 31 // Check the frame is in the list of overlays 32 for (Overlay o : overlays) { 33 if (o.Frame.equals(frame)) { 34 return o; 35 } 36 } 37 return null; 38 } 27 39 } -
trunk/src/org/expeditee/items/Item.java
r147 r154 1931 1931 1932 1932 public boolean hasAction() { 1933 return _actions != null && _actions.size() > 0; 1933 List<String> actions = getAction(); 1934 return actions != null && actions.size() > 0; 1934 1935 } 1935 1936 -
trunk/src/org/expeditee/items/ItemUtils.java
r121 r154 71 71 72 72 public static final int TAG_VECTOR = 19; 73 74 public static final int TAG_ACTIVE_VECTOR = 21; 73 75 74 76 public static final int TAG_BITMAP_IMAGE = 20; … … 76 78 public static final int TAG_MIN = 0; 77 79 78 public static final int TAG_MAX = 2 0;80 public static final int TAG_MAX = 21; 79 81 80 82 /** … … 283 285 case TAG_VECTOR: 284 286 return "@v"; 287 case TAG_ACTIVE_VECTOR: 288 return "@av"; 285 289 case TAG_ACTIVE_OVERLAY: 286 290 return "@ao"; -
trunk/src/org/expeditee/items/Text.java
r147 r154 488 488 // Trim the text to remove new lines on the beginning and end of the 489 489 // string 490 if(_text.charAt(left) == '\n'){ 491 //if the entire line is being removed then remove one of the new lines 492 if(_text.charAt(right) == '\n'){ 490 if (_text.charAt(left) == '\n') { 491 // if the entire line is being removed then remove one of the new 492 // lines, the first case checks if the last line is being removed 493 if (right >= _text.length() || _text.charAt(right) == '\n') { 493 494 _text.deleteCharAt(left); 494 495 right--; 495 } else{496 } else { 496 497 left++; 497 498 } 498 499 } 499 // New lines are always at the start of the line for now...500 //if(_text.charAt(right - 1) == '\n' && left < right){501 //right--;502 //}500 // New lines are always at the start of the line for now... 501 // if(_text.charAt(right - 1) == '\n' && left < right){ 502 // right--; 503 // } 503 504 String s = _text.substring(left, right); 504 505 … … 570 571 int pos = hit.getInsertionIndex() + _lineOffsets.get(line); 571 572 572 if (line > 0 && hit.getInsertionIndex() == 0) 573 pos++; 573 if (line > 0 && hit.getInsertionIndex() == 0) { 574 // Only move forward a char if the line begins with a hard line 575 // break... not a soft line break 576 if (_text.charAt(pos) == '\n') { 577 pos++; 578 } 579 } 574 580 575 581 if (insertPos < 0) … … 1795 1801 String text = getText().toLowerCase(); 1796 1802 // TODO make it so can just check the _overlay variable 1803 //Mike cant remember the reason _overlay var cant be use! opps 1804 if(!text.startsWith("@")) 1805 return false; 1797 1806 return text.startsWith("@o") || text.startsWith("@ao") 1798 || text.startsWith("@v") ;1807 || text.startsWith("@v") || text.startsWith("@av"); 1799 1808 } 1800 1809 -
trunk/src/org/expeditee/items/XRayable.java
r147 r154 150 150 if (_source == null) { 151 151 return; 152 } else {153 _source.setLink(frameName);154 152 } 155 153 if(frameName == null) 154 invalidateAll(); 155 _source.setLink(frameName); 156 156 updatePolygon(); 157 //TODO: only invalidate the link bit 158 invalidateAll(); 157 159 } 158 160 159 161 @Override 160 162 public void setActions(List<String> action) { 161 if (_source == null) 163 if (_source == null){ 162 164 return; 163 else 164 _source.setActions(action); 165 165 } 166 if(action.size() == 0) 167 invalidateAll(); 168 _source.setActions(action); 166 169 updatePolygon(); 170 invalidateAll(); 167 171 } 168 172
Note:
See TracChangeset
for help on using the changeset viewer.