]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insettext.h
Some more changes for updating text-insets.
[lyx.git] / src / insets / insettext.h
index c61fffd0a493b5d80beb6f00e41b835f0819ee25..223b34ede153db528872a1d1681847b569954042 100644 (file)
@@ -37,15 +37,22 @@ class LyXScreen;
  */
 class InsetText : public UpdatableInset {
 public:
-    ///
-    enum { TEXT_TO_INSET_OFFSET = 2 };
     ///
     enum UpdateCodes {
        NONE = 0,
        INIT,
        FULL,
        CURSOR_PAR,
-       SELECTION
+       CURSOR,
+       SELECTION,
+       DRAW_FRAME,
+       CLEAR_FRAME
+    };
+    ///
+    enum DrawFrame {
+       NEVER = 0,
+       LOCKED,
+       ALWAYS
     };
     ///
     explicit
@@ -71,7 +78,9 @@ public:
     ///
     int width(Painter &, LyXFont const & f) const;
     ///
-    void draw(BufferView *, LyXFont const &, int , float &) const;
+    int textWidth(Painter &) const;
+    ///
+    void draw(BufferView *, LyXFont const &, int , float &, bool) const;
     ///
     void update(BufferView *, LyXFont const &, bool =false);
     ///
@@ -127,36 +136,38 @@ public:
     ///
     void SetFont(BufferView *, LyXFont const &, bool toggleall = false);
     ///
+    int getMaxWidth(Painter &, UpdatableInset const *) const;
+    ///
     void init(InsetText const * ins = 0);
     ///
+    void WriteParagraphData(Buffer const *, std::ostream &) const;
+    ///
     void SetParagraphData(LyXParagraph *);
     ///
     void SetAutoBreakRows(bool);
     ///
-    void SetDrawLockedFrame(bool);
+    void SetDrawFrame(BufferView *, DrawFrame);
     ///
-    void SetFrameColor(LColor::color);
+    void SetFrameColor(BufferView *, LColor::color);
     ///
-    LyXFont GetDrawFont(BufferView *, LyXParagraph *, int pos) const;
+//    LyXFont GetDrawFont(BufferView *, LyXParagraph *, int pos) const;
     ///
     LyXText * getLyXText(BufferView *) const;
     void deleteLyXText(BufferView *);
 
     LyXParagraph * par;
+    ///
+    mutable UpdateCodes need_update;
 
 protected:
     ///
     void UpdateLocal(BufferView *, UpdateCodes, bool mark_dirty);
-    ///
-    void WriteParagraphData(Buffer const *, std::ostream &) const;
-    ///
-    virtual int getMaxTextWidth(Painter &, UpdatableInset const *) const;
 
     mutable int drawTextXOffset;
     mutable int drawTextYOffset;
     ///
     bool autoBreakRows;
-    bool drawLockedFrame;
+    DrawFrame drawFrame;
     ///
     LColor::color frame_color;
 
@@ -184,6 +195,7 @@ private:
     ///
     string getText(int);
     ///
+    bool checkAndActivateInset(BufferView * bv, bool behind);
     bool checkAndActivateInset(BufferView * bv, int x = 0, int y = 0,
                               int button = 0);
     ///
@@ -192,6 +204,11 @@ private:
     int cpos(BufferView *) const;
     LyXParagraph * cpar(BufferView *) const;
     Row * crow(BufferView *) const;
+
+    /// This instead of a macro
+    LyXText * TEXT(BufferView * bv) const {
+       return getLyXText(bv);
+    }
        
     /* Private structures and variables */
     ///
@@ -200,6 +217,11 @@ private:
     int insetAscent;
     int insetDescent;
     int insetWidth;
+    mutable int last_width;
+    mutable int last_height;
+    mutable int top_y;
+    ///
+    LyXParagraph * inset_par;
     ///
     int inset_pos;
     ///
@@ -213,8 +235,6 @@ private:
     ///
     mutable float xpos;
     ///
-    mutable UpdateCodes need_update;
-    ///
     UpdatableInset * the_locking_inset;
     ///
     LyXParagraph * old_par;