From e5cd3ce1a4bf54a2c02b82274992b2e0dcb40cb6 Mon Sep 17 00:00:00 2001 From: Angus Leeming Date: Tue, 4 Mar 2003 14:31:04 +0000 Subject: [PATCH] LFUN_INSET_MODIFY git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6336 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/BufferView_pimpl.C | 6 +++--- src/ChangeLog | 8 ++++++++ src/LyXAction.C | 1 + src/commandtags.h | 1 + src/insets/ChangeLog | 9 +++++++++ src/insets/insetbibitem.C | 2 +- src/insets/insetbibtex.C | 2 +- src/insets/insetcommand.C | 2 +- src/insets/insetert.C | 19 ++++++++++--------- src/insets/insetlabel.C | 6 +++--- src/mathed/ChangeLog | 8 ++++++++ src/mathed/formulabase.C | 8 ++------ src/mathed/ref_inset.C | 2 +- 13 files changed, 49 insertions(+), 25 deletions(-) diff --git a/src/BufferView_pimpl.C b/src/BufferView_pimpl.C index 249f23eddd..cac2fb0e59 100644 --- a/src/BufferView_pimpl.C +++ b/src/BufferView_pimpl.C @@ -1178,14 +1178,14 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev_in) string const name = ev.getArg(0); InsetBase * base = owner_->getDialogs().getOpenInset(name); - Inset * inset = 0; if (base) { // This works both for 'original' and 'mathed' insets. // Note that the localDispatch performs updateInset // also. - base->localDispatch(ev); + FuncRequest fr(bv_, LFUN_INSET_MODIFY, ev.argument); + base->localDispatch(fr); } else { - inset = createInset(ev); + Inset * inset = createInset(ev); if (inset && insertInset(inset)) { updateInset(inset, true); } else { diff --git a/src/ChangeLog b/src/ChangeLog index 78521d1a22..9ca53e3bcb 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +2003-03-04 Angus Leeming + + * commandtags.h: + * LyXAction.C: new LFUN_INSET_MODIFY. + + * BufferView_pimpl.C (dispatch): if an inset is found to be open + on LFUN_INSET_APPLY, pass LFUN_INSET_MODIFY to its localDispatch. + 2003-03-04 Lars Gullik Bjønnes * several files: ws changes only diff --git a/src/LyXAction.C b/src/LyXAction.C index 1470b05bfc..acafbe2bfd 100644 --- a/src/LyXAction.C +++ b/src/LyXAction.C @@ -421,6 +421,7 @@ void LyXAction::init() { LFUN_DIALOG_DISCONNECT_INSET, "dialog-disconnect-inset", N_("Disconnect the dialog from the current inset"), Noop }, { LFUN_INSET_APPLY, "inset-apply", "", Noop }, + { LFUN_INSET_MODIFY, "", "internal only", Noop }, { LFUN_NOACTION, "", "", Noop } }; diff --git a/src/commandtags.h b/src/commandtags.h index eddedebf97..085ae4f7a2 100644 --- a/src/commandtags.h +++ b/src/commandtags.h @@ -297,6 +297,7 @@ enum kb_action { LFUN_DIALOG_HIDE, LFUN_DIALOG_DISCONNECT_INSET, LFUN_INSET_APPLY, + LFUN_INSET_MODIFY, LFUN_LASTACTION /* this marks the end of the table */ }; diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index b8a15d1931..9e65924dc3 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,12 @@ +2003-03-04 Angus Leeming + + * insetbibitem.C (localDispatch): + * insetbibtex.C (localDispatch): + * insetcommand.C (localDispatch): + * insetert.C (localDispatch): + * insetlabel.C (localDispatch): + handle LFUN_INSET_MODIFY, not LFUN_INSET_APPLY. + 2003-03-04 Lars Gullik Bjønnes * insettext.C (latex): adjust for ParagraphList::iterator diff --git a/src/insets/insetbibitem.C b/src/insets/insetbibitem.C index 74defd5eb9..13a491b147 100644 --- a/src/insets/insetbibitem.C +++ b/src/insets/insetbibitem.C @@ -51,7 +51,7 @@ Inset * InsetBibitem::clone(Buffer const &, bool) const dispatch_result InsetBibitem::localDispatch(FuncRequest const & cmd) { - if (cmd.action != LFUN_INSET_APPLY) + if (cmd.action != LFUN_INSET_MODIFY) return UNDISPATCHED; InsetCommandParams p; diff --git a/src/insets/insetbibtex.C b/src/insets/insetbibtex.C index a400dd1e8c..895b7a032b 100644 --- a/src/insets/insetbibtex.C +++ b/src/insets/insetbibtex.C @@ -48,7 +48,7 @@ InsetBibtex::~InsetBibtex() dispatch_result InsetBibtex::localDispatch(FuncRequest const & cmd) { - if (cmd.action != LFUN_INSET_APPLY) + if (cmd.action != LFUN_INSET_MODIFY) return UNDISPATCHED; InsetCommandParams p; diff --git a/src/insets/insetcommand.C b/src/insets/insetcommand.C index 4069a825a5..b0be308fea 100644 --- a/src/insets/insetcommand.C +++ b/src/insets/insetcommand.C @@ -67,7 +67,7 @@ int InsetCommand::docbook(Buffer const *, ostream &, bool) const dispatch_result InsetCommand::localDispatch(FuncRequest const & cmd) { - if (cmd.action != LFUN_INSET_APPLY) + if (cmd.action != LFUN_INSET_MODIFY) return UNDISPATCHED; InsetCommandParams p; diff --git a/src/insets/insetert.C b/src/insets/insetert.C index e7ead1e6a9..ae0eda8f9f 100644 --- a/src/insets/insetert.C +++ b/src/insets/insetert.C @@ -442,7 +442,7 @@ int InsetERT::docbook(Buffer const *, ostream & os, bool) const Inset::RESULT InsetERT::localDispatch(FuncRequest const & cmd) { - Inset::RESULT result = DISPATCHED_NOUPDATE; + Inset::RESULT result = UNDISPATCHED; BufferView * bv = cmd.view(); if (inset.paragraph()->empty()) { @@ -450,33 +450,34 @@ Inset::RESULT InsetERT::localDispatch(FuncRequest const & cmd) } switch (cmd.action) { - case LFUN_INSET_APPLY: { - if (!bv) - return UNDISPATCHED; - + case LFUN_INSET_MODIFY: { InsetERT::ERTStatus status_; InsetERTMailer::string2params(cmd.argument, status_); status(bv, status_); bv->updateInset(this, true); - return DISPATCHED; + result = DISPATCHED; } break; case LFUN_MOUSE_PRESS: lfunMousePress(cmd); - return DISPATCHED; + result = DISPATCHED; + break; case LFUN_MOUSE_MOTION: lfunMouseMotion(cmd); - return DISPATCHED; + result = DISPATCHED; + break; case LFUN_MOUSE_RELEASE: lfunMouseRelease(cmd); - return DISPATCHED; + result = DISPATCHED; + break; case LFUN_LAYOUT: bv->owner()->setLayout(inset.paragraph()->layout()->name()); + result = DISPATCHED_NOUPDATE; break; default: diff --git a/src/insets/insetlabel.C b/src/insets/insetlabel.C index 459699b895..015504e96b 100644 --- a/src/insets/insetlabel.C +++ b/src/insets/insetlabel.C @@ -54,7 +54,7 @@ void InsetLabel::edit(BufferView *, int, int, mouse_button::state) dispatch_result InsetLabel::localDispatch(FuncRequest const & cmd) { - if (cmd.action != LFUN_INSET_APPLY) + if (cmd.action != LFUN_INSET_MODIFY) return UNDISPATCHED; InsetCommandParams p; @@ -64,8 +64,8 @@ dispatch_result InsetLabel::localDispatch(FuncRequest const & cmd) bool clean = true; if (view() && p.getContents() != params().getContents()) { - clean = view()->ChangeCitationsIfUnique(params().getContents(), - p.getContents()); + clean = view()->ChangeRefsIfUnique(params().getContents(), + p.getContents()); } setParams(p); diff --git a/src/mathed/ChangeLog b/src/mathed/ChangeLog index 6ac9de5d4e..4df2ea1e1f 100644 --- a/src/mathed/ChangeLog +++ b/src/mathed/ChangeLog @@ -1,3 +1,11 @@ +2003-03-04 Angus Leeming + + * formulabase.C (localDispatch): if an inset is found on + LFUN_INSET_APPLY, send LFUN_INSET_MODIFY to the inset's localDispatch. + + * ref_inset.C (localDispatch): handle LFUN_INSET_MODIFY, not + LFUN_INSET_APPLY. + 2003-03-03 Lars Gullik Bjønnes * formulabase.h: adjust for boost 1.30.0 diff --git a/src/mathed/formulabase.C b/src/mathed/formulabase.C index cd4ea1dc90..cca0e6f1c4 100644 --- a/src/mathed/formulabase.C +++ b/src/mathed/formulabase.C @@ -806,16 +806,12 @@ dispatch_result InsetFormulaBase::localDispatch(FuncRequest const & cmd) case LFUN_INSET_APPLY: { string const name = cmd.getArg(0); - if (name != "ref") { - result = UNDISPATCHED; - break; - } - InsetBase * base = bv->owner()->getDialogs().getOpenInset(name); if (base) { - result = base->localDispatch(cmd); + FuncRequest fr(bv, LFUN_INSET_MODIFY, cmd.argument); + result = base->localDispatch(fr); } else { // Turn 'argument' into a temporary RefInset. MathArray ar; diff --git a/src/mathed/ref_inset.C b/src/mathed/ref_inset.C index 7848ab0b68..ca7d8e67ec 100644 --- a/src/mathed/ref_inset.C +++ b/src/mathed/ref_inset.C @@ -133,7 +133,7 @@ int RefInset::docbook(std::ostream & os, bool) const dispatch_result RefInset::localDispatch(FuncRequest const & cmd) { - if (cmd.action != LFUN_INSET_APPLY || cmd.getArg(0) != "ref") + if (cmd.action != LFUN_INSET_MODIFY || cmd.getArg(0) != "ref") return UNDISPATCHED; MathArray ar;