Get rid of LyXFunc::dispatch that takes a string.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7898 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2003-10-13 00:38:09 +00:00
parent 122e7616d7
commit 6cebb34085
12 changed files with 58 additions and 47 deletions

View 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...

View 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.

View 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);
}

View 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)
@ -21,11 +25,11 @@
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>

View 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();

View 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]:

View File

@ -21,9 +21,11 @@
#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) {

View 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;

View 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;
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"));
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));
if (ret == 0)
bv->owner()->dispatch(FuncRequest(LFUN_MENUWRITE));
return buf.isClean();
}
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;

View 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();

View 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:

View 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();