]> git.lyx.org Git - features.git/commitdiff
Get rid of some magic booleans in updateLabels() and related routines.
authorRichard Heck <rgheck@comcast.net>
Wed, 20 Jan 2010 19:42:12 +0000 (19:42 +0000)
committerRichard Heck <rgheck@comcast.net>
Wed, 20 Jan 2010 19:42:12 +0000 (19:42 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33110 a592a061-630c-0410-9148-cb99ea01b6c8

33 files changed:
src/Buffer.cpp
src/Buffer.h
src/Counters.cpp
src/Counters.h
src/insets/Inset.h
src/insets/InsetBibitem.cpp
src/insets/InsetBibitem.h
src/insets/InsetCaption.cpp
src/insets/InsetCaption.h
src/insets/InsetCitation.cpp
src/insets/InsetCitation.h
src/insets/InsetFloat.cpp
src/insets/InsetFloat.h
src/insets/InsetFoot.cpp
src/insets/InsetFoot.h
src/insets/InsetInclude.cpp
src/insets/InsetInclude.h
src/insets/InsetLabel.cpp
src/insets/InsetLabel.h
src/insets/InsetListings.cpp
src/insets/InsetListings.h
src/insets/InsetRef.cpp
src/insets/InsetRef.h
src/insets/InsetTabular.cpp
src/insets/InsetTabular.h
src/insets/InsetText.cpp
src/insets/InsetText.h
src/insets/InsetWrap.cpp
src/insets/InsetWrap.h
src/mathed/InsetMathHull.cpp
src/mathed/InsetMathHull.h
src/output_xhtml.cpp
src/sgml.cpp

index 6568fab364f54b1e49c508bbc237bada3a1a827a..e60ffd0d04ba32302f2661286ad4f107d5dddbf4 100644 (file)
@@ -1498,7 +1498,7 @@ void Buffer::writeLyXHTMLSource(odocstream & os,
 {
        LaTeXFeatures features(*this, params(), runparams);
        validate(features);
-       updateLabels(UpdateMaster, true);
+       updateLabels(UpdateMaster, OutputUpdate);
        checkBibInfoCache();
        d->bibinfo_.makeCitationLabels(*this);
        updateMacros();
@@ -3500,7 +3500,7 @@ void Buffer::setBuffersForInsets() const
 }
 
 
-void Buffer::updateLabels(UpdateScope scope, bool out) const
+void Buffer::updateLabels(UpdateScope scope, UpdateType utype) const
 {
        // Use the master text class also for child documents
        Buffer const * const master = masterBuffer();
@@ -3518,7 +3518,7 @@ void Buffer::updateLabels(UpdateScope scope, bool out) const
                // If this is a child document start with the master
                if (master != this) {
                        bufToUpdate.insert(this);
-                       master->updateLabels(UpdateMaster, out);
+                       master->updateLabels(UpdateMaster, utype);
                        // Do this here in case the master has no gui associated with it. Then, 
                        // the TocModel is not updated and TocModel::toc_ is invalid (bug 5699).
                        if (!master->gui_)
@@ -3546,7 +3546,7 @@ void Buffer::updateLabels(UpdateScope scope, bool out) const
 
        // do the real work
        ParIterator parit = cbuf.par_iterator_begin();
-       updateLabels(parit, out);
+       updateLabels(parit, utype);
 
        if (master != this)
                // TocBackend update will be done later.
@@ -3628,7 +3628,7 @@ static bool needEnumCounterReset(ParIterator const & it)
 
 
 // set the label of a paragraph. This includes the counters.
-void Buffer::setLabel(ParIterator & it, bool for_output) const
+void Buffer::setLabel(ParIterator & it, UpdateType utype) const
 {
        BufferParams const & bp = this->masterBuffer()->params();
        DocumentClass const & textclass = bp.documentClass();
@@ -3660,7 +3660,7 @@ void Buffer::setLabel(ParIterator & it, bool for_output) const
                if (layout.toclevel <= bp.secnumdepth
                    && (layout.latextype != LATEX_ENVIRONMENT
                        || it.text()->isFirstInSequence(it.pit()))) {
-                       counters.step(layout.counter, for_output);
+                       counters.step(layout.counter, utype);
                        par.params().labelString(
                                par.expandLabel(layout, bp));
                } else
@@ -3714,7 +3714,7 @@ void Buffer::setLabel(ParIterator & it, bool for_output) const
                // Maybe we have to reset the enumeration counter.
                if (needEnumCounterReset(it))
                        counters.reset(enumcounter);
-               counters.step(enumcounter, for_output);
+               counters.step(enumcounter, utype);
 
                string const & lang = par.getParLanguage(bp)->code();
                par.params().labelString(counters.theCounter(enumcounter, lang));
@@ -3731,7 +3731,7 @@ void Buffer::setLabel(ParIterator & it, bool for_output) const
                        docstring name = this->B_(textclass.floats().getType(type).name());
                        if (counters.hasCounter(from_utf8(type))) {
                                string const & lang = par.getParLanguage(bp)->code();
-                               counters.step(from_utf8(type), for_output);
+                               counters.step(from_utf8(type), utype);
                                full_label = bformat(from_ascii("%1$s %2$s:"), 
                                                     name, 
                                                     counters.theCounter(from_utf8(type), lang));
@@ -3757,7 +3757,7 @@ void Buffer::setLabel(ParIterator & it, bool for_output) const
 }
 
 
-void Buffer::updateLabels(ParIterator & parit, bool out) const
+void Buffer::updateLabels(ParIterator & parit, UpdateType utype) const
 {
        LASSERT(parit.pit() == 0, /**/);
 
@@ -3774,7 +3774,7 @@ void Buffer::updateLabels(ParIterator & parit, bool out) const
                parit->params().depth(min(parit->params().depth(), maxdepth));
                maxdepth = parit->getMaxDepthAfter();
 
-               if (out) {
+               if (utype == OutputUpdate) {
                        // track the active counters
                        // we have to do this for the master buffer, since the local
                        // buffer isn't tracking anything.
@@ -3783,14 +3783,14 @@ void Buffer::updateLabels(ParIterator & parit, bool out) const
                }
                
                // set the counter for this paragraph
-               setLabel(parit, out);
+               setLabel(parit, utype);
 
                // now the insets
                InsetList::const_iterator iit = parit->insetList().begin();
                InsetList::const_iterator end = parit->insetList().end();
                for (; iit != end; ++iit) {
                        parit.pos() = iit->pos;
-                       iit->inset->updateLabels(parit, out);
+                       iit->inset->updateLabels(parit, utype);
                }
        }
 }
index 297e63208ce126bf5110d47a62f428f3292ffd73..deca3a49dbd570e744f74448292356f2998dcf03 100644 (file)
@@ -12,6 +12,7 @@
 #ifndef BUFFER_H
 #define BUFFER_H
 
+#include "OutputEnums.h"
 #include "update_flags.h"
 
 #include "insets/InsetCode.h"
@@ -552,13 +553,13 @@ public:
        /// Updates screen labels and some other information associated with
        /// insets and paragraphs. Actually, it's more like a general "recurse
        /// through the Buffer" routine, that visits all the insets and paragraphs.
-       void updateLabels() const { updateLabels(UpdateMaster, false); }
+       void updateLabels() const { updateLabels(UpdateMaster, InternalUpdate); }
        /// \param scope: whether to start with the master document or just
        /// do this one.
        /// \param output: whether we are preparing for output.
-       void updateLabels(UpdateScope scope, bool output) const;
+       void updateLabels(UpdateScope scope, UpdateType utype) const;
        /// 
-       void updateLabels(ParIterator & parit, bool output) const;
+       void updateLabels(ParIterator & parit, UpdateType utype) const;
 
        /// Spellcheck starting from \p from.
        /// \p from initial position, will then points to the next misspelled
@@ -579,7 +580,7 @@ private:
        void updateMacros(DocIterator & it,
                                     DocIterator & scope) const;
        ///
-       void setLabel(ParIterator & it) const;
+       void setLabel(ParIterator & it, UpdateType utype) const;
        ///
        void collectRelatives(BufferSet & bufs) const;
 
index fff4ac7d92984198c4a9bdb0b1bd466ec55784fa..626596a83301d6121dd742f625ced09751f66f4e 100644 (file)
@@ -227,7 +227,7 @@ int Counters::value(docstring const & ctr) const
 }
 
 
-void Counters::step(docstring const & ctr, bool track_counters)
+void Counters::step(docstring const & ctr, UpdateType utype)
 {
        CounterList::iterator it = counterList_.find(ctr);
        if (it == counterList_.end()) {
@@ -237,7 +237,7 @@ void Counters::step(docstring const & ctr, bool track_counters)
        }
 
        it->second.step();
-       if (track_counters) {
+       if (utype == OutputUpdate) {
                LASSERT(!counter_stack_.empty(), /* */);
                counter_stack_.pop_back();
                counter_stack_.push_back(ctr);
index d32f477ea82dd2004cece50b66804c18bd3a99a9..16f1d981840e6766c59ce866d6ca43894b32659c 100644 (file)
@@ -15,6 +15,8 @@
 #ifndef COUNTERS_H
 #define COUNTERS_H
 
+#include "OutputEnums.h"
+
 #include "support/docstring.h"
 
 #include <map>
@@ -116,7 +118,7 @@ public:
        /// Sub-slaves are not zeroed! That happens at slave's first 
        /// step 0->1. Seems to be sufficient.
        /// \param for_output: whether to track the counters
-       void step(docstring const & ctr, bool track_counters = false);
+       void step(docstring const & ctr, UpdateType = InternalUpdate);
        /// Reset all counters.
        void reset();
        /// Reset counters matched by match string.
index ec69809bd8aef22e202d574664e2bf4df066f968..8b56f802cd4a59870d4af15e553682d3d9652b57 100644 (file)
@@ -18,6 +18,7 @@
 #include "ColorCode.h"
 #include "InsetCode.h"
 #include "Layout.h"
+#include "OutputEnums.h"
 
 #include "support/strfwd.h"
 #include "support/types.h"
@@ -472,7 +473,7 @@ public:
        /// Update the counters of this inset and of its contents.
        /// The boolean indicates whether we are preparing for output, e.g.,
        /// of XHTML.
-       virtual void updateLabels(ParIterator const &, bool) {}
+       virtual void updateLabels(ParIterator const &, UpdateType) {}
 
        /// Updates the inset's dialog
        virtual Buffer const * updateFrontend() const;
index 123c639a629d9b467cee12b6819c1a4e50d0a267..ded2b8b9cca3507daafad96b1476f9b426c9b5e7 100644 (file)
@@ -254,13 +254,13 @@ void InsetBibitem::fillWithBibKeys(BiblioInfo & keys, InsetIterator const & it)
 
 
 // Update the counters of this inset and of its contents
-void InsetBibitem::updateLabels(ParIterator const & it, bool)
+void InsetBibitem::updateLabels(ParIterator const & it, UpdateType utype)
 {
        BufferParams const & bp = buffer().masterBuffer()->params();
        Counters & counters = bp.documentClass().counters();
        docstring const bibitem = from_ascii("bibitem");
        if (counters.hasCounter(bibitem) && getParam("label").empty()) {
-               counters.step(bibitem);
+               counters.step(bibitem, utype);
                string const & lang = it.paragraph().getParLanguage(bp)->code();
                autolabel_ = counters.theCounter(bibitem, lang);
        } else {
index cdbd857873f84130a8dd306e9e073c8472a9dfb6..98fdf9ff8e9a2a633edd8207e106e20198c51d55 100644 (file)
@@ -65,7 +65,7 @@ private:
        ///
        virtual void fillWithBibKeys(BiblioInfo &, InsetIterator const &) const;
        /// Update the counter of this inset
-       virtual void updateLabels(ParIterator const &, bool);
+       void updateLabels(ParIterator const &, UpdateType);
        ///
        void updateCommand(docstring const & new_key, bool dummy = false);
        ///
index 4b84a8190f8312976140178fac53d39b07bcb241..b9ed6029dd6010528d28a32e92f0596db3b9f2ce 100644 (file)
@@ -307,14 +307,14 @@ docstring InsetCaption::getCaptionAsHTML(XHTMLStream & xs,
 }
 
 
-void InsetCaption::updateLabels(ParIterator const & it, bool out)
+void InsetCaption::updateLabels(ParIterator const & it, UpdateType utype)
 {
        Buffer const & master = *buffer().masterBuffer();
        DocumentClass const & tclass = master.params().documentClass();
        string const & lang = it.paragraph().getParLanguage(master.params())->code();
        Counters & cnts = tclass.counters();
        string const & type = cnts.current_float();
-       if (out) {
+       if (utype == OutputUpdate) {
                // counters are local to the caption
                cnts.saveLastCounter();
        }
@@ -337,7 +337,7 @@ void InsetCaption::updateLabels(ParIterator const & it, bool out)
                                       master.B_(tclass.floats().getType(type).name()));
                }
                if (cnts.hasCounter(counter)) {
-                       cnts.step(counter, out);
+                       cnts.step(counter, utype);
                        full_label_ = bformat(from_ascii("%1$s %2$s:"), 
                                              name,
                                              cnts.theCounter(counter, lang));
@@ -346,8 +346,8 @@ void InsetCaption::updateLabels(ParIterator const & it, bool out)
        }
 
        // Do the real work now.
-       InsetText::updateLabels(it, out);
-       if (out)
+       InsetText::updateLabels(it, utype);
+       if (utype == OutputUpdate)
                cnts.restoreLastCounter();
 }
 
index 81eee6ee12cdcf674210f68726e2e38a49c031d5..e24808e8533113d3b66734dde1abfdb80a4d81fe 100644 (file)
@@ -64,7 +64,7 @@ private:
        ///
        bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
        // Update the counters of this inset and of its contents
-       void updateLabels(ParIterator const &, bool);
+       void updateLabels(ParIterator const &, UpdateType);
        ///
        int latex(odocstream & os, OutputParams const &) const;
        ///
index 7c4caa742ef535829fa6e3c69e710e17c3bb8d9f..0e59af21f7e0f7b2ce6487115ad51715a89c80e3 100644 (file)
@@ -457,7 +457,7 @@ docstring InsetCitation::screenLabel() const
 }
 
 
-void InsetCitation::updateLabels(ParIterator const &, bool)
+void InsetCitation::updateLabels(ParIterator const &, UpdateType utype)
 {
        CiteEngine const engine = buffer().params().citeEngine();
        if (cache.params == params() && cache.engine == engine)
index aff08945602cc1efe9c1b23036afc64eddedb237..64996e7403839ac2d907f50cc1d7291e59f954f0 100644 (file)
@@ -56,7 +56,7 @@ public:
        ///
        void validate(LaTeXFeatures &) const;
        ///
-       void updateLabels(ParIterator const & it, bool);
+       void updateLabels(ParIterator const & it, UpdateType);
        ///
        void addToToc(DocIterator const &);
 
index 97180b33532c4e0d96ce687aa940709eb9f1417e..00cb7bd723fbd8109128437324a5d3ea5f2729bd 100644 (file)
@@ -195,11 +195,11 @@ bool InsetFloat::getStatus(Cursor & cur, FuncRequest const & cmd,
 }
 
 
-void InsetFloat::updateLabels(ParIterator const & it, bool out)
+void InsetFloat::updateLabels(ParIterator const & it, UpdateType utype)
 {
        Counters & cnts =
                buffer().masterBuffer()->params().documentClass().counters();
-       if (out) {
+       if (utype == OutputUpdate) {
                // counters are local to the float
                cnts.saveLastCounter();
        }
@@ -217,11 +217,11 @@ void InsetFloat::updateLabels(ParIterator const & it, bool out)
        cnts.current_float(params().type);
        cnts.isSubfloat(subflt);
 
-       InsetCollapsable::updateLabels(it, out);
+       InsetCollapsable::updateLabels(it, utype);
 
        //reset afterwards
        cnts.current_float(saveflt);
-       if (out)
+       if (utype == OutputUpdate)
                cnts.restoreLastCounter();
        cnts.isSubfloat(savesubflt);
 }
index 35539ece9de5cce67b1390ce76afdaa84adb841f..3edba343140ca9cbb0ec14bcccbe0377bc64cbb9 100644 (file)
@@ -101,7 +101,7 @@ private:
        ///
        bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
        // Update the counters of this inset and of its contents
-       void updateLabels(ParIterator const &, bool);
+       void updateLabels(ParIterator const &, UpdateType);
        ///
        void doDispatch(Cursor & cur, FuncRequest & cmd);
        ///
index f184e4bc7902832c055a749f38dee810c6f7b915..48a70817cb5d3195cc5a333772737714be1245a5 100644 (file)
@@ -36,11 +36,11 @@ InsetFoot::InsetFoot(Buffer * buf)
 {}
 
 
-void InsetFoot::updateLabels(ParIterator const & it, bool out)
+void InsetFoot::updateLabels(ParIterator const & it, UpdateType utype)
 {
        BufferParams const & bp = buffer().masterBuffer()->params();
        Counters & cnts = bp.documentClass().counters();
-       if (out) {
+       if (utype == OutputUpdate) {
                // the footnote counter is local to this inset
                cnts.saveLastCounter();
        }
@@ -48,13 +48,13 @@ void InsetFoot::updateLabels(ParIterator const & it, bool out)
        InsetLayout const & il = getLayout();
        docstring const & count = il.counter();
        if (!outer.layout().intitle && cnts.hasCounter(count)) {
-               cnts.step(count, out);
+               cnts.step(count, utype);
                custom_label_= translateIfPossible(il.labelstring()) 
                        + ' ' + cnts.theCounter(count, outer.getParLanguage(bp)->code());
                setLabel(custom_label_);        
        }
-       InsetCollapsable::updateLabels(it, out);
-       if (out)
+       InsetCollapsable::updateLabels(it, utype);
+       if (utype == OutputUpdate)
                cnts.restoreLastCounter();      
 }
 
index 3efc7c89e5a825ffda83db9ac4f624936a590388..28aee678b9d20c91494de222ebf40692f2183896 100644 (file)
@@ -38,7 +38,7 @@ private:
        ///
        int docbook(odocstream &, OutputParams const &) const;
        /// Update the counters of this inset and of its contents
-       void updateLabels(ParIterator const &, bool);
+       void updateLabels(ParIterator const &, UpdateType);
        ///
        void addToToc(DocIterator const &);
        ///
index e65cdd637f644397c9988c183d6efa06ef50961e..aa1c00fd80a12f9857acd3d2054eb328a03d9be5 100644 (file)
@@ -1047,18 +1047,18 @@ void InsetInclude::updateCommand()
        setParams(p);   
 }
 
-void InsetInclude::updateLabels(ParIterator const & it, bool out)
+void InsetInclude::updateLabels(ParIterator const & it, UpdateType utype)
 {
        Buffer const * const childbuffer = getChildBuffer();
        if (childbuffer) {
-               childbuffer->updateLabels(Buffer::UpdateChildOnly, out);
+               childbuffer->updateLabels(Buffer::UpdateChildOnly, utype);
                return;
        }
        if (!isListings(params()))
                return;
 
        if (label_)
-               label_->updateLabels(it, out);
+               label_->updateLabels(it, utype);
 
        InsetListingsParams const par(to_utf8(params()["lstparams"]));
        if (par.getParamValue("caption").empty()) {
@@ -1070,7 +1070,7 @@ void InsetInclude::updateLabels(ParIterator const & it, bool out)
        docstring const cnt = from_ascii("listing");
        listings_label_ = master.B_("Program Listing");
        if (counters.hasCounter(cnt)) {
-               counters.step(cnt);
+               counters.step(cnt, utype);
                listings_label_ += " " + convert<docstring>(counters.value(cnt));
        }
 }
index d0c5263a21ca18fed3bfc9fe1a2a8ec0c057c9be..428a2dd7ccd89a362f61dc8237f1ddd2d4720c20 100644 (file)
@@ -94,7 +94,7 @@ public:
        ///
        void updateCommand();
        ///
-       void updateLabels(ParIterator const &, bool);
+       void updateLabels(ParIterator const &, UpdateType);
        ///
        static ParamInfo const & findInfo(std::string const &);
        ///
index 840a6341d5df21f03e3112a57d9d22a23acc4b15..edcf5ec742a78f88a8969f9d1b080d3b1c8a1ff1 100644 (file)
@@ -108,7 +108,7 @@ docstring InsetLabel::screenLabel() const
 }
 
 
-void InsetLabel::updateLabels(ParIterator const & par, bool out)
+void InsetLabel::updateLabels(ParIterator const & par, UpdateType utype)
 {
        docstring const & label = getParam("name");
        if (buffer().insetLabel(label)) {
@@ -119,7 +119,7 @@ void InsetLabel::updateLabels(ParIterator const & par, bool out)
        buffer().setInsetLabel(label, this);
        screen_label_ = label;
 
-       if (out) {
+       if (utype) {
                // save info on the active counter
                Counters const & cnts = 
                        buffer().masterBuffer()->params().documentClass().counters();
index 8c3f3ae970f777499b109b58d5715f7eb2b53df3..1ad8da9b1675632d08c86bd44d6cda3c1b146ec3 100644 (file)
@@ -55,7 +55,7 @@ public:
        static bool isCompatibleCommand(std::string const & s) 
                { return s == "label"; }
        ///
-       void updateLabels(ParIterator const & it, bool);
+       void updateLabels(ParIterator const & it, UpdateType);
        ///
        void addToToc(DocIterator const &);
        ///
index 78a97b875b894a6541ba73455c3db2f62a77c420..de690f7c1985d46b90be9b15e2331e1283d614d2 100644 (file)
@@ -71,7 +71,7 @@ Inset::DisplayType InsetListings::display() const
 }
 
 
-void InsetListings::updateLabels(ParIterator const & it, bool out)
+void InsetListings::updateLabels(ParIterator const & it, UpdateType utype)
 {
        Counters & cnts = buffer().masterBuffer()->params().documentClass().counters();
        string const saveflt = cnts.current_float();
@@ -79,7 +79,7 @@ void InsetListings::updateLabels(ParIterator const & it, bool out)
        // Tell to captions what the current float is
        cnts.current_float("listing");
 
-       InsetCollapsable::updateLabels(it, out);
+       InsetCollapsable::updateLabels(it, utype);
 
        //reset afterwards
        cnts.current_float(saveflt);
index 1e4135c3ef057380cfd1157c7f4167d36ed3c9a4..d11612282d2be731aa75b306bf8431115f905001 100644 (file)
@@ -48,7 +48,7 @@ private:
        ///
        docstring name() const { return from_ascii("Listings"); }
        // Update the counters of this inset and of its contents
-       void updateLabels(ParIterator const &, bool);
+       void updateLabels(ParIterator const &, UpdateType);
        ///
        void write(std::ostream & os) const;
        ///
index 647347bc8d811d18367a58ba02a83dd7cae1d4b6..f292caf32eee2d50b4a9b270cc4d1101e7ddb711 100644 (file)
@@ -161,7 +161,7 @@ void InsetRef::tocString(odocstream & os) const
 }
 
 
-void InsetRef::updateLabels(ParIterator const & it, bool)
+void InsetRef::updateLabels(ParIterator const & it, UpdateType)
 {
        docstring const & label = getParam("reference");
        // register this inset into the buffer reference cache.
index 9359d665604e83d93b6c8fbf55c0950bd72839e5..afcaaf4974d6985b9269875b33399050a995566c 100644 (file)
@@ -67,7 +67,7 @@ public:
        ///
        static bool isCompatibleCommand(std::string const & s);
        ///
-       void updateLabels(ParIterator const & it, bool);
+       void updateLabels(ParIterator const & it, UpdateType);
        ///
        void addToToc(DocIterator const &);
 protected:
index 390b08eedcbab11c3f60b614546da66752471c5c..902814a723d3af4249b3c49698c2719668a00ef6 100644 (file)
@@ -3398,7 +3398,7 @@ void InsetTabular::edit(Cursor & cur, bool front, EntryDirection)
 }
 
 
-void InsetTabular::updateLabels(ParIterator const & it, bool out)
+void InsetTabular::updateLabels(ParIterator const & it, UpdateType utype)
 {
        // In a longtable, tell captions what the current float is
        Counters & cnts = buffer().masterBuffer()->params().documentClass().counters();
@@ -3410,7 +3410,7 @@ void InsetTabular::updateLabels(ParIterator const & it, bool out)
        it2.forwardPos();
        size_t const end = it2.nargs();
        for ( ; it2.idx() < end; it2.top().forwardIdx())
-               buffer().updateLabels(it2, out);
+               buffer().updateLabels(it2, utype);
 
        //reset afterwards
        if (tabular.is_long_tabular)
index 922e13ae3191b11b154239c8fdb2d6a8ec2e03d8..bc72937741fa1fb860ec88ca2d5456eab81b41f7 100644 (file)
@@ -836,7 +836,7 @@ public:
        /// can we go further down on mouse click?
        bool descendable(BufferView const &) const { return true; }
        // Update the counters of this inset and of its contents
-       void updateLabels(ParIterator const &, bool);
+       void updateLabels(ParIterator const &, UpdateType);
 
        ///
        bool completionSupported(Cursor const &) const;
index 39fa0937f32c6a1072c49bb973eefd27a1a15733..8761c98f75c33712ecfa5fecb731211b63556c50 100644 (file)
@@ -504,7 +504,7 @@ docstring InsetText::insetAsXHTML(XHTMLStream & xs, OutputParams const & runpara
        if ((opts & WriteLabel) && !il.counter().empty()) {
                BufferParams const & bp = buffer().masterBuffer()->params();
                Counters & cntrs = bp.documentClass().counters();
-               cntrs.step(il.counter(), true);
+               cntrs.step(il.counter(), OutputUpdate);
                // FIXME: translate to paragraph language
                if (!il.htmllabel().empty()) {
                        docstring const lbl = 
@@ -648,23 +648,21 @@ ParagraphList & InsetText::paragraphs()
 }
 
 
-void InsetText::updateLabels(ParIterator const & it, bool out)
+void InsetText::updateLabels(ParIterator const & it, UpdateType utype)
 {
        ParIterator it2 = it;
        it2.forwardPos();
        LASSERT(&it2.inset() == this && it2.pit() == 0, return);
        if (producesOutput()) {
-               // FIXME We only want to do this, in fact, for some insets.
-               // But we'll need layout info for that.
                InsetLayout const & il = getLayout();
-               bool const save_layouts = out && il.htmlisblock();
+               bool const save_layouts = utype == OutputUpdate && il.htmlisblock();
                Counters & cnt = buffer().masterBuffer()->params().documentClass().counters();
                if (save_layouts) {
                        // LYXERR0("Entering " << name());
                        cnt.clearLastLayout();
                        // FIXME cnt.saveLastCounter()?
                }
-               buffer().updateLabels(it2, out);
+               buffer().updateLabels(it2, utype);
                if (save_layouts) {
                        // LYXERR0("Exiting " << name());
                        cnt.restoreLastLayout();
@@ -676,7 +674,7 @@ void InsetText::updateLabels(ParIterator const & it, bool out)
                //      tclass.counters().clearLastLayout()
                // since we are saving and restoring the existing counters, etc.
                Counters const savecnt = tclass.counters();
-               buffer().updateLabels(it2, out);
+               buffer().updateLabels(it2, utype);
                tclass.counters() = savecnt;
        }
 }
index 43ef3f717dd26cba86a7b23c247bbf57a7966263..8c1f6842e7d377f3e000483bffe430cedb4b539e 100644 (file)
@@ -164,7 +164,7 @@ public:
                { return getLayout().allowParagraphCustomization(); }
 
        /// Update the counters of this inset and of its contents
-       virtual void updateLabels(ParIterator const &, bool);
+       virtual void updateLabels(ParIterator const &, UpdateType);
        /// the string that is passed to the TOC
        void tocString(odocstream &) const;
        ///
index c12628b61fb087b0bb86a06d664c297d7a9653be..03d5ed528f22910b9e6d43b6693b7616ee4906cd 100644 (file)
@@ -114,12 +114,12 @@ bool InsetWrap::getStatus(Cursor & cur, FuncRequest const & cmd,
 }
 
 
-void InsetWrap::updateLabels(ParIterator const & it, bool out)
+void InsetWrap::updateLabels(ParIterator const & it, UpdateType utype)
 {
        setLabel(_("wrap: ") + floatName(params_.type));
        Counters & cnts =
                buffer().masterBuffer()->params().documentClass().counters();
-       if (out) {
+       if (utype == OutputUpdate) {
                // counters are local to the wrap
                cnts.saveLastCounter();
        }
@@ -128,11 +128,11 @@ void InsetWrap::updateLabels(ParIterator const & it, bool out)
        // Tell to captions what the current float is
        cnts.current_float(params().type);
 
-       InsetCollapsable::updateLabels(it, out);
+       InsetCollapsable::updateLabels(it, utype);
 
        // reset afterwards
        cnts.current_float(saveflt);
-       if (out)
+       if (utype == OutputUpdate)
                cnts.restoreLastCounter();
 }
 
index b079997743e48f50adccf2826cde8d49455bbf5e..5c601c894ade189953a107cea51576112a266ab2 100644 (file)
@@ -79,7 +79,7 @@ private:
        ///
        bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
        /// Update the counters of this inset and of its contents
-       void updateLabels(ParIterator const &, bool);
+       void updateLabels(ParIterator const &, UpdateType);
        ///
        void doDispatch(Cursor & cur, FuncRequest & cmd);
        ///
index cf21d152f52044cc36523c88308e3c71b435052c..79ac46e52f027f3d329c8bd974cb43361309dd9b 100644 (file)
@@ -213,7 +213,7 @@ void InsetMathHull::setBuffer(Buffer & buffer)
 }
 
 
-void InsetMathHull::updateLabels(ParIterator const & it, bool out)
+void InsetMathHull::updateLabels(ParIterator const & it, UpdateType utype)
 {
        if (!buffer_) {
                //FIXME: buffer_ should be set at creation for this inset! Problem is
@@ -223,7 +223,7 @@ void InsetMathHull::updateLabels(ParIterator const & it, bool out)
        }
        for (size_t i = 0; i != label_.size(); ++i) {
                if (label_[i])
-                       label_[i]->updateLabels(it, out);
+                       label_[i]->updateLabels(it, utype);
        }
 }
 
index db4d2ff89cca83f0e7cd911559c139b0ff06ad80..1e94d6badc13dcbf4ee9019aeb9f17c78ad1c567 100644 (file)
@@ -14,6 +14,8 @@
 
 #include "InsetMathGrid.h"
 
+#include "OutputEnums.h"
+
 #include <boost/scoped_ptr.hpp>
 
 
@@ -36,7 +38,7 @@ public:
        ///
        void setBuffer(Buffer &);
        ///
-       void updateLabels(ParIterator const &, bool);
+       void updateLabels(ParIterator const &, UpdateType);
        ///
        void addToToc(DocIterator const &);
        ///
index 212d1f6eabdd8b340682d29c486a24f2122cdbc6..85b58774fca76c0e156cfdade4a14b0b0ed970b7 100644 (file)
@@ -573,7 +573,7 @@ ParagraphList::const_iterator makeParagraphs(Buffer const & buf,
        for (; par != pend; ++par) {
                Layout const & lay = par->layout();
                if (!lay.counter.empty())
-                       buf.params().documentClass().counters().step(lay.counter);
+                       buf.params().documentClass().counters().step(lay.counter, OutputUpdate);
                // FIXME We should see if there's a label to be output and
                // do something with it.
                if (par != pbegin)
@@ -674,7 +674,7 @@ ParagraphList::const_iterator makeEnvironmentHtml(Buffer const & buf,
                    && (par == pbegin || !isNormalEnv(style)) 
                                && cnts.hasCounter(cntr)
                )
-                       cnts.step(cntr);
+                       cnts.step(cntr, OutputUpdate);
                ParagraphList::const_iterator send;
                // this will be positive, if we want to skip the initial word
                // (if it's been taken for the label).
@@ -786,7 +786,7 @@ void makeCommand(Buffer const & buf,
 {
        Layout const & style = pbegin->layout();
        if (!style.counter.empty())
-               buf.params().documentClass().counters().step(style.counter);
+               buf.params().documentClass().counters().step(style.counter, OutputUpdate);
 
        openTag(xs, style);
 
index 7b899f223cfe3124a64b8e753dd6fa7db7c0c91c..f895287195b5c55aabc8d7e8301cb572fb6c8057 100644 (file)
@@ -220,6 +220,7 @@ void sgml::openTag(Buffer const & buf, odocstream & os,
                if (param.find('#') != string::npos) {
                        // FIXME UNICODE
                        if (!style.counter.empty())
+                               // NOTE This could use OutputUpdate and track the counters.
                                counters.step(style.counter);
                        else
                                counters.step(from_ascii(name));