Changeset 410


Ignore:
Timestamp:
11/19/08 16:43:35 (16 years ago)
Author:
ra33
Message:

Completed several tasks specified by Rob...

  1. Changing the resize for single text items to use the text items origin as the origin for the resize.
  1. Added message linking to documentation for SIMPLE statements when a statement is used incorrectly.
  1. Other minor changes...
Location:
trunk/src/org/expeditee
Files:
1 added
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/actions/Navigation.java

    r408 r410  
    88import org.expeditee.gui.FrameUtils;
    99import org.expeditee.gui.MessageBay;
     10import org.expeditee.gui.UserSettings;
    1011import org.expeditee.items.Item;
    1112
     
    4142         */
    4243        public static void GotoHome() {
    43                 FrameUtils.DisplayHomeFrame();
     44                FrameUtils.DisplayFrame(UserSettings.HomeFrame);
     45        }
     46       
     47        public static void GotoZero() {
     48                FrameUtils.DisplayFrame(DisplayIO.getCurrentFrame().getFramesetName() + 0);
    4449        }
    4550
     
    4853         */
    4954        public static void GotoProfile() {
    50                 FrameUtils.DisplayProfileFrame();
    51         }
    52 
     55                FrameUtils.DisplayFrame(UserSettings.ProfileName + '1');
     56        }
     57
     58        /**
     59         * Loads the Frame in the current frameset with the given number and
     60         * displays it
     61         *
     62         * @param value
     63         *            The number of the Frame to load
     64         */
     65        public static void Goto(Integer value) {
     66                FrameUtils.DisplayFrame(DisplayIO.getCurrentFrame().getFramesetName() + value);
     67        }
     68       
    5369        /**
    5470         * Loads the Frame with the given FrameName and displays it
     
    5975        public static void Goto(String frameName) {
    6076                FrameUtils.DisplayFrame(frameName);
    61         }
    62 
    63         /**
    64          * Loads the Frame in the current frameset with the given number and
    65          * displays it
    66          *
    67          * @param value
    68          *            The number of the Frame to load
    69          */
    70         public static void Goto(Integer value) {
    71                 FrameUtils.DisplayFrame(value.toString());
    7277        }
    7378
  • trunk/src/org/expeditee/actions/Simple.java

    r409 r410  
    499499                        } catch (ArrayIndexOutOfBoundsException e) {
    500500                                FlagError(item);
    501                                 throw new Exception("Too few parametres: " + item.toString());
     501                                throw new IncorrectUseOfStatementException("Too few parametres: " + item.toString(), item.getStatement());
    502502                        } catch (NullPointerException e) {
    503503                                FlagError(item);
     
    506506                        } catch (RuntimeException e) {
    507507                                FlagError(item);
    508                                 throw new Exception(e.getMessage() + " " + item.toString());
     508                                throw new IncorrectUseOfStatementException(e.getMessage() + " " + item.toString(), item.getStatement());
    509509                        } catch (Exception e) {
    510510                                throw new Exception(e.getMessage());
     
    10071007                } else if (tokens[0].startsWith("set")) {
    10081008                        if (tokens[0].equals("set")) {
     1009                                assertExactParametreCount(tokens, 2);
    10091010                                try {
    10101011                                        // Check if we are setting variable to variable
  • trunk/src/org/expeditee/agents/wordprocessing/JSpellChecker.java

    r389 r410  
    11package org.expeditee.agents.wordprocessing;
    22
    3 import java.awt.Color;
    43import java.io.File;
    54import java.io.FileNotFoundException;
     
    1110import org.expeditee.gui.Frame;
    1211import org.expeditee.gui.FrameIO;
    13 import org.expeditee.gui.MessageBay;
    1412import org.expeditee.items.Text;
    1513
     
    9896        public void init() throws FileNotFoundException, IOException {
    9997                log(this.hashCode() + ": JSpellChecker.init");
    100                 MessageBay.displayMessage("Loading spell checker...");
     98                //MessageBay.displayMessage("Loading spell checker...");
    10199
    102100                checker = new SpellChecker();
     
    113111                initialized = true;
    114112
    115                 MessageBay.displayMessage("Spell checker Loaded", Color.green.darker());
     113                //MessageBay.displayMessage("Spell checker Loaded", Color.green.darker());
    116114        }
    117115
  • trunk/src/org/expeditee/gui/FrameKeyboardActions.java

    r408 r410  
    950950                        // - UserSettings.Gravity);
    951951                        text.justify(true);
     952                        break;
     953
     954                case KeyEvent.VK_R:
     955                        Text textCurrent = getCurrentTextItem();
     956                        if (textCurrent == null) {
     957                                for (Text t : currentFrame.getBodyTextItems(false)) {
     958                                        t.setWidth(null);
     959                                        t.justify(true);
     960                                }
     961
     962                                return;
     963                        }
     964                        textCurrent.setWidth(null);
     965                        textCurrent.justify(true);
    952966                        break;
    953967                case KeyEvent.VK_S:
     
    10721086                                        break;
    10731087                                case SizeUp:
    1074                                         SetSize(firstConnected, repeat, false, true);
     1088                                        SetSize(firstConnected, repeat, false, true, isControlDown);
    10751089                                        break;
    10761090                                case SizeDown:
    1077                                         SetSize(firstConnected, -repeat, false, true);
     1091                                        SetSize(firstConnected, -repeat, false, true, isControlDown);
    10781092                                        break;
    10791093                                case ChangeColor:
     
    11481162                        return;
    11491163                case SizeUp:
    1150                         SetSize(on, repeat, true, false);
     1164                        SetSize(on, repeat, true, false, isControlDown);
    11511165                        if (on instanceof Text) {
    11521166                                DisplayIO.setTextCursor((Text) on, Text.NONE, true, false,
     
    11551169                        break;
    11561170                case SizeDown:
    1157                         SetSize(on, -repeat, true, false);
     1171                        SetSize(on, -repeat, true, false, isControlDown);
    11581172                        if (on instanceof Text) {
    11591173                                DisplayIO.setTextCursor((Text) on, Text.NONE, true, false,
     
    14381452         */
    14391453        public static void moveCursorAndFreeItems(int x, int y) {
     1454                int oldX = FrameMouseActions.getX();
     1455                int oldY = FrameMouseActions.getY();
     1456               
     1457                if(oldX == x && oldY == y)
     1458                        return;
     1459               
    14401460                DisplayIO.setCursorPosition(x, y);
    14411461                Item firstItem = FreeItems.getItemAttachedToCursor();
     
    16201640         */
    16211641        public static void SetSize(Item item, int diff, boolean moveCursor,
    1622                         boolean insideEnclosure) {
     1642                        boolean insideEnclosure, boolean isControlDown) {
    16231643                Collection<Item> toSize = new HashSet<Item>();
    16241644                // the mouse is only moved when the Item is on the frame, not free
     
    17961816                                i.setSize(newSize);
    17971817                                if (i instanceof Text && i.getSize() != oldSize) {
    1798                                         i.translate(origin, resizeRatio);
    1799                                         if (i.isLineEnd()) {
    1800                                                 i.setPosition(i.getPosition());
     1818                                        if (toSize.size() == 1 &&  !isControlDown) {
     1819                                                moveCursorAndFreeItems(i.getX(), i.getY());
     1820                                        } else {
     1821                                                i.translate(origin, resizeRatio);
     1822                                                if (i.isLineEnd()) {
     1823                                                        i.setPosition(i.getPosition());
     1824                                                }
    18011825                                        }
    18021826                                }
  • trunk/src/org/expeditee/gui/FrameMouseActions.java

    r408 r410  
    775775                                        tdfc(clickedOn);
    776776                                } catch (RuntimeException e) {
     777                                        e.printStackTrace();
    777778                                        MessageBay.errorMessage("TDFC error: " + e.getMessage());
    778779                                }
  • trunk/src/org/expeditee/gui/FrameUtils.java

    r409 r410  
    472472                DisplayFrame(framename, true, true);
    473473        }
    474 
    475         public static void DisplayHomeFrame() {
    476                 DisplayFrame(UserSettings.HomeFrame);
    477         }
    478 
    479         public static void DisplayProfileFrame() {
    480                 DisplayFrame(UserSettings.ProfileName + '1');
    481         }
    482 
     474       
    483475        public static Frame getFrame(String frameName) {
    484476                // if the new frame does not exist then tell the user
  • trunk/src/org/expeditee/io/KMSReader.java

    r400 r410  
    8787                        _ItemTags.put("u", Item.class.getMethod("setHighlight", pBool));
    8888                        _ItemTags.put("e", Item.class.getMethod("setFillColor", pColor));
     89                        _ItemTags.put("E", Item.class.getMethod("setGradientColor", pColor));
     90                        _ItemTags.put("Q", Item.class.getMethod("setGradientAngle", pInt));
     91                       
    8992                        _ItemTags.put("i", Item.class.getMethod("setFillPattern", pString));
    9093                        _ItemTags.put("o", Item.class.getMethod("setOwner", pString));
  • trunk/src/org/expeditee/items/FrameBitmap.java

    r108 r410  
    3737                                width = s.length();
    3838                }
     39               
     40                if(width == 0)
     41                        return false;
     42               
    3943                BufferedImage bi = new BufferedImage(width, height,
    4044                                BufferedImage.TYPE_INT_ARGB);
  • trunk/src/org/expeditee/items/Item.java

    r400 r410  
    2424
    2525import org.expeditee.actions.Actions;
     26import org.expeditee.actions.IncorrectUseOfStatementException;
    2627import org.expeditee.actions.Misc;
    2728import org.expeditee.actions.Simple;
     
    191192                 * the user uses backspace to delete a text line end
    192193                 */
    193                 //dest._anchorBottom = source._anchorBottom;
    194                 //dest._anchorRight = source._anchorRight;
    195 
     194                // dest._anchorBottom = source._anchorBottom;
     195                // dest._anchorRight = source._anchorRight;
    196196                dest.setFormula(source.getFormula());
    197197                dest.setParent(source.getParent());
     
    770770                return _formula != null;
    771771        }
    772        
     772
    773773        public boolean hasAttributeValuePair() {
    774774                return _attributeValuePair != null && _attributeValuePair.hasPair();
     
    949949                return getWidth();
    950950        }
    951        
     951
    952952        public Integer getWidth() {
    953953                return null;
     
    12411241                        Simple.ProgramStarted();
    12421242                        Simple.RunFrameAndReportError(this, new Context());
    1243                         Simple.ProgramFinished();
    12441243                        MessageBay.displayMessage(AgentStats.getStats(), GREEN);
    12451244                } catch (ConcurrentModificationException ce) {
    1246                         Simple.ProgramFinished();
    12471245                        ce.printStackTrace();
     1246                } catch (IncorrectUseOfStatementException ise) {
     1247                        MessageBay.linkedErrorMessage(ise.getMessage());
     1248                        MessageBay.displayMessage("See SIMPLE doc for ["
     1249                                        + ise.getStatement() + "] statement", ise.getStatement() + "1", Color.CYAN.darker(),
     1250                                        true, null);
    12481251                } catch (Exception e) {
    12491252                        MessageBay.linkedErrorMessage(e.getMessage());
    1250                         Simple.ProgramFinished();
    1251                 }
     1253                }
     1254                Simple.ProgramFinished();
    12521255                // Need to repaint any highlights etc
    12531256                FrameGraphics.requestRefresh(true);
     
    18731876        public void setRightMargin(int i, boolean fixWidth) {
    18741877                int newWidth = i - getX() - Item.MARGIN_LEFT;
    1875                 if(!fixWidth){
     1878                if (!fixWidth) {
    18761879                        newWidth *= -1;
    18771880                }
    1878                
     1881
    18791882                setWidth(newWidth);
    18801883        }
     
    27992802
    28002803        public AttributeValuePair getAttributeValuePair() {
    2801                 if(_attributeValuePair  == null){
     2804                if (_attributeValuePair == null) {
    28022805                        _attributeValuePair = new AttributeValuePair(getText());
    28032806                }
     
    28052808        }
    28062809
    2807         /*private static Set<Object> _locks = new HashSet<Object>();
    2808 
    2809         public static void lock(Object itemToLock) {
    2810                 _locks.add(itemToLock);
    2811         }
    2812        
    2813         public static void unlock(Object itemToUnlock) {
    2814                 _locks.remove(itemToUnlock);
    2815         }
    2816        
    2817         public static boolean isLocked(Object item) {
    2818                 return _locks.contains(item);
    2819         }*/
    2820        
    2821        
     2810        /*
     2811         * private static Set<Object> _locks = new HashSet<Object>();
     2812         *
     2813         * public static void lock(Object itemToLock) { _locks.add(itemToLock); }
     2814         *
     2815         * public static void unlock(Object itemToUnlock) {
     2816         * _locks.remove(itemToUnlock); }
     2817         *
     2818         * public static boolean isLocked(Object item) { return
     2819         * _locks.contains(item); }
     2820         */
     2821
    28222822}
  • trunk/src/org/expeditee/items/Text.java

    r404 r410  
    100100        public static final int PAGE_UP = 8;
    101101
    102         private Integer _maxWidth = null;
     102        /*
     103         * Set the width to be IMPLICIT, but as wide as possible, a negative width
     104         * value is one that is implicitly set by the system... a positive value is
     105         * one explicitly set by the user.
     106         */
     107        private Integer _maxWidth = Integer.MIN_VALUE + 1;
    103108
    104109        private Justification _justification = Justification.left;
     
    575580                _text.insert(left, newText);
    576581                rebuild(true);
     582               
     583                clearCache();
    577584
    578585                invalidateAll();
     
    11261133                        List<String> list = new LinkedList<String>();
    11271134
     1135                        // Rebuilding prevents errors when displaying frame bitmaps
     1136                        if (_lineOffsets.size() == 0) {
     1137                                rebuild(false);
     1138                        }
     1139
    11281140                        int last = 0;
    11291141                        for (int offset : _lineOffsets) {
     
    15341546                if (_textLayouts.size() < 1) {
    15351547                        rebuild(true);
    1536                         //System.out.println("Error: " + _text);
    1537                         //return;
     1548                        // System.out.println("Error: " + _text);
     1549                        // return;
    15381550                }
    15391551
     
    16841696                copy.setInitialSpacing(getInitialSpacing());
    16851697
    1686                 copy.setWidth(getWidth());
     1698                copy.setWidth(getWidthToSave());
    16871699                copy.setJustification(getJustification());
    16881700                copy.setLetterSpacing(getLetterSpacing());
    16891701                copy.setWordSpacing(getWordSpacing());
    1690                 copy.setWidth(getWidth());
     1702                copy.setWidth(getWidthToSave());
    16911703                copy.setFont(getFont());
    16921704                if (hasFormula()) {
     
    19801992                                // setRightMargin(frameWidth, false);
    19811993                        }
     1994                }
     1995                String text = _text.toString();
     1996
     1997                // Show the overlay stuff immediately if this is an overlay item
     1998                if (hasLink() && (text.startsWith("@ao") || text.startsWith("@o"))) {
     1999                        FrameKeyboardActions.Refresh();
    19822000                }
    19832001        }
     
    22852303                rebuild(true);
    22862304        }
     2305
     2306        /*
     2307         * Returns the SIMPLE statement contained by this text item.
     2308         *
     2309         */
     2310        public String getStatement() {
     2311                return getText().split("\\s+")[0];
     2312        }
    22872313}
  • trunk/src/org/expeditee/items/widgets/charts/AbstractChart.java

    r376 r410  
    8686                                        invalidateLink();
    8787                                        FrameKeyboardActions.SetSize(getFirstCorner(), 1, false,
    88                                                         true);
     88                                                        true, false);
    8989                                        invalidateSelf();
    9090                                        FrameGraphics.refresh(true);
     
    9494                                        invalidateLink();
    9595                                        FrameKeyboardActions.SetSize(getFirstCorner(), -1, false,
    96                                                         true);
     96                                                        true, false);
    9797                                        invalidateSelf();
    9898                                        FrameGraphics.refresh(true);
Note: See TracChangeset for help on using the changeset viewer.