ncurses initial
This commit is contained in:
@@ -8,6 +8,7 @@ using std::cout;
|
|||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
|
setlocale(LC_ALL, "");
|
||||||
initscr(); /* Start curses mode */
|
initscr(); /* Start curses mode */
|
||||||
|
|
||||||
/*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)
|
||||||
@@ -40,7 +41,7 @@ int main()
|
|||||||
|
|
||||||
Tree firstTree("firstTree");
|
Tree firstTree("firstTree");
|
||||||
|
|
||||||
firstTree.addPerson("Адам,", true, Nobody, Nobody, {0, 1, 6});
|
firstTree.addPerson("Адам", true, Nobody, Nobody, {0, 1, 6});
|
||||||
firstTree.addPerson("Ева", false, Nobody, Nobody, {0, 1, 6});
|
firstTree.addPerson("Ева", false, Nobody, Nobody, {0, 1, 6});
|
||||||
firstTree.addRelation(0, Husband, 1);
|
firstTree.addRelation(0, Husband, 1);
|
||||||
|
|
||||||
@@ -59,8 +60,6 @@ int main()
|
|||||||
|
|
||||||
/* ====================================================== */
|
/* ====================================================== */
|
||||||
|
|
||||||
refresh(); /* Print it on to the real screen */
|
|
||||||
|
|
||||||
Array<Tree> trees;
|
Array<Tree> trees;
|
||||||
|
|
||||||
bool quit = false;
|
bool quit = false;
|
||||||
@@ -106,7 +105,11 @@ int main()
|
|||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
std::cout << "Enter a command\n";
|
clear();
|
||||||
|
printw("Enter a command\n");
|
||||||
|
refresh();
|
||||||
|
// getmaxyx(stdscr,row,col); /* get the number of rows and columns */
|
||||||
|
|
||||||
std::cin >> input;
|
std::cin >> input;
|
||||||
for (i = 0; i < numCom; ++i)
|
for (i = 0; i < numCom; ++i)
|
||||||
{
|
{
|
||||||
|
|||||||
+55
-14
@@ -1,11 +1,14 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <ncursesw/ncurses.h>
|
||||||
|
|
||||||
#include"person.h"
|
#include"person.h"
|
||||||
#include "help.h"
|
#include "help.h"
|
||||||
|
|
||||||
using std::cout;
|
using std::cout;
|
||||||
|
|
||||||
|
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)
|
||||||
, month(Month)
|
, month(Month)
|
||||||
@@ -18,23 +21,41 @@ EventTime::EventTime(I16 Year, U8 Month, U16 Day, I8 Hour, I8 Minute)
|
|||||||
|
|
||||||
void EventTime::print() const
|
void EventTime::print() const
|
||||||
{
|
{
|
||||||
|
/* if (day != UNKNOWN_DATE) */
|
||||||
|
/* cout << (I32)day; */
|
||||||
|
/* else */
|
||||||
|
/* cout << "??"; */
|
||||||
|
/* cout << '.'; */
|
||||||
|
|
||||||
|
/* if (month != UNKNOWN_DATE) */
|
||||||
|
/* cout << (I32)month; */
|
||||||
|
/* else */
|
||||||
|
/* cout << "??"; */
|
||||||
|
/* cout << '.'; */
|
||||||
|
|
||||||
|
/* if (year != UNKNOWN_DATE) */
|
||||||
|
/* cout << year; */
|
||||||
|
/* else */
|
||||||
|
/* cout << "????"; */
|
||||||
|
/* cout << '\n'; */
|
||||||
|
|
||||||
if (day != UNKNOWN_DATE)
|
if (day != UNKNOWN_DATE)
|
||||||
cout << (I32)day;
|
wprintw(info_tab, "%d", day);
|
||||||
else
|
else
|
||||||
cout << "??";
|
waddstr(info_tab, "??");
|
||||||
cout << '.';
|
waddch(info_tab, '.');
|
||||||
|
|
||||||
if (month != UNKNOWN_DATE)
|
if (month != UNKNOWN_DATE)
|
||||||
cout << (I32)month;
|
wprintw(info_tab, "%d", month);
|
||||||
else
|
else
|
||||||
cout << "??";
|
waddstr(info_tab, "??");
|
||||||
cout << '.';
|
waddch(info_tab, '.');
|
||||||
|
|
||||||
if (year != UNKNOWN_DATE)
|
if (year != UNKNOWN_DATE)
|
||||||
cout << year;
|
wprintw(info_tab, "%d", year);
|
||||||
else
|
else
|
||||||
cout << "????";
|
waddstr(info_tab, "????");
|
||||||
cout << '\n';
|
waddch(info_tab, '\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -106,14 +127,34 @@ void Person::rename(const char* newName)
|
|||||||
|
|
||||||
void Person::print()const
|
void Person::print()const
|
||||||
{
|
{
|
||||||
cout << name_ << '\n';
|
info_tab = newwin(LINES, COLS, 0, 0);
|
||||||
cout << (isMale_ ? "Male\n" : "Female\n");
|
|
||||||
|
|
||||||
cout << "Birth: ";
|
waddstr(info_tab, name_.data());
|
||||||
|
waddch(info_tab,'\n');
|
||||||
|
|
||||||
|
waddstr(info_tab, "Birth: ");
|
||||||
birth_.print();
|
birth_.print();
|
||||||
|
|
||||||
cout << "Death: "; //TODO: only print if known
|
waddstr(info_tab, "Death: ");
|
||||||
death_.print();
|
death_.print();
|
||||||
|
|
||||||
cout << '\n';
|
mvaddstr(LINES-1, 0, "Press any key to return.");
|
||||||
|
|
||||||
|
wrefresh(info_tab);
|
||||||
|
getch(); /* waint press */
|
||||||
|
|
||||||
|
werase(info_tab);
|
||||||
|
wrefresh(info_tab);
|
||||||
|
delwin(info_tab);
|
||||||
|
|
||||||
|
/* cout << name_ << '\n'; */
|
||||||
|
/* cout << (isMale_ ? "Male\n" : "Female\n"); */
|
||||||
|
|
||||||
|
/* cout << "Birth: "; */
|
||||||
|
/* birth_.print(); */
|
||||||
|
|
||||||
|
/* cout << "Death: "; //TODO: only print if known */
|
||||||
|
/* death_.print(); */
|
||||||
|
|
||||||
|
/* cout << '\n'; */
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user