]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/WorkArea.C
Rename .C => .cpp for files in src/frontends/controllers, step 1
[lyx.git] / src / frontends / WorkArea.C
index abe266cd79d7aad543f961d57f856cb6a37dfd2f..c1a89e18a9cb699702f9658e28e9a52ac646befc 100644 (file)
@@ -149,15 +149,14 @@ void WorkArea::redraw()
        ViewMetricsInfo const & vi = buffer_view_->viewMetricsInfo();
        greyed_out_ = false;
 
-       if (lyxerr.debugging(Debug::WORKAREA)) {
-               lyxerr[Debug::WORKAREA] << "WorkArea::redraw screen" << endl;
-       }
+       LYXERR(Debug::WORKAREA) << "WorkArea::redraw screen" << endl;
+
        int const ymin = std::max(vi.y1, 0);
        int const ymax = vi.p2 < vi.size - 1 ? vi.y2 : height();
 
        expose(0, ymin, width(), ymax - ymin);
 
-       //lyxerr[Debug::WORKAREA]
+       //LYXERR(Debug::WORKAREA)
        //<< "  ymin = " << ymin << "  width() = " << width()
 //             << "  ymax-ymin = " << ymax-ymin << std::endl;
 
@@ -205,8 +204,17 @@ void WorkArea::dispatch(FuncRequest const & cmd0, key_modifier::state k)
        else
                cmd = cmd0;
 
-       bool needRedraw = buffer_view_->workAreaDispatch(cmd);
+       // In order to avoid bad surprise in the middle of an operation, we better stop
+       // the blinking cursor.
+       if (!(cmd.action == LFUN_MOUSE_MOTION 
+               && cmd.button() == mouse_button::none))
+               stopBlinkingCursor();
+
+       bool const needRedraw = buffer_view_->workAreaDispatch(cmd);
 
+       if (needRedraw)
+               redraw();
+       
        // Skip these when selecting
        if (cmd.action != LFUN_MOUSE_MOTION) {
                lyx_view_.updateLayoutChoice();
@@ -214,7 +222,6 @@ void WorkArea::dispatch(FuncRequest const & cmd0, key_modifier::state k)
                lyx_view_.updateToolbars();
        }
 
-       
        // GUI tweaks except with mouse motion with no button pressed.
        if (!(cmd.action == LFUN_MOUSE_MOTION 
                && cmd.button() == mouse_button::none)) {
@@ -223,13 +230,9 @@ void WorkArea::dispatch(FuncRequest const & cmd0, key_modifier::state k)
                // of the new status here.
                lyx_view_.clearMessage();
 
-               // Show the cursor       immediately after any operation.
-               hideCursor();
-               toggleCursor();
+               // Show the cursor immediately after any operation.
+               startBlinkingCursor();
        }
-
-       if (needRedraw)
-               redraw();
 }
 
 
@@ -239,8 +242,8 @@ void WorkArea::resizeBufferView()
        lyx_view_.message(_("Formatting document..."));
        buffer_view_->workAreaResize(width(), height());
        lyx_view_.updateLayoutChoice();
-       lyx_view_.busy(false);
        lyx_view_.clearMessage();
+       lyx_view_.busy(false);
 }
 
 
@@ -255,14 +258,15 @@ void WorkArea::updateScrollbar()
 
 void WorkArea::scrollBufferView(int position)
 {
+       stopBlinkingCursor();
        buffer_view_->scrollDocView(position);
        redraw();
-       hideCursor();
        if (lyxrc.cursor_follows_scrollbar) {
                buffer_view_->setCursorFromScrollbar();
                lyx_view_.updateLayoutChoice();
        }
-       toggleCursor();
+       // Show the cursor immediately after any operation.
+       startBlinkingCursor();
 }
 
 
@@ -276,7 +280,7 @@ void WorkArea::showCursor()
 
        CursorShape shape = BAR_SHAPE;
 
-       LyXText const & text = *buffer_view_->getLyXText();
+       LyXText const & text = *buffer_view_->cursor().innerText();
        LyXFont const & realfont = text.real_current_font;
        BufferParams const & bp = buffer_view_->buffer()->params();
        bool const samelang = realfont.language() == bp.language;