fix example

This commit is contained in:
vrd
2023-02-14 11:22:45 +02:00
parent e57affde26
commit f0290d21da
4 changed files with 26 additions and 8 deletions
-6
View File
@@ -34,10 +34,6 @@ int main()
/* test1.addRelation(0, Spouse, 1); */ /* test1.addRelation(0, Spouse, 1); */
/* test1.addPerson("Venelin", true, 0, 1, {1998, 6, 9}); */ /* test1.addPerson("Venelin", true, 0, 1, {1998, 6, 9}); */
/* test1.addPerson("Vasil", true, 0, 1, {2001, 1, 16}); */ /* 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(); test1.saveToFile();
test2.addPerson("Vasil Dimitrov", true, Nobody, Nobody, {1941, 5, 18}); test2.addPerson("Vasil Dimitrov", true, Nobody, Nobody, {1941, 5, 18});
@@ -45,12 +41,10 @@ int main()
test2.addRelation(0, Spouse, 1); test2.addRelation(0, Spouse, 1);
test2.addPerson("Dimitar", true, 0, 1); test2.addPerson("Dimitar", true, 0, 1);
test2.addPerson("Nadejda", false, 0, 1, {1972, 12, 15}); test2.addPerson("Nadejda", false, 0, 1, {1972, 12, 15});
/* test2.addRelation(2, Brother, 3); */
test2.addPerson("Branimira", false); test2.addPerson("Branimira", false);
test2.addRelation(2, Spouse, 4); test2.addRelation(2, Spouse, 4);
test2.addPerson("Ioan", true, 2, 4); test2.addPerson("Ioan", true, 2, 4);
test2.addPerson("Rumiana", false, 2, 4); test2.addPerson("Rumiana", false, 2, 4);
/* test2.addRelation(5, Brother, 6); */
test1.display(); test1.display();
test2.display(); test2.display();
+1 -1
View File
@@ -8,7 +8,7 @@
using std::cout; using std::cout;
WINDOW* info_tab; static WINDOW* info_tab;
EventTime::EventTime(I16 Year, U8 Month, U16 Day, I8 Hour, I8 Minute) EventTime::EventTime(I16 Year, U8 Month, U16 Day, I8 Hour, I8 Minute)
: year(Year) : year(Year)
+1
View File
@@ -14,6 +14,7 @@ Visualization:
- horizontal navigation between cousins - horizontal navigation between cousins
- color on different consoles - color on different consoles
- screen resize - screen resize
- empty tree
Compilation Compilation
- static and dynamic ncurses - static and dynamic ncurses
+23
View File
@@ -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() void Tree::display()
{ {
draw(); draw();
@@ -386,6 +406,9 @@ void Tree::display()
switch(c) switch(c)
{ {
case KEY_F(1):
displayHelp();
break;
case '\n': case '\n':
focused_ = selected_; focused_ = selected_;
draw(); draw();