]> git.lyx.org Git - features.git/commitdiff
Fix display of branch buttons and tooltips.
authorRichard Heck <rgheck@lyx.org>
Sat, 30 Jul 2016 02:58:03 +0000 (22:58 -0400)
committerRichard Heck <rgheck@lyx.org>
Sat, 30 Jul 2016 02:58:03 +0000 (22:58 -0400)
src/insets/InsetBranch.cpp
src/insets/InsetBranch.h

index 22f6bb10945aeb922dff9e750b7e6578c0d6c048..8f4b77b0033fd06a5fd42a2ac031adf074ec34da 100644 (file)
@@ -64,7 +64,7 @@ void InsetBranch::read(Lexer & lex)
 }
 
 
-docstring InsetBranch::toolTip(BufferView const & bv, int, int) const
+docstring InsetBranch::toolTip(BufferView const &, int, int) const
 {
        docstring const masterstatus = isBranchSelected() ?
                _("active") : _("non-active");
@@ -72,14 +72,22 @@ docstring InsetBranch::toolTip(BufferView const & bv, int, int) const
                _("active") : _("non-active");
        docstring const status = (masterstatus == childstatus) ?
                masterstatus :
-               support::bformat(_("master: %1$s, child: %2$s"),
+               support::bformat(_("master %1$s, child %2$s"),
                                                 masterstatus, childstatus);
-       docstring const heading = params_.inverted ?
-               support::bformat(_("Branch, inverted (%1$s): %2$s"), status, params_.branch) :
-               support::bformat(_("Branch (%1$s): %2$s"), status, params_.branch);
-       if (isOpen(bv))
-               return heading;
-       return toolTipText(heading + from_ascii("\n"));
+
+       docstring const masteron = producesOutput() ?
+               _("on") : _("off");
+       docstring const childon = producesOutput(true) ?
+               _("on") : _("off");
+       docstring const onoff = (masteron == childon) ?
+               masteron :
+               support::bformat(_("master %1$s, child %2$s"),
+                                                masteron, childon);
+
+       docstring const heading = 
+               support::bformat(_("Branch Name: %1$s\nBranch Status: %2$s\nInset Status: %3$s"),
+                                                params_.branch, status, onoff);
+       return toolTipText(heading);
 }
 
 
@@ -87,25 +95,18 @@ 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
-       static char_type const itick = 0x271A; // ✚ U+271A HEAVY GREEK CROSS
-       static char_type const icross = 0x274E; // ❎ U+274E NEGATIVE SQUARED CROSS MARK
 
        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);
 
-       bool const master_selected = isBranchSelected();
-       bool const child_selected = isBranchSelected(true);
+       bool const master_selected = producesOutput();
+       bool const child_selected = producesOutput(true);
 
-       docstring symb = docstring(1, master_selected ? 
-               (params_.inverted ? icross : tick) :
-               (params_.inverted ? itick: cross));
-       if (inchild && master_selected != child_selected) {
-               symb += child_selected ? 
-                       (params_.inverted ? icross : tick) :
-                       (params_.inverted ? itick: cross);
-       }
+       docstring symb = docstring(1, master_selected ? tick : cross);
+       if (inchild && master_selected != child_selected)
+               symb += (child_selected ? tick : cross);
 
        if (decoration() == InsetLayout::MINIMALISTIC)
                return symb + params_.branch;
@@ -280,9 +281,9 @@ bool InsetBranch::isBranchSelected(bool const child) const
 }
 
 
-bool InsetBranch::producesOutput() const
+bool InsetBranch::producesOutput(bool const child) const
 {
-       return isBranchSelected(false) != params_.inverted;
+       return isBranchSelected(child) != params_.inverted;
 }
 
 
index 83783e71ebaadb9e4650cfcf8544167360201c3d..fcf706144eb4a5511cc088507b0619a7a5f07bb3 100644 (file)
@@ -103,7 +103,7 @@ private:
         * Note that Branch insets are considered part of the
         * document when they are selected XOR inverted.
         */
-       bool producesOutput() const;
+    bool producesOutput(bool const child = false) const;
        ///
        bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
        ///