#include "layout.h"
#include "LColor.h"
#include "insets/inset.h"
+#include "RowList.h"
class Buffer;
class BufferParams;
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
};
///
/// sets inset as owner
LyXText(BufferView *, InsetText *);
- /// Destructor
- ~LyXText();
-
void init(BufferView *, bool reinit = false);
///
int height;
* 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;
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
bool bidi_InRange(lyx::pos_type pos) const;
private:
///
- Row * firstrow;
- ///
- Row * lastrow;
-
+ RowList rowlist_;
///
void cursorLeftOneWord(LyXCursor &);
/** 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);