diff --git a/src/display.cpp b/src/display.cpp index 7c96091..c9bb21d 100644 --- a/src/display.cpp +++ b/src/display.cpp @@ -4,21 +4,44 @@ const int Curses::cmd_kbd_lines = 12; const int Curses::cmd_kbd_columns = 50; + const int Curses::cmd_speed_lines = 4; const int Curses::cmd_speed_columns = 50; +const int Curses::get_lines = 1; +const int Curses::get_columns = 1; + +const int Curses::nav_data_lines = 5; +const int Curses::nav_data_columns = 40; + +const int Curses::log_sent_w_lines = 12; +const int Curses::log_sent_w_columns = 40; + Curses::Curses() { initscr(); cbreak(); //noecho(); + cmd_kbd = newwin(cmd_kbd_lines, cmd_kbd_columns, 0, 0); - cmd_speed = newwin(cmd_speed_lines, - cmd_speed_columns, cmd_kbd_lines+1, 0); - get = newwin(1,1,cmd_kbd_lines + cmd_speed_lines + 1,2); - //log_sent_w = newwin(/// - //nav_data = newwin(// + + get = newwin(get_lines, get_columns, + cmd_kbd_lines, cmd_kbd_columns/2); + + cmd_speed = newwin(cmd_speed_lines, cmd_speed_columns, + cmd_kbd_lines + get_lines, 0); + + log_sent_w = newwin(log_sent_w_lines, log_sent_w_columns, + 0, cmd_kbd_columns + 1); + log_line_number = log_sent_w_lines - 1; + + scrollok(log_sent_w, TRUE); + + nav_data = newwin(nav_data_lines, nav_data_columns, + log_sent_w_lines + 1, cmd_kbd_columns + 1); + print_cmd_kbd(); print_cmd_speed(); + wmove(get, 0, 0); wrefresh(get); } @@ -60,7 +83,9 @@ void Curses::update_cmd_speed(const char& coord, const float& v) { } void Curses::log_sent(const std::string& str) { - + wmove(log_sent_w, log_line_number++, 0); + waddstr(log_sent_w, (str + "\n").c_str() ); + wrefresh(log_sent_w); } void Curses::update_navdata(const float& batteryPercent, diff --git a/src/display.h b/src/display.h index 367f10f..07127e5 100644 --- a/src/display.h +++ b/src/display.h @@ -10,15 +10,24 @@ class Curses static const int cmd_kbd_lines; static const int cmd_kbd_columns; WINDOW* cmd_kbd; + void print_cmd_kbd(); + static const int cmd_speed_lines; static const int cmd_speed_columns; WINDOW* cmd_speed; - void print_cmd_kbd(); void print_cmd_speed(); + + static const int get_lines; + static const int get_columns; WINDOW* get; - // TODO (avec scroll) + static const int log_sent_w_lines; + static const int log_sent_w_columns; + int log_line_number; WINDOW* log_sent_w; + + static const int nav_data_lines; + static const int nav_data_columns; WINDOW* nav_data; public: