]> git.lyx.org Git - features.git/commitdiff
Please JMarc: Make sure we always pass through LyXFunc::dispatch() even if this is...
authorAbdelrazak Younes <younes@lyx.org>
Mon, 26 Nov 2007 22:45:17 +0000 (22:45 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Mon, 26 Nov 2007 22:45:17 +0000 (22:45 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21807 a592a061-630c-0410-9148-cb99ea01b6c8

src/LyXFunc.cpp
src/frontends/LyXView.h
src/frontends/qt4/Action.cpp
src/frontends/qt4/Dialog.cpp
src/frontends/qt4/GuiCommandBuffer.cpp
src/frontends/qt4/GuiToc.cpp
src/frontends/qt4/GuiToolbar.cpp
src/frontends/qt4/GuiView.cpp
src/frontends/qt4/GuiView.h
src/frontends/qt4/InsertTableWidget.cpp

index 891d40b0102c47dfa729a1399f7b65739b86a462..af5cf05e1132d4b25221c84ed40fe38b4a9df3c1 100644 (file)
@@ -197,7 +197,8 @@ bool import(LyXView * lv, FileName const & filename,
                        : changeExtension(filename.absFilename(),
                                          formats.extension(loader_format));
                lv->view()->insertPlaintextFile(filename2, as_paragraphs);
-               lv->dispatch(FuncRequest(LFUN_MARK_OFF), true);
+               theLyXFunc().setLyXView(lv);
+               lyx::dispatch(FuncRequest(LFUN_MARK_OFF));
        }
 
        // we are done
@@ -1823,7 +1824,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
 
                        // Let the current LyXView dispatch its own actions.
                        BOOST_ASSERT(lyx_view_);
-                       if (lyx_view_->dispatch(cmd, false)) {
+                       if (lyx_view_->dispatch(cmd)) {
                                if (lyx_view_->view())
                                        updateFlags = lyx_view_->view()->cursor().result().update();
                                break;
index da93d5d4d4c704f91c6ff643208f310ad8df7620..9c610ccffb9d0cb41e6237e7bda8022cd430e156 100644 (file)
@@ -78,7 +78,7 @@ public:
        /// \param propagate: indicate if the dispatch should be probagated to
        /// the main lyx::dispatch().
        /// \return true if the \c FuncRequest has been dispatched.
-       virtual bool dispatch(FuncRequest const & cmd, bool propagate) = 0;
+       virtual bool dispatch(FuncRequest const & cmd) = 0;
 
        ///
        virtual void restartCursor() = 0;
index 16996b410ffedc779e225b5cf01a134ea771c142..d15bdaecdd2980a20c15579c4348d76d4360d242 100644 (file)
@@ -62,7 +62,8 @@ void Action::update()
 void Action::action()
 {
        //LYXERR(Debug::ACTION, "calling LyXFunc::dispatch: func_: ");
-       lyxView_.dispatch(func_);
+       theLyXFunc().setLyXView(&lyxView_);
+       lyx::dispatch(func_);
        triggered(this);
 }
 
index cc3d3999c51cbd5528b91480aef37dadcd7aba30..40b4f376321a75595b0810446833f9fa9132c305 100644 (file)
@@ -49,7 +49,8 @@ bool Dialog::canApply() const
 
 void Dialog::dispatch(FuncRequest const & fr) const
 {
-       lyxview_->dispatch(fr);
+       theLyXFunc().setLyXView(lyxview_);
+       lyx::dispatch(fr);
 }
 
 
index a18515cff4285dc7cf03ad6f5e4fee7c5dcb546d..ce6896ef9fda2de08ebb1032df9a5e8eff2d779f 100644 (file)
@@ -273,7 +273,8 @@ docstring const GuiCommandBuffer::getCurrentState() const
 void GuiCommandBuffer::hide() const
 {
        FuncRequest cmd(LFUN_COMMAND_EXECUTE, "off");
-       view_->dispatch(cmd);
+       theLyXFunc().setLyXView(view_);
+       lyx::dispatch(cmd);
 }
 
 
@@ -325,7 +326,8 @@ void GuiCommandBuffer::dispatch(string const & str)
        history_pos_ = history_.end();
        FuncRequest func = lyxaction.lookupFunc(str);
        func.origin = FuncRequest::COMMANDBUFFER;
-       view_->dispatch(func);
+       theLyXFunc().setLyXView(view_);
+       lyx::dispatch(func);
 }
 
 } // namespace frontend
index 7e3ca23da1b17b9a8cbce46bec92f8999c5d4f0b..f366a1ffcce792c586e3156857633a097af667d6 100644 (file)
@@ -113,7 +113,7 @@ void GuiToc::goTo(int type, QModelIndex const & index)
        LYXERR(Debug::GUI, "GuiToc::goTo " << to_utf8(it->str()));
 
        string const tmp = convert<string>(it->id());
-       lyxview().dispatch(FuncRequest(LFUN_PARAGRAPH_GOTO, tmp));
+       dispatch(FuncRequest(LFUN_PARAGRAPH_GOTO, tmp));
 }
 
 
index c7de616f962fa24b15f9316f177db61e7b3ecdd7..a2e0618710656919927ae7611b0b67ebe37820d3 100644 (file)
@@ -352,7 +352,8 @@ void GuiLayoutBox::selected(const QString & str)
                if (translateIfPossible(itname) == name) {
                        FuncRequest const func(LFUN_LAYOUT, itname,
                                               FuncRequest::TOOLBAR);
-                       owner_.dispatch(func);
+                       theLyXFunc().setLyXView(&owner_);
+                       lyx::dispatch(func);
                        return;
                }
        }
index 46c59a38047bbbf4f7d0d7692b44792efcf5f2dc..efb877ffe4217d00dcbce35e99957bf482dce3d5 100644 (file)
@@ -1018,7 +1018,7 @@ FuncStatus GuiView::getStatus(FuncRequest const & cmd)
 }
 
 
-bool GuiView::dispatch(FuncRequest const & cmd, bool propagate)
+bool GuiView::dispatch(FuncRequest const & cmd)
 {
        BufferView * bv = view();       
        // By default we won't need any update.
@@ -1161,18 +1161,9 @@ bool GuiView::dispatch(FuncRequest const & cmd, bool propagate)
                }
 
                default:
-                       if (propagate) {
-                               theLyXFunc().setLyXView(this);
-                               lyx::dispatch(cmd);
-                       }
                        return false;
        }
 
-       if (bv) {
-               bv->processUpdateFlags(bv->cursor().result().update());
-               // We won't need any new update.
-               bv->cursor().updateFlags(Update::None);
-       }
        return true;
 }
 
index 4078683878069846b776468c2d2fe0d76f0a0ebb..a1c05f6ecdebbf89f8c35a899ab2cb73d145f601 100644 (file)
@@ -76,7 +76,7 @@ public:
        void updateToolbars();
        QMenu * createPopupMenu();
        FuncStatus getStatus(FuncRequest const & cmd);
-       bool dispatch(FuncRequest const & cmd, bool propagate = true);
+       bool dispatch(FuncRequest const & cmd);
 
        ///
        void setLayoutDialog(GuiLayoutBox *);
index c385d02a8d61dadd70b05b3398682ab63395f68b..4ff38099ede2c1284e2dc14b077038534ea2fa2a 100644 (file)
@@ -108,7 +108,8 @@ void InsertTableWidget::mouseReleaseEvent(QMouseEvent * /*event*/)
 {
        if (underMouse_) {
                QString const data = QString("%1 %2").arg(bottom_).arg(right_);
-               lyxView_.dispatch(FuncRequest(LFUN_TABULAR_INSERT, fromqstr(data)));
+               theLyXFunc().setLyXView(&lyxView_);
+               lyx::dispatch(FuncRequest(LFUN_TABULAR_INSERT, fromqstr(data)));
        }
        // emit signal
        visible(false);