diff --git a/src/columns/ColDate.cpp b/src/columns/ColDate.cpp index f536ba290..bb80efafb 100644 --- a/src/columns/ColDate.cpp +++ b/src/columns/ColDate.cpp @@ -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") { } diff --git a/src/columns/ColRecur.cpp b/src/columns/ColRecur.cpp index 113f168c2..e441efe9e 100644 --- a/src/columns/ColRecur.cpp +++ b/src/columns/ColRecur.cpp @@ -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 raw; - wrapText (raw, project, width); - - std::vector ::iterator i; - for (i = raw.begin (); i != raw.end (); ++i) - lines.push_back (color.colorize (leftJustify (*i, width))); -*/ } //////////////////////////////////////////////////////////////////////////////// diff --git a/src/columns/ColStart.cpp b/src/columns/ColStart.cpp index 74ba2773b..f7e0e223d 100644 --- a/src/columns/ColStart.cpp +++ b/src/columns/ColStart.cpp @@ -25,7 +25,11 @@ // //////////////////////////////////////////////////////////////////////////////// +#include #include +#include + +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 & 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); + } +} + +//////////////////////////////////////////////////////////////////////////////// diff --git a/src/columns/ColStart.h b/src/columns/ColStart.h index c9cf0ae2d..6f133fb7d 100644 --- a/src/columns/ColStart.h +++ b/src/columns/ColStart.h @@ -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 &, Task&, int, Color&); }; #endif diff --git a/test/view.t.cpp b/test/view.t.cpp index 5eede7130..942a60c92 100644 --- a/test/view.t.cpp +++ b/test/view.t.cpp @@ -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);