]> git.lyx.org Git - features.git/commitdiff
more dispatchresult changes
authorLars Gullik Bjønnes <larsbj@gullik.org>
Sat, 1 Nov 2003 15:45:19 +0000 (15:45 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Sat, 1 Nov 2003 15:45:19 +0000 (15:45 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8013 a592a061-630c-0410-9148-cb99ea01b6c8

41 files changed:
src/BufferView_pimpl.C
src/ChangeLog
src/cursor.C
src/dispatchresult.h
src/insets/ChangeLog
src/insets/insetbase.C
src/insets/insetbibitem.C
src/insets/insetbibtex.C
src/insets/insetbox.C
src/insets/insetbranch.C
src/insets/insetcite.C
src/insets/insetcollapsable.C
src/insets/insetcommand.C
src/insets/insetert.C
src/insets/insetexternal.C
src/insets/insetfloat.C
src/insets/insetfloatlist.C
src/insets/insetgraphics.C
src/insets/insetinclude.C
src/insets/insetindex.C
src/insets/insetlabel.C
src/insets/insetminipage.C
src/insets/insetnote.C
src/insets/insetref.C
src/insets/insettabular.C
src/insets/insettext.C
src/insets/insettoc.C
src/insets/inseturl.C
src/insets/insetwrap.C
src/insets/updatableinset.C
src/lyxfunc.C
src/mathed/ChangeLog
src/mathed/command_inset.C
src/mathed/formulabase.C
src/mathed/math_cursor.C
src/mathed/math_gridinset.C
src/mathed/math_hullinset.C
src/mathed/math_nestinset.C
src/mathed/math_scriptinset.C
src/mathed/ref_inset.C
src/text3.C

index e5b694b1c64c385365188b4a00c352031bd0912f..dafede22355b31f2992e5e1be3b0f5e612239aa4 100644 (file)
@@ -1279,7 +1279,7 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev_in)
                break;
 
        default:
-               return bv_->getLyXText()->dispatch(FuncRequest(ev, bv_)) >= DispatchResult(DISPATCHED);
+               return bv_->getLyXText()->dispatch(FuncRequest(ev, bv_)).dispatched();
        } // end of switch
 
        return true;
index 102ccf9682ff2ab91c6ad2220d31b1258cac3c3c..43aed57ff6abcb97e128847da27589ddc91beb97 100644 (file)
@@ -1,3 +1,14 @@
+2003-11-01  Lars Gullik Bjønnes  <larsbj@gullik.net>
+
+       * text3.C:
+       * lyxfunc.C:
+       * cursor.C (dispatch): 
+       * BufferView_pimpl.C (dispatch): adjust for DispatchResult changes
+
+       * dispatchresult.h: remove UNDISPATCHED, DISPATCHED and
+       DISPATCHED_NOUPDATE from dispatch_result_t, add NONE. Add a
+       contructor, add a class function dispatched. Remove operator>=
+
 2003-11-01  Lars Gullik Bjønnes  <larsbj@gullik.net>
 
        * debug.C: only use the default constructor for debugstream
index f7b876e342a14bc89e7ee4f83c366c591733dc2b..32257acfc0ba5512ecbe01fd48af89be0f394257 100644 (file)
@@ -32,17 +32,16 @@ DispatchResult Cursor::dispatch(FuncRequest const & cmd)
                DispatchResult res = data_[i].inset_->dispatch(cmd);
                lyxerr << "   result: " << res.val() << endl;
 
-               if (res == DispatchResult(DISPATCHED)) {
-                       //update();
-                       return DispatchResult(DISPATCHED);
+               if (res.dispatched()) {
+                       if (res.val() != NOUPDATE) {
+                               //update();
+                       }
+                       return DispatchResult(true);
                }
 
-               if (res == DispatchResult(DISPATCHED_NOUPDATE))
-                       return DispatchResult(DISPATCHED);
-
                lyxerr << "# unhandled result: " << res.val() << endl;
        }
-       return DispatchResult(UNDISPATCHED);
+       return DispatchResult(false);
 }
 
 
index a91f8e2d60b0f376e3d58dbabd7a45d6e1eabafc..5ecfb35dbbcb87adb132a1778ece31cc29133a26 100644 (file)
 #define DISPATCH_RESULT_H
 
 /** Dispatch result codes
-       DISPATCHED          = the inset catched the action
-       DISPATCHED_NOUPDATE = the inset catched the action and no update
-                       is needed here to redraw the inset
+       DISPATCHED          = the inset caught the action
+       DISPATCHED_NOUPDATE = the inset caught the action and no update
+                       is needed to redraw the inset
        FINISHED            = the inset must be unlocked as a result
                        of the action
-       FINISHED_RIGHT      = FINISHED, but put the cursor to the RIGHT of
+       FINISHED_RIGHT      = FINISHED, but move the cursor RIGHT from
                        the inset.
-       FINISHED_UP         = FINISHED, but put the cursor UP of
+       FINISHED_UP         = FINISHED, but move the cursor UP from
                        the inset.
-       FINISHED_DOWN       = FINISHED, but put the cursor DOWN of
+       FINISHED_DOWN       = FINISHED, but move the cursor DOWN from
                        the inset.
        UNDISPATCHED        = the action was not catched, it should be
                        dispatched by lower level insets
 */
 enum dispatch_result_t {
-       UNDISPATCHED = 0,
-       DISPATCHED,
-       DISPATCHED_NOUPDATE,
+       NONE = 0,
+       NOUPDATE,
        FINISHED,
        FINISHED_RIGHT,
        FINISHED_UP,
@@ -45,11 +44,18 @@ enum dispatch_result_t {
 class DispatchResult {
 public:
        DispatchResult()
-               : val_(UNDISPATCHED) {}
+               : dispatched_(false), val_(NONE) {}
        explicit
-       DispatchResult(dispatch_result_t val) : val_(val) {}
+       DispatchResult(bool dis)
+               : dispatched_(dis), val_(NONE) {}
+       DispatchResult(bool dis, dispatch_result_t val)
+               : dispatched_(dis), val_(val) {}
        dispatch_result_t val() const { return val_; }
+       bool dispatched() const {
+               return dispatched_;
+       }
 private:
+       bool dispatched_;
        dispatch_result_t val_;
 };
 
@@ -57,7 +63,7 @@ private:
 inline
 bool operator==(DispatchResult const & lhs, DispatchResult const & rhs)
 {
-       return lhs.val() == rhs.val();
+       return lhs.dispatched() == rhs.dispatched() && lhs.val() == rhs.val();
 }
 
 
@@ -67,13 +73,4 @@ bool operator!=(DispatchResult const & lhs, DispatchResult const & rhs)
        return !(lhs == rhs);
 }
 
-
-// This operator is temporary, will be removed with the introduction of
-// a status field in DispatchResult.
-inline
-bool operator>=(DispatchResult const & lhs, DispatchResult const & rhs)
-{
-       return lhs.val() >= rhs.val();
-}
-
 #endif // DISPATCH_RESULT_H
index d51eb8f2a43468ed5d671136d128eee1eb39bafb..f7138266c8629de6f5a33e3f77cf4c50fabf02bc 100644 (file)
@@ -1,12 +1,16 @@
+2003-11-01  Lars Gullik Bjønnes  <larsbj@gullik.net>
+
+       * insets: adjust for DispatchResult changes.
+
 2003-11-01  Jürgen Spitzmüller  <j.spitzmueller@gmx.de>
 
        * insetpagebreak.C: fix screen representation & ascii output.
 
 2003-11-01  Alfredo Braunstein  <abraunst@libero.it>
 
-       * inset.[Ch]: 
-       * insettext.[Ch]: 
-       * insettabular.[Ch]: 
+       * inset.[Ch]:
+       * insettext.[Ch]:
+       * insettabular.[Ch]:
        * insetcollapsable.[Ch]: bool haveParagraphs() -> int numParagraphs()
 
 2003-10-31  José Matos  <jamatos@lyx.org>
index 59ca88fea50621cffb7007f93470cafa161b6bbe..e0df020b6105c3704f8673a69bd2b67ff0ff6162 100644 (file)
@@ -33,5 +33,5 @@ InsetBase::dispatch(FuncRequest const & f)
 DispatchResult
 InsetBase::priv_dispatch(FuncRequest const &, idx_type &, pos_type &)
 {
-       return DispatchResult(UNDISPATCHED);
+       return DispatchResult(false);
 }
index 1e0e1fa47a90cfea37dbc14acc52eafb6f257fe6..f1afd96c76aca1bb87ad82c18127220473f73a8a 100644 (file)
@@ -67,17 +67,17 @@ InsetBibitem::priv_dispatch(FuncRequest const & cmd,
 
        case LFUN_INSET_EDIT:
                InsetCommandMailer("bibitem", *this).showDialog(cmd.view());
-               return DispatchResult(DISPATCHED);
+               return DispatchResult(true);
 
        case LFUN_INSET_MODIFY: {
                InsetCommandParams p;
                InsetCommandMailer::string2params(cmd.argument, p);
                if (p.getCmdName().empty())
-                       return DispatchResult(DISPATCHED);
+                       return DispatchResult(true);
                setParams(p);
                cmd.view()->updateInset(this);
                cmd.view()->fitCursor();
-               return DispatchResult(DISPATCHED);
+               return DispatchResult(true);
        }
 
        default:
index 74fc533887114e6ee471417d51d13cc87d146f2e..16f791d5507a9f1d7ee48577dc611303741e5e5f 100644 (file)
@@ -96,19 +96,19 @@ InsetBibtex::priv_dispatch(FuncRequest const & cmd,
 
        case LFUN_INSET_DIALOG_SHOW:
                InsetCommandMailer("bibtex", *this).showDialog(cmd.view());
-               return DispatchResult(DISPATCHED);
+               return DispatchResult(true);
        case LFUN_MOUSE_RELEASE:
                if (button().box().contains(cmd.x, cmd.y))
                        InsetCommandMailer("bibtex", *this).showDialog(cmd.view());
-               return DispatchResult(DISPATCHED);
+               return DispatchResult(true);
 
        case LFUN_INSET_MODIFY: {
                InsetCommandParams p;
                InsetCommandMailer::string2params(cmd.argument, p);
                if (p.getCmdName().empty())
-                       return DispatchResult(DISPATCHED);
+                       return DispatchResult(true);
                setParams(p);
-               return  DispatchResult(DISPATCHED);
+               return  DispatchResult(true);
        }
 
        default:
index adbb9c0c8892503346749e0931c9a294f1d613b5..36842210d9c4277e466a57d537278f9738650c51 100644 (file)
@@ -177,16 +177,16 @@ InsetBox::priv_dispatch(FuncRequest const & cmd,
                InsetBoxMailer::string2params(cmd.argument, params_);
                setButtonLabel();
                bv->updateInset(this);
-               return DispatchResult(DISPATCHED);
+               return DispatchResult(true);
        }
        case LFUN_INSET_DIALOG_UPDATE:
                InsetBoxMailer(*this).updateDialog(bv);
-               return DispatchResult(DISPATCHED);
+               return DispatchResult(true);
 
        case LFUN_MOUSE_RELEASE:
                if (cmd.button() == mouse_button::button3 && hitButton(cmd)) {
                        InsetBoxMailer(*this).showDialog(bv);
-                       return DispatchResult(DISPATCHED);
+                       return DispatchResult(true);
                }
                // fallthrough:
 
index 666c08125cd19cf406985ac2d3a898b164e294bb..b3416ae9dc3a6b3e672254c0237b967633ef4cf7 100644 (file)
@@ -130,20 +130,20 @@ InsetBranch::priv_dispatch(FuncRequest const & cmd,
                params_.branch = params.branch;
                setButtonLabel();
                bv->updateInset(this);
-               return DispatchResult(DISPATCHED);
+               return DispatchResult(true);
                }
        case LFUN_INSET_EDIT:
                if (cmd.button() != mouse_button::button3)
                        return InsetCollapsable::priv_dispatch(cmd, idx, pos);
 
-               return DispatchResult(UNDISPATCHED);
+               return DispatchResult(false);
        case LFUN_INSET_DIALOG_UPDATE:
                InsetBranchMailer("branch", *this).updateDialog(bv);
-               return DispatchResult(DISPATCHED);
+               return DispatchResult(true);
        case LFUN_MOUSE_RELEASE:
                if (cmd.button() == mouse_button::button3 && hitButton(cmd)) {
                    InsetBranchMailer("branch", *this).showDialog(bv);
-                       return DispatchResult(DISPATCHED);
+                       return DispatchResult(true);
                }
                // fallthrough:
        default:
index 760a71df9acc5931cba5e00d5993a6489073c001..ef07a4c401ffefa4b19b19896a9dccabe41c6ae8 100644 (file)
@@ -316,7 +316,7 @@ InsetCitation::priv_dispatch(FuncRequest const & cmd,
        switch (cmd.action) {
        case LFUN_INSET_EDIT:
                InsetCommandMailer("citation", *this).showDialog(cmd.view());
-               return DispatchResult(DISPATCHED);
+               return DispatchResult(true);
 
        default:
                return InsetCommand::priv_dispatch(cmd, idx, pos);
index a787b3a2a4398dc407fdb28c4ba2c2882e7a714b..11b4c06d74d3ac0a9cff2d042882d2101e00c2bb 100644 (file)
@@ -234,7 +234,7 @@ void InsetCollapsable::lfunMouseRelease(FuncRequest const & cmd)
                bv->updateInset(this);
                bv->buffer()->markDirty();
        } else if (!collapsed_ && cmd.y > button_dim.y2) {
-               ret = inset.dispatch(adjustCommand(cmd)) == DispatchResult(DISPATCHED);
+               ret = inset.dispatch(adjustCommand(cmd)) == DispatchResult(true);
        }
        if (cmd.button() == mouse_button::button3 && !ret)
                showInsetDialog(bv);
@@ -310,14 +310,14 @@ InsetCollapsable::priv_dispatch(FuncRequest const & cmd,
                                        if (bv->lockInset(this))
                                                inset.dispatch(cmd);
                                }
-                               return DispatchResult(DISPATCHED);
+                               return DispatchResult(true);
                        }
 
 #ifdef WITH_WARNINGS
 #warning Fix this properly in BufferView_pimpl::workAreaButtonRelease
 #endif
                        if (cmd.button() == mouse_button::button3)
-                               return DispatchResult(DISPATCHED);
+                               return DispatchResult(true);
 
                        UpdatableInset::priv_dispatch(cmd, idx, pos);
 
@@ -327,13 +327,13 @@ InsetCollapsable::priv_dispatch(FuncRequest const & cmd,
                                // it was already collapsed!
                                first_after_edit = true;
                                if (!bv->lockInset(this))
-                                       return DispatchResult(DISPATCHED);
+                                       return DispatchResult(true);
                                bv->updateInset(this);
                                bv->buffer()->markDirty();
                                inset.dispatch(cmd);
                        } else {
                                if (!bv->lockInset(this))
-                                       return DispatchResult(DISPATCHED);
+                                       return DispatchResult(true);
                                if (cmd.y <= button_dim.y2) {
                                        FuncRequest cmd1 = cmd;
                                        cmd1.y = 0;
@@ -341,26 +341,26 @@ InsetCollapsable::priv_dispatch(FuncRequest const & cmd,
                                } else
                                        inset.dispatch(adjustCommand(cmd));
                        }
-                       return DispatchResult(DISPATCHED);
+                       return DispatchResult(true);
                }
 
                case LFUN_MOUSE_PRESS:
                        if (!collapsed_ && cmd.y > button_dim.y2)
                                inset.dispatch(adjustCommand(cmd));
-                       return DispatchResult(DISPATCHED);
+                       return DispatchResult(true);
 
                case LFUN_MOUSE_MOTION:
                        if (!collapsed_ && cmd.y > button_dim.y2)
                                inset.dispatch(adjustCommand(cmd));
-                       return DispatchResult(DISPATCHED);
+                       return DispatchResult(true);
 
                case LFUN_MOUSE_RELEASE:
                        lfunMouseRelease(cmd);
-                       return DispatchResult(DISPATCHED);
+                       return DispatchResult(true);
 
                default:
-                       DispatchResult result = inset.dispatch(cmd);
-                       if (result >= DispatchResult(FINISHED))
+                       DispatchResult const result = inset.dispatch(cmd);
+                       if (result.val() >= FINISHED)
                                bv->unlockInset(this);
                        first_after_edit = false;
                        return result;
index 78ffc5561ed7030f29a8b95023222d296c2829b5..d8576148ed46f024e2d90703a503569a8f5e0bc5 100644 (file)
@@ -96,22 +96,22 @@ InsetCommand::priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &)
                InsetCommandParams p;
                InsetCommandMailer::string2params(cmd.argument, p);
                if (p.getCmdName().empty())
-                       return DispatchResult(UNDISPATCHED);
+                       return DispatchResult(false);
 
                setParams(p);
                cmd.view()->updateInset(this);
-               return DispatchResult(DISPATCHED);
+               return DispatchResult(true);
        }
 
        case LFUN_INSET_DIALOG_UPDATE:
                InsetCommandMailer(cmd.argument, *this).updateDialog(cmd.view());
-               return DispatchResult(DISPATCHED);
+               return DispatchResult(true);
 
        case LFUN_MOUSE_RELEASE:
                return dispatch(FuncRequest(cmd.view(), LFUN_INSET_EDIT));
 
        default:
-               return DispatchResult(UNDISPATCHED);
+               return DispatchResult(false);
        }
 
 }
index 047dd9c9f684862895a913dffb09ff118753f4bd..d3a9417fcda8c48f6927e7ff29a021c4eabb62b6 100644 (file)
@@ -429,7 +429,7 @@ DispatchResult
 InsetERT::priv_dispatch(FuncRequest const & cmd,
                        idx_type & idx, pos_type & pos)
 {
-       DispatchResult result = DispatchResult(UNDISPATCHED);
+       DispatchResult result = DispatchResult(false);
        BufferView * bv = cmd.view();
 
        if (inset.paragraphs.begin()->empty()) {
@@ -466,28 +466,28 @@ InsetERT::priv_dispatch(FuncRequest const & cmd,
                 */
                inset.getLyXText(cmd.view())->fullRebreak();
                bv->updateInset(this);
-               result = DispatchResult(DISPATCHED);
+               result = DispatchResult(true);
        }
        break;
 
        case LFUN_MOUSE_PRESS:
                lfunMousePress(cmd);
-               result = DispatchResult(DISPATCHED);
+               result = DispatchResult(true);
                break;
 
        case LFUN_MOUSE_MOTION:
                lfunMouseMotion(cmd);
-               result = DispatchResult(DISPATCHED);
+               result = DispatchResult(true);
                break;
 
        case LFUN_MOUSE_RELEASE:
                lfunMouseRelease(cmd);
-               result = DispatchResult(DISPATCHED);
+               result = DispatchResult(true);
                break;
 
        case LFUN_LAYOUT:
                bv->owner()->setLayout(inset.paragraphs.begin()->layout()->name());
-               result = DispatchResult(DISPATCHED_NOUPDATE);
+               result = DispatchResult(true, NOUPDATE);
                break;
 
        default:
index d1fb7c011a3dd986787657517fcf7cd8a8559c67..355bf8ef0e61bcae70eb2f12b4f420e745268a2e 100644 (file)
@@ -439,7 +439,7 @@ InsetExternal::priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &)
                InsetExternalParams p;
                InsetExternalMailer::string2params(cmd.argument, buffer, p);
                external::editExternal(p, buffer);
-               return DispatchResult(DISPATCHED_NOUPDATE);
+               return DispatchResult(true, NOUPDATE);
        }
 
        case LFUN_INSET_MODIFY: {
@@ -450,20 +450,20 @@ InsetExternal::priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &)
                InsetExternalMailer::string2params(cmd.argument, buffer, p);
                setParams(p, buffer);
                cmd.view()->updateInset(this);
-               return DispatchResult(DISPATCHED);
+               return DispatchResult(true);
        }
 
        case LFUN_INSET_DIALOG_UPDATE:
                InsetExternalMailer(*this).updateDialog(cmd.view());
-               return DispatchResult(DISPATCHED);
+               return DispatchResult(true);
 
        case LFUN_MOUSE_RELEASE:
        case LFUN_INSET_EDIT:
                InsetExternalMailer(*this).showDialog(cmd.view());
-               return DispatchResult(DISPATCHED);
+               return DispatchResult(true);
 
        default:
-               return DispatchResult(UNDISPATCHED);
+               return DispatchResult(false);
        }
 }
 
index e0f3386700210c07525bfae97ab66434e9aaa49a..757a55aeb8b0af8cac8de7685a7b5931f0498895 100644 (file)
@@ -176,12 +176,12 @@ InsetFloat::priv_dispatch(FuncRequest const & cmd,
 
                wide(params_.wide, cmd.view()->buffer()->params());
                cmd.view()->updateInset(this);
-               return DispatchResult(DISPATCHED);
+               return DispatchResult(true);
        }
 
        case LFUN_INSET_DIALOG_UPDATE: {
                InsetFloatMailer(*this).updateDialog(cmd.view());
-               return DispatchResult(DISPATCHED);
+               return DispatchResult(true);
        }
 
        default:
index 33b182c3211bf6eda6beff82df25175707882c25..e24621809d9fb81286e4e4bead0e3d670d3ab176 100644 (file)
@@ -127,11 +127,11 @@ InsetFloatList::priv_dispatch(FuncRequest const & cmd,
                case LFUN_MOUSE_RELEASE:
                        if (button().box().contains(cmd.x, cmd.y))
                                InsetCommandMailer("toc", *this).showDialog(cmd.view());
-                       return DispatchResult(DISPATCHED);
+                       return DispatchResult(true);
 
                case LFUN_INSET_DIALOG_SHOW:
                        InsetCommandMailer("toc", *this).showDialog(cmd.view());
-                       return DispatchResult(DISPATCHED);
+                       return DispatchResult(true);
 
                default:
                        return InsetCommand::priv_dispatch(cmd, idx, pos);
index 26d1a3471cad80fe7403da93a2d2c229b630118d..05605ffc18d27b7922befeacf553120ccd90df94 100644 (file)
@@ -203,20 +203,20 @@ InsetGraphics::priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &)
                        setParams(p);
                        cmd.view()->updateInset(this);
                }
-               return DispatchResult(DISPATCHED);
+               return DispatchResult(true);
        }
 
        case LFUN_INSET_DIALOG_UPDATE:
                InsetGraphicsMailer(*this).updateDialog(cmd.view());
-               return DispatchResult(DISPATCHED);
+               return DispatchResult(true);
 
        case LFUN_INSET_EDIT:
        case LFUN_MOUSE_RELEASE:
                InsetGraphicsMailer(*this).showDialog(cmd.view());
-               return DispatchResult(DISPATCHED);
+               return DispatchResult(true);
 
        default:
-               return DispatchResult(UNDISPATCHED);
+               return DispatchResult(false);
        }
 }
 
index a766bd0f8cb4c53e8630bd9938c9b940a6591e01..c7f6421578c87f0370b8738ddb6d9fa36bc7f067 100644 (file)
@@ -120,24 +120,24 @@ InsetInclude::priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &)
                        set(p, *cmd.view()->buffer());
                        cmd.view()->updateInset(this);
                }
-               return DispatchResult(DISPATCHED);
+               return DispatchResult(true);
        }
 
        case LFUN_INSET_DIALOG_UPDATE:
                InsetIncludeMailer(*this).updateDialog(cmd.view());
-               return DispatchResult(DISPATCHED);
+               return DispatchResult(true);
 
        case LFUN_MOUSE_RELEASE:
                if (button_.box().contains(cmd.x, cmd.y))
                        InsetIncludeMailer(*this).showDialog(cmd.view());
-               return DispatchResult(DISPATCHED);
+               return DispatchResult(true);
 
        case LFUN_INSET_DIALOG_SHOW:
                InsetIncludeMailer(*this).showDialog(cmd.view());
-               return DispatchResult(DISPATCHED);
+               return DispatchResult(true);
 
        default:
-               return DispatchResult(UNDISPATCHED);
+               return DispatchResult(false);
        }
 }
 
index 47a7e56d33884dd1cc0dcc5421e7dca8776c29de..f8f91ad4c0b4d045a5edb8e78d09246db936d140 100644 (file)
@@ -68,7 +68,7 @@ InsetIndex::priv_dispatch(FuncRequest const & cmd,
        switch (cmd.action) {
                case LFUN_INSET_EDIT:
                        InsetCommandMailer("index", *this).showDialog(cmd.view());
-                       return DispatchResult(DISPATCHED);
+                       return DispatchResult(true);
 
                default:
                        return InsetCommand::priv_dispatch(cmd, idx, pos);
index 4907c7075b271de0d429afd71c52e73d1ee5cbe2..b5b16cf8aee856ac179c057df416514a0bfb9eb1 100644 (file)
@@ -68,14 +68,14 @@ InsetLabel::priv_dispatch(FuncRequest const & cmd,
 
        case LFUN_INSET_EDIT:
                InsetCommandMailer("label", *this).showDialog(bv);
-               return DispatchResult(DISPATCHED);
+               return DispatchResult(true);
                break;
 
        case LFUN_INSET_MODIFY: {
                InsetCommandParams p;
                InsetCommandMailer::string2params(cmd.argument, p);
                if (p.getCmdName().empty())
-                       return DispatchResult(UNDISPATCHED);
+                       return DispatchResult(false);
 
                bool clean = true;
                if (bv && p.getContents() != params().getContents()) {
@@ -85,7 +85,7 @@ InsetLabel::priv_dispatch(FuncRequest const & cmd,
 
                setParams(p);
                bv->updateInset(this);
-               return DispatchResult(DISPATCHED);
+               return DispatchResult(true);
        }
 
        default:
index 5956fd5b05e953674e929afdfd5d482925df8648..73685cc2630ac5897733b28f889d84fca2f9c32d 100644 (file)
@@ -112,12 +112,12 @@ InsetMinipage::priv_dispatch(FuncRequest const & cmd,
                 * with ugliness like this ... */
                inset.getLyXText(cmd.view())->fullRebreak();
                cmd.view()->updateInset(this);
-               return DispatchResult(DISPATCHED);
+               return DispatchResult(true);
        }
 
        case LFUN_INSET_DIALOG_UPDATE:
                InsetMinipageMailer(*this).updateDialog(cmd.view());
-               return DispatchResult(DISPATCHED);
+               return DispatchResult(true);
 
        default:
                return InsetCollapsable::priv_dispatch(cmd, idx, pos);
index 1806d96d80cab20224ede6af5d13f85b5e060360..b627811694ca9de0d1618a50dbe25b66d3e1d5d4 100644 (file)
@@ -142,22 +142,22 @@ InsetNote::priv_dispatch(FuncRequest const & cmd,
                InsetNoteMailer::string2params(cmd.argument, params_);
                setButtonLabel();
                bv->updateInset(this);
-               return DispatchResult(DISPATCHED);
+               return DispatchResult(true);
        }
 
        case LFUN_INSET_EDIT:
                if (cmd.button() == mouse_button::button3)
-                       return DispatchResult(UNDISPATCHED);
+                       return DispatchResult(false);
                return InsetCollapsable::priv_dispatch(cmd, idx, pos);
 
        case LFUN_INSET_DIALOG_UPDATE:
                InsetNoteMailer("note", *this).updateDialog(bv);
-               return DispatchResult(DISPATCHED);
+               return DispatchResult(true);
 
        case LFUN_MOUSE_RELEASE:
                if (cmd.button() == mouse_button::button3 && hitButton(cmd)) {
                        InsetNoteMailer("note", *this).showDialog(bv);
-                       return DispatchResult(DISPATCHED);
+                       return DispatchResult(true);
                }
                // fallthrough:
 
index e9c86e0bfe5a5e45a2c436609e889d68b0357469..2e8e385fb38d404a5d1462ae71407b614dc2b462 100644 (file)
@@ -58,7 +58,7 @@ InsetRef::priv_dispatch(FuncRequest const & cmd,
                                dispatch(FuncRequest(LFUN_REF_GOTO, getContents()));
                else
                        InsetCommandMailer("ref", *this).showDialog(cmd.view());
-               return DispatchResult(DISPATCHED);
+               return DispatchResult(true);
 
        default:
                return InsetCommand::priv_dispatch(cmd, idx, pos);
index c9d8b368ed5a8928dbdae35bd87efb2f7f3869c6..aacabc46a4f63ddadb748edee5fcb512382aa6ca 100644 (file)
@@ -599,18 +599,18 @@ void InsetTabular::lfunMousePress(FuncRequest const & cmd)
 
 bool InsetTabular::lfunMouseRelease(FuncRequest const & cmd)
 {
-       DispatchResult ret = DispatchResult(UNDISPATCHED);
+       DispatchResult ret(false);
        if (the_locking_inset) {
                FuncRequest cmd1 = cmd;
                cmd1.x -= inset_x;
                cmd1.y -= inset_y;
                ret = the_locking_inset->dispatch(cmd1);
        }
-       if (cmd.button() == mouse_button::button3 && ret == DispatchResult(UNDISPATCHED)) {
+       if (cmd.button() == mouse_button::button3 && ret == DispatchResult(false)) {
                InsetTabularMailer(*this).showDialog(cmd.view());
                return true;
        }
-       return ret >= DispatchResult(DISPATCHED);
+       return ret.dispatched() || ret.val() > FINISHED;
 }
 
 
@@ -680,7 +680,7 @@ InsetTabular::priv_dispatch(FuncRequest const & cmd,
 
                if (!bv->lockInset(this)) {
                        lyxerr << "InsetTabular::Cannot lock inset" << endl;
-                       return DispatchResult(DISPATCHED);
+                       return DispatchResult(true);
                }
 
                finishUndo();
@@ -716,34 +716,34 @@ InsetTabular::priv_dispatch(FuncRequest const & cmd,
                                activateCellInset(bv, cmd.x - inset_x, cmd.y - inset_y, cmd.button());
                        }
                }
-               return DispatchResult(DISPATCHED);
+               return DispatchResult(true);
        }
 
-       if (result == DispatchResult(DISPATCHED) || result == DispatchResult(DISPATCHED_NOUPDATE)) {
+       if (result.dispatched()) {
                resetPos(bv);
                return result;
        }
 
        if (cmd.action < 0 && cmd.argument.empty())
-               return DispatchResult(FINISHED);
+               return DispatchResult(false, FINISHED);
 
        bool hs = hasSelection();
 
-       result = DispatchResult(DISPATCHED);
+       result = DispatchResult(true);
        // this one have priority over the locked InsetText, if we're not already
        // inside another tabular then that one get's priority!
        if (getFirstLockingInsetOfType(InsetOld::TABULAR_CODE) == this) {
                switch (cmd.action) {
                case LFUN_MOUSE_PRESS:
                        lfunMousePress(cmd);
-                       return DispatchResult(DISPATCHED);
+                       return DispatchResult(true);
 
                case LFUN_MOUSE_MOTION:
                        lfunMouseMotion(cmd);
-                       return DispatchResult(DISPATCHED);
+                       return DispatchResult(true);
 
                case LFUN_MOUSE_RELEASE:
-                       return lfunMouseRelease(cmd) ? DispatchResult(DISPATCHED) : DispatchResult(UNDISPATCHED);
+                       return DispatchResult(lfunMouseRelease(cmd));
 
                case LFUN_CELL_BACKWARD:
                case LFUN_CELL_FORWARD:
@@ -756,7 +756,7 @@ InsetTabular::priv_dispatch(FuncRequest const & cmd,
                        if (hs)
                                updateLocal(bv);
                        if (!the_locking_inset)
-                               return DispatchResult(DISPATCHED_NOUPDATE);
+                               return DispatchResult(true, NOUPDATE);
                        return result;
                // this to avoid compiler warnings.
                default:
@@ -768,33 +768,35 @@ InsetTabular::priv_dispatch(FuncRequest const & cmd,
        string    arg    = cmd.argument;
        if (the_locking_inset) {
                result = the_locking_inset->dispatch(cmd);
-               if (result == DispatchResult(DISPATCHED_NOUPDATE)) {
-                       int sc = scroll();
-                       resetPos(bv);
-                       if (sc != scroll()) { // inset has been scrolled
+               if (result.dispatched()) {
+                       if (result.val() == NOUPDATE) {
+                               int const sc = scroll();
+                               resetPos(bv);
+                               if (sc != scroll()) {
+                                       // inset has been scrolled
+                                       updateLocal(bv);
+                               }
+                       } else {
                                updateLocal(bv);
                        }
                        return result;
-               } else if (result == DispatchResult(DISPATCHED)) {
-                       updateLocal(bv);
-                       return result;
-               } else if (result == DispatchResult(FINISHED_UP)) {
+               } else if (result.val() == FINISHED_UP) {
                        action = LFUN_UP;
                        // Make sure to reset status message after
                        // exiting, e.g. math inset
                        bv->owner()->clearMessage();
-               } else if (result == DispatchResult(FINISHED_DOWN)) {
+               } else if (result.val() == FINISHED_DOWN) {
                        action = LFUN_DOWN;
                        bv->owner()->clearMessage();
-               } else if (result == DispatchResult(FINISHED_RIGHT)) {
+               } else if (result.val() == FINISHED_RIGHT) {
                        action = LFUN_RIGHT;
                        bv->owner()->clearMessage();
-               } else if (result == DispatchResult(FINISHED)) {
+               } else if (result.val() == FINISHED) {
                        bv->owner()->clearMessage();
                }
        }
 
-       result = DispatchResult(DISPATCHED);
+       result = DispatchResult(true);
        switch (action) {
                // --- Cursor Movements ----------------------------------
        case LFUN_RIGHTSEL: {
@@ -960,7 +962,7 @@ InsetTabular::priv_dispatch(FuncRequest const & cmd,
                break;
        case LFUN_TABULAR_FEATURE:
                if (!tabularFeatures(bv, arg))
-                       result = DispatchResult(UNDISPATCHED);
+                       result = DispatchResult(false);
                break;
                // insert file functions
        case LFUN_FILE_INSERT_ASCII_PARA:
@@ -972,7 +974,7 @@ InsetTabular::priv_dispatch(FuncRequest const & cmd,
                if (insertAsciiString(bv, tmpstr, false))
                        updateLocal(bv);
                else
-                       result = DispatchResult(UNDISPATCHED);
+                       result = DispatchResult(false);
                break;
        }
        // cut and paste functions
@@ -1073,7 +1075,7 @@ InsetTabular::priv_dispatch(FuncRequest const & cmd,
        default:
                // handle font changing stuff on selection before we lock the inset
                // in the default part!
-               result = DispatchResult(UNDISPATCHED);
+               result = DispatchResult(false);
                if (hs) {
                        switch(action) {
                        case LFUN_LANGUAGE:
@@ -1087,7 +1089,7 @@ InsetTabular::priv_dispatch(FuncRequest const & cmd,
                        case LFUN_UNDERLINE:
                        case LFUN_FONT_SIZE:
                                if (bv->dispatch(FuncRequest(bv, action, arg)))
-                                       result = DispatchResult(DISPATCHED);
+                                       result = DispatchResult(true);
                                break;
                        default:
                                break;
@@ -1095,15 +1097,15 @@ InsetTabular::priv_dispatch(FuncRequest const & cmd,
                }
                // we try to activate the actual inset and put this event down to
                // the insets dispatch function.
-               if (result == DispatchResult(DISPATCHED) || the_locking_inset)
+               if (result.dispatched() || the_locking_inset)
                        break;
                if (activateCellInset(bv)) {
                        result = the_locking_inset->dispatch(FuncRequest(bv, action, arg));
-                       if (result == DispatchResult(UNDISPATCHED) || result >= DispatchResult(FINISHED)) {
+                       if (!result.dispatched()) {
                                unlockInsetInInset(bv, the_locking_inset);
                                // we need to update if this was requested before
                                updateLocal(bv);
-                               return DispatchResult(UNDISPATCHED);
+                               return DispatchResult(false);
                        }
                        if (hs)
                                clearSelection();
@@ -1112,11 +1114,12 @@ InsetTabular::priv_dispatch(FuncRequest const & cmd,
                }
                break;
        }
-       if (!(result >= DispatchResult(FINISHED))) {
-               if (!the_locking_inset && bv->fitCursor())
-                       updateLocal(bv);
-       } else
+
+       if (result.val() >= FINISHED)
                bv->unlockInset(this);
+       else if (!the_locking_inset && bv->fitCursor())
+               updateLocal(bv);
+
        return result;
 }
 
@@ -1404,17 +1407,17 @@ DispatchResult InsetTabular::moveRight(BufferView * bv, bool lock)
 {
        if (lock && !old_locking_inset) {
                if (activateCellInset(bv))
-                       return DispatchResult(DISPATCHED);
+                       return DispatchResult(true);
        } else {
                bool moved = isRightToLeft(bv)
                        ? movePrevCell(bv) : moveNextCell(bv);
                if (!moved)
-                       return DispatchResult(FINISHED_RIGHT);
+                       return DispatchResult(false, FINISHED_RIGHT);
                if (lock && activateCellInset(bv))
-                       return DispatchResult(DISPATCHED);
+                       return DispatchResult(true);
        }
        resetPos(bv);
-       return DispatchResult(DISPATCHED_NOUPDATE);
+       return DispatchResult(true, NOUPDATE);
 }
 
 
@@ -1422,12 +1425,12 @@ DispatchResult InsetTabular::moveLeft(BufferView * bv, bool lock)
 {
        bool moved = isRightToLeft(bv) ? moveNextCell(bv) : movePrevCell(bv);
        if (!moved)
-               return DispatchResult(FINISHED);
+               return DispatchResult(false, FINISHED);
        // behind the inset
        if (lock && activateCellInset(bv, 0, 0, mouse_button::none, true))
-               return DispatchResult(DISPATCHED);
+               return DispatchResult(true);
        resetPos(bv);
-       return DispatchResult(DISPATCHED_NOUPDATE);
+       return DispatchResult(true, NOUPDATE);
 }
 
 
@@ -1436,7 +1439,7 @@ DispatchResult InsetTabular::moveUp(BufferView * bv, bool lock)
        int const ocell = actcell;
        actcell = tabular.getCellAbove(actcell);
        if (actcell == ocell) // we moved out of the inset
-               return DispatchResult(FINISHED_UP);
+               return DispatchResult(false, FINISHED_UP);
        resetPos(bv);
        if (lock) {
                int x = 0;
@@ -1446,9 +1449,9 @@ DispatchResult InsetTabular::moveUp(BufferView * bv, bool lock)
                        x -= cursorx_ + tabular.getBeginningOfTextInCell(actcell);
                }
                if (activateCellInset(bv, x, 0))
-                       return DispatchResult(DISPATCHED);
+                       return DispatchResult(true);
        }
-       return DispatchResult(DISPATCHED_NOUPDATE);
+       return DispatchResult(true, NOUPDATE);
 }
 
 
@@ -1457,7 +1460,7 @@ DispatchResult InsetTabular::moveDown(BufferView * bv, bool lock)
        int const ocell = actcell;
        actcell = tabular.getCellBelow(actcell);
        if (actcell == ocell) // we moved out of the inset
-               return DispatchResult(FINISHED_DOWN);
+               return DispatchResult(false, FINISHED_DOWN);
        resetPos(bv);
        if (lock) {
                int x = 0;
@@ -1467,9 +1470,9 @@ DispatchResult InsetTabular::moveDown(BufferView * bv, bool lock)
                        x -= cursorx_ + tabular.getBeginningOfTextInCell(actcell);
                }
                if (activateCellInset(bv, x, 0))
-                       return DispatchResult(DISPATCHED);
+                       return DispatchResult(true);
        }
-       return DispatchResult(DISPATCHED_NOUPDATE);
+       return DispatchResult(true, NOUPDATE);
 }
 
 
index 63cedf890141cc8558f987ed65903970d19b068e..a2934b3ab922835c63a3076754ceef99aaf1bc27 100644 (file)
@@ -546,8 +546,11 @@ bool InsetText::lfunMouseRelease(FuncRequest const & cmd)
        cmd1.y -= inset_y;
 
        no_selection = true;
-       if (the_locking_inset)
-               return the_locking_inset->dispatch(cmd1) >= DispatchResult(DISPATCHED);
+       if (the_locking_inset) {
+               DispatchResult const res = the_locking_inset->dispatch(cmd1);
+
+               return res.dispatched() || res.val() >= NOUPDATE;
+       }
 
        int tmp_x = cmd.x;
        int tmp_y = cmd.y + dim_.asc - bv->top_y();
@@ -557,7 +560,8 @@ bool InsetText::lfunMouseRelease(FuncRequest const & cmd)
 
        // We still need to deal properly with the whole relative vs.
        // absolute mouse co-ords thing in a realiable, sensible way
-       bool ret = inset->dispatch(cmd1) >= DispatchResult(DISPATCHED);
+       DispatchResult const res = inset->dispatch(cmd1);
+       bool const ret = res.dispatched() || res.val() >= NOUPDATE;
        updateLocal(bv, false);
        return ret;
 }
@@ -601,7 +605,7 @@ InsetText::priv_dispatch(FuncRequest const & cmd,
 
                if (!bv->lockInset(this)) {
                        lyxerr[Debug::INSETS] << "Cannot lock inset" << endl;
-                       return DispatchResult(DISPATCHED);
+                       return DispatchResult(true);
                }
 
                locked = true;
@@ -649,19 +653,19 @@ InsetText::priv_dispatch(FuncRequest const & cmd,
                updateLocal(bv, false);
                // Tell the paragraph dialog that we've entered an insettext.
                bv->dispatch(FuncRequest(LFUN_PARAGRAPH_UPDATE));
-               return DispatchResult(DISPATCHED);
+               return DispatchResult(true);
        }
 
        case LFUN_MOUSE_PRESS:
                lfunMousePress(cmd);
-               return DispatchResult(DISPATCHED);
+               return DispatchResult(true);
 
        case LFUN_MOUSE_MOTION:
                lfunMouseMotion(cmd);
-               return DispatchResult(DISPATCHED);
+               return DispatchResult(true);
 
        case LFUN_MOUSE_RELEASE:
-               return lfunMouseRelease(cmd) ? DispatchResult(DISPATCHED) : DispatchResult(UNDISPATCHED);
+               return DispatchResult(lfunMouseRelease(cmd));
 
        default:
                break;
@@ -671,51 +675,50 @@ InsetText::priv_dispatch(FuncRequest const & cmd,
        no_selection = false;
 
        DispatchResult result = UpdatableInset::priv_dispatch(cmd, idx, pos);
-       if (result != DispatchResult(UNDISPATCHED))
-               return DispatchResult(DISPATCHED);
+       if (result.dispatched())
+               return DispatchResult(true);
 
-       result = DispatchResult(DISPATCHED);
+       result = DispatchResult(true);
        if (cmd.action < 0 && cmd.argument.empty())
-               return DispatchResult(FINISHED);
+               return DispatchResult(false, FINISHED);
 
        if (the_locking_inset) {
                result = the_locking_inset->dispatch(cmd);
-               if (result == DispatchResult(DISPATCHED_NOUPDATE))
-                       return result;
-               if (result == DispatchResult(DISPATCHED)) {
-                       updateLocal(bv, false);
+
+               if (result.dispatched()) {
+                       if (result.val() != NOUPDATE)
+                               updateLocal(bv, false);
                        return result;
                }
-               if (result >= DispatchResult(FINISHED)) {
-                       switch (result.val()) {
-                       case FINISHED_RIGHT:
-                               moveRightIntern(bv, false, false);
-                               result = DispatchResult(DISPATCHED);
-                               break;
-                       case FINISHED_UP:
-                               result = moveUp(bv);
-                               if (result >= DispatchResult(FINISHED)) {
-                                       updateLocal(bv, false);
-                                       bv->unlockInset(this);
-                               }
-                               break;
-                       case FINISHED_DOWN:
-                               result = moveDown(bv);
-                               if (result >= DispatchResult(FINISHED)) {
-                                       updateLocal(bv, false);
-                                       bv->unlockInset(this);
-                               }
-                               break;
-                       default:
-                               result = DispatchResult(DISPATCHED);
-                               break;
+
+               switch (result.val()) {
+               case FINISHED_RIGHT:
+                       moveRightIntern(bv, false, false);
+                       result = DispatchResult(true);
+                       break;
+               case FINISHED_UP:
+                       result = moveUp(bv);
+                       if (result.val() >= FINISHED) {
+                               updateLocal(bv, false);
+                               bv->unlockInset(this);
                        }
-                       the_locking_inset = 0;
-                       updateLocal(bv, false);
-                       // make sure status gets reset immediately
-                       bv->owner()->clearMessage();
-                       return result;
+                       break;
+               case FINISHED_DOWN:
+                       result = moveDown(bv);
+                       if (result.val() >= FINISHED) {
+                               updateLocal(bv, false);
+                               bv->unlockInset(this);
+                       }
+                       break;
+               default:
+                       result = DispatchResult(true);
+                       break;
                }
+               the_locking_inset = 0;
+               updateLocal(bv, false);
+               // make sure status gets reset immediately
+               bv->owner()->clearMessage();
+               return result;
        }
        bool updflag = false;
 
@@ -749,7 +752,7 @@ InsetText::priv_dispatch(FuncRequest const & cmd,
                }
                text_.selection.cursor = text_.cursor;
                updflag = true;
-               result = DispatchResult(DISPATCHED_NOUPDATE);
+               result = DispatchResult(true, NOUPDATE);
                break;
 
        // cursor movements that need special handling
@@ -773,21 +776,21 @@ InsetText::priv_dispatch(FuncRequest const & cmd,
 
        case LFUN_PRIOR:
                if (crow() == text_.firstRow())
-                       result = DispatchResult(FINISHED_UP);
+                       result = DispatchResult(false, FINISHED_UP);
                else {
                        text_.cursorPrevious();
                        text_.clearSelection();
-                       result = DispatchResult(DISPATCHED_NOUPDATE);
+                       result = DispatchResult(true, NOUPDATE);
                }
                break;
 
        case LFUN_NEXT:
                if (crow() == text_.lastRow())
-                       result = DispatchResult(FINISHED_DOWN);
+                       result = DispatchResult(false, FINISHED_DOWN);
                else {
                        text_.cursorNext();
                        text_.clearSelection();
-                       result = DispatchResult(DISPATCHED_NOUPDATE);
+                       result = DispatchResult(true, NOUPDATE);
                }
                break;
 
@@ -832,7 +835,7 @@ InsetText::priv_dispatch(FuncRequest const & cmd,
 
        case LFUN_BREAKPARAGRAPH:
                if (!autoBreakRows_) {
-                       result = DispatchResult(DISPATCHED);
+                       result = DispatchResult(true);
                } else {
                        replaceSelection(bv->getLyXText());
                        text_.breakParagraph(paragraphs, 0);
@@ -842,7 +845,7 @@ InsetText::priv_dispatch(FuncRequest const & cmd,
 
        case LFUN_BREAKPARAGRAPHKEEPLAYOUT:
                if (!autoBreakRows_) {
-                       result = DispatchResult(DISPATCHED);
+                       result = DispatchResult(true);
                } else {
                        replaceSelection(bv->getLyXText());
                        text_.breakParagraph(paragraphs, 1);
@@ -852,7 +855,7 @@ InsetText::priv_dispatch(FuncRequest const & cmd,
 
        case LFUN_BREAKLINE: {
                if (!autoBreakRows_) {
-                       result = DispatchResult(DISPATCHED);
+                       result = DispatchResult(true);
                } else {
                        replaceSelection(bv->getLyXText());
                        text_.insertInset(new InsetNewline);
@@ -901,7 +904,7 @@ InsetText::priv_dispatch(FuncRequest const & cmd,
 
        default:
                if (!bv->dispatch(cmd))
-                       result = DispatchResult(UNDISPATCHED);
+                       result = DispatchResult(false);
                break;
        }
 
@@ -916,11 +919,11 @@ InsetText::priv_dispatch(FuncRequest const & cmd,
                setFont(bv, font, false);
        }
 
-       if (result >= DispatchResult(FINISHED))
+       if (result.val() >= FINISHED)
                bv->unlockInset(this);
 
-       if (result == DispatchResult(DISPATCHED_NOUPDATE))
-               result = DispatchResult(DISPATCHED);
+       if (result.val() == NOUPDATE)
+               result = DispatchResult(true);
        return result;
 }
 
@@ -1043,13 +1046,13 @@ InsetText::moveRightIntern(BufferView * bv, bool front,
        ParagraphList::iterator c_par = cpar();
 
        if (boost::next(c_par) == paragraphs.end() && cpos() >= c_par->size())
-               return DispatchResult(FINISHED_RIGHT);
+               return DispatchResult(false, FINISHED_RIGHT);
        if (activate_inset && checkAndActivateInset(bv, front))
-               return DispatchResult(DISPATCHED);
+               return DispatchResult(true);
        text_.cursorRight(bv);
        if (!selecting)
                text_.clearSelection();
-       return DispatchResult(DISPATCHED_NOUPDATE);
+       return DispatchResult(true, NOUPDATE);
 }
 
 
@@ -1058,33 +1061,33 @@ InsetText::moveLeftIntern(BufferView * bv, bool front,
                          bool activate_inset, bool selecting)
 {
        if (cpar() == paragraphs.begin() && cpos() <= 0)
-               return DispatchResult(FINISHED);
+               return DispatchResult(false, FINISHED);
        text_.cursorLeft(bv);
        if (!selecting)
                text_.clearSelection();
        if (activate_inset && checkAndActivateInset(bv, front))
-               return DispatchResult(DISPATCHED);
-       return DispatchResult(DISPATCHED_NOUPDATE);
+               return DispatchResult(true);
+       return DispatchResult(true, NOUPDATE);
 }
 
 
 DispatchResult InsetText::moveUp(BufferView * bv)
 {
        if (crow() == text_.firstRow())
-               return DispatchResult(FINISHED_UP);
+               return DispatchResult(false, FINISHED_UP);
        text_.cursorUp(bv);
        text_.clearSelection();
-       return DispatchResult(DISPATCHED_NOUPDATE);
+       return DispatchResult(true, NOUPDATE);
 }
 
 
 DispatchResult InsetText::moveDown(BufferView * bv)
 {
        if (crow() == text_.lastRow())
-               return DispatchResult(FINISHED_DOWN);
+               return DispatchResult(false, FINISHED_DOWN);
        text_.cursorDown(bv);
        text_.clearSelection();
-       return DispatchResult(DISPATCHED_NOUPDATE);
+       return DispatchResult(true, NOUPDATE);
 }
 
 
index 014fb31fb377fa98d98199cea6b2a97cd6eabb54..a4f9fb17d122e067705372eef228217b682f1622 100644 (file)
@@ -82,11 +82,11 @@ InsetTOC::priv_dispatch(FuncRequest const & cmd,
        case LFUN_MOUSE_RELEASE:
                if (button().box().contains(cmd.x, cmd.y))
                        InsetCommandMailer("toc", *this).showDialog(cmd.view());
-               return DispatchResult(DISPATCHED);
+               return DispatchResult(true);
 
        case LFUN_INSET_DIALOG_SHOW:
                InsetCommandMailer("toc", *this).showDialog(cmd.view());
-               return DispatchResult(DISPATCHED);
+               return DispatchResult(true);
 
        default:
                return InsetCommand::priv_dispatch(cmd, idx, pos);
index a0533375ac18f223d53e578431871abfc957e704..1cd18fe3b75c4691848f40e0e47c348e43fccd5b 100644 (file)
@@ -51,7 +51,7 @@ InsetUrl::priv_dispatch(FuncRequest const & cmd,
        switch (cmd.action) {
                case LFUN_INSET_EDIT:
                        InsetCommandMailer("url", *this).showDialog(cmd.view());
-                       return DispatchResult(DISPATCHED);
+                       return DispatchResult(true);
                default:
                        return InsetCommand::priv_dispatch(cmd, idx, pos);
        }
index 6ff91b69a97dc5e3d6f4d17bc2af3b9ef5732c82..1432b3650cd3c3a5f7cb1522570aa2c912deec2d 100644 (file)
@@ -98,12 +98,12 @@ InsetWrap::priv_dispatch(FuncRequest const & cmd,
                params_.width     = params.width;
 
                cmd.view()->updateInset(this);
-               return DispatchResult(DISPATCHED);
+               return DispatchResult(true);
        }
 
        case LFUN_INSET_DIALOG_UPDATE:
                InsetWrapMailer(*this).updateDialog(cmd.view());
-               return DispatchResult(DISPATCHED);
+               return DispatchResult(true);
 
        default:
                return InsetCollapsable::priv_dispatch(cmd, idx, pos);
index 1e0a4f0a0e45c621b20d3a47e23124cfebbefd7c..56fc9d72df78289e8c2a9ecd3d5a5d9b8e09977f 100644 (file)
@@ -113,7 +113,7 @@ DispatchResult
 UpdatableInset::priv_dispatch(FuncRequest const & ev, idx_type &, pos_type &)
 {
        if (ev.action == LFUN_MOUSE_RELEASE)
-               return (editable() == IS_EDITABLE) ? DispatchResult(DISPATCHED) : DispatchResult(UNDISPATCHED);
+               return DispatchResult(editable() == IS_EDITABLE);
 
        if (!ev.argument.empty() && ev.action == LFUN_SCROLL_INSET) {
                if (ev.argument.find('.') != ev.argument.npos) {
@@ -125,9 +125,9 @@ UpdatableInset::priv_dispatch(FuncRequest const & ev, idx_type &, pos_type &)
                }
                ev.view()->updateInset(this);
 
-               return DispatchResult(DISPATCHED);
+               return DispatchResult(true);
        }
-       return DispatchResult(UNDISPATCHED);
+       return DispatchResult(false);
 }
 
 
index 91bf61f3b96913f7d0a7be1af02c091ea2a58776..e67eb2c8b0c9b6fdf7ee9e84e3ce1bc18e56238e 100644 (file)
@@ -885,11 +885,11 @@ void LyXFunc::dispatch(FuncRequest const & func, bool verbose)
        {
                Cursor cursor;
                buildCursor(cursor, *view());
-               if (cursor.dispatch(FuncRequest(func, view())) == DispatchResult(DISPATCHED)) {
+               if (cursor.dispatch(FuncRequest(func, view())).dispatched()) {
                        lyxerr << "dispatched by Cursor::dispatch()\n";
                        goto exit_with_message;
                }
-               lyxerr << "### NOT DispatchResult(DISPATCHED) BY Cursor::dispatch() ###\n";
+               lyxerr << "### NOT DispatchResult(true) BY Cursor::dispatch() ###\n";
        }
 #endif
 
@@ -933,27 +933,27 @@ void LyXFunc::dispatch(FuncRequest const & func, bool verbose)
 
                        // Hand-over to inset's own dispatch:
                        result = inset->dispatch(FuncRequest(view(), action, argument));
-                       if (result == DispatchResult(DISPATCHED) || result == DispatchResult(DISPATCHED_NOUPDATE)) {
+                       if (result.dispatched()) {
                                goto exit_with_message;
                        }
 
-                       // If DispatchResult(UNDISPATCHED), just soldier on
-                       if (result == DispatchResult(FINISHED)) {
+                       // If DispatchResult(false), just soldier on
+                       if (result.val() == FINISHED) {
                                owner->clearMessage();
                                goto exit_with_message;
                                // We do not need special RTL handling here:
-                               // DispatchResult(FINISHED) means that the cursor should be
+                               // FINISHED means that the cursor should be
                                // one position after the inset.
                        }
 
-                       if (result == DispatchResult(FINISHED_RIGHT)) {
+                       if (result.val() == FINISHED_RIGHT) {
                                view()->text->cursorRight(view());
                                moveCursorUpdate();
                                owner->clearMessage();
                                goto exit_with_message;
                        }
 
-                       if (result == DispatchResult(FINISHED_UP)) {
+                       if (result.val() == FINISHED_UP) {
                                LyXText * text = view()->text;
                                ParagraphList::iterator pit = text->cursorPar();
                                Row const & row = *pit->getRow(text->cursor.pos());
@@ -975,7 +975,7 @@ void LyXFunc::dispatch(FuncRequest const & func, bool verbose)
                                goto exit_with_message;
                        }
 
-                       if (result == DispatchResult(FINISHED_DOWN)) {
+                       if (result.val() == FINISHED_DOWN) {
                                LyXText * text = view()->text;
                                ParagraphList::iterator pit = text->cursorPar();
                                Row const & row = *pit->getRow(text->cursor.pos());
index 1d4229d7488d421356ca913b32202acd2da7e7d1..2a0459ac6a72e94abdbf758d4ca387b8ccb90014 100644 (file)
@@ -1,3 +1,7 @@
+2003-11-01  Lars Gullik Bjønnes  <larsbj@gullik.net>
+
+       * adjust for DispatchResult changes
+
 2003-10-31  José Matos  <jamatos@lyx.org>
 
        * formula.[Ch] (ascii, linuxdoc, docbook):
 
 2003-10-29  Lars Gullik Bjønnes  <larsbj@gullik.net>
 
-       * math_scriptinset.C (priv_dispatch): 
-       * math_nestinset.C (priv_dispatch): 
-       * math_hullinset.C (priv_dispatch): 
-       * math_gridinset.C (priv_dispatch): 
-       * math_cursor.C (dispatch): 
-       * formulabase.C (lfunMouseRelease, lfunMousePress) 
-       (lfunMouseMotion, priv_dispatch): 
+       * math_scriptinset.C (priv_dispatch):
+       * math_nestinset.C (priv_dispatch):
+       * math_hullinset.C (priv_dispatch):
+       * math_gridinset.C (priv_dispatch):
+       * math_cursor.C (dispatch):
+       * formulabase.C (lfunMouseRelease, lfunMousePress)
+       (lfunMouseMotion, priv_dispatch):
        * command_inset.C (priv_dispatch): explict DispatchResult ctor fallout.
 
 2003-10-29  Lars Gullik Bjønnes  <larsbj@gullik.net>
index 70fac8e236e4dea6810bc0df9318f73f2f219c1b..a2657c8f56f15371392830edb600ed882a67ec07 100644 (file)
@@ -62,7 +62,7 @@ CommandInset::priv_dispatch(FuncRequest const & cmd,
                default:
                        return MathNestInset::priv_dispatch(cmd, idx, pos);
        }
-       return DispatchResult(UNDISPATCHED);
+       return DispatchResult(false);
 }
 
 
index 854db1714ce19d21ff378968fb71cbed2cb53f93..6dc422cd8c18b8bc845e28706c5b1913e387687e 100644 (file)
@@ -215,7 +215,7 @@ void InsetFormulaBase::toggleInsetSelection(BufferView * bv)
 DispatchResult InsetFormulaBase::lfunMouseRelease(FuncRequest const & cmd)
 {
        if (!mathcursor)
-               return DispatchResult(UNDISPATCHED);
+               return DispatchResult(false);
 
        BufferView * bv = cmd.view();
        bv->updateInset(this);
@@ -223,12 +223,12 @@ DispatchResult InsetFormulaBase::lfunMouseRelease(FuncRequest const & cmd)
 
        if (cmd.button() == mouse_button::button3) {
                // try to dispatch to enclosed insets first
-               if (mathcursor->dispatch(cmd) == DispatchResult(UNDISPATCHED)) {
+               if (!mathcursor->dispatch(cmd).dispatched()) {
                        // launch math panel for right mouse button
                        lyxerr << "lfunMouseRelease: undispatched: " << cmd.button() << endl;
                        bv->owner()->getDialogs().show("mathpanel");
                }
-               return DispatchResult(DISPATCHED);
+               return DispatchResult(true);
        }
 
        if (cmd.button() == mouse_button::button2) {
@@ -238,7 +238,7 @@ DispatchResult InsetFormulaBase::lfunMouseRelease(FuncRequest const & cmd)
                mathcursor->setPos(cmd.x + xo_, cmd.y + yo_);
                mathcursor->insert(ar);
                bv->updateInset(this);
-               return DispatchResult(DISPATCHED);
+               return DispatchResult(true);
        }
 
        if (cmd.button() == mouse_button::button1) {
@@ -250,10 +250,10 @@ DispatchResult InsetFormulaBase::lfunMouseRelease(FuncRequest const & cmd)
                //mathcursor = new MathCursor(this, x == 0);
                //metrics(bv);
                //mathcursor->setPos(x + xo_, y + yo_);
-               return DispatchResult(DISPATCHED);
+               return DispatchResult(true);
        }
 
-       return DispatchResult(UNDISPATCHED);
+       return DispatchResult(false);
 }
 
 
@@ -272,7 +272,7 @@ DispatchResult InsetFormulaBase::lfunMousePress(FuncRequest const & cmd)
 
        if (cmd.button() == mouse_button::button3) {
                mathcursor->dispatch(cmd);
-               return DispatchResult(DISPATCHED);
+               return DispatchResult(true);
        }
 
        if (cmd.button() == mouse_button::button1) {
@@ -281,28 +281,28 @@ DispatchResult InsetFormulaBase::lfunMousePress(FuncRequest const & cmd)
                mathcursor->selClear();
                mathcursor->setPos(cmd.x + xo_, cmd.y + yo_);
                mathcursor->dispatch(cmd);
-               return DispatchResult(DISPATCHED);
+               return DispatchResult(true);
        }
 
        bv->updateInset(this);
-       return DispatchResult(DISPATCHED);
+       return DispatchResult(true);
 }
 
 
 DispatchResult InsetFormulaBase::lfunMouseMotion(FuncRequest const & cmd)
 {
        if (!mathcursor)
-               return DispatchResult(DISPATCHED);
+               return DispatchResult(true);
 
-       if (mathcursor->dispatch(FuncRequest(cmd)) != DispatchResult(UNDISPATCHED))
-               return DispatchResult(DISPATCHED);
+       if (mathcursor->dispatch(FuncRequest(cmd)).dispatched())
+               return DispatchResult(true);
 
        // only select with button 1
        if (cmd.button() != mouse_button::button1)
-               return DispatchResult(DISPATCHED);
+               return DispatchResult(true);
 
        if (abs(cmd.x - first_x) < 2 && abs(cmd.y - first_y) < 2)
-               return DispatchResult(DISPATCHED);
+               return DispatchResult(true);
 
        first_x = cmd.x;
        first_y = cmd.y;
@@ -313,7 +313,7 @@ DispatchResult InsetFormulaBase::lfunMouseMotion(FuncRequest const & cmd)
        BufferView * bv = cmd.view();
        mathcursor->setPos(cmd.x + xo_, cmd.y + yo_);
        bv->updateInset(this);
-       return DispatchResult(DISPATCHED);
+       return DispatchResult(true);
 }
 
 
@@ -349,7 +349,7 @@ InsetFormulaBase::priv_dispatch(FuncRequest const & cmd,
                        // if that is removed, we won't get the magenta box when entering an
                        // inset for the first time
                        bv->updateInset(this);
-                       return DispatchResult(DISPATCHED);
+                       return DispatchResult(true);
 
                case LFUN_MOUSE_PRESS:
                        //lyxerr << "Mouse single press" << endl;
@@ -368,10 +368,10 @@ InsetFormulaBase::priv_dispatch(FuncRequest const & cmd,
        }
 
        if (!mathcursor)
-               return DispatchResult(UNDISPATCHED);
+               return DispatchResult(false);
 
        string argument    = cmd.argument;
-       DispatchResult result      = DispatchResult(DISPATCHED);
+       DispatchResult result(true);
        bool sel           = false;
        bool was_macro     = mathcursor->inMacroMode();
        bool was_selection = mathcursor->selection();
@@ -400,7 +400,7 @@ InsetFormulaBase::priv_dispatch(FuncRequest const & cmd,
        case LFUN_RIGHTSEL:
                sel = true; // fall through...
        case LFUN_RIGHT:
-               result = mathcursor->right(sel) ? DispatchResult(DISPATCHED) : DispatchResult(FINISHED_RIGHT);
+               result = mathcursor->right(sel) ? DispatchResult(true) : DispatchResult(false, FINISHED_RIGHT);
                //lyxerr << "calling scroll 20" << endl;
                //scroll(bv, 20);
                // write something to the minibuffer
@@ -410,19 +410,19 @@ InsetFormulaBase::priv_dispatch(FuncRequest const & cmd,
        case LFUN_LEFTSEL:
                sel = true; // fall through
        case LFUN_LEFT:
-               result = mathcursor->left(sel) ? DispatchResult(DISPATCHED) : DispatchResult(FINISHED);
+               result = mathcursor->left(sel) ? DispatchResult(true) : DispatchResult(true, FINISHED);
                break;
 
        case LFUN_UPSEL:
                sel = true; // fall through
        case LFUN_UP:
-               result = mathcursor->up(sel) ? DispatchResult(DISPATCHED) : DispatchResult(FINISHED_UP);
+               result = mathcursor->up(sel) ? DispatchResult(true) : DispatchResult(false, FINISHED_UP);
                break;
 
        case LFUN_DOWNSEL:
                sel = true; // fall through
        case LFUN_DOWN:
-               result = mathcursor->down(sel) ? DispatchResult(DISPATCHED) : DispatchResult(FINISHED_DOWN);
+               result = mathcursor->down(sel) ? DispatchResult(true) : DispatchResult(false, FINISHED_DOWN);
                break;
 
        case LFUN_WORDSEL:
@@ -434,7 +434,7 @@ InsetFormulaBase::priv_dispatch(FuncRequest const & cmd,
        case LFUN_UP_PARAGRAPH:
        case LFUN_DOWN_PARAGRAPHSEL:
        case LFUN_DOWN_PARAGRAPH:
-               result = DispatchResult(FINISHED);
+               result = DispatchResult(true, FINISHED);
                break;
 
        case LFUN_HOMESEL:
@@ -442,7 +442,7 @@ InsetFormulaBase::priv_dispatch(FuncRequest const & cmd,
                sel = true; // fall through
        case LFUN_HOME:
        case LFUN_WORDLEFT:
-               result = mathcursor->home(sel) ? DispatchResult(DISPATCHED) : DispatchResult(FINISHED);
+               result = mathcursor->home(sel) ? DispatchResult(true) : DispatchResult(true, FINISHED);
                break;
 
        case LFUN_ENDSEL:
@@ -450,21 +450,21 @@ InsetFormulaBase::priv_dispatch(FuncRequest const & cmd,
                sel = true; // fall through
        case LFUN_END:
        case LFUN_WORDRIGHT:
-               result = mathcursor->end(sel) ? DispatchResult(DISPATCHED) : DispatchResult(FINISHED_RIGHT);
+               result = mathcursor->end(sel) ? DispatchResult(true) : DispatchResult(false, FINISHED_RIGHT);
                break;
 
        case LFUN_PRIORSEL:
        case LFUN_PRIOR:
        case LFUN_BEGINNINGBUFSEL:
        case LFUN_BEGINNINGBUF:
-               result = DispatchResult(FINISHED);
+               result = DispatchResult(true, FINISHED);
                break;
 
        case LFUN_NEXTSEL:
        case LFUN_NEXT:
        case LFUN_ENDBUFSEL:
        case LFUN_ENDBUF:
-               result = DispatchResult(FINISHED_RIGHT);
+               result = DispatchResult(false, FINISHED_RIGHT);
                break;
 
        case LFUN_CELL_FORWARD:
@@ -479,7 +479,7 @@ InsetFormulaBase::priv_dispatch(FuncRequest const & cmd,
        case LFUN_BACKSPACE:
                recordUndo(bv, Undo::ATOMIC);
                if (!mathcursor->backspace()) {
-                       result = DispatchResult(FINISHED);
+                       result = DispatchResult(true, FINISHED);
                        remove_inset = true;
                }
                break;
@@ -488,7 +488,7 @@ InsetFormulaBase::priv_dispatch(FuncRequest const & cmd,
        case LFUN_DELETE:
                recordUndo(bv, Undo::ATOMIC);
                if (!mathcursor->erase()) {
-                       result = DispatchResult(FINISHED);
+                       result = DispatchResult(true, FINISHED);
                        remove_inset = true;
                }
                break;
@@ -641,7 +641,7 @@ InsetFormulaBase::priv_dispatch(FuncRequest const & cmd,
 
 
        case LFUN_EXEC_COMMAND:
-               result = DispatchResult(UNDISPATCHED);
+               result = DispatchResult(false);
                break;
 
        case LFUN_INSET_ERT:
@@ -669,7 +669,7 @@ InsetFormulaBase::priv_dispatch(FuncRequest const & cmd,
                if (!argument.empty()) {
                        recordUndo(bv, Undo::ATOMIC);
                        if (argument.size() == 1)
-                               result = mathcursor->interpret(argument[0]) ? DispatchResult(DISPATCHED) : DispatchResult(FINISHED_RIGHT);
+                               result = mathcursor->interpret(argument[0]) ? DispatchResult(true) : DispatchResult(false, FINISHED_RIGHT);
                        else
                                mathcursor->insert(argument);
                }
@@ -679,7 +679,7 @@ InsetFormulaBase::priv_dispatch(FuncRequest const & cmd,
                if (mathcursor->selection())
                        mathcursor->selClear();
                else
-                       result = DispatchResult(UNDISPATCHED);
+                       result = DispatchResult(false);
                break;
 
        case LFUN_INSET_TOGGLE:
@@ -687,7 +687,7 @@ InsetFormulaBase::priv_dispatch(FuncRequest const & cmd,
                break;
 
        case LFUN_DIALOG_SHOW:
-               result = DispatchResult(UNDISPATCHED);
+               result = DispatchResult(false);
                break;
 
        case LFUN_DIALOG_SHOW_NEW_INSET: {
@@ -699,7 +699,7 @@ InsetFormulaBase::priv_dispatch(FuncRequest const & cmd,
                }
 
                if (data.empty())
-                       result = DispatchResult(UNDISPATCHED);
+                       result = DispatchResult(false);
                else {
                        bv->owner()->getDialogs().show(name, data, 0);
                }
@@ -718,19 +718,19 @@ InsetFormulaBase::priv_dispatch(FuncRequest const & cmd,
                        MathArray ar;
                        if (createMathInset_fromDialogStr(cmd.argument, ar)) {
                                mathcursor->insert(ar);
-                               result = DispatchResult(DISPATCHED);
+                               result = DispatchResult(true);
                        } else {
-                               result = DispatchResult(UNDISPATCHED);
+                               result = DispatchResult(false);
                        }
                }
        }
        break;
 
        default:
-               result = DispatchResult(UNDISPATCHED);
+               result = DispatchResult(false);
        }
 
-       if (result == DispatchResult(DISPATCHED))
+       if (result == DispatchResult(true))
                bv->updateInset(this);
 
        mathcursor->normalize();
@@ -741,8 +741,7 @@ InsetFormulaBase::priv_dispatch(FuncRequest const & cmd,
        if (mathcursor->selection() || was_selection)
                toggleInsetSelection(bv);
 
-       if (result == DispatchResult(DISPATCHED) || result == DispatchResult(DISPATCHED_NOUPDATE) ||
-           result == DispatchResult(UNDISPATCHED)) {
+       if (result.val() <= NOUPDATE) {
                fitInsetCursor(bv);
                revealCodes(bv);
                cmd.view()->stuffClipboard(mathcursor->grabSelection());
index 1394725642754c75d0c2308231ae0658c18d2d1e..118aefd0b47e98cb967e9fccdb9ecb98c4f2b3fc 100644 (file)
@@ -1417,17 +1417,19 @@ DispatchResult MathCursor::dispatch(FuncRequest const & cmd)
                case LFUN_MOUSE_RELEASE:
                case LFUN_MOUSE_DOUBLE: {
                        CursorPos & pos = Cursor_.back();
-                       DispatchResult res = DispatchResult(UNDISPATCHED);
-                       int x = 0, y = 0;
+                       int x = 0;
+                       int y = 0;
                        getPos(x, y);
                        if (x < cmd.x && hasPrevAtom()) {
-                               res = prevAtom().nucleus()->dispatch(cmd, pos.idx_, pos.pos_);
-                               if (res != DispatchResult(UNDISPATCHED))
+                               DispatchResult const res =
+                                       prevAtom().nucleus()->dispatch(cmd, pos.idx_, pos.pos_);
+                               if (res.dispatched())
                                        return res;
                        }
                        if (x > cmd.x && hasNextAtom()) {
-                               res = nextAtom().nucleus()->dispatch(cmd, pos.idx_, pos.pos_);
-                               if (res != DispatchResult(UNDISPATCHED))
+                               DispatchResult const res =
+                                       nextAtom().nucleus()->dispatch(cmd, pos.idx_, pos.pos_);
+                               if (res.dispatched())
                                        return res;
                        }
                }
@@ -1437,16 +1439,17 @@ DispatchResult MathCursor::dispatch(FuncRequest const & cmd)
 
        for (int i = Cursor_.size() - 1; i >= 0; --i) {
                CursorPos & pos = Cursor_[i];
-               DispatchResult res = pos.inset_->dispatch(cmd, pos.idx_, pos.pos_);
-               if (res != DispatchResult(UNDISPATCHED)) {
-                       if (res == DispatchResult(FINISHED)) {
+               DispatchResult const res =
+                       pos.inset_->dispatch(cmd, pos.idx_, pos.pos_);
+               if (res.dispatched()) {
+                       if (res.val() == FINISHED) {
                                Cursor_.shrink(i + 1);
                                selClear();
                        }
                        return res;
                }
        }
-       return DispatchResult(UNDISPATCHED);
+       return DispatchResult(false);
 }
 
 
index fba7ef020470b615703e2142f53898dbc615d817..a0d8fa6be606d784969e8c5653a691a59f1a9ff2 100644 (file)
@@ -1050,13 +1050,13 @@ DispatchResult MathGridInset::priv_dispatch(FuncRequest const & cmd,
                case LFUN_MOUSE_RELEASE:
                        //if (cmd.button() == mouse_button::button3) {
                        //      GridInsetMailer(*this).showDialog();
-                       //      return DispatchResult(DISPATCHED);
+                       //      return DispatchResult(true);
                        //}
-                       return DispatchResult(UNDISPATCHED);
+                       return DispatchResult(false);
 
                case LFUN_INSET_DIALOG_UPDATE:
                        GridInsetMailer(*this).updateDialog(cmd.view());
-                       return DispatchResult(UNDISPATCHED);
+                       return DispatchResult(false);
 
                // insert file functions
                case LFUN_DELETE_LINE_FORWARD:
@@ -1072,12 +1072,12 @@ DispatchResult MathGridInset::priv_dispatch(FuncRequest const & cmd,
                                idx = nargs() - 1;
                        if (pos > cell(idx).size())
                                pos = cell(idx).size();
-                       return DispatchResult(FINISHED);
+                       return DispatchResult(true, FINISHED);
 
                case LFUN_CELL_SPLIT:
                        //recordUndo(bv, Undo::ATOMIC);
                        splitCell(idx, pos);
-                       return DispatchResult(FINISHED);
+                       return DispatchResult(true, FINISHED);
 
                case LFUN_BREAKLINE: {
                        //recordUndo(bv, Undo::INSERT);
@@ -1096,7 +1096,7 @@ DispatchResult MathGridInset::priv_dispatch(FuncRequest const & cmd,
                        pos = cell(idx).size();
 
                        //mathcursor->normalize();
-                       return DispatchResult(FINISHED);
+                       return DispatchResult(true, FINISHED);
                }
 
                case LFUN_TABULAR_FEATURE: {
@@ -1151,9 +1151,9 @@ DispatchResult MathGridInset::priv_dispatch(FuncRequest const & cmd,
                        else if (s == "swap-column")
                                swapCol(col(idx));
                        else
-                               return DispatchResult(UNDISPATCHED);
-                       lyxerr << "returning DispatchResult(FINISHED)" << endl;
-                       return DispatchResult(FINISHED);
+                               return DispatchResult(false);
+                       lyxerr << "returning DispatchResult(true, FINISHED)" << endl;
+                       return DispatchResult(true, FINISHED);
                }
 
                case LFUN_PASTE: {
@@ -1184,7 +1184,7 @@ DispatchResult MathGridInset::priv_dispatch(FuncRequest const & cmd,
                                        for (col_type c = 0; c < grid.ncols(); ++c)
                                                cell(i).append(grid.cell(grid.index(r, c)));
                        }
-                       return DispatchResult(FINISHED);
+                       return DispatchResult(true, FINISHED);
                }
 
                default:
index 8742d6127d33d57bc205ea13feb326c2cec39498..df370ecffac45bb7af32bab25ea28ec6e672cd66 100644 (file)
@@ -782,7 +782,7 @@ DispatchResult MathHullInset::priv_dispatch
                                mutate("eqnarray");
                                idx = 1;
                                pos = 0;
-                               return DispatchResult(FINISHED);
+                               return DispatchResult(true, FINISHED);
                        }
                        return MathGridInset::priv_dispatch(cmd, idx, pos);
 
@@ -798,7 +798,7 @@ DispatchResult MathHullInset::priv_dispatch
                                                numbered(row, !old);
                                //bv->owner()->message(old ? _("No number") : _("Number"));
                        }
-                       return DispatchResult(DISPATCHED);
+                       return DispatchResult(true);
 
                case LFUN_MATH_NONUMBER:
                        if (display()) {
@@ -808,7 +808,7 @@ DispatchResult MathHullInset::priv_dispatch
                                //bv->owner()->message(old ? _("No number") : _("Number"));
                                numbered(r, !old);
                        }
-                       return DispatchResult(DISPATCHED);
+                       return DispatchResult(true);
 
                case LFUN_INSERT_LABEL: {
                        row_type r = (type_ == "multline") ? nrows() - 1 : row(idx);
@@ -822,7 +822,7 @@ DispatchResult MathHullInset::priv_dispatch
                                        ? Alert::askForText(_("Enter new label to insert:"), default_label)
                                        : Alert::askForText(_("Enter label:"), old_label);
                                if (!res.first)
-                                       return DispatchResult(UNDISPATCHED);
+                                       return DispatchResult(false);
                                new_label = trim(res.second);
                        }
 
@@ -832,12 +832,12 @@ DispatchResult MathHullInset::priv_dispatch
                        if (!new_label.empty())
                                numbered(r, true);
                        label(r, new_label);
-                       return DispatchResult(DISPATCHED);
+                       return DispatchResult(true);
                }
 
                case LFUN_MATH_EXTERN:
                        doExtern(cmd, idx, pos);
-                       return DispatchResult(FINISHED);
+                       return DispatchResult(true, FINISHED);
 
                case LFUN_MATH_MUTATE: {
                        lyxerr << "Hull: MUTATE: " << cmd.argument << endl;
@@ -849,14 +849,14 @@ DispatchResult MathHullInset::priv_dispatch
                                idx = nargs() - 1;
                        if (pos > cell(idx).size())
                                pos = cell(idx).size();
-                       return DispatchResult(FINISHED);
+                       return DispatchResult(true, FINISHED);
                }
 
                case LFUN_MATH_DISPLAY: {
                        mutate(type_ == "simple" ? "equation" : "simple");
                        idx = 0;
                        pos = cell(idx).size();
-                       return DispatchResult(FINISHED);
+                       return DispatchResult(true, FINISHED);
                }
 
                default:
index 4924a04ac1bc1e7e9efadcefedfba6abf648adb7..c561af8e8ffbf706f07089eb419dc3d6ad5a882f 100644 (file)
@@ -299,7 +299,7 @@ MathNestInset::priv_dispatch(FuncRequest const & cmd,
                        mathed_parse_cell(ar, cmd.argument);
                        cell(idx).insert(pos, ar);
                        pos += ar.size();
-                       return DispatchResult(DISPATCHED);
+                       return DispatchResult(true);
                }
 
                case LFUN_PASTESELECTION:
@@ -310,7 +310,7 @@ MathNestInset::priv_dispatch(FuncRequest const & cmd,
                case LFUN_MOUSE_PRESS:
                        if (cmd.button() == mouse_button::button2)
                                return priv_dispatch(FuncRequest(bv, LFUN_PASTESELECTION), idx, pos);
-                       return DispatchResult(UNDISPATCHED);
+                       return DispatchResult(false);
 
                default:
                        return MathInset::priv_dispatch(cmd, idx, pos);
index 3a634c50d72232d31aa1118e8c75abeba07fec1a..e60c2dd635c7ea184c04d108315748967f67ac41 100644 (file)
@@ -528,7 +528,7 @@ MathScriptInset::priv_dispatch(FuncRequest const & cmd,
                        limits_ =  (hasLimits()) ? -1 : 1;
                else
                        limits_ = 0;
-               return DispatchResult(DISPATCHED);
+               return DispatchResult(true);
        }
 
        return MathNestInset::priv_dispatch(cmd, idx, pos);
index aec962e78f82d3da9e29f4168c7e414a75c6713c..89319115a72c6b06e4d069683ff3bca854ca91af 100644 (file)
@@ -62,18 +62,18 @@ RefInset::priv_dispatch(FuncRequest const & cmd,
                if (cmd.getArg(0) == "ref") {
                        MathArray ar;
                        if (!createMathInset_fromDialogStr(cmd.argument, ar))
-                               return DispatchResult(UNDISPATCHED);
+                               return DispatchResult(false);
 
                        *this = *ar[0].nucleus()->asRefInset();
 
-                       return DispatchResult(DISPATCHED);
+                       return DispatchResult(true);
                }
                break;
        case LFUN_MOUSE_RELEASE:
                if (cmd.button() == mouse_button::button3) {
                        lyxerr << "trying to goto ref" << cell(0) << endl;
                        cmd.view()->dispatch(FuncRequest(LFUN_REF_GOTO, asString(cell(0))));
-                       return DispatchResult(DISPATCHED);
+                       return DispatchResult(true);
                }
                if (cmd.button() == mouse_button::button1) {
                        // Eventually trigger dialog with button 3
@@ -81,18 +81,18 @@ RefInset::priv_dispatch(FuncRequest const & cmd,
                        string const data = createDialogStr("ref");
                        cmd.view()->owner()->getDialogs().
                                show("ref", data, this);
-                       return DispatchResult(DISPATCHED);
+                       return DispatchResult(true);
                }
                break;
        case LFUN_MOUSE_PRESS:
        case LFUN_MOUSE_MOTION:
                // eat other mouse commands
-               return DispatchResult(DISPATCHED);
+               return DispatchResult(true);
        default:
                return CommandInset::priv_dispatch(cmd, idx, pos);
        }
        // not our business
-       return DispatchResult(UNDISPATCHED);
+       return DispatchResult(false);
 }
 
 
index 1f65d67e0776efb4fc75965d907a5105e1a861fb..3585c9c5eaec991156305079093db373e99f5abf 100644 (file)
@@ -982,14 +982,14 @@ DispatchResult LyXText::dispatch(FuncRequest const & cmd)
 
        case LFUN_BEGINNINGBUFSEL:
                if (inset_owner)
-                       return DispatchResult(UNDISPATCHED);
+                       return DispatchResult(false);
                cursorTop();
                finishChange(bv, true);
                break;
 
        case LFUN_ENDBUFSEL:
                if (inset_owner)
-                       return DispatchResult(UNDISPATCHED);
+                       return DispatchResult(false);
                cursorBottom();
                finishChange(bv, true);
                break;
@@ -1534,8 +1534,8 @@ DispatchResult LyXText::dispatch(FuncRequest const & cmd)
                break;
 
        default:
-               return DispatchResult(UNDISPATCHED);
+               return DispatchResult(false);
        }
 
-       return DispatchResult(DISPATCHED);
+       return DispatchResult(true);
 }