Feature #800
- Added feature #800, adding a new command 'columns' that lists all the columns available for custom reports, and includes their formatting options (thanks to T. Charles Yun).
This commit is contained in:
@@ -39,8 +39,14 @@ ColumnUrgency::ColumnUrgency ()
|
||||
{
|
||||
_name = "urgency";
|
||||
_type = "number";
|
||||
_style = "default";
|
||||
_style = "real";
|
||||
_label = STRING_COLUMN_LABEL_URGENCY;
|
||||
|
||||
_styles.push_back ("real");
|
||||
_styles.push_back ("integer");
|
||||
|
||||
_examples.push_back ("4.6");
|
||||
_examples.push_back ("4");
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -52,9 +58,17 @@ ColumnUrgency::~ColumnUrgency ()
|
||||
// Set the minimum and maximum widths for the value.
|
||||
void ColumnUrgency::measure (Task& task, int& minimum, int& maximum)
|
||||
{
|
||||
minimum = maximum = format (task.urgency (), 4, 3).length ();
|
||||
if (_style == "default" ||
|
||||
_style == "real")
|
||||
{
|
||||
minimum = maximum = format (task.urgency (), 4, 3).length ();
|
||||
}
|
||||
else if (_style == "integer")
|
||||
{
|
||||
minimum = maximum = format ((int)task.urgency ()).length ();
|
||||
}
|
||||
|
||||
if (_style != "default")
|
||||
else
|
||||
throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);
|
||||
}
|
||||
|
||||
@@ -65,10 +79,21 @@ void ColumnUrgency::render (
|
||||
int width,
|
||||
Color& color)
|
||||
{
|
||||
lines.push_back (
|
||||
color.colorize (
|
||||
rightJustify (
|
||||
format (task.urgency (), 4, 3), width)));
|
||||
if (_style == "default" ||
|
||||
_style == "real")
|
||||
{
|
||||
lines.push_back (
|
||||
color.colorize (
|
||||
rightJustify (
|
||||
format (task.urgency (), 4, 3), width)));
|
||||
}
|
||||
else if (_style == "integer")
|
||||
{
|
||||
lines.push_back (
|
||||
color.colorize (
|
||||
rightJustify (
|
||||
format ((int)task.urgency ()), width)));
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user