diff --git a/src/frontends/qt4/ColorCache.cpp b/src/frontends/qt4/ColorCache.cpp index 4ae3d065bb..69520fc738 100644 --- a/src/frontends/qt4/ColorCache.cpp +++ b/src/frontends/qt4/ColorCache.cpp @@ -16,6 +16,7 @@ #include + namespace lyx { void ColorCache::init() @@ -27,11 +28,14 @@ void ColorCache::init() /// get the given color -QColor const & ColorCache::get(ColorCode color) const +QColor ColorCache::get(ColorCode color) const { if (!initialized_) const_cast(this)->init(); - return lcolors_[color]; + if (color <= Color_ignore) + return lcolors_[color]; + // used by branches + return QColor(lcolor.getX11Name(color).c_str()); } diff --git a/src/frontends/qt4/ColorCache.h b/src/frontends/qt4/ColorCache.h index b667f91197..1716d5c044 100644 --- a/src/frontends/qt4/ColorCache.h +++ b/src/frontends/qt4/ColorCache.h @@ -29,7 +29,7 @@ public: ColorCache() : initialized_(false) {} /// get the given color - QColor const & get(ColorCode color) const; + QColor get(ColorCode color) const; /// clear all colors void clear() { initialized_ = false; } diff --git a/src/insets/InsetBranch.cpp b/src/insets/InsetBranch.cpp index 948a8d6388..d8b2fd7cbc 100644 --- a/src/insets/InsetBranch.cpp +++ b/src/insets/InsetBranch.cpp @@ -82,9 +82,8 @@ void InsetBranch::setButtonLabel() if (!params_.branch.empty()) { // FIXME UNICODE ColorCode c = lcolor.getFromLyXName(to_utf8(params_.branch)); - if (c == Color_none) { + if (c == Color_none) s = _("Undef: ") + s; - } } if (decoration() == InsetLayout::Classic) setLabel(isOpen() ? s : getNewLabel(s) ); @@ -95,15 +94,13 @@ void InsetBranch::setButtonLabel() ColorCode InsetBranch::backgroundColor() const { - if (!params_.branch.empty()) { - // FIXME UNICODE - ColorCode c = lcolor.getFromLyXName(to_utf8(params_.branch)); - if (c == Color_none) { - c = Color_error; - } - return c; - } else + if (params_.branch.empty()) return Inset::backgroundColor(); + // FIXME UNICODE + ColorCode c = lcolor.getFromLyXName(to_utf8(params_.branch)); + if (c == Color_none) + c = Color_error; + return c; }