- Implemented ColPriority, with 'default' and 'long' formats.
- Implemented ColProject 'parent' format.
This commit is contained in:
Paul Beckingham 2011-04-29 19:33:54 -04:00
parent dd1be996a6
commit 9fd819e3a0
9 changed files with 195 additions and 16 deletions

View file

@ -50,6 +50,16 @@ ColumnProject::~ColumnProject ()
void ColumnProject::measure (Task& task, int& minimum, int& maximum)
{
std::string project = task.get ("project");
if (_style == "parent")
{
std::string::size_type period = project.find ('.');
if (period != std::string::npos)
project = project.substr (0, period);
}
else if (_style != "default")
throw std::string ("Unrecognized column format '") + _type + "." + _style + "'";
minimum = 0;
maximum = project.length ();
@ -70,14 +80,20 @@ void ColumnProject::render (
int width,
Color& color)
{
// TODO Can't use Nibbler here. Need to use a UTF8-safe version of extractLines.
Nibbler nibbler (task.get ("project"));
std::string word;
while (nibbler.getUntilWS (word))
std::string project = task.get ("project");
if (_style == "parent")
{
nibbler.skipWS ();
lines.push_back (color.colorize (leftJustify (word, width)));
std::string::size_type period = project.find ('.');
if (period != std::string::npos)
project = project.substr (0, period);
}
std::vector <std::string> raw;
wrapText (raw, project, width);
std::vector <std::string>::iterator i;
for (i = raw.begin (); i != raw.end (); ++i)
lines.push_back (color.colorize (leftJustify (*i, width)));
}
////////////////////////////////////////////////////////////////////////////////