#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,
- /**
- * A paint has caused a change in some rows
- * and rebreaking is needed.
- */
- CHANGED_IN_DRAW = 1,
+ REFRESH_NONE = 0,
/// the refresh_row needs repainting
- NEED_VERY_LITTLE_REFRESH = 2,
+ REFRESH_ROW = 1,
/// everything from refresh_y downwards needs repainting
- NEED_MORE_REFRESH = 3
+ REFRESH_AREA = 2
};
///
/// sets inset as owner
LyXText(BufferView *, InsetText *);
- /// Destructor
- ~LyXText();
-
void init(BufferView *, bool reinit = false);
///
int height;
void setCharFont(Paragraph * par,
lyx::pos_type pos, LyXFont const & font, bool toggleall);
- /// return true if the row changed
- void markChangeInDraw(Row * row, Row * next);
///
void breakAgainOneRow(Row * row);
/// what you expect when pressing <enter> at cursor position
/// clear any pending paints
void clearPaint();
- /// post notice that we changed during a draw
- void postChangedInDraw();
-
/**
* Mark position y as the starting point for a repaint
*/
* 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
int workWidth() const;
///
int workWidth(Inset * inset) const;
+
///
void computeBidiTables(Buffer const *, Row * row) const;
-
/// Maps positions in the visual string to positions in logical string.
- inline
- lyx::pos_type log2vis(lyx::pos_type pos) const {
- if (bidi_start == -1)
- return pos;
- else
- return log2vis_list[pos-bidi_start];
- }
-
+ lyx::pos_type log2vis(lyx::pos_type pos) const;
/// Maps positions in the logical string to positions in visual string.
- inline
- lyx::pos_type vis2log(lyx::pos_type pos) const {
- if (bidi_start == -1)
- return pos;
- else
- return vis2log_list[pos-bidi_start];
- }
- ///
- inline
- lyx::pos_type bidi_level(lyx::pos_type pos) const {
- if (bidi_start == -1)
- return 0;
- else
- return bidi_levels[pos-bidi_start];
- }
- ///
- inline
- bool bidi_InRange(lyx::pos_type pos) const {
- return bidi_start == -1 ||
- (bidi_start <= pos && pos <= bidi_end);
- }
-private:
+ lyx::pos_type vis2log(lyx::pos_type pos) const;
///
- Row * firstrow;
+ lyx::pos_type bidi_level(lyx::pos_type pos) const;
///
- Row * lastrow;
-
+ bool bidi_InRange(lyx::pos_type pos) const;
+private:
+ ///
+ 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);
* with a dynamic left margin will be rebroken. */
void updateCounters();
///
- void update(bool changed = true);
+ void update();
/**
* Returns an inset if inset was hit, or 0 if not.
* If hit, the coordinates are changed relative to the inset.
///
mutable std::vector<lyx::pos_type> log2vis_list;
-
///
mutable std::vector<lyx::pos_type> vis2log_list;
-
///
mutable std::vector<lyx::pos_type> bidi_levels;
-
///
mutable lyx::pos_type bidi_start;
-
///
mutable lyx::pos_type bidi_end;