]> git.lyx.org Git - lyx.git/blobdiff - src/buffer_funcs.cpp
* do not lookup the same macro all the time
[lyx.git] / src / buffer_funcs.cpp
index f8469d702e51b4fd3175e692889d6751fcee3eec..e53f89780548988fcf6ec64f7a2cf4004efa4bb2 100644 (file)
@@ -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();
        }
 }