Changeset 137


Ignore:
Timestamp:
07/14/08 10:05:43 (16 years ago)
Author:
ra33
Message:

Fixed a few problems with painting etc.. and finished search stuff

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

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/gui/Browser.java

    r121 r137  
    8080
    8181                UserSettings.Init();
     82               
    8283                UserSettings.Username = FrameIO.ConvertToValidFramesetName(System
    8384                                .getProperty("user.name"));
     
    9495                        }
    9596                }
     97               
    9698                FrameUtils.ParseProfile(profile);
    9799               
  • trunk/src/org/expeditee/gui/DisplayIO.java

    r128 r137  
    6161         * The title to display in the Title bar.
    6262         */
    63         public static final String TITLE = "Exp02Jul2008A";
     63        public static final String TITLE = "Exp10Jul2008A";
    6464
    6565        private DisplayIO() {
  • trunk/src/org/expeditee/gui/FrameGraphics.java

    r131 r137  
    3434
    3535        // the maximum size that can be used to paint on
    36         private static Dimension _MaxSize;
     36        private static Dimension _MaxSize = new Dimension(1000,1000);
    3737
    3838        // modes
  • trunk/src/org/expeditee/gui/FrameMouseActions.java

    r133 r137  
    229229                // System.out.println("MousePressed " + e.getX() + "," + e.getY() + " "
    230230                // + e.getWhen());
    231                
     231
    232232                // Auto-hide popups when user clicks into expeditee world
    233233                PopupManager.hideAllPopups();
     
    24202420                        if (i.hasVector()) {
    24212421                                bReparse = true;
    2422                                 // Frame overlayFrame = FrameIO.LoadFrame(i.getAbsoluteLink());
    2423                                 // Collection<Item> copies = ItemUtils.CopyItems(overlayFrame
    2424                                 // .getNonAnnotationItems(), i.getVector());
    2425                                 // FreeItems.getInstance().addAll(copies);
    2426                                 // TODO add the copies to the free items so they are visible
    2427                                 // when the cursor is moving around but are not anchored
     2422
     2423                                Frame overlayFrame = FrameIO.LoadFrame(i.getAbsoluteLink());
     2424                                Collection<Item> copies = ItemUtils.CopyItems(overlayFrame
     2425                                                .getNonAnnotationItems(), i.getVector());
     2426                                for(Item copy: copies){
     2427                                        FreeItems.getInstance().add(copy);
     2428                                        copy.setFloating(true);
     2429                                        copy.setParent(null);
     2430                                }
    24282431                        }
    24292432                }
     
    25082511
    25092512        public static void anchor(Item toAnchor, boolean checkEnclosure) {
     2513                //Only anchor items we have full permission over... ie dont anchor vector items
     2514                if(!toAnchor.hasPermission(Permission.full))
     2515                        return;
     2516               
    25102517                toAnchor.anchor();
    25112518
  • trunk/src/org/expeditee/gui/MessageBay.java

    r130 r137  
    124124
    125125        public static void invalidateFullBay() {
     126                if(_messageBuffer == null)
     127                        return;
     128               
    126129                _dirtyAreas.clear();
    127130                addDirtyArea(new Rectangle(0, FrameGraphics.getMaxFrameSize().height,
  • trunk/src/org/expeditee/items/Item.java

    r133 r137  
    175175
    176176                dest.setParent(source.getParent());
     177                dest._overlay = source._overlay;
    177178                dest._mode = source._mode;// SelectedMode.None;
    178179                dest._visible = source._visible;
     
    16961697        public void setHighlightMode(HighlightMode mode, Color color) {
    16971698                setHighlightColor(color);
    1698                 if (_mode != mode) {
    1699                         _mode = mode;
    1700                         this.invalidateCommonTrait(ItemAppearence.HighlightModeChanged);
     1699                if (hasPermission(Permission.followLinks)) {
     1700                        if (_mode != mode) {
     1701                                _mode = mode;
     1702                                this.invalidateCommonTrait(ItemAppearence.HighlightModeChanged);
     1703                        }
    17011704                }
    17021705        }
     
    18931896                return _actions != null && _actions.size() > 0;
    18941897        }
    1895        
     1898
    18961899        public void setAction(String action) {
    18971900                // Want to resize the highlight box for text items if actions are been
     
    19281931                boolean hasLink = getLink() != null;
    19291932                boolean hasAction = hasAction();
    1930                
     1933
    19311934                if (hasLink || hasAction) {
    19321935                        g.setStroke(HIGHLIGHT_STROKE);
  • trunk/src/org/expeditee/items/Text.java

    r131 r137  
    3838public class Text extends Item {
    3939        public static String LINE_SEPARATOR = System.getProperty("line.separator");
    40         public static char[] BULLETS = {'\u2219' , '\u2218', '\u2217'};
     40
     41        public static char[] BULLETS = { '\u2219', '\u2218', '\u2217' };
     42
    4143        private static char DEFAULT_BULLET = BULLETS[2];
     44
    4245        private static String DEFAULT_BULLET_STRING = DEFAULT_BULLET + " ";
    43        
     46
    4447        private String[] _processedText = null;
    4548
     
    97100
    98101        private int _selectionEnd = -1;
    99        
     102
    100103        // text is broken up into lines
    101104        private StringBuffer _text = new StringBuffer();
     
    125128                setID(id);
    126129        }
    127        
     130
    128131        /**
    129132         * Creates a text item which is not added to the frame.
     133         *
    130134         * @param text
    131135         */
     
    190194        }
    191195
    192        
    193196        /**
    194197         * Sets the justification of this Text item. The given integer should
     
    277280         */
    278281        public void removeText(String text) {
    279                
     282
    280283                if (_text.length() > 0 && _text.indexOf(text) == 0) {
    281                         //invalidateAll();
     284                        // invalidateAll();
    282285                        _text.delete(0, text.length());
    283286                }
    284                
    285287
    286288        }
     
    289291                int length = _text.length();
    290292                if (length > 0) {
    291                         //invalidateAll();
     293                        // invalidateAll();
    292294                        int pos = _text.indexOf(textToRemove);
    293295                        int textToRemoveLength = textToRemove.length();
     
    296298                        }
    297299                }
    298                
     300
    299301        }
    300302
     
    366368         */
    367369        private char getNextBullet(char bullet) {
    368                 for(int i = 0; i < BULLETS.length - 1; i++){
    369                         if(BULLETS[i]== bullet)
    370                                 return BULLETS[i+1];
     370                for (int i = 0; i < BULLETS.length - 1; i++) {
     371                        if (BULLETS[i] == bullet)
     372                                return BULLETS[i + 1];
    371373                }
    372374                return BULLETS[0];
     
    374376
    375377        private char getPreviousBullet(char bullet) {
    376                 for(int i = 1; i < BULLETS.length; i++){
    377                         if(BULLETS[i]== bullet)
     378                for (int i = 1; i < BULLETS.length; i++) {
     379                        if (BULLETS[i] == bullet)
    378380                                return BULLETS[i - 1];
    379381                }
     
    470472                if (_selectionStart < 0 || _selectionEnd < 0)
    471473                        return null;
    472                
     474
    473475                invalidateAll();
    474                
     476
    475477                if (_selectionEnd > _text.length())
    476478                        _selectionEnd = _text.length();
     
    484486                _text.insert(left, newText);
    485487                rebuild(true);
    486                
     488
    487489                invalidateAll();
    488490
     
    520522                TextLayout current = null;
    521523                int line;
    522                
     524
    523525                invalidateAll();
    524526
     
    617619                        }
    618620
    619                         if (_text.length() == 0){
     621                        if (_text.length() == 0) {
    620622                                rebuild(false);
    621623                                return new Point2D.Float(this._x, this._y);
     
    664666                                                x,
    665667                                                (getX() - Item.MARGIN_RIGHT - (2 * getGravity()) + getBoundsWidth()));
    666                
     668
    667669                invalidateAll();
    668                
     670
    669671                return new Point2D.Float(Math.round(x), Math.round(getY() + y
    670672                                + caret[1]));
     
    813815                // rejustify();
    814816                rebuild(false);
    815                
     817
    816818                invalidateAll();
    817819        }
     
    11331135        private void rebuild(boolean limitWidth) {
    11341136                // if there is no text, there is nothing to do
    1135                 if (_text == null || _text.length() == 0){
    1136 //                      Frame parent = getParent();
    1137 //                      if(parent != null)
    1138 //                              parent.removeItem(this);
     1137                if (_text == null || _text.length() == 0) {
     1138                        // Frame parent = getParent();
     1139                        // if(parent != null)
     1140                        // parent.removeItem(this);
    11391141                        return;
    11401142                }
    1141                
     1143
    11421144                AttributedString paragraphText = new AttributedString(_text.toString());
    11431145                paragraphText.addAttribute(TextAttribute.FONT, getPaintFont());
     
    11881190
    11891191                updatePolygon();
    1190                
     1192
    11911193        }
    11921194
     
    13141316                        return;
    13151317                }
    1316                
     1318
     1319                // check if its a vector item and paint all the vector stuff too if this
     1320                // item is a free item
     1321                // This will allow for dragging vectors around the place!
     1322                if (hasVector() && isFloating()) {
     1323                        FrameGraphics.requestRefresh(false);
     1324                        // TODO make this use a more efficient paint method...
     1325                        // Have the text item return a bigger repaint area if it has an
     1326                        // associated vector
     1327                }
     1328
    13171329                // the background is only cleared if required
    13181330                if (getBackgroundColor() != null) {
     
    14181430                paintLink(g);
    14191431        }
    1420        
     1432
    14211433        @Override
    14221434        protected Rectangle getLinkDrawArea() { // TODO: Revise
     
    14931505                        if (isAnnotation())
    14941506                                return;
    1495                         if (!isLineEnd() && _text.length() > 0 && _text.charAt(0) == DEFAULT_BULLET) {
     1507                        if (!isLineEnd() && _text.length() > 0
     1508                                        && _text.charAt(0) == DEFAULT_BULLET) {
    14961509                                newPoint.setLocation(insertText(""
    14971510                                                + (char) KeyEvent.VK_BACK_SPACE, mouseX, mouseY, 1));
     
    15101523                                newPoint.setLocation(insertText(""
    15111524                                                + (char) KeyEvent.VK_BACK_SPACE, mouseX, mouseY, 1));
    1512                                 newPoint
    1513                                                 .setLocation(insertText( DEFAULT_BULLET_STRING, newPoint.x, newPoint.y, 0));
     1525                                newPoint.setLocation(insertText(DEFAULT_BULLET_STRING,
     1526                                                newPoint.x, newPoint.y, 0));
    15141527                        } else {
    15151528                                newPoint.setLocation(insertText(""
     
    15571570                        _lineBreaker.deleteChar(inserting.getIterator(), pos);
    15581571                }
    1559                
    1560                
    1561                
     1572
    15621573        }
    15631574
     
    17271738        @Override
    17281739        protected int getLinkYOffset() {
    1729                 if (_textLayouts.size() == 0) return  0;
     1740                if (_textLayouts.size() == 0)
     1741                        return 0;
    17301742                return Math.round(-(_textLayouts.get(0).getAscent() / 2));
    17311743        }
     
    17481760
    17491761        public static boolean isBulletChar(char c) {
    1750                 for(int i = 0; i < BULLETS.length; i++){
    1751                         if(BULLETS[i]== c)
     1762                for (int i = 0; i < BULLETS.length; i++) {
     1763                        if (BULLETS[i] == c)
    17521764                                return true;
    17531765                }
    1754                 return c== '*' || c == '+' || c == '>' || c == '-' || c == 'o';
    1755         }
    1756        
     1766                return c == '*' || c == '+' || c == '>' || c == '-' || c == 'o';
     1767        }
     1768
    17571769        public boolean hasOverlay() {
    1758                 if(!isAnnotation() || getLink()==null)
     1770                if (!isAnnotation() || getLink() == null)
    17591771                        return false;
    1760                 return ItemUtils.startsWithTag(this, "@ao") ||ItemUtils.startsWithTag(this, "@v");
     1772                return ItemUtils.startsWithTag(this, "@ao")
     1773                                || ItemUtils.startsWithTag(this, "@v");
    17611774        }
    17621775
Note: See TracChangeset for help on using the changeset viewer.