#include <config.h>
#include "BranchList.h"
+#include "LColor.h"
+
+#include "frontends/Application.h"
+
#include <algorithm>
+
+namespace lyx {
+
using std::string;
+Branch::Branch()
+{
+ theApp->getRgbColor(LColor::background, color_);
+}
+
+
string const & Branch::getBranch() const
{
return branch_;
}
-string const & Branch::getColor() const
+RGBColor const & Branch::getColor() const
{
return color_;
}
-void Branch::setColor(string const & c)
+void Branch::setColor(RGBColor const & c)
{
color_ = c;
}
+void Branch::setColor(string const & c)
+{
+ if (c.size() == 7 && c[0] == '#')
+ color_ = RGBColor(c);
+ else
+ // no color set or invalid color - use normal background
+ theApp->getRgbColor(LColor::background, color_);
+}
+
+
Branch * BranchList::find(std::string const & name)
{
List::iterator it =
Branch br;
br.setBranch(name);
br.setSelected(false);
- br.setColor("none");
list.push_back(br);
}
if (j == string::npos)
bool BranchList::remove(string const & s)
{
- List::size_type const size = list.size();
+ size_t const size = list.size();
list.remove_if(BranchNamesEqual(s));
return size != list.size();
}
+
+
+} // namespace lyx