mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-10 20:04:46 +00:00
rewrite localDispatch as a switch
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6384 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
e36eb8f674
commit
4c496f6e8d
@ -1,3 +1,10 @@
|
||||
2003-03-07 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* insetbibitem.C (localDispatch):
|
||||
* insetbibtex.C (localDispatch):
|
||||
* insetlabel.C (localDispatch):
|
||||
rewrite as a switch.
|
||||
|
||||
2003-03-07 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* insetgraphics.[Ch]: define a new class InsetGraphicsMailer and use
|
||||
|
@ -51,24 +51,30 @@ Inset * InsetBibitem::clone(Buffer const &, bool) const
|
||||
|
||||
dispatch_result InsetBibitem::localDispatch(FuncRequest const & cmd)
|
||||
{
|
||||
if (cmd.action != LFUN_INSET_MODIFY)
|
||||
return UNDISPATCHED;
|
||||
Inset::RESULT result = UNDISPATCHED;
|
||||
|
||||
InsetCommandParams p;
|
||||
InsetCommandMailer::string2params(cmd.argument, p);
|
||||
if (p.getCmdName().empty())
|
||||
return UNDISPATCHED;
|
||||
switch (cmd.action) {
|
||||
case LFUN_INSET_MODIFY: {
|
||||
InsetCommandParams p;
|
||||
InsetCommandMailer::string2params(cmd.argument, p);
|
||||
if (p.getCmdName().empty())
|
||||
break;
|
||||
|
||||
if (view() && p.getContents() != params().getContents()) {
|
||||
view()->ChangeCitationsIfUnique(params().getContents(),
|
||||
p.getContents());
|
||||
if (view() && p.getContents() != params().getContents()) {
|
||||
view()->ChangeCitationsIfUnique(params().getContents(),
|
||||
p.getContents());
|
||||
}
|
||||
|
||||
setParams(p);
|
||||
cmd.view()->updateInset(this, true);
|
||||
result = DISPATCHED;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
result = InsetCommand::localDispatch(cmd);
|
||||
}
|
||||
|
||||
setParams(p);
|
||||
if (view())
|
||||
view()->updateInset(this, true);
|
||||
|
||||
return DISPATCHED;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
@ -48,24 +48,30 @@ InsetBibtex::~InsetBibtex()
|
||||
|
||||
dispatch_result InsetBibtex::localDispatch(FuncRequest const & cmd)
|
||||
{
|
||||
if (cmd.action != LFUN_INSET_MODIFY)
|
||||
return UNDISPATCHED;
|
||||
Inset::RESULT result = UNDISPATCHED;
|
||||
|
||||
InsetCommandParams p;
|
||||
InsetCommandMailer::string2params(cmd.argument, p);
|
||||
if (p.getCmdName().empty())
|
||||
return UNDISPATCHED;
|
||||
switch (cmd.action) {
|
||||
case LFUN_INSET_MODIFY: {
|
||||
InsetCommandParams p;
|
||||
InsetCommandMailer::string2params(cmd.argument, p);
|
||||
if (p.getCmdName().empty())
|
||||
break;
|
||||
|
||||
if (view() && p.getContents() != params().getContents()) {
|
||||
view()->ChangeCitationsIfUnique(params().getContents(),
|
||||
p.getContents());
|
||||
if (view() && p.getContents() != params().getContents()) {
|
||||
view()->ChangeCitationsIfUnique(params().getContents(),
|
||||
p.getContents());
|
||||
}
|
||||
|
||||
setParams(p);
|
||||
cmd.view()->updateInset(this, true);
|
||||
result = DISPATCHED;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
result = InsetCommand::localDispatch(cmd);
|
||||
}
|
||||
|
||||
setParams(p);
|
||||
if (view())
|
||||
view()->updateInset(this, true);
|
||||
|
||||
return DISPATCHED;
|
||||
return result;
|
||||
}
|
||||
|
||||
string const InsetBibtex::getScreenLabel(Buffer const *) const
|
||||
|
@ -54,36 +54,31 @@ void InsetLabel::edit(BufferView *, int, int, mouse_button::state)
|
||||
|
||||
dispatch_result InsetLabel::localDispatch(FuncRequest const & cmd)
|
||||
{
|
||||
if (cmd.action != LFUN_INSET_MODIFY)
|
||||
return UNDISPATCHED;
|
||||
Inset::RESULT result = UNDISPATCHED;
|
||||
|
||||
InsetCommandParams p;
|
||||
InsetCommandMailer::string2params(cmd.argument, p);
|
||||
if (p.getCmdName().empty())
|
||||
return UNDISPATCHED;
|
||||
switch (cmd.action) {
|
||||
case LFUN_INSET_MODIFY: {
|
||||
InsetCommandParams p;
|
||||
InsetCommandMailer::string2params(cmd.argument, p);
|
||||
if (p.getCmdName().empty())
|
||||
return UNDISPATCHED;
|
||||
|
||||
bool clean = true;
|
||||
if (view() && p.getContents() != params().getContents()) {
|
||||
clean = view()->ChangeRefsIfUnique(params().getContents(),
|
||||
p.getContents());
|
||||
bool clean = true;
|
||||
if (view() && p.getContents() != params().getContents()) {
|
||||
clean = view()->ChangeRefsIfUnique(params().getContents(),
|
||||
p.getContents());
|
||||
}
|
||||
|
||||
setParams(p);
|
||||
cmd.view()->updateInset(this, !clean);
|
||||
result = DISPATCHED;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
result = InsetCommand::localDispatch(cmd);
|
||||
}
|
||||
|
||||
setParams(p);
|
||||
if (view())
|
||||
view()->updateInset(this, !clean);
|
||||
|
||||
return DISPATCHED;
|
||||
// if (result.first) {
|
||||
// string new_contents = trim(result.second);
|
||||
// if (!new_contents.empty() &&
|
||||
// getContents() != new_contents) {
|
||||
// bv->buffer()->markDirty();
|
||||
// bool flag = bv->ChangeRefsIfUnique(getContents(),
|
||||
// new_contents);
|
||||
// setContents(new_contents);
|
||||
// bv->updateInset(this, !flag);
|
||||
// }
|
||||
// }
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user