mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-28 02:26:21 +00:00
Refactor subwin sizing and disabled wrapping
This commit is contained in:
@@ -65,8 +65,7 @@ wins_init(void)
|
||||
(GDestroyNotify)win_free);
|
||||
|
||||
max_cols = getmaxx(stdscr);
|
||||
int cols = getmaxx(stdscr);
|
||||
ProfWin *console = win_create(CONS_WIN_TITLE, cols, WIN_CONSOLE);
|
||||
ProfWin *console = win_create(CONS_WIN_TITLE, WIN_CONSOLE);
|
||||
g_hash_table_insert(windows, GINT_TO_POINTER(1), console);
|
||||
|
||||
current = 1;
|
||||
@@ -261,8 +260,7 @@ wins_new(const char * const from, win_type_t type)
|
||||
{
|
||||
GList *keys = g_hash_table_get_keys(windows);
|
||||
int result = get_next_available_win_num(keys);
|
||||
int cols = getmaxx(stdscr);
|
||||
ProfWin *new = win_create(from, cols, type);
|
||||
ProfWin *new = win_create(from, type);
|
||||
g_hash_table_insert(windows, GINT_TO_POINTER(result), new);
|
||||
g_list_free(keys);
|
||||
return new;
|
||||
@@ -289,13 +287,20 @@ wins_resize_all(void)
|
||||
{
|
||||
int rows, cols;
|
||||
getmaxyx(stdscr, rows, cols);
|
||||
int main_cols = win_main_width();
|
||||
|
||||
GList *values = g_hash_table_get_values(windows);
|
||||
GList *curr = values;
|
||||
while (curr != NULL) {
|
||||
ProfWin *window = curr->data;
|
||||
if (((window->type == WIN_MUC) || (window->type == WIN_CONSOLE)) && (window->subwin)) {
|
||||
wresize(window->win, PAD_SIZE, (cols/SUB_WIN_RATIO) * (SUB_WIN_RATIO-1));
|
||||
wresize(window->win, PAD_SIZE, main_cols);
|
||||
wresize(window->subwin, PAD_SIZE, cols - main_cols);
|
||||
if (window->type == WIN_MUC) {
|
||||
ui_muc_roster(window->from);
|
||||
} else if (window->type == WIN_CONSOLE) {
|
||||
ui_roster();
|
||||
}
|
||||
} else {
|
||||
wresize(window->win, PAD_SIZE, cols);
|
||||
}
|
||||
@@ -306,8 +311,8 @@ wins_resize_all(void)
|
||||
|
||||
ProfWin *current_win = wins_get_current();
|
||||
if (((current_win->type == WIN_MUC) || (current_win->type == WIN_CONSOLE)) && (current_win->subwin)) {
|
||||
pnoutrefresh(current_win->win, current_win->y_pos, 0, 1, 0, rows-3, ((cols/SUB_WIN_RATIO) * (SUB_WIN_RATIO-1)) -1);
|
||||
pnoutrefresh(current_win->subwin, current_win->sub_y_pos, 0, 1, (cols/SUB_WIN_RATIO) * (SUB_WIN_RATIO-1), rows-3, cols-1);
|
||||
pnoutrefresh(current_win->win, current_win->y_pos, 0, 1, 0, rows-3, main_cols-1);
|
||||
pnoutrefresh(current_win->subwin, current_win->sub_y_pos, 0, 1, main_cols, rows-3, cols-1);
|
||||
} else {
|
||||
pnoutrefresh(current_win->win, current_win->y_pos, 0, 1, 0, rows-3, cols-1);
|
||||
}
|
||||
@@ -332,13 +337,14 @@ wins_show_subwin(ProfWin *window)
|
||||
{
|
||||
int rows, cols;
|
||||
getmaxyx(stdscr, rows, cols);
|
||||
int main_cols = win_main_width();
|
||||
|
||||
win_show_subwin(window);
|
||||
|
||||
ProfWin *current_win = wins_get_current();
|
||||
if ((current_win->type == WIN_MUC) || (current_win->type == WIN_CONSOLE)) {
|
||||
pnoutrefresh(current_win->win, current_win->y_pos, 0, 1, 0, rows-3, ((cols/SUB_WIN_RATIO) * (SUB_WIN_RATIO-1)) -1);
|
||||
pnoutrefresh(current_win->subwin, current_win->sub_y_pos, 0, 1, (cols/SUB_WIN_RATIO) * (SUB_WIN_RATIO-1), rows-3, cols-1);
|
||||
pnoutrefresh(current_win->win, current_win->y_pos, 0, 1, 0, rows-3, main_cols-1);
|
||||
pnoutrefresh(current_win->subwin, current_win->sub_y_pos, 0, 1, main_cols, rows-3, cols-1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user