make dispatch_result_t ctor of DispatchResult explicit

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8004 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2003-10-29 19:19:27 +00:00
parent a3236d4c95
commit a7060da197
44 changed files with 308 additions and 257 deletions

View File

@ -1279,7 +1279,7 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev_in)
break;
default:
return bv_->getLyXText()->dispatch(FuncRequest(ev, bv_)) >= DISPATCHED;
return bv_->getLyXText()->dispatch(FuncRequest(ev, bv_)) >= DispatchResult(DISPATCHED);
} // end of switch
return true;

View File

@ -1,3 +1,12 @@
2003-10-29 Lars Gullik Bjønnes <larsbj@gullik.net>
* text3.C (dispatch):
* lyxfunc.C (dispatch):
* cursor.C (dispatch):
* BufferView_pimpl.C (dispatch): explict DispatchResult ctor fallout.
* dispatchresult.h: make the dispatch_result_t ctor explicit
2003-10-29 Martin Vermeer <martin.vermeer@hut.fi>
* sgml.[Ch]:
@ -17,7 +26,7 @@
removal. comment out call to update
* BufferView_pimpl.C (dispatch): dont implicit covert to bool
2003-10-29 Lars Gullik Bjønnes <larsbj@gullik.net>
* text3.C:
@ -27,7 +36,7 @@
* lyxfunc.C:
* cursor.C:
* BufferView_pimpl.C: dispatch_result -> DispatchResult changes.
(dispatch):
(dispatch):
* dispatchresult.h: new file, DispatchResult broken out of
insets/insetbase.h

View File

@ -1765,8 +1765,8 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
// environment tag closing
for (; depth > par->params().depth(); --depth) {
if (!environment_inner[depth].empty())
sgml::closeEnvTags(ofs, false, environment_inner[depth],
if (!environment_inner[depth].empty())
sgml::closeEnvTags(ofs, false, environment_inner[depth],
command_depth + depth);
sgml::closeTag(ofs, depth + command_depth, false, environment_stack[depth]);
environment_stack[depth].erase();
@ -1776,7 +1776,7 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
if (depth == par->params().depth()
&& environment_stack[depth] != style->latexname()
&& !environment_stack[depth].empty()) {
sgml::closeEnvTags(ofs, false, environment_inner[depth],
sgml::closeEnvTags(ofs, false, environment_inner[depth],
command_depth + depth);
sgml::closeTag(ofs, depth + command_depth, false, environment_stack[depth]);
@ -1864,7 +1864,7 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
environment_inner[depth] = "!-- --";
sgml::openTag(ofs, depth + command_depth, false, environment_stack[depth]);
} else {
sgml::closeEnvTags(ofs, false, environment_inner[depth],
sgml::closeEnvTags(ofs, false, environment_inner[depth],
command_depth + depth);
}
@ -1930,7 +1930,7 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
// Close open tags
for (int d = depth; d >= 0; --d) {
if (!environment_stack[depth].empty()) {
sgml::closeEnvTags(ofs, false, environment_inner[depth],
sgml::closeEnvTags(ofs, false, environment_inner[depth],
command_depth + depth);
}
}

View File

@ -32,17 +32,17 @@ DispatchResult Cursor::dispatch(FuncRequest const & cmd)
DispatchResult res = data_[i].inset_->dispatch(cmd);
lyxerr << " result: " << res.val() << endl;
if (res == DISPATCHED) {
if (res == DispatchResult(DISPATCHED)) {
//update();
return DISPATCHED;
return DispatchResult(DISPATCHED);
}
if (res == DISPATCHED_NOUPDATE)
return DISPATCHED;
if (res == DispatchResult(DISPATCHED_NOUPDATE))
return DispatchResult(DISPATCHED);
lyxerr << "# unhandled result: " << res.val() << endl;
}
return UNDISPATCHED;
return DispatchResult(UNDISPATCHED);
}

View File

@ -46,6 +46,7 @@ class DispatchResult {
public:
DispatchResult()
: val_(UNDISPATCHED) {}
explicit
DispatchResult(dispatch_result_t val) : val_(val) {}
dispatch_result_t val() const { return val_; }
private:

View File

@ -1,3 +1,33 @@
2003-10-29 Lars Gullik Bjønnes <larsbj@gullik.net>
* updatableinset.C (priv_dispatch):
* insetwrap.C (priv_dispatch):
* inseturl.C (priv_dispatch):
* insettoc.C (priv_dispatch):
* insettext.C (lfunMouseRelease, priv_dispatch, moveRightIntern)
(moveLeftIntern, moveUp, moveDown):
* insettabular.C (lfunMouseRelease, priv_dispatch, moveRight)
(moveLeft, moveUp, moveDown):
* insetref.C (priv_dispatch):
* insetnote.C (priv_dispatch):
* insetminipage.C (priv_dispatch):
* insetlabel.C (priv_dispatch):
* insetindex.C (priv_dispatch):
* insetinclude.C (priv_dispatch):
* insetgraphics.C (priv_dispatch):
* insetfloatlist.C (priv_dispatch):
* insetfloat.C (priv_dispatch):
* insetexternal.C (priv_dispatch):
* insetert.C (priv_dispatch):
* insetcommand.C (priv_dispatch):
* insetcollapsable.C (lfunMouseRelease, priv_dispatch):
* insetcite.C (priv_dispatch):
* insetbranch.C (priv_dispatch):
* insetbox.C (priv_dispatch):
* insetbibtex.C (priv_dispatch):
* insetbibitem.C (priv_dispatch):
* insetbase.C (priv_dispatch): explict DispatchResult ctor fallout.
2003-10-29 Martin Vermeer <martin.vermeer@hut.fi>
* insettext.C: small refactoring of docbook stuff

View File

@ -33,5 +33,5 @@ InsetBase::dispatch(FuncRequest const & f)
DispatchResult
InsetBase::priv_dispatch(FuncRequest const &, idx_type &, pos_type &)
{
return UNDISPATCHED;
return DispatchResult(UNDISPATCHED);
}

View File

@ -67,17 +67,17 @@ InsetBibitem::priv_dispatch(FuncRequest const & cmd,
case LFUN_INSET_EDIT:
InsetCommandMailer("bibitem", *this).showDialog(cmd.view());
return DISPATCHED;
return DispatchResult(DISPATCHED);
case LFUN_INSET_MODIFY: {
InsetCommandParams p;
InsetCommandMailer::string2params(cmd.argument, p);
if (p.getCmdName().empty())
return DISPATCHED;
return DispatchResult(DISPATCHED);
setParams(p);
cmd.view()->updateInset(this);
cmd.view()->fitCursor();
return DISPATCHED;
return DispatchResult(DISPATCHED);
}
default:

View File

@ -96,19 +96,19 @@ InsetBibtex::priv_dispatch(FuncRequest const & cmd,
case LFUN_INSET_DIALOG_SHOW:
InsetCommandMailer("bibtex", *this).showDialog(cmd.view());
return DISPATCHED;
return DispatchResult(DISPATCHED);
case LFUN_MOUSE_RELEASE:
if (button().box().contains(cmd.x, cmd.y))
InsetCommandMailer("bibtex", *this).showDialog(cmd.view());
return DISPATCHED;
return DispatchResult(DISPATCHED);
case LFUN_INSET_MODIFY: {
InsetCommandParams p;
InsetCommandMailer::string2params(cmd.argument, p);
if (p.getCmdName().empty())
return DISPATCHED;
return DispatchResult(DISPATCHED);
setParams(p);
return DISPATCHED;
return DispatchResult(DISPATCHED);
}
default:

View File

@ -177,16 +177,16 @@ InsetBox::priv_dispatch(FuncRequest const & cmd,
InsetBoxMailer::string2params(cmd.argument, params_);
setButtonLabel();
bv->updateInset(this);
return DISPATCHED;
return DispatchResult(DISPATCHED);
}
case LFUN_INSET_DIALOG_UPDATE:
InsetBoxMailer(*this).updateDialog(bv);
return DISPATCHED;
return DispatchResult(DISPATCHED);
case LFUN_MOUSE_RELEASE:
if (cmd.button() == mouse_button::button3 && hitButton(cmd)) {
InsetBoxMailer(*this).showDialog(bv);
return DISPATCHED;
return DispatchResult(DISPATCHED);
}
// fallthrough:

View File

@ -130,20 +130,20 @@ InsetBranch::priv_dispatch(FuncRequest const & cmd,
params_.branch = params.branch;
setButtonLabel();
bv->updateInset(this);
return DISPATCHED;
return DispatchResult(DISPATCHED);
}
case LFUN_INSET_EDIT:
if (cmd.button() != mouse_button::button3)
return InsetCollapsable::priv_dispatch(cmd, idx, pos);
return UNDISPATCHED;
return DispatchResult(UNDISPATCHED);
case LFUN_INSET_DIALOG_UPDATE:
InsetBranchMailer("branch", *this).updateDialog(bv);
return DISPATCHED;
return DispatchResult(DISPATCHED);
case LFUN_MOUSE_RELEASE:
if (cmd.button() == mouse_button::button3 && hitButton(cmd)) {
InsetBranchMailer("branch", *this).showDialog(bv);
return DISPATCHED;
return DispatchResult(DISPATCHED);
}
// fallthrough:
default:

View File

@ -316,7 +316,7 @@ InsetCitation::priv_dispatch(FuncRequest const & cmd,
switch (cmd.action) {
case LFUN_INSET_EDIT:
InsetCommandMailer("citation", *this).showDialog(cmd.view());
return DISPATCHED;
return DispatchResult(DISPATCHED);
default:
return InsetCommand::priv_dispatch(cmd, idx, pos);

View File

@ -234,7 +234,7 @@ void InsetCollapsable::lfunMouseRelease(FuncRequest const & cmd)
bv->updateInset(this);
bv->buffer()->markDirty();
} else if (!collapsed_ && cmd.y > button_dim.y2) {
ret = inset.dispatch(adjustCommand(cmd)) == DISPATCHED;
ret = inset.dispatch(adjustCommand(cmd)) == DispatchResult(DISPATCHED);
}
if (cmd.button() == mouse_button::button3 && !ret)
showInsetDialog(bv);
@ -307,14 +307,14 @@ InsetCollapsable::priv_dispatch(FuncRequest const & cmd,
if (bv->lockInset(this))
inset.dispatch(cmd);
}
return DISPATCHED;
return DispatchResult(DISPATCHED);
}
#ifdef WITH_WARNINGS
#warning Fix this properly in BufferView_pimpl::workAreaButtonRelease
#endif
if (cmd.button() == mouse_button::button3)
return DISPATCHED;
return DispatchResult(DISPATCHED);
UpdatableInset::priv_dispatch(cmd, idx, pos);
@ -324,13 +324,13 @@ InsetCollapsable::priv_dispatch(FuncRequest const & cmd,
// it was already collapsed!
first_after_edit = true;
if (!bv->lockInset(this))
return DISPATCHED;
return DispatchResult(DISPATCHED);
bv->updateInset(this);
bv->buffer()->markDirty();
inset.dispatch(cmd);
} else {
if (!bv->lockInset(this))
return DISPATCHED;
return DispatchResult(DISPATCHED);
if (cmd.y <= button_dim.y2) {
FuncRequest cmd1 = cmd;
cmd1.y = 0;
@ -338,26 +338,26 @@ InsetCollapsable::priv_dispatch(FuncRequest const & cmd,
} else
inset.dispatch(adjustCommand(cmd));
}
return DISPATCHED;
return DispatchResult(DISPATCHED);
}
case LFUN_MOUSE_PRESS:
if (!collapsed_ && cmd.y > button_dim.y2)
inset.dispatch(adjustCommand(cmd));
return DISPATCHED;
return DispatchResult(DISPATCHED);
case LFUN_MOUSE_MOTION:
if (!collapsed_ && cmd.y > button_dim.y2)
inset.dispatch(adjustCommand(cmd));
return DISPATCHED;
return DispatchResult(DISPATCHED);
case LFUN_MOUSE_RELEASE:
lfunMouseRelease(cmd);
return DISPATCHED;
return DispatchResult(DISPATCHED);
default:
DispatchResult result = inset.dispatch(cmd);
if (result >= FINISHED)
if (result >= DispatchResult(FINISHED))
bv->unlockInset(this);
first_after_edit = false;
return result;

View File

@ -93,22 +93,22 @@ InsetCommand::priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &)
InsetCommandParams p;
InsetCommandMailer::string2params(cmd.argument, p);
if (p.getCmdName().empty())
return UNDISPATCHED;
return DispatchResult(UNDISPATCHED);
setParams(p);
cmd.view()->updateInset(this);
return DISPATCHED;
return DispatchResult(DISPATCHED);
}
case LFUN_INSET_DIALOG_UPDATE:
InsetCommandMailer(cmd.argument, *this).updateDialog(cmd.view());
return DISPATCHED;
return DispatchResult(DISPATCHED);
case LFUN_MOUSE_RELEASE:
return dispatch(FuncRequest(cmd.view(), LFUN_INSET_EDIT));
default:
return UNDISPATCHED;
return DispatchResult(UNDISPATCHED);
}
}

View File

@ -426,7 +426,7 @@ DispatchResult
InsetERT::priv_dispatch(FuncRequest const & cmd,
idx_type & idx, pos_type & pos)
{
DispatchResult result = UNDISPATCHED;
DispatchResult result = DispatchResult(UNDISPATCHED);
BufferView * bv = cmd.view();
if (inset.paragraphs.begin()->empty()) {
@ -463,28 +463,28 @@ InsetERT::priv_dispatch(FuncRequest const & cmd,
*/
inset.getLyXText(cmd.view())->fullRebreak();
bv->updateInset(this);
result = DISPATCHED;
result = DispatchResult(DISPATCHED);
}
break;
case LFUN_MOUSE_PRESS:
lfunMousePress(cmd);
result = DISPATCHED;
result = DispatchResult(DISPATCHED);
break;
case LFUN_MOUSE_MOTION:
lfunMouseMotion(cmd);
result = DISPATCHED;
result = DispatchResult(DISPATCHED);
break;
case LFUN_MOUSE_RELEASE:
lfunMouseRelease(cmd);
result = DISPATCHED;
result = DispatchResult(DISPATCHED);
break;
case LFUN_LAYOUT:
bv->owner()->setLayout(inset.paragraphs.begin()->layout()->name());
result = DISPATCHED_NOUPDATE;
result = DispatchResult(DISPATCHED_NOUPDATE);
break;
default:

View File

@ -439,7 +439,7 @@ InsetExternal::priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &)
InsetExternalParams p;
InsetExternalMailer::string2params(cmd.argument, buffer, p);
external::editExternal(p, buffer);
return DISPATCHED_NOUPDATE;
return DispatchResult(DISPATCHED_NOUPDATE);
}
case LFUN_INSET_MODIFY: {
@ -450,20 +450,20 @@ InsetExternal::priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &)
InsetExternalMailer::string2params(cmd.argument, buffer, p);
setParams(p, buffer);
cmd.view()->updateInset(this);
return DISPATCHED;
return DispatchResult(DISPATCHED);
}
case LFUN_INSET_DIALOG_UPDATE:
InsetExternalMailer(*this).updateDialog(cmd.view());
return DISPATCHED;
return DispatchResult(DISPATCHED);
case LFUN_MOUSE_RELEASE:
case LFUN_INSET_EDIT:
InsetExternalMailer(*this).showDialog(cmd.view());
return DISPATCHED;
return DispatchResult(DISPATCHED);
default:
return UNDISPATCHED;
return DispatchResult(UNDISPATCHED);
}
}

View File

@ -175,12 +175,12 @@ InsetFloat::priv_dispatch(FuncRequest const & cmd,
wide(params_.wide, cmd.view()->buffer()->params());
cmd.view()->updateInset(this);
return DISPATCHED;
return DispatchResult(DISPATCHED);
}
case LFUN_INSET_DIALOG_UPDATE: {
InsetFloatMailer(*this).updateDialog(cmd.view());
return DISPATCHED;
return DispatchResult(DISPATCHED);
}
default:

View File

@ -127,11 +127,11 @@ InsetFloatList::priv_dispatch(FuncRequest const & cmd,
case LFUN_MOUSE_RELEASE:
if (button().box().contains(cmd.x, cmd.y))
InsetCommandMailer("toc", *this).showDialog(cmd.view());
return DISPATCHED;
return DispatchResult(DISPATCHED);
case LFUN_INSET_DIALOG_SHOW:
InsetCommandMailer("toc", *this).showDialog(cmd.view());
return DISPATCHED;
return DispatchResult(DISPATCHED);
default:
return InsetCommand::priv_dispatch(cmd, idx, pos);

View File

@ -203,20 +203,20 @@ InsetGraphics::priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &)
setParams(p);
cmd.view()->updateInset(this);
}
return DISPATCHED;
return DispatchResult(DISPATCHED);
}
case LFUN_INSET_DIALOG_UPDATE:
InsetGraphicsMailer(*this).updateDialog(cmd.view());
return DISPATCHED;
return DispatchResult(DISPATCHED);
case LFUN_INSET_EDIT:
case LFUN_MOUSE_RELEASE:
InsetGraphicsMailer(*this).showDialog(cmd.view());
return DISPATCHED;
return DispatchResult(DISPATCHED);
default:
return UNDISPATCHED;
return DispatchResult(UNDISPATCHED);
}
}

View File

@ -120,24 +120,24 @@ InsetInclude::priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &)
set(p, *cmd.view()->buffer());
cmd.view()->updateInset(this);
}
return DISPATCHED;
return DispatchResult(DISPATCHED);
}
case LFUN_INSET_DIALOG_UPDATE:
InsetIncludeMailer(*this).updateDialog(cmd.view());
return DISPATCHED;
return DispatchResult(DISPATCHED);
case LFUN_MOUSE_RELEASE:
if (button_.box().contains(cmd.x, cmd.y))
InsetIncludeMailer(*this).showDialog(cmd.view());
return DISPATCHED;
return DispatchResult(DISPATCHED);
case LFUN_INSET_DIALOG_SHOW:
InsetIncludeMailer(*this).showDialog(cmd.view());
return DISPATCHED;
return DispatchResult(DISPATCHED);
default:
return UNDISPATCHED;
return DispatchResult(UNDISPATCHED);
}
}

View File

@ -68,7 +68,7 @@ InsetIndex::priv_dispatch(FuncRequest const & cmd,
switch (cmd.action) {
case LFUN_INSET_EDIT:
InsetCommandMailer("index", *this).showDialog(cmd.view());
return DISPATCHED;
return DispatchResult(DISPATCHED);
default:
return InsetCommand::priv_dispatch(cmd, idx, pos);

View File

@ -68,14 +68,14 @@ InsetLabel::priv_dispatch(FuncRequest const & cmd,
case LFUN_INSET_EDIT:
InsetCommandMailer("label", *this).showDialog(bv);
return DISPATCHED;
return DispatchResult(DISPATCHED);
break;
case LFUN_INSET_MODIFY: {
InsetCommandParams p;
InsetCommandMailer::string2params(cmd.argument, p);
if (p.getCmdName().empty())
return UNDISPATCHED;
return DispatchResult(UNDISPATCHED);
bool clean = true;
if (bv && p.getContents() != params().getContents()) {
@ -85,7 +85,7 @@ InsetLabel::priv_dispatch(FuncRequest const & cmd,
setParams(p);
bv->updateInset(this);
return DISPATCHED;
return DispatchResult(DISPATCHED);
}
default:

View File

@ -112,12 +112,12 @@ InsetMinipage::priv_dispatch(FuncRequest const & cmd,
* with ugliness like this ... */
inset.getLyXText(cmd.view())->fullRebreak();
cmd.view()->updateInset(this);
return DISPATCHED;
return DispatchResult(DISPATCHED);
}
case LFUN_INSET_DIALOG_UPDATE:
InsetMinipageMailer(*this).updateDialog(cmd.view());
return DISPATCHED;
return DispatchResult(DISPATCHED);
default:
return InsetCollapsable::priv_dispatch(cmd, idx, pos);

View File

@ -142,22 +142,22 @@ InsetNote::priv_dispatch(FuncRequest const & cmd,
InsetNoteMailer::string2params(cmd.argument, params_);
setButtonLabel();
bv->updateInset(this);
return DISPATCHED;
return DispatchResult(DISPATCHED);
}
case LFUN_INSET_EDIT:
if (cmd.button() == mouse_button::button3)
return UNDISPATCHED;
return DispatchResult(UNDISPATCHED);
return InsetCollapsable::priv_dispatch(cmd, idx, pos);
case LFUN_INSET_DIALOG_UPDATE:
InsetNoteMailer("note", *this).updateDialog(bv);
return DISPATCHED;
return DispatchResult(DISPATCHED);
case LFUN_MOUSE_RELEASE:
if (cmd.button() == mouse_button::button3 && hitButton(cmd)) {
InsetNoteMailer("note", *this).showDialog(bv);
return DISPATCHED;
return DispatchResult(DISPATCHED);
}
// fallthrough:

View File

@ -58,7 +58,7 @@ InsetRef::priv_dispatch(FuncRequest const & cmd,
dispatch(FuncRequest(LFUN_REF_GOTO, getContents()));
else
InsetCommandMailer("ref", *this).showDialog(cmd.view());
return DISPATCHED;
return DispatchResult(DISPATCHED);
default:
return InsetCommand::priv_dispatch(cmd, idx, pos);

View File

@ -598,18 +598,18 @@ void InsetTabular::lfunMousePress(FuncRequest const & cmd)
bool InsetTabular::lfunMouseRelease(FuncRequest const & cmd)
{
DispatchResult ret = UNDISPATCHED;
DispatchResult ret = DispatchResult(UNDISPATCHED);
if (the_locking_inset) {
FuncRequest cmd1 = cmd;
cmd1.x -= inset_x;
cmd1.y -= inset_y;
ret = the_locking_inset->dispatch(cmd1);
}
if (cmd.button() == mouse_button::button3 && ret == UNDISPATCHED) {
if (cmd.button() == mouse_button::button3 && ret == DispatchResult(UNDISPATCHED)) {
InsetTabularMailer(*this).showDialog(cmd.view());
return true;
}
return ret >= DISPATCHED;
return ret >= DispatchResult(DISPATCHED);
}
@ -679,7 +679,7 @@ InsetTabular::priv_dispatch(FuncRequest const & cmd,
if (!bv->lockInset(this)) {
lyxerr << "InsetTabular::Cannot lock inset" << endl;
return DISPATCHED;
return DispatchResult(DISPATCHED);
}
finishUndo();
@ -715,34 +715,34 @@ InsetTabular::priv_dispatch(FuncRequest const & cmd,
activateCellInset(bv, cmd.x - inset_x, cmd.y - inset_y, cmd.button());
}
}
return DISPATCHED;
return DispatchResult(DISPATCHED);
}
if (result == DISPATCHED || result == DISPATCHED_NOUPDATE) {
if (result == DispatchResult(DISPATCHED) || result == DispatchResult(DISPATCHED_NOUPDATE)) {
resetPos(bv);
return result;
}
if (cmd.action < 0 && cmd.argument.empty())
return FINISHED;
return DispatchResult(FINISHED);
bool hs = hasSelection();
result = DISPATCHED;
result = DispatchResult(DISPATCHED);
// this one have priority over the locked InsetText, if we're not already
// inside another tabular then that one get's priority!
if (getFirstLockingInsetOfType(InsetOld::TABULAR_CODE) == this) {
switch (cmd.action) {
case LFUN_MOUSE_PRESS:
lfunMousePress(cmd);
return DISPATCHED;
return DispatchResult(DISPATCHED);
case LFUN_MOUSE_MOTION:
lfunMouseMotion(cmd);
return DISPATCHED;
return DispatchResult(DISPATCHED);
case LFUN_MOUSE_RELEASE:
return lfunMouseRelease(cmd) ? DISPATCHED : UNDISPATCHED;
return lfunMouseRelease(cmd) ? DispatchResult(DISPATCHED) : DispatchResult(UNDISPATCHED);
case LFUN_CELL_BACKWARD:
case LFUN_CELL_FORWARD:
@ -755,7 +755,7 @@ InsetTabular::priv_dispatch(FuncRequest const & cmd,
if (hs)
updateLocal(bv);
if (!the_locking_inset)
return DISPATCHED_NOUPDATE;
return DispatchResult(DISPATCHED_NOUPDATE);
return result;
// this to avoid compiler warnings.
default:
@ -767,33 +767,33 @@ InsetTabular::priv_dispatch(FuncRequest const & cmd,
string arg = cmd.argument;
if (the_locking_inset) {
result = the_locking_inset->dispatch(cmd);
if (result == DISPATCHED_NOUPDATE) {
if (result == DispatchResult(DISPATCHED_NOUPDATE)) {
int sc = scroll();
resetPos(bv);
if (sc != scroll()) { // inset has been scrolled
updateLocal(bv);
}
return result;
} else if (result == DISPATCHED) {
} else if (result == DispatchResult(DISPATCHED)) {
updateLocal(bv);
return result;
} else if (result == FINISHED_UP) {
} else if (result == DispatchResult(FINISHED_UP)) {
action = LFUN_UP;
// Make sure to reset status message after
// exiting, e.g. math inset
bv->owner()->clearMessage();
} else if (result == FINISHED_DOWN) {
} else if (result == DispatchResult(FINISHED_DOWN)) {
action = LFUN_DOWN;
bv->owner()->clearMessage();
} else if (result == FINISHED_RIGHT) {
} else if (result == DispatchResult(FINISHED_RIGHT)) {
action = LFUN_RIGHT;
bv->owner()->clearMessage();
} else if (result == FINISHED) {
} else if (result == DispatchResult(FINISHED)) {
bv->owner()->clearMessage();
}
}
result = DISPATCHED;
result = DispatchResult(DISPATCHED);
switch (action) {
// --- Cursor Movements ----------------------------------
case LFUN_RIGHTSEL: {
@ -959,7 +959,7 @@ InsetTabular::priv_dispatch(FuncRequest const & cmd,
break;
case LFUN_TABULAR_FEATURE:
if (!tabularFeatures(bv, arg))
result = UNDISPATCHED;
result = DispatchResult(UNDISPATCHED);
break;
// insert file functions
case LFUN_FILE_INSERT_ASCII_PARA:
@ -971,7 +971,7 @@ InsetTabular::priv_dispatch(FuncRequest const & cmd,
if (insertAsciiString(bv, tmpstr, false))
updateLocal(bv);
else
result = UNDISPATCHED;
result = DispatchResult(UNDISPATCHED);
break;
}
// cut and paste functions
@ -1072,7 +1072,7 @@ InsetTabular::priv_dispatch(FuncRequest const & cmd,
default:
// handle font changing stuff on selection before we lock the inset
// in the default part!
result = UNDISPATCHED;
result = DispatchResult(UNDISPATCHED);
if (hs) {
switch(action) {
case LFUN_LANGUAGE:
@ -1086,7 +1086,7 @@ InsetTabular::priv_dispatch(FuncRequest const & cmd,
case LFUN_UNDERLINE:
case LFUN_FONT_SIZE:
if (bv->dispatch(FuncRequest(bv, action, arg)))
result = DISPATCHED;
result = DispatchResult(DISPATCHED);
break;
default:
break;
@ -1094,15 +1094,15 @@ InsetTabular::priv_dispatch(FuncRequest const & cmd,
}
// we try to activate the actual inset and put this event down to
// the insets dispatch function.
if (result == DISPATCHED || the_locking_inset)
if (result == DispatchResult(DISPATCHED) || the_locking_inset)
break;
if (activateCellInset(bv)) {
result = the_locking_inset->dispatch(FuncRequest(bv, action, arg));
if (result == UNDISPATCHED || result >= FINISHED) {
if (result == DispatchResult(UNDISPATCHED) || result >= DispatchResult(FINISHED)) {
unlockInsetInInset(bv, the_locking_inset);
// we need to update if this was requested before
updateLocal(bv);
return UNDISPATCHED;
return DispatchResult(UNDISPATCHED);
}
if (hs)
clearSelection();
@ -1111,7 +1111,7 @@ InsetTabular::priv_dispatch(FuncRequest const & cmd,
}
break;
}
if (!(result >= FINISHED)) {
if (!(result >= DispatchResult(FINISHED))) {
if (!the_locking_inset && bv->fitCursor())
updateLocal(bv);
} else
@ -1399,17 +1399,17 @@ DispatchResult InsetTabular::moveRight(BufferView * bv, bool lock)
{
if (lock && !old_locking_inset) {
if (activateCellInset(bv))
return DISPATCHED;
return DispatchResult(DISPATCHED);
} else {
bool moved = isRightToLeft(bv)
? movePrevCell(bv) : moveNextCell(bv);
if (!moved)
return FINISHED_RIGHT;
return DispatchResult(FINISHED_RIGHT);
if (lock && activateCellInset(bv))
return DISPATCHED;
return DispatchResult(DISPATCHED);
}
resetPos(bv);
return DISPATCHED_NOUPDATE;
return DispatchResult(DISPATCHED_NOUPDATE);
}
@ -1417,12 +1417,12 @@ DispatchResult InsetTabular::moveLeft(BufferView * bv, bool lock)
{
bool moved = isRightToLeft(bv) ? moveNextCell(bv) : movePrevCell(bv);
if (!moved)
return FINISHED;
return DispatchResult(FINISHED);
// behind the inset
if (lock && activateCellInset(bv, 0, 0, mouse_button::none, true))
return DISPATCHED;
return DispatchResult(DISPATCHED);
resetPos(bv);
return DISPATCHED_NOUPDATE;
return DispatchResult(DISPATCHED_NOUPDATE);
}
@ -1431,7 +1431,7 @@ DispatchResult InsetTabular::moveUp(BufferView * bv, bool lock)
int const ocell = actcell;
actcell = tabular.getCellAbove(actcell);
if (actcell == ocell) // we moved out of the inset
return FINISHED_UP;
return DispatchResult(FINISHED_UP);
resetPos(bv);
if (lock) {
int x = 0;
@ -1441,9 +1441,9 @@ DispatchResult InsetTabular::moveUp(BufferView * bv, bool lock)
x -= cursorx_ + tabular.getBeginningOfTextInCell(actcell);
}
if (activateCellInset(bv, x, 0))
return DISPATCHED;
return DispatchResult(DISPATCHED);
}
return DISPATCHED_NOUPDATE;
return DispatchResult(DISPATCHED_NOUPDATE);
}
@ -1452,7 +1452,7 @@ DispatchResult InsetTabular::moveDown(BufferView * bv, bool lock)
int const ocell = actcell;
actcell = tabular.getCellBelow(actcell);
if (actcell == ocell) // we moved out of the inset
return FINISHED_DOWN;
return DispatchResult(FINISHED_DOWN);
resetPos(bv);
if (lock) {
int x = 0;
@ -1462,9 +1462,9 @@ DispatchResult InsetTabular::moveDown(BufferView * bv, bool lock)
x -= cursorx_ + tabular.getBeginningOfTextInCell(actcell);
}
if (activateCellInset(bv, x, 0))
return DISPATCHED;
return DispatchResult(DISPATCHED);
}
return DISPATCHED_NOUPDATE;
return DispatchResult(DISPATCHED_NOUPDATE);
}

View File

@ -547,7 +547,7 @@ bool InsetText::lfunMouseRelease(FuncRequest const & cmd)
no_selection = true;
if (the_locking_inset)
return the_locking_inset->dispatch(cmd1) >= DISPATCHED;
return the_locking_inset->dispatch(cmd1) >= DispatchResult(DISPATCHED);
int tmp_x = cmd.x;
int tmp_y = cmd.y + dim_.asc - bv->top_y();
@ -557,7 +557,7 @@ bool InsetText::lfunMouseRelease(FuncRequest const & cmd)
// We still need to deal properly with the whole relative vs.
// absolute mouse co-ords thing in a realiable, sensible way
bool ret = inset->dispatch(cmd1) >= DISPATCHED;
bool ret = inset->dispatch(cmd1) >= DispatchResult(DISPATCHED);
updateLocal(bv, false);
return ret;
}
@ -601,7 +601,7 @@ InsetText::priv_dispatch(FuncRequest const & cmd,
if (!bv->lockInset(this)) {
lyxerr[Debug::INSETS] << "Cannot lock inset" << endl;
return DISPATCHED;
return DispatchResult(DISPATCHED);
}
locked = true;
@ -649,19 +649,19 @@ InsetText::priv_dispatch(FuncRequest const & cmd,
updateLocal(bv, false);
// Tell the paragraph dialog that we've entered an insettext.
bv->dispatch(FuncRequest(LFUN_PARAGRAPH_UPDATE));
return DISPATCHED;
return DispatchResult(DISPATCHED);
}
case LFUN_MOUSE_PRESS:
lfunMousePress(cmd);
return DISPATCHED;
return DispatchResult(DISPATCHED);
case LFUN_MOUSE_MOTION:
lfunMouseMotion(cmd);
return DISPATCHED;
return DispatchResult(DISPATCHED);
case LFUN_MOUSE_RELEASE:
return lfunMouseRelease(cmd) ? DISPATCHED : UNDISPATCHED;
return lfunMouseRelease(cmd) ? DispatchResult(DISPATCHED) : DispatchResult(UNDISPATCHED);
default:
break;
@ -671,43 +671,43 @@ InsetText::priv_dispatch(FuncRequest const & cmd,
no_selection = false;
DispatchResult result = UpdatableInset::priv_dispatch(cmd, idx, pos);
if (result != UNDISPATCHED)
return DISPATCHED;
if (result != DispatchResult(UNDISPATCHED))
return DispatchResult(DISPATCHED);
result = DISPATCHED;
result = DispatchResult(DISPATCHED);
if (cmd.action < 0 && cmd.argument.empty())
return FINISHED;
return DispatchResult(FINISHED);
if (the_locking_inset) {
result = the_locking_inset->dispatch(cmd);
if (result == DISPATCHED_NOUPDATE)
if (result == DispatchResult(DISPATCHED_NOUPDATE))
return result;
if (result == DISPATCHED) {
if (result == DispatchResult(DISPATCHED)) {
updateLocal(bv, false);
return result;
}
if (result >= FINISHED) {
if (result >= DispatchResult(FINISHED)) {
switch (result.val()) {
case FINISHED_RIGHT:
moveRightIntern(bv, false, false);
result = DISPATCHED;
result = DispatchResult(DISPATCHED);
break;
case FINISHED_UP:
result = moveUp(bv);
if (result >= FINISHED) {
if (result >= DispatchResult(FINISHED)) {
updateLocal(bv, false);
bv->unlockInset(this);
}
break;
case FINISHED_DOWN:
result = moveDown(bv);
if (result >= FINISHED) {
if (result >= DispatchResult(FINISHED)) {
updateLocal(bv, false);
bv->unlockInset(this);
}
break;
default:
result = DISPATCHED;
result = DispatchResult(DISPATCHED);
break;
}
the_locking_inset = 0;
@ -749,7 +749,7 @@ InsetText::priv_dispatch(FuncRequest const & cmd,
}
text_.selection.cursor = text_.cursor;
updflag = true;
result = DISPATCHED_NOUPDATE;
result = DispatchResult(DISPATCHED_NOUPDATE);
break;
// cursor movements that need special handling
@ -773,21 +773,21 @@ InsetText::priv_dispatch(FuncRequest const & cmd,
case LFUN_PRIOR:
if (crow() == text_.firstRow())
result = FINISHED_UP;
result = DispatchResult(FINISHED_UP);
else {
text_.cursorPrevious();
text_.clearSelection();
result = DISPATCHED_NOUPDATE;
result = DispatchResult(DISPATCHED_NOUPDATE);
}
break;
case LFUN_NEXT:
if (crow() == text_.lastRow())
result = FINISHED_DOWN;
result = DispatchResult(FINISHED_DOWN);
else {
text_.cursorNext();
text_.clearSelection();
result = DISPATCHED_NOUPDATE;
result = DispatchResult(DISPATCHED_NOUPDATE);
}
break;
@ -832,7 +832,7 @@ InsetText::priv_dispatch(FuncRequest const & cmd,
case LFUN_BREAKPARAGRAPH:
if (!autoBreakRows_) {
result = DISPATCHED;
result = DispatchResult(DISPATCHED);
} else {
replaceSelection(bv->getLyXText());
text_.breakParagraph(paragraphs, 0);
@ -842,7 +842,7 @@ InsetText::priv_dispatch(FuncRequest const & cmd,
case LFUN_BREAKPARAGRAPHKEEPLAYOUT:
if (!autoBreakRows_) {
result = DISPATCHED;
result = DispatchResult(DISPATCHED);
} else {
replaceSelection(bv->getLyXText());
text_.breakParagraph(paragraphs, 1);
@ -852,7 +852,7 @@ InsetText::priv_dispatch(FuncRequest const & cmd,
case LFUN_BREAKLINE: {
if (!autoBreakRows_) {
result = DISPATCHED;
result = DispatchResult(DISPATCHED);
} else {
replaceSelection(bv->getLyXText());
text_.insertInset(new InsetNewline);
@ -901,7 +901,7 @@ InsetText::priv_dispatch(FuncRequest const & cmd,
default:
if (!bv->dispatch(cmd))
result = UNDISPATCHED;
result = DispatchResult(UNDISPATCHED);
break;
}
@ -916,11 +916,11 @@ InsetText::priv_dispatch(FuncRequest const & cmd,
setFont(bv, font, false);
}
if (result >= FINISHED)
if (result >= DispatchResult(FINISHED))
bv->unlockInset(this);
if (result == DISPATCHED_NOUPDATE)
result = DISPATCHED;
if (result == DispatchResult(DISPATCHED_NOUPDATE))
result = DispatchResult(DISPATCHED);
return result;
}
@ -1186,13 +1186,13 @@ InsetText::moveRightIntern(BufferView * bv, bool front,
ParagraphList::iterator c_par = cpar();
if (boost::next(c_par) == paragraphs.end() && cpos() >= c_par->size())
return FINISHED_RIGHT;
return DispatchResult(FINISHED_RIGHT);
if (activate_inset && checkAndActivateInset(bv, front))
return DISPATCHED;
return DispatchResult(DISPATCHED);
text_.cursorRight(bv);
if (!selecting)
text_.clearSelection();
return DISPATCHED_NOUPDATE;
return DispatchResult(DISPATCHED_NOUPDATE);
}
@ -1201,33 +1201,33 @@ InsetText::moveLeftIntern(BufferView * bv, bool front,
bool activate_inset, bool selecting)
{
if (cpar() == paragraphs.begin() && cpos() <= 0)
return FINISHED;
return DispatchResult(FINISHED);
text_.cursorLeft(bv);
if (!selecting)
text_.clearSelection();
if (activate_inset && checkAndActivateInset(bv, front))
return DISPATCHED;
return DISPATCHED_NOUPDATE;
return DispatchResult(DISPATCHED);
return DispatchResult(DISPATCHED_NOUPDATE);
}
DispatchResult InsetText::moveUp(BufferView * bv)
{
if (crow() == text_.firstRow())
return FINISHED_UP;
return DispatchResult(FINISHED_UP);
text_.cursorUp(bv);
text_.clearSelection();
return DISPATCHED_NOUPDATE;
return DispatchResult(DISPATCHED_NOUPDATE);
}
DispatchResult InsetText::moveDown(BufferView * bv)
{
if (crow() == text_.lastRow())
return FINISHED_DOWN;
return DispatchResult(FINISHED_DOWN);
text_.cursorDown(bv);
text_.clearSelection();
return DISPATCHED_NOUPDATE;
return DispatchResult(DISPATCHED_NOUPDATE);
}

View File

@ -82,11 +82,11 @@ InsetTOC::priv_dispatch(FuncRequest const & cmd,
case LFUN_MOUSE_RELEASE:
if (button().box().contains(cmd.x, cmd.y))
InsetCommandMailer("toc", *this).showDialog(cmd.view());
return DISPATCHED;
return DispatchResult(DISPATCHED);
case LFUN_INSET_DIALOG_SHOW:
InsetCommandMailer("toc", *this).showDialog(cmd.view());
return DISPATCHED;
return DispatchResult(DISPATCHED);
default:
return InsetCommand::priv_dispatch(cmd, idx, pos);

View File

@ -51,7 +51,7 @@ InsetUrl::priv_dispatch(FuncRequest const & cmd,
switch (cmd.action) {
case LFUN_INSET_EDIT:
InsetCommandMailer("url", *this).showDialog(cmd.view());
return DISPATCHED;
return DispatchResult(DISPATCHED);
default:
return InsetCommand::priv_dispatch(cmd, idx, pos);
}

View File

@ -97,12 +97,12 @@ InsetWrap::priv_dispatch(FuncRequest const & cmd,
params_.width = params.width;
cmd.view()->updateInset(this);
return DISPATCHED;
return DispatchResult(DISPATCHED);
}
case LFUN_INSET_DIALOG_UPDATE:
InsetWrapMailer(*this).updateDialog(cmd.view());
return DISPATCHED;
return DispatchResult(DISPATCHED);
default:
return InsetCollapsable::priv_dispatch(cmd, idx, pos);

View File

@ -113,7 +113,7 @@ DispatchResult
UpdatableInset::priv_dispatch(FuncRequest const & ev, idx_type &, pos_type &)
{
if (ev.action == LFUN_MOUSE_RELEASE)
return (editable() == IS_EDITABLE) ? DISPATCHED : UNDISPATCHED;
return (editable() == IS_EDITABLE) ? DispatchResult(DISPATCHED) : DispatchResult(UNDISPATCHED);
if (!ev.argument.empty() && ev.action == LFUN_SCROLL_INSET) {
if (ev.argument.find('.') != ev.argument.npos) {
@ -125,9 +125,9 @@ UpdatableInset::priv_dispatch(FuncRequest const & ev, idx_type &, pos_type &)
}
ev.view()->updateInset(this);
return DISPATCHED;
return DispatchResult(DISPATCHED);
}
return UNDISPATCHED;
return DispatchResult(UNDISPATCHED);
}

View File

@ -885,11 +885,11 @@ void LyXFunc::dispatch(FuncRequest const & func, bool verbose)
{
Cursor cursor;
buildCursor(cursor, *view());
if (cursor.dispatch(FuncRequest(func, view())) == DISPATCHED) {
if (cursor.dispatch(FuncRequest(func, view())) == DispatchResult(DISPATCHED)) {
lyxerr << "dispatched by Cursor::dispatch()\n";
goto exit_with_message;
}
lyxerr << "### NOT DISPATCHED BY Cursor::dispatch() ###\n";
lyxerr << "### NOT DispatchResult(DISPATCHED) BY Cursor::dispatch() ###\n";
}
#endif
@ -933,27 +933,27 @@ void LyXFunc::dispatch(FuncRequest const & func, bool verbose)
// Hand-over to inset's own dispatch:
result = inset->dispatch(FuncRequest(view(), action, argument));
if (result == DISPATCHED || result == DISPATCHED_NOUPDATE) {
if (result == DispatchResult(DISPATCHED) || result == DispatchResult(DISPATCHED_NOUPDATE)) {
goto exit_with_message;
}
// If UNDISPATCHED, just soldier on
if (result == FINISHED) {
// If DispatchResult(UNDISPATCHED), just soldier on
if (result == DispatchResult(FINISHED)) {
owner->clearMessage();
goto exit_with_message;
// We do not need special RTL handling here:
// FINISHED means that the cursor should be
// DispatchResult(FINISHED) means that the cursor should be
// one position after the inset.
}
if (result == FINISHED_RIGHT) {
if (result == DispatchResult(FINISHED_RIGHT)) {
view()->text->cursorRight(view());
moveCursorUpdate();
owner->clearMessage();
goto exit_with_message;
}
if (result == FINISHED_UP) {
if (result == DispatchResult(FINISHED_UP)) {
LyXText * text = view()->text;
ParagraphList::iterator pit = text->cursorPar();
Row const & row = *pit->getRow(text->cursor.pos());
@ -975,7 +975,7 @@ void LyXFunc::dispatch(FuncRequest const & func, bool verbose)
goto exit_with_message;
}
if (result == FINISHED_DOWN) {
if (result == DispatchResult(FINISHED_DOWN)) {
LyXText * text = view()->text;
ParagraphList::iterator pit = text->cursorPar();
Row const & row = *pit->getRow(text->cursor.pos());
@ -999,7 +999,7 @@ void LyXFunc::dispatch(FuncRequest const & func, bool verbose)
}
#warning I am not sure this is still right, please have a look! (Jug 20020417)
// result == UNDISPATCHED
// result == DispatchResult()
//setMessage(N_("Text mode"));
switch (action) {
case LFUN_UNKNOWN_ACTION:

View File

@ -1,7 +1,18 @@
2003-10-29 Lars Gullik Bjřnnes <larsbj@gullik.net>
* math_scriptinset.C (priv_dispatch):
* math_nestinset.C (priv_dispatch):
* math_hullinset.C (priv_dispatch):
* math_gridinset.C (priv_dispatch):
* math_cursor.C (dispatch):
* formulabase.C (lfunMouseRelease, lfunMousePress)
(lfunMouseMotion, priv_dispatch):
* command_inset.C (priv_dispatch): explict DispatchResult ctor fallout.
2003-10-29 Lars Gullik Bjřnnes <larsbj@gullik.net>
* math_hullinset.C (priv_dispatch):
* math_gridinset.C (priv_dispatch):
* math_cursor.C (dispatch): FINISHED_POP -> FINISHED
2003-10-29 Lars Gullik Bjřnnes <larsbj@gullik.net>
@ -9,7 +20,7 @@
* math_hullinset.C (priv_dispatch):
* math_gridinset.C (priv_dispatch):
* math_cursor.C (dispatch): DISPATCHED_POP -> FINISHED_POP
(dispatch):
(dispatch):
* math_scriptinset.h: change dispatch to priv_dispatch and make it
protected

View File

@ -62,7 +62,7 @@ CommandInset::priv_dispatch(FuncRequest const & cmd,
default:
return MathNestInset::priv_dispatch(cmd, idx, pos);
}
return UNDISPATCHED;
return DispatchResult(UNDISPATCHED);
}

View File

@ -215,7 +215,7 @@ void InsetFormulaBase::toggleInsetSelection(BufferView * bv)
DispatchResult InsetFormulaBase::lfunMouseRelease(FuncRequest const & cmd)
{
if (!mathcursor)
return UNDISPATCHED;
return DispatchResult(UNDISPATCHED);
BufferView * bv = cmd.view();
bv->updateInset(this);
@ -223,12 +223,12 @@ DispatchResult InsetFormulaBase::lfunMouseRelease(FuncRequest const & cmd)
if (cmd.button() == mouse_button::button3) {
// try to dispatch to enclosed insets first
if (mathcursor->dispatch(cmd) == UNDISPATCHED) {
if (mathcursor->dispatch(cmd) == DispatchResult(UNDISPATCHED)) {
// launch math panel for right mouse button
lyxerr << "lfunMouseRelease: undispatched: " << cmd.button() << endl;
bv->owner()->getDialogs().show("mathpanel");
}
return DISPATCHED;
return DispatchResult(DISPATCHED);
}
if (cmd.button() == mouse_button::button2) {
@ -238,7 +238,7 @@ DispatchResult InsetFormulaBase::lfunMouseRelease(FuncRequest const & cmd)
mathcursor->setPos(cmd.x + xo_, cmd.y + yo_);
mathcursor->insert(ar);
bv->updateInset(this);
return DISPATCHED;
return DispatchResult(DISPATCHED);
}
if (cmd.button() == mouse_button::button1) {
@ -250,10 +250,10 @@ DispatchResult InsetFormulaBase::lfunMouseRelease(FuncRequest const & cmd)
//mathcursor = new MathCursor(this, x == 0);
//metrics(bv);
//mathcursor->setPos(x + xo_, y + yo_);
return DISPATCHED;
return DispatchResult(DISPATCHED);
}
return UNDISPATCHED;
return DispatchResult(UNDISPATCHED);
}
@ -272,7 +272,7 @@ DispatchResult InsetFormulaBase::lfunMousePress(FuncRequest const & cmd)
if (cmd.button() == mouse_button::button3) {
mathcursor->dispatch(cmd);
return DISPATCHED;
return DispatchResult(DISPATCHED);
}
if (cmd.button() == mouse_button::button1) {
@ -281,28 +281,28 @@ DispatchResult InsetFormulaBase::lfunMousePress(FuncRequest const & cmd)
mathcursor->selClear();
mathcursor->setPos(cmd.x + xo_, cmd.y + yo_);
mathcursor->dispatch(cmd);
return DISPATCHED;
return DispatchResult(DISPATCHED);
}
bv->updateInset(this);
return DISPATCHED;
return DispatchResult(DISPATCHED);
}
DispatchResult InsetFormulaBase::lfunMouseMotion(FuncRequest const & cmd)
{
if (!mathcursor)
return DISPATCHED;
return DispatchResult(DISPATCHED);
if (mathcursor->dispatch(FuncRequest(cmd)) != UNDISPATCHED)
return DISPATCHED;
if (mathcursor->dispatch(FuncRequest(cmd)) != DispatchResult(UNDISPATCHED))
return DispatchResult(DISPATCHED);
// only select with button 1
if (cmd.button() != mouse_button::button1)
return DISPATCHED;
return DispatchResult(DISPATCHED);
if (abs(cmd.x - first_x) < 2 && abs(cmd.y - first_y) < 2)
return DISPATCHED;
return DispatchResult(DISPATCHED);
first_x = cmd.x;
first_y = cmd.y;
@ -313,7 +313,7 @@ DispatchResult InsetFormulaBase::lfunMouseMotion(FuncRequest const & cmd)
BufferView * bv = cmd.view();
mathcursor->setPos(cmd.x + xo_, cmd.y + yo_);
bv->updateInset(this);
return DISPATCHED;
return DispatchResult(DISPATCHED);
}
@ -349,7 +349,7 @@ InsetFormulaBase::priv_dispatch(FuncRequest const & cmd,
// if that is removed, we won't get the magenta box when entering an
// inset for the first time
bv->updateInset(this);
return DISPATCHED;
return DispatchResult(DISPATCHED);
case LFUN_MOUSE_PRESS:
//lyxerr << "Mouse single press" << endl;
@ -368,10 +368,10 @@ InsetFormulaBase::priv_dispatch(FuncRequest const & cmd,
}
if (!mathcursor)
return UNDISPATCHED;
return DispatchResult(UNDISPATCHED);
string argument = cmd.argument;
DispatchResult result = DISPATCHED;
DispatchResult result = DispatchResult(DISPATCHED);
bool sel = false;
bool was_macro = mathcursor->inMacroMode();
bool was_selection = mathcursor->selection();
@ -400,7 +400,7 @@ InsetFormulaBase::priv_dispatch(FuncRequest const & cmd,
case LFUN_RIGHTSEL:
sel = true; // fall through...
case LFUN_RIGHT:
result = mathcursor->right(sel) ? DISPATCHED : FINISHED_RIGHT;
result = mathcursor->right(sel) ? DispatchResult(DISPATCHED) : DispatchResult(FINISHED_RIGHT);
//lyxerr << "calling scroll 20" << endl;
//scroll(bv, 20);
// write something to the minibuffer
@ -410,19 +410,19 @@ InsetFormulaBase::priv_dispatch(FuncRequest const & cmd,
case LFUN_LEFTSEL:
sel = true; // fall through
case LFUN_LEFT:
result = mathcursor->left(sel) ? DISPATCHED : FINISHED;
result = mathcursor->left(sel) ? DispatchResult(DISPATCHED) : DispatchResult(FINISHED);
break;
case LFUN_UPSEL:
sel = true; // fall through
case LFUN_UP:
result = mathcursor->up(sel) ? DISPATCHED : FINISHED_UP;
result = mathcursor->up(sel) ? DispatchResult(DISPATCHED) : DispatchResult(FINISHED_UP);
break;
case LFUN_DOWNSEL:
sel = true; // fall through
case LFUN_DOWN:
result = mathcursor->down(sel) ? DISPATCHED : FINISHED_DOWN;
result = mathcursor->down(sel) ? DispatchResult(DISPATCHED) : DispatchResult(FINISHED_DOWN);
break;
case LFUN_WORDSEL:
@ -434,7 +434,7 @@ InsetFormulaBase::priv_dispatch(FuncRequest const & cmd,
case LFUN_UP_PARAGRAPH:
case LFUN_DOWN_PARAGRAPHSEL:
case LFUN_DOWN_PARAGRAPH:
result = FINISHED;
result = DispatchResult(FINISHED);
break;
case LFUN_HOMESEL:
@ -442,7 +442,7 @@ InsetFormulaBase::priv_dispatch(FuncRequest const & cmd,
sel = true; // fall through
case LFUN_HOME:
case LFUN_WORDLEFT:
result = mathcursor->home(sel) ? DISPATCHED : FINISHED;
result = mathcursor->home(sel) ? DispatchResult(DISPATCHED) : DispatchResult(FINISHED);
break;
case LFUN_ENDSEL:
@ -450,21 +450,21 @@ InsetFormulaBase::priv_dispatch(FuncRequest const & cmd,
sel = true; // fall through
case LFUN_END:
case LFUN_WORDRIGHT:
result = mathcursor->end(sel) ? DISPATCHED : FINISHED_RIGHT;
result = mathcursor->end(sel) ? DispatchResult(DISPATCHED) : DispatchResult(FINISHED_RIGHT);
break;
case LFUN_PRIORSEL:
case LFUN_PRIOR:
case LFUN_BEGINNINGBUFSEL:
case LFUN_BEGINNINGBUF:
result = FINISHED;
result = DispatchResult(FINISHED);
break;
case LFUN_NEXTSEL:
case LFUN_NEXT:
case LFUN_ENDBUFSEL:
case LFUN_ENDBUF:
result = FINISHED_RIGHT;
result = DispatchResult(FINISHED_RIGHT);
break;
case LFUN_CELL_FORWARD:
@ -479,7 +479,7 @@ InsetFormulaBase::priv_dispatch(FuncRequest const & cmd,
case LFUN_BACKSPACE:
recordUndo(bv, Undo::ATOMIC);
if (!mathcursor->backspace()) {
result = FINISHED;
result = DispatchResult(FINISHED);
remove_inset = true;
}
break;
@ -488,7 +488,7 @@ InsetFormulaBase::priv_dispatch(FuncRequest const & cmd,
case LFUN_DELETE:
recordUndo(bv, Undo::ATOMIC);
if (!mathcursor->erase()) {
result = FINISHED;
result = DispatchResult(FINISHED);
remove_inset = true;
}
break;
@ -641,7 +641,7 @@ InsetFormulaBase::priv_dispatch(FuncRequest const & cmd,
case LFUN_EXEC_COMMAND:
result = UNDISPATCHED;
result = DispatchResult(UNDISPATCHED);
break;
case LFUN_INSET_ERT:
@ -669,7 +669,7 @@ InsetFormulaBase::priv_dispatch(FuncRequest const & cmd,
if (!argument.empty()) {
recordUndo(bv, Undo::ATOMIC);
if (argument.size() == 1)
result = mathcursor->interpret(argument[0]) ? DISPATCHED : FINISHED_RIGHT;
result = mathcursor->interpret(argument[0]) ? DispatchResult(DISPATCHED) : DispatchResult(FINISHED_RIGHT);
else
mathcursor->insert(argument);
}
@ -679,7 +679,7 @@ InsetFormulaBase::priv_dispatch(FuncRequest const & cmd,
if (mathcursor->selection())
mathcursor->selClear();
else
result = UNDISPATCHED;
result = DispatchResult(UNDISPATCHED);
break;
case LFUN_INSET_TOGGLE:
@ -687,7 +687,7 @@ InsetFormulaBase::priv_dispatch(FuncRequest const & cmd,
break;
case LFUN_DIALOG_SHOW:
result = UNDISPATCHED;
result = DispatchResult(UNDISPATCHED);
break;
case LFUN_DIALOG_SHOW_NEW_INSET: {
@ -699,7 +699,7 @@ InsetFormulaBase::priv_dispatch(FuncRequest const & cmd,
}
if (data.empty())
result = UNDISPATCHED;
result = DispatchResult(UNDISPATCHED);
else {
bv->owner()->getDialogs().show(name, data, 0);
}
@ -718,19 +718,19 @@ InsetFormulaBase::priv_dispatch(FuncRequest const & cmd,
MathArray ar;
if (createMathInset_fromDialogStr(cmd.argument, ar)) {
mathcursor->insert(ar);
result = DISPATCHED;
result = DispatchResult(DISPATCHED);
} else {
result = UNDISPATCHED;
result = DispatchResult(UNDISPATCHED);
}
}
}
break;
default:
result = UNDISPATCHED;
result = DispatchResult(UNDISPATCHED);
}
if (result == DISPATCHED)
if (result == DispatchResult(DISPATCHED))
bv->updateInset(this);
mathcursor->normalize();
@ -741,8 +741,8 @@ InsetFormulaBase::priv_dispatch(FuncRequest const & cmd,
if (mathcursor->selection() || was_selection)
toggleInsetSelection(bv);
if (result == DISPATCHED || result == DISPATCHED_NOUPDATE ||
result == UNDISPATCHED) {
if (result == DispatchResult(DISPATCHED) || result == DispatchResult(DISPATCHED_NOUPDATE) ||
result == DispatchResult(UNDISPATCHED)) {
fitInsetCursor(bv);
revealCodes(bv);
cmd.view()->stuffClipboard(mathcursor->grabSelection());

View File

@ -1417,17 +1417,17 @@ DispatchResult MathCursor::dispatch(FuncRequest const & cmd)
case LFUN_MOUSE_RELEASE:
case LFUN_MOUSE_DOUBLE: {
CursorPos & pos = Cursor_.back();
DispatchResult res = UNDISPATCHED;
DispatchResult res = DispatchResult(UNDISPATCHED);
int x = 0, y = 0;
getPos(x, y);
if (x < cmd.x && hasPrevAtom()) {
res = prevAtom().nucleus()->dispatch(cmd, pos.idx_, pos.pos_);
if (res != UNDISPATCHED)
if (res != DispatchResult(UNDISPATCHED))
return res;
}
if (x > cmd.x && hasNextAtom()) {
res = nextAtom().nucleus()->dispatch(cmd, pos.idx_, pos.pos_);
if (res != UNDISPATCHED)
if (res != DispatchResult(UNDISPATCHED))
return res;
}
}
@ -1438,15 +1438,15 @@ DispatchResult MathCursor::dispatch(FuncRequest const & cmd)
for (int i = Cursor_.size() - 1; i >= 0; --i) {
CursorPos & pos = Cursor_[i];
DispatchResult res = pos.inset_->dispatch(cmd, pos.idx_, pos.pos_);
if (res != UNDISPATCHED) {
if (res == FINISHED) {
if (res != DispatchResult(UNDISPATCHED)) {
if (res == DispatchResult(FINISHED)) {
Cursor_.shrink(i + 1);
selClear();
}
return res;
}
}
return UNDISPATCHED;
return DispatchResult(UNDISPATCHED);
}

View File

@ -1050,13 +1050,13 @@ DispatchResult MathGridInset::priv_dispatch(FuncRequest const & cmd,
case LFUN_MOUSE_RELEASE:
//if (cmd.button() == mouse_button::button3) {
// GridInsetMailer(*this).showDialog();
// return DISPATCHED;
// return DispatchResult(DISPATCHED);
//}
return UNDISPATCHED;
return DispatchResult(UNDISPATCHED);
case LFUN_INSET_DIALOG_UPDATE:
GridInsetMailer(*this).updateDialog(cmd.view());
return UNDISPATCHED;
return DispatchResult(UNDISPATCHED);
// insert file functions
case LFUN_DELETE_LINE_FORWARD:
@ -1072,12 +1072,12 @@ DispatchResult MathGridInset::priv_dispatch(FuncRequest const & cmd,
idx = nargs() - 1;
if (pos > cell(idx).size())
pos = cell(idx).size();
return FINISHED;
return DispatchResult(FINISHED);
case LFUN_CELL_SPLIT:
//recordUndo(bv, Undo::ATOMIC);
splitCell(idx, pos);
return FINISHED;
return DispatchResult(FINISHED);
case LFUN_BREAKLINE: {
//recordUndo(bv, Undo::INSERT);
@ -1096,7 +1096,7 @@ DispatchResult MathGridInset::priv_dispatch(FuncRequest const & cmd,
pos = cell(idx).size();
//mathcursor->normalize();
return FINISHED;
return DispatchResult(FINISHED);
}
case LFUN_TABULAR_FEATURE: {
@ -1151,9 +1151,9 @@ DispatchResult MathGridInset::priv_dispatch(FuncRequest const & cmd,
else if (s == "swap-column")
swapCol(col(idx));
else
return UNDISPATCHED;
lyxerr << "returning FINISHED" << endl;
return FINISHED;
return DispatchResult(UNDISPATCHED);
lyxerr << "returning DispatchResult(FINISHED)" << endl;
return DispatchResult(FINISHED);
}
case LFUN_PASTE: {
@ -1184,7 +1184,7 @@ DispatchResult MathGridInset::priv_dispatch(FuncRequest const & cmd,
for (col_type c = 0; c < grid.ncols(); ++c)
cell(i).append(grid.cell(grid.index(r, c)));
}
return FINISHED;
return DispatchResult(FINISHED);
}
default:

View File

@ -782,7 +782,7 @@ DispatchResult MathHullInset::priv_dispatch
mutate("eqnarray");
idx = 1;
pos = 0;
return FINISHED;
return DispatchResult(FINISHED);
}
return MathGridInset::priv_dispatch(cmd, idx, pos);
@ -798,7 +798,7 @@ DispatchResult MathHullInset::priv_dispatch
numbered(row, !old);
//bv->owner()->message(old ? _("No number") : _("Number"));
}
return DISPATCHED;
return DispatchResult(DISPATCHED);
case LFUN_MATH_NONUMBER:
if (display()) {
@ -808,7 +808,7 @@ DispatchResult MathHullInset::priv_dispatch
//bv->owner()->message(old ? _("No number") : _("Number"));
numbered(r, !old);
}
return DISPATCHED;
return DispatchResult(DISPATCHED);
case LFUN_INSERT_LABEL: {
row_type r = (type_ == "multline") ? nrows() - 1 : row(idx);
@ -822,7 +822,7 @@ DispatchResult MathHullInset::priv_dispatch
? Alert::askForText(_("Enter new label to insert:"), default_label)
: Alert::askForText(_("Enter label:"), old_label);
if (!res.first)
return UNDISPATCHED;
return DispatchResult(UNDISPATCHED);
new_label = trim(res.second);
}
@ -832,12 +832,12 @@ DispatchResult MathHullInset::priv_dispatch
if (!new_label.empty())
numbered(r, true);
label(r, new_label);
return DISPATCHED;
return DispatchResult(DISPATCHED);
}
case LFUN_MATH_EXTERN:
doExtern(cmd, idx, pos);
return FINISHED;
return DispatchResult(FINISHED);
case LFUN_MATH_MUTATE: {
lyxerr << "Hull: MUTATE: " << cmd.argument << endl;
@ -849,14 +849,14 @@ DispatchResult MathHullInset::priv_dispatch
idx = nargs() - 1;
if (pos > cell(idx).size())
pos = cell(idx).size();
return FINISHED;
return DispatchResult(FINISHED);
}
case LFUN_MATH_DISPLAY: {
mutate(type_ == "simple" ? "equation" : "simple");
idx = 0;
pos = cell(idx).size();
return FINISHED;
return DispatchResult(FINISHED);
}
default:

View File

@ -299,7 +299,7 @@ MathNestInset::priv_dispatch(FuncRequest const & cmd,
mathed_parse_cell(ar, cmd.argument);
cell(idx).insert(pos, ar);
pos += ar.size();
return DISPATCHED;
return DispatchResult(DISPATCHED);
}
case LFUN_PASTESELECTION:
@ -310,7 +310,7 @@ MathNestInset::priv_dispatch(FuncRequest const & cmd,
case LFUN_MOUSE_PRESS:
if (cmd.button() == mouse_button::button2)
return priv_dispatch(FuncRequest(bv, LFUN_PASTESELECTION), idx, pos);
return UNDISPATCHED;
return DispatchResult(UNDISPATCHED);
default:
return MathInset::priv_dispatch(cmd, idx, pos);

View File

@ -528,7 +528,7 @@ MathScriptInset::priv_dispatch(FuncRequest const & cmd,
limits_ = (hasLimits()) ? -1 : 1;
else
limits_ = 0;
return DISPATCHED;
return DispatchResult(DISPATCHED);
}
return MathNestInset::priv_dispatch(cmd, idx, pos);

View File

@ -62,18 +62,18 @@ RefInset::priv_dispatch(FuncRequest const & cmd,
if (cmd.getArg(0) == "ref") {
MathArray ar;
if (!createMathInset_fromDialogStr(cmd.argument, ar))
return UNDISPATCHED;
return DispatchResult(UNDISPATCHED);
*this = *ar[0].nucleus()->asRefInset();
return DISPATCHED;
return DispatchResult(DISPATCHED);
}
break;
case LFUN_MOUSE_RELEASE:
if (cmd.button() == mouse_button::button3) {
lyxerr << "trying to goto ref" << cell(0) << endl;
cmd.view()->dispatch(FuncRequest(LFUN_REF_GOTO, asString(cell(0))));
return DISPATCHED;
return DispatchResult(DISPATCHED);
}
if (cmd.button() == mouse_button::button1) {
// Eventually trigger dialog with button 3
@ -81,18 +81,18 @@ RefInset::priv_dispatch(FuncRequest const & cmd,
string const data = createDialogStr("ref");
cmd.view()->owner()->getDialogs().
show("ref", data, this);
return DISPATCHED;
return DispatchResult(DISPATCHED);
}
break;
case LFUN_MOUSE_PRESS:
case LFUN_MOUSE_MOTION:
// eat other mouse commands
return DISPATCHED;
return DispatchResult(DISPATCHED);
default:
return CommandInset::priv_dispatch(cmd, idx, pos);
}
// not our business
return UNDISPATCHED;
return DispatchResult(UNDISPATCHED);
}

View File

@ -125,7 +125,7 @@ unsigned int closeEnvTags(ostream & ofs, bool mixcont,
string item_name= "listitem";
lines += closeTag(ofs, total_depth, mixcont, item_name);
if (environment_inner_depth == "varlistentry")
lines += closeTag(ofs, total_depth, mixcont,
lines += closeTag(ofs, total_depth, mixcont,
environment_inner_depth);
}
return lines;

View File

@ -417,7 +417,7 @@ void handle_tabular(Parser & p, ostream & os,
// multicolumn cells are tricky: This
// \multicolumn{2}{|c|}{col1-2}&
// \multicolumn{2}{|c|}{col3-4}\\
// \multicolumn{2}{|c|}{col3-4} "\\"
// gives | col1-2 | col3-4 | and not
// | col1-2 || col3-4 |
// So:

View File

@ -982,14 +982,14 @@ DispatchResult LyXText::dispatch(FuncRequest const & cmd)
case LFUN_BEGINNINGBUFSEL:
if (inset_owner)
return UNDISPATCHED;
return DispatchResult(UNDISPATCHED);
cursorTop();
finishChange(bv, true);
break;
case LFUN_ENDBUFSEL:
if (inset_owner)
return UNDISPATCHED;
return DispatchResult(UNDISPATCHED);
cursorBottom();
finishChange(bv, true);
break;
@ -1534,8 +1534,8 @@ DispatchResult LyXText::dispatch(FuncRequest const & cmd)
break;
default:
return UNDISPATCHED;
return DispatchResult(UNDISPATCHED);
}
return DISPATCHED;
return DispatchResult(DISPATCHED);
}