comparison grapher.cpp @ 51:bf3ab0ffb559

* some preliminaries for thinking about use of date in row layout
author Chris Cannam
date Thu, 11 Nov 2010 22:27:24 +0000
parents f9b53c10a3f6
children 384420567575
comparison
equal deleted inserted replaced
50:c76782c14371 51:bf3ab0ffb559
162 162
163 m_alloc[row].insert(col); 163 m_alloc[row].insert(col);
164 item->setColumn(col); 164 item->setColumn(col);
165 m_handled.insert(id); 165 m_handled.insert(id);
166 166
167 // Normally the children will lay out themselves, but we can do
168 // a better job in some special cases:
169
167 int nchildren = cs->children().size(); 170 int nchildren = cs->children().size();
168 171
169 // look for merging children and make sure nobody 172 // look for merging children and make sure nobody
170 // is going to overwrite their "merge lines" 173 // is going to overwrite their "merge lines" if they extend further
174 // than a single step
175
171 foreach (QString childId, cs->children()) { 176 foreach (QString childId, cs->children()) {
172 if (!m_changesets.contains(childId)) continue; 177 if (!m_changesets.contains(childId)) continue;
173 Changeset *child = m_changesets[childId]; 178 Changeset *child = m_changesets[childId];
174 if (child->parents().size() > 1) { 179 if (child->parents().size() > 1) {
175 int childRow = m_items[childId]->row(); 180 int childRow = m_items[childId]->row();
176 std::cerr << "I'm at " << row << ", child with >1 parents is at " << childRow << std::endl; 181 std::cerr << "I'm at " << row << ", child with >1 parents is at " << childRow << std::endl;
177 for (int r = row; r >= childRow; --r) { 182 for (int r = row; r > childRow; --r) {
178 std::cerr << "setting row " << r << ", col " << col << std::endl; 183 std::cerr << "setting row " << r << ", col " << col << std::endl;
179 m_alloc[r].insert(col); 184 m_alloc[r].insert(col);
180 } 185 }
181 } 186 }
182 } 187 }
183 188
189 // look for the case where exactly two children have the same
190 // branch as us: split them to a little either side of our position
191
184 if (nchildren > 1) { 192 if (nchildren > 1) {
185 // Normally the children will lay out themselves. We just 193
186 // want to handle the case where exactly two children have the
187 // same branch as us, because we can handle that neatly
188 QList<QString> special; 194 QList<QString> special;
189 foreach (QString childId, cs->children()) { 195 foreach (QString childId, cs->children()) {
190 if (!m_changesets.contains(childId)) continue; 196 if (!m_changesets.contains(childId)) continue;
191 Changeset *child = m_changesets[childId]; 197 Changeset *child = m_changesets[childId];
192 if (child->branch() == branch && 198 if (child->branch() == branch &&
310 316
311 // Layout in reverse order, i.e. forward chronological order. 317 // Layout in reverse order, i.e. forward chronological order.
312 // This ensures that parents will normally be laid out before 318 // This ensures that parents will normally be laid out before
313 // their children -- though we can recurse from layout() if we 319 // their children -- though we can recurse from layout() if we
314 // find any weird exceptions 320 // find any weird exceptions
321
322 //!!! changesets are not in any chronological order, necessarily:
323 // we need to sort by datetime() [or, better, numerical date]
324 // and then use m_rowDateMap
325
315 m_handled.clear(); 326 m_handled.clear();
316 for (int i = csets.size() - 1; i >= 0; --i) { 327 for (int i = csets.size() - 1; i >= 0; --i) {
317 layoutRow(csets[i]->id()); 328 layoutRow(csets[i]->id());
318 } 329 }
319 330