]> git.lyx.org Git - features.git/commitdiff
Branch-invert: Fix discrepancy with the outliner and document statistics
authorGuillaume Munch <gm@lyx.org>
Tue, 12 Jul 2016 13:28:12 +0000 (14:28 +0100)
committerGuillaume Munch <gm@lyx.org>
Tue, 12 Jul 2016 13:28:12 +0000 (14:28 +0100)
src/insets/InsetBranch.cpp
src/insets/InsetBranch.h

index 53007f604bfbd715971d2f5449a2df7ddbb4f5e9..22f6bb10945aeb922dff9e750b7e6578c0d6c048 100644 (file)
@@ -280,9 +280,15 @@ bool InsetBranch::isBranchSelected(bool const child) const
 }
 
 
+bool InsetBranch::producesOutput() const
+{
+       return isBranchSelected(false) != params_.inverted;
+}
+
+
 void InsetBranch::latex(otexstream & os, OutputParams const & runparams) const
 {
-       if (isBranchActive())
+       if (producesOutput())
                InsetText::latex(os, runparams);
 }
 
@@ -290,7 +296,7 @@ void InsetBranch::latex(otexstream & os, OutputParams const & runparams) const
 int InsetBranch::plaintext(odocstringstream & os,
                           OutputParams const & runparams, size_t max_length) const
 {
-       if (!isBranchActive())
+       if (!producesOutput())
                return 0;
 
        int len = InsetText::plaintext(os, runparams, max_length);
@@ -301,13 +307,13 @@ int InsetBranch::plaintext(odocstringstream & os,
 int InsetBranch::docbook(odocstream & os,
                         OutputParams const & runparams) const
 {
-       return isBranchActive() ?  InsetText::docbook(os, runparams) : 0;
+       return producesOutput() ?  InsetText::docbook(os, runparams) : 0;
 }
 
 
 docstring InsetBranch::xhtml(XHTMLStream & xs, OutputParams const & rp) const
 {
-       if (isBranchActive()) {
+       if (producesOutput()) {
                OutputParams newrp = rp;
                newrp.par_begin = 0;
                newrp.par_end = text().paragraphs().size();
@@ -319,7 +325,7 @@ docstring InsetBranch::xhtml(XHTMLStream & xs, OutputParams const & rp) const
 
 void InsetBranch::toString(odocstream & os) const
 {
-       if (isBranchActive())
+       if (producesOutput())
                InsetCollapsable::toString(os);
 }
 
@@ -327,14 +333,14 @@ void InsetBranch::toString(odocstream & os) const
 void InsetBranch::forOutliner(docstring & os, size_t const maxlen,
                                                          bool const shorten) const
 {
-       if (isBranchActive())
+       if (producesOutput())
                InsetCollapsable::forOutliner(os, maxlen, shorten);
 }
 
 
 void InsetBranch::validate(LaTeXFeatures & features) const
 {
-       if (isBranchActive())
+       if (producesOutput())
                InsetCollapsable::validate(features);
 }
 
@@ -348,7 +354,7 @@ string InsetBranch::contextMenuName() const
 bool InsetBranch::isMacroScope() const 
 {
        // Its own scope if not selected by buffer
-       return !isBranchActive();
+       return !producesOutput();
 }
 
 
@@ -388,7 +394,7 @@ void InsetBranch::addToToc(DocIterator const & cpit, bool output_active,
        toc->push_back(TocItem(pit, 0, str, output_active));
 
        // Proceed with the rest of the inset.
-       bool const doing_output = output_active && isBranchActive();
+       bool const doing_output = output_active && producesOutput();
        InsetCollapsable::addToToc(cpit, doing_output, utype);
 }
 
index beca1c683bee7b42dd5acffdefe1dcb4a2b1c4d2..83783e71ebaadb9e4650cfcf8544167360201c3d 100644 (file)
@@ -97,17 +97,13 @@ private:
                \c buffer. \p child only checks within child documents.
         */
        bool isBranchSelected(bool const child = false) const;
-       ///
-       bool isBranchActive(bool const child = false) const
-               // XOR
-               { return isBranchSelected(child) != params_.inverted; }
        /*!
         * Is the content of this inset part of the output document?
         *
-        * Note that Branch insets are only considered part of the
-        * document when they are selected.
+        * Note that Branch insets are considered part of the
+        * document when they are selected XOR inverted.
         */
-       bool producesOutput() const { return isBranchSelected(); }
+       bool producesOutput() const;
        ///
        bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
        ///