diff options
author | James Booth <boothj5@gmail.com> | 2014-10-09 21:42:09 +0100 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2014-10-09 21:42:09 +0100 |
commit | cbe14d6e4e78baf205484274a139661c64b64144 (patch) | |
tree | d42b59533263c4cf3b23ba6eaea6ed48017d0305 /src/ui | |
parent | 73262221f54428a29156f52e429237182cac51f0 (diff) | |
download | profani-tty-cbe14d6e4e78baf205484274a139661c64b64144.tar.gz |
Implemented /occupants show
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/core.c | 3 | ||||
-rw-r--r-- | src/ui/window.c | 13 | ||||
-rw-r--r-- | src/ui/window.h | 1 | ||||
-rw-r--r-- | src/ui/windows.c | 18 | ||||
-rw-r--r-- | src/ui/windows.h | 1 |
5 files changed, 34 insertions, 2 deletions
diff --git a/src/ui/core.c b/src/ui/core.c index b61c4627..58434eab 100644 --- a/src/ui/core.c +++ b/src/ui/core.c @@ -2788,7 +2788,8 @@ _ui_room_show_occupants(const char * const room) { ProfWin *window = wins_get_by_recipient(room); if (window && !window->subwin) { - cons_debug("Showing occupants"); + wins_show_subwin(window); + ui_muc_roster(room); } } diff --git a/src/ui/window.c b/src/ui/window.c index 40d40b24..26228307 100644 --- a/src/ui/window.c +++ b/src/ui/window.c @@ -103,6 +103,19 @@ win_hide_subwin(ProfWin *window) } void +win_show_subwin(ProfWin *window) +{ + if (!window->subwin) { + window->subwin = newpad(PAD_SIZE, OCCUPANT_WIN_WIDTH); + wbkgd(window->subwin, COLOUR_TEXT); + + int cols = getmaxx(stdscr); + wresize(window->win, PAD_SIZE, (cols/OCCUPANT_WIN_RATIO) * (OCCUPANT_WIN_RATIO-1)); + win_redraw(window); + } +} + +void win_free(ProfWin* window) { buffer_free(window->buffer); diff --git a/src/ui/window.h b/src/ui/window.h index a12be754..68bab0e7 100644 --- a/src/ui/window.h +++ b/src/ui/window.h @@ -103,5 +103,6 @@ void win_save_println(ProfWin *window, const char * const message); void win_save_newline(ProfWin *window); void win_redraw(ProfWin *window); void win_hide_subwin(ProfWin *window); +void win_show_subwin(ProfWin *window); #endif diff --git a/src/ui/windows.c b/src/ui/windows.c index 03e09726..0542f3da 100644 --- a/src/ui/windows.c +++ b/src/ui/windows.c @@ -294,7 +294,7 @@ wins_resize_all(void) GList *curr = values; while (curr != NULL) { ProfWin *window = curr->data; - if (window->type == WIN_MUC) { + if ((window->type == WIN_MUC) && (window->subwin)) { wresize(window->win, PAD_SIZE, (cols/OCCUPANT_WIN_RATIO) * (OCCUPANT_WIN_RATIO-1)); } else { wresize(window->win, PAD_SIZE, cols); @@ -320,12 +320,28 @@ wins_hide_subwin(ProfWin *window) getmaxyx(stdscr, rows, cols); win_hide_subwin(window); + ProfWin *current_win = wins_get_current(); if (current_win->type == WIN_MUC) { pnoutrefresh(current_win->win, current_win->y_pos, 0, 1, 0, rows-3, cols-1); } } +void +wins_show_subwin(ProfWin *window) +{ + int rows, cols; + getmaxyx(stdscr, rows, cols); + + win_show_subwin(window); + + ProfWin *current_win = wins_get_current(); + if (current_win->type == WIN_MUC) { + pnoutrefresh(current_win->win, current_win->y_pos, 0, 1, 0, rows-3, ((cols/OCCUPANT_WIN_RATIO) * (OCCUPANT_WIN_RATIO-1)) -1); + pnoutrefresh(current_win->subwin, current_win->sub_y_pos, 0, 1, (cols/OCCUPANT_WIN_RATIO) * (OCCUPANT_WIN_RATIO-1), rows-3, cols-1); + } +} + gboolean wins_duck_exists(void) { diff --git a/src/ui/windows.h b/src/ui/windows.h index 3f79e808..7b3a94f8 100644 --- a/src/ui/windows.h +++ b/src/ui/windows.h @@ -64,5 +64,6 @@ gboolean wins_xmlconsole_exists(void); ProfWin * wins_get_xmlconsole(void); gboolean wins_swap(int source_win, int target_win); void wins_hide_subwin(ProfWin *window); +void wins_show_subwin(ProfWin *window); #endif |