break;
default:
- return bv_->getLyXText()->dispatch(FuncRequest(ev, bv_)) >= DispatchResult(DISPATCHED);
+ return bv_->getLyXText()->dispatch(FuncRequest(ev, bv_)).dispatched();
} // end of switch
return true;
+2003-11-01 Lars Gullik Bjønnes <larsbj@gullik.net>
+
+ * text3.C:
+ * lyxfunc.C:
+ * cursor.C (dispatch):
+ * BufferView_pimpl.C (dispatch): adjust for DispatchResult changes
+
+ * dispatchresult.h: remove UNDISPATCHED, DISPATCHED and
+ DISPATCHED_NOUPDATE from dispatch_result_t, add NONE. Add a
+ contructor, add a class function dispatched. Remove operator>=
+
2003-11-01 Lars Gullik Bjønnes <larsbj@gullik.net>
* debug.C: only use the default constructor for debugstream
DispatchResult res = data_[i].inset_->dispatch(cmd);
lyxerr << " result: " << res.val() << endl;
- if (res == DispatchResult(DISPATCHED)) {
- //update();
- return DispatchResult(DISPATCHED);
+ if (res.dispatched()) {
+ if (res.val() != NOUPDATE) {
+ //update();
+ }
+ return DispatchResult(true);
}
- if (res == DispatchResult(DISPATCHED_NOUPDATE))
- return DispatchResult(DISPATCHED);
-
lyxerr << "# unhandled result: " << res.val() << endl;
}
- return DispatchResult(UNDISPATCHED);
+ return DispatchResult(false);
}
#define DISPATCH_RESULT_H
/** Dispatch result codes
- DISPATCHED = the inset catched the action
- DISPATCHED_NOUPDATE = the inset catched the action and no update
- is needed here to redraw the inset
+ DISPATCHED = the inset caught the action
+ DISPATCHED_NOUPDATE = the inset caught the action and no update
+ is needed to redraw the inset
FINISHED = the inset must be unlocked as a result
of the action
- FINISHED_RIGHT = FINISHED, but put the cursor to the RIGHT of
+ FINISHED_RIGHT = FINISHED, but move the cursor RIGHT from
the inset.
- FINISHED_UP = FINISHED, but put the cursor UP of
+ FINISHED_UP = FINISHED, but move the cursor UP from
the inset.
- FINISHED_DOWN = FINISHED, but put the cursor DOWN of
+ FINISHED_DOWN = FINISHED, but move the cursor DOWN from
the inset.
UNDISPATCHED = the action was not catched, it should be
dispatched by lower level insets
*/
enum dispatch_result_t {
- UNDISPATCHED = 0,
- DISPATCHED,
- DISPATCHED_NOUPDATE,
+ NONE = 0,
+ NOUPDATE,
FINISHED,
FINISHED_RIGHT,
FINISHED_UP,
class DispatchResult {
public:
DispatchResult()
- : val_(UNDISPATCHED) {}
+ : dispatched_(false), val_(NONE) {}
explicit
- DispatchResult(dispatch_result_t val) : val_(val) {}
+ DispatchResult(bool dis)
+ : dispatched_(dis), val_(NONE) {}
+ DispatchResult(bool dis, dispatch_result_t val)
+ : dispatched_(dis), val_(val) {}
dispatch_result_t val() const { return val_; }
+ bool dispatched() const {
+ return dispatched_;
+ }
private:
+ bool dispatched_;
dispatch_result_t val_;
};
inline
bool operator==(DispatchResult const & lhs, DispatchResult const & rhs)
{
- return lhs.val() == rhs.val();
+ return lhs.dispatched() == rhs.dispatched() && lhs.val() == rhs.val();
}
return !(lhs == rhs);
}
-
-// This operator is temporary, will be removed with the introduction of
-// a status field in DispatchResult.
-inline
-bool operator>=(DispatchResult const & lhs, DispatchResult const & rhs)
-{
- return lhs.val() >= rhs.val();
-}
-
#endif // DISPATCH_RESULT_H
+2003-11-01 Lars Gullik Bjønnes <larsbj@gullik.net>
+
+ * insets: adjust for DispatchResult changes.
+
2003-11-01 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* insetpagebreak.C: fix screen representation & ascii output.
2003-11-01 Alfredo Braunstein <abraunst@libero.it>
- * inset.[Ch]:
- * insettext.[Ch]:
- * insettabular.[Ch]:
+ * inset.[Ch]:
+ * insettext.[Ch]:
+ * insettabular.[Ch]:
* insetcollapsable.[Ch]: bool haveParagraphs() -> int numParagraphs()
2003-10-31 José Matos <jamatos@lyx.org>
DispatchResult
InsetBase::priv_dispatch(FuncRequest const &, idx_type &, pos_type &)
{
- return DispatchResult(UNDISPATCHED);
+ return DispatchResult(false);
}
case LFUN_INSET_EDIT:
InsetCommandMailer("bibitem", *this).showDialog(cmd.view());
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
case LFUN_INSET_MODIFY: {
InsetCommandParams p;
InsetCommandMailer::string2params(cmd.argument, p);
if (p.getCmdName().empty())
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
setParams(p);
cmd.view()->updateInset(this);
cmd.view()->fitCursor();
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
}
default:
case LFUN_INSET_DIALOG_SHOW:
InsetCommandMailer("bibtex", *this).showDialog(cmd.view());
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
case LFUN_MOUSE_RELEASE:
if (button().box().contains(cmd.x, cmd.y))
InsetCommandMailer("bibtex", *this).showDialog(cmd.view());
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
case LFUN_INSET_MODIFY: {
InsetCommandParams p;
InsetCommandMailer::string2params(cmd.argument, p);
if (p.getCmdName().empty())
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
setParams(p);
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
}
default:
InsetBoxMailer::string2params(cmd.argument, params_);
setButtonLabel();
bv->updateInset(this);
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
}
case LFUN_INSET_DIALOG_UPDATE:
InsetBoxMailer(*this).updateDialog(bv);
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
case LFUN_MOUSE_RELEASE:
if (cmd.button() == mouse_button::button3 && hitButton(cmd)) {
InsetBoxMailer(*this).showDialog(bv);
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
}
// fallthrough:
params_.branch = params.branch;
setButtonLabel();
bv->updateInset(this);
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
}
case LFUN_INSET_EDIT:
if (cmd.button() != mouse_button::button3)
return InsetCollapsable::priv_dispatch(cmd, idx, pos);
- return DispatchResult(UNDISPATCHED);
+ return DispatchResult(false);
case LFUN_INSET_DIALOG_UPDATE:
InsetBranchMailer("branch", *this).updateDialog(bv);
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
case LFUN_MOUSE_RELEASE:
if (cmd.button() == mouse_button::button3 && hitButton(cmd)) {
InsetBranchMailer("branch", *this).showDialog(bv);
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
}
// fallthrough:
default:
switch (cmd.action) {
case LFUN_INSET_EDIT:
InsetCommandMailer("citation", *this).showDialog(cmd.view());
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
default:
return InsetCommand::priv_dispatch(cmd, idx, pos);
bv->updateInset(this);
bv->buffer()->markDirty();
} else if (!collapsed_ && cmd.y > button_dim.y2) {
- ret = inset.dispatch(adjustCommand(cmd)) == DispatchResult(DISPATCHED);
+ ret = inset.dispatch(adjustCommand(cmd)) == DispatchResult(true);
}
if (cmd.button() == mouse_button::button3 && !ret)
showInsetDialog(bv);
if (bv->lockInset(this))
inset.dispatch(cmd);
}
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
}
#ifdef WITH_WARNINGS
#warning Fix this properly in BufferView_pimpl::workAreaButtonRelease
#endif
if (cmd.button() == mouse_button::button3)
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
UpdatableInset::priv_dispatch(cmd, idx, pos);
// it was already collapsed!
first_after_edit = true;
if (!bv->lockInset(this))
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
bv->updateInset(this);
bv->buffer()->markDirty();
inset.dispatch(cmd);
} else {
if (!bv->lockInset(this))
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
if (cmd.y <= button_dim.y2) {
FuncRequest cmd1 = cmd;
cmd1.y = 0;
} else
inset.dispatch(adjustCommand(cmd));
}
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
}
case LFUN_MOUSE_PRESS:
if (!collapsed_ && cmd.y > button_dim.y2)
inset.dispatch(adjustCommand(cmd));
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
case LFUN_MOUSE_MOTION:
if (!collapsed_ && cmd.y > button_dim.y2)
inset.dispatch(adjustCommand(cmd));
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
case LFUN_MOUSE_RELEASE:
lfunMouseRelease(cmd);
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
default:
- DispatchResult result = inset.dispatch(cmd);
- if (result >= DispatchResult(FINISHED))
+ DispatchResult const result = inset.dispatch(cmd);
+ if (result.val() >= FINISHED)
bv->unlockInset(this);
first_after_edit = false;
return result;
InsetCommandParams p;
InsetCommandMailer::string2params(cmd.argument, p);
if (p.getCmdName().empty())
- return DispatchResult(UNDISPATCHED);
+ return DispatchResult(false);
setParams(p);
cmd.view()->updateInset(this);
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
}
case LFUN_INSET_DIALOG_UPDATE:
InsetCommandMailer(cmd.argument, *this).updateDialog(cmd.view());
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
case LFUN_MOUSE_RELEASE:
return dispatch(FuncRequest(cmd.view(), LFUN_INSET_EDIT));
default:
- return DispatchResult(UNDISPATCHED);
+ return DispatchResult(false);
}
}
InsetERT::priv_dispatch(FuncRequest const & cmd,
idx_type & idx, pos_type & pos)
{
- DispatchResult result = DispatchResult(UNDISPATCHED);
+ DispatchResult result = DispatchResult(false);
BufferView * bv = cmd.view();
if (inset.paragraphs.begin()->empty()) {
*/
inset.getLyXText(cmd.view())->fullRebreak();
bv->updateInset(this);
- result = DispatchResult(DISPATCHED);
+ result = DispatchResult(true);
}
break;
case LFUN_MOUSE_PRESS:
lfunMousePress(cmd);
- result = DispatchResult(DISPATCHED);
+ result = DispatchResult(true);
break;
case LFUN_MOUSE_MOTION:
lfunMouseMotion(cmd);
- result = DispatchResult(DISPATCHED);
+ result = DispatchResult(true);
break;
case LFUN_MOUSE_RELEASE:
lfunMouseRelease(cmd);
- result = DispatchResult(DISPATCHED);
+ result = DispatchResult(true);
break;
case LFUN_LAYOUT:
bv->owner()->setLayout(inset.paragraphs.begin()->layout()->name());
- result = DispatchResult(DISPATCHED_NOUPDATE);
+ result = DispatchResult(true, NOUPDATE);
break;
default:
InsetExternalParams p;
InsetExternalMailer::string2params(cmd.argument, buffer, p);
external::editExternal(p, buffer);
- return DispatchResult(DISPATCHED_NOUPDATE);
+ return DispatchResult(true, NOUPDATE);
}
case LFUN_INSET_MODIFY: {
InsetExternalMailer::string2params(cmd.argument, buffer, p);
setParams(p, buffer);
cmd.view()->updateInset(this);
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
}
case LFUN_INSET_DIALOG_UPDATE:
InsetExternalMailer(*this).updateDialog(cmd.view());
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
case LFUN_MOUSE_RELEASE:
case LFUN_INSET_EDIT:
InsetExternalMailer(*this).showDialog(cmd.view());
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
default:
- return DispatchResult(UNDISPATCHED);
+ return DispatchResult(false);
}
}
wide(params_.wide, cmd.view()->buffer()->params());
cmd.view()->updateInset(this);
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
}
case LFUN_INSET_DIALOG_UPDATE: {
InsetFloatMailer(*this).updateDialog(cmd.view());
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
}
default:
case LFUN_MOUSE_RELEASE:
if (button().box().contains(cmd.x, cmd.y))
InsetCommandMailer("toc", *this).showDialog(cmd.view());
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
case LFUN_INSET_DIALOG_SHOW:
InsetCommandMailer("toc", *this).showDialog(cmd.view());
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
default:
return InsetCommand::priv_dispatch(cmd, idx, pos);
setParams(p);
cmd.view()->updateInset(this);
}
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
}
case LFUN_INSET_DIALOG_UPDATE:
InsetGraphicsMailer(*this).updateDialog(cmd.view());
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
case LFUN_INSET_EDIT:
case LFUN_MOUSE_RELEASE:
InsetGraphicsMailer(*this).showDialog(cmd.view());
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
default:
- return DispatchResult(UNDISPATCHED);
+ return DispatchResult(false);
}
}
set(p, *cmd.view()->buffer());
cmd.view()->updateInset(this);
}
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
}
case LFUN_INSET_DIALOG_UPDATE:
InsetIncludeMailer(*this).updateDialog(cmd.view());
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
case LFUN_MOUSE_RELEASE:
if (button_.box().contains(cmd.x, cmd.y))
InsetIncludeMailer(*this).showDialog(cmd.view());
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
case LFUN_INSET_DIALOG_SHOW:
InsetIncludeMailer(*this).showDialog(cmd.view());
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
default:
- return DispatchResult(UNDISPATCHED);
+ return DispatchResult(false);
}
}
switch (cmd.action) {
case LFUN_INSET_EDIT:
InsetCommandMailer("index", *this).showDialog(cmd.view());
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
default:
return InsetCommand::priv_dispatch(cmd, idx, pos);
case LFUN_INSET_EDIT:
InsetCommandMailer("label", *this).showDialog(bv);
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
break;
case LFUN_INSET_MODIFY: {
InsetCommandParams p;
InsetCommandMailer::string2params(cmd.argument, p);
if (p.getCmdName().empty())
- return DispatchResult(UNDISPATCHED);
+ return DispatchResult(false);
bool clean = true;
if (bv && p.getContents() != params().getContents()) {
setParams(p);
bv->updateInset(this);
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
}
default:
* with ugliness like this ... */
inset.getLyXText(cmd.view())->fullRebreak();
cmd.view()->updateInset(this);
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
}
case LFUN_INSET_DIALOG_UPDATE:
InsetMinipageMailer(*this).updateDialog(cmd.view());
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
default:
return InsetCollapsable::priv_dispatch(cmd, idx, pos);
InsetNoteMailer::string2params(cmd.argument, params_);
setButtonLabel();
bv->updateInset(this);
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
}
case LFUN_INSET_EDIT:
if (cmd.button() == mouse_button::button3)
- return DispatchResult(UNDISPATCHED);
+ return DispatchResult(false);
return InsetCollapsable::priv_dispatch(cmd, idx, pos);
case LFUN_INSET_DIALOG_UPDATE:
InsetNoteMailer("note", *this).updateDialog(bv);
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
case LFUN_MOUSE_RELEASE:
if (cmd.button() == mouse_button::button3 && hitButton(cmd)) {
InsetNoteMailer("note", *this).showDialog(bv);
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
}
// fallthrough:
dispatch(FuncRequest(LFUN_REF_GOTO, getContents()));
else
InsetCommandMailer("ref", *this).showDialog(cmd.view());
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
default:
return InsetCommand::priv_dispatch(cmd, idx, pos);
bool InsetTabular::lfunMouseRelease(FuncRequest const & cmd)
{
- DispatchResult ret = DispatchResult(UNDISPATCHED);
+ DispatchResult ret(false);
if (the_locking_inset) {
FuncRequest cmd1 = cmd;
cmd1.x -= inset_x;
cmd1.y -= inset_y;
ret = the_locking_inset->dispatch(cmd1);
}
- if (cmd.button() == mouse_button::button3 && ret == DispatchResult(UNDISPATCHED)) {
+ if (cmd.button() == mouse_button::button3 && ret == DispatchResult(false)) {
InsetTabularMailer(*this).showDialog(cmd.view());
return true;
}
- return ret >= DispatchResult(DISPATCHED);
+ return ret.dispatched() || ret.val() > FINISHED;
}
if (!bv->lockInset(this)) {
lyxerr << "InsetTabular::Cannot lock inset" << endl;
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
}
finishUndo();
activateCellInset(bv, cmd.x - inset_x, cmd.y - inset_y, cmd.button());
}
}
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
}
- if (result == DispatchResult(DISPATCHED) || result == DispatchResult(DISPATCHED_NOUPDATE)) {
+ if (result.dispatched()) {
resetPos(bv);
return result;
}
if (cmd.action < 0 && cmd.argument.empty())
- return DispatchResult(FINISHED);
+ return DispatchResult(false, FINISHED);
bool hs = hasSelection();
- result = DispatchResult(DISPATCHED);
+ result = DispatchResult(true);
// this one have priority over the locked InsetText, if we're not already
// inside another tabular then that one get's priority!
if (getFirstLockingInsetOfType(InsetOld::TABULAR_CODE) == this) {
switch (cmd.action) {
case LFUN_MOUSE_PRESS:
lfunMousePress(cmd);
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
case LFUN_MOUSE_MOTION:
lfunMouseMotion(cmd);
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
case LFUN_MOUSE_RELEASE:
- return lfunMouseRelease(cmd) ? DispatchResult(DISPATCHED) : DispatchResult(UNDISPATCHED);
+ return DispatchResult(lfunMouseRelease(cmd));
case LFUN_CELL_BACKWARD:
case LFUN_CELL_FORWARD:
if (hs)
updateLocal(bv);
if (!the_locking_inset)
- return DispatchResult(DISPATCHED_NOUPDATE);
+ return DispatchResult(true, NOUPDATE);
return result;
// this to avoid compiler warnings.
default:
string arg = cmd.argument;
if (the_locking_inset) {
result = the_locking_inset->dispatch(cmd);
- if (result == DispatchResult(DISPATCHED_NOUPDATE)) {
- int sc = scroll();
- resetPos(bv);
- if (sc != scroll()) { // inset has been scrolled
+ if (result.dispatched()) {
+ if (result.val() == NOUPDATE) {
+ int const sc = scroll();
+ resetPos(bv);
+ if (sc != scroll()) {
+ // inset has been scrolled
+ updateLocal(bv);
+ }
+ } else {
updateLocal(bv);
}
return result;
- } else if (result == DispatchResult(DISPATCHED)) {
- updateLocal(bv);
- return result;
- } else if (result == DispatchResult(FINISHED_UP)) {
+ } else if (result.val() == FINISHED_UP) {
action = LFUN_UP;
// Make sure to reset status message after
// exiting, e.g. math inset
bv->owner()->clearMessage();
- } else if (result == DispatchResult(FINISHED_DOWN)) {
+ } else if (result.val() == FINISHED_DOWN) {
action = LFUN_DOWN;
bv->owner()->clearMessage();
- } else if (result == DispatchResult(FINISHED_RIGHT)) {
+ } else if (result.val() == FINISHED_RIGHT) {
action = LFUN_RIGHT;
bv->owner()->clearMessage();
- } else if (result == DispatchResult(FINISHED)) {
+ } else if (result.val() == FINISHED) {
bv->owner()->clearMessage();
}
}
- result = DispatchResult(DISPATCHED);
+ result = DispatchResult(true);
switch (action) {
// --- Cursor Movements ----------------------------------
case LFUN_RIGHTSEL: {
break;
case LFUN_TABULAR_FEATURE:
if (!tabularFeatures(bv, arg))
- result = DispatchResult(UNDISPATCHED);
+ result = DispatchResult(false);
break;
// insert file functions
case LFUN_FILE_INSERT_ASCII_PARA:
if (insertAsciiString(bv, tmpstr, false))
updateLocal(bv);
else
- result = DispatchResult(UNDISPATCHED);
+ result = DispatchResult(false);
break;
}
// cut and paste functions
default:
// handle font changing stuff on selection before we lock the inset
// in the default part!
- result = DispatchResult(UNDISPATCHED);
+ result = DispatchResult(false);
if (hs) {
switch(action) {
case LFUN_LANGUAGE:
case LFUN_UNDERLINE:
case LFUN_FONT_SIZE:
if (bv->dispatch(FuncRequest(bv, action, arg)))
- result = DispatchResult(DISPATCHED);
+ result = DispatchResult(true);
break;
default:
break;
}
// we try to activate the actual inset and put this event down to
// the insets dispatch function.
- if (result == DispatchResult(DISPATCHED) || the_locking_inset)
+ if (result.dispatched() || the_locking_inset)
break;
if (activateCellInset(bv)) {
result = the_locking_inset->dispatch(FuncRequest(bv, action, arg));
- if (result == DispatchResult(UNDISPATCHED) || result >= DispatchResult(FINISHED)) {
+ if (!result.dispatched()) {
unlockInsetInInset(bv, the_locking_inset);
// we need to update if this was requested before
updateLocal(bv);
- return DispatchResult(UNDISPATCHED);
+ return DispatchResult(false);
}
if (hs)
clearSelection();
}
break;
}
- if (!(result >= DispatchResult(FINISHED))) {
- if (!the_locking_inset && bv->fitCursor())
- updateLocal(bv);
- } else
+
+ if (result.val() >= FINISHED)
bv->unlockInset(this);
+ else if (!the_locking_inset && bv->fitCursor())
+ updateLocal(bv);
+
return result;
}
{
if (lock && !old_locking_inset) {
if (activateCellInset(bv))
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
} else {
bool moved = isRightToLeft(bv)
? movePrevCell(bv) : moveNextCell(bv);
if (!moved)
- return DispatchResult(FINISHED_RIGHT);
+ return DispatchResult(false, FINISHED_RIGHT);
if (lock && activateCellInset(bv))
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
}
resetPos(bv);
- return DispatchResult(DISPATCHED_NOUPDATE);
+ return DispatchResult(true, NOUPDATE);
}
{
bool moved = isRightToLeft(bv) ? moveNextCell(bv) : movePrevCell(bv);
if (!moved)
- return DispatchResult(FINISHED);
+ return DispatchResult(false, FINISHED);
// behind the inset
if (lock && activateCellInset(bv, 0, 0, mouse_button::none, true))
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
resetPos(bv);
- return DispatchResult(DISPATCHED_NOUPDATE);
+ return DispatchResult(true, NOUPDATE);
}
int const ocell = actcell;
actcell = tabular.getCellAbove(actcell);
if (actcell == ocell) // we moved out of the inset
- return DispatchResult(FINISHED_UP);
+ return DispatchResult(false, FINISHED_UP);
resetPos(bv);
if (lock) {
int x = 0;
x -= cursorx_ + tabular.getBeginningOfTextInCell(actcell);
}
if (activateCellInset(bv, x, 0))
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
}
- return DispatchResult(DISPATCHED_NOUPDATE);
+ return DispatchResult(true, NOUPDATE);
}
int const ocell = actcell;
actcell = tabular.getCellBelow(actcell);
if (actcell == ocell) // we moved out of the inset
- return DispatchResult(FINISHED_DOWN);
+ return DispatchResult(false, FINISHED_DOWN);
resetPos(bv);
if (lock) {
int x = 0;
x -= cursorx_ + tabular.getBeginningOfTextInCell(actcell);
}
if (activateCellInset(bv, x, 0))
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
}
- return DispatchResult(DISPATCHED_NOUPDATE);
+ return DispatchResult(true, NOUPDATE);
}
cmd1.y -= inset_y;
no_selection = true;
- if (the_locking_inset)
- return the_locking_inset->dispatch(cmd1) >= DispatchResult(DISPATCHED);
+ if (the_locking_inset) {
+ DispatchResult const res = the_locking_inset->dispatch(cmd1);
+
+ return res.dispatched() || res.val() >= NOUPDATE;
+ }
int tmp_x = cmd.x;
int tmp_y = cmd.y + dim_.asc - bv->top_y();
// We still need to deal properly with the whole relative vs.
// absolute mouse co-ords thing in a realiable, sensible way
- bool ret = inset->dispatch(cmd1) >= DispatchResult(DISPATCHED);
+ DispatchResult const res = inset->dispatch(cmd1);
+ bool const ret = res.dispatched() || res.val() >= NOUPDATE;
updateLocal(bv, false);
return ret;
}
if (!bv->lockInset(this)) {
lyxerr[Debug::INSETS] << "Cannot lock inset" << endl;
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
}
locked = true;
updateLocal(bv, false);
// Tell the paragraph dialog that we've entered an insettext.
bv->dispatch(FuncRequest(LFUN_PARAGRAPH_UPDATE));
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
}
case LFUN_MOUSE_PRESS:
lfunMousePress(cmd);
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
case LFUN_MOUSE_MOTION:
lfunMouseMotion(cmd);
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
case LFUN_MOUSE_RELEASE:
- return lfunMouseRelease(cmd) ? DispatchResult(DISPATCHED) : DispatchResult(UNDISPATCHED);
+ return DispatchResult(lfunMouseRelease(cmd));
default:
break;
no_selection = false;
DispatchResult result = UpdatableInset::priv_dispatch(cmd, idx, pos);
- if (result != DispatchResult(UNDISPATCHED))
- return DispatchResult(DISPATCHED);
+ if (result.dispatched())
+ return DispatchResult(true);
- result = DispatchResult(DISPATCHED);
+ result = DispatchResult(true);
if (cmd.action < 0 && cmd.argument.empty())
- return DispatchResult(FINISHED);
+ return DispatchResult(false, FINISHED);
if (the_locking_inset) {
result = the_locking_inset->dispatch(cmd);
- if (result == DispatchResult(DISPATCHED_NOUPDATE))
- return result;
- if (result == DispatchResult(DISPATCHED)) {
- updateLocal(bv, false);
+
+ if (result.dispatched()) {
+ if (result.val() != NOUPDATE)
+ updateLocal(bv, false);
return result;
}
- if (result >= DispatchResult(FINISHED)) {
- switch (result.val()) {
- case FINISHED_RIGHT:
- moveRightIntern(bv, false, false);
- result = DispatchResult(DISPATCHED);
- break;
- case FINISHED_UP:
- result = moveUp(bv);
- if (result >= DispatchResult(FINISHED)) {
- updateLocal(bv, false);
- bv->unlockInset(this);
- }
- break;
- case FINISHED_DOWN:
- result = moveDown(bv);
- if (result >= DispatchResult(FINISHED)) {
- updateLocal(bv, false);
- bv->unlockInset(this);
- }
- break;
- default:
- result = DispatchResult(DISPATCHED);
- break;
+
+ switch (result.val()) {
+ case FINISHED_RIGHT:
+ moveRightIntern(bv, false, false);
+ result = DispatchResult(true);
+ break;
+ case FINISHED_UP:
+ result = moveUp(bv);
+ if (result.val() >= FINISHED) {
+ updateLocal(bv, false);
+ bv->unlockInset(this);
}
- the_locking_inset = 0;
- updateLocal(bv, false);
- // make sure status gets reset immediately
- bv->owner()->clearMessage();
- return result;
+ break;
+ case FINISHED_DOWN:
+ result = moveDown(bv);
+ if (result.val() >= FINISHED) {
+ updateLocal(bv, false);
+ bv->unlockInset(this);
+ }
+ break;
+ default:
+ result = DispatchResult(true);
+ break;
}
+ the_locking_inset = 0;
+ updateLocal(bv, false);
+ // make sure status gets reset immediately
+ bv->owner()->clearMessage();
+ return result;
}
bool updflag = false;
}
text_.selection.cursor = text_.cursor;
updflag = true;
- result = DispatchResult(DISPATCHED_NOUPDATE);
+ result = DispatchResult(true, NOUPDATE);
break;
// cursor movements that need special handling
case LFUN_PRIOR:
if (crow() == text_.firstRow())
- result = DispatchResult(FINISHED_UP);
+ result = DispatchResult(false, FINISHED_UP);
else {
text_.cursorPrevious();
text_.clearSelection();
- result = DispatchResult(DISPATCHED_NOUPDATE);
+ result = DispatchResult(true, NOUPDATE);
}
break;
case LFUN_NEXT:
if (crow() == text_.lastRow())
- result = DispatchResult(FINISHED_DOWN);
+ result = DispatchResult(false, FINISHED_DOWN);
else {
text_.cursorNext();
text_.clearSelection();
- result = DispatchResult(DISPATCHED_NOUPDATE);
+ result = DispatchResult(true, NOUPDATE);
}
break;
case LFUN_BREAKPARAGRAPH:
if (!autoBreakRows_) {
- result = DispatchResult(DISPATCHED);
+ result = DispatchResult(true);
} else {
replaceSelection(bv->getLyXText());
text_.breakParagraph(paragraphs, 0);
case LFUN_BREAKPARAGRAPHKEEPLAYOUT:
if (!autoBreakRows_) {
- result = DispatchResult(DISPATCHED);
+ result = DispatchResult(true);
} else {
replaceSelection(bv->getLyXText());
text_.breakParagraph(paragraphs, 1);
case LFUN_BREAKLINE: {
if (!autoBreakRows_) {
- result = DispatchResult(DISPATCHED);
+ result = DispatchResult(true);
} else {
replaceSelection(bv->getLyXText());
text_.insertInset(new InsetNewline);
default:
if (!bv->dispatch(cmd))
- result = DispatchResult(UNDISPATCHED);
+ result = DispatchResult(false);
break;
}
setFont(bv, font, false);
}
- if (result >= DispatchResult(FINISHED))
+ if (result.val() >= FINISHED)
bv->unlockInset(this);
- if (result == DispatchResult(DISPATCHED_NOUPDATE))
- result = DispatchResult(DISPATCHED);
+ if (result.val() == NOUPDATE)
+ result = DispatchResult(true);
return result;
}
ParagraphList::iterator c_par = cpar();
if (boost::next(c_par) == paragraphs.end() && cpos() >= c_par->size())
- return DispatchResult(FINISHED_RIGHT);
+ return DispatchResult(false, FINISHED_RIGHT);
if (activate_inset && checkAndActivateInset(bv, front))
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
text_.cursorRight(bv);
if (!selecting)
text_.clearSelection();
- return DispatchResult(DISPATCHED_NOUPDATE);
+ return DispatchResult(true, NOUPDATE);
}
bool activate_inset, bool selecting)
{
if (cpar() == paragraphs.begin() && cpos() <= 0)
- return DispatchResult(FINISHED);
+ return DispatchResult(false, FINISHED);
text_.cursorLeft(bv);
if (!selecting)
text_.clearSelection();
if (activate_inset && checkAndActivateInset(bv, front))
- return DispatchResult(DISPATCHED);
- return DispatchResult(DISPATCHED_NOUPDATE);
+ return DispatchResult(true);
+ return DispatchResult(true, NOUPDATE);
}
DispatchResult InsetText::moveUp(BufferView * bv)
{
if (crow() == text_.firstRow())
- return DispatchResult(FINISHED_UP);
+ return DispatchResult(false, FINISHED_UP);
text_.cursorUp(bv);
text_.clearSelection();
- return DispatchResult(DISPATCHED_NOUPDATE);
+ return DispatchResult(true, NOUPDATE);
}
DispatchResult InsetText::moveDown(BufferView * bv)
{
if (crow() == text_.lastRow())
- return DispatchResult(FINISHED_DOWN);
+ return DispatchResult(false, FINISHED_DOWN);
text_.cursorDown(bv);
text_.clearSelection();
- return DispatchResult(DISPATCHED_NOUPDATE);
+ return DispatchResult(true, NOUPDATE);
}
case LFUN_MOUSE_RELEASE:
if (button().box().contains(cmd.x, cmd.y))
InsetCommandMailer("toc", *this).showDialog(cmd.view());
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
case LFUN_INSET_DIALOG_SHOW:
InsetCommandMailer("toc", *this).showDialog(cmd.view());
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
default:
return InsetCommand::priv_dispatch(cmd, idx, pos);
switch (cmd.action) {
case LFUN_INSET_EDIT:
InsetCommandMailer("url", *this).showDialog(cmd.view());
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
default:
return InsetCommand::priv_dispatch(cmd, idx, pos);
}
params_.width = params.width;
cmd.view()->updateInset(this);
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
}
case LFUN_INSET_DIALOG_UPDATE:
InsetWrapMailer(*this).updateDialog(cmd.view());
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
default:
return InsetCollapsable::priv_dispatch(cmd, idx, pos);
UpdatableInset::priv_dispatch(FuncRequest const & ev, idx_type &, pos_type &)
{
if (ev.action == LFUN_MOUSE_RELEASE)
- return (editable() == IS_EDITABLE) ? DispatchResult(DISPATCHED) : DispatchResult(UNDISPATCHED);
+ return DispatchResult(editable() == IS_EDITABLE);
if (!ev.argument.empty() && ev.action == LFUN_SCROLL_INSET) {
if (ev.argument.find('.') != ev.argument.npos) {
}
ev.view()->updateInset(this);
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
}
- return DispatchResult(UNDISPATCHED);
+ return DispatchResult(false);
}
{
Cursor cursor;
buildCursor(cursor, *view());
- if (cursor.dispatch(FuncRequest(func, view())) == DispatchResult(DISPATCHED)) {
+ if (cursor.dispatch(FuncRequest(func, view())).dispatched()) {
lyxerr << "dispatched by Cursor::dispatch()\n";
goto exit_with_message;
}
- lyxerr << "### NOT DispatchResult(DISPATCHED) BY Cursor::dispatch() ###\n";
+ lyxerr << "### NOT DispatchResult(true) BY Cursor::dispatch() ###\n";
}
#endif
// Hand-over to inset's own dispatch:
result = inset->dispatch(FuncRequest(view(), action, argument));
- if (result == DispatchResult(DISPATCHED) || result == DispatchResult(DISPATCHED_NOUPDATE)) {
+ if (result.dispatched()) {
goto exit_with_message;
}
- // If DispatchResult(UNDISPATCHED), just soldier on
- if (result == DispatchResult(FINISHED)) {
+ // If DispatchResult(false), just soldier on
+ if (result.val() == FINISHED) {
owner->clearMessage();
goto exit_with_message;
// We do not need special RTL handling here:
- // DispatchResult(FINISHED) means that the cursor should be
+ // FINISHED means that the cursor should be
// one position after the inset.
}
- if (result == DispatchResult(FINISHED_RIGHT)) {
+ if (result.val() == FINISHED_RIGHT) {
view()->text->cursorRight(view());
moveCursorUpdate();
owner->clearMessage();
goto exit_with_message;
}
- if (result == DispatchResult(FINISHED_UP)) {
+ if (result.val() == FINISHED_UP) {
LyXText * text = view()->text;
ParagraphList::iterator pit = text->cursorPar();
Row const & row = *pit->getRow(text->cursor.pos());
goto exit_with_message;
}
- if (result == DispatchResult(FINISHED_DOWN)) {
+ if (result.val() == FINISHED_DOWN) {
LyXText * text = view()->text;
ParagraphList::iterator pit = text->cursorPar();
Row const & row = *pit->getRow(text->cursor.pos());
+2003-11-01 Lars Gullik Bjønnes <larsbj@gullik.net>
+
+ * adjust for DispatchResult changes
+
2003-10-31 José Matos <jamatos@lyx.org>
* formula.[Ch] (ascii, linuxdoc, docbook):
2003-10-29 Lars Gullik Bjønnes <larsbj@gullik.net>
- * math_scriptinset.C (priv_dispatch):
- * math_nestinset.C (priv_dispatch):
- * math_hullinset.C (priv_dispatch):
- * math_gridinset.C (priv_dispatch):
- * math_cursor.C (dispatch):
- * formulabase.C (lfunMouseRelease, lfunMousePress)
- (lfunMouseMotion, priv_dispatch):
+ * math_scriptinset.C (priv_dispatch):
+ * math_nestinset.C (priv_dispatch):
+ * math_hullinset.C (priv_dispatch):
+ * math_gridinset.C (priv_dispatch):
+ * math_cursor.C (dispatch):
+ * formulabase.C (lfunMouseRelease, lfunMousePress)
+ (lfunMouseMotion, priv_dispatch):
* command_inset.C (priv_dispatch): explict DispatchResult ctor fallout.
2003-10-29 Lars Gullik Bjønnes <larsbj@gullik.net>
default:
return MathNestInset::priv_dispatch(cmd, idx, pos);
}
- return DispatchResult(UNDISPATCHED);
+ return DispatchResult(false);
}
DispatchResult InsetFormulaBase::lfunMouseRelease(FuncRequest const & cmd)
{
if (!mathcursor)
- return DispatchResult(UNDISPATCHED);
+ return DispatchResult(false);
BufferView * bv = cmd.view();
bv->updateInset(this);
if (cmd.button() == mouse_button::button3) {
// try to dispatch to enclosed insets first
- if (mathcursor->dispatch(cmd) == DispatchResult(UNDISPATCHED)) {
+ if (!mathcursor->dispatch(cmd).dispatched()) {
// launch math panel for right mouse button
lyxerr << "lfunMouseRelease: undispatched: " << cmd.button() << endl;
bv->owner()->getDialogs().show("mathpanel");
}
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
}
if (cmd.button() == mouse_button::button2) {
mathcursor->setPos(cmd.x + xo_, cmd.y + yo_);
mathcursor->insert(ar);
bv->updateInset(this);
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
}
if (cmd.button() == mouse_button::button1) {
//mathcursor = new MathCursor(this, x == 0);
//metrics(bv);
//mathcursor->setPos(x + xo_, y + yo_);
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
}
- return DispatchResult(UNDISPATCHED);
+ return DispatchResult(false);
}
if (cmd.button() == mouse_button::button3) {
mathcursor->dispatch(cmd);
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
}
if (cmd.button() == mouse_button::button1) {
mathcursor->selClear();
mathcursor->setPos(cmd.x + xo_, cmd.y + yo_);
mathcursor->dispatch(cmd);
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
}
bv->updateInset(this);
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
}
DispatchResult InsetFormulaBase::lfunMouseMotion(FuncRequest const & cmd)
{
if (!mathcursor)
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
- if (mathcursor->dispatch(FuncRequest(cmd)) != DispatchResult(UNDISPATCHED))
- return DispatchResult(DISPATCHED);
+ if (mathcursor->dispatch(FuncRequest(cmd)).dispatched())
+ return DispatchResult(true);
// only select with button 1
if (cmd.button() != mouse_button::button1)
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
if (abs(cmd.x - first_x) < 2 && abs(cmd.y - first_y) < 2)
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
first_x = cmd.x;
first_y = cmd.y;
BufferView * bv = cmd.view();
mathcursor->setPos(cmd.x + xo_, cmd.y + yo_);
bv->updateInset(this);
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
}
// if that is removed, we won't get the magenta box when entering an
// inset for the first time
bv->updateInset(this);
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
case LFUN_MOUSE_PRESS:
//lyxerr << "Mouse single press" << endl;
}
if (!mathcursor)
- return DispatchResult(UNDISPATCHED);
+ return DispatchResult(false);
string argument = cmd.argument;
- DispatchResult result = DispatchResult(DISPATCHED);
+ DispatchResult result(true);
bool sel = false;
bool was_macro = mathcursor->inMacroMode();
bool was_selection = mathcursor->selection();
case LFUN_RIGHTSEL:
sel = true; // fall through...
case LFUN_RIGHT:
- result = mathcursor->right(sel) ? DispatchResult(DISPATCHED) : DispatchResult(FINISHED_RIGHT);
+ result = mathcursor->right(sel) ? DispatchResult(true) : DispatchResult(false, FINISHED_RIGHT);
//lyxerr << "calling scroll 20" << endl;
//scroll(bv, 20);
// write something to the minibuffer
case LFUN_LEFTSEL:
sel = true; // fall through
case LFUN_LEFT:
- result = mathcursor->left(sel) ? DispatchResult(DISPATCHED) : DispatchResult(FINISHED);
+ result = mathcursor->left(sel) ? DispatchResult(true) : DispatchResult(true, FINISHED);
break;
case LFUN_UPSEL:
sel = true; // fall through
case LFUN_UP:
- result = mathcursor->up(sel) ? DispatchResult(DISPATCHED) : DispatchResult(FINISHED_UP);
+ result = mathcursor->up(sel) ? DispatchResult(true) : DispatchResult(false, FINISHED_UP);
break;
case LFUN_DOWNSEL:
sel = true; // fall through
case LFUN_DOWN:
- result = mathcursor->down(sel) ? DispatchResult(DISPATCHED) : DispatchResult(FINISHED_DOWN);
+ result = mathcursor->down(sel) ? DispatchResult(true) : DispatchResult(false, FINISHED_DOWN);
break;
case LFUN_WORDSEL:
case LFUN_UP_PARAGRAPH:
case LFUN_DOWN_PARAGRAPHSEL:
case LFUN_DOWN_PARAGRAPH:
- result = DispatchResult(FINISHED);
+ result = DispatchResult(true, FINISHED);
break;
case LFUN_HOMESEL:
sel = true; // fall through
case LFUN_HOME:
case LFUN_WORDLEFT:
- result = mathcursor->home(sel) ? DispatchResult(DISPATCHED) : DispatchResult(FINISHED);
+ result = mathcursor->home(sel) ? DispatchResult(true) : DispatchResult(true, FINISHED);
break;
case LFUN_ENDSEL:
sel = true; // fall through
case LFUN_END:
case LFUN_WORDRIGHT:
- result = mathcursor->end(sel) ? DispatchResult(DISPATCHED) : DispatchResult(FINISHED_RIGHT);
+ result = mathcursor->end(sel) ? DispatchResult(true) : DispatchResult(false, FINISHED_RIGHT);
break;
case LFUN_PRIORSEL:
case LFUN_PRIOR:
case LFUN_BEGINNINGBUFSEL:
case LFUN_BEGINNINGBUF:
- result = DispatchResult(FINISHED);
+ result = DispatchResult(true, FINISHED);
break;
case LFUN_NEXTSEL:
case LFUN_NEXT:
case LFUN_ENDBUFSEL:
case LFUN_ENDBUF:
- result = DispatchResult(FINISHED_RIGHT);
+ result = DispatchResult(false, FINISHED_RIGHT);
break;
case LFUN_CELL_FORWARD:
case LFUN_BACKSPACE:
recordUndo(bv, Undo::ATOMIC);
if (!mathcursor->backspace()) {
- result = DispatchResult(FINISHED);
+ result = DispatchResult(true, FINISHED);
remove_inset = true;
}
break;
case LFUN_DELETE:
recordUndo(bv, Undo::ATOMIC);
if (!mathcursor->erase()) {
- result = DispatchResult(FINISHED);
+ result = DispatchResult(true, FINISHED);
remove_inset = true;
}
break;
case LFUN_EXEC_COMMAND:
- result = DispatchResult(UNDISPATCHED);
+ result = DispatchResult(false);
break;
case LFUN_INSET_ERT:
if (!argument.empty()) {
recordUndo(bv, Undo::ATOMIC);
if (argument.size() == 1)
- result = mathcursor->interpret(argument[0]) ? DispatchResult(DISPATCHED) : DispatchResult(FINISHED_RIGHT);
+ result = mathcursor->interpret(argument[0]) ? DispatchResult(true) : DispatchResult(false, FINISHED_RIGHT);
else
mathcursor->insert(argument);
}
if (mathcursor->selection())
mathcursor->selClear();
else
- result = DispatchResult(UNDISPATCHED);
+ result = DispatchResult(false);
break;
case LFUN_INSET_TOGGLE:
break;
case LFUN_DIALOG_SHOW:
- result = DispatchResult(UNDISPATCHED);
+ result = DispatchResult(false);
break;
case LFUN_DIALOG_SHOW_NEW_INSET: {
}
if (data.empty())
- result = DispatchResult(UNDISPATCHED);
+ result = DispatchResult(false);
else {
bv->owner()->getDialogs().show(name, data, 0);
}
MathArray ar;
if (createMathInset_fromDialogStr(cmd.argument, ar)) {
mathcursor->insert(ar);
- result = DispatchResult(DISPATCHED);
+ result = DispatchResult(true);
} else {
- result = DispatchResult(UNDISPATCHED);
+ result = DispatchResult(false);
}
}
}
break;
default:
- result = DispatchResult(UNDISPATCHED);
+ result = DispatchResult(false);
}
- if (result == DispatchResult(DISPATCHED))
+ if (result == DispatchResult(true))
bv->updateInset(this);
mathcursor->normalize();
if (mathcursor->selection() || was_selection)
toggleInsetSelection(bv);
- if (result == DispatchResult(DISPATCHED) || result == DispatchResult(DISPATCHED_NOUPDATE) ||
- result == DispatchResult(UNDISPATCHED)) {
+ if (result.val() <= NOUPDATE) {
fitInsetCursor(bv);
revealCodes(bv);
cmd.view()->stuffClipboard(mathcursor->grabSelection());
case LFUN_MOUSE_RELEASE:
case LFUN_MOUSE_DOUBLE: {
CursorPos & pos = Cursor_.back();
- DispatchResult res = DispatchResult(UNDISPATCHED);
- int x = 0, y = 0;
+ int x = 0;
+ int y = 0;
getPos(x, y);
if (x < cmd.x && hasPrevAtom()) {
- res = prevAtom().nucleus()->dispatch(cmd, pos.idx_, pos.pos_);
- if (res != DispatchResult(UNDISPATCHED))
+ DispatchResult const res =
+ prevAtom().nucleus()->dispatch(cmd, pos.idx_, pos.pos_);
+ if (res.dispatched())
return res;
}
if (x > cmd.x && hasNextAtom()) {
- res = nextAtom().nucleus()->dispatch(cmd, pos.idx_, pos.pos_);
- if (res != DispatchResult(UNDISPATCHED))
+ DispatchResult const res =
+ nextAtom().nucleus()->dispatch(cmd, pos.idx_, pos.pos_);
+ if (res.dispatched())
return res;
}
}
for (int i = Cursor_.size() - 1; i >= 0; --i) {
CursorPos & pos = Cursor_[i];
- DispatchResult res = pos.inset_->dispatch(cmd, pos.idx_, pos.pos_);
- if (res != DispatchResult(UNDISPATCHED)) {
- if (res == DispatchResult(FINISHED)) {
+ DispatchResult const res =
+ pos.inset_->dispatch(cmd, pos.idx_, pos.pos_);
+ if (res.dispatched()) {
+ if (res.val() == FINISHED) {
Cursor_.shrink(i + 1);
selClear();
}
return res;
}
}
- return DispatchResult(UNDISPATCHED);
+ return DispatchResult(false);
}
case LFUN_MOUSE_RELEASE:
//if (cmd.button() == mouse_button::button3) {
// GridInsetMailer(*this).showDialog();
- // return DispatchResult(DISPATCHED);
+ // return DispatchResult(true);
//}
- return DispatchResult(UNDISPATCHED);
+ return DispatchResult(false);
case LFUN_INSET_DIALOG_UPDATE:
GridInsetMailer(*this).updateDialog(cmd.view());
- return DispatchResult(UNDISPATCHED);
+ return DispatchResult(false);
// insert file functions
case LFUN_DELETE_LINE_FORWARD:
idx = nargs() - 1;
if (pos > cell(idx).size())
pos = cell(idx).size();
- return DispatchResult(FINISHED);
+ return DispatchResult(true, FINISHED);
case LFUN_CELL_SPLIT:
//recordUndo(bv, Undo::ATOMIC);
splitCell(idx, pos);
- return DispatchResult(FINISHED);
+ return DispatchResult(true, FINISHED);
case LFUN_BREAKLINE: {
//recordUndo(bv, Undo::INSERT);
pos = cell(idx).size();
//mathcursor->normalize();
- return DispatchResult(FINISHED);
+ return DispatchResult(true, FINISHED);
}
case LFUN_TABULAR_FEATURE: {
else if (s == "swap-column")
swapCol(col(idx));
else
- return DispatchResult(UNDISPATCHED);
- lyxerr << "returning DispatchResult(FINISHED)" << endl;
- return DispatchResult(FINISHED);
+ return DispatchResult(false);
+ lyxerr << "returning DispatchResult(true, FINISHED)" << endl;
+ return DispatchResult(true, FINISHED);
}
case LFUN_PASTE: {
for (col_type c = 0; c < grid.ncols(); ++c)
cell(i).append(grid.cell(grid.index(r, c)));
}
- return DispatchResult(FINISHED);
+ return DispatchResult(true, FINISHED);
}
default:
mutate("eqnarray");
idx = 1;
pos = 0;
- return DispatchResult(FINISHED);
+ return DispatchResult(true, FINISHED);
}
return MathGridInset::priv_dispatch(cmd, idx, pos);
numbered(row, !old);
//bv->owner()->message(old ? _("No number") : _("Number"));
}
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
case LFUN_MATH_NONUMBER:
if (display()) {
//bv->owner()->message(old ? _("No number") : _("Number"));
numbered(r, !old);
}
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
case LFUN_INSERT_LABEL: {
row_type r = (type_ == "multline") ? nrows() - 1 : row(idx);
? Alert::askForText(_("Enter new label to insert:"), default_label)
: Alert::askForText(_("Enter label:"), old_label);
if (!res.first)
- return DispatchResult(UNDISPATCHED);
+ return DispatchResult(false);
new_label = trim(res.second);
}
if (!new_label.empty())
numbered(r, true);
label(r, new_label);
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
}
case LFUN_MATH_EXTERN:
doExtern(cmd, idx, pos);
- return DispatchResult(FINISHED);
+ return DispatchResult(true, FINISHED);
case LFUN_MATH_MUTATE: {
lyxerr << "Hull: MUTATE: " << cmd.argument << endl;
idx = nargs() - 1;
if (pos > cell(idx).size())
pos = cell(idx).size();
- return DispatchResult(FINISHED);
+ return DispatchResult(true, FINISHED);
}
case LFUN_MATH_DISPLAY: {
mutate(type_ == "simple" ? "equation" : "simple");
idx = 0;
pos = cell(idx).size();
- return DispatchResult(FINISHED);
+ return DispatchResult(true, FINISHED);
}
default:
mathed_parse_cell(ar, cmd.argument);
cell(idx).insert(pos, ar);
pos += ar.size();
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
}
case LFUN_PASTESELECTION:
case LFUN_MOUSE_PRESS:
if (cmd.button() == mouse_button::button2)
return priv_dispatch(FuncRequest(bv, LFUN_PASTESELECTION), idx, pos);
- return DispatchResult(UNDISPATCHED);
+ return DispatchResult(false);
default:
return MathInset::priv_dispatch(cmd, idx, pos);
limits_ = (hasLimits()) ? -1 : 1;
else
limits_ = 0;
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
}
return MathNestInset::priv_dispatch(cmd, idx, pos);
if (cmd.getArg(0) == "ref") {
MathArray ar;
if (!createMathInset_fromDialogStr(cmd.argument, ar))
- return DispatchResult(UNDISPATCHED);
+ return DispatchResult(false);
*this = *ar[0].nucleus()->asRefInset();
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
}
break;
case LFUN_MOUSE_RELEASE:
if (cmd.button() == mouse_button::button3) {
lyxerr << "trying to goto ref" << cell(0) << endl;
cmd.view()->dispatch(FuncRequest(LFUN_REF_GOTO, asString(cell(0))));
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
}
if (cmd.button() == mouse_button::button1) {
// Eventually trigger dialog with button 3
string const data = createDialogStr("ref");
cmd.view()->owner()->getDialogs().
show("ref", data, this);
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
}
break;
case LFUN_MOUSE_PRESS:
case LFUN_MOUSE_MOTION:
// eat other mouse commands
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
default:
return CommandInset::priv_dispatch(cmd, idx, pos);
}
// not our business
- return DispatchResult(UNDISPATCHED);
+ return DispatchResult(false);
}
case LFUN_BEGINNINGBUFSEL:
if (inset_owner)
- return DispatchResult(UNDISPATCHED);
+ return DispatchResult(false);
cursorTop();
finishChange(bv, true);
break;
case LFUN_ENDBUFSEL:
if (inset_owner)
- return DispatchResult(UNDISPATCHED);
+ return DispatchResult(false);
cursorBottom();
finishChange(bv, true);
break;
break;
default:
- return DispatchResult(UNDISPATCHED);
+ return DispatchResult(false);
}
- return DispatchResult(DISPATCHED);
+ return DispatchResult(true);
}