]> git.lyx.org Git - features.git/commitdiff
Small API cleanup: as BufferView already use Buffer::changed() make it use it some...
authorAbdelrazak Younes <younes@lyx.org>
Fri, 5 Oct 2007 09:38:40 +0000 (09:38 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Fri, 5 Oct 2007 09:38:40 +0000 (09:38 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20747 a592a061-630c-0410-9148-cb99ea01b6c8

src/BufferView.cpp
src/BufferView.h
src/frontends/WorkArea.cpp

index 0abea62854f8e746b436c04f5d7192033a9e0934..180c2b1aa768476a5a483e836d483eff9eb4bfc3 100644 (file)
@@ -1315,7 +1315,7 @@ Inset const * BufferView::getCoveringInset(Text const & text, int x, int y)
 }
 
 
-bool BufferView::workAreaDispatch(FuncRequest const & cmd0)
+void BufferView::mouseEventDispatch(FuncRequest const & cmd0)
 {
        //lyxerr << BOOST_CURRENT_FUNCTION << "[ cmd0 " << cmd0 << "]" << endl;
 
@@ -1340,7 +1340,7 @@ bool BufferView::workAreaDispatch(FuncRequest const & cmd0)
                        getCoveringInset(buffer_.text(), cmd.x, cmd.y);
                if (covering_inset == last_inset_)
                        // Same inset, no need to do anything...
-                       return false;
+                       return;
 
                bool need_redraw = false;
                // const_cast because of setMouseHover().
@@ -1353,7 +1353,7 @@ bool BufferView::workAreaDispatch(FuncRequest const & cmd0)
                        need_redraw |= inset->setMouseHover(true);
                last_inset_ = inset;
                if (!need_redraw)
-                       return false;
+                       return;
 
                // if last metrics update was in singlepar mode, WorkArea::redraw() will
                // not expose the button for redraw. We adjust here the metrics dimension
@@ -1375,7 +1375,8 @@ bool BufferView::workAreaDispatch(FuncRequest const & cmd0)
 
                // This event (moving without mouse click) is not passed further.
                // This should be changed if it is further utilized.
-               return true;
+               buffer_.changed();
+               return;
        }
 
        // Build temporary cursor.
@@ -1388,9 +1389,8 @@ bool BufferView::workAreaDispatch(FuncRequest const & cmd0)
        // via the temp cursor. If the inset wishes to change the real
        // cursor it has to do so explicitly by using
        //  cur.bv().cursor() = cur;  (or similar)
-       if (inset) {
+       if (inset)
                inset->dispatch(cur, cmd);
-       }
 
        // Now dispatch to the temporary cursor. If the real cursor should
        // be modified, the inset's dispatch has to do so explicitly.
@@ -1400,11 +1400,14 @@ bool BufferView::workAreaDispatch(FuncRequest const & cmd0)
        //Do we have a selection?
        theSelection().haveSelection(cursor().selection());
 
-       // Redraw if requested and necessary.
-       if (cur.result().dispatched() && cur.result().update())
-               return update(cur.result().update());
-
-       return false;
+       // If the command has been dispatched,
+       if (cur.result().dispatched()
+               // an update is asked,
+               && cur.result().update()
+               // and redraw is needed,
+               && update(cur.result().update()))
+               // then trigger a redraw.
+               buffer_.changed();
 }
 
 
index 07d4c0370d8737d65af5c2f7d1b8b565869f296b..192742b8c42ebfd7ae74301fe1a3d7cb37431d9f 100644 (file)
@@ -170,8 +170,7 @@ public:
 
        /// dispatch method helper for \c WorkArea
        /// \sa WorkArea
-       /// \retval true if a redraw is needed
-       bool workAreaDispatch(FuncRequest const & ev);
+       void mouseEventDispatch(FuncRequest const & ev);
 
        /// access to anchor.
        pit_type anchor_ref() const;
index dadb3e10c5ed449d9d6eb8265f626666b60a5f51..86a4d93cf52880dd42e11ec304cd1d806d886b7a 100644 (file)
@@ -203,10 +203,7 @@ void WorkArea::dispatch(FuncRequest const & cmd0, KeyModifier mod)
                && cmd.button() == mouse_button::none))
                stopBlinkingCursor();
 
-       bool const needRedraw = buffer_view_->workAreaDispatch(cmd);
-
-       if (needRedraw)
-               buffer_view_->buffer().changed();
+       buffer_view_->mouseEventDispatch(cmd);
 
        // Skip these when selecting
        if (cmd.action != LFUN_MOUSE_MOTION) {