move keyhandling from Tree
This commit is contained in:
+13
-23
@@ -34,17 +34,15 @@ public:
|
||||
Tree() = default;
|
||||
template <class Str>
|
||||
explicit Tree(Str&& Name) : treeName_(std::forward<Str>(Name)) {}
|
||||
/* Tree(const Tree&) = default; */
|
||||
/* Tree& operator= (const Tree& other); */
|
||||
|
||||
Tree operator+ (const Tree& other) const;
|
||||
Tree operator- (const Tree& other) const; /* todo */
|
||||
Tree& operator+= (const Tree& other);
|
||||
Tree& operator-= (const Tree& other);
|
||||
|
||||
void rename(const char* newName);
|
||||
|
||||
bool isEmpty();
|
||||
person_id last();
|
||||
|
||||
std::vector<person_id> findId(const std::string& name) const;
|
||||
person_id findId(const std::string& name, Sex) const;
|
||||
person_id findRootAncestor(person_id) const;
|
||||
@@ -53,6 +51,7 @@ public:
|
||||
//oldest common ancestor ID, a person is considerd an ancestor of himself
|
||||
person_id findCommonAncestor(person_id first, person_id second) const; /* needs to be fixed, never return nobody */
|
||||
RelType findRelation(person_id first, person_id second) const;
|
||||
const std::vector<Relation>& findRelations(person_id) const;
|
||||
person_id findParent(person_id child, Sex parentSex) const;
|
||||
person_id findSpouse(person_id person) const;
|
||||
std::vector<person_id> findChildren(person_id person) const;
|
||||
@@ -67,15 +66,16 @@ public:
|
||||
void removeRelation(person_id first, person_id second);
|
||||
void removeRelation(const char* firstName, const char* secondName);
|
||||
|
||||
/* display the tree and wait process key input */
|
||||
void display();
|
||||
/* draw the tree based on this person */
|
||||
void focusPerson(person_id);
|
||||
person_id focused() const;
|
||||
|
||||
void print()const;
|
||||
/* void printRel(person_id id)const; //Prints out close relatives */
|
||||
void printMember(person_id)const;
|
||||
void printOldestAncestors(person_id)const;//
|
||||
void draw(person_id selected, U8 zoom, I16 offsetY, I16 offsetX);
|
||||
|
||||
private:
|
||||
// recursion to find common ancestor
|
||||
void commonAncestorRec(person_id, std::vector<U8> &visited)const;
|
||||
|
||||
void addRelOneSide(person_id first, RelType, person_id second);
|
||||
@@ -83,30 +83,20 @@ private:
|
||||
(example adds siblings after parents are added) */
|
||||
void updateRels(person_id);
|
||||
|
||||
void draw() const;
|
||||
/* draw a line of people starting from person with id
|
||||
return the farthest X that will be drawn */
|
||||
I16 drawLineWithWives(person_id, I16 drawY, I16 drawX) const;
|
||||
|
||||
void selectLeft();
|
||||
void selectDown();
|
||||
void selectUp();
|
||||
void selectRight();
|
||||
|
||||
void selectLeftSibSpouse(person_id);
|
||||
void selectRightSib(person_id);
|
||||
|
||||
std::string treeName_;
|
||||
std::vector<Person> people_; //The data for each member
|
||||
std::vector<std::vector<Relation>> relations_; //The relatives of each member
|
||||
|
||||
// 0 is the first person in the tree
|
||||
person_id focused_ = 0; /* the tree was draw based on this person */
|
||||
person_id selected_ = 0;
|
||||
I16 offsetX_ = 0; /* offset of the tree in relation to the screen*/
|
||||
I16 offsetY_ = 0;
|
||||
U8 zoom_ = 0;
|
||||
U8 dist_between_ = 1; /* distance between people */
|
||||
U8 spouse_dist_ = 0; /* distance between spouses */
|
||||
//Search, ect.
|
||||
};
|
||||
|
||||
// todo: figure out what to do with these constants
|
||||
const U8 dist_between_ = 1; /* distance between people */
|
||||
const U8 spouse_dist_ = 0; /* distance between spouses */
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user