]> git.lyx.org Git - lyx.git/blobdiff - src/CutAndPaste.cpp
Tooltips for collapsables and branches
[lyx.git] / src / CutAndPaste.cpp
index f657d57cbde9d0a876bc52c623142cb96964902f..befcaf3ba96ff3c9ca71c1c9a706e481b8f358ed 100644 (file)
@@ -191,10 +191,10 @@ pasteSelectionHelper(Cursor & cur, ParagraphList const & parlist,
                // Set the inset owner of this paragraph.
                tmpbuf->setInsetOwner(pars[pit].inInset());
                for (pos_type i = 0; i < tmpbuf->size(); ++i) {
-                       if (tmpbuf->isInset(i) &&
-                           !pars[pit].insetAllowed(tmpbuf->getInset(i)->lyxCode()))
-                               // do not track deletion of invalid insets
-                               tmpbuf->eraseChar(i--, false);
+                       // do not track deletion of invalid insets
+                       if (Inset * inset = tmpbuf->getInset(i))
+                               if (!pars[pit].insetAllowed(inset->lyxCode()))
+                                       tmpbuf->eraseChar(i--, false);
                }
 
                tmpbuf->setChange(Change(buffer.params().trackChanges ?
@@ -445,17 +445,15 @@ void switchBetweenClasses(TextClassPtr const & c1,
                if (inset->lyxCode() != FLEX_CODE)
                        // FIXME: Should we verify all InsetCollapsable?
                        continue;
-               docstring const name = inset->name();
-               InsetLayout const & il = tclass2.insetlayout(name);
-               inset->setLayout(il);
-               if (il.labelstring != from_utf8("UNDEFINED"))
+               inset->setLayout(c2);
+               if (inset->getLayout().labelstring != from_utf8("UNDEFINED"))
                        continue;
                // The flex inset is undefined in tclass2
                docstring const s = bformat(_(
                        "Flex inset %1$s is "
                        "undefined because of class "
                        "conversion from\n%2$s to %3$s"),
-                       name, from_utf8(tclass1.name()),
+                       inset->name(), from_utf8(tclass1.name()),
                        from_utf8(tclass2.name()));
                // To warn the user that something had to be done.
                errorlist.push_back(ErrorItem(