]> git.lyx.org Git - features.git/commitdiff
* LyXView::updateInset(): schedule a redraw instead of redraw immediately.
authorAbdelrazak Younes <younes@lyx.org>
Tue, 16 Jan 2007 15:16:09 +0000 (15:16 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Tue, 16 Jan 2007 15:16:09 +0000 (15:16 +0000)
* WorkArea::sheduleRedraw(): new pure virtual method.

* GuiWorkArea::showCursor(): handle the scheduled redraw.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16708 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/LyXView.C
src/frontends/WorkArea.h
src/frontends/qt4/GuiWorkArea.C
src/frontends/qt4/GuiWorkArea.h

index 9017b09e9b798f39ada73d35082d06054984c9cb..e6ad20d284129b7e6780b24da1a72db8492cc7b9 100644 (file)
@@ -431,11 +431,10 @@ Buffer const * const LyXView::updateInset(InsetBase const * inset) const
 {
        Buffer const * buffer_ptr = 0;
        if (inset) {
-               buffer_ptr = work_area_->bufferView().buffer();
-               // No FitCursor:
                BOOST_ASSERT(work_area_);
-               work_area_->bufferView().update(Update::Force);
-               work_area_->redraw();
+               work_area_->sheduleRedraw();
+
+               buffer_ptr = work_area_->bufferView().buffer();
        }
        return buffer_ptr;
 }
index 01a77aed037c78ac241992ff1a31faf05ab147c9..f53f221c316946005ed0ca0378e4d670c80d325a 100644 (file)
@@ -82,6 +82,9 @@ public:
         */
        virtual void setScrollbarParams(int height, int pos, int line_height) = 0;
 
+       ///
+       virtual void sheduleRedraw() = 0;
+
        /// redraw the screen, without using existing pixmap
        virtual void redraw();
        ///
index 7ec53683f41c30bb859da67a0d99a4c558597dd4..482ae69847172bce5b756054e149d834470126ef 100644 (file)
@@ -159,7 +159,7 @@ SyntheticMouseEvent::SyntheticMouseEvent()
 
 
 GuiWorkArea::GuiWorkArea(int w, int h, int id, LyXView & lyx_view)
-       : WorkArea(id, lyx_view), need_resize_(false)
+       : WorkArea(id, lyx_view), need_resize_(false), shedule_redraw_(false)
 {
        cursor_ = new frontend::CursorWidget();
        cursor_->hide();
@@ -535,6 +535,19 @@ void GuiWorkArea::updateScreen()
 
 void GuiWorkArea::showCursor(int x, int y, int h, CursorShape shape)
 {
+       if (shedule_redraw_) {
+               if (buffer_view_ && buffer_view_->buffer()) {
+                       buffer_view_->update(Update::Force);
+                       updateScreen();
+                       viewport()->update(QRect(0, 0, viewport()->width(), viewport()->height()));
+               }
+               shedule_redraw_ = false;
+               // Show the cursor immediately after the update.
+               hideCursor();
+               toggleCursor();
+               return;
+       }
+
        cursor_->update(x, y, h, shape);
        cursor_->show();
        viewport()->update(cursor_->rect());
index c9843504bd34ebf9797081ec85300a58eabd81dd..d9b27611132966834856c52bb124cda97bf0bc04 100644 (file)
@@ -103,6 +103,8 @@ public:
        virtual int height() const { return viewport()->height(); }
        ///
        virtual void setScrollbarParams(int height, int pos, int line_height);
+       ///
+       virtual void sheduleRedraw() { shedule_redraw_ = true; }
 
        /// update the passed area.
        void update(int x, int y, int w, int h);
@@ -171,6 +173,8 @@ private:
        QPixmap screen_;
        ///
        bool need_resize_;
+       ///
+       bool shedule_redraw_;
 };
 
 } // namespace frontend