]> git.lyx.org Git - lyx.git/blobdiff - src/screen.C
citation patch from Angus
[lyx.git] / src / screen.C
index 929ffe28a6b89275dfda52e9e317027a867c46c0..38effb1e19b64b285c19f72be1e8c128f4772644 100644 (file)
@@ -47,7 +47,7 @@ GC createGC()
 
 // Constructor
 LyXScreen::LyXScreen(WorkArea & o) //, LyXText * text_ptr)
-       : owner(o) //, text(text_ptr)
+       : owner(o), force_clear(true) //, text(text_ptr)
 {
        // the cursor isnt yet visible
        cursor_visible = false;
@@ -98,11 +98,18 @@ void LyXScreen::DrawFromTo(LyXText * text, int y1, int y2, int y_offset, int x_o
        // y1 is now the real beginning of row on the screen
        
        while (row != 0 && y < y2) {
-               text->GetVisibleRow(owner.owner(), y+y_offset, x_offset, row, y + text->first);
+               LyXText::text_status st = text->status;
+               do {
+                       text->status = st;
+                       text->GetVisibleRow(owner.owner(), y+y_offset,
+                                           x_offset, row, y + text->first);
+               } while (text->status == LyXText::CHANGED_IN_DRAW);
+               text->status = st;
                y += row->height();
                row = row->next();
        }
-   
+       force_clear = false;
+
        // maybe we have to clear the screen at the bottom
        if ((y < y2) && text->bv_owner) {
                owner.getPainter().fillRectangle(0, y,
@@ -121,8 +128,15 @@ void LyXScreen::DrawOneRow(LyXText * text, Row * row, long y_text,
        if (y + row->height() > 0
            && y - row->height() <= long(owner.height())) {
                // ok there is something visible
-               text->GetVisibleRow(owner.owner(), y, x_offset, row, y + text->first);
+               LyXText::text_status st = text->status;
+               do {
+                       text->status = st;
+                       text->GetVisibleRow(owner.owner(), y, x_offset, row,
+                                           y + text->first);
+               } while (text->status == LyXText::CHANGED_IN_DRAW);
+               text->status = st;
        }
+       force_clear = false;
 }
 
 
@@ -405,6 +419,7 @@ void LyXScreen::Update(LyXText * text, int y_offset, int x_offset)
                       owner.workWidth(), text->refresh_row->height());
        }
        break;
+       case LyXText::CHANGED_IN_DRAW: // just to remove the warning
        case LyXText::UNCHANGED:
                // Nothing needs done
                break;
@@ -412,7 +427,8 @@ void LyXScreen::Update(LyXText * text, int y_offset, int x_offset)
 }
 
 
-void LyXScreen::ToggleSelection(LyXText * text, bool kill_selection)
+void LyXScreen::ToggleSelection(LyXText * text,  bool kill_selection,
+                               int y_offset, int x_offset)
 {
        // only if there is a selection
        if (!text->selection) return;
@@ -427,7 +443,8 @@ void LyXScreen::ToggleSelection(LyXText * text, bool kill_selection)
 
        if (kill_selection)
                text->selection = 0;
-       DrawFromTo(text, top - text->first, bottom - text->first);
+       DrawFromTo(text, top - text->first, bottom - text->first,
+                  y_offset, x_offset);
        expose(0, top - text->first,
               owner.workWidth(),
               bottom - text->first - (top - text->first));
@@ -450,7 +467,7 @@ void LyXScreen::ToggleToggle(LyXText * text, int y_offset, int x_offset)
        
        bottom = min(max(ulong(bottom), text->first), text->first + owner.height());
        top = min(max(ulong(top), text->first), text->first + owner.height());
-       
+
        DrawFromTo(text, top - text->first, bottom - text->first, y_offset,
                   x_offset);
        expose(0, top - text->first, owner.workWidth(),