]> git.lyx.org Git - features.git/commitdiff
* src/insets/InsetCommand.{cpp,h}:
authorJürgen Spitzmüller <spitz@lyx.org>
Mon, 10 Sep 2007 16:06:01 +0000 (16:06 +0000)
committerJürgen Spitzmüller <spitz@lyx.org>
Mon, 10 Sep 2007 16:06:01 +0000 (16:06 +0000)
- 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

src/BufferView.cpp
src/Text3.cpp
src/insets/InsetCommand.cpp
src/insets/InsetCommand.h

index cec416633d704951bdf8542fd78374e287502662..ae5a4ddc5f47c70fc76a1d228956739e38fc568c 100644 (file)
@@ -913,12 +913,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.
index d537f33633e6f7b871cc2d74710e11bfb09960ef..3d767bf106db5f1a38226af1f1c03bf544be7937 100644 (file)
@@ -1202,12 +1202,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;
        }
index c98ea20a872cc2981a9d38548b1f9e527c6f9142..a97b84d2ab7a3ac8f178a782172f7d94c8893175 100644 (file)
@@ -132,8 +132,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;
        }
 
@@ -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)
 {
        if (getContents() == from)
index 9a745b86ff7bf706dd749a0af6f7ca9b04ba358d..a22152ce4d675e834b06350a0dbf72fa5e28f2c5 100644 (file)
@@ -81,6 +81,8 @@ public:
        {
                return p_[name];
        }
+       ///
+       void edit(Cursor & cur, bool left);
        /// FIXME remove
        virtual void replaceContents(std::string const & from, std::string const & to);
        ///