]> git.lyx.org Git - features.git/blobdiff - src/insets/InsetBranch.cpp
DocBook: merge code duplicates for HTML and CALS tables.
[features.git] / src / insets / InsetBranch.cpp
index bb1a0906216d3350e4858283112608df46b2f6da..2b60ca6f44a4004678ecdebd76a3b2cce91c51db 100644 (file)
@@ -28,6 +28,7 @@
 #include "TextClass.h"
 #include "TocBackend.h"
 
+#include "support/convert.h"
 #include "support/debug.h"
 #include "support/gettext.h"
 #include "support/lstrings.h"
@@ -111,8 +112,10 @@ docstring const InsetBranch::buttonLabel(BufferView const &) const
        if (inchild && master_selected != child_selected)
                symb += (child_selected ? tick : cross);
 
-       if (decoration() == InsetLayout::MINIMALISTIC)
-               return symb + params_.branch;
+    docstring inv_symb = from_ascii(params_.inverted ? "~" : "");
+
+       if (decoration() == InsetDecoration::MINIMALISTIC)
+               return symb + inv_symb + params_.branch;
 
        docstring s;
        if (inmaster && inchild)
@@ -123,7 +126,7 @@ docstring const InsetBranch::buttonLabel(BufferView const &) const
                s = _("Branch (master): ");
        else // !inmaster && !inchild
                s = _("Branch (undefined): ");
-       s += params_.branch;
+       s += inv_symb + params_.branch;
 
        return symb + s;
 }
@@ -133,8 +136,12 @@ ColorCode InsetBranch::backgroundColor(PainterInfo const & pi) const
 {
        if (params_.branch.empty())
                return Inset::backgroundColor(pi);
+       string const branch_id = (buffer().masterParams().branchlist().find(params_.branch))
+                       ? convert<string>(buffer().masterParams().branchlist().id())
+                       : convert<string>(buffer().params().branchlist().id());
        // FIXME UNICODE
-       ColorCode c = lcolor.getFromLyXName(to_utf8(params_.branch));
+       string const branchcol = "branch" + branch_id + to_utf8(params_.branch);
+       ColorCode c = lcolor.getFromLyXName(branchcol);
        if (c == Color_none)
                c = Color_error;
        return c;
@@ -307,7 +314,7 @@ bool InsetBranch::producesOutput() const
 
 void InsetBranch::latex(otexstream & os, OutputParams const & runparams) const
 {
-       if (producesOutput()) {
+       if (producesOutput() || ((runparams.for_searchAdv & OutputParams::SearchNonOutput) != 0)) {
                OutputParams rp = runparams;
                rp.inbranch = true;
                InsetText::latex(os, rp);
@@ -321,7 +328,7 @@ void InsetBranch::latex(otexstream & os, OutputParams const & runparams) const
 int InsetBranch::plaintext(odocstringstream & os,
                           OutputParams const & runparams, size_t max_length) const
 {
-       if (!producesOutput())
+       if (!producesOutput() && ((runparams.for_searchAdv & OutputParams::SearchNonOutput) == 0))
                return 0;
 
        int len = InsetText::plaintext(os, runparams, max_length);