]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insettext.h
The speed patch: redraw only rows that have changed
[lyx.git] / src / insets / insettext.h
index df3472db786da2a1757ec024d29ea7fd2ea41861..11cd54be750a9da92150cb9863a35af9b1f200d4 100644 (file)
@@ -12,7 +12,7 @@
 #ifndef INSETTEXT_H
 #define INSETTEXT_H
 
-#include "updatableinset.h"
+#include "inset.h"
 #include "RowList_fwd.h"
 #include "lyxfont.h"
 #include "lyxtext.h"
 class Buffer;
 class BufferParams;
 class BufferView;
+class CursorSlice;
 class Dimension;
 class LColor_color;
-class CursorSlice;
-class Painter;
 class ParagraphList;
-class Row;
 
 
 /**
  A text inset is like a TeX box to write full text
  (including styles and other insets) in a given space.
  */
-class InsetText : public UpdatableInset {
+class InsetText : public InsetOld {
 public:
-       ///
-       enum DrawFrame {
-               ///
-               NEVER = 0,
-               ///
-               LOCKED,
-               ///
-               ALWAYS
-       };
        ///
        explicit InsetText(BufferParams const &);
        ///
-       explicit InsetText();
-       ///
-       InsetText(InsetText const &);
-       ///
-       virtual std::auto_ptr<InsetBase> clone() const;
-       ///
-       void operator=(InsetText const & it);
-       /// empty inset to empty par, or just mark as erased
-       void clear(bool just_mark_erased);
+       InsetText();
+       /// empty inset to empty par
+       void clear();
        ///
        void read(Buffer const & buf, LyXLex & lex);
        ///
@@ -72,6 +55,8 @@ public:
        ///
        std::string const editMessage() const;
        ///
+       EDITABLE editable() const { return HIGHLY_EDITABLE; }
+       ///
        bool isTextInset() const { return true; }
        ///
        int latex(Buffer const &, std::ostream &,
@@ -81,16 +66,17 @@ public:
                  OutputParams const &) const;
        ///
        int linuxdoc(Buffer const &, std::ostream &,
-                    OutputParams const &) const ;
+                    OutputParams const &) const;
        ///
        int docbook(Buffer const &, std::ostream &,
-                   OutputParams const &) const ;
+                   OutputParams const &) const;
        ///
        void validate(LaTeXFeatures & features) const;
+
+       /// return x,y of given position relative to the inset's baseline
+       void cursorPos(CursorSlice const & sl, bool boundary, int & x, int & y) const;
        ///
-       InsetOld::Code lyxCode() const { return InsetOld::TEXT_CODE; }
-       /// FIXME, document
-       void getCursorPos(CursorSlice const & cur, int & x, int & y) const;
+       Code lyxCode() const { return TEXT_CODE; }
        ///
        void setFont(BufferView *, LyXFont const &,
                     bool toggleall = false,
@@ -100,9 +86,9 @@ public:
        ///
        void setAutoBreakRows(bool);
        ///
-       bool getAutoBreakRows() const { return autoBreakRows_; }
+       bool getAutoBreakRows() const { return text_.autoBreakRows_; }
        ///
-       void setDrawFrame(DrawFrame);
+       void setDrawFrame(bool);
        ///
        LColor_color frameColor() const;
        ///
@@ -114,12 +100,15 @@ public:
        /// Appends \c list with all labels found within this inset.
        void getLabelList(Buffer const &, std::vector<std::string> & list) const;
        ///
-       LyXText * getText(int) const;
+       LyXText * getText(int i) const {
+               return (i == 0) ? const_cast<LyXText*>(&text_) : 0;
+       }
        ///
        bool getStatus(LCursor & cur, FuncRequest const & cmd, FuncStatus &) const;
 
        /// mark as erased for change tracking
-       void markErased() { clear(true); }
+       void markErased(bool erased);
+
        /**
         * Mark as new. Used when pasting in tabular, and adding rows
         * or columns. Note that pasting will ensure that tracking already
@@ -150,37 +139,31 @@ public:
        bool insetAllowed(Code) const { return true; }
        ///
        bool allowSpellCheck() const { return true; }
-       
+       /// should paragraph indendation be ommitted in any case?
+       bool neverIndent() const;
+       ///
+       InsetText(InsetText const &);
+
 protected:
        ///
-       void priv_dispatch(LCursor & cur, FuncRequest & cmd);
+       virtual void doDispatch(LCursor & cur, FuncRequest & cmd);
+
 private:
        ///
-       void updateLocal(LCursor &);
+       virtual std::auto_ptr<InsetBase> doClone() const;
        ///
        void init();
-       // If the inset is empty set the language of the current font to the
-       // language to the surronding text (if different).
-       void sanitizeEmptyText(BufferView &);
-       ///
-       void setCharFont(Buffer const &, int pos, LyXFont const & font);
-       ///
-       void removeNewlines();
-       ///
-       void drawFrame(Painter &, int x, int y) const;
-       ///
-       void clearInset(Painter &, int x, int y) const;
 
        ///
-       bool autoBreakRows_;
-       ///
-       DrawFrame drawFrame_;
+       bool drawFrame_;
        /** We store the LColor::color value as an int to get LColor.h out
         *  of the header file.
         */
        int frame_color_;
        ///
-       mutable lyx::par_type old_par;
+       mutable lyx::pit_type old_pit;
+       ///
+       static int border_;
 public:
        ///
        mutable LyXText text_;