]> git.lyx.org Git - features.git/blobdiff - src/factory.C
Part of IU.
[features.git] / src / factory.C
index f5a79b3ec543ba7d9fae794743371a4f566aac82..d1afb99668381cc7fcbc4d8e523d3d4b1cd08a97 100644 (file)
@@ -179,16 +179,19 @@ InsetOld * createInset(BufferView * bv, FuncRequest const & cmd)
                bv->owner()->getDialogs().show("tabularcreate");
                return 0;
 
-       case LFUN_INSET_CAPTION: 
-       if (!bv->innerInset()) {
-               auto_ptr<InsetCaption> inset(new InsetCaption(params));
-               inset->setOwner(bv->innerInset());
-               inset->setAutoBreakRows(true);
-               inset->setDrawFrame(InsetText::LOCKED);
-               inset->setFrameColor(LColor::captionframe);
-               return inset.release();
+       case LFUN_INSET_CAPTION: {
+               UpdatableInset * up = bv->cursor().inset()
+                       ? bv->cursor().inset()->asUpdatableInset() : 0;
+               if (!up) {
+                       auto_ptr<InsetCaption> inset(new InsetCaption(params));
+                       inset->setOwner(up);
+                       inset->setAutoBreakRows(true);
+                       inset->setDrawFrame(InsetText::LOCKED);
+                       inset->setFrameColor(LColor::captionframe);
+                       return inset.release();
+               }
+               return 0;
        }
-       return 0;
 
        case LFUN_INDEX_PRINT:
                return new InsetPrintIndex(InsetCommandParams("printindex"));