Mercurial > hg > easyhg
diff grapher.cpp @ 55:261bfb9481fe
* Make changeset item boxes wider if they have no neighbours.
Changeset item code is horrible -- items generally need
refactoring to take out hardcoded dimensions.
author | Chris Cannam |
---|---|
date | Fri, 12 Nov 2010 17:30:53 +0000 |
parents | 3c46b2ac45d3 |
children | f583e44d9d31 |
line wrap: on
line diff
--- a/grapher.cpp Fri Nov 12 17:04:36 2010 +0000 +++ b/grapher.cpp Fri Nov 12 17:30:53 2010 +0000 @@ -186,8 +186,9 @@ if (!m_changesets.contains(childId)) continue; Changeset *child = m_changesets[childId]; int childRow = m_items[childId]->row(); - if (child->parents().size() > 1 || child->branch() == cs->branch()) { - for (int r = row; r > childRow; --r) { + if (child->parents().size() > 1 || + child->branch() == cs->branch()) { + for (int r = row-1; r > childRow; --r) { m_alloc[r].insert(col); } } @@ -211,9 +212,8 @@ for (int i = 0; i < 2; ++i) { int off = i * 2 - 1; // 0 -> -1, 1 -> 1 ChangesetItem *it = m_items[special[i]]; - m_alloc[it->row()].insert(col); // avoid our column it->setColumn(findAvailableColumn(it->row(), col + off, true)); - for (int r = row; r >= it->row(); --r) { + for (int r = row-1; r >= it->row(); --r) { m_alloc[r].insert(it->column()); } m_handled.insert(special[i]); @@ -384,6 +384,14 @@ layoutCol(cs->id()); } + foreach (Changeset *cs, csets) { + ChangesetItem *item = m_items[cs->id()]; + if (!m_alloc[item->row()].contains(item->column()-1) && + !m_alloc[item->row()].contains(item->column()+1)) { + item->setWide(true); + } + } + // we know that 0 is an upper bound on row, and that mincol must // be <= 0 and maxcol >= 0, so these initial values are good int minrow = 0, maxrow = 0;