]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/WorkArea.C
* src/frontends/qt4/GuiSelection.C
[lyx.git] / src / frontends / WorkArea.C
index 17cac2a849c0214617a3ed0f491e02eaa22176da..135dd2071e259a00b61bb15cdb64f244b4200935 100644 (file)
 #include "rowpainter.h"
 
 #include "gettext.h"
-#include "support/filetools.h" // LibFileSearch
 #include "support/forkedcontr.h"
 
 #include <boost/utility.hpp>
 #include <boost/bind.hpp>
 #include <boost/current_function.hpp>
 
-using lyx::support::libFileSearch;
 using lyx::support::ForkedcallsController;
 
 using std::endl;
@@ -120,16 +118,18 @@ BufferView const & WorkArea::bufferView() const
 void WorkArea::stopBlinkingCursor()
 {
        cursor_timeout_.stop();
+       hideCursor();
 }
 
 
 void WorkArea::startBlinkingCursor()
 {
+       showCursor();
        cursor_timeout_.restart();
 }
 
 
-void WorkArea::redraw(bool singlePar)
+void WorkArea::redraw()
 {
        if (!buffer_view_ || !buffer_view_->buffer()) {
                greyed_out_ = true;
@@ -138,7 +138,11 @@ void WorkArea::redraw(bool singlePar)
                return;
        }
 
-       buffer_view_->updateMetrics(singlePar && hasFocus());
+       // No need to do anything if this is the current view. The BufferView 
+       // metrics are already up to date.
+       if (&lyx_view_ != theApp()->currentView())
+               // FIXME: it would be nice to optimize for the off-screen case.
+               buffer_view_->updateMetrics(false);
 
        updateScrollbar();
 
@@ -165,20 +169,17 @@ void WorkArea::redraw(bool singlePar)
 void WorkArea::processKeySym(LyXKeySymPtr key,
                                                         key_modifier::state state)
 {
-       hideCursor();
+       // In order to avoid bad surprise in the middle of an operation, we better stop
+       // the blinking cursor.
+       stopBlinkingCursor();
 
        theLyXFunc().setLyXView(&lyx_view_);
        theLyXFunc().processKeySym(key, state);
 
-       /* This is perhaps a bit of a hack. When we move
-        * around, or type, it's nice to be able to see
-        * the cursor immediately after the keypress. So
-        * we reset the toggle timeout and force the visibility
-        * of the cursor. Note we cannot do this inside
-        * dispatch() itself, because that's called recursively.
+       /* When we move around, or type, it's nice to be able to see
+        * the cursor immediately after the keypress.
         */
-//     if (buffer_view_->buffer())
-       toggleCursor();
+       startBlinkingCursor();
 }
 
 
@@ -201,14 +202,19 @@ void WorkArea::dispatch(FuncRequest const & cmd0)
                lyx_view_.updateToolbars();
        }
 
-       // Slight hack: this is only called currently when we
-       // clicked somewhere, so we force through the display
-       // of the new status here.
-       lyx_view_.clearMessage();
-
-       // Show the cursor immediately after any operation.
-       hideCursor();
-       toggleCursor();
+       
+       // GUI tweaks except with mouse motion with no button pressed.
+       if (!(cmd0.action == LFUN_MOUSE_MOTION 
+               && cmd0.button() == mouse_button::none)) {
+               // Slight hack: this is only called currently when we
+               // clicked somewhere, so we force through the display
+               // of the new status here.
+               lyx_view_.clearMessage();
+
+               // Show the cursor immediately after any operation.
+               hideCursor();
+               toggleCursor();
+       }
 
        if (needRedraw)
                redraw();
@@ -221,7 +227,6 @@ void WorkArea::resizeBufferView()
        lyx_view_.message(_("Formatting document..."));
        buffer_view_->workAreaResize(width(), height());
        lyx_view_.updateLayoutChoice();
-       redraw();
        lyx_view_.busy(false);
        lyx_view_.clearMessage();
 }