comparison grapher.h @ 145:644bd31e8301

* Include the uncommitted item in general graph layout (in case it is not at the head, when other items will need to avoid it)
author Chris Cannam
date Wed, 01 Dec 2010 17:41:14 +0000
parents 005a54380502
children 70fe12873106
comparison
equal deleted inserted replaced
143:f61f032b06f9 145:644bd31e8301
18 #ifndef GRAPHER_H 18 #ifndef GRAPHER_H
19 #define GRAPHER_H 19 #define GRAPHER_H
20 20
21 #include "changeset.h" 21 #include "changeset.h"
22 #include "changesetitem.h" 22 #include "changesetitem.h"
23 #include "uncommitteditem.h"
23 #include "changesetscene.h" 24 #include "changesetscene.h"
24 25
25 #include <QSet> 26 #include <QSet>
26 #include <QMap> 27 #include <QMap>
27 #include <QPair> 28 #include <QPair>
31 class Grapher 32 class Grapher
32 { 33 {
33 public: 34 public:
34 Grapher(ChangesetScene *scene) { m_scene = scene; } 35 Grapher(ChangesetScene *scene) { m_scene = scene; }
35 36
36 void layout(Changesets csets); 37 void layout(Changesets csets, QString uncommittedSproutsFrom = "");
37 38
38 ChangesetItem *getItemFor(Changeset *cs); 39 ChangesetItem *getItemFor(Changeset *cs);
40
41 UncommittedItem *getUncommittedItem() { return m_uncommitted; }
39 42
40 class LayoutException : public std::exception { 43 class LayoutException : public std::exception {
41 public: 44 public:
42 LayoutException(QString message) throw() : m_message(message) { } 45 LayoutException(QString message) throw() : m_message(message) { }
43 virtual ~LayoutException() throw() { } 46 virtual ~LayoutException() throw() { }
72 IdSet m_handled; 75 IdSet m_handled;
73 76
74 typedef QMap<int, QString> RowDateMap; 77 typedef QMap<int, QString> RowDateMap;
75 RowDateMap m_rowDates; 78 RowDateMap m_rowDates;
76 79
80 QString m_uncommittedParentId;
81 int m_uncommittedParentRow;
82 UncommittedItem *m_uncommitted;
83 bool m_haveAllocatedUncommittedColumn;
84
77 void layoutRow(QString id); 85 void layoutRow(QString id);
78 void layoutCol(QString id); 86 void layoutCol(QString id);
79 void allocateBranchHomes(Changesets csets); 87 void allocateBranchHomes(Changesets csets);
80 bool rangesConflict(const Range &r1, const Range &r2); 88 bool rangesConflict(const Range &r1, const Range &r2);
81 int findAvailableColumn(int row, int parent, bool preferParentCol); 89 int findAvailableColumn(int row, int parent, bool preferParentCol);
90 bool isAvailable(int row, int col);
82 }; 91 };
83 92
84 #endif 93 #endif