You can change statusbar colors with /SET statusbar_xxx.

git-svn-id: http://svn.irssi.org/repos/irssi/trunk@440 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2000-07-09 12:51:33 +00:00 committed by cras
commit 92bce7e219
2 changed files with 72 additions and 44 deletions

View file

@ -49,6 +49,9 @@
the lag */ the lag */
#define MAX_LAG_UNKNOWN_TIME 30 #define MAX_LAG_UNKNOWN_TIME 30
static int sbar_color_dim, sbar_color_normal, sbar_color_bold;
static int sbar_color_background, sbar_color_away, sbar_color_act_highlight;
static STATUSBAR_REC *mainbar; static STATUSBAR_REC *mainbar;
static MAIN_WINDOW_REC *mainbar_window; static MAIN_WINDOW_REC *mainbar_window;
static int use_colors; static int use_colors;
@ -97,9 +100,9 @@ static void statusbar_clock(SBAR_ITEM_REC *item, int ypos)
g_snprintf(str, sizeof(str), "%02d:%02d", tm->tm_hour, tm->tm_min); g_snprintf(str, sizeof(str), "%02d:%02d", tm->tm_hour, tm->tm_min);
move(ypos, item->xpos); move(ypos, item->xpos);
set_color((1 << 4)+3); addch('['); set_color(sbar_color_dim); addch('[');
set_color((1 << 4)+15); addstr(str); set_color(sbar_color_bold); addstr(str);
set_color((1 << 4)+3); addch(']'); set_color(sbar_color_dim); addch(']');
screen_refresh(); screen_refresh();
} }
@ -163,24 +166,24 @@ static void statusbar_nick(SBAR_ITEM_REC *item, int ypos)
/* size ok, draw the nick */ /* size ok, draw the nick */
move(ypos, item->xpos); move(ypos, item->xpos);
set_color((1 << 4)+3); addch('['); set_color(sbar_color_dim); addch('[');
if (nickrec != NULL && (nickrec->op || nickrec->voice)) { if (nickrec != NULL && (nickrec->op || nickrec->voice)) {
set_color((1 << 4)+15); set_color(sbar_color_bold);
addch(nickrec->op ? '@' : '+'); addch(nickrec->op ? '@' : '+');
} }
set_color((1 << 4)+7); addstr(nick); set_color(sbar_color_normal); addstr(nick);
if (umode_size) { if (umode_size) {
set_color((1 << 4)+15); addch('('); set_color(sbar_color_bold); addch('(');
set_color((1 << 4)+3); addch('+'); set_color(sbar_color_dim); addch('+');
set_color((1 << 4)+7); addstr(server->usermode); set_color(sbar_color_normal); addstr(server->usermode);
set_color((1 << 4)+15); addch(')'); set_color(sbar_color_bold); addch(')');
} }
if (server != NULL && server->usermode_away) { if (server != NULL && server->usermode_away) {
set_color((1 << 4)+7); addstr(" ("); set_color(sbar_color_normal); addstr(" (");
set_color((1 << 4)+10); addstr("zZzZ"); set_color(sbar_color_away); addstr("zZzZ");
set_color((1 << 4)+7); addch(')'); set_color(sbar_color_normal); addch(')');
} }
set_color((1 << 4)+3); addch(']'); set_color(sbar_color_dim); addch(']');
screen_refresh(); screen_refresh();
} }
@ -260,31 +263,31 @@ static void statusbar_channel(SBAR_ITEM_REC *item, int ypos)
} }
move(ypos, item->xpos); move(ypos, item->xpos);
set_color((1 << 4)+3); addch('['); set_color(sbar_color_dim); addch('[');
/* window number */ /* window number */
set_color((1 << 4)+7); addstr(winnum); set_color(sbar_color_normal); addstr(winnum);
set_color((1 << 4)+3); addch(':'); set_color(sbar_color_dim); addch(':');
if (channame[0] == '\0' && server != NULL) if (channame[0] == '\0' && server != NULL)
{ {
/* server tag */ /* server tag */
set_color((1 << 4)+7); addstr(server->tag); set_color(sbar_color_normal); addstr(server->tag);
addstr(" (change with ^X)"); addstr(" (change with ^X)");
} }
else if (channame[0] != '\0') else if (channame[0] != '\0')
{ {
/* channel + mode */ /* channel + mode */
set_color((1 << 4)+7); addstr(channame); set_color(sbar_color_normal); addstr(channame);
if (mode_size) if (mode_size)
{ {
set_color((1 << 4)+15); addch('('); set_color(sbar_color_bold); addch('(');
set_color((1 << 4)+3); addch('+'); set_color(sbar_color_dim); addch('+');
set_color((1 << 4)+7); addstr(mode); set_color(sbar_color_normal); addstr(mode);
set_color((1 << 4)+15); addch(')'); set_color(sbar_color_bold); addch(')');
} }
} }
set_color((1 << 4)+3); addch(']'); set_color(sbar_color_dim); addch(']');
screen_refresh(); screen_refresh();
if (mode != NULL) g_free(mode); if (mode != NULL) g_free(mode);
@ -317,7 +320,7 @@ static void draw_activity(gchar *title, gboolean act, gboolean det)
gchar str[MAX_INT_STRLEN]; gchar str[MAX_INT_STRLEN];
gboolean first, is_det; gboolean first, is_det;
set_color((1 << 4)+7); addstr(title); set_color(sbar_color_normal); addstr(title);
first = TRUE; first = TRUE;
for (tmp = activity_list; tmp != NULL; tmp = tmp->next) for (tmp = activity_list; tmp != NULL; tmp = tmp->next)
@ -332,7 +335,7 @@ static void draw_activity(gchar *title, gboolean act, gboolean det)
first = FALSE; first = FALSE;
else else
{ {
set_color((1 << 4)+3); set_color(sbar_color_dim);
addch(','); addch(',');
} }
@ -340,13 +343,16 @@ static void draw_activity(gchar *title, gboolean act, gboolean det)
switch (window->new_data) switch (window->new_data)
{ {
case NEWDATA_TEXT: case NEWDATA_TEXT:
set_color((1 << 4)+3); set_color(sbar_color_dim);
break; break;
case NEWDATA_MSG: case NEWDATA_MSG:
set_color((1 << 4)+15); set_color(sbar_color_bold);
break; break;
case NEWDATA_HILIGHT: case NEWDATA_HILIGHT:
set_color((1 << 4) + (window->last_color > 0 ? mirc_colors[window->last_color] : 13)); if (window->last_color > 0)
set_color(sbar_color_background | mirc_colors[window->last_color]);
else
set_color(sbar_color_act_highlight);
break; break;
} }
addstr(str); addstr(str);
@ -390,11 +396,11 @@ static void statusbar_activity(SBAR_ITEM_REC *item, int ypos)
return; return;
move(ypos, item->xpos); move(ypos, item->xpos);
set_color((1 << 4)+3); addch('['); set_color(sbar_color_dim); addch('[');
if (act) draw_activity("Act: ", TRUE, !det); if (act) draw_activity("Act: ", TRUE, !det);
if (act && det) addch(' '); if (act && det) addch(' ');
if (det) draw_activity("Det: ", FALSE, TRUE); if (det) draw_activity("Det: ", FALSE, TRUE);
set_color((1 << 4)+3); addch(']'); set_color(sbar_color_dim); addch(']');
screen_refresh(); screen_refresh();
} }
@ -472,7 +478,7 @@ static void statusbar_more(SBAR_ITEM_REC *item, int ypos)
if (item->size != 10) return; if (item->size != 10) return;
move(ypos, item->xpos); move(ypos, item->xpos);
set_color((1 << 4)+15); addstr("-- more --"); set_color(sbar_color_bold); addstr("-- more --");
screen_refresh(); screen_refresh();
} }
@ -548,11 +554,11 @@ static void statusbar_lag(SBAR_ITEM_REC *item, int ypos)
if (item->size != 0) { if (item->size != 0) {
lag_last_draw = now; lag_last_draw = now;
move(ypos, item->xpos); move(ypos, item->xpos);
set_color((1 << 4)+3); addch('['); set_color(sbar_color_dim); addch('[');
set_color((1 << 4)+7); addstr("Lag: "); set_color(sbar_color_normal); addstr("Lag: ");
set_color((1 << 4)+15); addstr(str->str); set_color(sbar_color_bold); addstr(str->str);
set_color((1 << 4)+3); addch(']'); set_color(sbar_color_dim); addch(']');
screen_refresh(); screen_refresh();
} }
@ -635,11 +641,11 @@ static void statusbar_mail(SBAR_ITEM_REC *item, int ypos)
return; return;
move(ypos, item->xpos); move(ypos, item->xpos);
set_color((1 << 4)+3); addch('['); set_color(sbar_color_dim); addch('[');
set_color((1 << 4)+7); addstr("Mail: "); set_color(sbar_color_normal); addstr("Mail: ");
set_color((1 << 4)+15); addstr(str); set_color(sbar_color_bold); addstr(str);
set_color((1 << 4)+3); addch(']'); set_color(sbar_color_dim); addch(']');
screen_refresh(); screen_refresh();
} }
@ -663,7 +669,8 @@ static void statusbar_topic(SBAR_ITEM_REC *item, int ypos)
} }
move(ypos, item->xpos); move(ypos, item->xpos);
set_bg((1<<4)+7); clrtoeol(); set_bg(0); set_bg(settings_get_int("statusbar_background") << 4);
clrtoeol(); set_bg(0);
if (active_win == NULL) if (active_win == NULL)
return; return;
@ -677,7 +684,7 @@ static void statusbar_topic(SBAR_ITEM_REC *item, int ypos)
if (topic != NULL) { if (topic != NULL) {
topic = strip_codes(topic); topic = strip_codes(topic);
str = g_strdup_printf("%.*s", item->size, topic); str = g_strdup_printf("%.*s", item->size, topic);
set_color((1<<4)+15); addstr(str); set_color(sbar_color_bold); addstr(str);
g_free(str); g_free(str);
g_free(topic); g_free(topic);
} }
@ -814,6 +821,19 @@ static void read_settings(void)
topicbar_destroy(); topicbar_destroy();
lag_min_show = settings_get_int("lag_min_show")*10; 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);
} }
void statusbar_items_init(void) void statusbar_items_init(void)
@ -825,6 +845,13 @@ void statusbar_items_init(void)
settings_add_bool("lookandfeel", "actlist_moves", FALSE); settings_add_bool("lookandfeel", "actlist_moves", FALSE);
settings_add_bool("misc", "mail_counter", TRUE); settings_add_bool("misc", "mail_counter", TRUE);
settings_add_int("colors", "statusbar_background", 1);
settings_add_int("colors", "statusbar_dim", 3);
settings_add_int("colors", "statusbar_normal", 7);
settings_add_int("colors", "statusbar_bold", 15);
settings_add_int("colors", "statusbar_away", 10);
settings_add_int("colors", "statusbar_act_highlight", 13);
/* clock */ /* clock */
clock_timetag = g_timeout_add(1000, (GSourceFunc) statusbar_clock_timeout, NULL); clock_timetag = g_timeout_add(1000, (GSourceFunc) statusbar_clock_timeout, NULL);

View file

@ -21,6 +21,7 @@
#include "module.h" #include "module.h"
#include "signals.h" #include "signals.h"
#include "server.h" #include "server.h"
#include "settings.h"
#include "windows.h" #include "windows.h"
@ -118,7 +119,7 @@ void statusbar_redraw(STATUSBAR_REC *bar)
return; return;
} }
set_bg((1<<4)+15); set_bg(settings_get_int("statusbar_background") << 4);
move(bar->ypos, 0); clrtoeol(); move(bar->ypos, 0); clrtoeol();
set_bg(0); set_bg(0);
@ -159,7 +160,7 @@ STATUSBAR_REC *statusbar_create(int pos, int ypos)
rec->line -= sbar_lowest; rec->line -= sbar_lowest;
} }
set_bg((1<<4)+15); set_bg(settings_get_int("statusbar_background") << 4);
move(rec->ypos, 0); clrtoeol(); move(rec->ypos, 0); clrtoeol();
set_bg(0); set_bg(0);