X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FBranchList.C;h=44c98e4a7007beac6d81e9f8fcc9e564b62445cb;hb=35204f8f33d7400a5fefeffea533fb4cb4097211;hp=75f183a0aa50408d45a42738b7c6289c617605c3;hpb=399e6e788cee5fb7d4a916365a4ef60f30cfe654;p=lyx.git diff --git a/src/BranchList.C b/src/BranchList.C index 75f183a0aa..44c98e4a70 100644 --- a/src/BranchList.C +++ b/src/BranchList.C @@ -12,25 +12,30 @@ #include "BranchList.h" #include "LColor.h" -#include "frontends/lyx_gui.h" + +#include "frontends/Application.h" + #include + +namespace lyx { + using std::string; Branch::Branch() { - lyx_gui::getRGBColor(LColor::background, color_); + theApp->getRgbColor(LColor::background, color_); } -string const & Branch::getBranch() const +docstring const & Branch::getBranch() const { return branch_; } -void Branch::setBranch(string const & s) +void Branch::setBranch(docstring const & s) { branch_ = s; } @@ -51,13 +56,13 @@ bool Branch::setSelected(bool b) } -lyx::RGBColor const & Branch::getColor() const +RGBColor const & Branch::getColor() const { return color_; } -void Branch::setColor(lyx::RGBColor const & c) +void Branch::setColor(RGBColor const & c) { color_ = c; } @@ -66,14 +71,14 @@ void Branch::setColor(lyx::RGBColor const & c) void Branch::setColor(string const & c) { if (c.size() == 7 && c[0] == '#') - color_ = lyx::RGBColor(c); + color_ = RGBColor(c); else // no color set or invalid color - use normal background - lyx_gui::getRGBColor(LColor::background, color_); + theApp->getRgbColor(LColor::background, color_); } -Branch * BranchList::find(std::string const & name) +Branch * BranchList::find(docstring const & name) { List::iterator it = std::find_if(list.begin(), list.end(), BranchNamesEqual(name)); @@ -81,7 +86,7 @@ Branch * BranchList::find(std::string const & name) } -Branch const * BranchList::find(std::string const & name) const +Branch const * BranchList::find(docstring const & name) const { List::const_iterator it = std::find_if(list.begin(), list.end(), BranchNamesEqual(name)); @@ -89,14 +94,14 @@ Branch const * BranchList::find(std::string const & name) const } -bool BranchList::add(string const & s) +bool BranchList::add(docstring const & s) { bool added = false; - string::size_type i = 0; + docstring::size_type i = 0; while (true) { - string::size_type const j = s.find_first_of(separator_, i); - string name; - if (j == string::npos) + docstring::size_type const j = s.find_first_of(separator_, i); + docstring name; + if (j == docstring::npos) name = s.substr(i); else name = s.substr(i, j - i); @@ -111,7 +116,7 @@ bool BranchList::add(string const & s) br.setSelected(false); list.push_back(br); } - if (j == string::npos) + if (j == docstring::npos) break; i = j + 1; } @@ -119,9 +124,12 @@ bool BranchList::add(string const & s) } -bool BranchList::remove(string const & s) +bool BranchList::remove(docstring 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