Changeset 289
- Timestamp:
- 09/03/08 09:50:37 (16 years ago)
- Location:
- trunk/src/org/expeditee
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/agents/DisplayComet.java
r154 r289 22 22 super(); 23 23 } 24 24 25 25 @Override 26 26 protected Frame process(Frame frame) { 27 27 Collection<String> seen = new HashSet<String>(); 28 28 29 29 DisplayIO.addToBack(frame); 30 30 31 31 // Goto the end of the comet 32 32 Item old = null; 33 33 Frame oldFrame = frame; 34 34 while (oldFrame != null) { 35 if (_stop)35 if (_stop) 36 36 return null; 37 37 seen.add(oldFrame.getName().toLowerCase()); … … 42 42 if (old != null) { 43 43 String link = old.getAbsoluteLink(); 44 String linkLowerCase = link.toLowerCase(); 45 if (link != null && !seen.contains(linkLowerCase)) { 46 oldFrame = FrameIO.LoadFrame(linkLowerCase); 47 MessageBay.overwriteMessage("Loading frames: " + link); 44 45 if (link != null) { 46 String linkLowerCase = link.toLowerCase(); 47 if (!seen.contains(linkLowerCase)) { 48 oldFrame = FrameIO.LoadFrame(linkLowerCase); 49 MessageBay.overwriteMessage("Loading frames: " + link); 50 } 48 51 } 49 52 } … … 51 54 // Back out one frame at a time 52 55 while (!_frameList.empty()) { 53 if (_stop)56 if (_stop) 54 57 return null; 55 58 DisplayIO.setCurrentFrame(_frameList.pop(), true); -
trunk/src/org/expeditee/gui/FrameKeyboardActions.java
r286 r289 20 20 21 21 import org.expeditee.actions.Actions; 22 import org.expeditee.actions.Misc; 22 23 import org.expeditee.actions.NavigationActions; 23 24 import org.expeditee.actions.Simple; … … 969 970 // get whatever the user is pointing at 970 971 Item on = FrameUtils.getCurrentItem(); 971 972 String displayMessage = "F" + key.ordinal() + ": " + key.toString(); 972 973 // check for enclosed mode 973 974 if (on == null && key.ordinal() < FunctionKey.AudienceMode.ordinal()) { … … 1033 1034 AddDate(firstConnected); 1034 1035 break; 1035 } 1036 return; 1037 } 1038 } 1039 String displayMessage = "F" + key.ordinal() + ": " + key.toString(); 1036 case Save: 1037 Save(); 1038 MessageBay.displayMessage(displayMessage); 1039 break; 1040 } 1041 return; 1042 } 1043 } 1040 1044 // Show a description of the function key pressed if the user is in free 1041 1045 // space and return for the F keys that dont do anything in free space. … … 1048 1052 case AudienceMode: 1049 1053 case Refresh: 1054 case Save: 1050 1055 break; 1056 case SizeDown: 1057 if(isControlDown){ 1058 UserSettings.ScaleFactor -= 0.05; 1059 Misc.repaint(); 1060 return; 1061 } 1062 case SizeUp: 1063 if(isControlDown){ 1064 UserSettings.ScaleFactor += 0.05; 1065 Misc.repaint(); 1066 return; 1067 } 1051 1068 default: 1052 1069 MessageBay.displayMessageOnce(displayMessage); … … 1103 1120 Refresh(); 1104 1121 break; 1122 case Save: 1123 Save(); 1124 break; 1105 1125 } 1106 1126 on = FrameUtils.getCurrentItem(); … … 1108 1128 if (on == null && (enclosed == null || enclosed.size() == 0)) 1109 1129 MessageBay.displayMessage(displayMessage); 1130 } 1131 1132 private static void Save() { 1133 Frame current = DisplayIO.getCurrentFrame(); 1134 current.change(); 1135 FrameIO.SaveFrame(current,true, true); 1110 1136 } 1111 1137 -
trunk/src/org/expeditee/gui/FrameUtils.java
r286 r289 34 34 import org.expeditee.network.PeerToPeer; 35 35 import org.expeditee.stats.SessionStats; 36 import org.jfree.util.ArrayUtilities; 36 37 37 38 public class FrameUtils { … … 637 638 } else if (attribute.equals("framesetdirs")) { 638 639 UserSettings.FrameDirs.addAll(getDirs(item)); 640 } else if (attribute.equals("style")) { 641 UserSettings.Style = getStyle(item.getChild()); 639 642 } else { 640 643 errors.add(attributeFullCase + " is not a profile frame tag"); … … 642 645 } 643 646 return errors; 647 } 648 649 private static List<Text> getStyle(Frame child) { 650 List<Text> style = new ArrayList<Text>(8); 651 for (int i = 0; i < 10; i++){ 652 style.add(null); 653 } 654 655 for (Text text : child.getBodyTextItems(false)) { 656 String type = text.getText(); 657 char lastChar = type.charAt(type.length() - 1); 658 if (Character.isDigit(lastChar)) { 659 style.set(lastChar - '0', text); 660 } else { 661 style.set(0, text); 662 } 663 } 664 return style; 644 665 } 645 666 -
trunk/src/org/expeditee/gui/FunctionKey.java
r80 r289 4 4 public enum FunctionKey { 5 5 DropDown, SizeUp, SizeDown, ChangeColor, ToggleAnnotation, InsertDate, NewFrameset, ChangeFontStyle, ChangeFontFamily, 6 AudienceMode, XRayMode, Unused, Refresh;6 AudienceMode, XRayMode, Save, Refresh; 7 7 } -
trunk/src/org/expeditee/gui/UserSettings.java
r286 r289 3 3 import java.io.File; 4 4 import java.net.URL; 5 import java.util.Collection; 5 6 import java.util.LinkedList; 6 7 import java.util.List; … … 15 16 public abstract class UserSettings { 16 17 18 public static List<Text> Style; 19 17 20 public static int Gravity = 3; 21 22 public static float ScaleFactor = 1F; 18 23 19 24 public static int LineStraightenThreshold = 15; … … 85 90 * runs the jar from the command line from another directory. 86 91 * 87 * @return 92 * @return the full path location of the Jar 88 93 */ 89 94 public static String getJarLocation() { -
trunk/src/org/expeditee/io/AbstractHTMLWriter.java
r121 r289 1 1 package org.expeditee.io; 2 2 3 import java.awt.Color; 4 import java.awt.Font; 3 5 import java.io.File; 4 6 import java.io.IOException; 7 import java.util.List; 5 8 6 9 import org.expeditee.gui.Frame; 7 10 import org.expeditee.gui.MessageBay; 8 import org.expeditee.items.Item; 11 import org.expeditee.gui.UserSettings; 12 import org.expeditee.items.Text; 9 13 10 14 public abstract class AbstractHTMLWriter extends DefaultTreeWriter { 11 private int _indent = 0;12 15 13 16 private static final String INDENT = " "; … … 24 27 _writer.write("<title>" + start.getTitle()); 25 28 _writer.write("</title>" + ItemWriter.NEW_LINE); 29 30 // Write in the style for the headers and body text 31 _writer.write("<style>" + ItemWriter.NEW_LINE); 32 _writer.write("<!--" + ItemWriter.NEW_LINE); 33 34 // Go through all the styles 35 List<Text> style = UserSettings.Style; 36 37 writeStyleInfo(_writer, "P", style.get(0)); 38 for (int i = 1; i < style.size(); i++) { 39 writeStyleInfo(_writer, "H" + i, style.get(i)); 40 } 41 _writer.write("-->" + ItemWriter.NEW_LINE); 42 _writer.write("</style>" + ItemWriter.NEW_LINE); 43 26 44 _writer.write("</head>" + ItemWriter.NEW_LINE); 27 45 _writer.write("<body>" + ItemWriter.NEW_LINE); 46 } 47 48 private void writeStyleInfo(ProxyWriter writer, String styleName, Text style) 49 throws IOException { 50 if (style == null) 51 return; 52 53 writer.write(styleName + " { font-size: " + Math.round(style.getSize()) 54 + "pt"); 55 56 Font font = style.getPaintFont(); 57 if(font == null) 58 return; 59 60 writer.write("; font-family: " + Conversion.getCssFontFamily(font.getFamily())); 61 if (font.isBold()) { 62 writer.write("; font-weight: bold"); 63 } else { 64 writer.write("; font-weight: normal"); 65 } 66 67 if (font.isItalic()) { 68 writer.write("; font-style: italic"); 69 } else { 70 writer.write("; font-style: normal"); 71 } 72 Color c = style.getBackgroundColor(); 73 if (c != null) { 74 writer.write("; background-color: " + Conversion.getCssColor(c)); 75 } 76 c = style.getColor(); 77 if (c != null) { 78 writer.write("; color: " + Conversion.getCssColor(c)); 79 } 80 81 c = style.getBorderColor(); 82 if (c != null) { 83 writer.write("; outline-color: " + Conversion.getCssColor(c)); 84 writer.write("; outline-style: solid"); 85 } 86 87 writer.write("}" + ItemWriter.NEW_LINE); 88 28 89 } 29 90 … … 32 93 protected String getFilesFolder() { 33 94 if (_filesFolderName == null) { 34 _filesFolderName = _filename.substring(0, _filename.lastIndexOf('.')) + FILE_FOLDER_SUFFIX; 35 File dir = new File (_filesFolderName); 95 _filesFolderName = _filename.substring(0, _filename 96 .lastIndexOf('.')) 97 + FILE_FOLDER_SUFFIX; 98 File dir = new File(_filesFolderName); 36 99 _filesFolderName = dir.getName(); 37 100 if (!dir.exists()) { … … 46 109 } 47 110 } 48 111 49 112 return _filesFolderName + File.separator; 50 113 } … … 54 117 _writer.write("</body>" + ItemWriter.NEW_LINE); 55 118 return super.finaliseTree(); 56 }57 58 @Override59 protected void writeStartLink(Item linker) throws IOException {60 _indent++;61 }62 63 @Override64 protected void writeEndLink(Item linker) throws IOException {65 _indent--;66 119 } 67 120 -
trunk/src/org/expeditee/io/Conversion.java
r226 r289 219 219 String code = Text.FONT_WHEEL[0]; 220 220 if (separator > 0) { 221 code = Actions.getCapitalizedFontName(fontCode.substring(0,separator)) + '-'; 221 code = Actions.getCapitalizedFontName(fontCode.substring(0, 222 separator)) + '-'; 222 223 fontCode = fontCode.substring(separator); 223 224 } else { … … 385 386 return Float.parseFloat(value); 386 387 } 387 388 388 389 if (type.equals(Float.class)) { 389 390 if (orig instanceof Float … … 393 394 return ((Float) orig) + Float.parseFloat(value); 394 395 } 395 396 if (value.length() == 0 || 396 397 if (value.length() == 0 || value.equals("null")) 397 398 return null; 398 399 399 400 400 return Float.parseFloat(value); … … 491 491 just[0] = Justification.getJustification(value); 492 492 return just; 493 } else if (name.endsWith("Permission")) {493 } else if (name.endsWith("Permission")) { 494 494 Permission[] permission = new Permission[1]; 495 495 permission[0] = Permission.getPermission(value); … … 560 560 return output; 561 561 562 if (name.endsWith("Text")){562 if (name.endsWith("Text")) { 563 563 List<String> list = new LinkedList<String>(); 564 for (String s: output.toString().split("\n")){564 for (String s : output.toString().split("\n")) { 565 565 list.add(s); 566 566 } … … 569 569 if (name.endsWith("Justification")) 570 570 return ((Justification) output).getCode(); 571 571 572 572 if (name.endsWith("Permission")) 573 573 return ((Permission) output).getCode(); … … 619 619 public static String getPdfFont(String family) { 620 620 family = family.toLowerCase(); 621 if (family.equals(Text.FONT_WHEEL[0])){621 if (family.equals(Text.FONT_WHEEL[0])) { 622 622 return FontFactory.HELVETICA; 623 } else if(family.equals(Text.FONT_WHEEL[2])){623 } else if (family.equals(Text.FONT_WHEEL[2])) { 624 624 return FontFactory.TIMES_ROMAN; 625 625 } 626 626 return FontFactory.COURIER; 627 627 } 628 629 public static String getCssColor(Color c) { 630 assert (c != null); 631 return "rgb(" + c.getRed() + "," + c.getGreen() + "," + c.getBlue() 632 + ")"; 633 } 634 635 public static String getCssFontFamily(String family) { 636 family = family.toLowerCase(); 637 if(family.equals("monospaced") || family.equals("dialog")){ 638 return "courier"; 639 }else if(family.equals("sansserif")){ 640 return "sans-serif"; 641 }else{ 642 return family; 643 } 644 } 628 645 } -
trunk/src/org/expeditee/io/DefaultTreeWriter.java
r121 r289 14 14 TreeWriter { 15 15 16 protected int _indent = 0; 17 16 18 // the list of frames currently being processed 17 19 private Stack<FrameCounter> _frames = new Stack<FrameCounter>(); … … 47 49 */ 48 50 protected void writeStartLink(Item linker) throws IOException { 49 51 _indent++; 50 52 } 51 53 … … 59 61 */ 60 62 protected void writeEndLink(Item linker) throws IOException { 61 63 _indent--; 62 64 } 63 65 -
trunk/src/org/expeditee/items/Item.java
r286 r289 35 35 import org.expeditee.gui.MessageBay; 36 36 import org.expeditee.gui.Overlay; 37 import org.expeditee.gui.UserSettings; 37 38 import org.expeditee.gui.Vector; 38 39 import org.expeditee.io.Conversion; … … 192 193 dest._overlay = source._overlay; 193 194 dest._mode = source._mode;// SelectedMode.None; 194 // dest._highlightColor = source._highlightColor;195 // dest.setHighlight(source.getHighlight());196 195 // dest._highlightColor = source._highlightColor; 196 // dest.setHighlight(source.getHighlight()); 197 197 198 dest._visible = source._visible; 198 199 Frame parent = source.getParentOrCurrentFrame(); -
trunk/src/org/expeditee/items/Text.java
r286 r289 36 36 import org.expeditee.gui.FrameMouseActions; 37 37 import org.expeditee.gui.FrameUtils; 38 import org.expeditee.gui.UserSettings; 38 39 import org.expeditee.math.ExpediteeJEP; 39 40 import org.nfunk.jep.Node; … … 275 276 276 277 public void setAttributeValue(String value) { 277 AttributeValuePair avp = new AttributeValuePair(getText(), false);278 AttributeValuePair avp = new AttributeValuePair(getText(), false); 278 279 avp.setValue(value); 279 280 setText(avp.toString()); … … 1426 1427 if (hasFormula()) { 1427 1428 g.setColor(getPaintHighlightColor()); 1428 Stroke highlightStroke = new BasicStroke( 1429 1F, CAP, JOIN); 1429 Stroke highlightStroke = new BasicStroke(1F, CAP, JOIN); 1430 1430 g.setStroke(highlightStroke); 1431 1431 … … 1556 1556 public void setSize(float size) { 1557 1557 invalidateAll(); 1558 //size *= UserSettings.ScaleFactor; 1558 1559 // Dont want to have size set when duplicating a point which has size 0 1559 1560 if (size < 0)
Note:
See TracChangeset
for help on using the changeset viewer.