diff --git a/main.cpp b/main.cpp index b59e1bf..f4dd12e 100644 --- a/main.cpp +++ b/main.cpp @@ -34,10 +34,6 @@ int main() /* test1.addRelation(0, Spouse, 1); */ /* test1.addPerson("Venelin", true, 0, 1, {1998, 6, 9}); */ /* test1.addPerson("Vasil", true, 0, 1, {2001, 1, 16}); */ - /* test1.addRelation(2, Brother, 3); */ - /* test1.addPerson("Maria-Veronika", 2009, 9, 3, 1, 0, 1); */ - /* test1.addRelation(2, Brother, 4); */ - /* test1.addRelation(3, Brother, 4); */ test1.saveToFile(); test2.addPerson("Vasil Dimitrov", true, Nobody, Nobody, {1941, 5, 18}); @@ -45,12 +41,10 @@ int main() test2.addRelation(0, Spouse, 1); test2.addPerson("Dimitar", true, 0, 1); test2.addPerson("Nadejda", false, 0, 1, {1972, 12, 15}); - /* test2.addRelation(2, Brother, 3); */ test2.addPerson("Branimira", false); - test2.addRelation(2, Spouse, 4); + test2.addRelation(2, Spouse, 4); test2.addPerson("Ioan", true, 2, 4); test2.addPerson("Rumiana", false, 2, 4); - /* test2.addRelation(5, Brother, 6); */ test1.display(); test2.display(); diff --git a/person.cpp b/person.cpp index 74afb71..d91ec3f 100644 --- a/person.cpp +++ b/person.cpp @@ -8,7 +8,7 @@ using std::cout; -WINDOW* info_tab; +static WINDOW* info_tab; EventTime::EventTime(I16 Year, U8 Month, U16 Day, I8 Hour, I8 Minute) : year(Year) diff --git a/todo.txt b/todo.txt index 2225f87..ba93c62 100644 --- a/todo.txt +++ b/todo.txt @@ -14,6 +14,7 @@ Visualization: - horizontal navigation between cousins - color on different consoles - screen resize +- empty tree Compilation - static and dynamic ncurses diff --git a/tree.cpp b/tree.cpp index 51b9be6..3b866a4 100644 --- a/tree.cpp +++ b/tree.cpp @@ -375,6 +375,26 @@ void Tree::removeRelation(const unsigned first, const unsigned second) } } +static void displayHelp() +{ + WINDOW* help_tab = newwin(LINES, COLS, 0, 0); + + printw("%s\n", "Enter - focus the currently selected person", + "Arrow keys - move the camera", + "H, J, K, L - move the selection", + "I - display info about the selected person"); + + mvwaddstr(help_tab, LINES-1, 0, "Press any key to return."); + + wrefresh(help_tab); + getch(); /* waint press */ + + werase(help_tab); + wrefresh(help_tab); /* todo: dont update */ + delwin(help_tab); + +} + void Tree::display() { draw(); @@ -386,6 +406,9 @@ void Tree::display() switch(c) { + case KEY_F(1): + displayHelp(); + break; case '\n': focused_ = selected_; draw();