mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-14 12:25:11 +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>
|
2003-03-07 Angus Leeming <leeming@lyx.org>
|
||||||
|
|
||||||
* insetgraphics.[Ch]: define a new class InsetGraphicsMailer and use
|
* 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)
|
dispatch_result InsetBibitem::localDispatch(FuncRequest const & cmd)
|
||||||
{
|
{
|
||||||
if (cmd.action != LFUN_INSET_MODIFY)
|
Inset::RESULT result = UNDISPATCHED;
|
||||||
return UNDISPATCHED;
|
|
||||||
|
|
||||||
InsetCommandParams p;
|
switch (cmd.action) {
|
||||||
InsetCommandMailer::string2params(cmd.argument, p);
|
case LFUN_INSET_MODIFY: {
|
||||||
if (p.getCmdName().empty())
|
InsetCommandParams p;
|
||||||
return UNDISPATCHED;
|
InsetCommandMailer::string2params(cmd.argument, p);
|
||||||
|
if (p.getCmdName().empty())
|
||||||
|
break;
|
||||||
|
|
||||||
if (view() && p.getContents() != params().getContents()) {
|
if (view() && p.getContents() != params().getContents()) {
|
||||||
view()->ChangeCitationsIfUnique(params().getContents(),
|
view()->ChangeCitationsIfUnique(params().getContents(),
|
||||||
p.getContents());
|
p.getContents());
|
||||||
|
}
|
||||||
|
|
||||||
|
setParams(p);
|
||||||
|
cmd.view()->updateInset(this, true);
|
||||||
|
result = DISPATCHED;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
result = InsetCommand::localDispatch(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
setParams(p);
|
return result;
|
||||||
if (view())
|
|
||||||
view()->updateInset(this, true);
|
|
||||||
|
|
||||||
return DISPATCHED;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -48,24 +48,30 @@ InsetBibtex::~InsetBibtex()
|
|||||||
|
|
||||||
dispatch_result InsetBibtex::localDispatch(FuncRequest const & cmd)
|
dispatch_result InsetBibtex::localDispatch(FuncRequest const & cmd)
|
||||||
{
|
{
|
||||||
if (cmd.action != LFUN_INSET_MODIFY)
|
Inset::RESULT result = UNDISPATCHED;
|
||||||
return UNDISPATCHED;
|
|
||||||
|
|
||||||
InsetCommandParams p;
|
switch (cmd.action) {
|
||||||
InsetCommandMailer::string2params(cmd.argument, p);
|
case LFUN_INSET_MODIFY: {
|
||||||
if (p.getCmdName().empty())
|
InsetCommandParams p;
|
||||||
return UNDISPATCHED;
|
InsetCommandMailer::string2params(cmd.argument, p);
|
||||||
|
if (p.getCmdName().empty())
|
||||||
|
break;
|
||||||
|
|
||||||
if (view() && p.getContents() != params().getContents()) {
|
if (view() && p.getContents() != params().getContents()) {
|
||||||
view()->ChangeCitationsIfUnique(params().getContents(),
|
view()->ChangeCitationsIfUnique(params().getContents(),
|
||||||
p.getContents());
|
p.getContents());
|
||||||
|
}
|
||||||
|
|
||||||
|
setParams(p);
|
||||||
|
cmd.view()->updateInset(this, true);
|
||||||
|
result = DISPATCHED;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
result = InsetCommand::localDispatch(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
setParams(p);
|
return result;
|
||||||
if (view())
|
|
||||||
view()->updateInset(this, true);
|
|
||||||
|
|
||||||
return DISPATCHED;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
string const InsetBibtex::getScreenLabel(Buffer const *) const
|
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)
|
dispatch_result InsetLabel::localDispatch(FuncRequest const & cmd)
|
||||||
{
|
{
|
||||||
if (cmd.action != LFUN_INSET_MODIFY)
|
Inset::RESULT result = UNDISPATCHED;
|
||||||
return UNDISPATCHED;
|
|
||||||
|
|
||||||
InsetCommandParams p;
|
switch (cmd.action) {
|
||||||
InsetCommandMailer::string2params(cmd.argument, p);
|
case LFUN_INSET_MODIFY: {
|
||||||
if (p.getCmdName().empty())
|
InsetCommandParams p;
|
||||||
return UNDISPATCHED;
|
InsetCommandMailer::string2params(cmd.argument, p);
|
||||||
|
if (p.getCmdName().empty())
|
||||||
|
return UNDISPATCHED;
|
||||||
|
|
||||||
bool clean = true;
|
bool clean = true;
|
||||||
if (view() && p.getContents() != params().getContents()) {
|
if (view() && p.getContents() != params().getContents()) {
|
||||||
clean = view()->ChangeRefsIfUnique(params().getContents(),
|
clean = view()->ChangeRefsIfUnique(params().getContents(),
|
||||||
p.getContents());
|
p.getContents());
|
||||||
|
}
|
||||||
|
|
||||||
|
setParams(p);
|
||||||
|
cmd.view()->updateInset(this, !clean);
|
||||||
|
result = DISPATCHED;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
result = InsetCommand::localDispatch(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
setParams(p);
|
return result;
|
||||||
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);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user