]> git.lyx.org Git - features.git/commitdiff
Fix bug #10213 as discussed there: We now display the same button
authorRichard Heck <rgheck@lyx.org>
Tue, 14 Jun 2016 17:55:18 +0000 (18:55 +0100)
committerRichard Heck <rgheck@lyx.org>
Tue, 21 Jun 2016 18:43:52 +0000 (14:43 -0400)
whether the branch is open or closed.

src/insets/InsetBranch.cpp
src/insets/InsetBranch.h

index 7d2d4d51cb36adb9529326219c0d75bbad96c9c4..18db067183267a29969ea379cd9db02b1ba710d1 100644 (file)
@@ -82,36 +82,38 @@ docstring InsetBranch::toolTip(BufferView const & bv, int, int) const
 }
 
 
-docstring const InsetBranch::buttonLabel(BufferView const & bv) const
+docstring const InsetBranch::buttonLabel(BufferView const &) const
 {
        static char_type const tick = 0x2714; // ✔ U+2714 HEAVY CHECK MARK
        static char_type const cross = 0x2716; // ✖ U+2716 HEAVY MULTIPLICATION X
-       docstring s = _("Branch: ") + params_.branch;
+
        Buffer const & realbuffer = *buffer().masterBuffer();
        BranchList const & branchlist = realbuffer.params().branchlist();
        bool const inmaster = branchlist.find(params_.branch);
        bool const inchild = buffer().params().branchlist().find(params_.branch);
-       if (!inmaster && inchild)
-               s = _("Branch (child only): ") + params_.branch;
-       else if (inmaster && !inchild)
-               s = _("Branch (master only): ") + params_.branch;
-       else if (!inmaster)
-               s = _("Branch (undefined): ") + params_.branch;
-       if (!params_.branch.empty()) {
-               // FIXME UNICODE
-               ColorCode c = lcolor.getFromLyXName(to_utf8(params_.branch));
-               if (c == Color_none)
-                       s = _("Undef: ") + s;
-       }
+
        bool const master_selected = isBranchSelected();
        bool const child_selected = isBranchSelected(true);
+
        docstring symb = docstring(1, master_selected ? tick : cross);
        if (inchild && master_selected != child_selected)
                symb += child_selected ? tick : cross;
-       if (decoration() == InsetLayout::CLASSIC)
-               return symb + (isOpen(bv) ? s : getNewLabel(s));
-       else
-               return symb + params_.branch + ": " + getNewLabel(s);
+
+       if (decoration() == InsetLayout::MINIMALISTIC)
+               return symb + params_.branch;
+
+       docstring s;
+       if (inmaster && inchild)
+               s = _("Branch: ");
+       else if (inchild) // && !inmaster
+               s = _("Branch (child only): ");
+       else if (inmaster) // && !inchild
+               s = _("Branch (master only): ");
+       else // !inmaster && !inchild
+               s = _("Branch (undefined): ");
+       s += params_.branch;
+
+    return symb + s;
 }
 
 
index e005bce24594384cc1737a4fb2b6377097a02630..b4ecbc8c99507bd81c0be3d806ed1c17efd6867d 100644 (file)
@@ -61,7 +61,7 @@ private:
        ///
        void read(Lexer & lex);
        ///
-       docstring const buttonLabel(BufferView const & bv) const;
+       docstring const buttonLabel(BufferView const &) const;
        ///
        ColorCode backgroundColor(PainterInfo const &) const;
        ///