ColUrgency: Now uses Column::render{Integer,Double}

This commit is contained in:
Paul Beckingham 2015-10-31 15:24:03 -04:00
parent 4c55b8c9af
commit 43e4f8a485

View file

@ -51,15 +51,11 @@ ColumnUrgency::~ColumnUrgency ()
// Set the minimum and maximum widths for the value. // Set the minimum and maximum widths for the value.
void ColumnUrgency::measure (Task& task, unsigned int& minimum, unsigned int& maximum) void ColumnUrgency::measure (Task& task, unsigned int& minimum, unsigned int& maximum)
{ {
if (_style == "default" || if (_style == "default" || _style == "real")
_style == "real")
{
minimum = maximum = format (task.urgency (), 4, 3).length (); minimum = maximum = format (task.urgency (), 4, 3).length ();
}
else if (_style == "integer") else if (_style == "integer")
{
minimum = maximum = format ((int)task.urgency ()).length (); minimum = maximum = format ((int)task.urgency ()).length ();
}
else else
throw format (STRING_COLUMN_BAD_FORMAT, _name, _style); throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);
@ -72,21 +68,11 @@ void ColumnUrgency::render (
int width, int width,
Color& color) Color& color)
{ {
if (_style == "default" || if (_style == "default" || _style == "real")
_style == "real") renderDouble (lines, width, color, task.urgency ());
{
lines.push_back (
color.colorize (
rightJustify (
format (task.urgency (), 4, 3), width)));
}
else if (_style == "integer") else if (_style == "integer")
{ renderInteger (lines, width, color, static_cast <int> (task.urgency ()));
lines.push_back (
color.colorize (
rightJustify (
format ((int)task.urgency ()), width)));
}
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////