]> git.lyx.org Git - lyx.git/blobdiff - src/buffer_funcs.cpp
EmbeddedObjects.lyx: add hint how to force a rotation direction for rotated floats
[lyx.git] / src / buffer_funcs.cpp
index 6527018748ae4f21737c42a8cfdcfd30bb5085b6..0080874610693be76d3f3cf7a836b159aa0b3624 100644 (file)
@@ -377,7 +377,7 @@ void setCaptionLabels(Inset & inset, string const & type,
                        setCaptionLabels(icap, type, label, counters);
                        if (icap.lyxCode() == Inset::CAPTION_CODE) {
                                // We found a caption!
-                               counters.step(counter); 
+                               counters.step(counter);
                                int number = counters.value(counter);
                                InsetCaption & ic = static_cast<InsetCaption &>(icap);
                                ic.setType(type);
@@ -400,7 +400,7 @@ void setCaptions(Paragraph & par, TextClass const & textclass)
        InsetList::iterator end = par.insetlist.end();
        for (; it != end; ++it) {
                Inset & inset = *it->inset;
-               if (inset.lyxCode() == Inset::FLOAT_CODE 
+               if (inset.lyxCode() == Inset::FLOAT_CODE
                        || inset.lyxCode() == Inset::WRAP_CODE) {
                        docstring const name = inset.name();
                        if (name.empty())
@@ -419,6 +419,10 @@ void setCaptions(Paragraph & par, TextClass const & textclass)
                }
                else if (inset.lyxCode() == Inset::LISTINGS_CODE)
                        setCaptionLabels(inset, "listing", from_ascii("Listing"), counters);
+               else if (inset.lyxCode() == Inset::INCLUDE_CODE)
+                       // if this include inset contains lstinputlisting, and has a caption
+                       // it will increase the 'listing' counter by one
+                       static_cast<InsetInclude &>(inset).updateCounter(counters);
        }
 }
 
@@ -698,16 +702,17 @@ void updateLabels(Buffer const & buf, bool childonly)
 
        Buffer & cbuf = const_cast<Buffer &>(buf);
        cbuf.tocBackend().update();
-       cbuf.structureChanged();
+       if (!childonly)
+               cbuf.structureChanged();
 }
 
 
 void checkBufferStructure(Buffer & buffer, ParIterator const & par_it)
 {
-       if (par_it->layout()->labeltype == LABEL_COUNTER
-               && par_it->layout()->toclevel != Layout::NOT_IN_TOC) {
-               buffer.tocBackend().updateItem(par_it);
-               buffer.structureChanged();
+       if (par_it->layout()->toclevel != Layout::NOT_IN_TOC) {
+               Buffer * master = buffer.getMasterBuffer();
+               master->tocBackend().updateItem(par_it);
+               master->structureChanged();
        }
 }