diff options
Diffstat (limited to 'client')
-rw-r--r-- | client/setup.c | 6 | ||||
-rw-r--r-- | client/ui.c | 28 | ||||
-rw-r--r-- | client/ui.h | 4 |
3 files changed, 23 insertions, 15 deletions
diff --git a/client/setup.c b/client/setup.c index e51965f..8b5d07a 100644 --- a/client/setup.c +++ b/client/setup.c @@ -43,8 +43,10 @@ void w2_client_setup(int argc, char **argv) { g_w2_ui_width = getmaxx(g_w2_ui_win); g_w2_ui_height = getmaxy(g_w2_ui_win); - g_w2_ui_pad_tabbar = newpad(1, g_w2_ui_width); - g_w2_ui_pad_body = newpad(g_w2_ui_height - 5, g_w2_ui_width); + g_w2_ui_pad_tabbar = newpad(1, g_w2_ui_width); + g_w2_ui_pad_body = newpad(g_w2_ui_height - 5, g_w2_ui_width); + g_w2_ui_pad_statusbar = newpad(2, g_w2_ui_width); + g_w2_ui_pad_seperator = newpad(1, g_w2_ui_width); scrollok(g_w2_ui_pad_body, true); // check endianness diff --git a/client/ui.c b/client/ui.c index 9e6837a..c45259e 100644 --- a/client/ui.c +++ b/client/ui.c @@ -12,6 +12,8 @@ WINDOW *g_w2_ui_win; WINDOW *g_w2_ui_pad_tabbar; +WINDOW *g_w2_ui_pad_statusbar; +WINDOW *g_w2_ui_pad_seperator; WINDOW *g_w2_ui_pad_body; int g_w2_ui_pad_body_scroll = 0; unsigned int g_w2_ui_width = 0; @@ -37,7 +39,6 @@ void w2_ui_switch_tab(w2_e_ui_tabs next_tab) { void w2_ui_key_handler() { int ch; void (*current_mode_key_handler)() = g_w2_keyhndl_ptrs[g_w2_ui_current_tab]; - return; while ((ch = getch()) != -1) { if (ch == '\t') w2_ui_switch_tab(g_w2_ui_current_tab + 1); @@ -56,12 +57,16 @@ void w2_ui_main() { void w2_ui_paint() { w2_ui_paint_statusbar(); + w2_ui_paint_tabbar(); + w2_ui_paint_seperator(); if (w2_timer_end(W2_TIMER_UPDATE) >= (1000 / W2_UI_UPDATE_FPS)) { (*g_w2_tab_ptrs[g_w2_ui_current_tab])(g_w2_ui_last_tab != g_w2_ui_current_tab); g_w2_ui_last_tab = g_w2_ui_current_tab; w2_timer_start(W2_TIMER_UPDATE); } + prefresh(g_w2_ui_pad_statusbar, 0, 0, 0, 0, 1, g_w2_ui_width - 1); prefresh(g_w2_ui_pad_tabbar, 0, 0, 2, 0, 2, g_w2_ui_width - 1); + prefresh(g_w2_ui_pad_seperator, 0, 0, 3, 0, 3, g_w2_ui_width - 1); prefresh(g_w2_ui_pad_body, W2_MAX(0, g_w2_ui_pad_body_scroll), 0, 4 - W2_MIN(0, g_w2_ui_pad_body_scroll), 0, g_w2_ui_height - 2, g_w2_ui_width - 1); } @@ -69,30 +74,27 @@ void w2_ui_paint() { void w2_ui_paint_statusbar() { char temp[g_w2_ui_width]; - for (unsigned int i = 0; i < g_w2_ui_width; i++) temp[i] = ' '; - mvaddnstr(0, 0, temp, g_w2_ui_width); - mvaddnstr(1, 0, temp, g_w2_ui_width); - mvaddnstr(2, 0, temp, g_w2_ui_width); - g_w2_state.connected ? sprintf(temp, W2_UI_CONN_STAT_CONNECTED ", %ims %s", g_w2_state.ping, W2_UI_CONN_STAT_PING) : sprintf(temp, W2_UI_CONN_STAT_DISCONNECTED); - mvaddstr(0, 0, temp); + w2_wmvaddstr(g_w2_ui_pad_statusbar, 0, 0, temp); sprintf(temp, "(%s)", g_w2_state.info.build_str); - mvaddstr(0, g_w2_ui_width / 2 - strlen(temp) / 2, temp); + w2_wmvaddstr(g_w2_ui_pad_statusbar, 0, g_w2_ui_width / 2 - strlen(temp) / 2, temp); sprintf(temp, "%s %i%%", W2_UI_BATT_STAT_BATTERY, g_w2_state.battery_level); - mvaddstr(0, g_w2_ui_width - strlen(temp), temp); + w2_wmvaddstr(g_w2_ui_pad_statusbar, 0, g_w2_ui_width - strlen(temp), temp); sprintf(temp, "[%s]", g_w2_mode_strings[g_w2_state.mode]); - mvaddstr(1, 0, temp); + w2_wmvaddstr(g_w2_ui_pad_statusbar, 1, 0, temp); sprintf(temp, "%i %s, %i %s", 0, W2_UI_EXPT_STAT_WARNINGS, 0, W2_UI_EXPT_STAT_ERRORS); - mvaddstr(1, g_w2_ui_width - strlen(temp), temp); + w2_wmvaddstr(g_w2_ui_pad_statusbar, 1, g_w2_ui_width - strlen(temp), temp); +} - w2_ui_paint_tabbar(); +void w2_ui_paint_seperator() { + char temp[g_w2_ui_width]; for (unsigned int i = 0; i < g_w2_ui_width; i++) temp[i] = '-'; - mvaddnstr(3, 0, temp, g_w2_ui_width); + w2_wmvaddnstr(g_w2_ui_pad_seperator, 0, 0, temp, g_w2_ui_width); } diff --git a/client/ui.h b/client/ui.h index eb09739..a003cfc 100644 --- a/client/ui.h +++ b/client/ui.h @@ -14,6 +14,8 @@ typedef enum { extern WINDOW *g_w2_ui_win; extern WINDOW *g_w2_ui_pad_tabbar; +extern WINDOW *g_w2_ui_pad_statusbar; +extern WINDOW *g_w2_ui_pad_seperator; extern WINDOW *g_w2_ui_pad_body; extern int g_w2_ui_pad_body_scroll; extern unsigned int g_w2_ui_width; @@ -37,6 +39,8 @@ void w2_ui_main(); void w2_ui_paint_statusbar(); /** draw tab bar */ void w2_ui_paint_tabbar(); +/** draw seperator under tab bar */ +void w2_ui_paint_seperator(); void w2_ui_tabbar_init(); |