* Licence details can be found in the file COPYING.
*
* \author Martin Vermeer
+ * \author Jürgen Spitzmüller
*
* Full author contact details are available in file CREDITS.
*/
#include "frontends/Application.h"
+#include "support/lstrings.h"
+
#include <algorithm>
using namespace std;
class BranchNamesEqual : public std::unary_function<Branch, bool>
{
public:
- BranchNamesEqual(docstring const & name) : name_(name) {}
+ BranchNamesEqual(docstring const & name)
+ : name_(name)
+ {}
bool operator()(Branch const & branch) const
{
private:
docstring name_;
};
+
}
-Branch::Branch() : selected_(false)
+Branch::Branch()
+ : selected_(false), filenameSuffix_(false)
{
// no theApp() with command line export
if (theApp())
theApp()->getRgbColor(Color_background, color_);
+ else
+ frontend::Application::getRgbColorUncached(Color_background, color_);
}
}
+bool Branch::hasFileNameSuffix() const
+{
+ return filenameSuffix_;
+}
+
+
+void Branch::setFileNameSuffix(bool b)
+{
+ filenameSuffix_ = b;
+}
+
+
RGBColor const & Branch::color() const
{
return color_;
{
if (str.size() == 7 && str[0] == '#')
color_ = rgbFromHexName(str);
- else
+ else {
// no color set or invalid color - use normal background
- theApp()->getRgbColor(Color_background, color_);
+ // no theApp() with command line export
+ if (theApp())
+ theApp()->getRgbColor(Color_background, color_);
+ else
+ frontend::Application::getRgbColorUncached(Color_background, color_);
+ }
}
Branch br;
br.setBranch(name);
br.setSelected(false);
+ br.setFileNameSuffix(false);
list.push_back(br);
}
if (j == docstring::npos)
}
+docstring BranchList::getFileNameSuffix() const
+{
+ docstring result;
+ List::const_iterator it = list.begin();
+ for (; it != list.end(); ++it) {
+ if (it->isSelected() && it->hasFileNameSuffix())
+ result += "-" + it->branch();
+ }
+ return support::subst(result, from_ascii("/"), from_ascii("_"));
+}
+
} // namespace lyx