initial draw
This commit is contained in:
@@ -8,10 +8,11 @@ using std::cout;
|
|||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
setlocale(LC_ALL, "");
|
setlocale(LC_ALL, "");
|
||||||
|
|
||||||
initscr(); /* Start curses mode */
|
initscr(); /* Start curses mode */
|
||||||
noecho();
|
noecho();
|
||||||
cbreak(); /* get input instantly */
|
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 test1("Dechkovi"); //addTree Dechkovi addTree Karamanovi load 0 load 1 (to work with these example trees)
|
||||||
Tree test2("Karamanovi");
|
Tree test2("Karamanovi");
|
||||||
|
|||||||
+11
@@ -158,3 +158,14 @@ void Person::print()const
|
|||||||
|
|
||||||
/* cout << '\n'; */
|
/* 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;
|
||||||
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
#include <ncursesw/ncurses.h>
|
||||||
#include "common/basicTypes.h"
|
#include "common/basicTypes.h"
|
||||||
|
|
||||||
struct EventTime
|
struct EventTime
|
||||||
@@ -33,6 +34,8 @@ public:
|
|||||||
void rename(const char* newName);
|
void rename(const char* newName);
|
||||||
void print()const;
|
void print()const;
|
||||||
|
|
||||||
|
WINDOW* createPad()const;
|
||||||
|
|
||||||
friend class Tree;
|
friend class Tree;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -442,6 +442,23 @@ void Tree::removeRelation(const unsigned firstId, const unsigned secondId)
|
|||||||
|
|
||||||
void Tree::draw() const
|
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();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user