- workarea().getPainter().start();
-
- switch (text->status()) {
- case LyXText::NEED_MORE_REFRESH:
- {
- int const y = max(int(text->refresh_y - text->first_y), 0);
- drawFromTo(text, bv, y, vheight, yo, xo);
- text->refresh_y = 0;
- // otherwise this is called ONLY from BufferView_pimpl(update)
- // or we should see to set this flag accordingly
- if (text != bv->text)
- text->status(bv, LyXText::UNCHANGED);
- expose(0, y, vwidth, vheight - y);
- }
- break;
- case LyXText::NEED_VERY_LITTLE_REFRESH:
- {
- // ok I will update the current cursor row
- drawOneRow(text, bv, text->refresh_row, text->refresh_y,
- yo, xo);
- // this because if we had a major update the refresh_row could
- // have been set to 0!
- if (text->refresh_row) {
- // otherwise this is called ONLY from BufferView_pimpl(update)
- // or we should see to set this flag accordingly
- if (text != bv->text)
- text->status(bv, LyXText::UNCHANGED);
- expose(0, text->refresh_y - text->first_y + yo,
- vwidth, text->refresh_row->height());
- }
- }
- break;
- case LyXText::CHANGED_IN_DRAW: // just to remove the warning
- case LyXText::UNCHANGED:
- // Nothing needs done
- break;
- }
-
- workarea().getPainter().end();
-}
-
-
-void LyXScreen::toggleSelection(LyXText * text, BufferView * bv,
- bool kill_selection,
- int yo, int xo)
-{
- // only if there is a selection
- if (!text->selection.set()) return;
-
- int const bottom = min(
- max(static_cast<int>(text->selection.end.y()
- - text->selection.end.row()->baseline()
- + text->selection.end.row()->height()),
- text->first_y),
- static_cast<int>(text->first_y + workarea().workHeight()));
- int const top = min(
- max(static_cast<int>(text->selection.start.y() -
- text->selection.start.row()->baseline()),
- text->first_y),
- static_cast<int>(text->first_y + workarea().workHeight()));
-
- if (kill_selection)
- text->selection.set(false);
-
- workarea().getPainter().start();
-
- drawFromTo(text, bv, top - text->first_y, bottom - text->first_y,
- yo, xo);
- expose(0, top - text->first_y,
- workarea().workWidth(),
- bottom - text->first_y - (top - text->first_y));
-
- workarea().getPainter().end();
-}
-
-
-void LyXScreen::toggleToggle(LyXText * text, BufferView * bv,
- int yo, int xo)
-{
- if (text->toggle_cursor.par() == text->toggle_end_cursor.par()
- && text->toggle_cursor.pos() == text->toggle_end_cursor.pos())