Make the insets accept LFUN_INSET_SETTINGS. These insets did not yet respond to LFUN_INSET_SETTINGS. One had to use LFUN_INSET_TOGGLE to show the settings dialog. Now, this dependency on LFUN_INSET_TOGGLE can be removed.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29176 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Vincent van Ravesteijn 2009-04-10 00:20:12 +00:00
parent 9b111ea5a6
commit cc11c6803c
8 changed files with 52 additions and 7 deletions

View File

@ -435,6 +435,7 @@ bool InsetExternal::getStatus(Cursor & cur, FuncRequest const & cmd,
case LFUN_INSET_EDIT:
case LFUN_INSET_MODIFY:
case LFUN_INSET_DIALOG_UPDATE:
case LFUN_INSET_SETTINGS:
flag.setEnabled(true);
return true;
@ -446,9 +447,15 @@ bool InsetExternal::getStatus(Cursor & cur, FuncRequest const & cmd,
void InsetExternal::edit(Cursor & cur, bool, EntryDirection)
{
cur.bv().showDialog("external",
params2string(params(), cur.bv().buffer()),
this);
showInsetDialog(&cur.bv());
}
bool InsetExternal::showInsetDialog(BufferView * bv) const
{
bv->showDialog("external", params2string(params(), bv->buffer()),
const_cast<InsetExternal *>(this));
return true;
}

View File

@ -140,6 +140,8 @@ private:
///
void edit(Cursor & cur, bool front, EntryDirection entry_from);
///
bool showInsetDialog(BufferView * bv) const;
///
bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
///
void doDispatch(Cursor & cur, FuncRequest & cmd);

View File

@ -234,6 +234,7 @@ bool InsetGraphics::getStatus(Cursor & cur, FuncRequest const & cmd,
case LFUN_INSET_EDIT:
case LFUN_INSET_MODIFY:
case LFUN_INSET_DIALOG_UPDATE:
case LFUN_INSET_SETTINGS:
flag.setEnabled(true);
return true;
@ -245,11 +246,19 @@ bool InsetGraphics::getStatus(Cursor & cur, FuncRequest const & cmd,
void InsetGraphics::edit(Cursor & cur, bool, EntryDirection)
{
cur.bv().showDialog("graphics", params2string(params(),
cur.bv().buffer()), this);
showInsetDialog(&cur.bv());
}
bool InsetGraphics::showInsetDialog(BufferView * bv) const
{
bv->showDialog("graphics", params2string(params(), bv->buffer()),
const_cast<InsetGraphics *>(this));
return true;
}
void InsetGraphics::metrics(MetricsInfo & mi, Dimension & dim) const
{
graphic_->metrics(mi, dim);

View File

@ -87,6 +87,8 @@ private:
///
void edit(Cursor & cur, bool front, EntryDirection entry_from);
///
bool showInsetDialog(BufferView * bv) const;
///
void editGraphics(InsetGraphicsParams const &, Buffer const &) const;
///
bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;

View File

@ -177,6 +177,7 @@ bool InsetSpace::getStatus(Cursor & cur, FuncRequest const & cmd,
status.setOnOff(params_.kind == params.kind);
}
// fall through
case LFUN_INSET_SETTINGS:
case LFUN_INSET_DIALOG_UPDATE:
status.setEnabled(true);
return true;
@ -188,7 +189,15 @@ bool InsetSpace::getStatus(Cursor & cur, FuncRequest const & cmd,
void InsetSpace::edit(Cursor & cur, bool, EntryDirection)
{
cur.bv().showDialog("space", params2string(params()), this);
showInsetDialog(&cur.bv());
}
bool InsetSpace::showInsetDialog(BufferView * bv) const
{
bv->showDialog("space", params2string(params()),
const_cast<InsetSpace *>(this));
return true;
}

View File

@ -161,6 +161,8 @@ public:
bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
private:
///
bool showInsetDialog(BufferView * bv) const;
///
InsetSpaceParams params_;
};

View File

@ -92,6 +92,11 @@ bool InsetVSpace::getStatus(Cursor & cur, FuncRequest const & cmd,
}
status.setEnabled(true);
return true;
case LFUN_INSET_SETTINGS:
status.setEnabled(true);
return true;
default:
return Inset::getStatus(cur, cmd, status);
}
@ -100,8 +105,15 @@ bool InsetVSpace::getStatus(Cursor & cur, FuncRequest const & cmd,
void InsetVSpace::edit(Cursor & cur, bool, EntryDirection)
{
cur.bv().showDialog("vspace", params2string(space()),
showInsetDialog(&cur.bv());
}
bool InsetVSpace::showInsetDialog(BufferView * bv) const
{
bv->showDialog("vspace", params2string(space()),
const_cast<InsetVSpace *>(this));
return true;
}

View File

@ -67,6 +67,8 @@ private:
Inset * clone() const { return new InsetVSpace(*this); }
///
docstring const label() const;
///
bool showInsetDialog(BufferView * bv) const;
///
VSpace space_;