]> git.lyx.org Git - lyx.git/blobdiff - src/buffer_funcs.cpp
* Only enter inset which return true on isActive(). This is the behavior in the curso...
[lyx.git] / src / buffer_funcs.cpp
index f8469d702e51b4fd3175e692889d6751fcee3eec..bed9c147ae5690ad4528d15486c1556df3b89304 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())
@@ -417,6 +417,12 @@ void setCaptions(Paragraph & par, TextClass const & textclass)
                        // FIXME: are "table" and "Table" the correct type and label?
                        setCaptionLabels(inset, "table", from_ascii("Table"), counters);
                }
+               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);
        }
 }
 
@@ -696,7 +702,8 @@ void updateLabels(Buffer const & buf, bool childonly)
 
        Buffer & cbuf = const_cast<Buffer &>(buf);
        cbuf.tocBackend().update();
-       cbuf.structureChanged();
+       if (!childonly)
+               cbuf.structureChanged();
 }
 
 
@@ -704,8 +711,9 @@ 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();
+               Buffer * master = buffer.getMasterBuffer();
+               master->tocBackend().updateItem(par_it);
+               master->structureChanged();
        }
 }