diff --git a/compile.sh b/compile.sh index 60b6070..6a9f9f0 100755 --- a/compile.sh +++ b/compile.sh @@ -1,5 +1,7 @@ #!/bin/dash +mkdir -p bin/release + language=' -std=gnu++20 -fno-rtti diff --git a/compile_debug.sh b/compile_debug.sh index f7acc73..7b55053 100755 --- a/compile_debug.sh +++ b/compile_debug.sh @@ -1 +1,5 @@ +#!/bin/dash + +mkdir -p bin/debug + g++ -o bin/debug/famt -std=gnu++20 -g -O0 *.cpp -lncursesw diff --git a/main.cpp b/main.cpp index bc83580..b0fb558 100644 --- a/main.cpp +++ b/main.cpp @@ -55,7 +55,7 @@ int main() /* (test1 + test2).display(); */ test1 += test2; test1.display(); - test1.display(); + /* test1.display(); */ /* test1.saveTree(); */ diff --git a/todo.txt b/todo.txt index e90c6bf..13f749a 100644 --- a/todo.txt +++ b/todo.txt @@ -3,6 +3,10 @@ Help addPerson add siblings (add relation improve) +findRelative + +findRelation - extend + Draw distinct regions of a tree Draw spouses' relatives if main has none @@ -21,3 +25,6 @@ Compilation ? - same person can be present twice +Backend +- move to SQLlite +- backup diff --git a/tree.cpp b/tree.cpp index b1f8acf..9ee8046 100644 --- a/tree.cpp +++ b/tree.cpp @@ -200,6 +200,17 @@ person_id Tree::findParent(person_id child, bool isParentMale) const return parent; } +std::vector Tree::findChildren(person_id person) const +{ + vector children; + for(const Relation& rel: relations[person]) + { + if (rel.type == Parent) + children.push_back(rel.id); + } + return children; +} + person_id Tree::findSpouse(person_id person) const { person_id spouse = Nobody; @@ -215,16 +226,16 @@ person_id Tree::findSpouse(person_id person) const } -/* person_id Tree::findRelation(person_id first, person_id second) const */ -/* { */ -/* const auto& curRels = relations[first]; */ -/* for(auto i =0; i findChildren(person_id person) const; void saveTree()const;// bool loadTree(); @@ -74,6 +86,8 @@ private: void selectUp(); void selectRight(); + void selectLeftSibSpouse(person_id person); + void selectRightSib(person_id person); std::string treeName = "Unnamed"; unsigned numPeople = 0; @@ -82,21 +96,10 @@ private: person_id focused_ = 0; /* the tree was draw based on this person */ person_id selected_ = 0; - U16 offset_ = 0; /* offset of the tree */ + I16 offsetX_ = 0; /* offset of the tree in relation to the screen*/ + I16 offsetY_ = 0; U8 dist_between_ = 1; /* distance between people */ U8 spouse_dist_ = 0; /* distance between spouses */ //Search, ect. }; -enum RelType : U8 -{ - None = 0, - Parent, - Child, - Sibling, - HalfSibling, - Spouse, - ExSpouse, - - Other -};