- Implemented start.active.
This commit is contained in:
Paul Beckingham 2011-05-02 22:53:47 -04:00
parent 27752bd510
commit f9ab8f2a1c
5 changed files with 61 additions and 21 deletions

View file

@ -102,9 +102,6 @@ void ColumnDate::measure (Task& task, int& minimum, int& maximum)
else if (_style == "short")
{
}
else if (_style == "active")
{
}
else if (_style == "countdown")
{
}

View file

@ -91,23 +91,6 @@ void ColumnRecur::render (
color.colorize (
rightJustify (context.config.get ("recurrence.indicator").length (), width)));
}
/*
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);
}
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)));
*/
}
////////////////////////////////////////////////////////////////////////////////

View file

@ -25,7 +25,11 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <Context.h>
#include <ColStart.h>
#include <text.h>
extern Context context;
////////////////////////////////////////////////////////////////////////////////
ColumnStart::ColumnStart ()
@ -40,3 +44,51 @@ ColumnStart::~ColumnStart ()
}
////////////////////////////////////////////////////////////////////////////////
// Overriden so that style <----> label are linked.
// Note that you can not determine which gets called first.
void ColumnStart::setStyle (const std::string& value)
{
_style = value;
if (_style == "active" && _label == "Started")
_label = "A";
}
////////////////////////////////////////////////////////////////////////////////
// Set the minimum and maximum widths for the value.
void ColumnStart::measure (Task& task, int& minimum, int& maximum)
{
minimum = maximum = 0;
if (task.has (_attribute))
{
if (_style == "active")
{
}
else
ColumnDate::measure (task, minimum, maximum);
}
}
////////////////////////////////////////////////////////////////////////////////
void ColumnStart::render (
std::vector <std::string>& lines,
Task& task,
int width,
Color& color)
{
if (task.has (_attribute))
{
if (_style == "active")
{
lines.push_back (
color.colorize (
rightJustify (
context.config.get ("active.indicator"), width)));
}
else
ColumnDate::render (lines, task, width, color);
}
}
////////////////////////////////////////////////////////////////////////////////

View file

@ -34,6 +34,10 @@ class ColumnStart : public ColumnDate
public:
ColumnStart ();
~ColumnStart ();
void setStyle (const std::string&);
void measure (Task&, int&, int&);
void render (std::vector <std::string>&, Task&, int, Color&);
};
#endif