* 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/branches/BRANCH_1_5_X@20192 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2007-09-10 16:04:21 +00:00
parent a0c7b98414
commit 2b240a39c2
5 changed files with 25 additions and 11 deletions

View File

@ -1020,12 +1020,16 @@ Update::flags BufferView::dispatch(FuncRequest const & cmd)
// if there is an inset at cursor, see whether it
// wants to toggle.
Inset * inset = cur.nextInset();
if (inset && inset->isActive()) {
Cursor tmpcur = cur;
tmpcur.pushLeft(*inset);
inset->dispatch(tmpcur, tmpcmd);
if (tmpcur.result().dispatched()) {
cur.dispatched();
if (inset) {
if (inset->isActive()) {
Cursor tmpcur = cur;
tmpcur.pushLeft(*inset);
inset->dispatch(tmpcur, tmpcmd);
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.

View File

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

View File

@ -133,8 +133,8 @@ void InsetCommand::doDispatch(Cursor & cur, FuncRequest & cmd)
}
case LFUN_MOUSE_RELEASE: {
if (!mailer_name_.empty() && !cur.selection())
InsetCommandMailer(mailer_name_, *this).showDialog(&cur.bv());
if (!cur.selection())
edit(cur, true);
break;
}
@ -166,6 +166,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)
{
if (getContents() == from)

View File

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

View File

@ -133,6 +133,9 @@ What's new
- Fix bug where the cursor was largely off-screen on document opening
(bug 3427).
- The dialogs of "editable" insets (such as index entries, urls or citations)
are now opened by "next-inset-toggle", i.e. C-i (bug 2907).
* DOCUMENTATION