* src/insets/InsetCommand.{cpp,h}:

- implement edit function that opens the inset's dialog.
* src/BufferView.cpp (doDispatch):
	- call inset->edit (i.e. open dialog) for EDITABLE insets on next-inset-toggle (bug 2907)
* src/Text3.cpp (doDispatch: INDEX_INSERT):
	- move inset->edit to where it belongs.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20193 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2007-09-10 16:06:01 +00:00
parent e055ef0a33
commit 59c2e75e41
4 changed files with 22 additions and 11 deletions

View File

@ -913,12 +913,16 @@ Update::flags BufferView::dispatch(FuncRequest const & cmd)
// if there is an inset at cursor, see whether it // if there is an inset at cursor, see whether it
// wants to toggle. // wants to toggle.
Inset * inset = cur.nextInset(); Inset * inset = cur.nextInset();
if (inset && inset->isActive()) { if (inset) {
Cursor tmpcur = cur; if (inset->isActive()) {
tmpcur.pushLeft(*inset); Cursor tmpcur = cur;
inset->dispatch(tmpcur, tmpcmd); tmpcur.pushLeft(*inset);
if (tmpcur.result().dispatched()) { inset->dispatch(tmpcur, tmpcmd);
cur.dispatched(); if (tmpcur.result().dispatched()) {
cur.dispatched();
}
} else if (inset->editable() == Inset::IS_EDITABLE) {
inset->edit(cur, true);
} }
} }
// if it did not work, try the underlying inset. // if it did not work, try the underlying inset.

View File

@ -1202,12 +1202,10 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
recordUndo(cur); recordUndo(cur);
cur.clearSelection(); cur.clearSelection();
insertInset(cur, inset); insertInset(cur, inset);
inset->edit(cur, true);
// Show the dialog for the nomenclature entry, since the // Show the dialog for the nomenclature entry, since the
// description entry still needs to be filled in. // description entry still needs to be filled in.
if (cmd.action == LFUN_NOMENCL_INSERT) if (cmd.action == LFUN_NOMENCL_INSERT)
InsetCommandMailer("nomenclature", inset->edit(cur, true);
*reinterpret_cast<InsetCommand *>(inset)).showDialog(&cur.bv());
cur.posRight(); cur.posRight();
break; break;
} }

View File

@ -132,8 +132,8 @@ void InsetCommand::doDispatch(Cursor & cur, FuncRequest & cmd)
} }
case LFUN_MOUSE_RELEASE: { case LFUN_MOUSE_RELEASE: {
if (!mailer_name_.empty() && !cur.selection()) if (!cur.selection())
InsetCommandMailer(mailer_name_, *this).showDialog(&cur.bv()); edit(cur, true);
break; break;
} }
@ -165,6 +165,13 @@ bool InsetCommand::getStatus(Cursor & cur, FuncRequest const & cmd,
} }
void InsetCommand::edit(Cursor & cur, bool)
{
if (!mailer_name_.empty())
InsetCommandMailer(mailer_name_, *this).showDialog(&cur.bv());
}
void InsetCommand::replaceContents(std::string const & from, string const & to) void InsetCommand::replaceContents(std::string const & from, string const & to)
{ {
if (getContents() == from) if (getContents() == from)

View File

@ -81,6 +81,8 @@ public:
{ {
return p_[name]; return p_[name];
} }
///
void edit(Cursor & cur, bool left);
/// FIXME remove /// FIXME remove
virtual void replaceContents(std::string const & from, std::string const & to); virtual void replaceContents(std::string const & from, std::string const & to);
/// ///