]> git.lyx.org Git - features.git/commitdiff
the FuncRequest changes
authorAndré Pönitz <poenitz@gmx.net>
Wed, 7 Aug 2002 08:11:41 +0000 (08:11 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Wed, 7 Aug 2002 08:11:41 +0000 (08:11 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4887 a592a061-630c-0410-9148-cb99ea01b6c8

47 files changed:
src/BufferView.C
src/BufferView.h
src/BufferView_pimpl.C
src/BufferView_pimpl.h
src/ChangeLog
src/LaTeX.C
src/LyXAction.C
src/LyXAction.h
src/WordLangTuple.h
src/frontends/Liason.h
src/frontends/LyXView.h
src/frontends/controllers/ControlCommand.C
src/frontends/controllers/ControlForks.C
src/frontends/controllers/ControlInclude.C
src/frontends/controllers/ControlRef.C
src/frontends/controllers/ControlTabularCreate.C
src/frontends/qt2/FileDialog_private.C
src/frontends/qt2/Toolbar_pimpl.C
src/frontends/xforms/FormMathsDelim.C
src/frontends/xforms/FormMathsMatrix.C
src/frontends/xforms/FormMathsPanel.C
src/frontends/xforms/FormPreferences.C
src/frontends/xforms/Toolbar_pimpl.C
src/funcrequest.h [new file with mode: 0644]
src/insets/ChangeLog
src/insets/inset.C
src/insets/inset.h
src/insets/insetcollapsable.C
src/insets/insetcollapsable.h
src/insets/insetert.C
src/insets/insetert.h
src/insets/insetparent.C
src/insets/insetref.C
src/insets/insettabular.C
src/insets/insettabular.h
src/insets/insettext.C
src/insets/insettext.h
src/lyxfunc.C
src/lyxfunc.h
src/lyxrc.C
src/mathed/formula.C
src/mathed/formula.h
src/mathed/formulabase.C
src/mathed/formulabase.h
src/mathed/math_support.C
src/mathed/ref_inset.C
src/toc.C

index 0040c41738fb561fb959640c46f01e7a227019d5..475720d1f20f77c7ea39b20dea2d9bfa33ae8a5c 100644 (file)
@@ -237,7 +237,7 @@ BufferView::UpdateCodes operator|(BufferView::UpdateCodes uc1,
 }
 
 
-bool BufferView::dispatch(kb_action action, string const & argument)
+bool BufferView::dispatch(FuncRequest const & ev)
 {
-       return pimpl_->dispatch(action, argument);
+       return pimpl_->dispatch(ev);
 }
index fb7b2983419e3521b04476c3d072b49ba8ca5fd4..5f1f8fc25e3cdc42558a0d50c7dc01d33fe17a76 100644 (file)
@@ -16,7 +16,6 @@
 
 #include "LString.h"
 #include "undo.h"
-#include "commandtags.h"
 
 #include "insets/inset.h"
 #include "WordLangTuple.h"
@@ -203,7 +202,7 @@ public:
        ///
        void stuffClipboard(string const &) const;
        ///
-       bool dispatch(kb_action action, string const & argument);
+       bool dispatch(FuncRequest const & argument);
 private:
        ///
        struct Pimpl;
index 78d5dca18ebe13506e576cf61feeaa74b5bda4ec..215a0dcaa9b20db8cefdc9fb834eeba4b8a7bf93 100644 (file)
@@ -39,6 +39,7 @@
 #include "gettext.h"
 #include "ParagraphParameters.h"
 #include "undo_funcs.h"
+#include "funcrequest.h"
 
 #include "insets/insetbib.h"
 #include "insets/insettext.h"
@@ -617,8 +618,7 @@ void BufferView::Pimpl::workAreaButtonPress(int xpos, int ypos,
                if (paste_internally)
                        owner_->getLyXFunc()->dispatch(LFUN_PASTE);
                else
-                       owner_->getLyXFunc()->dispatch(LFUN_PASTESELECTION,
-                                                      string("paragraph"));
+                       owner_->getLyXFunc()->dispatch(FuncRequest(LFUN_PASTESELECTION, "paragraph"));
                selection_possible = false;
                return;
        }
@@ -734,7 +734,7 @@ void BufferView::Pimpl::workAreaButtonRelease(int x, int y,
                // We are in inset locking mode.
 
                /* LyX does a kind of work-area grabbing for insets.
-                  Only a ButtonPress Event outside the inset will
+                  Only a ButtonPress FuncRequest outside the inset will
                   force a insetUnlock. */
                bv_->theLockingInset()->
                        insetButtonRelease(bv_, x, y, button);
@@ -1485,14 +1485,14 @@ void BufferView::Pimpl::MenuInsertLyXFile(string const & filen)
 }
 
 
-bool BufferView::Pimpl::dispatch(kb_action action, string const & argument)
+bool BufferView::Pimpl::dispatch(FuncRequest const & ev)
 {
        lyxerr[Debug::ACTION] << "BufferView::Pimpl::Dispatch: action["
-                             << action <<"] arg[" << argument << "]" << endl;
+         << ev.action <<"] arg[" << ev.argument << "]" << endl;
 
        LyXTextClass const & tclass = buffer_->params.getLyXTextClass();
 
-       switch (action) {
+       switch (ev.action) {
                // --- Misc -------------------------------------------
        case LFUN_APPENDIX:
        {
@@ -1542,13 +1542,8 @@ bool BufferView::Pimpl::dispatch(kb_action action, string const & argument)
                break;
 
        case LFUN_PASTESELECTION:
-       {
-               bool asPara = false;
-               if (argument == "paragraph")
-                       asPara = true;
-               pasteClipboard(asPara);
-       }
-       break;
+               pasteClipboard(ev.argument == "paragraph");
+               break;
 
        case LFUN_CUT:
                bv_->cut();
@@ -1621,28 +1616,28 @@ bool BufferView::Pimpl::dispatch(kb_action action, string const & argument)
                break;
 
        case LFUN_FILE_INSERT:
-               MenuInsertLyXFile(argument);
+               MenuInsertLyXFile(ev.argument);
                break;
 
        case LFUN_FILE_INSERT_ASCII_PARA:
-               InsertAsciiFile(bv_, argument, true);
+               InsertAsciiFile(bv_, ev.argument, true);
                break;
 
        case LFUN_FILE_INSERT_ASCII:
-               InsertAsciiFile(bv_, argument, false);
+               InsertAsciiFile(bv_, ev.argument, false);
                break;
 
        case LFUN_LAYOUT:
        {
                lyxerr[Debug::INFO] << "LFUN_LAYOUT: (arg) "
-                                   << argument << endl;
+                                   << ev.argument << endl;
 
                // This is not the good solution to the empty argument
                // problem, but it will hopefully suffice for 1.2.0.
                // The correct solution would be to augument the
                // function list/array with information about what
                // functions needs arguments and their type.
-               if (argument.empty()) {
+               if (ev.argument.empty()) {
                        owner_->getLyXFunc()->setErrorMessage(
                                _("LyX function 'layout' needs an argument."));
                        break;
@@ -1650,8 +1645,8 @@ bool BufferView::Pimpl::dispatch(kb_action action, string const & argument)
 
                // Derive layout number from given argument (string)
                // and current buffer's textclass (number). */
-               bool hasLayout = tclass.hasLayout(argument);
-               string layout = argument;
+               bool hasLayout = tclass.hasLayout(ev.argument);
+               string layout = ev.argument;
 
                // If the entry is obsolete, use the new one instead.
                if (hasLayout) {
@@ -1662,7 +1657,7 @@ bool BufferView::Pimpl::dispatch(kb_action action, string const & argument)
 
                if (!hasLayout) {
                        owner_->getLyXFunc()->setErrorMessage(
-                               string(N_("Layout ")) + argument +
+                               string(N_("Layout ")) + ev.argument +
                                N_(" not known"));
                        break;
                }
@@ -1699,7 +1694,7 @@ bool BufferView::Pimpl::dispatch(kb_action action, string const & argument)
        break;
 
        case LFUN_LANGUAGE:
-               lang(bv_, argument);
+               lang(bv_, ev.argument);
                switchKeyMap();
                owner_->view_state_changed();
                break;
@@ -1745,7 +1740,7 @@ bool BufferView::Pimpl::dispatch(kb_action action, string const & argument)
                break;
 
        case LFUN_FONT_SIZE:
-               fontSize(bv_, argument);
+               fontSize(bv_, ev.argument);
                owner_->view_state_changed();
                break;
 
@@ -1817,16 +1812,16 @@ bool BufferView::Pimpl::dispatch(kb_action action, string const & argument)
 
 
        case LFUN_INSERT_LABEL:
-               MenuInsertLabel(bv_, argument);
+               MenuInsertLabel(bv_, ev.argument);
                break;
 
        case LFUN_REF_INSERT:
-               if (argument.empty()) {
+               if (ev.argument.empty()) {
                        InsetCommandParams p("ref");
                        owner_->getDialogs()->createRef(p.getAsString());
                } else {
                        InsetCommandParams p;
-                       p.setFromString(argument);
+                       p.setFromString(ev.argument);
 
                        InsetRef * inset = new InsetRef(p, *buffer_);
                        if (!insertInset(inset))
@@ -1837,16 +1832,16 @@ bool BufferView::Pimpl::dispatch(kb_action action, string const & argument)
                break;
 
        case LFUN_BOOKMARK_SAVE:
-               savePosition(strToUnsignedInt(argument));
+               savePosition(strToUnsignedInt(ev.argument));
                break;
 
        case LFUN_BOOKMARK_GOTO:
-               restorePosition(strToUnsignedInt(argument));
+               restorePosition(strToUnsignedInt(ev.argument));
                break;
 
        case LFUN_REF_GOTO:
        {
-               string label(argument);
+               string label = ev.argument;
                if (label.empty()) {
                        InsetRef * inset =
                                static_cast<InsetRef*>(getInsetByCode(Inset::REF_CODE));
@@ -2657,7 +2652,7 @@ bool BufferView::Pimpl::dispatch(kb_action action, string const & argument)
                        cur_value = par->params().spacing().getValue();
                }
 
-               istringstream istr(argument.c_str());
+               istringstream istr(ev.argument.c_str());
 
                string tmp;
                istr >> tmp;
@@ -2683,7 +2678,7 @@ bool BufferView::Pimpl::dispatch(kb_action action, string const & argument)
                        new_spacing = Spacing::Default;
                } else {
                        lyxerr << _("Unknown spacing argument: ")
-                              << argument << endl;
+                              << ev.argument << endl;
                }
                if (cur_spacing != new_spacing || cur_value != new_value) {
                        par->params().spacing(Spacing(new_spacing, new_value));
@@ -2716,7 +2711,7 @@ bool BufferView::Pimpl::dispatch(kb_action action, string const & argument)
        case LFUN_URL:
        {
                InsetCommandParams p;
-               if (action == LFUN_HTMLURL)
+               if (ev.action == LFUN_HTMLURL)
                        p.setCmdName("htmlurl");
                else
                        p.setCmdName("url");
@@ -2727,7 +2722,7 @@ bool BufferView::Pimpl::dispatch(kb_action action, string const & argument)
        case LFUN_INSERT_URL:
        {
                InsetCommandParams p;
-               p.setFromString(argument);
+               p.setFromString(ev.argument);
 
                InsetUrl * inset = new InsetUrl(p);
                if (!insertInset(inset))
@@ -2763,25 +2758,25 @@ bool BufferView::Pimpl::dispatch(kb_action action, string const & argument)
 
        case LFUN_INSET_FLOAT:
                // check if the float type exist
-               if (floatList.typeExist(argument)) {
+               if (floatList.typeExist(ev.argument)) {
                        insertAndEditInset(new InsetFloat(buffer_->params,
-                                                         argument));
+                                                         ev.argument));
                } else {
                        lyxerr << "Non-existent float type: "
-                              << argument << endl;
+                              << ev.argument << endl;
                }
                break;
 
        case LFUN_INSET_WIDE_FLOAT:
                // check if the float type exist
-               if (floatList.typeExist(argument)) {
+               if (floatList.typeExist(ev.argument)) {
                        InsetFloat * new_inset =
-                               new InsetFloat(buffer_->params, argument);
+                               new InsetFloat(buffer_->params, ev.argument);
                        new_inset->wide(true);
                        insertAndEditInset(new_inset);
                } else {
                        lyxerr << "Non-existent float type: "
-                              << argument << endl;
+                              << ev.argument << endl;
                }
                break;
 
@@ -2817,14 +2812,14 @@ bool BufferView::Pimpl::dispatch(kb_action action, string const & argument)
 
        case LFUN_TABULAR_INSERT:
        {
-               if (argument.empty()) {
+               if (ev.argument.empty()) {
                        owner_->getDialogs()->showTabularCreate();
                        break;
                }
  
                int r = 2;
                int c = 2;
-               ::sscanf(argument.c_str(),"%d%d", &r, &c);
+               ::sscanf(ev.argument.c_str(),"%d%d", &r, &c);
                InsetTabular * new_inset =
                        new InsetTabular(*buffer_, r, c);
                bool const rtl =
@@ -2857,9 +2852,9 @@ bool BufferView::Pimpl::dispatch(kb_action action, string const & argument)
        {
                int x = 0;
                int y = 0;
-               if (::sscanf(argument.c_str(), " %d %d", &x, &y) != 2) {
+               if (::sscanf(ev.argument.c_str(), " %d %d", &x, &y) != 2) {
                        lyxerr << "SETXY: Could not parse coordinates in '"
-                              << argument << std::endl;
+                              << ev.argument << std::endl;
                }
                bv_->getLyXText()->setCursorFromCoordinates(bv_, x, y);
        }
@@ -2901,13 +2896,13 @@ bool BufferView::Pimpl::dispatch(kb_action action, string const & argument)
        case LFUN_HUNG_UMLAUT:
        case LFUN_CIRCLE:
        case LFUN_OGONEK:
-               if (argument.empty()) {
+               if (ev.argument.empty()) {
                        // As always...
-                       owner_->getLyXFunc()->handleKeyFunc(action);
+                       owner_->getLyXFunc()->handleKeyFunc(ev.action);
                } else {
-                       owner_->getLyXFunc()->handleKeyFunc(action);
+                       owner_->getLyXFunc()->handleKeyFunc(ev.action);
                        owner_->getIntl()->getTransManager()
-                               .TranslateAndInsert(argument[0], bv_->getLyXText());
+                               .TranslateAndInsert(ev.argument[0], bv_->getLyXText());
                        update(bv_->getLyXText(),
                               BufferView::SELECT
                               | BufferView::FITCUR
@@ -2916,45 +2911,45 @@ bool BufferView::Pimpl::dispatch(kb_action action, string const & argument)
                break;
 
        case LFUN_MATH:
-               mathDispatch(bv_, argument);
+               mathDispatch(bv_, ev.argument);
                break;
 
        case LFUN_MATH_MACRO:
-               mathDispatchMathMacro(bv_, argument);
+               mathDispatchMathMacro(bv_, ev.argument);
                break;
 
        case LFUN_MATH_DELIM:
-               mathDispatchMathDelim(bv_, argument);
+               mathDispatchMathDelim(bv_, ev.argument);
                break;
 
        case LFUN_INSERT_MATRIX:
-               mathDispatchInsertMatrix(bv_, argument);
+               mathDispatchInsertMatrix(bv_, ev.argument);
                break;
 
        case LFUN_INSERT_MATH:
-               mathDispatchInsertMath(bv_, argument);
+               mathDispatchInsertMath(bv_, ev.argument);
                break;
 
        case LFUN_MATH_IMPORT_SELECTION: // Imports LaTeX from the X selection
-               mathDispatchMathImportSelection(bv_, argument);
+               mathDispatchMathImportSelection(bv_, ev.argument);
                break;
 
        case LFUN_MATH_DISPLAY:          // Open or create a displayed math inset
-               mathDispatchMathDisplay(bv_, argument);
+               mathDispatchMathDisplay(bv_, ev.argument);
                break;
 
        case LFUN_MATH_MODE:             // Open or create an inlined math inset
-               mathDispatchMathMode(bv_, argument);
+               mathDispatchMathMode(bv_, ev.argument);
                break;
 
        case LFUN_GREEK:                 // Insert a single greek letter
-               mathDispatchGreek(bv_, argument);
+               mathDispatchGreek(bv_, ev.argument);
                break;
 
        case LFUN_CITATION_INSERT:
        {
                InsetCommandParams p;
-               p.setFromString(argument);
+               p.setFromString(ev.argument);
 
                InsetCitation * inset = new InsetCitation(p);
                if (!insertInset(inset))
@@ -2969,14 +2964,14 @@ bool BufferView::Pimpl::dispatch(kb_action action, string const & argument)
                // ale970405+lasgoutt970425
                // The argument can be up to two tokens separated
                // by a space. The first one is the bibstyle.
-               string const db       = token(argument, ' ', 0);
-               string const bibstyle = token(argument, ' ', 1);
+               string const db       = token(ev.argument, ' ', 0);
+               string const bibstyle = token(ev.argument, ' ', 1);
 
                InsetCommandParams p("BibTeX", db, bibstyle);
                InsetBibtex * inset = new InsetBibtex(p);
 
                if (insertInset(inset)) {
-                       if (argument.empty())
+                       if (ev.argument.empty())
                                inset->edit(bv_);
                } else
                        delete inset;
@@ -2989,7 +2984,7 @@ bool BufferView::Pimpl::dispatch(kb_action action, string const & argument)
                InsetBibtex * inset =
                        static_cast<InsetBibtex*>(getInsetByCode(Inset::BIBTEX_CODE));
                if (inset) {
-                       inset->addDatabase(argument);
+                       inset->addDatabase(ev.argument);
                }
        }
        break;
@@ -2999,7 +2994,7 @@ bool BufferView::Pimpl::dispatch(kb_action action, string const & argument)
                InsetBibtex * inset =
                        static_cast<InsetBibtex*>(getInsetByCode(Inset::BIBTEX_CODE));
                if (inset) {
-                       inset->delDatabase(argument);
+                       inset->delDatabase(ev.argument);
                }
        }
        break;
@@ -3009,14 +3004,14 @@ bool BufferView::Pimpl::dispatch(kb_action action, string const & argument)
                InsetBibtex * inset =
                        static_cast<InsetBibtex*>(getInsetByCode(Inset::BIBTEX_CODE));
                if (inset) {
-                       inset->setOptions(argument);
+                       inset->setOptions(ev.argument);
                }
        }
        break;
 
        case LFUN_INDEX_INSERT:
        {
-               string entry = argument;
+               string entry = ev.argument;
                if (entry.empty()) {
                        entry = bv_->getLyXText()->getStringToIndex(bv_);
                }
@@ -3047,7 +3042,7 @@ bool BufferView::Pimpl::dispatch(kb_action action, string const & argument)
 
        case LFUN_PARENTINSERT:
        {
-               InsetCommandParams p("lyxparent", argument);
+               InsetCommandParams p("lyxparent", ev.argument);
                Inset * inset = new InsetParent(p, *buffer_);
                if (!insertInset(inset, tclass.defaultLayoutName()))
                        delete inset;
@@ -3058,7 +3053,7 @@ bool BufferView::Pimpl::dispatch(kb_action action, string const & argument)
        case LFUN_CHILD_INSERT:
        {
                InsetInclude::Params p;
-               p.cparams.setFromString(argument);
+               p.cparams.setFromString(ev.argument);
                p.masterFilename_ = buffer_->fileName();
 
                InsetInclude * inset = new InsetInclude(p);
@@ -3072,19 +3067,19 @@ bool BufferView::Pimpl::dispatch(kb_action action, string const & argument)
        break;
 
        case LFUN_FLOAT_LIST:
-               if (floatList.typeExist(argument)) {
-                       Inset * inset = new InsetFloatList(argument);
+               if (floatList.typeExist(ev.argument)) {
+                       Inset * inset = new InsetFloatList(ev.argument);
                        if (!insertInset(inset, tclass.defaultLayoutName()))
                                delete inset;
                } else {
                        lyxerr << "Non-existent float type: "
-                              << argument << endl;
+                              << ev.argument << endl;
                }
                break;
 
        case LFUN_THESAURUS_ENTRY:
        {
-               string arg = argument;
+               string arg = ev.argument;
 
                if (arg.empty()) {
                        arg = bv_->getLyXText()->selectionAsString(buffer_,
@@ -3105,7 +3100,7 @@ bool BufferView::Pimpl::dispatch(kb_action action, string const & argument)
 
        case LFUN_SELFINSERT:
        {
-               if (argument.empty()) break;
+               if (ev.argument.empty()) break;
 
                /* Automatically delete the currently selected
                 * text and replace it with what is being
@@ -3129,8 +3124,8 @@ bool BufferView::Pimpl::dispatch(kb_action action, string const & argument)
                beforeChange(lt);
                LyXFont const old_font(lt->real_current_font);
 
-               string::const_iterator cit = argument.begin();
-               string::const_iterator end = argument.end();
+               string::const_iterator cit = ev.argument.begin();
+               string::const_iterator end = ev.argument.end();
                for (; cit != end; ++cit) {
                        owner_->getIntl()->getTransManager().
                                TranslateAndInsert(*cit, lt);
@@ -3158,8 +3153,8 @@ bool BufferView::Pimpl::dispatch(kb_action action, string const & argument)
                struct tm * now_tm = localtime(&now_time_t);
                setlocale(LC_TIME, "");
                string arg;
-               if (!argument.empty())
-                       arg = argument;
+               if (!ev.argument.empty())
+                       arg = ev.argument;
                else
                        arg = lyxrc.date_insert_format;
                char datetmp[32];
@@ -3265,7 +3260,8 @@ void BufferView::Pimpl::smartQuote()
 
        if (style->pass_thru ||
                (!insertInset(new InsetQuotes(c, bv_->buffer()->params))))
-               bv_->owner()->getLyXFunc()->dispatch(LFUN_SELFINSERT, string("\""));
+               bv_->owner()->getLyXFunc()
+                       ->dispatch(FuncRequest(LFUN_SELFINSERT, "\""));
 }
 
 
index 429df7b067c4e89e159ece3fec04096e6016f7dc..96d7d7cf4a02bda9879ed48a17eb6a61fcb6c270 100644 (file)
@@ -11,7 +11,6 @@
 #define BUFFERVIEW_PIMPL_H
 
 #include "BufferView.h"
-#include "commandtags.h"
 #include "frontends/Timeout.h"
 #include "frontends/key_state.h"
 #include "frontends/mouse_state.h"
@@ -125,7 +124,7 @@ struct BufferView::Pimpl : public boost::signals::trackable {
        ///
        void updateInset(Inset * inset, bool mark_dirty);
        ///
-       bool dispatch(kb_action action, string const & argument);
+       bool dispatch(FuncRequest const & ev);
 private:
        /**
         * Return the on-screen dimensions of the inset at the cursor.
index b547ff24bc1b11c9e63262fc29c94fb2b4019ac9..299306131dca7551e7ff0e6e74470ba306a520e5 100644 (file)
@@ -1,3 +1,16 @@
+
+2002-08-07  André Pönitz <poenitz@gmx.net>
+
+       * funcrequest.h: new class to wrap a kb_action and its argument
+
+       * BufferView.[Ch]:
+       * BufferView_pimpl[Ch]:
+       * LaTeX.C:
+       * LyXAction.[Ch]:
+       * lyxfunc.[Ch]:
+       * lyxrc.C: subsequent changes
+
+
 2002-08-07  John Levon  <levon@movementarian.org>
 
        * BufferView_pimpl.C (redoCurrentBuffer): fix screen update when
index 0fb01690f471cac41943c1ce446181e741a72755..046f3f114856cb3ee2a1e217a997c0bc461b3185 100644 (file)
@@ -22,6 +22,7 @@
 #include "gettext.h"
 #include "lyxfunc.h"
 #include "debug.h"
+#include "funcrequest.h"
 #include "support/filetools.h"
 #include "support/FileInfo.h"
 #include "support/lstrings.h"
@@ -197,7 +198,7 @@ int LaTeX::run(TeXErrors & terr, LyXFunc * lfun)
        if (lfun) {
                ostringstream str;
                str << _("LaTeX run number") << ' ' << count;
-               lfun->dispatch(LFUN_MESSAGE, str.str().c_str(), false);
+               lfun->dispatch(FuncRequest(LFUN_MESSAGE, str.str().c_str()));
        }
 
        this->operator()();
@@ -233,7 +234,7 @@ int LaTeX::run(TeXErrors & terr, LyXFunc * lfun)
                // no checks for now
                lyxerr[Debug::LATEX] << "Running MakeIndex." << endl;
                if (lfun) {
-                       lfun->dispatch(LFUN_MESSAGE, _("Running MakeIndex."), false);
+                       lfun->dispatch(FuncRequest(LFUN_MESSAGE, _("Running MakeIndex.")));
                }
 
                rerun = runMakeIndex(OnlyFilename(ChangeExtension(file, ".idx")));
@@ -248,7 +249,7 @@ int LaTeX::run(TeXErrors & terr, LyXFunc * lfun)
                // no checks for now
                lyxerr[Debug::LATEX] << "Running BibTeX." << endl;
                if (lfun) {
-                       lfun->dispatch(LFUN_MESSAGE, _("Running BibTeX."), false);
+                       lfun->dispatch(FuncRequest(LFUN_MESSAGE, _("Running BibTeX.")));
                }
 
                updateBibtexDependencies(head, bibtex_info);
@@ -283,7 +284,7 @@ int LaTeX::run(TeXErrors & terr, LyXFunc * lfun)
                        ostringstream str;
                        str << _("LaTeX run number") << ' ' << count;
                        // check lyxstring string stream and gcc 3.1 before fixing
-                       lfun->dispatch(LFUN_MESSAGE, str.str().c_str(), false);
+                       lfun->dispatch(FuncRequest(LFUN_MESSAGE, str.str().c_str()));
                }
 
                this->operator()();
@@ -313,7 +314,7 @@ int LaTeX::run(TeXErrors & terr, LyXFunc * lfun)
                // no checks for now
                lyxerr[Debug::LATEX] << "Running MakeIndex." << endl;
                if (lfun) {
-                       lfun->dispatch(LFUN_MESSAGE, _("Running MakeIndex."), false);
+                       lfun->dispatch(FuncRequest(LFUN_MESSAGE, _("Running MakeIndex.")));
                }
 
                rerun = runMakeIndex(OnlyFilename(ChangeExtension(file, ".idx")));
@@ -339,7 +340,7 @@ int LaTeX::run(TeXErrors & terr, LyXFunc * lfun)
                if (lfun) {
                        ostringstream str;
                        str << _("LaTeX run number") << ' ' << count;
-                       lfun->dispatch(LFUN_MESSAGE, str.str().c_str(), false);
+                       lfun->dispatch(FuncRequest(LFUN_MESSAGE, str.str().c_str()));
                }
 
                this->operator()();
index 7df11552dd8d48fb58a211382573fddd946a2f5f..1163df80818de27501d4671668f5347761a91381 100644 (file)
@@ -74,14 +74,14 @@ void LyXAction::init()
        static bool init;
        if (init) return;
 
-       struct lfun_item {
+       struct ev_item {
                kb_action action;
                char const * name;
                char const * helpText;
                unsigned int attrib;
        };
 
-       lfun_item items[] = {
+       ev_item items[] = {
                { LFUN_ACUTE, "accent-acute", "", Noop },
                { LFUN_BREVE, "accent-breve", "", Noop },
                { LFUN_CARON, "accent-caron", "", Noop },
@@ -483,10 +483,7 @@ int LyXAction::getPseudoAction(kb_action action, string const & arg) const
        static unsigned int pseudo_counter = LFUN_LASTACTION;
 
        // Create new pseudo action.
-       pseudo_func tmp_p;
-       tmp_p.action = action;
-       tmp_p.arg = arg;
-       lyx_pseudo_map[++pseudo_counter] = tmp_p;
+       lyx_pseudo_map[++pseudo_counter] = FuncRequest(action, arg);
 
        // First ensure that the action is in lyx_arg_map;
        lyx_arg_map[action];
@@ -517,8 +514,8 @@ kb_action LyXAction::retrieveActionArg(int pseudo, string & arg) const
        if (pit != lyx_pseudo_map.end()) {
                lyxerr[Debug::ACTION] << "Found the pseudoaction: ["
                                      << pit->second.action << '|'
-                                     << pit->second.arg << "]\n";
-               arg = pit->second.arg;
+                                     << pit->second.argument << "]\n";
+               arg = pit->second.argument;
                return pit->second.action;
        } else {
                lyxerr << "Lyx Error: Unrecognized pseudo-action "
index 734969d5aab828f224f45f2ce42c42c914e812fb..9b93c2744a40d38fe95072293385f02dc30fe083 100644 (file)
@@ -8,12 +8,12 @@
 
 #include <map>
 
-#include "commandtags.h"
-#include "LString.h"
+#include "funcrequest.h"
 #include <boost/utility.hpp>
 
 /** This class encapsulates LyX action and user command operations.
  */
+
 class LyXAction : boost::noncopyable {
 private:
        ///
@@ -26,20 +26,13 @@ private:
                string helpText;
        };
 
-       ///
-       struct pseudo_func {
-               ///
-               kb_action action;
-               ///
-               string arg;
-       };
 public:
        ///
        typedef std::map<string, kb_action> func_map;
        ///
        typedef std::map<kb_action, func_info> info_map;
        ///
-       typedef std::map<unsigned int, pseudo_func> pseudo_map;
+       typedef std::map<unsigned int, FuncRequest> pseudo_map;
        ///
        typedef std::map<string, unsigned int> arg_item;
        ///
index d58ca4a7eb854b7ad20d2bb81ffc4ef545d39fc1..47343f6a4f616ce624da4b2215e41c2d6f2ad40e 100644 (file)
  */
 class WordLangTuple {
 public:
-       WordLangTuple() {};
+       WordLangTuple() {}
  
        WordLangTuple(string const & w, string const & c)
-               : word_(w), code_(c) {}
+               : word_(w), code_(c)
+       {}
  
        /// return the word
        string const word() const {
index 4f36465111b71fa83f6701abd4253e9b57dd1534..17e2d409d7e361f72bc896804f2df77468c57413 100644 (file)
@@ -5,7 +5,7 @@
  * This is basically the Communicator class from the lyx cvs module all
  * over again.
  *
- * Eventually, we will switch back to the XTL+LyXFunc combination that
+ * FuncRequestually, we will switch back to the XTL+LyXFunc combination that
  * worked so nicely on a very small number of compilers and systems (when
  * most systems can support those required features).
  *
@@ -42,7 +42,7 @@ class BufferParams;
     elaborate. This is basically the Communicator class from the lyx cvs module
     all over again.
 
-    Eventually, we will switch back to the XTL+LyXFunc combination that
+    FuncRequestually, we will switch back to the XTL+LyXFunc combination that
     worked so nicely on a very small number of compilers and systems.
     See the "dialogbase" branch of lyx-devel cvs module for xtl implementation.
 */
index 51bebd9223d82e19a86477a13b5141a5048547f0..e41c1f02b52db16e9cb2a4bd7e7d762148a6ad46 100644 (file)
@@ -123,7 +123,7 @@ public:
        void resetAutosaveTimer();
 
 protected:
-       /// view of a buffer. Eventually there will be several.
+       /// view of a buffer. FuncRequestually there will be several.
        boost::shared_ptr<BufferView> bufferview_;
 
        /// view's menubar
index 511e30823fafdced8b61c7a7d31c0d39eb5e04f8..dd57990afc7befab59888f88f8d41cba6dbbd41a 100644 (file)
@@ -25,6 +25,8 @@
 #include "frontends/LyXView.h"
 #include "lyxfunc.h"
 #include "BufferView.h"
+#include "funcrequest.h"
+
 
 ControlCommand::ControlCommand(LyXView & lv, Dialogs & d, kb_action ac)
        : ControlInset<InsetCommand, InsetCommandParams>(lv, d),
@@ -55,6 +57,7 @@ void ControlCommand::applyParamsToInset()
 
 void ControlCommand::applyParamsNoInset()
 {
-       if (action_ == LFUN_NOACTION) return;
-       lv_.getLyXFunc()->dispatch(action_, params().getAsString());
+       if (action_ == LFUN_NOACTION)
+               return;
+       lv_.getLyXFunc()->dispatch(FuncRequest(action_, params().getAsString()));
 }
index 80f65f43f759a0adfba66f16865964b13210f9c5..bd31be6cfb61e192dc2725f97973e2048e824120 100644 (file)
@@ -18,6 +18,7 @@
 #include "BufferView.h"
 #include "frontends/LyXView.h"
 #include "lyxfunc.h"
+#include "funcrequest.h"
 
 #include "support/forkedcontr.h"
 #include "support/lstrings.h"
@@ -65,7 +66,7 @@ void ControlForks::apply()
 
        for (vector<string>::const_iterator it = pids_.begin();
             it != pids_.end(); ++it) {
-               lv_.getLyXFunc()->dispatch(LFUN_FORKS_KILL, *it);
+               lv_.getLyXFunc()->dispatch(FuncRequest(LFUN_FORKS_KILL, *it));
        }
 
        pids_.clear();
index 7fa2410cb2b25010f1d9c1993ed79aa46442c38f..2bac0f5fa2be3460b637b3e313d37c1ef5ba517b 100644 (file)
@@ -21,6 +21,7 @@
 #include "gettext.h"
 #include "helper_funcs.h"
 #include "lyxrc.h"
+#include "funcrequest.h"
 
 #include "support/filetools.h"
 
@@ -72,15 +73,16 @@ string const ControlInclude::Browse(string const & in_name, Type in_type)
 
 void ControlInclude::load(string const & file)
 {
-       lv_.getLyXFunc()->dispatch(LFUN_CHILDOPEN, file);
+       lv_.getLyXFunc()->dispatch(FuncRequest(LFUN_CHILDOPEN, file));
 }
 
 
 bool ControlInclude::fileExists(string const & file)
 {
-       string const fileWithAbsPath = MakeAbsPath(file, OnlyPath(params().masterFilename_));
+       string const fileWithAbsPath
+               = MakeAbsPath(file, OnlyPath(params().masterFilename_));
 
-       if (params().noload){
+       if (params().noload) {
 
                if (prefixIs(file, "../") || prefixIs(file, "/"))
                        Alert::alert(_("Warning!"),
@@ -92,7 +94,6 @@ bool ControlInclude::fileExists(string const & file)
                return true;
        
        else
-               Alert::alert(_("Warning!"),
-                       _("Specified file doesn't exist"));
+               Alert::alert(_("Warning!"), _("Specified file doesn't exist"));
                return false;
 }
index 5e1ea07ef4bd7a597653e28b35e92b278aac287b..3afb56b835fbfc5437bc8c61f9fc3566cd6b7fea 100644 (file)
@@ -20,6 +20,7 @@
 #include "ControlRef.h"
 #include "lyxfunc.h"
 #include "bufferlist.h"
+#include "funcrequest.h"
 
 #include "support/filetools.h" // MakeAbsPath, MakeDisplayPath
 
@@ -44,14 +45,14 @@ vector<string> const ControlRef::getLabelList(string const & name) const
 
 void ControlRef::gotoRef(string const & ref) const
 {
-       lv_.getLyXFunc()->dispatch(LFUN_BOOKMARK_SAVE, "0", false);
-       lv_.getLyXFunc()->dispatch(LFUN_REF_GOTO, ref);
+       lv_.getLyXFunc()->dispatch(FuncRequest(LFUN_BOOKMARK_SAVE, "0"), false);
+       lv_.getLyXFunc()->dispatch(FuncRequest(LFUN_REF_GOTO, ref));
 }
 
 
 void ControlRef::gotoBookmark() const
 {
-       lv_.getLyXFunc()->dispatch(LFUN_BOOKMARK_GOTO, "0", false);
+       lv_.getLyXFunc()->dispatch(FuncRequest(LFUN_BOOKMARK_GOTO, "0"), false);
 }
 
 
index 0922c54a582bbce833b6cc4106c6d4c142b9100e..58a7198e8997414137cd4ae6bfdcf57f4f73f244 100644 (file)
@@ -21,6 +21,7 @@
 #include "ButtonControllerBase.h"
 #include "BufferView.h"
 #include "lyxfunc.h"
+#include "funcrequest.h"
 
 #include "frontends/LyXView.h"
 
@@ -34,7 +35,7 @@ ControlTabularCreate::ControlTabularCreate(LyXView & lv, Dialogs & d)
 
 ControlTabularCreate::rowsCols & ControlTabularCreate::params()
 {
-               return params_;
+       return params_;
 }
 
 
@@ -51,7 +52,6 @@ void ControlTabularCreate::apply()
 
        view().apply();
 
-       string const val(tostr(params().first) + " " + tostr(params().second));
-
-       lv_.getLyXFunc()->dispatch(LFUN_TABULAR_INSERT, val);
+       string const val = tostr(params().first) + " " + tostr(params().second);
+       lv_.getLyXFunc()->dispatch(FuncRequest(LFUN_TABULAR_INSERT, val));
 }
index 4a90977dc8c562351b45f51e0b554c1f192d16b2..4b97afdee267c1ea18f00945ccd533c957fd3957 100644 (file)
 
 #include "QtLyXView.h"
 #include "debug.h"
+#include "funcrequest.h"
 
 #include "FileDialog_private.h"
 
-LyXFileDialog::LyXFileDialog(LyXView * lv, kb_action a, string const & p, string const & m, string const & t)
-       : QFileDialog(p.c_str(), m.c_str(), qApp->mainWidget(), t.c_str(), a == LFUN_SELECT_FILE_SYNC),
-       lv_(lv), action_(a)
+LyXFileDialog::LyXFileDialog(LyXView * lv, kb_action a,
+               string const & p, string const & m, string const & t)
+       : QFileDialog(p.c_str(), m.c_str(), qApp->mainWidget(), t.c_str(),
+                           a == LFUN_SELECT_FILE_SYNC),
+         lv_(lv), action_(a)
 {
        setCaption(t.c_str());
 }
@@ -33,9 +36,10 @@ void LyXFileDialog::done(int what)
        if (action_ == LFUN_SELECT_FILE_SYNC) {
                QDialog::done(what);
                return;
-       } else if (what == QDialog::Accepted) {
-               lv_->getLyXFunc()->dispatch(action_, selectedFile().data(), false);
        }
 
+       if (what == QDialog::Accepted)
+               lv_->getLyXFunc()->dispatch(FuncRequest(action_, selectedFile().data()));
+
        delete this;
 }
index d1c62be0da645662a889ec0ef612fd30be43979b..deee5abc6c7027c8e32ad678b723fdaa99c4e706 100644 (file)
@@ -148,7 +148,7 @@ void Toolbar::Pimpl::changed_layout(string const & sel)
        for (LyXTextClass::const_iterator cit = tc.begin();
             cit != end; ++cit) {
                if (_((*cit)->name()) == sel) {
-                       owner_->getLyXFunc()->dispatch(LFUN_LAYOUT, (*cit)->name());
+                       owner_->getLyXFunc()->dispatch(FuncRequest(LFUN_LAYOUT, (*cit)->name()));
                        return;
                }
        }
index 1b5531f44d996a99f70e78a05886d034cf6797f9..99c3873b88af881f10bae5fc2d1f0debd3af9d72 100644 (file)
@@ -23,6 +23,7 @@
 #include "debug.h"
 #include "support/lstrings.h"
 #include "lyxfunc.h"
+#include "funcrequest.h"
 #include FORMS_H_LOCATION
 
 #include "delim.xbm"
@@ -31,7 +32,8 @@
 
 static int const delim_rversion[] = {
        1,1,3,3,4,5,7,7,9,9,10,11,
-       13,13,14,15,16,17,19,19,20,21,22,23 };
+       13,13,14,15,16,17,19,19,20,21,22,23
+};
 
 static char const * delim_values[] = {
        "(", ")", "lceil",  "rceil",  "uparrow",  "Uparrow",
@@ -91,9 +93,11 @@ void FormMathsDelim::apply()
        ostringstream ost;
        ost << delim_values[left] << ' ' << delim_values[right];
 
-       lv_->getLyXFunc()->dispatch(LFUN_MATH_DELIM, ost.str().c_str(), false);
+       lv_->getLyXFunc()->
+               dispatch(FuncRequest(LFUN_MATH_DELIM, ost.str().c_str()), false);
 }
 
+
 bool FormMathsDelim::input(FL_OBJECT *, long)
 {
        int left = int(dialog_->radio_left->u_ldata);
index 6e2f650050dffb62ffe6bba42c14410fc6c0708f..84de53f1a287c90621736a20cbc9553d1c49d5b3 100644 (file)
@@ -23,6 +23,7 @@
 #include "frontends/LyXView.h"
 #include "Lsstream.h"
 #include "lyxfunc.h"
+#include "funcrequest.h"
 #include "support/LAssert.h"
 #include "support/lyxalgo.h" // lyx::count
 #include FORMS_H_LOCATION
@@ -99,9 +100,11 @@ void FormMathsMatrix::apply()
        ostringstream ost;
        ost << nx << ' ' << ny << ' ' << c << ' ' << sh;
 
-       lv_->getLyXFunc()->dispatch(LFUN_INSERT_MATRIX, ost.str().c_str(), false);
+       lv_->getLyXFunc()->
+               dispatch(FuncRequest(LFUN_INSERT_MATRIX, ost.str().c_str()));
 }
 
+
 bool FormMathsMatrix::input(FL_OBJECT * ob, long)
 {
        if (ob == dialog_->choice_valign ||
@@ -123,9 +126,9 @@ int FormMathsMatrix::AlignFilter(char const * cur, int c)
 {
        size_t len = strlen(cur);
 
-       int const n = int(fl_get_slider_value(dialog_->slider_columns) + 0.5) -
-               int(len) +
-               int(lyx::count(cur, cur + len, '|'));
+       int const n = int(fl_get_slider_value(dialog_->slider_columns) + 0.5)
+               - int(len)
+               int(lyx::count(cur, cur + len, '|'));
        if (n < 0)
                return FL_INVALID;
 
index 6f624c873b3554fbda343847b43c090f6736f852..a84805b9d9625bbcd559617fc883f44c170889ff 100644 (file)
@@ -22,6 +22,7 @@
 #include "MathsSymbols.h"
 #include "debug.h"
 #include "lyxfunc.h"
+#include "funcrequest.h"
 
 #include "forms/form_maths_deco.h"
 #include "forms/form_maths_delim.h"
@@ -381,9 +382,9 @@ bool FormMathsPanel::input(FL_OBJECT *, long data)
 void FormMathsPanel::insertSymbol(string const & sym, bool bs) const
 {
        if (bs)
-               lv_->getLyXFunc()->dispatch(LFUN_INSERT_MATH, '\\' + sym);
+               lv_->getLyXFunc()->dispatch(FuncRequest(LFUN_INSERT_MATH, '\\' + sym));
        else
-               lv_->getLyXFunc()->dispatch(LFUN_INSERT_MATH, sym);
+               lv_->getLyXFunc()->dispatch(FuncRequest(LFUN_INSERT_MATH, sym));
 }
 
 
index c4ae22c06d8ee9dcf672b0c7385611b6b9a93607..f2d4d8ec8500e08f2d2dbe3a3a0d90612ee36cc3 100644 (file)
@@ -27,6 +27,7 @@
 #include "lyxrc.h"
 #include "LColor.h"
 #include "Lsstream.h"
+#include "funcrequest.h"
 
 #include "combox.h"
 #include "Color.h"
@@ -436,7 +437,7 @@ void FormPreferences::Colors::apply()
 
                        string const s = lcolor.getLyXName(lc) + string(" ") +
                                hexname;
-                       parent_.lv_->getLyXFunc()->dispatch(LFUN_SET_COLOR, s);
+                       parent_.lv_->getLyXFunc()->dispatch(FuncRequest(LFUN_SET_COLOR, s));
                }
        }
 }
@@ -488,6 +489,7 @@ void FormPreferences::Colors::build()
        setPrehandler(dialog_->radio_hsv);
 }
 
+
 string const
 FormPreferences::Colors::feedback(FL_OBJECT const * const ob) const
 {
@@ -682,7 +684,8 @@ void FormPreferences::Colors::InputRGB()
 
 void FormPreferences::Colors::LoadBrowserLyX()
 {
-       if (!dialog_->browser_lyx_objs->visible) return;
+       if (!dialog_->browser_lyx_objs->visible)
+               return;
 
        // First, define the modifiable xforms colors
        xformsColorDB.clear();
@@ -742,7 +745,7 @@ void FormPreferences::Colors::LoadBrowserLyX()
 
                        string const arg = lcolor.getLyXName(lc) + " black";
                        parent_.lv_->getLyXFunc()->
-                               dispatch(LFUN_SET_COLOR, arg);
+                               dispatch(FuncRequest(LFUN_SET_COLOR, arg));
                        continue;
                }
 
index 4367ed6a82a253b32f0b3ce8c4ed69adc8435dbe..2d69e24bb5fbbebd3c092232d86a2b21ff41d3ad 100644 (file)
 #include "FuncStatus.h"
 #include "BufferView.h"
 #include "buffer.h"
-#include "LyXAction.h"
+#include "funcrequest.h"
 #include "MathsSymbols.h"
 #include "gettext.h"
 #include "Tooltips.h"
 #include FORMS_H_LOCATION
 #include "combox.h"
 #include "ToolbarDefaults.h"
+#include "LyXAction.h"
 
 #include "support/LAssert.h"
 #include "support/filetools.h"
@@ -155,9 +156,7 @@ void Toolbar::Pimpl::update()
 // this one is not "C" because combox callbacks are really C++ %-|
 void Toolbar::Pimpl::layoutSelectedCB(int, void * arg, Combox *)
 {
-       Toolbar::Pimpl * tb = reinterpret_cast<Toolbar::Pimpl *>(arg);
-
-       tb->layoutSelected();
+       reinterpret_cast<Toolbar::Pimpl *>(arg)->layoutSelected();
 }
 
 
@@ -171,7 +170,7 @@ void Toolbar::Pimpl::layoutSelected()
        for (LyXTextClass::const_iterator cit = tc.begin();
             cit != end; ++cit) {
                if (_((*cit)->name()) == layoutguiname) {
-                       owner_->getLyXFunc()->dispatch(LFUN_LAYOUT, (*cit)->name());
+                       owner_->getLyXFunc()->dispatch(FuncRequest(LFUN_LAYOUT, (*cit)->name()));
                        return;
                }
        }
diff --git a/src/funcrequest.h b/src/funcrequest.h
new file mode 100644 (file)
index 0000000..c48a893
--- /dev/null
@@ -0,0 +1,30 @@
+#ifndef FUNCREQUEST_H
+#define FUNCREQUEST_H
+
+#include "commandtags.h"
+#include "LString.h"
+
+/** This class encapsulates LyX action and arguemnt
+ *  in order to passs it around easily.
+ */
+struct FuncRequest {
+       /// 
+       FuncRequest()
+               : action(LFUN_UNKNOWN_ACTION)
+       {}
+       /// 
+       FuncRequest(kb_action act)
+               : action(act)
+       {}
+       /// 
+       FuncRequest(kb_action act, string const & arg)
+               : action(act), argument(arg)
+       {}
+
+       ///
+       kb_action action;
+       ///
+       string argument;
+};
+
+#endif
index 316749adfa97c3e62cfac498c5aa0c5d1575eeff..954d997279950a9701752059c9096c1e200fab64 100644 (file)
@@ -1,3 +1,14 @@
+
+2002-08-07  André Pönitz <poenitz@gmx.net>
+
+       * inset.[Ch]:
+       * insetcollapsable.[Ch]:
+       * insetert.[Ch]:
+       * insetparent.[Ch]:
+       * insetref.[Ch]:
+       * insettabular.[Ch]:
+       * insettext.[Ch]:  change (kb_action, arg) pair into a FuncRequest
+
 2002-08-06  John Levon  <levon@movementarian.org>
 
        * inset.h: 
index 4429c12cb8bc43663c971145b90824f3e79f720e..0bc1ecb1861211a9626672376079a39a2dc227b8 100644 (file)
@@ -20,7 +20,7 @@
 #include "support/lstrings.h"
 #include "frontends/Painter.h"
 #include "frontends/mouse_state.h"
-#include "commandtags.h"
+#include "funcrequest.h"
 #include "support/lstrings.h"
 #include "gettext.h"
 #include "lyxfont.h"
@@ -301,15 +301,14 @@ void UpdatableInset::scroll(BufferView * bv, int offset) const
 
 ///  An updatable inset could handle lyx editing commands
 UpdatableInset::RESULT
-UpdatableInset::localDispatch(BufferView * bv,
-                             kb_action action, string const & arg)
+UpdatableInset::localDispatch(BufferView * bv, FuncRequest const & ev)
 {
-       if (!arg.empty() && (action==LFUN_SCROLL_INSET)) {
-               if (arg.find('.') != arg.npos) {
-                       float const xx = static_cast<float>(strToDbl(arg));
+       if (!ev.argument.empty() && ev.action == LFUN_SCROLL_INSET) {
+               if (ev.argument.find('.') != ev.argument.npos) {
+                       float const xx = static_cast<float>(strToDbl(ev.argument));
                        scroll(bv, xx);
                } else {
-                       int const xx = strToInt(arg);
+                       int const xx = strToInt(ev.argument);
                        scroll(bv, xx);
                }
                bv->updateInset(this, false);
index 48ff4741fc0dc80119b00cc40f7b7159d3315e50..c3ff56608b68a985ae3b29e2ea0f90ee5a16cf66 100644 (file)
 
 #include <vector>
 #include "LString.h"
-#include "commandtags.h"
+#include "LColor.h"
 #include "frontends/mouse_state.h"
 #include "WordLangTuple.h"
-#include "LColor.h"
 
 class LyXFont;
 class BufferView;
@@ -30,6 +29,7 @@ class LyXText;
 class LyXLex;
 class Paragraph;
 class LyXCursor;
+class FuncRequest;
 
 struct LaTeXFeatures;
 
@@ -512,7 +512,7 @@ public:
                                        bool /*lr*/ = false)
                { return false; }
        ///  An updatable inset could handle lyx editing commands
-       virtual RESULT localDispatch(BufferView *, kb_action, string const &);
+       virtual RESULT localDispatch(BufferView *, FuncRequest const & ev);
        ///
        bool isCursorVisible() const { return cursor_visible_; }
        ///
index ffba580c7f2500c1007fcf97badea053e49e7cee..0cbc128b3ac528dee469303c118e41e985a0b780 100644 (file)
@@ -437,10 +437,9 @@ void InsetCollapsable::update(BufferView * bv, LyXFont const & font,
 
 
 UpdatableInset::RESULT
-InsetCollapsable::localDispatch(BufferView * bv, kb_action action,
-                               string const & arg)
+InsetCollapsable::localDispatch(BufferView * bv, FuncRequest const & ev)
 {
-       UpdatableInset::RESULT result = inset.localDispatch(bv, action, arg);
+       UpdatableInset::RESULT result = inset.localDispatch(bv, ev);
        if (result >= FINISHED)
                bv->unlockInset(this);
        first_after_edit = false;
index 8ae7d2a593f52c327621516b0530fe389892969c..140e15ba979ea112e61210a0a747e47d2020bc63 100644 (file)
@@ -95,8 +95,7 @@ public:
        ///
        void insetMotionNotify(BufferView *, int, int, mouse_button::state);
        ///
-       UpdatableInset::RESULT localDispatch(BufferView *, kb_action,
-                                            string const &);
+       UpdatableInset::RESULT localDispatch(BufferView *, FuncRequest const &);
        ///
        int latex(Buffer const *, std::ostream &,
                  bool fragile, bool free_spc) const;
index a05d684befce813b607869621a26c187f41eb72c..d6f1ff9ce6ae25cc0fe9bde2c06c4a7da70483d6 100644 (file)
@@ -21,6 +21,7 @@
 #include "BufferView.h"
 #include "frontends/LyXView.h"
 #include "lyxtext.h"
+#include "funcrequest.h"
 #include "debug.h"
 #include "lyxrow.h"
 #include "lyxlex.h"
@@ -444,7 +445,7 @@ int InsetERT::docbook(Buffer const *, ostream & os, bool) const
 
 
 UpdatableInset::RESULT
-InsetERT::localDispatch(BufferView * bv, kb_action action, string const & arg)
+InsetERT::localDispatch(BufferView * bv, FuncRequest const & ev)
 {
        UpdatableInset::RESULT result = DISPATCHED_NOUPDATE;
 
@@ -452,14 +453,14 @@ InsetERT::localDispatch(BufferView * bv, kb_action action, string const & arg)
                set_latex_font(bv);
        }
 
-       switch (action) {
+       switch (ev.action) {
        case LFUN_LAYOUT:
                bv->owner()->setLayout(inset.paragraph()->layout()->name());
                break;
        default:
-               result = InsetCollapsable::localDispatch(bv, action, arg);
+               result = InsetCollapsable::localDispatch(bv, ev);
        }
-       switch (action) {
+       switch (ev.action) {
        case LFUN_BREAKPARAGRAPH:
        case LFUN_BREAKPARAGRAPHKEEPLAYOUT:
        case LFUN_BACKSPACE:
index 3b580ed938e8f552650f6f0549d482af934a6655..b75f62c7b55269461ef9b33bc59294b52f0e45a4 100644 (file)
@@ -94,8 +94,7 @@ public:
        ///
        void validate(LaTeXFeatures &) const {}
        ///
-       UpdatableInset::RESULT localDispatch(BufferView *, kb_action,
-                                            string const &);
+       UpdatableInset::RESULT localDispatch(BufferView *, FuncRequest const &);
        ///
        bool checkInsertChar(LyXFont &);
        ///
index 4afdbab43c51414dee5593e708ec2971738d1079..8a5a1972859d318590c4b8bf67d7bdb28f4e7e83 100644 (file)
@@ -22,7 +22,7 @@
 #include "BufferView.h"
 #include "frontends/LyXView.h"
 #include "support/LOstream.h"
-#include "commandtags.h"
+#include "funcrequest.h"
 #include "buffer.h"
 #include "gettext.h"
 #include "lyxfunc.h"
@@ -47,7 +47,7 @@ string const InsetParent::getScreenLabel(Buffer const *) const
 void InsetParent::edit(BufferView * bv, int, int, mouse_button::state)
 {    
        bv->owner()->getLyXFunc()->
-               dispatch(LFUN_CHILDOPEN, getContents());
+               dispatch(FuncRequest(LFUN_CHILDOPEN, getContents()));
 }
 
 
index aac91335cbcf7d935161d4d954a65006b26d841f..a0bbc2857c2c097278e5bbf97a9e9c2c6fb9cbf7 100644 (file)
@@ -6,7 +6,7 @@
 
 #include "insetref.h"
 #include "buffer.h"
-#include "commandtags.h"
+#include "funcrequest.h"
 #include "debug.h"
 #include "gettext.h"
 #include "LaTeXFeatures.h"
@@ -22,20 +22,20 @@ InsetRef::InsetRef(InsetCommandParams const & p, Buffer const & buf, bool)
        : InsetCommand(p), isLatex(buf.isLatex())
 {}
 
+
 void InsetRef::edit(BufferView * bv, int, int, mouse_button::state button)
 {
-       // Eventually trigger dialog with button 3 not 1
+       // FuncRequestually trigger dialog with button 3 not 1
        if (button == mouse_button::button3)
                bv->owner()->getLyXFunc()->
-                       dispatch(LFUN_REF_GOTO, getContents());
+                       dispatch(FuncRequest(LFUN_REF_GOTO, getContents()));
        else if (button == mouse_button::button1)
                bv->owner()->getDialogs()->showRef(this);
 }
 
 
 void InsetRef::edit(BufferView *, bool)
-{
-}
+{}
 
 
 string const InsetRef::getScreenLabel(Buffer const *) const
index 2749679a351f64811b42f3f08a635a2b498c361a..b5df68b3eac2856f4227b54d60c4f46ba9c6d2fa 100644 (file)
@@ -35,6 +35,7 @@
 #include "lyxlength.h"
 #include "ParagraphParameters.h"
 #include "lyxlex.h"
+#include "funcrequest.h"
 
 #include "frontends/Dialogs.h"
 #include "frontends/Alert.h"
@@ -820,7 +821,7 @@ void InsetTabular::insetButtonPress(BufferView * bv, int x, int y, mouse_button:
                the_locking_inset = 0;
        }
        if (button == mouse_button::button2) {
-               localDispatch(bv, LFUN_PASTESELECTION, "paragraph");
+               localDispatch(bv, FuncRequest(LFUN_PASTESELECTION, "paragraph"));
                return;
        }
        if (inset_hit && bv->theLockingInset()) {
@@ -877,20 +878,19 @@ void InsetTabular::insetMotionNotify(BufferView * bv, int x, int y, mouse_button
 
 
 UpdatableInset::RESULT
-InsetTabular::localDispatch(BufferView * bv, kb_action action,
-                           string const & arg)
+InsetTabular::localDispatch(BufferView * bv, FuncRequest const & ev)
 {
        // We need to save the value of the_locking_inset as the call to
        // the_locking_inset->LocalDispatch might unlock it.
        old_locking_inset = the_locking_inset;
        UpdatableInset::RESULT result =
-               UpdatableInset::localDispatch(bv, action, arg);
+               UpdatableInset::localDispatch(bv, ev);
        if (result == DISPATCHED || result == DISPATCHED_NOUPDATE) {
                resetPos(bv);
                return result;
        }
 
-       if ((action < 0) && arg.empty())
+       if (ev.action < 0 && ev.argument.empty())
                return FINISHED;
 
        bool hs = hasSelection();
@@ -899,12 +899,12 @@ InsetTabular::localDispatch(BufferView * bv, kb_action action,
        // this one have priority over the locked InsetText, if we're not already
        // inside another tabular then that one get's priority!
        if (getFirstLockingInsetOfType(Inset::TABULAR_CODE) == this) {
-               switch (action) {
+               switch (ev.action) {
                case LFUN_SHIFT_TAB:
                case LFUN_TAB:
                        hideInsetCursor(bv);
                        unlockInsetInInset(bv, the_locking_inset);
-                       if (action == LFUN_TAB)
+                       if (ev.action == LFUN_TAB)
                                moveNextCell(bv, old_locking_inset != 0);
                        else
                                movePrevCell(bv, old_locking_inset != 0);
@@ -922,8 +922,10 @@ InsetTabular::localDispatch(BufferView * bv, kb_action action,
                }
        }
 
+       kb_action action = ev.action;
+       string    arg    = ev.argument;
        if (the_locking_inset) {
-               result = the_locking_inset->localDispatch(bv, action, arg);
+               result = the_locking_inset->localDispatch(bv, ev);
                if (result == DISPATCHED_NOUPDATE) {
                        int sc = scroll();
                        resetPos(bv);
@@ -1248,7 +1250,7 @@ InsetTabular::localDispatch(BufferView * bv, kb_action action,
                        case LFUN_DEFAULT:
                        case LFUN_UNDERLINE:
                        case LFUN_FONT_SIZE:
-                               if (bv->dispatch(action, arg))
+                               if (bv->dispatch(FuncRequest(action, arg)))
                                        result = DISPATCHED;
                                break;
                        default:
@@ -1263,7 +1265,7 @@ InsetTabular::localDispatch(BufferView * bv, kb_action action,
                if (activateCellInset(bv)) {
                        // reset need_update setted in above function!
                        need_update = NONE;
-                       result = the_locking_inset->localDispatch(bv, action, arg);
+                       result = the_locking_inset->localDispatch(bv, FuncRequest(action, arg));
                        if ((result == UNDISPATCHED) || (result >= FINISHED)) {
                                unlockInsetInInset(bv, the_locking_inset);
                                nodraw(false);
index 329a67df7c65d53b3bbda71e8f044518e36ff054..6e653b9aadf971328f28ccd801fe748d39a2dde6 100644 (file)
@@ -142,8 +142,7 @@ public:
        ///
        void insetMotionNotify(BufferView *, int, int, mouse_button::state);
        ///
-       UpdatableInset::RESULT localDispatch(BufferView *, kb_action,
-                                            string const &);
+       UpdatableInset::RESULT localDispatch(BufferView *, FuncRequest const &);
        ///
        int latex(Buffer const *, std::ostream &, bool, bool) const;
        ///
index b191f313eadedfba2f6bcbf4d74a39d9493be45e..93187b791683603e102fbb206ec9217297d429f8 100644 (file)
@@ -19,7 +19,6 @@
 #include "lyxlex.h"
 #include "debug.h"
 #include "lyxfont.h"
-#include "commandtags.h"
 #include "buffer.h"
 #include "frontends/LyXView.h"
 #include "BufferView.h"
@@ -40,6 +39,7 @@
 #include "ParagraphParameters.h"
 #include "undo_funcs.h"
 #include "lyxfind.h"
+#include "funcrequest.h"
 
 #include "frontends/Alert.h"
 #include "frontends/Dialogs.h"
@@ -1043,7 +1043,7 @@ void InsetText::insetButtonPress(BufferView * bv,
        if (bv->theLockingInset()) {
                if (isHighlyEditableInset(inset)) {
                        // We just have to lock the inset before calling a
-                       // PressEvent on it!
+                       // PressFuncRequest on it!
                        UpdatableInset * uinset = static_cast<UpdatableInset*>(inset);
                        if (!bv->lockInset(uinset)) {
                                lyxerr[Debug::INSETS] << "Cannot lock inset" << endl;
@@ -1057,7 +1057,7 @@ void InsetText::insetButtonPress(BufferView * bv,
        if (!inset) { // && (button == mouse_button::button2)) {
                bool paste_internally = false;
                if ((button == mouse_button::button2) && getLyXText(bv)->selection.set()) {
-                       localDispatch(bv, LFUN_COPY, "");
+                       localDispatch(bv, FuncRequest(LFUN_COPY));
                        paste_internally = true;
                }
                bool clear = false;
@@ -1096,10 +1096,9 @@ void InsetText::insetButtonPress(BufferView * bv,
                // insert this
                if (button == mouse_button::button2) {
                        if (paste_internally)
-                               localDispatch(bv, LFUN_PASTE, "");
+                               localDispatch(bv, FuncRequest(LFUN_PASTE));
                        else
-                               localDispatch(bv, LFUN_PASTESELECTION,
-                                             "paragraph");
+                               localDispatch(bv, FuncRequest(LFUN_PASTESELECTION, "paragraph"));
                }
        } else {
                getLyXText(bv)->clearSelection();
@@ -1177,23 +1176,21 @@ void InsetText::insetMotionNotify(BufferView * bv, int x, int y, mouse_button::s
 
 
 UpdatableInset::RESULT
-InsetText::localDispatch(BufferView * bv,
-                        kb_action action, string const & arg)
+InsetText::localDispatch(BufferView * bv, FuncRequest const & ev)
 {
        bool was_empty = par->size() == 0 && !par->next();
        no_selection = false;
        UpdatableInset::RESULT
-               result= UpdatableInset::localDispatch(bv, action, arg);
-       if (result != UNDISPATCHED) {
+               result= UpdatableInset::localDispatch(bv, ev);
+       if (result != UNDISPATCHED)
                return DISPATCHED;
-       }
 
        result = DISPATCHED;
-       if ((action < 0) && arg.empty())
+       if (ev.action < 0 && ev.argument.empty())
                return FINISHED;
 
        if (the_locking_inset) {
-               result = the_locking_inset->localDispatch(bv, action, arg);
+               result = the_locking_inset->localDispatch(bv, ev);
                if (result == DISPATCHED_NOUPDATE)
                        return result;
                else if (result == DISPATCHED) {
@@ -1244,14 +1241,14 @@ InsetText::localDispatch(BufferView * bv,
        }
        int updwhat = 0;
        int updflag = false;
-       switch (action) {
+       switch (ev.action) {
        // Normal chars
        case LFUN_SELFINSERT:
                if (bv->buffer()->isReadonly()) {
 //         setErrorMessage(N_("Document is read only"));
                        break;
                }
-               if (!arg.empty()) {
+               if (!ev.argument.empty()) {
                        /* Automatically delete the currently selected
                         * text and replace it with what is being
                         * typed in now. Depends on lyxrc settings
@@ -1267,9 +1264,9 @@ InsetText::localDispatch(BufferView * bv,
                                }
                        }
                        lt->clearSelection();
-                       for (string::size_type i = 0; i < arg.length(); ++i) {
+                       for (string::size_type i = 0; i < ev.argument.length(); ++i) {
                                bv->owner()->getIntl()->getTransManager().
-                                       TranslateAndInsert(arg[i], lt);
+                                       TranslateAndInsert(ev.argument[i], lt);
                        }
                }
                lt->selection.cursor = lt->cursor;
@@ -1376,7 +1373,7 @@ InsetText::localDispatch(BufferView * bv,
 
                if (clip.empty())
                        break;
-               if (arg == "paragraph") {
+               if (ev.argument == "paragraph") {
                        lt->insertStringAsParagraphs(bv, clip);
                } else {
                        lt->insertStringAsLines(bv, clip);
@@ -1449,7 +1446,7 @@ InsetText::localDispatch(BufferView * bv,
                        // and current buffer's textclass (number). */
                        LyXTextClass const & tclass =
                                bv->buffer()->params.getLyXTextClass();
-                       string layout = arg;
+                       string layout = ev.argument;
                        bool hasLayout = tclass.hasLayout(layout);
 
                        // If the entry is obsolete, use the new one instead.
@@ -1462,8 +1459,8 @@ InsetText::localDispatch(BufferView * bv,
 
                        // see if we found the layout number:
                        if (!hasLayout) {
-                               string const msg = string(N_("Layout ")) + arg + N_(" not known");
-                               bv->owner()->getLyXFunc()->dispatch(LFUN_MESSAGE, msg);
+                               FuncRequest lf(LFUN_MESSAGE, N_("Layout ") + ev.argument + N_(" not known"));
+                               bv->owner()->getLyXFunc()->dispatch(lf);
                                break;
                        }
 
@@ -1491,7 +1488,7 @@ InsetText::localDispatch(BufferView * bv,
                        cur_value = par->params().spacing().getValue();
                }
 
-               istringstream istr(arg.c_str());
+               istringstream istr(ev.argument.c_str());
                string tmp;
                istr >> tmp;
                Spacing::Space new_spacing = cur_spacing;
@@ -1516,7 +1513,7 @@ InsetText::localDispatch(BufferView * bv,
                        new_spacing = Spacing::Default;
                } else {
                        lyxerr << _("Unknown spacing argument: ")
-                                  << arg << endl;
+                                  << ev.argument << endl;
                }
                if (cur_spacing != new_spacing || cur_value != new_value) {
                        par->params().spacing(Spacing(new_spacing, new_value));
@@ -1527,7 +1524,7 @@ InsetText::localDispatch(BufferView * bv,
        break;
 
        default:
-               if (!bv->dispatch(action, arg))
+               if (!bv->dispatch(ev))
                        result = UNDISPATCHED;
                break;
        }
index 7b1723daa40916304e88b0857623639f9388887e..b8545b7a73509b0e9b922116bf6e53fddab1f99d 100644 (file)
@@ -129,8 +129,7 @@ public:
        ///
        void insetMotionNotify(BufferView *, int, int, mouse_button::state);
        ///
-       UpdatableInset::RESULT localDispatch(BufferView *,
-                                            kb_action, string const &);
+       UpdatableInset::RESULT localDispatch(BufferView *, FuncRequest const &);
        ///
        int latex(Buffer const *, std::ostream &,
                  bool fragile, bool free_spc) const;
index 330d12fc0f4134eaef907fb5b51bcef144c9d894..56464ec535f7a21d1ab8735e9fe00bef168f5abf 100644 (file)
@@ -190,7 +190,7 @@ void LyXFunc::processKeySym(LyXKeySymPtr keysym,
                       << endl;
        }
        // Do nothing if we have nothing (JMarc)
-       if ( ! keysym->isOK() ) {
+       if (!keysym->isOK()) {
                lyxerr[Debug::KEY] << "Empty kbd action (probably composing)"
                                   << endl;
                return;
@@ -264,7 +264,7 @@ void LyXFunc::processKeySym(LyXKeySymPtr keysym,
                if (c != 0)
                        argument = c;
 
-               dispatch(LFUN_SELFINSERT, argument);
+               dispatch(FuncRequest(LFUN_SELFINSERT, argument));
                lyxerr[Debug::KEY] << "SelfInsert arg[`"
                                   << argument << "']" << endl;
        } else {
@@ -275,25 +275,23 @@ void LyXFunc::processKeySym(LyXKeySymPtr keysym,
 
 FuncStatus LyXFunc::getStatus(int ac) const
 {
-       kb_action action;
        string argument;
-       action = lyxaction.retrieveActionArg(ac, argument);
-       return getStatus(action, argument);
+       kb_action action = lyxaction.retrieveActionArg(ac, argument);
+       return getStatus(FuncRequest(action, argument));
 }
 
 
-FuncStatus LyXFunc::getStatus(kb_action action,
-                             string const & argument) const
+FuncStatus LyXFunc::getStatus(FuncRequest const & ev) const
 {
        FuncStatus flag;
        Buffer * buf = owner->buffer();
 
-       if (action == LFUN_NOACTION) {
+       if (ev.action == LFUN_NOACTION) {
                setStatusMessage(N_("Nothing to do"));
                return flag.disabled(true);
        }
 
-       if (action == LFUN_UNKNOWN_ACTION) {
+       if (ev.action == LFUN_UNKNOWN_ACTION) {
                setStatusMessage(N_("Unknown action"));
                return flag.unknown(true);
        }
@@ -302,13 +300,13 @@ FuncStatus LyXFunc::getStatus(kb_action action,
        setStatusMessage(N_("Command disabled"));
 
        // Check whether we need a buffer
-       if (!lyxaction.funcHasFlag(action, LyXAction::NoBuffer)) {
+       if (!lyxaction.funcHasFlag(ev.action, LyXAction::NoBuffer)) {
                // Yes we need a buffer, do we have one?
                if (buf) {
                        // yes
                        // Can we use a readonly buffer?
                        if (buf->isReadonly() &&
-                           !lyxaction.funcHasFlag(action,
+                           !lyxaction.funcHasFlag(ev.action,
                                                   LyXAction::ReadOnly)) {
                                // no
                                setStatusMessage(N_("Document is read-only"));
@@ -327,14 +325,14 @@ FuncStatus LyXFunc::getStatus(kb_action action,
        // I would really like to avoid having this switch and rather try to
        // encode this in the function itself.
        bool disable = false;
-       switch (action) {
+       switch (ev.action) {
        case LFUN_MENUPRINT:
                disable = !Exporter::IsExportable(buf, "dvi")
                        || lyxrc.print_command == "none";
                break;
        case LFUN_EXPORT:
-               disable = argument == "fax" &&
-                       !Exporter::IsExportable(buf, argument);
+               disable = ev.argument == "fax" &&
+                       !Exporter::IsExportable(buf, ev.argument);
                break;
        case LFUN_UNDO:
                disable = buf->undostack.empty();
@@ -378,11 +376,11 @@ FuncStatus LyXFunc::getStatus(kb_action action,
                        //ret.disabled(true);
                        if (tli->lyxCode() == Inset::TABULAR_CODE) {
                                ret = static_cast<InsetTabular *>(tli)
-                                       ->getStatus(argument);
+                                       ->getStatus(ev.argument);
                        } else if (tli->getFirstLockingInsetOfType(Inset::TABULAR_CODE)) {
                                ret = static_cast<InsetTabular *>
                                        (tli->getFirstLockingInsetOfType(Inset::TABULAR_CODE))
-                                       ->getStatus(argument);
+                                       ->getStatus(ev.argument);
                        }
                        flag |= ret;
                        disable = false;
@@ -391,7 +389,7 @@ FuncStatus LyXFunc::getStatus(kb_action action,
                        FuncStatus ret;
 
                        disable = true;
-                       ret = inset.getStatus(argument);
+                       ret = inset.getStatus(ev.argument);
                        if (ret.onoff(true) || ret.onoff(false))
                                flag.setOnOff(false);
                }
@@ -413,7 +411,7 @@ FuncStatus LyXFunc::getStatus(kb_action action,
                break;
        case LFUN_BOOKMARK_GOTO:
                disable =  !owner->view()->
-                       isSavedPosition(strToUnsignedInt(argument));
+                       isSavedPosition(strToUnsignedInt(ev.argument));
                break;
        case LFUN_INSET_TOGGLE: {
                LyXText * lt = owner->view()->getLyXText();
@@ -433,15 +431,15 @@ FuncStatus LyXFunc::getStatus(kb_action action,
                                disable = true;
                                break;
                        }
-                       if (argument.empty()) {
+                       if (ev.argument.empty()) {
                                flag.clear();
                                break;
                        }
-                       if (!contains("tcb", argument[0])) {
+                       if (!contains("tcb", ev.argument[0])) {
                                disable = true;
                                break;
                        }
-                       flag.setOnOff(argument[0] == align);
+                       flag.setOnOff(ev.argument[0] == align);
                } else
                        disable = true;
                break;
@@ -453,22 +451,22 @@ FuncStatus LyXFunc::getStatus(kb_action action,
                                disable = true;
                                break;
                        }
-                       if (argument.empty()) {
+                       if (ev.argument.empty()) {
                                flag.clear();
                                break;
                        }
-                       if (!contains("lcr", argument[0])) {
+                       if (!contains("lcr", ev.argument[0])) {
                                disable = true;
                                break;
                        }
-                       flag.setOnOff(argument[0] == align);
+                       flag.setOnOff(ev.argument[0] == align);
                } else
                        disable = true;
                break;
 
        case LFUN_MATH_MUTATE:
                if (tli && (tli->lyxCode() == Inset::MATH_CODE))
-                       flag.setOnOff(mathcursor->formula()->hullType() == argument);
+                       flag.setOnOff(mathcursor->formula()->hullType() == ev.argument);
                else
                        disable = true;
                break;
@@ -498,7 +496,7 @@ FuncStatus LyXFunc::getStatus(kb_action action,
 
        // the functions which insert insets
        Inset::Code code = Inset::NO_CODE;
-       switch (action) {
+       switch (ev.action) {
        case LFUN_INSET_ERT:
                code = Inset::ERT_CODE;
                break;
@@ -602,7 +600,7 @@ FuncStatus LyXFunc::getStatus(kb_action action,
                flag.disabled(true);
 
        // A few general toggles
-       switch (action) {
+       switch (ev.action) {
        case LFUN_TOOLTIPS_TOGGLE:
                flag.setOnOff(owner->getDialogs()->tooltipsEnabled());
                break;
@@ -616,7 +614,7 @@ FuncStatus LyXFunc::getStatus(kb_action action,
        case LFUN_SWITCHBUFFER:
                // toggle on the current buffer, but do not toggle off
                // the other ones (is that a good idea?)
-               if (argument == buf->fileName())
+               if (ev.argument == buf->fileName())
                        flag.setOnOff(true);
                break;
        default:
@@ -626,7 +624,7 @@ FuncStatus LyXFunc::getStatus(kb_action action,
        // the font related toggles
        if (!mathcursor) {
                LyXFont const & font = TEXT(false)->real_current_font;
-               switch (action) {
+               switch (ev.action) {
                case LFUN_EMPH:
                        flag.setOnOff(font.emph() == LyXFont::ON);
                        break;
@@ -650,7 +648,7 @@ FuncStatus LyXFunc::getStatus(kb_action action,
                }
        } else {
                string tc = mathcursor->getLastCode();
-               switch (action) {
+               switch (ev.action) {
                case LFUN_BOLD:
                        flag.setOnOff(tc == "mathbf");
                        break;
@@ -679,10 +677,9 @@ FuncStatus LyXFunc::getStatus(kb_action action,
 
        // this one is difficult to get right. As a half-baked
        // solution, we consider only the first action of the sequence
-       if (action == LFUN_SEQUENCE) {
+       if (ev.action == LFUN_SEQUENCE) {
                // argument contains ';'-terminated commands
-               const int ac = lyxaction.LookupFunc(token(argument, ';', 0));
-               flag = getStatus(ac);
+               flag = getStatus(lyxaction.LookupFunc(token(ev.argument, ';', 0)));
        }
 
        return flag;
@@ -708,15 +705,15 @@ void LyXFunc::dispatch(int ac, bool verbose)
 {
        string argument;
        kb_action const action = lyxaction.retrieveActionArg(ac, argument);
-       dispatch(action, argument, verbose);
+       dispatch(FuncRequest(action, argument), verbose);
 }
 
 
 
-void LyXFunc::dispatch(kb_action action, string argument, bool verbose)
+void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
 {
-       lyxerr[Debug::ACTION] << "LyXFunc::dispatch: action[" << action
-                             <<"] arg[" << argument << "]" << endl;
+       lyxerr[Debug::ACTION] << "LyXFunc::dispatch: action[" << ev.action
+                             <<"] arg[" << ev.argument << "]" << endl;
 
        // we have not done anything wrong yet.
        errorstat = false;
@@ -734,8 +731,11 @@ void LyXFunc::dispatch(kb_action action, string argument, bool verbose)
        if (owner->view()->available())
                owner->view()->hideCursor();
 
+       string argument = ev.argument;
+       kb_action action = ev.action;
+
        // We cannot use this function here
-       if (getStatus(action, argument).disabled()) {
+       if (getStatus(ev).disabled()) {
                lyxerr[Debug::ACTION] << "LyXFunc::dispatch: "
                       << lyxaction.getActionName(action)
                       << " [" << action << "] is disabled at this location"
@@ -768,7 +768,7 @@ void LyXFunc::dispatch(kb_action action, string argument, bool verbose)
                                goto exit_with_message;
                        } else if (((result=inset->
                                     // Hand-over to inset's own dispatch:
-                                    localDispatch(owner->view().get(), action, argument)) ==
+                                    localDispatch(owner->view().get(), FuncRequest(action, argument))) ==
                                    UpdatableInset::DISPATCHED) ||
                                   (result == UpdatableInset::DISPATCHED_NOUPDATE))
                                goto exit_with_message;
@@ -1336,10 +1336,10 @@ void LyXFunc::dispatch(kb_action action, string argument, bool verbose)
 
        // passthrough hat and underscore outside mathed:
        case LFUN_SUBSCRIPT:
-               dispatch(LFUN_SELFINSERT, "_", false);
+               dispatch(FuncRequest(LFUN_SELFINSERT, "_"));
                break;
        case LFUN_SUPERSCRIPT:
-               dispatch(LFUN_SELFINSERT, "^", false);
+               dispatch(FuncRequest(LFUN_SELFINSERT, "^"));
                break;
 
        case LFUN_MATH_PANEL:
@@ -1361,7 +1361,7 @@ void LyXFunc::dispatch(kb_action action, string argument, bool verbose)
                        } else {
                                p.setContents(argument);
                        }
-                       dispatch(LFUN_CITATION_INSERT, p.getAsString());
+                       dispatch(FuncRequest(LFUN_CITATION_INSERT, p.getAsString()));
                } else
                        owner->getDialogs()->createCitation(p.getAsString());
        }
@@ -1507,48 +1507,47 @@ void LyXFunc::dispatch(kb_action action, string argument, bool verbose)
        default:
                // Then if it was none of the above
                // Trying the BufferView::pimpl dispatch:
-               if (!owner->view()->dispatch(action, argument))
+               if (!owner->view()->dispatch(ev))
                        lyxerr << "A truly unknown func ["
-                              << lyxaction.getActionName(action) << "]!"
+                              << lyxaction.getActionName(ev.action) << "]!"
                               << endl;
                break;
        } // end of switch
 
 exit_with_message:
-       string const & msg = getMessage();
-       sendDispatchMessage(msg, action, argument, verbose);
+       sendDispatchMessage(getMessage(), ev, verbose);
 }
 
 
-void LyXFunc::sendDispatchMessage(string const & msg, kb_action action, string const & arg, bool verbose)
+void LyXFunc::sendDispatchMessage(string const & msg, FuncRequest const & ev, bool verbose)
 {
        owner->updateMenubar();
        owner->updateToolbar();
 
-       if (action == LFUN_SELFINSERT || !verbose) {
+       if (ev.action == LFUN_SELFINSERT || !verbose) {
                lyxerr[Debug::ACTION] << "dispatch msg is " << msg << endl;
                if (!msg.empty())
                        owner->message(msg);
                return;
        }
 
-       string dispatch_msg(msg);
+       string dispatch_msg = msg;
        if (!dispatch_msg.empty())
                dispatch_msg += " ";
 
-       string comname = lyxaction.getActionName(action);
+       string comname = lyxaction.getActionName(ev.action);
 
-       int pseudoaction = action;
+       int pseudoaction = ev.action;
        bool argsadded = false;
 
-       if (!arg.empty()) {
+       if (!ev.argument.empty()) {
                // the pseudoaction is useful for the bindings
-               pseudoaction = lyxaction.searchActionArg(action, arg);
+               pseudoaction = lyxaction.searchActionArg(ev.action, ev.argument);
 
                if (pseudoaction == LFUN_UNKNOWN_ACTION) {
-                       pseudoaction = action;
+                       pseudoaction = ev.action;
                } else {
-                       comname += " " + arg;
+                       comname += " " + ev.argument;
                        argsadded = true;
                }
        }
@@ -1557,8 +1556,8 @@ void LyXFunc::sendDispatchMessage(string const & msg, kb_action action, string c
 
        if (!shortcuts.empty()) {
                comname += ": " + shortcuts;
-       } else if (!argsadded && !arg.empty()) {
-               comname += " " + arg;
+       } else if (!argsadded && !ev.argument.empty()) {
+               comname += " " + ev.argument;
        }
 
        if (!comname.empty()) {
index fd6e8538963ac7a6db551ec0f7cd52d6e079b70a..6eca3068a0dbb0c1529bad2b8dc8a2daec82cd61 100644 (file)
@@ -7,15 +7,16 @@
 #endif
 
 
-#include "commandtags.h" // for kb_action enum
 #include "FuncStatus.h"
 #include "kbsequence.h"
+#include "commandtags.h"
 #include "LString.h"
 
 #include <boost/signals/trackable.hpp>
 
 class LyXView;
 class LyXText;
+class FuncRequest;
 
 
 /** This class encapsulates all the LyX command operations.
@@ -31,7 +32,7 @@ public:
        LyXFunc(LyXView *);
 
        /// LyX dispatcher, executes lyx actions.
-       void dispatch(kb_action ac, string argument = string(), bool verbose = false);
+       void dispatch(FuncRequest const &, bool verbose = false);
 
        /// Dispatch via a string argument
        void dispatch(string const & s, bool verbose = false);
@@ -49,8 +50,7 @@ public:
        /// can contain the string argument.
        FuncStatus getStatus(int ac) const;
        ///
-       FuncStatus getStatus(kb_action action,
-                            string const & argument = string()) const;
+       FuncStatus getStatus(FuncRequest const & action) const;
 
        /// The last key was meta
        bool wasMetaKey() const;
@@ -101,7 +101,7 @@ private:
        mutable string status_buffer;
 
        /// send a post-dispatch status message
-       void sendDispatchMessage(string const & msg, kb_action ac, string const & arg, bool verbose);
+       void sendDispatchMessage(string const & msg, FuncRequest const & ev, bool verbose);
 
        // I think the following should be moved to BufferView. (Asger)
 
index 33f0c601b017fa93f6db19bdbe73fb9c32da6c89..eef41ae2f82d4e608a98ed3d8bf8d1f78092231e 100644 (file)
@@ -726,7 +726,7 @@ int LyXRC::read(string const & filename)
                                break;
                        }
 
-                       if ((action = lyxaction.LookupFunc(cmd))>= 0) {
+                       if ((action = lyxaction.LookupFunc(cmd)) >= 0) {
                                if (lyxerr.debugging(Debug::LYXRC)) {
                                        lyxerr << "RC_BIND: Sequence `"
                                               << seq << "' Command `"
index 3f05043ecb39b7589a2bd1d9cee682826b9500f9..27fabf24953917db4a49f076654160aa6090bdcd 100644 (file)
@@ -20,7 +20,6 @@
 #include <config.h>
 
 #include "formula.h"
-#include "commandtags.h"
 #include "math_cursor.h"
 #include "math_parser.h"
 #include "math_charinset.h"
@@ -37,6 +36,7 @@
 #include "gettext.h"
 #include "debug.h"
 #include "lyxrc.h"
+#include "funcrequest.h"
 
 #include "support/LOstream.h"
 #include "support/LAssert.h"
@@ -252,12 +252,11 @@ vector<string> const InsetFormula::getLabelList() const
 
 
 UpdatableInset::RESULT
-InsetFormula::localDispatch(BufferView * bv, kb_action action,
-        string const & arg)
+InsetFormula::localDispatch(BufferView * bv, FuncRequest const & ev)
 {
        RESULT result = DISPATCHED;
 
-       switch (action) {
+       switch (ev.action) {
 
                case LFUN_BREAKLINE:
                        bv->lockedInsetStoreUndo(Undo::INSERT);
@@ -305,7 +304,7 @@ InsetFormula::localDispatch(BufferView * bv, kb_action action,
 
                        MathCursor::row_type row = mathcursor->hullRow();
                        string old_label = hull()->label(row);
-                       string new_label = arg;
+                       string new_label = ev.argument;
 
                        if (new_label.empty()) {
                                string const default_label =
@@ -343,7 +342,7 @@ InsetFormula::localDispatch(BufferView * bv, kb_action action,
                        int x;
                        int y;
                        mathcursor->getPos(x, y);
-                       mutate(arg);
+                       mutate(ev.argument);
                        mathcursor->setPos(x, y);
                        mathcursor->normalize();
                        updateLocal(bv, true);
@@ -354,7 +353,7 @@ InsetFormula::localDispatch(BufferView * bv, kb_action action,
                {
                        bv->lockedInsetStoreUndo(Undo::EDIT);
                        if (mathcursor)
-                               mathcursor->handleExtern(arg);
+                               mathcursor->handleExtern(ev.argument);
                        // re-compute inset dimension
                        metrics(bv);
                        updateLocal(bv, true);
@@ -379,13 +378,13 @@ InsetFormula::localDispatch(BufferView * bv, kb_action action,
                case LFUN_PASTESELECTION:
                {
                        string const clip = bv->getClipboard();
-               if (!clip.empty())
+                       if (!clip.empty())
                                mathed_parse_normal(par_, clip);
                        break;
                }
 
                default:
-                       result = InsetFormulaBase::localDispatch(bv, action, arg);
+                       result = InsetFormulaBase::localDispatch(bv, ev);
        }
 
        return result;
index 888e25f4f423fb8e7e94fabb44d66a250ff26637..1b1d66834ad2892e8804a69f586312ad6eee9cfc 100644 (file)
@@ -72,7 +72,7 @@ public:
        ///
        bool insetAllowed(Inset::Code code) const;
        ///
-       virtual RESULT localDispatch(BufferView *, kb_action, string const &);
+       virtual RESULT localDispatch(BufferView *, FuncRequest const &);
        ///
        std::vector<string> const getLabelList() const;
        ///
index 5952705d852e538471a937bf66295513db83a071..e7b46738dce2a9bf3bb744997bae5cef0b209213 100644 (file)
@@ -25,7 +25,7 @@
 #include "formula.h"
 #include "formulamacro.h"
 #include "lyxrc.h"
-#include "commandtags.h"
+#include "funcrequest.h"
 #include "BufferView.h"
 #include "lyxtext.h"
 #include "lyxfunc.h"
@@ -397,8 +397,7 @@ void InsetFormulaBase::insetMotionNotify(BufferView * bv,
 
 
 UpdatableInset::RESULT
-InsetFormulaBase::localDispatch(BufferView * bv, kb_action action,
-                           string const & arg)
+InsetFormulaBase::localDispatch(BufferView * bv, FuncRequest const & ev)
 {
        //lyxerr << "InsetFormulaBase::localDispatch: act: " << action
        //      << " arg: '" << arg
@@ -406,8 +405,8 @@ InsetFormulaBase::localDispatch(BufferView * bv, kb_action action,
 
        if (!mathcursor)
                return UNDISPATCHED;
-       string argument  = arg;
 
+       string argument    = ev.argument;
        RESULT result      = DISPATCHED;
        bool sel           = false;
        bool was_macro     = mathcursor->inMacroMode();
@@ -418,7 +417,7 @@ InsetFormulaBase::localDispatch(BufferView * bv, kb_action action,
        mathcursor->normalize();
        mathcursor->touch();
 
-       switch (action) {
+       switch (ev.action) {
 
        case LFUN_WORDRIGHTSEL:
        case LFUN_RIGHTSEL:
@@ -524,7 +523,7 @@ InsetFormulaBase::localDispatch(BufferView * bv, kb_action action,
                lyxerr << "LFUN_SETXY broken!\n";
                int x = 0;
                int y = 0;
-               istringstream is(arg.c_str());
+               istringstream is(ev.argument.c_str());
                is >> x >> y;
                mathcursor->setPos(x, y);
                updateLocal(bv, false);
@@ -553,7 +552,7 @@ InsetFormulaBase::localDispatch(BufferView * bv, kb_action action,
        // Special casing for superscript in case of LyX handling
        // dead-keys:
        case LFUN_CIRCUMFLEX:
-               if (arg.empty()) {
+               if (ev.argument.empty()) {
                        // do superscript if LyX handles
                        // deadkeys
                        bv->lockedInsetStoreUndo(Undo::EDIT);
@@ -579,27 +578,27 @@ InsetFormulaBase::localDispatch(BufferView * bv, kb_action action,
                break;
 
        //  Math fonts
-       case LFUN_GREEK_TOGGLE: handleFont(bv, arg, "lyxgreek"); break;
-       case LFUN_BOLD:         handleFont(bv, arg, "textbf"); break;
-       case LFUN_SANS:         handleFont(bv, arg, "textsf"); break;
-       case LFUN_EMPH:         handleFont(bv, arg, "mathcal"); break;
-       case LFUN_ROMAN:        handleFont(bv, arg, "mathrm"); break;
-       case LFUN_CODE:         handleFont(bv, arg, "texttt"); break;
-       case LFUN_FRAK:         handleFont(bv, arg, "mathfrak"); break;
-       case LFUN_ITAL:         handleFont(bv, arg, "mathit"); break;
-       case LFUN_NOUN:         handleFont(bv, arg, "mathbb"); break;
-       case LFUN_DEFAULT:      handleFont(bv, arg, "textnormal"); break;
-       case LFUN_FREE:         handleFont(bv, arg, "textrm"); break;
+       case LFUN_GREEK_TOGGLE: handleFont(bv, ev.argument, "lyxgreek"); break;
+       case LFUN_BOLD:         handleFont(bv, ev.argument, "textbf"); break;
+       case LFUN_SANS:         handleFont(bv, ev.argument, "textsf"); break;
+       case LFUN_EMPH:         handleFont(bv, ev.argument, "mathcal"); break;
+       case LFUN_ROMAN:        handleFont(bv, ev.argument, "mathrm"); break;
+       case LFUN_CODE:         handleFont(bv, ev.argument, "texttt"); break;
+       case LFUN_FRAK:         handleFont(bv, ev.argument, "mathfrak"); break;
+       case LFUN_ITAL:         handleFont(bv, ev.argument, "mathit"); break;
+       case LFUN_NOUN:         handleFont(bv, ev.argument, "mathbb"); break;
+       case LFUN_DEFAULT:      handleFont(bv, ev.argument, "textnormal"); break;
+       case LFUN_FREE:         handleFont(bv, ev.argument, "textrm"); break;
 
        case LFUN_GREEK:
-               handleFont(bv, arg, "lyxgreek1");
-               if (arg.size())
-                       mathcursor->interpret(arg);
+               handleFont(bv, ev.argument, "lyxgreek1");
+               if (ev.argument.size())
+                       mathcursor->interpret(ev.argument);
                break;
 
        case LFUN_MATH_MODE:
                if (mathcursor->currentMode()) {
-                       handleFont(bv, arg, "textrm");
+                       handleFont(bv, ev.argument, "textrm");
                } else {
                        mathcursor->niceInsert(MathAtom(new MathHullInset("simple")));
                        updateLocal(bv, true);
@@ -624,9 +623,9 @@ InsetFormulaBase::localDispatch(BufferView * bv, kb_action action,
                break;
 
        case LFUN_INSERT_MATRIX:
-               if (!arg.empty()) {
+               if (!ev.argument.empty()) {
                        bv->lockedInsetStoreUndo(Undo::EDIT);
-                       mathcursor->interpret("matrix " + arg);
+                       mathcursor->interpret("matrix " + ev.argument);
                        updateLocal(bv, true);
                }
                break;
@@ -635,7 +634,7 @@ InsetFormulaBase::localDispatch(BufferView * bv, kb_action action,
        case LFUN_SUBSCRIPT:
        {
                bv->lockedInsetStoreUndo(Undo::EDIT);
-               mathcursor->script(action == LFUN_SUPERSCRIPT);
+               mathcursor->script(ev.action == LFUN_SUPERSCRIPT);
                updateLocal(bv, true);
                break;
        }
@@ -644,7 +643,7 @@ InsetFormulaBase::localDispatch(BufferView * bv, kb_action action,
        {
                //lyxerr << "formulabase::LFUN_MATH_DELIM, arg: '" << arg << "'\n";
                string ls;
-               string rs = split(arg, ls, ' ');
+               string rs = split(ev.argument, ls, ' ');
                // Reasonable default values
                if (ls.empty())
                        ls = '(';
@@ -681,8 +680,8 @@ InsetFormulaBase::localDispatch(BufferView * bv, kb_action action,
                if (p) {
                        mathcursor->popToEnclosingGrid();
                        bv->lockedInsetStoreUndo(Undo::EDIT);
-                       char align = arg.size() ? arg[0] : 'c';
-                       switch (action) {
+                       char align = ev.argument.size() ? ev.argument[0] : 'c';
+                       switch (ev.action) {
                                case LFUN_MATH_HALIGN: p->halign(align, p->col(idx)); break;
                                case LFUN_MATH_VALIGN: p->valign(align); break;
                                case LFUN_MATH_ROW_INSERT: p->addRow(p->row(idx)); break;
@@ -757,13 +756,13 @@ InsetFormulaBase::localDispatch(BufferView * bv, kb_action action,
                //              updateInset(inset, true);
                //}
                //
-               if (arg.empty()) {
+               if (ev.argument.empty()) {
                        InsetCommandParams p("ref");
                        bv->owner()->getDialogs()->createRef(p.getAsString());
                } else {
                        //mathcursor->handleNest(new InsetRef2);
                        //mathcursor->insert(arg);
-                       mathcursor->insert(MathAtom(new RefInset(arg)));
+                       mathcursor->insert(MathAtom(new RefInset(ev.argument)));
                }
                updateLocal(bv, true);
                break;
@@ -941,8 +940,8 @@ void mathDispatchCreation(BufferView * bv, string const & arg, bool display)
                        // always changing to mathrm when opening an inlined inset
                        // -- I really hate "LyXfunc overloading"...
                        if (display)
-                               f->localDispatch(bv, LFUN_MATH_DISPLAY, string());
-                       f->localDispatch(bv, LFUN_INSERT_MATH, arg);
+                               f->localDispatch(bv, FuncRequest(LFUN_MATH_DISPLAY));
+                       f->localDispatch(bv, FuncRequest(LFUN_INSERT_MATH, arg));
                }
        } else {
                // create a macro if we see "\\newcommand" somewhere, and an ordinary
@@ -1000,7 +999,7 @@ void mathDispatchMathDelim(BufferView * bv, string const & arg)
        InsetFormula * f = new InsetFormula(bv);
        if (openNewInset(bv, f)) {
                f->mutate("simple");
-               bv->theLockingInset()->localDispatch(bv, LFUN_MATH_DELIM, arg);
+               bv->theLockingInset()->localDispatch(bv, FuncRequest(LFUN_MATH_DELIM, arg));
        }
 }
 
@@ -1012,7 +1011,7 @@ void mathDispatchInsertMatrix(BufferView * bv, string const & arg)
        InsetFormula * f = new InsetFormula(bv);
        if (openNewInset(bv, f)) {
                f->mutate("simple");
-               bv->theLockingInset()->localDispatch(bv, LFUN_INSERT_MATRIX, arg);
+               bv->theLockingInset()->localDispatch(bv, FuncRequest(LFUN_INSERT_MATRIX, arg));
        }
 }
 
@@ -1024,7 +1023,7 @@ void mathDispatchInsertMath(BufferView * bv, string const & arg)
        InsetFormula * f = new InsetFormula(bv);
        if (openNewInset(bv, f)) {
                f->mutate("simple");
-    bv->theLockingInset()->localDispatch(bv, LFUN_INSERT_MATH, arg);
+    bv->theLockingInset()->localDispatch(bv, FuncRequest(LFUN_INSERT_MATH, arg));
        }
 }
 
@@ -1036,7 +1035,7 @@ void mathDispatchGreek(BufferView * bv, string const & arg)
        InsetFormula * f = new InsetFormula(bv);
        if (openNewInset(bv, f)) {
                f->mutate("simple");
-               bv->theLockingInset()->localDispatch(bv, LFUN_GREEK, arg);
+               bv->theLockingInset()->localDispatch(bv, FuncRequest(LFUN_GREEK, arg));
                bv->unlockInset(f);
        }
 }
index 205f894ed0703a0c90bf5f43b9cd9969df542210..504c44c2808cf3c8dfc18fc234346d64c159db77 100644 (file)
@@ -24,7 +24,6 @@
 #include "lyxfont.h"
 
 #include <boost/weak_ptr.hpp>
-
 #include <iosfwd>
 
 class Buffer;
@@ -90,7 +89,7 @@ public:
        virtual void insetUnlock(BufferView *);
 
        /// To allow transparent use of math editing functions
-       virtual RESULT localDispatch(BufferView *, kb_action, string const &);
+       virtual RESULT localDispatch(BufferView *, FuncRequest const &);
 
        ///
        virtual std::vector<string> const getLabelList() const;
@@ -165,7 +164,7 @@ void mathDispatchGreek(BufferView *, string const &);
 //
 void mathDispatchMathImportSelection(BufferView *, string const &);
 //
-void mathDispatch(BufferView *, kb_action, string const &);
+void mathDispatch(BufferView *, FuncRequest const &);
 //
 void mathDispatch(BufferView *, string const &);
 
index 59b4df2c42c236ad782aab7ae461da3992aac869..34896fbaeb6bbfe5228b50b440a5a4bc96f30b6c 100644 (file)
@@ -524,7 +524,7 @@ LyXFont::FONT_SERIES const inh_series = LyXFont::INHERIT_SERIES;
 LyXFont::FONT_SHAPE  const inh_shape  = LyXFont::INHERIT_SHAPE; 
 
 
-// mathnormal should be the first, otherwise the fallback fuerther down
+// mathnormal should be the first, otherwise the fallback further down
 // does not work
 fontinfo fontinfos[] = {
        {"mathnormal",
index f748a22476d59575c9a44c69ab7fb26c81c02a38..aa433942e3f3c63e296d41b5c6e2264523666340 100644 (file)
@@ -2,7 +2,7 @@
 
 #include "ref_inset.h"
 #include "math_cursor.h"
-#include "commandtags.h"
+#include "funcrequest.h"
 #include "formulabase.h"
 #include "BufferView.h"
 #include "frontends/LyXView.h"
@@ -41,13 +41,13 @@ int RefInset::dispatch(string const & cmd, idx_type, pos_type)
        if (cmd == "mouse-3-release") {
                lyxerr << "trying to goto ref" << cell(0) << "\n";
                mathcursor->formula()->view()->owner()->getLyXFunc()->
-                       dispatch(LFUN_REF_GOTO, asString(cell(0)));
+                       dispatch(FuncRequest(LFUN_REF_GOTO, asString(cell(0))));
                return 1; // dispatched
        }
 
        if (cmd == "mouse-1-release") {
                lyxerr << "trying to open ref" << cell(0) << "\n";
-               // Eventually trigger dialog with button 3 not 1
+               // FuncRequestually trigger dialog with button 3 not 1
 //             mathcursor->formula()->view()->owner()->getDialogs()
 //                     ->showRef(this);
                return 1; // dispatched
index 8c8c92dbca4efc379938d20630f461478f6c63e5..e0398fb09d208bbf1f4032d86938a17ea6300169 100644 (file)
--- a/src/toc.C
+++ b/src/toc.C
@@ -48,7 +48,7 @@ string const TocItem::asString() const
 void TocItem::goTo(LyXView & lv_) const
 {
        string const tmp = tostr(par->id());
-       lv_.getLyXFunc()->dispatch(LFUN_GOTO_PARAGRAPH, tmp, false);
+       lv_.getLyXFunc()->dispatch(FuncRequest(LFUN_GOTO_PARAGRAPH, tmp));
 }