]> git.lyx.org Git - lyx.git/blobdiff - src/lyxtext.h
fix some C++ parsing bugs
[lyx.git] / src / lyxtext.h
index eba0ec42a631c4769b0f6b4745393374e5ce8bd5..5a4f8efc51c26cf05d9b648de8698465b2df4f38 100644 (file)
@@ -17,6 +17,7 @@
 #include "layout.h"
 #include "LColor.h"
 #include "insets/inset.h"
+#include "RowList.h"
 
 class Buffer;
 class BufferParams;
@@ -37,13 +38,13 @@ class ParagraphList;
 class LyXText {
 public:
        /// what repainting is needed
-       enum text_status {
+       enum refresh_status {
                /// no repaint is needed
-               UNCHANGED = 0,
+               REFRESH_NONE = 0,
                /// the refresh_row needs repainting
-               NEED_VERY_LITTLE_REFRESH = 1,
+               REFRESH_ROW = 1,
                /// everything from refresh_y downwards needs repainting
-               NEED_MORE_REFRESH = 2
+               REFRESH_AREA = 2
        };
 
        ///
@@ -66,9 +67,6 @@ public:
        /// sets inset as owner
        LyXText(BufferView *, InsetText *);
 
-       /// Destructor
-       ~LyXText();
-
        void init(BufferView *, bool reinit = false);
        ///
        int height;
@@ -207,26 +205,25 @@ public:
         * Return the status. This represents what repaints are
         * pending after some operation (e.g. inserting a char).
         */
-       text_status status() const;
+       refresh_status refreshStatus() const;
 
 private:
        /**
         * The pixel y position from which to repaint the screen.
         * The position is absolute along the height of outermost
-        * lyxtext (I think). NEED_MORE_REFRESH and NEED_LITTLE_REFRESH
+        * lyxtext (I think). REFRESH_AREA and REFRESH_ROW
         * repaints both use this as a starting point (if it's within
         * the viewable portion of the lyxtext).
         */
        int refresh_y;
        /**
         * The row from which to repaint the screen, used by screen.c.
-        * This must be set if the pending update is NEED_LITTLE_REFRESH.
-        * It doesn't make any difference for NEED_MORE_REFRESH.
+        * This must be set if the pending update is REFRESH_ROW.
+        * It doesn't make any difference for REFRESH_AREA.
         */
        Row * refresh_row;
 
-       /// refresh status
-       text_status status_;
+       refresh_status refresh_status_;
 
        /// only the top-level LyXText has this non-zero
        BufferView * bv_owner;
@@ -252,8 +249,8 @@ public:
            IMO it's stupid to have to allocate a dummy y all the time I need
            the first row
        */
-       Row * firstRow() const { return firstrow; }
-
+       Row * firstRow() const { return &*rowlist_.begin(); }
+       Row * lastRow() const { return &const_cast<LyXText*>(this)->rowlist_.back(); }
        /** The cursor.
          Later this variable has to be removed. There should be now internal
          cursor in a text (and thus not in a buffer). By keeping this it is
@@ -490,10 +487,7 @@ public:
        bool bidi_InRange(lyx::pos_type pos) const;
 private:
        ///
-       Row * firstrow;
-       ///
-       Row * lastrow;
-
+       RowList rowlist_;
        ///
        void cursorLeftOneWord(LyXCursor &);
 
@@ -517,6 +511,7 @@ private:
        /** inserts a new row behind the specified row, increments
            the touched counters */
        void insertRow(Row * row, Paragraph * par, lyx::pos_type pos);
+
        /// removes the row and reset the touched counters
        void removeRow(Row * row);