Merge branch 'recurrence' into 2.6.0

This commit is contained in:
Paul Beckingham
2017-01-07 12:29:11 -05:00
65 changed files with 652 additions and 484 deletions

View File

@@ -58,7 +58,7 @@ ColumnDepends::ColumnDepends ()
// Note that you can not determine which gets called first.
void ColumnDepends::setStyle (const std::string& value)
{
_style = value;
Column::setStyle (value);
if (_style == "indicator" && _label == STRING_COLUMN_LABEL_DEP) _label = _label.substr (0, context.config.get ("dependency.indicator").length ());
else if (_style == "count" && _label == STRING_COLUMN_LABEL_DEP) _label = STRING_COLUMN_LABEL_DEP_S;
@@ -68,26 +68,25 @@ void ColumnDepends::setStyle (const std::string& value)
// Set the minimum and maximum widths for the value.
void ColumnDepends::measure (Task& task, unsigned int& minimum, unsigned int& maximum)
{
std::vector <Task> blocking;
dependencyGetBlocking (task, blocking);
if (_style == "indicator")
minimum = maximum = 0;
if (task.has (_name))
{
if (task.has ("depends"))
minimum = maximum = utf8_width (context.config.get ("dependency.indicator"));
else
minimum = maximum = 0;
}
else if (_style == "count")
{
minimum = maximum = 2 + format ((int) blocking.size ()).length ();
}
else if (_style == "default" ||
_style == "list")
{
minimum = maximum = 0;
if (task.has ("depends"))
if (_style == "indicator")
{
minimum = maximum = utf8_width (context.config.get ("dependency.indicator"));
}
else if (_style == "count")
{
minimum = maximum = 2 + format ((int) dependencyGetBlocking (task).size ()).length ();
}
else if (_style == "default" ||
_style == "list")
{
minimum = maximum = 0;
auto blocking = dependencyGetBlocking (task);
std::vector <int> blocking_ids;
for (auto& i : blocking)
blocking_ids.push_back (i.id);
@@ -104,8 +103,6 @@ void ColumnDepends::measure (Task& task, unsigned int& minimum, unsigned int& ma
}
}
}
else
throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);
}
////////////////////////////////////////////////////////////////////////////////
@@ -118,30 +115,31 @@ void ColumnDepends::render (
if (task.has (_name))
{
if (_style == "indicator")
renderStringRight (lines, width, color, context.config.get ("dependency.indicator"));
else
{
std::vector <Task> blocking;
dependencyGetBlocking (task, blocking);
renderStringRight (lines, width, color, context.config.get ("dependency.indicator"));
}
if (_style == "count")
renderStringRight (lines, width, color, '[' + format (static_cast <int>(blocking.size ())) + ']');
else if (_style == "count")
{
renderStringRight (lines, width, color, '[' + format (static_cast <int>(dependencyGetBlocking (task).size ())) + ']');
}
else if (_style == "default" ||
_style == "list")
{
std::vector <int> blocking_ids;
for (const auto& t : blocking)
blocking_ids.push_back (t.id);
else if (_style == "default" ||
_style == "list")
{
auto blocking = dependencyGetBlocking (task);
auto combined = join (" ", blocking_ids);
std::vector <int> blocking_ids;
for (const auto& t : blocking)
blocking_ids.push_back (t.id);
std::vector <std::string> all;
wrapText (all, combined, width, _hyphenate);
auto combined = join (" ", blocking_ids);
for (const auto& i : all)
renderStringLeft (lines, width, color, i);
}
std::vector <std::string> all;
wrapText (all, combined, width, _hyphenate);
for (const auto& i : all)
renderStringLeft (lines, width, color, i);
}
}
}