+2003-11-03 Lars Gullik Bjønnes <larsbj@gullik.net>
+
+ * text3.C (dispatch): adjust for new DisptchResult semantics.
+
+ * lyxfunc.C (dispatch): handle update when return from
+ Cursor::dispatch, adjust for new DispatchResult semantics.
+
+ * dispatchresult.h: drop NOUPDATE from dispatch_result_t. Make
+ DispatchResult(true) mean to not update. Add class functions for
+ setting dispatched and update, as well as reading.
+
+ * cursor.C (dispatch): don't handle update here
+
2003-11-03 Lars Gullik Bjønnes <larsbj@gullik.net>
* trans_mgr.h: store t1_ and t2_ in scoped_ptr
DispatchResult res = data_[i].inset_->dispatch(cmd);
lyxerr << " result: " << res.val() << endl;
- if (res.dispatched()) {
- if (res.val() != NOUPDATE) {
- //update();
- }
- return DispatchResult(true);
- }
+ if (res.dispatched())
+ return res;
lyxerr << "# unhandled result: " << res.val() << endl;
}
*/
enum dispatch_result_t {
NONE = 0,
- NOUPDATE,
FINISHED,
FINISHED_RIGHT,
FINISHED_UP,
FINISHED_DOWN
};
+
/** \c DispatchResult is a wrapper for dispatch_result_t.
* It can be forward-declared and passed as a function argument without
* having to expose insetbase.h.
: dispatched_(false), val_(NONE) {}
explicit
DispatchResult(bool dis)
- : dispatched_(dis), val_(NONE) {}
+ : dispatched_(dis), update_(false), val_(NONE) {}
+ DispatchResult(bool dis, bool update)
+ : dispatched_(dis), update_(true), val_(NONE) {}
DispatchResult(bool dis, dispatch_result_t val)
- : dispatched_(dis), val_(val) {}
+ : dispatched_(dis), update_(false), val_(val) {}
dispatch_result_t val() const { return val_; }
bool dispatched() const {
return dispatched_;
}
+ void dispatched(bool dis) {
+ dispatched_ = dis;
+ }
+ bool update() const {
+ return update_;
+ }
+ void update(bool up) {
+ update_ = up;
+ }
private:
bool dispatched_;
+ bool update_;
dispatch_result_t val_;
};
+2003-11-03 Lars Gullik Bjønnes <larsbj@gullik.net>
+
+ * Inset::dispatch's: adjust for new DispatchResult semantics.
+
2003-11-03 Lars Gullik Bjønnes <larsbj@gullik.net>
* render_base.h: make clone return an auto_ptr
* render_button.C (clone): adjust
* render_graphic.C (clone): adjust
* render_preview.C (clone): adjust
-
+
* insettheorem.C (clone): return an auto_ptr
* insettext.C (priv_dispatch): exception safety
case LFUN_INSET_EDIT:
InsetCommandMailer("bibitem", *this).showDialog(cmd.view());
- return DispatchResult(true);
+ return DispatchResult(true, true);
case LFUN_INSET_MODIFY: {
InsetCommandParams p;
InsetCommandMailer::string2params(cmd.argument, p);
if (p.getCmdName().empty())
- return DispatchResult(true);
+ return DispatchResult(true, true);
setParams(p);
cmd.view()->updateInset(this);
cmd.view()->fitCursor();
- return DispatchResult(true);
+ return DispatchResult(true, true);
}
default:
InsetBibtex::priv_dispatch(FuncRequest const & cmd,
idx_type & idx, pos_type & pos)
{
+ DispatchResult result(false);
+
switch (cmd.action) {
case LFUN_INSET_DIALOG_SHOW:
InsetCommandMailer("bibtex", *this).showDialog(cmd.view());
- return DispatchResult(true);
+ result.dispatched(true);
+ break;
+
case LFUN_MOUSE_RELEASE:
if (button().box().contains(cmd.x, cmd.y))
InsetCommandMailer("bibtex", *this).showDialog(cmd.view());
- return DispatchResult(true);
-
+ result.dispatched(true);
+ break;
+
case LFUN_INSET_MODIFY: {
InsetCommandParams p;
InsetCommandMailer::string2params(cmd.argument, p);
- if (p.getCmdName().empty())
- return DispatchResult(true);
- setParams(p);
- return DispatchResult(true);
+ if (!p.getCmdName().empty())
+ setParams(p);
+ result.dispatched(true);
+ result.update(true);
}
-
+ break;
+
default:
- return InsetCommand::priv_dispatch(cmd, idx, pos);
+ result = InsetCommand::priv_dispatch(cmd, idx, pos);
+ break;
}
+ return result;
}
+
string const InsetBibtex::getScreenLabel(Buffer const &) const
{
return _("BibTeX Generated References");
InsetBox::priv_dispatch(FuncRequest const & cmd,
idx_type & idx, pos_type & pos)
{
+ DispatchResult result(false);
BufferView * bv = cmd.view();
switch (cmd.action) {
InsetBoxMailer::string2params(cmd.argument, params_);
setButtonLabel();
bv->updateInset(this);
- return DispatchResult(true);
+ result.dispatched(true);
+ result.update(true);
+ break;
}
case LFUN_INSET_DIALOG_UPDATE:
InsetBoxMailer(*this).updateDialog(bv);
- return DispatchResult(true);
+ result.dispatched(true);
+ break;
case LFUN_MOUSE_RELEASE:
if (cmd.button() == mouse_button::button3 && hitButton(cmd)) {
// fallthrough:
default:
- return InsetCollapsable::priv_dispatch(cmd, idx, pos);
+ result = InsetCollapsable::priv_dispatch(cmd, idx, pos);
+ break;
}
+
+ return result;
}
{
BufferView * bv = cmd.view();
switch (cmd.action) {
- case LFUN_INSET_MODIFY:
- {
+ case LFUN_INSET_MODIFY: {
InsetBranchParams params;
InsetBranchMailer::string2params(cmd.argument, params);
params_.branch = params.branch;
setButtonLabel();
bv->updateInset(this);
- return DispatchResult(true);
- }
+ return DispatchResult(true, true);
+ }
case LFUN_INSET_EDIT:
if (cmd.button() != mouse_button::button3)
return InsetCollapsable::priv_dispatch(cmd, idx, pos);
-
return DispatchResult(false);
+
case LFUN_INSET_DIALOG_UPDATE:
InsetBranchMailer("branch", *this).updateDialog(bv);
return DispatchResult(true);
+
case LFUN_MOUSE_RELEASE:
if (cmd.button() == mouse_button::button3 && hitButton(cmd)) {
InsetBranchMailer("branch", *this).showDialog(bv);
switch (cmd.action) {
case LFUN_INSET_EDIT:
InsetCommandMailer("citation", *this).showDialog(cmd.view());
- return DispatchResult(true);
+ return DispatchResult(true, 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(true);
+ ret = inset.dispatch(adjustCommand(cmd)) == DispatchResult(true, true);
}
if (cmd.button() == mouse_button::button3 && !ret)
showInsetDialog(bv);
if (bv->lockInset(this))
inset.dispatch(cmd);
}
- return DispatchResult(true);
+ return DispatchResult(true, true);
}
#ifdef WITH_WARNINGS
#warning Fix this properly in BufferView_pimpl::workAreaButtonRelease
#endif
if (cmd.button() == mouse_button::button3)
- return DispatchResult(true);
+ return DispatchResult(true, true);
UpdatableInset::priv_dispatch(cmd, idx, pos);
// it was already collapsed!
first_after_edit = true;
if (!bv->lockInset(this))
- return DispatchResult(true);
+ return DispatchResult(true, true);
bv->updateInset(this);
bv->buffer()->markDirty();
inset.dispatch(cmd);
} else {
if (!bv->lockInset(this))
- return DispatchResult(true);
+ return DispatchResult(true, true);
if (cmd.y <= button_dim.y2) {
FuncRequest cmd1 = cmd;
cmd1.y = 0;
} else
inset.dispatch(adjustCommand(cmd));
}
- return DispatchResult(true);
+ return DispatchResult(true, true);
}
case LFUN_MOUSE_PRESS:
if (!collapsed_ && cmd.y > button_dim.y2)
inset.dispatch(adjustCommand(cmd));
- return DispatchResult(true);
+ return DispatchResult(true, true);
case LFUN_MOUSE_MOTION:
if (!collapsed_ && cmd.y > button_dim.y2)
inset.dispatch(adjustCommand(cmd));
- return DispatchResult(true);
+ return DispatchResult(true, true);
case LFUN_MOUSE_RELEASE:
lfunMouseRelease(cmd);
- return DispatchResult(true);
+ return DispatchResult(true, true);
default:
DispatchResult const result = inset.dispatch(cmd);
setParams(p);
cmd.view()->updateInset(this);
- return DispatchResult(true);
+ return DispatchResult(true, true);
}
case LFUN_INSET_DIALOG_UPDATE:
InsetCommandMailer(cmd.argument, *this).updateDialog(cmd.view());
- return DispatchResult(true);
+ return DispatchResult(true, true);
case LFUN_MOUSE_RELEASE:
return dispatch(FuncRequest(cmd.view(), LFUN_INSET_EDIT));
*/
inset.getLyXText(cmd.view())->fullRebreak();
bv->updateInset(this);
- result = DispatchResult(true);
+ result = DispatchResult(true, true);
}
break;
case LFUN_MOUSE_PRESS:
lfunMousePress(cmd);
- result = DispatchResult(true);
+ result = DispatchResult(true, true);
break;
case LFUN_MOUSE_MOTION:
lfunMouseMotion(cmd);
- result = DispatchResult(true);
+ result = DispatchResult(true, true);
break;
case LFUN_MOUSE_RELEASE:
lfunMouseRelease(cmd);
- result = DispatchResult(true);
+ result = DispatchResult(true, true);
break;
case LFUN_LAYOUT:
bv->owner()->setLayout(inset.paragraphs.begin()->layout()->name());
- result = DispatchResult(true, NOUPDATE);
+ result = DispatchResult(true);
break;
default:
InsetExternalParams p;
InsetExternalMailer::string2params(cmd.argument, buffer, p);
external::editExternal(p, buffer);
- return DispatchResult(true, NOUPDATE);
+ return DispatchResult(true);
}
case LFUN_INSET_MODIFY: {
InsetExternalMailer::string2params(cmd.argument, buffer, p);
setParams(p, buffer);
cmd.view()->updateInset(this);
- return DispatchResult(true);
+ return DispatchResult(true, true);
}
case LFUN_INSET_DIALOG_UPDATE:
InsetExternalMailer(*this).updateDialog(cmd.view());
- return DispatchResult(true);
+ return DispatchResult(true, true);
case LFUN_MOUSE_RELEASE:
case LFUN_INSET_EDIT:
InsetExternalMailer(*this).showDialog(cmd.view());
- return DispatchResult(true);
+ return DispatchResult(true, true);
default:
return DispatchResult(false);
wide(params_.wide, cmd.view()->buffer()->params());
cmd.view()->updateInset(this);
- return DispatchResult(true);
+ return DispatchResult(true, true);
}
case LFUN_INSET_DIALOG_UPDATE: {
InsetFloatMailer(*this).updateDialog(cmd.view());
- return DispatchResult(true);
+ return DispatchResult(true, true);
}
default:
case LFUN_MOUSE_RELEASE:
if (button().box().contains(cmd.x, cmd.y))
InsetCommandMailer("toc", *this).showDialog(cmd.view());
- return DispatchResult(true);
+ return DispatchResult(true, true);
case LFUN_INSET_DIALOG_SHOW:
InsetCommandMailer("toc", *this).showDialog(cmd.view());
- return DispatchResult(true);
+ return DispatchResult(true, true);
default:
return InsetCommand::priv_dispatch(cmd, idx, pos);
setParams(p);
cmd.view()->updateInset(this);
}
- return DispatchResult(true);
+ return DispatchResult(true, true);
}
case LFUN_INSET_DIALOG_UPDATE:
InsetGraphicsMailer(*this).updateDialog(cmd.view());
- return DispatchResult(true);
+ return DispatchResult(true, true);
case LFUN_INSET_EDIT:
case LFUN_MOUSE_RELEASE:
InsetGraphicsMailer(*this).showDialog(cmd.view());
- return DispatchResult(true);
+ return DispatchResult(true, true);
default:
return DispatchResult(false);
set(p, *cmd.view()->buffer());
cmd.view()->updateInset(this);
}
- return DispatchResult(true);
+ return DispatchResult(true, true);
}
case LFUN_INSET_DIALOG_UPDATE:
InsetIncludeMailer(*this).updateDialog(cmd.view());
- return DispatchResult(true);
+ return DispatchResult(true, true);
case LFUN_MOUSE_RELEASE:
if (button_.box().contains(cmd.x, cmd.y))
InsetIncludeMailer(*this).showDialog(cmd.view());
- return DispatchResult(true);
+ return DispatchResult(true, true);
case LFUN_INSET_DIALOG_SHOW:
InsetIncludeMailer(*this).showDialog(cmd.view());
- return DispatchResult(true);
+ return DispatchResult(true, true);
default:
return DispatchResult(false);
switch (cmd.action) {
case LFUN_INSET_EDIT:
InsetCommandMailer("index", *this).showDialog(cmd.view());
- return DispatchResult(true);
+ return DispatchResult(true, true);
default:
return InsetCommand::priv_dispatch(cmd, idx, pos);
case LFUN_INSET_EDIT:
InsetCommandMailer("label", *this).showDialog(bv);
- return DispatchResult(true);
+ return DispatchResult(true, true);
break;
case LFUN_INSET_MODIFY: {
setParams(p);
bv->updateInset(this);
- return DispatchResult(true);
+ return DispatchResult(true, true);
}
default:
* with ugliness like this ... */
inset.getLyXText(cmd.view())->fullRebreak();
cmd.view()->updateInset(this);
- return DispatchResult(true);
+ return DispatchResult(true, true);
}
case LFUN_INSET_DIALOG_UPDATE:
InsetMinipageMailer(*this).updateDialog(cmd.view());
- return DispatchResult(true);
+ return DispatchResult(true, true);
default:
return InsetCollapsable::priv_dispatch(cmd, idx, pos);
InsetNoteMailer::string2params(cmd.argument, params_);
setButtonLabel();
bv->updateInset(this);
- return DispatchResult(true);
+ return DispatchResult(true, true);
}
case LFUN_INSET_EDIT:
case LFUN_INSET_DIALOG_UPDATE:
InsetNoteMailer("note", *this).updateDialog(bv);
- return DispatchResult(true);
+ return DispatchResult(true, true);
case LFUN_MOUSE_RELEASE:
if (cmd.button() == mouse_button::button3 && hitButton(cmd)) {
InsetNoteMailer("note", *this).showDialog(bv);
- return DispatchResult(true);
+ return DispatchResult(true, true);
}
// fallthrough:
dispatch(FuncRequest(LFUN_REF_GOTO, getContents()));
else
InsetCommandMailer("ref", *this).showDialog(cmd.view());
- return DispatchResult(true);
+ return DispatchResult(true, true);
default:
return InsetCommand::priv_dispatch(cmd, idx, pos);
if (!bv->lockInset(this)) {
lyxerr << "InsetTabular::Cannot lock inset" << endl;
- return DispatchResult(true);
+ return DispatchResult(true, true);
}
finishUndo();
activateCellInset(bv, cmd.x - inset_x, cmd.y - inset_y, cmd.button());
}
}
- return DispatchResult(true);
+ return DispatchResult(true, true);
}
if (result.dispatched()) {
bool hs = hasSelection();
- result = DispatchResult(true);
+ result = DispatchResult(true, 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(true);
+ return DispatchResult(true, true);
case LFUN_MOUSE_MOTION:
lfunMouseMotion(cmd);
- return DispatchResult(true);
+ return DispatchResult(true, true);
case LFUN_MOUSE_RELEASE:
return DispatchResult(lfunMouseRelease(cmd));
if (hs)
updateLocal(bv);
if (!the_locking_inset)
- return DispatchResult(true, NOUPDATE);
+ return DispatchResult(true);
return result;
// this to avoid compiler warnings.
default:
if (the_locking_inset) {
result = the_locking_inset->dispatch(cmd);
if (result.dispatched()) {
- if (result.val() == NOUPDATE) {
+ if (result.update()) {
+ updateLocal(bv);
+ } else {
int const sc = scroll();
resetPos(bv);
if (sc != scroll()) {
// inset has been scrolled
updateLocal(bv);
}
- } else {
- updateLocal(bv);
}
return result;
} else if (result.val() == FINISHED_UP) {
}
}
- result = DispatchResult(true);
+ result = DispatchResult(true, true);
switch (action) {
// --- Cursor Movements ----------------------------------
case LFUN_RIGHTSEL: {
case LFUN_UNDERLINE:
case LFUN_FONT_SIZE:
if (bv->dispatch(FuncRequest(bv, action, arg)))
- result = DispatchResult(true);
+ result = DispatchResult(true, true);
break;
default:
break;
{
if (lock && !old_locking_inset) {
if (activateCellInset(bv))
- return DispatchResult(true);
+ return DispatchResult(true, true);
} else {
bool moved = isRightToLeft(bv)
? movePrevCell(bv) : moveNextCell(bv);
if (!moved)
return DispatchResult(false, FINISHED_RIGHT);
if (lock && activateCellInset(bv))
- return DispatchResult(true);
+ return DispatchResult(true, true);
}
resetPos(bv);
- return DispatchResult(true, NOUPDATE);
+ return DispatchResult(true);
}
return DispatchResult(false, FINISHED);
// behind the inset
if (lock && activateCellInset(bv, 0, 0, mouse_button::none, true))
- return DispatchResult(true);
+ return DispatchResult(true, true);
resetPos(bv);
- return DispatchResult(true, NOUPDATE);
+ return DispatchResult(true);
}
x -= cursorx_ + tabular.getBeginningOfTextInCell(actcell);
}
if (activateCellInset(bv, x, 0))
- return DispatchResult(true);
+ return DispatchResult(true, true);
}
- return DispatchResult(true, NOUPDATE);
+ return DispatchResult(true);
}
x -= cursorx_ + tabular.getBeginningOfTextInCell(actcell);
}
if (activateCellInset(bv, x, 0))
- return DispatchResult(true);
+ return DispatchResult(true, true);
}
- return DispatchResult(true, NOUPDATE);
+ return DispatchResult(true);
}
if (the_locking_inset) {
DispatchResult const res = the_locking_inset->dispatch(cmd1);
- return res.dispatched() || res.val() >= NOUPDATE;
+ return res.dispatched();
}
int tmp_x = cmd.x;
// We still need to deal properly with the whole relative vs.
// absolute mouse co-ords thing in a realiable, sensible way
DispatchResult const res = inset->dispatch(cmd1);
- bool const ret = res.dispatched() || res.val() >= NOUPDATE;
+ bool const ret = res.dispatched();
updateLocal(bv, false);
return ret;
}
if (!bv->lockInset(this)) {
lyxerr[Debug::INSETS] << "Cannot lock inset" << endl;
- return DispatchResult(true);
+ return DispatchResult(true, true);
}
locked = true;
updateLocal(bv, false);
// Tell the paragraph dialog that we've entered an insettext.
bv->dispatch(FuncRequest(LFUN_PARAGRAPH_UPDATE));
- return DispatchResult(true);
+ return DispatchResult(true, true);
}
case LFUN_MOUSE_PRESS:
lfunMousePress(cmd);
- return DispatchResult(true);
+ return DispatchResult(true, true);
case LFUN_MOUSE_MOTION:
lfunMouseMotion(cmd);
- return DispatchResult(true);
+ return DispatchResult(true, true);
case LFUN_MOUSE_RELEASE:
return DispatchResult(lfunMouseRelease(cmd));
DispatchResult result = UpdatableInset::priv_dispatch(cmd, idx, pos);
if (result.dispatched())
- return DispatchResult(true);
+ return DispatchResult(true, true);
- result = DispatchResult(true);
- if (cmd.action < 0 && cmd.argument.empty())
+ result = DispatchResult(true, true);
+ if (cmd.action == LFUN_UNKNOWN_ACTION && cmd.argument.empty())
return DispatchResult(false, FINISHED);
if (the_locking_inset) {
result = the_locking_inset->dispatch(cmd);
if (result.dispatched()) {
- if (result.val() != NOUPDATE)
+ if (result.update()) {
+ result.update(false);
updateLocal(bv, false);
+ }
return result;
}
switch (result.val()) {
case FINISHED_RIGHT:
moveRightIntern(bv, false, false);
- result = DispatchResult(true);
+ result = DispatchResult(true, true);
break;
case FINISHED_UP:
result = moveUp(bv);
}
break;
default:
- result = DispatchResult(true);
+ result = DispatchResult(true, true);
break;
}
the_locking_inset = 0;
}
text_.selection.cursor = text_.cursor;
updflag = true;
- result = DispatchResult(true, NOUPDATE);
+ result = DispatchResult(true);
break;
// cursor movements that need special handling
else {
text_.cursorPrevious();
text_.clearSelection();
- result = DispatchResult(true, NOUPDATE);
+ result = DispatchResult(true);
}
break;
else {
text_.cursorNext();
text_.clearSelection();
- result = DispatchResult(true, NOUPDATE);
+ result = DispatchResult(true);
}
break;
case LFUN_BREAKPARAGRAPH:
if (!autoBreakRows_) {
- result = DispatchResult(true);
+ result = DispatchResult(true, true);
} else {
replaceSelection(bv->getLyXText());
text_.breakParagraph(paragraphs, 0);
case LFUN_BREAKPARAGRAPHKEEPLAYOUT:
if (!autoBreakRows_) {
- result = DispatchResult(true);
+ result = DispatchResult(true, true);
} else {
replaceSelection(bv->getLyXText());
text_.breakParagraph(paragraphs, 1);
case LFUN_BREAKLINE: {
if (!autoBreakRows_) {
- result = DispatchResult(true);
+ result = DispatchResult(true, true);
} else {
replaceSelection(bv->getLyXText());
auto_ptr<InsetNewline> ins(new InsetNewline);
if (result.val() >= FINISHED)
bv->unlockInset(this);
- if (result.val() == NOUPDATE)
- result = DispatchResult(true);
+ if (result.val() == NONE)
+ result = DispatchResult(true, true);
return result;
}
if (boost::next(c_par) == paragraphs.end() && cpos() >= c_par->size())
return DispatchResult(false, FINISHED_RIGHT);
if (activate_inset && checkAndActivateInset(bv, front))
- return DispatchResult(true);
+ return DispatchResult(true, true);
text_.cursorRight(bv);
if (!selecting)
text_.clearSelection();
- return DispatchResult(true, NOUPDATE);
+ return DispatchResult(true);
}
if (!selecting)
text_.clearSelection();
if (activate_inset && checkAndActivateInset(bv, front))
- return DispatchResult(true);
- return DispatchResult(true, NOUPDATE);
+ return DispatchResult(true, true);
+ return DispatchResult(true);
}
return DispatchResult(false, FINISHED_UP);
text_.cursorUp(bv);
text_.clearSelection();
- return DispatchResult(true, NOUPDATE);
+ return DispatchResult(true);
}
return DispatchResult(false, FINISHED_DOWN);
text_.cursorDown(bv);
text_.clearSelection();
- return DispatchResult(true, NOUPDATE);
+ return DispatchResult(true);
}
case LFUN_MOUSE_RELEASE:
if (button().box().contains(cmd.x, cmd.y))
InsetCommandMailer("toc", *this).showDialog(cmd.view());
- return DispatchResult(true);
+ return DispatchResult(true, true);
case LFUN_INSET_DIALOG_SHOW:
InsetCommandMailer("toc", *this).showDialog(cmd.view());
- return DispatchResult(true);
+ return DispatchResult(true, true);
default:
return InsetCommand::priv_dispatch(cmd, idx, pos);
switch (cmd.action) {
case LFUN_INSET_EDIT:
InsetCommandMailer("url", *this).showDialog(cmd.view());
- return DispatchResult(true);
+ return DispatchResult(true, true);
default:
return InsetCommand::priv_dispatch(cmd, idx, pos);
}
params_.width = params.width;
cmd.view()->updateInset(this);
- return DispatchResult(true);
+ return DispatchResult(true, true);
}
case LFUN_INSET_DIALOG_UPDATE:
InsetWrapMailer(*this).updateDialog(cmd.view());
- return DispatchResult(true);
+ return DispatchResult(true, true);
default:
return InsetCollapsable::priv_dispatch(cmd, idx, pos);
}
ev.view()->updateInset(this);
- return DispatchResult(true);
+ return DispatchResult(true, true);
}
return DispatchResult(false);
}
{
Cursor cursor;
buildCursor(cursor, *view());
- if (cursor.dispatch(FuncRequest(func, view())).dispatched()) {
+ DispatchResult result =
+ cursor.dispatch(FuncRequest(func, view()));
+
+ if (result.dispatched()) {
+ if (result.update()) {
+ view()->update();
+ }
lyxerr << "dispatched by Cursor::dispatch()\n";
goto exit_with_message;
}
- lyxerr << "### NOT DispatchResult(true) BY Cursor::dispatch() ###\n";
+ lyxerr << "### NOT DispatchResult(true, true) BY Cursor::dispatch() ###\n";
}
#endif
// Hand-over to inset's own dispatch:
result = inset->dispatch(FuncRequest(view(), action, argument));
if (result.dispatched()) {
+ if (result.update())
+ view()->update();
+
goto exit_with_message;
}
+2003-11-03 Lars Gullik Bjønnes <larsbj@gullik.net>
+
+ * Adjust for new DispatchResult semantics.
+
2003-11-03 Lars Gullik Bjønnes <larsbj@gullik.net>
* math_parser.C (parse1): exception safety
lyxerr << "lfunMouseRelease: undispatched: " << cmd.button() << endl;
bv->owner()->getDialogs().show("mathpanel");
}
- return DispatchResult(true);
+ return DispatchResult(true, true);
}
if (cmd.button() == mouse_button::button2) {
mathcursor->setPos(cmd.x + xo_, cmd.y + yo_);
mathcursor->insert(ar);
bv->updateInset(this);
- return DispatchResult(true);
+ return DispatchResult(true, true);
}
if (cmd.button() == mouse_button::button1) {
//mathcursor = new MathCursor(this, x == 0);
//metrics(bv);
//mathcursor->setPos(x + xo_, y + yo_);
- return DispatchResult(true);
+ return DispatchResult(true, true);
}
return DispatchResult(false);
if (cmd.button() == mouse_button::button3) {
mathcursor->dispatch(cmd);
- return DispatchResult(true);
+ return DispatchResult(true, true);
}
if (cmd.button() == mouse_button::button1) {
mathcursor->selClear();
mathcursor->setPos(cmd.x + xo_, cmd.y + yo_);
mathcursor->dispatch(cmd);
- return DispatchResult(true);
+ return DispatchResult(true, true);
}
bv->updateInset(this);
- return DispatchResult(true);
+ return DispatchResult(true, true);
}
DispatchResult InsetFormulaBase::lfunMouseMotion(FuncRequest const & cmd)
{
if (!mathcursor)
- return DispatchResult(true);
+ return DispatchResult(true, true);
if (mathcursor->dispatch(FuncRequest(cmd)).dispatched())
- return DispatchResult(true);
+ return DispatchResult(true, true);
// only select with button 1
if (cmd.button() != mouse_button::button1)
- return DispatchResult(true);
+ return DispatchResult(true, true);
if (abs(cmd.x - first_x) < 2 && abs(cmd.y - first_y) < 2)
- return DispatchResult(true);
+ return DispatchResult(true, 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(true);
+ return DispatchResult(true, 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(true);
+ return DispatchResult(true, true);
case LFUN_MOUSE_PRESS:
//lyxerr << "Mouse single press" << endl;
case LFUN_RIGHTSEL:
sel = true; // fall through...
case LFUN_RIGHT:
- result = mathcursor->right(sel) ? DispatchResult(true) : DispatchResult(false, FINISHED_RIGHT);
+ result = mathcursor->right(sel) ? DispatchResult(true, 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(true) : DispatchResult(true, FINISHED);
+ result = mathcursor->left(sel) ? DispatchResult(true, true) : DispatchResult(true, FINISHED);
break;
case LFUN_UPSEL:
sel = true; // fall through
case LFUN_UP:
- result = mathcursor->up(sel) ? DispatchResult(true) : DispatchResult(false, FINISHED_UP);
+ result = mathcursor->up(sel) ? DispatchResult(true, true) : DispatchResult(false, FINISHED_UP);
break;
case LFUN_DOWNSEL:
sel = true; // fall through
case LFUN_DOWN:
- result = mathcursor->down(sel) ? DispatchResult(true) : DispatchResult(false, FINISHED_DOWN);
+ result = mathcursor->down(sel) ? DispatchResult(true, true) : DispatchResult(false, FINISHED_DOWN);
break;
case LFUN_WORDSEL:
sel = true; // fall through
case LFUN_HOME:
case LFUN_WORDLEFT:
- result = mathcursor->home(sel) ? DispatchResult(true) : DispatchResult(true, FINISHED);
+ result = mathcursor->home(sel) ? DispatchResult(true, true) : DispatchResult(true, FINISHED);
break;
case LFUN_ENDSEL:
sel = true; // fall through
case LFUN_END:
case LFUN_WORDRIGHT:
- result = mathcursor->end(sel) ? DispatchResult(true) : DispatchResult(false, FINISHED_RIGHT);
+ result = mathcursor->end(sel) ? DispatchResult(true, true) : DispatchResult(false, FINISHED_RIGHT);
break;
case LFUN_PRIORSEL:
if (!argument.empty()) {
recordUndo(bv, Undo::ATOMIC);
if (argument.size() == 1)
- result = mathcursor->interpret(argument[0]) ? DispatchResult(true) : DispatchResult(false, FINISHED_RIGHT);
+ result = mathcursor->interpret(argument[0]) ? DispatchResult(true, true) : DispatchResult(false, FINISHED_RIGHT);
else
mathcursor->insert(argument);
}
MathArray ar;
if (createMathInset_fromDialogStr(cmd.argument, ar)) {
mathcursor->insert(ar);
- result = DispatchResult(true);
+ result = DispatchResult(true, true);
} else {
result = DispatchResult(false);
}
result = DispatchResult(false);
}
- if (result == DispatchResult(true))
+ if (result == DispatchResult(true, true))
bv->updateInset(this);
mathcursor->normalize();
if (mathcursor->selection() || was_selection)
toggleInsetSelection(bv);
- if (result.val() <= NOUPDATE) {
+ if (result.dispatched()) {
fitInsetCursor(bv);
revealCodes(bv);
cmd.view()->stuffClipboard(mathcursor->grabSelection());
case LFUN_MOUSE_RELEASE:
//if (cmd.button() == mouse_button::button3) {
// GridInsetMailer(*this).showDialog();
- // return DispatchResult(true);
+ // return DispatchResult(true, true);
//}
return DispatchResult(false);
numbered(row, !old);
//bv->owner()->message(old ? _("No number") : _("Number"));
}
- return DispatchResult(true);
+ return DispatchResult(true, true);
case LFUN_MATH_NONUMBER:
if (display()) {
//bv->owner()->message(old ? _("No number") : _("Number"));
numbered(r, !old);
}
- return DispatchResult(true);
+ return DispatchResult(true, true);
case LFUN_INSERT_LABEL: {
row_type r = (type_ == "multline") ? nrows() - 1 : row(idx);
if (!new_label.empty())
numbered(r, true);
label(r, new_label);
- return DispatchResult(true);
+ return DispatchResult(true, true);
}
case LFUN_MATH_EXTERN:
mathed_parse_cell(ar, cmd.argument);
cell(idx).insert(pos, ar);
pos += ar.size();
- return DispatchResult(true);
+ return DispatchResult(true, true);
}
case LFUN_PASTESELECTION:
limits_ = (hasLimits()) ? -1 : 1;
else
limits_ = 0;
- return DispatchResult(true);
+ return DispatchResult(true, true);
}
return MathNestInset::priv_dispatch(cmd, idx, pos);
*this = *ar[0].nucleus()->asRefInset();
- return DispatchResult(true);
+ return DispatchResult(true, 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(true);
+ return DispatchResult(true, 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(true);
+ return DispatchResult(true, true);
}
break;
case LFUN_MOUSE_PRESS:
case LFUN_MOUSE_MOTION:
// eat other mouse commands
- return DispatchResult(true);
+ return DispatchResult(true, true);
default:
return CommandInset::priv_dispatch(cmd, idx, pos);
}
return DispatchResult(false);
}
- return DispatchResult(true);
+ return DispatchResult(true, true);
}