initial draw

This commit is contained in:
vrd
2022-12-18 00:35:01 +02:00
parent 0da0f98dc9
commit 5e9d2d8501
4 changed files with 43 additions and 11 deletions
+2 -1
View File
@@ -8,10 +8,11 @@ using std::cout;
int main()
{
setlocale(LC_ALL, "");
initscr(); /* Start curses mode */
noecho();
cbreak(); /* get input instantly */
refresh(); /* if not present the first real refresh is missed */
wnoutrefresh(stdscr); /* if not present the first real refresh is missed */
/*Tree test1("Dechkovi"); //addTree Dechkovi addTree Karamanovi load 0 load 1 (to work with these example trees)
Tree test2("Karamanovi");
+11
View File
@@ -158,3 +158,14 @@ void Person::print()const
/* cout << '\n'; */
}
WINDOW* Person::createPad()const
{
U16 width = name_.size() + 4;
WINDOW* pad = newpad(5, width);
box(pad, 5, width);
mvwaddstr(pad, 2, 2, name_.data());
return pad;
}
+3
View File
@@ -2,6 +2,7 @@
#include <string>
#include <fstream>
#include <ncursesw/ncurses.h>
#include "common/basicTypes.h"
struct EventTime
@@ -33,6 +34,8 @@ public:
void rename(const char* newName);
void print()const;
WINDOW* createPad()const;
friend class Tree;
private:
+17
View File
@@ -442,6 +442,23 @@ void Tree::removeRelation(const unsigned firstId, const unsigned secondId)
void Tree::draw() const
{
WINDOW* father = people[0].createPad();
WINDOW* mother = people[1].createPad();
U16 fw = getmaxx(father); /* return size, not coords */
U16 fh = getmaxy(father);
U16 mw = getmaxx(mother);
U16 mh = getmaxy(mother);
U16 drawX = (COLS - fw - mw) / 2;
pnoutrefresh(father, 0, 0,
1, drawX,
1 +fh-1, drawX + fw-1);
/* pnoutrefresh(mother, 0, 0, 1, d */
doupdate();
getch();
}