- Added new 'indented' format for the 'project' attribute.  Note that
  this is really only useful when a report is sorted by project.
This commit is contained in:
Paul Beckingham 2012-03-25 17:57:55 -04:00
parent 95e36d1145
commit 17c605502c
3 changed files with 21 additions and 3 deletions

View file

@ -30,6 +30,7 @@
#include <Context.h>
#include <ColProject.h>
#include <text.h>
#include <util.h>
#include <i18n.h>
extern Context context;
@ -44,9 +45,11 @@ ColumnProject::ColumnProject ()
_styles.push_back ("full");
_styles.push_back ("parent");
_styles.push_back ("indented");
_examples.push_back (STRING_COLUMN_EXAMPLES_PROJ);
_examples.push_back (STRING_COLUMN_EXAMPLES_PAR);
_examples.push_back (STRING_COLUMN_EXAMPLES_IND);
_hyphenate = context.config.getBoolean ("hyphenate");
}
@ -74,8 +77,13 @@ void ColumnProject::measure (Task& task, int& minimum, int& maximum)
if (period != std::string::npos)
project = project.substr (0, period);
}
else if (_style != "default" &&
_style != "full")
else if (_style == "indented")
{
project = indentProject (project, " ", '.');
}
else if (_style != "default" &&
_style != "full" &&
_style != "indented")
throw format (STRING_COLUMN_BAD_FORMAT, _name, _style);
minimum = longestWord (project);
@ -96,6 +104,10 @@ void ColumnProject::render (
if (period != std::string::npos)
project = project.substr (0, period);
}
else if (_style == "indented")
{
project = indentProject (project, " ", '.');
}
std::vector <std::string> raw;
wrapText (raw, project, width, _hyphenate);

View file

@ -187,6 +187,7 @@
#define STRING_COLUMN_EXAMPLES_TAGS "home @chore"
#define STRING_COLUMN_EXAMPLES_PROJ "home.garden"
#define STRING_COLUMN_EXAMPLES_PAR "home"
#define STRING_COLUMN_EXAMPLES_IND " home.garden"
#define STRING_COLUMN_EXAMPLES_DESC "Move your clothes down on to the lower peg"
#define STRING_COLUMN_EXAMPLES_ANNO1 "Immediately before your lunch"
#define STRING_COLUMN_EXAMPLES_ANNO2 "If you are playing in the match this afternoon"