View
- Fixed problem with incorrect Color vector addressing. - Modified ViewText to not underline empty column headers. - Implemented ViewText::set method to set only color.
This commit is contained in:
@@ -163,7 +163,8 @@ std::string ViewTask::render (std::vector <Task>& data, std::vector <int>& seque
|
|||||||
if (_width == 0 || sum_ideal <= overage)
|
if (_width == 0 || sum_ideal <= overage)
|
||||||
widths = ideal;
|
widths = ideal;
|
||||||
else if (sum_minimal > overage)
|
else if (sum_minimal > overage)
|
||||||
throw std::string ("There is not enough horizontal width to display the results.");
|
// throw std::string ("There is not enough horizontal width to display the results.");
|
||||||
|
widths = minimal;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
widths = minimal;
|
widths = minimal;
|
||||||
@@ -221,7 +222,7 @@ std::string ViewTask::render (std::vector <Task>& data, std::vector <int>& seque
|
|||||||
if (c)
|
if (c)
|
||||||
out += intra;
|
out += intra;
|
||||||
|
|
||||||
if (headers[i].size () < max_lines - i)
|
if (headers[c].size () < max_lines - i)
|
||||||
out += _header.colorize (std::string (widths[c], ' '));
|
out += _header.colorize (std::string (widths[c], ' '));
|
||||||
else
|
else
|
||||||
out += headers[c][i];
|
out += headers[c][i];
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ void ViewText::set (int row, int col, const std::string& value, Color color)
|
|||||||
_data[row][col] = value;
|
_data[row][col] = value;
|
||||||
|
|
||||||
if (color.nontrivial () &&
|
if (color.nontrivial () &&
|
||||||
! context.color ())
|
context.color ())
|
||||||
_color[row][col] = color;
|
_color[row][col] = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,7 +79,7 @@ void ViewText::set (int row, int col, int value, Color color)
|
|||||||
_data[row][col] = string_value;
|
_data[row][col] = string_value;
|
||||||
|
|
||||||
if (color.nontrivial () &&
|
if (color.nontrivial () &&
|
||||||
! context.color ())
|
context.color ())
|
||||||
_color[row][col] = color;
|
_color[row][col] = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,7 +90,15 @@ void ViewText::set (int row, int col, float value, int width, int precision, Col
|
|||||||
_data[row][col] = string_value;
|
_data[row][col] = string_value;
|
||||||
|
|
||||||
if (color.nontrivial () &&
|
if (color.nontrivial () &&
|
||||||
! context.color ())
|
context.color ())
|
||||||
|
_color[row][col] = color;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
void ViewText::set (int row, int col, Color color)
|
||||||
|
{
|
||||||
|
if (color.nontrivial () &&
|
||||||
|
context.color ())
|
||||||
_color[row][col] = color;
|
_color[row][col] = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -144,7 +152,8 @@ std::string ViewText::render ()
|
|||||||
if (sum_ideal <= overage)
|
if (sum_ideal <= overage)
|
||||||
widths = ideal;
|
widths = ideal;
|
||||||
else if (sum_minimal > overage)
|
else if (sum_minimal > overage)
|
||||||
throw std::string ("There is not enough horizontal width to display the results.");
|
// throw std::string ("There is not enough horizontal width to display the results.");
|
||||||
|
widths = minimal;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
widths = minimal;
|
widths = minimal;
|
||||||
@@ -199,7 +208,7 @@ std::string ViewText::render ()
|
|||||||
if (c)
|
if (c)
|
||||||
out += intra;
|
out += intra;
|
||||||
|
|
||||||
if (headers[i].size () < max_lines - i)
|
if (headers[c].size () < max_lines - i)
|
||||||
out += _header.colorize (std::string (widths[c], ' '));
|
out += _header.colorize (std::string (widths[c], ' '));
|
||||||
else
|
else
|
||||||
out += headers[c][i];
|
out += headers[c][i];
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ public:
|
|||||||
void set (int, int, const std::string&, Color color = Color::nocolor);
|
void set (int, int, const std::string&, Color color = Color::nocolor);
|
||||||
void set (int, int, int, Color color = Color::nocolor);
|
void set (int, int, int, Color color = Color::nocolor);
|
||||||
void set (int, int, float, int, int, Color color = Color::nocolor);
|
void set (int, int, float, int, int, Color color = Color::nocolor);
|
||||||
|
void set (int, int, Color);
|
||||||
|
|
||||||
// View rendering.
|
// View rendering.
|
||||||
std::string render ();
|
std::string render ();
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ void Column::renderHeader (
|
|||||||
Color& color)
|
Color& color)
|
||||||
{
|
{
|
||||||
if (context.verbose ("label") &&
|
if (context.verbose ("label") &&
|
||||||
_label != "")
|
nontrivial (_label))
|
||||||
{
|
{
|
||||||
// Create a basic label.
|
// Create a basic label.
|
||||||
std::string header;
|
std::string header;
|
||||||
|
|||||||
@@ -928,25 +928,25 @@ std::string renderMonths (
|
|||||||
{
|
{
|
||||||
if (weekStart == 1)
|
if (weekStart == 1)
|
||||||
{
|
{
|
||||||
view.add (Column::factory ("string", " "));
|
view.add (Column::factory ("string.right", " "));
|
||||||
view.add (Column::factory ("string", "Mo"));
|
view.add (Column::factory ("string.right", "Mo"));
|
||||||
view.add (Column::factory ("string", "Tu"));
|
view.add (Column::factory ("string.right", "Tu"));
|
||||||
view.add (Column::factory ("string", "We"));
|
view.add (Column::factory ("string.right", "We"));
|
||||||
view.add (Column::factory ("string", "Th"));
|
view.add (Column::factory ("string.right", "Th"));
|
||||||
view.add (Column::factory ("string", "Fr"));
|
view.add (Column::factory ("string.right", "Fr"));
|
||||||
view.add (Column::factory ("string", "Sa"));
|
view.add (Column::factory ("string.right", "Sa"));
|
||||||
view.add (Column::factory ("string", "Su"));
|
view.add (Column::factory ("string.right", "Su"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
view.add (Column::factory ("string", " "));
|
view.add (Column::factory ("string.right", " "));
|
||||||
view.add (Column::factory ("string", "Su"));
|
view.add (Column::factory ("string.right", "Su"));
|
||||||
view.add (Column::factory ("string", "Mo"));
|
view.add (Column::factory ("string.right", "Mo"));
|
||||||
view.add (Column::factory ("string", "Tu"));
|
view.add (Column::factory ("string.right", "Tu"));
|
||||||
view.add (Column::factory ("string", "We"));
|
view.add (Column::factory ("string.right", "We"));
|
||||||
view.add (Column::factory ("string", "Th"));
|
view.add (Column::factory ("string.right", "Th"));
|
||||||
view.add (Column::factory ("string", "Fr"));
|
view.add (Column::factory ("string.right", "Fr"));
|
||||||
view.add (Column::factory ("string", "Sa"));
|
view.add (Column::factory ("string.right", "Sa"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1087,8 +1087,8 @@ std::string renderMonths (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// TODO Solve this.
|
|
||||||
// table.setCellColor (row, thisCol, cellColor);
|
view.set (row, thisCol, cellColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for end of week, and...
|
// Check for end of week, and...
|
||||||
|
|||||||
Reference in New Issue
Block a user