- 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

View file

@ -55,6 +55,7 @@ int main (int argc, char** argv)
"description:\"This is the description text\" "
"project:\"Home\" "
"priority:\"H\" "
"start:\"1234567890\" "
"due:\"1234567890\" "
"tags:\"one,two\""
"]");
@ -92,6 +93,8 @@ int main (int argc, char** argv)
view.add (Column::factory ("tags"));
// view.add (Column::factory ("tags.indicator"));
view.add (Column::factory ("tags.count"));
// view.add (Column::factory ("description"));
// view.add (Column::factory ("description.desc"));
view.add (Column::factory ("description.truncated"));
// view.add (Column::factory ("depends"));
// view.add (Column::factory ("depends.count"));
@ -104,8 +107,9 @@ int main (int argc, char** argv)
view.add (Column::factory ("due.julian"));
// view.add (Column::factory ("due.epoch"));
// view.add (Column::factory ("due.iso"));
view.add (Column::factory ("start.active"));
view.add (Column::factory ("urgency"));
view.width (120);
view.width (100);
view.leftMargin (4);
/*
view.extraPadding (1);