refresh_status_ trisate -> need_refresh_ bool

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7276 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2003-07-15 11:08:02 +00:00
parent e347e9e925
commit 4ec8f6453d
8 changed files with 34 additions and 73 deletions

View File

@ -306,25 +306,17 @@ bool LyXScreen::fitCursor(LyXText * text, BufferView * bv)
void LyXScreen::update(BufferView & bv, int yo, int xo)
{
int const vwidth = workarea().workWidth();
int const vheight = workarea().workHeight();
LyXText * text = bv.text;
workarea().getPainter().start();
switch (text->refreshStatus()) {
case LyXText::REFRESH_ROW:
case LyXText::REFRESH_AREA:
{
if (text->needRefresh()) {
int const vwidth = workarea().workWidth();
int const vheight = workarea().workHeight();
text->updateRowPositions();
int const y = max(int(text->refresh_y - text->top_y()), 0);
drawFromTo(text, &bv, y, vheight, yo, xo);
expose(0, y, vwidth, vheight - y);
break;
}
case LyXText::REFRESH_NONE:
// Nothing needs done
break;
}
workarea().getPainter().end();

View File

@ -89,11 +89,9 @@ public:
* @param xo the x offset into the text
* @param yo the x offset into the text
*
* Updates part of the screen. If bv->text->status is
* LyXText::REFRESH_AREA, we update from the
* point of change and to the end of the screen.
* If text->status is LyXText::REFRESH_ROW,
* we only update the current row.
* Updates part of the screen. If bv->text->needRefresh is
* true, we update from the
* point of change to the end of the screen.
*/
virtual void update(BufferView & bv, int yo = 0, int xo = 0);
@ -141,11 +139,6 @@ protected:
void drawFromTo(LyXText *, BufferView *, int y1, int y2,
int y_offset = 0, int x_offset = 0);
/// y is a coordinate of the text
void drawOneRow(LyXText *, BufferView *,
RowList::iterator row,
int y_text, int y_offset = 0, int x_offset = 0);
private:
/// grey out (no buffer)
void greyOut();

View File

@ -431,11 +431,8 @@ void InsetTabular::update(BufferView * bv, bool reinit)
}
if (the_locking_inset)
the_locking_inset->update(bv, reinit);
if (need_update < FULL &&
bv->text->refreshStatus() == LyXText::REFRESH_AREA)
{
if (need_update < FULL && bv->text->needRefresh())
need_update = FULL;
}
switch (need_update) {
case INIT:

View File

@ -440,12 +440,12 @@ void InsetText::update(BufferView * bv, bool reinit)
the_locking_inset->update(bv, reinit);
}
if ((need_update & CURSOR_PAR) && (text_.refreshStatus() == LyXText::REFRESH_NONE) &&
if ((need_update & CURSOR_PAR) && !text_.needRefresh() &&
the_locking_inset) {
text_.updateInset(the_locking_inset);
}
if (text_.refreshStatus() == LyXText::REFRESH_AREA)
if (text_.needRefresh())
need_update |= FULL;
in_update = false;
@ -461,16 +461,9 @@ void InsetText::update(BufferView * bv, bool reinit)
void InsetText::setUpdateStatus(int what) const
{
need_update |= what;
// we have to redraw us full if our LyXText REFRESH_AREA or
// if we don't break row so that we only have one row to update!
if ((text_.refreshStatus() == LyXText::REFRESH_AREA) ||
(!autoBreakRows &&
(text_.refreshStatus() == LyXText::REFRESH_ROW)))
{
// we will to redraw us full if our LyXText wants it
if (text_.needRefresh())
need_update |= FULL;
} else if (text_.refreshStatus() == LyXText::REFRESH_ROW) {
need_update |= CURSOR_PAR;
}
// this to not draw a selection when we redraw all of it!
if (need_update & CURSOR && !(need_update & SELECTION)) {
@ -489,8 +482,8 @@ void InsetText::updateLocal(BufferView * bv, int what, bool mark_dirty)
text_.partialRebreak();
setUpdateStatus(what);
bool flag = mark_dirty ||
(((need_update != CURSOR) && (need_update != NONE)) ||
(text_.refreshStatus() != LyXText::REFRESH_NONE) || text_.selection.set());
((need_update != CURSOR && need_update != NONE) ||
text_.needRefresh() || text_.selection.set());
if (!text_.selection.set())
text_.selection.cursor = text_.cursor;

View File

@ -44,16 +44,6 @@ class ParagraphList;
// transition...
class LyXText : public TextCursor {
public:
/// what repainting is needed
enum refresh_status {
/// no repaint is needed
REFRESH_NONE = 0,
/// the refresh_row needs repainting
REFRESH_ROW = 1,
/// everything from refresh_y downwards needs repainting
REFRESH_AREA = 2
};
/// Constructor
LyXText(BufferView *);
/// sets inset as owner
@ -180,14 +170,10 @@ public:
/// clear any pending paints
void clearPaint();
/**
* Mark position y as the starting point for a repaint
*/
/// Mark position y as the starting point for a repaint
void postPaint(int start_y);
/**
* Mark the given row at position y as needing a repaint.
*/
/// Mark the given row at position y as needing a repaint.
void postRowPaint(RowList::iterator rit, int start_y);
///
@ -203,14 +189,14 @@ public:
* Return the status. This represents what repaints are
* pending after some operation (e.g. inserting a char).
*/
refresh_status refreshStatus() const;
bool needRefresh() const;
private:
/**
* The pixel y position from which to repaint the screen.
* The position is absolute along the height of outermost
* lyxtext (I think). REFRESH_AREA and REFRESH_ROW
* repaints both use this as a starting point (if it's within
* lyxtext (I think). If need_refresh_ is true
* repaints use this as a starting point (if it's within
* the viewable portion of the lyxtext).
*/
int refresh_y;
@ -220,8 +206,8 @@ private:
* It doesn't make any difference for REFRESH_AREA.
*/
RowList::iterator refresh_row;
refresh_status refresh_status_;
// do we need a refresh?
bool need_refresh_;
public:
/// only the top-level LyXText has this non-zero

View File

@ -259,7 +259,7 @@ void RowPainter::paintChars(pos_type & vpos, bool hebrew, bool arabic)
{
pos_type pos = text_.vis2log(vpos);
pos_type const last = lastPrintablePos(text_, row_);
LyXFont orig_font(getFont(pos));
LyXFont orig_font = getFont(pos);
// first character
string str;

View File

@ -2288,15 +2288,15 @@ ParagraphList & LyXText::ownerParagraphs() const
}
LyXText::refresh_status LyXText::refreshStatus() const
bool LyXText::needRefresh() const
{
return refresh_status_;
return need_refresh_;
}
void LyXText::clearPaint()
{
refresh_status_ = REFRESH_NONE;
need_refresh_ = true;
refresh_row = rows().end();
refresh_y = 0;
}
@ -2304,12 +2304,12 @@ void LyXText::clearPaint()
void LyXText::postPaint(int start_y)
{
refresh_status old = refresh_status_;
bool old = need_refresh_;
refresh_status_ = REFRESH_AREA;
need_refresh_ = true;
refresh_row = rows().end();
if (old != REFRESH_NONE && refresh_y < start_y)
if (old && refresh_y < start_y)
return;
refresh_y = start_y;
@ -2328,17 +2328,17 @@ void LyXText::postPaint(int start_y)
// make refresh_y be 0, and use row->y etc.
void LyXText::postRowPaint(RowList::iterator rit, int start_y)
{
if (refresh_status_ != REFRESH_NONE && refresh_y < start_y) {
refresh_status_ = REFRESH_AREA;
if (need_refresh_ && refresh_y < start_y) {
need_refresh_ = true;
return;
} else {
refresh_y = start_y;
}
if (refresh_status_ == REFRESH_AREA)
refresh_y = start_y;
if (need_refresh_)
return;
refresh_status_ = REFRESH_ROW;
need_refresh_ = true;
refresh_row = rit;
if (!inset_owner)

View File

@ -75,7 +75,7 @@ namespace {
}
if (!lt->isInInset()) {
bv->update(lt, BufferView::SELECT);
} else if (bv->text->refreshStatus() != LyXText::REFRESH_NONE) {
} else if (bv->text->needRefresh()) {
bv->update(BufferView::SELECT);
}