up down select and focus
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
#include "person.h"
|
||||
|
||||
using person_id = U32;
|
||||
enum RelType : U8;
|
||||
enum RelType: U8;
|
||||
|
||||
struct Relation
|
||||
{
|
||||
@@ -13,7 +13,9 @@ struct Relation
|
||||
RelType type;
|
||||
};
|
||||
|
||||
static constexpr person_id Nobody = UINT_MAX;
|
||||
enum: person_id {
|
||||
Nobody = UINT_MAX
|
||||
};
|
||||
|
||||
class Tree
|
||||
{
|
||||
@@ -31,9 +33,10 @@ public:
|
||||
|
||||
void rename(const char* newName);
|
||||
|
||||
person_id findId(const char*, short year=0, const unsigned char month=0, const unsigned char day=0)const;
|
||||
person_id findOldestAncestor(person_id id, bool sex = 0)const;//
|
||||
person_id findCommonAncestor(person_id firstId, person_id secondId)const; //oldest common ancestor ID
|
||||
person_id findId(const char*, short year=0, const unsigned char month=0, const unsigned char day=0) const;
|
||||
person_id findOldestAncestor(person_id id, bool sex = 0) const;//
|
||||
person_id findCommonAncestor(person_id firstId, person_id secondId) const; //oldest common ancestor ID
|
||||
person_id findRelation(person_id first, person_id second) const;
|
||||
|
||||
void saveTree()const;//
|
||||
bool loadTree();
|
||||
@@ -47,7 +50,7 @@ public:
|
||||
void removeRelation(person_id firstId, person_id secondId);
|
||||
void removeRelation(const char* firstName, const char* secondName);
|
||||
|
||||
void draw(person_id focused=0) const;
|
||||
void display();
|
||||
|
||||
void print()const;
|
||||
void printRel(person_id id)const; //Prints out close relatives
|
||||
@@ -56,29 +59,41 @@ public:
|
||||
|
||||
private:
|
||||
void commonAncestorRec(person_id id, const Array<char> &visited)const;
|
||||
|
||||
void draw() const;
|
||||
/* draw a line of people starting from person with id
|
||||
return the farthest X that will be drawn */
|
||||
I16 drawLine(person_id id, I16 drawY, I16 drawX) const;
|
||||
I16 drawLineWithWives(person_id id, I16 drawY, I16 drawX) const;
|
||||
|
||||
void selectLeft();
|
||||
void selectDown();
|
||||
void selectUp();
|
||||
void selectRight();
|
||||
|
||||
|
||||
std::string treeName = "Unnamed";
|
||||
unsigned numPeople = 0;
|
||||
Array<Person> people; //The data for each member
|
||||
Array<Array<Relation>> relations; //The relatives of each member
|
||||
|
||||
U16 offset = 0;
|
||||
U8 dist_between = 1;
|
||||
U8 spouse_dist = 0;
|
||||
person_id focused_ = 0; /* the tree was draw based on this person */
|
||||
person_id selected_ = 0;
|
||||
U16 offset_ = 0; /* offset of the tree */
|
||||
U8 dist_between_ = 1; /* distance between people */
|
||||
U8 spouse_dist_ = 0; /* distance between spouses */
|
||||
//Search, ect.
|
||||
};
|
||||
|
||||
enum RelType : U8
|
||||
{
|
||||
Invalid = 0,
|
||||
None = 0,
|
||||
Parent,
|
||||
Child,
|
||||
Sibling,
|
||||
HalfSibling,
|
||||
Spouse,
|
||||
ExSpouse
|
||||
ExSpouse,
|
||||
|
||||
Other
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user