#include <string>
+
namespace lyx {
void ColorCache::init()
/// get the given color
-QColor const & ColorCache::get(ColorCode color) const
+QColor ColorCache::get(ColorCode color) const
{
if (!initialized_)
const_cast<ColorCache *>(this)->init();
- return lcolors_[color];
+ if (color <= Color_ignore)
+ return lcolors_[color];
+ // used by branches
+ return QColor(lcolor.getX11Name(color).c_str());
}
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; }
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) );
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;
}