Changeset 13


Ignore:
Timestamp:
05/06/08 12:10:11 (16 years ago)
Author:
ra33
Message:

Changes

Location:
trunk/src/org/expeditee
Files:
7 edited

Legend:

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

    r4 r13  
    124124                Frame last = FrameIO.LoadLast();
    125125                FrameUtils.DisplayFrame(last, true);
     126        }
     127       
     128        public static void ZeroFrame() {
     129                Frame zeroFrame = FrameIO.LoadZero();
     130                FrameUtils.DisplayFrame(zeroFrame, true);
    126131        }
    127132       
  • trunk/src/org/expeditee/gui/DisplayIO.java

    r10 r13  
    5959         * The title to display in the Title bar.
    6060         */
    61         public static final String TITLE = "Exp01May2008A";
     61        public static final String TITLE = "Exp01May2008B";
    6262
    6363        private DisplayIO() {
  • trunk/src/org/expeditee/gui/Frame.java

    r10 r13  
    476476                }
    477477                _frameName = new Text(id);
     478                _frameName.setParent(this);
    478479                _frameName.setMaxSize(FrameGraphics.getMaxFrameSize());
    479480                _frameName.setText(getFramesetNameAdjusted() + _number);
  • trunk/src/org/expeditee/gui/FrameGraphics.java

    r10 r13  
    567567
    568568        public static void DisplayMessageAlways(String message) {
    569                 _lastMessage = null;
     569                //_lastMessage = null;
    570570                displayMessage(message, null, Color.BLACK);
    571571                Misc.Beep();
     
    577577        }
    578578
    579         private static String _lastMessage = null;
     579        //private static String _lastMessage = null;
    580580
    581581        private static void displayMessage(String message, String link, Color color) {
    582582                // add timestamp to message
    583                 if (message.equals(_lastMessage))
    584                         return;
    585                 _lastMessage = message;
     583                //if (message.equals(_lastMessage))
     584                //      return;
     585                //_lastMessage = message;
    586586
    587587                // message += _formatter.format(Calendar.getInstance().getTime());
  • trunk/src/org/expeditee/gui/FrameIO.java

    r12 r13  
    387387                return null;
    388388        }
    389 
     389       
     390        public static Frame LoadZero(String framesetName, String path) {
     391                String adjustedName = FrameUtils.GetFramesetNameAdjusted(framesetName);
     392                return LoadFrame(adjustedName + 0);
     393        }
     394
     395        public static Frame LoadZero() {
     396                Frame current = DisplayIO.getCurrentFrame();
     397                return LoadZero(current.getFramesetName(), current.path);
     398        }
     399       
    390400        public static Frame LoadLast() {
    391401                Frame current = DisplayIO.getCurrentFrame();
     
    891901                String conversion = frameset + " --> ";
    892902
    893                 // ensure the framename is valid
    894                 frameset = ConvertToValidFramesetName(frameset);
    895 
    896                 if (frameset == null)
     903                if (! IsValidFramesetName(frameset)){
    897904                        throw new Exception("Invalid frameset name");
    898 
     905                }
     906               
    899907                if (!recreate && FrameIO.DoesFramesetExist(frameset)) {
    900908                        throw new ExistingFramesetException(frameset);
     
    957965
    958966                return base;
    959         }
     967        }private static boolean IsValidFramesetName(String frameset) {
     968                for (int i = 0; i < frameset.length(); i++) {
     969                        // capitalize all characters after spaces
     970                        if (!Character.isLetterOrDigit(frameset.charAt(i))) {
     971                                return false;
     972                        }
     973                }
     974                return true;
     975        }
     976
     977
    960978
    961979        public static boolean DeleteFrameset(String framesetName) {
  • trunk/src/org/expeditee/gui/FrameKeyboardActions.java

    r12 r13  
    250250
    251251                if (ip == null) {
    252                         Frame next = (direction == Text.RIGHT) ? FrameIO.LoadNext()
    253                                         : FrameIO.LoadPrevious();
    254                         FrameUtils.DisplayFrame(next, true);
     252                        navigateFrame(direction);
    255253                        return;
    256254                }
     
    261259                        // positions over the the frame name navigation occurs
    262260                        if (on.isFrameName()) {
    263                                 Frame next = (direction == Text.RIGHT) ? FrameIO.LoadNext()
    264                                                 : FrameIO.LoadPrevious();
    265                                 FrameUtils.DisplayFrame(next, true);
     261                                navigateFrame(direction);
    266262                                return;
    267263                        } else {
     
    275271        }
    276272
     273        private void navigateFrame(int direction) {
     274                Frame next = null;
     275                switch(direction){
     276                case Text.RIGHT:
     277                case Text.PAGE_UP:
     278                        next = FrameIO.LoadNext();
     279                        break;
     280                case Text.LEFT:
     281                case Text.PAGE_DOWN:
     282                        next = FrameIO.LoadPrevious();
     283                        break;
     284                case Text.HOME:
     285                        next = FrameIO.LoadZero();
     286                        break;
     287                case Text.END:
     288                        next = FrameIO.LoadLast();
     289                        break;
     290                }
     291                FrameUtils.DisplayFrame(next, true);
     292        }
     293
    277294        /**
    278295         * Receives and processes any Function, Control, and Escape key presses
     
    314331                case KeyEvent.VK_RIGHT:
    315332                        move(Text.RIGHT);
     333                        break;
     334                case KeyEvent.VK_PAGE_DOWN:
     335                        navigateFrame(Text.PAGE_DOWN);
     336                        break;
     337                case KeyEvent.VK_PAGE_UP:
     338                        navigateFrame(Text.PAGE_UP);
    316339                        break;
    317340                case KeyEvent.VK_UP:
     
    784807                        if (Frame.itemAttachedToCursor()) {
    785808                                DisplayIO.setCursorPosition(dummyItem.getX(), dummyItem.getY());
    786                                 Frame.getItemAttachedToCursor().setPosition(dummyItem.getX(),
    787                                                 dummyItem.getY());
     809                                Item firstItem = Frame.getItemAttachedToCursor();
     810                                int deltaX = firstItem.getX() - dummyItem.getX();
     811                                int deltaY = firstItem.getY() - dummyItem.getY();
     812                               
     813                                for(Item i: Frame.FreeItems) {
     814                                        i.setPosition(i.getX()-deltaX,
     815                                                i.getY() - deltaY);
     816                                }
    788817                        } else {
    789818                                DisplayIO
     
    13301359                        // doing Tdfc while the cursor is set to the text cursor
    13311360                        DisplayIO.setCursor(Item.DEFAULT_CURSOR);
    1332                 } catch (ExistingFramesetException efe) {
    1333                         FrameGraphics.ErrorMessage(efe.getMessage());
    13341361                } catch (Exception e) {
    1335                         FrameGraphics.ErrorMessage("Frameset could not be created: "
    1336                                         + e.getMessage());
     1362                        FrameGraphics.ErrorMessage(e.getMessage());
    13371363                }
    13381364        }
  • trunk/src/org/expeditee/items/Text.java

    r7 r13  
    6868        public static final int END = 5;
    6969
     70        public static final int PAGE_DOWN = 6;
     71
     72        public static final int PAGE_UP = 7;
     73
    7074        private int _maxWidth = -1;
    7175
     
    560564                                                x,
    561565                                                (getX() - Item.MARGIN_RIGHT - (2 * getGravity()) + getBoundsWidth()));
    562                 return new Point(x, getY() + y
    563                                 + (int) caret[1]);
     566                return new Point(x, getY() + y + (int) caret[1]);
    564567        }
    565568
     
    14011404                                return;
    14021405
    1403                         // Remove 'a: ' from the begining if it is there
    1404                         if (_text.length() > 3 && _text.charAt(0) == 'a'
    1405                                         && _text.charAt(1) == ':') {
    1406                                 _text.delete(0, 2);
    1407                                 while (_text.charAt(0) == ' ')
    1408                                         _text.delete(0, 1);
    1409                         }
     1406                        /*
     1407                         * // Remove 'a: ' from the begining if it is there if
     1408                         * (_text.length() > 3 && _text.charAt(0) == 'a' && _text.charAt(1) ==
     1409                         * ':') { _text.delete(0, 2); while (_text.charAt(0) == ' ')
     1410                         * _text.delete(0, 1); }
     1411                         */
    14101412                        _text.insert(0, "@");
    14111413
     
    15581560                                Rectangle textOutline = text.getLogicalHighlightShape(0,
    15591561                                                text.getCharacterCount()).getBounds();
    1560                                
     1562
    15611563                                // check if the cursor is within the top, bottom and within the
    15621564                                // gravity of right
    15631565                                if (y - textY > textOutline.y - NEAR_DISTANCE
    1564                                                 && y - textY < textOutline.y + textOutline.height + NEAR_DISTANCE
     1566                                                && y - textY < textOutline.y + textOutline.height
     1567                                                                + NEAR_DISTANCE
    15651568                                                && x - textX < textOutline.width + NEAR_DISTANCE)
    15661569                                        return true;
     
    15701573                return false;
    15711574        }
    1572        
     1575
    15731576        @Override
    15741577        public void delete() {
Note: See TracChangeset for help on using the changeset viewer.