- Integrated ViewTask and ViewText completely.
- Obsoleted Table.{h,cpp}, Grid.{h,cpp}, grid.t.cpp
- Fixed ViewTask rendering bug that caused the full width to be used every time.
This commit is contained in:
Paul Beckingham 2011-05-13 01:10:30 -04:00
parent c8c7e02bc8
commit 6fb3bc5b03
14 changed files with 208 additions and 2002 deletions

View file

@ -111,13 +111,18 @@ std::string ViewTask::render (std::vector <Task>& data, std::vector <int>& seque
int global_min = utf8_length ((*i)->getLabel ());
int global_ideal = global_min;
std::vector <Task>::iterator d;
for (d = data.begin (); d != data.end (); ++d)
for (int s = 0; s < sequence.size (); ++s)
{
if (s >= _truncate_lines && _truncate_lines != 0)
break;
if (s >= _truncate_rows && _truncate_rows != 0)
break;
// Determine minimum and ideal width for this column.
int min;
int ideal;
(*i)->measure (*d, min, ideal);
(*i)->measure (data[sequence[s]], min, ideal);
if (min > global_min) global_min = min;
if (ideal > global_ideal) global_ideal = ideal;
@ -162,14 +167,17 @@ std::string ViewTask::render (std::vector <Task>& data, std::vector <int>& seque
overage -= sum_minimal;
// Spread 'overage' among columns where width[i] < ideal[i]
while (overage)
bool needed = true;
while (overage && needed)
{
needed = false;
for (int i = 0; i < _columns.size () && overage; ++i)
{
if (widths[i] < ideal[i])
{
++widths[i];
--overage;
needed = true;
}
}
}