static void statusbars_recalc_ypos(STATUSBAR_REC *bar) { GSList *tmp, *bar_group; int ypos; /* get list of statusbars with same type and placement, sorted by position */ bar_group = NULL; tmp = bar->config->type == STATUSBAR_TYPE_ROOT ? bar->group->bars : bar->parent_window->statusbars; for (; tmp != NULL; tmp = tmp->next) { STATUSBAR_REC *rec = tmp->data; if (rec->config->type == bar->config->type && rec->config->placement == bar->config->placement) { bar_group = g_slist_insert_sorted(bar_group, rec, (GCompareFunc) sbar_cmp_position); } } if (bar_group == NULL) { /* we just destroyed the last statusbar in this type/placement group */ return; } /* get the Y-position for the first statusbar */ if (bar->config->type == STATUSBAR_TYPE_ROOT) { ypos = bar->config->placement == STATUSBAR_TOP ? 0 : term_height - g_slist_length(bar_group); } else { ypos = bar->config->placement == STATUSBAR_TOP ? bar->parent_window->first_line : bar->parent_window->last_line - (g_slist_length(bar_group)-1); } /* set the Y-positions */ while (bar_group != NULL) { bar = bar_group->data; if (bar->real_ypos != ypos) { bar->real_ypos = ypos; statusbar_redraw(bar, TRUE); } ypos++; bar_group = g_slist_remove(bar_group, bar_group->data); } }
static void topicbar_create(void) { if (topic_bar != NULL) return; topic_bar = statusbar_create(STATUSBAR_POS_UP, 0); topic_item = statusbar_item_create(topic_bar, 0, FALSE, statusbar_topic); statusbar_redraw(topic_bar); signal_add("window changed", (SIGNAL_FUNC) sig_statusbar_topic_redraw); signal_add("window item changed", (SIGNAL_FUNC) sig_statusbar_topic_redraw); signal_add("channel topic changed", (SIGNAL_FUNC) sig_statusbar_topic_redraw); signal_add("query address changed", (SIGNAL_FUNC) sig_statusbar_topic_redraw); }
static void textui_finish_init(void) { quitting = FALSE; if (dummy) term_dummy_init(); else { term_refresh_freeze(); textbuffer_init(); textbuffer_view_init(); textbuffer_commands_init(); gui_expandos_init(); gui_printtext_init(); gui_readline_init(); lastlog_init(); mainwindows_init(); mainwindow_activity_init(); mainwindows_layout_init(); gui_windows_init(); statusbar_init(); term_refresh_thaw(); /* don't check settings with dummy mode */ settings_check(); } module_register("core", "fe-text"); #ifdef HAVE_STATIC_PERL perl_core_init(); fe_perl_init(); #endif dirty_check(); fe_common_core_finish_init(); signal_emit("irssi init finished", 0); statusbar_redraw(NULL, TRUE); if (servers == NULL && lookup_servers == NULL) { printtext(NULL, NULL, MSGLEVEL_CRAP|MSGLEVEL_NO_ACT, "%s", banner_text); } if (display_firsttimer) { printtext(NULL, NULL, MSGLEVEL_CRAP|MSGLEVEL_NO_ACT, "%s", firsttimer_text); } }
static void create_root_statusbars(void) { STATUSBAR_REC *bar; GSList *tmp; tmp = active_statusbar_group->config_bars; for (; tmp != NULL; tmp = tmp->next) { STATUSBAR_CONFIG_REC *rec = tmp->data; if (rec->type == STATUSBAR_TYPE_ROOT) { bar = statusbar_create(active_statusbar_group, rec, NULL); statusbar_redraw(bar, TRUE); } } }
void statusbar_recreate_items(STATUSBAR_REC *bar) { GSList *tmp; /* destroy */ while (bar->items != NULL) statusbar_item_destroy(bar->items->data); /* create */ for (tmp = bar->config->items; tmp != NULL; tmp = tmp->next) { SBAR_ITEM_CONFIG_REC *rec = tmp->data; statusbar_item_create(bar, rec); } statusbar_redraw(bar, TRUE); }
static void sig_statusbar_more_check(WINDOW_REC *window) { g_return_if_fail(window != NULL); if (!is_window_visible(window)) return; if (!WINDOW_GUI(window)->bottom) { if (more_item == NULL) { more_item = statusbar_item_create(mainbar, 10, FALSE, statusbar_more); statusbar_redraw(mainbar); } } else if (more_item != NULL) { statusbar_item_remove(more_item); more_item = NULL; } }
static void statusbars_add_visible(MAIN_WINDOW_REC *window) { STATUSBAR_GROUP_REC *group; STATUSBAR_REC *bar; GSList *tmp; group = active_statusbar_group; for (tmp = group->config_bars; tmp != NULL; tmp = tmp->next) { STATUSBAR_CONFIG_REC *config = tmp->data; if (config->type == STATUSBAR_TYPE_WINDOW && STATUSBAR_IS_VISIBLE(config, window) && statusbar_find(group, config->name, window) == NULL) { bar = statusbar_create(group, config, window); statusbar_redraw(bar, TRUE); } } }
void mainwindow_destroy(MAIN_WINDOW_REC *window) { g_return_if_fail(window != NULL); #ifdef USE_CURSES_WINDOWS delwin(window->curses_win); #endif mainwindows = g_slist_remove(mainwindows, window); signal_emit("mainwindow destroyed", 1, window); if (!quitting && mainwindows != NULL) { gui_windows_remove_parent(window); mainwindows_add_space(window->first_line, window->last_line+window->statusbar_lines); mainwindows_redraw(); statusbar_redraw(NULL); } g_free(window); if (active_mainwin == window) active_mainwin = NULL; }
static void read_settings(void) { use_colors = settings_get_bool("colors"); if (settings_get_bool("topicbar")) topicbar_create(); else if (!settings_get_bool("topicbar")) topicbar_destroy(); lag_min_show = settings_get_int("lag_min_show")*10; sbar_color_background = settings_get_int("statusbar_background") << 4; sbar_color_dim = sbar_color_background | settings_get_int("statusbar_dim"); sbar_color_normal = sbar_color_background | settings_get_int("statusbar_normal"); sbar_color_bold = sbar_color_background | settings_get_int("statusbar_bold"); sbar_color_away = sbar_color_background | settings_get_int("statusbar_away"); sbar_color_act_highlight = sbar_color_background | settings_get_int("statusbar_act_highlight"); statusbar_redraw(NULL); }
/* SYNTAX: WINDOW BALANCE */ static void cmd_window_balance(void) { GSList *sorted, *tmp; int avail_size, unit_size, bigger_units; int windows, last_line, old_size; windows = g_slist_length(mainwindows); if (windows == 1) return; avail_size = LINES-reserved_up-reserved_down; unit_size = avail_size/windows; bigger_units = avail_size%windows; sorted = mainwindows_get_sorted(FALSE); last_line = 0; for (tmp = sorted; tmp != NULL; tmp = tmp->next) { MAIN_WINDOW_REC *rec = tmp->data; old_size = rec->lines; rec->first_line = last_line+1; rec->last_line = rec->first_line-1 + unit_size - rec->statusbar_lines; rec->lines = rec->last_line-rec->first_line+1; if (bigger_units > 0) { rec->last_line++; bigger_units--; } last_line = rec->last_line + rec->statusbar_lines; mainwindow_resize(rec, rec->lines-old_size, FALSE); } g_slist_free(sorted); mainwindows_redraw(); statusbar_redraw(NULL); }
void statusbar_item_redraw(SBAR_ITEM_REC *item) { WINDOW_REC *old_active_win; g_return_if_fail(item != NULL); old_active_win = active_win; if (item->bar->parent_window != NULL) active_win = item->bar->parent_window->active; item->func(item, TRUE); item->dirty = TRUE; item->bar->dirty = TRUE; irssi_set_dirty(); if (item->max_size != item->size) { /* item wants a new size - we'll need to redraw the statusbar to see if this is allowed */ statusbar_redraw(item->bar, item->config->right_alignment); } active_win = old_active_win; }
void statusbar_items_init(void) { GSList *tmp; settings_add_int("misc", "lag_min_show", 100); settings_add_bool("lookandfeel", "topicbar", TRUE); settings_add_bool("lookandfeel", "actlist_moves", FALSE); /* clock */ clock_timetag = g_timeout_add(1000, (GSourceFunc) statusbar_clock_timeout, NULL); /* nick */ signal_add("server connected", (SIGNAL_FUNC) sig_statusbar_nick_redraw); signal_add("channel wholist", (SIGNAL_FUNC) sig_statusbar_nick_redraw); signal_add("window changed", (SIGNAL_FUNC) sig_statusbar_nick_redraw); signal_add("window item changed", (SIGNAL_FUNC) sig_statusbar_nick_redraw); signal_add("nick mode changed", (SIGNAL_FUNC) sig_statusbar_nick_redraw); signal_add("user mode changed", (SIGNAL_FUNC) sig_statusbar_nick_redraw); signal_add("server nick changed", (SIGNAL_FUNC) sig_statusbar_nick_redraw); signal_add("window server changed", (SIGNAL_FUNC) sig_statusbar_nick_redraw); signal_add("away mode changed", (SIGNAL_FUNC) sig_statusbar_nick_redraw); /* channel */ signal_add("window changed", (SIGNAL_FUNC) sig_statusbar_channel_redraw); signal_add("window item changed", (SIGNAL_FUNC) sig_statusbar_channel_redraw_window); signal_add("channel mode changed", (SIGNAL_FUNC) sig_statusbar_channel_redraw_window_item); signal_add("window server changed", (SIGNAL_FUNC) sig_statusbar_channel_redraw_window); signal_add("window refnum changed", (SIGNAL_FUNC) sig_statusbar_channel_redraw_window); /* activity */ activity_list = NULL; signal_add("window activity", (SIGNAL_FUNC) sig_statusbar_activity_hilight); signal_add("window destroyed", (SIGNAL_FUNC) sig_statusbar_activity_window_destroyed); /* more */ more_item = NULL; signal_add("gui page scrolled", (SIGNAL_FUNC) sig_statusbar_more_check_remove); signal_add("window item changed", (SIGNAL_FUNC) sig_statusbar_more_check); signal_add("window changed", (SIGNAL_FUNC) sig_statusbar_more_check); signal_add("gui print text", (SIGNAL_FUNC) sig_statusbar_more_check); /* lag */ lag_timetag = g_timeout_add(1000*LAG_REFRESH_TIME, (GSourceFunc) statusbar_lag_timeout, NULL); signal_add("server lag", (SIGNAL_FUNC) sig_statusbar_lag_redraw); signal_add("window server changed", (SIGNAL_FUNC) sig_statusbar_lag_redraw); /* topic */ topic_item = NULL; topic_bar = NULL; signal_add("setup changed", (SIGNAL_FUNC) read_settings); read_settings(); statusbar_redraw(NULL); /* middle bars */ signal_add("mainwindow created", (SIGNAL_FUNC) sig_mainwindow_created); signal_add("mainwindow destroyed", (SIGNAL_FUNC) sig_mainwindow_destroyed); signal_add("window changed", (SIGNAL_FUNC) sig_main_statusbar_changed); signal_add("window refnum changed", (SIGNAL_FUNC) sig_sidebars_redraw); /* add statusbars to existing windows */ for (tmp = mainwindows; tmp != NULL; tmp = tmp->next) sig_mainwindow_created(tmp->data); sig_main_statusbar_changed(active_win); }
static void textui_finish_init(void) { int loglev; quitting = FALSE; term_refresh_freeze(); textbuffer_init(); textbuffer_view_init(); textbuffer_commands_init(); gui_expandos_init(); gui_printtext_init(); gui_readline_init(); gui_entry_init(); lastlog_init(); mainwindows_init(); mainwindow_activity_init(); mainwindows_layout_init(); gui_windows_init(); /* Temporarily raise the fatal level to abort on config errors. */ loglev = g_log_set_always_fatal(G_LOG_FATAL_MASK | G_LOG_LEVEL_CRITICAL); statusbar_init(); g_log_set_always_fatal(loglev); term_refresh_thaw(); settings_check(); module_register("core", "fe-text"); #ifdef HAVE_STATIC_PERL perl_core_init(); fe_perl_init(); #endif #ifdef HAVE_STATIC_OTR otr_core_init(); #endif dirty_check(); fe_common_core_finish_init(); signal_emit("irssi init finished", 0); statusbar_redraw(NULL, TRUE); if (servers == NULL && lookup_servers == NULL) { printformat(NULL, NULL, MSGLEVEL_CRAP|MSGLEVEL_NO_ACT, TXT_IRSSI_BANNER); } if (display_firsttimer) { printformat(NULL, NULL, MSGLEVEL_CRAP|MSGLEVEL_NO_ACT, TXT_WELCOME_FIRSTTIME); } /* see irc-servers-setup.c:init_userinfo */ if (user_settings_changed) printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, TXT_WELCOME_INIT_SETTINGS); if (user_settings_changed & USER_SETTINGS_REAL_NAME) fe_settings_set_print("real_name"); if (user_settings_changed & USER_SETTINGS_USER_NAME) fe_settings_set_print("user_name"); if (user_settings_changed & USER_SETTINGS_NICK) fe_settings_set_print("nick"); if (user_settings_changed & USER_SETTINGS_HOSTNAME) fe_settings_set_print("hostname"); term_environment_check(); }