]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetBranch.cpp
Use home made code for the bool facet.
[lyx.git] / src / insets / InsetBranch.cpp
index 407f7d848e1f96617fa07d32ad1296021ac89366..62f6a57dbca5944e9bb44445382871a831c82462 100644 (file)
@@ -22,7 +22,6 @@
 #include "gettext.h"
 #include "Color.h"
 #include "Lexer.h"
-#include "Paragraph.h"
 #include "OutputParams.h"
 
 #include <sstream>
@@ -98,22 +97,33 @@ void InsetBranch::setButtonLabel()
        font.decSize();
 
        docstring s = _("Branch: ") + params_.branch;
-       font.setColor(Color::foreground);
        if (!params_.branch.empty()) {
                // FIXME UNICODE
                Color_color c = lcolor.getFromLyXName(to_utf8(params_.branch));
                if (c == Color::none) {
-                       c = Color::error;
                        s = _("Undef: ") + s;
                }
-               setBackgroundColor(c);
-       } else
-               setBackgroundColor(Color::background);
+       }
+       font.setColor(Color::foreground);
        setLabel(isOpen() ? s : getNewLabel(s) );
        setLabelFont(font);
 }
 
 
+Color_color InsetBranch::backgroundColor() const
+{
+       if (!params_.branch.empty()) {
+               // FIXME UNICODE
+               Color_color c = lcolor.getFromLyXName(to_utf8(params_.branch));
+               if (c == Color::none) {
+                       c = Color::error;
+               }
+               return c;
+       } else
+               return Inset::backgroundColor();
+}
+
+
 bool InsetBranch::showInsetDialog(BufferView * bv) const
 {
        InsetBranchMailer(const_cast<InsetBranch &>(*this)).showDialog(bv);