]> git.lyx.org Git - features.git/blobdiff - src/insets/InsetBranch.cpp
DocBook, InsetFloat: avoid a potential nullptr dereference when detecting the type...
[features.git] / src / insets / InsetBranch.cpp
index a70ff27463c6db5003efc637d6e33315d02aff80..be8e5517472da67010b95ee6b54d66b45d918137 100644 (file)
 #include "FuncStatus.h"
 #include "Lexer.h"
 #include "LyX.h"
-#include "OutputParams.h"
 #include "output_docbook.h"
 #include "output_xhtml.h"
 #include "TextClass.h"
 #include "TocBackend.h"
 
+#include "support/convert.h"
 #include "support/debug.h"
 #include "support/gettext.h"
 #include "support/lstrings.h"
@@ -112,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)
@@ -124,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;
 }
@@ -134,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;