]> git.lyx.org Git - features.git/commitdiff
Get rid of LyXFunc::dispatch that takes a string.
authorLars Gullik Bjønnes <larsbj@gullik.org>
Mon, 13 Oct 2003 00:38:09 +0000 (00:38 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Mon, 13 Oct 2003 00:38:09 +0000 (00:38 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7898 a592a061-630c-0410-9148-cb99ea01b6c8

12 files changed:
src/ChangeLog
src/frontends/controllers/ChangeLog
src/frontends/controllers/ControlCommandBuffer.C
src/frontends/qt2/ChangeLog
src/frontends/qt2/lyx_gui.C
src/frontends/xforms/ChangeLog
src/frontends/xforms/lyx_gui.C
src/insets/insettext.C
src/lyxfunc.C
src/lyxfunc.h
src/lyxserver.C
src/text2.C

index eece3490916df311d7052ab0e6256bc4c5ff61b6..dea28c94be0bddef05044f2bf940a4f0746da2a8 100644 (file)
@@ -1,3 +1,11 @@
+2003-10-13  Lars Gullik Bjønnes  <larsbj@gullik.net>
+
+       * lyxserver.C (callback): adjust
+
+       * lyxfunc.C (getStatus): add a missing brace in commented code
+       (ensureBufferClean): reindent
+       (dispatch): delete version taking a string
+
 2003-10-11  Lars Gullik Bjønnes  <larsbj@gullik.net>
 
        * LaTeX.C (deplog): move found file handlig from here...
index 152a2e64d0fb66a207015d8de19dfb79e2ed8fac..6d4bc5ef96c6e3624e514576aeaff389951e61fe 100644 (file)
@@ -1,3 +1,7 @@
+2003-10-13  Lars Gullik Bjønnes  <larsbj@gullik.net>
+
+       * ControlCommandBuffer.C (dispatch): adjust for dispatch change
+
 2003-10-08  Angus Leeming  <leeming@lyx.org>
 
        Fix doxygen warnings.
index 4b8c3576ea3f02c1a991e838dc8a421ca2417f84..c64f1a731f916f200b0f3f6abf91a7bb4bd9ec7d 100644 (file)
@@ -16,6 +16,7 @@
 #include "bufferview_funcs.h"
 #include "lyxfunc.h"
 #include "LyXAction.h"
+#include "funcrequest.h"
 #include "frontends/LyXView.h"
 #include "support/lyxalgo.h"
 #include "support/lstrings.h"
@@ -124,5 +125,5 @@ void ControlCommandBuffer::dispatch(string const & str)
 
        history_.push_back(str);
        history_pos_ = history_.end();
-       lv_.getLyXFunc().dispatch(str, true);
+       lv_.getLyXFunc().dispatch(lyxaction.lookupFunc(str), true);
 }
index 9fd97273bf7ba49d08aed60fc6394219a4d9cec4..40bf47a5aed1917264285b41ab9a7787c689b709 100644 (file)
@@ -1,3 +1,7 @@
+2003-10-13  Lars Gullik Bjønnes  <larsbj@gullik.net>
+
+       * lyx_gui.C (start): adjust for distpatch change
+
 2003-10-08  Jean-Marc Lasgouttes  <lasgouttes@lyx.org>
 
        * qfont_loader.C: add #include (needed for LyX/Mac)
 
 2003-10-06  Michael Schmitt  <michael.schmitt@teststep.org>
 
-       * QDelimiterDialog.h: 
-       * QMathDialog.h: 
-       * QSearchDialog.h: 
-       * floatplacement.h: 
-       * iconpalette.h: 
+       * QDelimiterDialog.h:
+       * QMathDialog.h:
+       * QSearchDialog.h:
+       * floatplacement.h:
+       * iconpalette.h:
        * panelstack.h: add #include <string>.
 
 2003-10-01  Vitaly Lipatov  <lav@vl3143.spb.edu>
index bd252f01c33537fd425aaebc437b439f8fe86f60..0b1a1fa4051dde39d998ff2c1e3b42e9fc4edb90 100644 (file)
@@ -21,6 +21,7 @@
 
 // FIXME: move this stuff out again
 #include "bufferlist.h"
+#include "LyXAction.h"
 #include "lyxfunc.h"
 #include "lyxrc.h"
 #include "lyxserver.h"
@@ -145,7 +146,7 @@ void start(string const & batch, vector<string> const & files)
 
        // handle the batch commands the user asked for
        if (!batch.empty()) {
-               view.getLyXFunc().dispatch(batch);
+               view.getLyXFunc().dispatch(lyxaction.lookupFunc(batch));
        }
 
        qApp->exec();
index 30a76c46964b54651b6da347631a94d778681e81..8bca6e674f2a798f3c38c984dee5861990d69b53 100644 (file)
@@ -1,3 +1,7 @@
+2003-10-13  Lars Gullik Bjønnes  <larsbj@gullik.net>
+
+       * lyx_gui.C (start): adjust for dispatch change
+
 2003-10-07  Angus Leeming  <leeming@lyx.org>
 
        * FormExternal.[Ch]:
index 0a2b331057d128b62c3207aec2784d1c84c02db6..29e851a86beb1ff10c9fbde5c9ff703c11ec8842 100644 (file)
 #include "bufferlist.h"
 #include "BufferView.h"
 #include "debug.h"
+#include "funcrequest.h"
 #include "gettext.h"
 #include "LColor.h"
 #include "lyx_main.h"
+#include "LyXAction.h"
 #include "lyxfunc.h"
 #include "lyxrc.h"
 #include "lyxserver.h"
@@ -295,7 +297,7 @@ void start(string const & batch, vector<string> const & files)
 
        // handle the batch commands the user asked for
        if (!batch.empty())
-               view.getLyXFunc().dispatch(batch);
+               view.getLyXFunc().dispatch(lyxaction.lookupFunc(batch));
 
        // enter the event loop
        while (!finished) {
index 921289d1cd057afb241156d3a2ae2b7eefdc2121..6b3bede4da0b2f116486d7544e06ed155d4c4f2d 100644 (file)
@@ -399,7 +399,7 @@ bool InsetText::lockInsetInInset(BufferView * bv, UpdatableInset * inset)
                        for (; it != end; ++it) {
                                if (it->inset == inset) {
                                        lyxerr << "InsetText::lockInsetInInset: 1 a" << endl;
-                                       text_.setCursorIntern(  
+                                       text_.setCursorIntern(
                                                std::distance(paragraphs.begin(), pit), it->pos);
                                        lyxerr << "InsetText::lockInsetInInset: 1 b" << endl;
                                        lyxerr << "bv: " << bv << " inset: " << inset << endl;
@@ -615,7 +615,7 @@ InsetOld::RESULT InsetText::localDispatch(FuncRequest const & cmd)
                if (cmd.argument.size()) {
                        if (cmd.argument == "left")
                                text_.setCursorIntern(0, 0);
-                       else 
+                       else
                                text_.setCursor(paragraphs.size() - 1, paragraphs.back().size());
                } else {
                        int tmp_y = (cmd.y < 0) ? 0 : cmd.y;
index 43f9b421536b228f686a609fbaad83e7c2e4e238..25f67589a50d3ebdd1ef4683ef94fe450ce67751 100644 (file)
@@ -400,7 +400,7 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & ev) const
                                break;
                        }
                        flag.setOnOff(ev.argument[0] == align);
-               } else
+               } else {
                        disable = true;
 
                        char align = mathcursor->halign();
@@ -817,39 +817,27 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & ev) const
 }
 
 
-void LyXFunc::dispatch(string const & s, bool verbose)
-{
-       FuncRequest func = lyxaction.lookupFunc(s);
-
-       if (func.action == LFUN_UNKNOWN_ACTION) {
-               owner->message(bformat(_("Unknown function (%1$s)"), s));
-               return;
-       }
-
-       dispatch(func, verbose);
-}
-
-
 namespace {
-       bool ensureBufferClean(BufferView * bv) {
-
-               Buffer & buf = *bv->buffer();
-               if (buf.isClean())
-                       return true;
-
-               string const file = MakeDisplayPath(buf.fileName(), 30);
-               string text = bformat(_("The document %1$s has unsaved "
-                                       "changes.\n\nDo you want to save "
-                                       "the document?"), file);
-               int const ret = Alert::prompt(_("Save changed document?"),
-                                             text, 0, 1, _("&Save"),
-                                             _("&Cancel"));
-
-               if (ret == 0)
-                       bv->owner()->dispatch(FuncRequest(LFUN_MENUWRITE));
 
-               return buf.isClean();
-       }
+bool ensureBufferClean(BufferView * bv)
+{
+       Buffer & buf = *bv->buffer();
+       if (buf.isClean())
+               return true;
+
+       string const file = MakeDisplayPath(buf.fileName(), 30);
+       string text = bformat(_("The document %1$s has unsaved "
+                               "changes.\n\nDo you want to save "
+                               "the document?"), file);
+       int const ret = Alert::prompt(_("Save changed document?"),
+                                     text, 0, 1, _("&Save"),
+                                     _("&Cancel"));
+
+       if (ret == 0)
+               bv->owner()->dispatch(FuncRequest(LFUN_MENUWRITE));
+
+       return buf.isClean();
+}
 
 } //namespace anon
 
@@ -953,7 +941,7 @@ void LyXFunc::dispatch(FuncRequest const & func, bool verbose)
                                // FINISHED means that the cursor should be
                                // one position after the inset.
                        }
-               
+
                        if (result == FINISHED_RIGHT) {
                                view()->text->cursorRight(view());
                                moveCursorUpdate();
@@ -980,7 +968,7 @@ void LyXFunc::dispatch(FuncRequest const & func, bool verbose)
                                owner->clearMessage();
                                goto exit_with_message;
                        }
-               
+
                        if (result == FINISHED_DOWN) {
                                RowList::iterator const irow = view()->text->cursorIRow();
                                if (irow != view()->text->lastRow()) {
@@ -1568,7 +1556,7 @@ void LyXFunc::dispatch(FuncRequest const & func, bool verbose)
                while (!argument.empty()) {
                        string first;
                        argument = split(argument, first, ';');
-                       dispatch(first);
+                       dispatch(lyxaction.lookupFunc(first));
                }
        }
        break;
index 21d34fda034c78fe045db3967a8b3f2178f8cb53..f42e1954ebadd0526c9a314018d0d375a15b5c3a 100644 (file)
@@ -45,9 +45,6 @@ public:
        /// LyX dispatcher, executes lyx actions.
        void dispatch(FuncRequest const &, bool verbose = false);
 
-       /// Dispatch via a string argument
-       void dispatch(std::string const & s, bool verbose = false);
-
        /// return the status bar state string
        std::string const view_status_message();
 
index e0f4336f35e3c60ec2b02d3515664aa1414aae19..d258cb5474e5621c99c32672b106137bedb602c0 100644 (file)
@@ -41,6 +41,8 @@
 
 #include "lyxserver.h"
 #include "debug.h"
+#include "funcrequest.h"
+#include "LyXAction.h"
 #include "lyxfunc.h"
 #include "support/lstrings.h"
 #include "support/lyxlib.h"
@@ -481,7 +483,7 @@ void LyXServer::callback(LyXServer * serv, string const & msg)
                        // support currently. (Lgb)
 
 
-                       serv->func->dispatch(cmd + ' ' + arg);
+                       serv->func->dispatch(FuncRequest(lyxaction.lookupFunc(cmd), arg));
                        string const rval = serv->func->getMessage();
 
                        //modified june 1999 stefano@zool.su.se:
index 44d48676963b0ba362c6294f9872966b662c7db5..e3994ced4f73dbe98d570a5ca4f59b3e74a801bc 100644 (file)
@@ -1894,7 +1894,7 @@ bool LyXText::deleteEmptyParagraphMechanism(LyXCursor const & old_cursor)
 
                deleted = true;
 
-               bool selection_position_was_oldcursor_position = 
+               bool selection_position_was_oldcursor_position =
                        selection.cursor.par() == old_cursor.par()
                        && selection.cursor.pos() == old_cursor.pos();