Ignore:
Timestamp:
07/03/08 16:48:09 (16 years ago)
Author:
bjn8
Message:

Added invalidation for graphics... biiiig commit. LOts of effeciency improvements - now can animate

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/items/Text.java

    r116 r121  
    182182        }
    183183
     184        @Override
     185        public Color getHighlightColor() {
     186                if (_highlightColor.equals(getPaintBackgroundColor()))
     187                        return ALTERNATE_HIGHLIGHT;
     188                return _highlightColor;
     189        }
     190
     191       
    184192        /**
    185193         * Sets the justification of this Text item. The given integer should
     
    225233         */
    226234        public void setText(String text) {
     235        //      if (_text != null && text.length() < _text.length())
     236        //              invalidateAll();
    227237                _text = new StringBuffer(text);
    228238                rebuild(false);
     239        //      invalidateAll();
    229240        }
    230241
     
    265276         */
    266277        public void removeText(String text) {
    267                 if (_text.length() > 0 && _text.indexOf(text) == 0)
     278               
     279                if (_text.length() > 0 && _text.indexOf(text) == 0) {
     280                        //invalidateAll();
    268281                        _text.delete(0, text.length());
     282                }
     283               
    269284
    270285        }
     
    273288                int length = _text.length();
    274289                if (length > 0) {
     290                        //invalidateAll();
    275291                        int pos = _text.indexOf(textToRemove);
    276292                        int textToRemoveLength = textToRemove.length();
     
    279295                        }
    280296                }
     297               
    281298        }
    282299
     
    411428                TextHitInfo hit = getCharPosition(line, mouseX);
    412429                _selectionStart = hit.getInsertionIndex() + _lineOffsets.get(line);
     430                invalidateAll();
    413431        }
    414432
     
    420438                TextHitInfo hit = getCharPosition(line, mouseX);
    421439                _selectionEnd = hit.getInsertionIndex() + _lineOffsets.get(line);
     440                invalidateAll();
    422441        }
    423442
     
    425444                _selectionStart = -1;
    426445                _selectionEnd = -1;
     446                invalidateAll();
    427447        }
    428448
    429449        public void clearSelectionEnd() {
    430450                _selectionEnd = -1;
     451                invalidateAll();
    431452        }
    432453
     
    448469                if (_selectionStart < 0 || _selectionEnd < 0)
    449470                        return null;
    450                 else if (_selectionEnd > _text.length())
     471               
     472                invalidateAll();
     473               
     474                if (_selectionEnd > _text.length())
    451475                        _selectionEnd = _text.length();
    452476
     
    459483                _text.insert(left, newText);
    460484                rebuild(true);
     485               
     486                invalidateAll();
    461487
    462488                return s;
     
    493519                TextLayout current = null;
    494520                int line;
     521               
     522                invalidateAll();
    495523
    496524                // check for empty string
     
    635663                                                x,
    636664                                                (getX() - Item.MARGIN_RIGHT - (2 * getGravity()) + getBoundsWidth()));
     665               
     666                invalidateAll();
     667               
    637668                return new Point2D.Float(Math.round(x), Math.round(getY() + y
    638669                                + caret[1]));
     
    777808        public void setFont(Font font) {
    778809                // all decoding occurs in the Utils class
     810               
    779811                _font = font;
    780 
    781812                // rejustify();
    782813                rebuild(false);
     
    11051136                        return;
    11061137                }
    1107 
     1138               
    11081139                AttributedString paragraphText = new AttributedString(_text.toString());
    11091140                paragraphText.addAttribute(TextAttribute.FONT, getPaintFont());
     
    11541185
    11551186                updatePolygon();
     1187               
    11561188        }
    11571189
     
    15151547                        _lineBreaker.deleteChar(inserting.getIterator(), pos);
    15161548                }
     1549               
     1550               
     1551               
    15171552        }
    15181553
     
    16821717        @Override
    16831718        protected int getLinkYOffset() {
     1719                if (_textLayouts.size() == 0) return  0;
    16841720                return Math.round(-(_textLayouts.get(0).getAscent() / 2));
    16851721        }
Note: See TracChangeset for help on using the changeset viewer.