diff --git a/docs/profanity.1 b/docs/profanity.1 index fc5cd37a..552613c5 100644 --- a/docs/profanity.1 +++ b/docs/profanity.1 @@ -83,31 +83,40 @@ vercheck=true .PP [colours] .br -away=magenta +bkgnd=default .br -chat=yellow +titlebar=blue .br -xa=blue +statusbar=blue .br -online=white +titlebartext=white +.br +titlebarbrackets=cyan +.br +statusbartext=white +.br +statusbarbrackets=cyan +.br +statusbaractive=cyan +.br +statusbarnew=white +.br +maintext=white +.br +splashtext=cyan +.br +online=green +.br +away=cyan +.br +chat=green .br dnd=red .br -offline=cyan +xa=cyan .br -bkgnd=default +offline=red .br -text=white -.br -err=red -.br -inc=yellow -.br -bar=green -.br -bar_draw=black -.br -bar_text=black .PP [connections] .br diff --git a/src/preferences.c b/src/preferences.c index e5e9653e..9bfacd88 100644 --- a/src/preferences.c +++ b/src/preferences.c @@ -65,18 +65,29 @@ static struct colour_string_t colours[] = { // colour preferences static struct colours_t { NCURSES_COLOR_T bkgnd; - NCURSES_COLOR_T text; + NCURSES_COLOR_T titlebar; + NCURSES_COLOR_T statusbar; + NCURSES_COLOR_T titlebartext; + NCURSES_COLOR_T titlebarbrackets; + NCURSES_COLOR_T statusbartext; + NCURSES_COLOR_T statusbarbrackets; + NCURSES_COLOR_T statusbaractive; + NCURSES_COLOR_T statusbarnew; + NCURSES_COLOR_T maintext; + NCURSES_COLOR_T splashtext; NCURSES_COLOR_T online; NCURSES_COLOR_T away; - NCURSES_COLOR_T chat; - NCURSES_COLOR_T dnd; NCURSES_COLOR_T xa; + NCURSES_COLOR_T dnd; + NCURSES_COLOR_T chat; NCURSES_COLOR_T offline; - NCURSES_COLOR_T err; - NCURSES_COLOR_T inc; - NCURSES_COLOR_T bar; - NCURSES_COLOR_T bar_draw; - NCURSES_COLOR_T bar_text; + NCURSES_COLOR_T typing; + NCURSES_COLOR_T gone; + NCURSES_COLOR_T error; + NCURSES_COLOR_T incoming; + NCURSES_COLOR_T roominfo; + NCURSES_COLOR_T me; + NCURSES_COLOR_T them; } colour_prefs; static NCURSES_COLOR_T _lookup_colour(const char * const colour); @@ -171,41 +182,74 @@ _load_colours(void) gchar *bkgnd_val = g_key_file_get_string(prefs, "colours", "bkgnd", NULL); _set_colour(bkgnd_val, &colour_prefs.bkgnd, -1); - gchar *text_val = g_key_file_get_string(prefs, "colours", "text", NULL); - _set_colour(text_val, &colour_prefs.text, COLOR_WHITE); + gchar *titlebar_val = g_key_file_get_string(prefs, "colours", "titlebar", NULL); + _set_colour(titlebar_val, &colour_prefs.titlebar, COLOR_BLUE); + + gchar *statusbar_val = g_key_file_get_string(prefs, "colours", "statusbar", NULL); + _set_colour(statusbar_val, &colour_prefs.statusbar, COLOR_BLUE); + + gchar *titlebartext_val = g_key_file_get_string(prefs, "colours", "titlebartext", NULL); + _set_colour(titlebartext_val, &colour_prefs.titlebartext, COLOR_WHITE); + + gchar *titlebarbrackets_val = g_key_file_get_string(prefs, "colours", "titlebarbrackets", NULL); + _set_colour(titlebarbrackets_val, &colour_prefs.titlebarbrackets, COLOR_CYAN); + + gchar *statusbartext_val = g_key_file_get_string(prefs, "colours", "statusbartext", NULL); + _set_colour(statusbartext_val, &colour_prefs.statusbartext, COLOR_WHITE); + + gchar *statusbarbrackets_val = g_key_file_get_string(prefs, "colours", "statusbarbrackets", NULL); + _set_colour(statusbarbrackets_val, &colour_prefs.statusbarbrackets, COLOR_CYAN); + + gchar *statusbaractive_val = g_key_file_get_string(prefs, "colours", "statusbaractive", NULL); + _set_colour(statusbaractive_val, &colour_prefs.statusbaractive, COLOR_CYAN); + + gchar *statusbarnew_val = g_key_file_get_string(prefs, "colours", "statusbarnew", NULL); + _set_colour(statusbarnew_val, &colour_prefs.statusbarnew, COLOR_WHITE); + + gchar *maintext_val = g_key_file_get_string(prefs, "colours", "maintext", NULL); + _set_colour(maintext_val, &colour_prefs.maintext, COLOR_WHITE); + + gchar *splashtext_val = g_key_file_get_string(prefs, "colours", "splashtext", NULL); + _set_colour(splashtext_val, &colour_prefs.splashtext, COLOR_CYAN); gchar *online_val = g_key_file_get_string(prefs, "colours", "online", NULL); _set_colour(online_val, &colour_prefs.online, COLOR_GREEN); gchar *away_val = g_key_file_get_string(prefs, "colours", "away", NULL); - _set_colour(away_val, &colour_prefs.away, COLOR_GREEN); + _set_colour(away_val, &colour_prefs.away, COLOR_CYAN); gchar *chat_val = g_key_file_get_string(prefs, "colours", "chat", NULL); _set_colour(chat_val, &colour_prefs.chat, COLOR_GREEN); gchar *dnd_val = g_key_file_get_string(prefs, "colours", "dnd", NULL); - _set_colour(dnd_val, &colour_prefs.dnd, COLOR_GREEN); + _set_colour(dnd_val, &colour_prefs.dnd, COLOR_RED); gchar *xa_val = g_key_file_get_string(prefs, "colours", "xa", NULL); - _set_colour(xa_val, &colour_prefs.xa, COLOR_GREEN); + _set_colour(xa_val, &colour_prefs.xa, COLOR_CYAN); gchar *offline_val = g_key_file_get_string(prefs, "colours", "offline", NULL); - _set_colour(offline_val, &colour_prefs.offline, COLOR_CYAN); + _set_colour(offline_val, &colour_prefs.offline, COLOR_RED); - gchar *err_val = g_key_file_get_string(prefs, "colours", "err", NULL); - _set_colour(err_val, &colour_prefs.err, COLOR_RED); + gchar *typing_val = g_key_file_get_string(prefs, "colours", "typing", NULL); + _set_colour(typing_val, &colour_prefs.typing, COLOR_YELLOW); - gchar *inc_val = g_key_file_get_string(prefs, "colours", "inc", NULL); - _set_colour(inc_val, &colour_prefs.inc, COLOR_YELLOW); + gchar *gone_val = g_key_file_get_string(prefs, "colours", "gone", NULL); + _set_colour(gone_val, &colour_prefs.gone, COLOR_RED); - gchar *bar_val = g_key_file_get_string(prefs, "colours", "bar", NULL); - _set_colour(bar_val, &colour_prefs.bar, COLOR_BLUE); + gchar *error_val = g_key_file_get_string(prefs, "colours", "error", NULL); + _set_colour(error_val, &colour_prefs.error, COLOR_RED); - gchar *bar_draw_val = g_key_file_get_string(prefs, "colours", "bar_draw", NULL); - _set_colour(bar_draw_val, &colour_prefs.bar_draw, COLOR_CYAN); + gchar *incoming_val = g_key_file_get_string(prefs, "colours", "incoming", NULL); + _set_colour(incoming_val, &colour_prefs.incoming, COLOR_YELLOW); - gchar *bar_text_val = g_key_file_get_string(prefs, "colours", "bar_text", NULL); - _set_colour(bar_text_val, &colour_prefs.bar_text, COLOR_WHITE); + gchar *roominfo_val = g_key_file_get_string(prefs, "colours", "roominfo", NULL); + _set_colour(roominfo_val, &colour_prefs.roominfo, COLOR_YELLOW); + + gchar *me_val = g_key_file_get_string(prefs, "colours", "me", NULL); + _set_colour(me_val, &colour_prefs.me, COLOR_YELLOW); + + gchar *them_val = g_key_file_get_string(prefs, "colours", "them", NULL); + _set_colour(them_val, &colour_prefs.them, COLOR_GREEN); } char * @@ -475,9 +519,63 @@ prefs_get_bkgnd() } NCURSES_COLOR_T -prefs_get_text() +prefs_get_titlebar() { - return colour_prefs.text; + return colour_prefs.titlebar; +} + +NCURSES_COLOR_T +prefs_get_statusbar() +{ + return colour_prefs.statusbar; +} + +NCURSES_COLOR_T +prefs_get_titlebartext() +{ + return colour_prefs.titlebartext; +} + +NCURSES_COLOR_T +prefs_get_titlebarbrackets() +{ + return colour_prefs.titlebarbrackets; +} + +NCURSES_COLOR_T +prefs_get_statusbartext() +{ + return colour_prefs.statusbartext; +} + +NCURSES_COLOR_T +prefs_get_statusbarbrackets() +{ + return colour_prefs.statusbarbrackets; +} + +NCURSES_COLOR_T +prefs_get_statusbaractive() +{ + return colour_prefs.statusbaractive; +} + +NCURSES_COLOR_T +prefs_get_statusbarnew() +{ + return colour_prefs.statusbarnew; +} + +NCURSES_COLOR_T +prefs_get_maintext() +{ + return colour_prefs.maintext; +} + +NCURSES_COLOR_T +prefs_get_splashtext() +{ + return colour_prefs.splashtext; } NCURSES_COLOR_T @@ -517,31 +615,43 @@ prefs_get_offline() } NCURSES_COLOR_T -prefs_get_err() +prefs_get_typing() { - return colour_prefs.err; + return colour_prefs.typing; } NCURSES_COLOR_T -prefs_get_inc() +prefs_get_gone() { - return colour_prefs.inc; + return colour_prefs.gone; } NCURSES_COLOR_T -prefs_get_bar() +prefs_get_error() { - return colour_prefs.bar; + return colour_prefs.error; } NCURSES_COLOR_T -prefs_get_bar_draw() +prefs_get_incoming() { - return colour_prefs.bar_draw; + return colour_prefs.incoming; } NCURSES_COLOR_T -prefs_get_bar_text() +prefs_get_roominfo() { - return colour_prefs.bar_text; + return colour_prefs.roominfo; +} + +NCURSES_COLOR_T +prefs_get_me() +{ + return colour_prefs.me; +} + +NCURSES_COLOR_T +prefs_get_them() +{ + return colour_prefs.them; } diff --git a/src/preferences.h b/src/preferences.h index d045f517..bb45ee07 100644 --- a/src/preferences.h +++ b/src/preferences.h @@ -78,17 +78,28 @@ gint prefs_get_priority(void); void prefs_add_login(const char *jid); NCURSES_COLOR_T prefs_get_bkgnd(); -NCURSES_COLOR_T prefs_get_text(); +NCURSES_COLOR_T prefs_get_titlebar(); +NCURSES_COLOR_T prefs_get_statusbar(); +NCURSES_COLOR_T prefs_get_titlebartext(); +NCURSES_COLOR_T prefs_get_titlebarbrackets(); +NCURSES_COLOR_T prefs_get_statusbartext(); +NCURSES_COLOR_T prefs_get_statusbarbrackets(); +NCURSES_COLOR_T prefs_get_statusbaractive(); +NCURSES_COLOR_T prefs_get_statusbarnew(); +NCURSES_COLOR_T prefs_get_maintext(); +NCURSES_COLOR_T prefs_get_splashtext(); NCURSES_COLOR_T prefs_get_online(); NCURSES_COLOR_T prefs_get_away(); NCURSES_COLOR_T prefs_get_chat(); NCURSES_COLOR_T prefs_get_dnd(); NCURSES_COLOR_T prefs_get_xa(); NCURSES_COLOR_T prefs_get_offline(); -NCURSES_COLOR_T prefs_get_err(); -NCURSES_COLOR_T prefs_get_inc(); -NCURSES_COLOR_T prefs_get_bar(); -NCURSES_COLOR_T prefs_get_bar_draw(); -NCURSES_COLOR_T prefs_get_bar_text(); +NCURSES_COLOR_T prefs_get_typing(); +NCURSES_COLOR_T prefs_get_gone(); +NCURSES_COLOR_T prefs_get_error(); +NCURSES_COLOR_T prefs_get_incoming(); +NCURSES_COLOR_T prefs_get_roominfo(); +NCURSES_COLOR_T prefs_get_me(); +NCURSES_COLOR_T prefs_get_them(); #endif diff --git a/src/status_bar.c b/src/status_bar.c index ad042cd1..37a9bce4 100644 --- a/src/status_bar.c +++ b/src/status_bar.c @@ -56,10 +56,10 @@ create_status_bar(void) } status_bar = newwin(1, cols, rows-2, 0); - wbkgd(status_bar, COLOUR_BAR_DEF); - wattron(status_bar, COLOUR_BAR_DRAW); + wbkgd(status_bar, COLOUR_STATUS_TEXT); + wattron(status_bar, COLOUR_STATUS_BRACKET); mvwprintw(status_bar, 0, cols - 29, _active); - wattroff(status_bar, COLOUR_BAR_DRAW); + wattroff(status_bar, COLOUR_STATUS_BRACKET); last_time = g_date_time_new_now_local(); @@ -95,11 +95,11 @@ status_bar_resize(void) mvwin(status_bar, rows-2, 0); wresize(status_bar, 1, cols); - wbkgd(status_bar, COLOUR_BAR_DEF); + wbkgd(status_bar, COLOUR_STATUS_TEXT); wclear(status_bar); - wattron(status_bar, COLOUR_BAR_DRAW); + wattron(status_bar, COLOUR_STATUS_BRACKET); mvwprintw(status_bar, 0, cols - 29, _active); - wattroff(status_bar, COLOUR_BAR_DRAW); + wattroff(status_bar, COLOUR_STATUS_BRACKET); for(i = 0; i < 9; i++) { if (is_new[i]) @@ -142,12 +142,12 @@ status_bar_active(const int win) int cols = getmaxx(stdscr); - wattron(status_bar, COLOUR_BAR_DRAW); + wattron(status_bar, COLOUR_STATUS_ACTIVE); if (win < 9) mvwprintw(status_bar, 0, cols - 29 + active_pos, "%d", win+1); else mvwprintw(status_bar, 0, cols - 29 + active_pos, "10"); - wattroff(status_bar, COLOUR_BAR_DRAW); + wattroff(status_bar, COLOUR_STATUS_ACTIVE); dirty = TRUE; } @@ -162,13 +162,13 @@ status_bar_new(const int win) int cols = getmaxx(stdscr); - wattron(status_bar, COLOUR_BAR_TEXT); + wattron(status_bar, COLOUR_STATUS_NEW); wattron(status_bar, A_BLINK); if (win < 9) mvwprintw(status_bar, 0, cols - 29 + active_pos, "%d", win+1); else mvwprintw(status_bar, 0, cols - 29 + active_pos, "10"); - wattroff(status_bar, COLOUR_BAR_TEXT); + wattroff(status_bar, COLOUR_STATUS_NEW); wattroff(status_bar, A_BLINK); dirty = TRUE; @@ -197,9 +197,9 @@ status_bar_print_message(const char * const msg) int cols = getmaxx(stdscr); - wattron(status_bar, COLOUR_BAR_DRAW); + wattron(status_bar, COLOUR_STATUS_BRACKET); mvwprintw(status_bar, 0, cols - 29, _active); - wattroff(status_bar, COLOUR_BAR_DRAW); + wattroff(status_bar, COLOUR_STATUS_BRACKET); int i; for(i = 0; i < 9; i++) { @@ -230,9 +230,9 @@ status_bar_clear(void) int cols = getmaxx(stdscr); - wattron(status_bar, COLOUR_BAR_DRAW); + wattron(status_bar, COLOUR_STATUS_BRACKET); mvwprintw(status_bar, 0, cols - 29, _active); - wattroff(status_bar, COLOUR_BAR_DRAW); + wattroff(status_bar, COLOUR_STATUS_BRACKET); dirty = TRUE; } @@ -249,9 +249,9 @@ status_bar_clear_message(void) int cols = getmaxx(stdscr); - wattron(status_bar, COLOUR_BAR_DRAW); + wattron(status_bar, COLOUR_STATUS_BRACKET); mvwprintw(status_bar, 0, cols - 29, _active); - wattroff(status_bar, COLOUR_BAR_DRAW); + wattroff(status_bar, COLOUR_STATUS_BRACKET); int i; for(i = 0; i < 9; i++) { @@ -269,13 +269,13 @@ _status_bar_update_time(void) { gchar *date_fmt = g_date_time_format(last_time, "%H:%M"); - wattron(status_bar, COLOUR_BAR_DRAW); + wattron(status_bar, COLOUR_STATUS_BRACKET); mvwaddch(status_bar, 0, 1, '['); - wattroff(status_bar, COLOUR_BAR_DRAW); + wattroff(status_bar, COLOUR_STATUS_BRACKET); mvwprintw(status_bar, 0, 2, date_fmt); - wattron(status_bar, COLOUR_BAR_DRAW); + wattron(status_bar, COLOUR_STATUS_BRACKET); mvwaddch(status_bar, 0, 7, ']'); - wattroff(status_bar, COLOUR_BAR_DRAW); + wattroff(status_bar, COLOUR_STATUS_BRACKET); free(date_fmt); diff --git a/src/title_bar.c b/src/title_bar.c index 0bfed5ba..1ebe4f09 100644 --- a/src/title_bar.c +++ b/src/title_bar.c @@ -42,7 +42,7 @@ create_title_bar(void) int cols = getmaxx(stdscr); title_bar = newwin(1, cols, 0, 0); - wbkgd(title_bar, COLOUR_BAR_DEF); + wbkgd(title_bar, COLOUR_TITLE_TEXT); title_bar_title(); title_bar_set_status(PRESENCE_OFFLINE); dirty = TRUE; @@ -63,7 +63,7 @@ title_bar_resize(void) int cols = getmaxx(stdscr); wresize(title_bar, 1, cols); - wbkgd(title_bar, COLOUR_BAR_DEF); + wbkgd(title_bar, COLOUR_TITLE_TEXT); wclear(title_bar); _title_bar_draw_title(); _title_bar_draw_status(); @@ -173,9 +173,9 @@ _title_bar_draw_status(void) { int cols = getmaxx(stdscr); - wattron(title_bar, COLOUR_BAR_DRAW); + wattron(title_bar, COLOUR_TITLE_BRACKET); mvwaddch(title_bar, 0, cols - 14, '['); - wattroff(title_bar, COLOUR_BAR_DRAW); + wattroff(title_bar, COLOUR_TITLE_BRACKET); if (current_status == PRESENCE_ONLINE) { mvwprintw(title_bar, 0, cols - 13, " ...online "); @@ -191,9 +191,9 @@ _title_bar_draw_status(void) mvwprintw(title_bar, 0, cols - 13, " ..offline "); } - wattron(title_bar, COLOUR_BAR_DRAW); + wattron(title_bar, COLOUR_TITLE_BRACKET); mvwaddch(title_bar, 0, cols - 2, ']'); - wattroff(title_bar, COLOUR_BAR_DRAW); + wattroff(title_bar, COLOUR_TITLE_BRACKET); dirty = TRUE; } diff --git a/src/ui.h b/src/ui.h index 68ee89d2..3e30fd1a 100644 --- a/src/ui.h +++ b/src/ui.h @@ -38,18 +38,27 @@ #define INP_WIN_MAX 1000 -#define COLOUR_TEXT COLOR_PAIR(1) -#define COLOUR_ONLINE COLOR_PAIR(2) -#define COLOUR_BAR_TEXT COLOR_PAIR(3) -#define COLOUR_BAR_DRAW COLOR_PAIR(4) -#define COLOUR_OFFLINE COLOR_PAIR(5) -#define COLOUR_ERR COLOR_PAIR(6) -#define COLOUR_INC COLOR_PAIR(7) -#define COLOUR_BAR_DEF COLOR_PAIR(8) -#define COLOUR_AWAY COLOR_PAIR(9) -#define COLOUR_CHAT COLOR_PAIR(10) -#define COLOUR_DND COLOR_PAIR(11) -#define COLOUR_XA COLOR_PAIR(12) +#define COLOUR_TEXT COLOR_PAIR(1) +#define COLOUR_SPLASH COLOR_PAIR(2) +#define COLOUR_ERROR COLOR_PAIR(3) +#define COLOUR_INCOMING COLOR_PAIR(4) +#define COLOUR_TITLE_TEXT COLOR_PAIR(10) +#define COLOUR_TITLE_BRACKET COLOR_PAIR(11) +#define COLOUR_STATUS_TEXT COLOR_PAIR(20) +#define COLOUR_STATUS_BRACKET COLOR_PAIR(21) +#define COLOUR_STATUS_ACTIVE COLOR_PAIR(22) +#define COLOUR_STATUS_NEW COLOR_PAIR(23) +#define COLOUR_ME COLOR_PAIR(30) +#define COLOUR_THEM COLOR_PAIR(31) +#define COLOUR_ROOMINFO COLOR_PAIR(40) +#define COLOUR_ONLINE COLOR_PAIR(50) +#define COLOUR_OFFLINE COLOR_PAIR(51) +#define COLOUR_AWAY COLOR_PAIR(52) +#define COLOUR_CHAT COLOR_PAIR(53) +#define COLOUR_DND COLOR_PAIR(54) +#define COLOUR_XA COLOR_PAIR(55) +#define COLOUR_TYPING COLOR_PAIR(60) +#define COLOUR_GONE COLOR_PAIR(61) typedef enum { WIN_UNUSED, diff --git a/src/windows.c b/src/windows.c index 8913c963..16165487 100644 --- a/src/windows.c +++ b/src/windows.c @@ -114,20 +114,40 @@ gui_init(void) use_default_colors(); start_color(); - init_pair(1, prefs_get_text(), prefs_get_bkgnd()); - init_pair(2, prefs_get_online(), prefs_get_bkgnd()); - init_pair(3, prefs_get_text(), prefs_get_bar()); - init_pair(4, prefs_get_bar_draw(), prefs_get_bar()); - init_pair(5, prefs_get_offline(), prefs_get_bkgnd()); - init_pair(6, prefs_get_err(), prefs_get_bkgnd()); - init_pair(7, prefs_get_inc(), prefs_get_bkgnd()); - init_pair(8, prefs_get_bar_text(), prefs_get_bar()); + // main text + init_pair(1, prefs_get_maintext(), prefs_get_bkgnd()); + init_pair(2, prefs_get_splashtext(), prefs_get_bkgnd()); + init_pair(3, prefs_get_error(), prefs_get_bkgnd()); + init_pair(4, prefs_get_incoming(), prefs_get_bkgnd()); - //statuses - init_pair(9, prefs_get_away(), prefs_get_bkgnd()); - init_pair(10, prefs_get_chat(), prefs_get_bkgnd()); - init_pair(11, prefs_get_dnd(), prefs_get_bkgnd()); - init_pair(12, prefs_get_xa(), prefs_get_bkgnd()); + // title bar + init_pair(10, prefs_get_titlebartext(), prefs_get_titlebar()); + init_pair(11, prefs_get_titlebarbrackets(), prefs_get_titlebar()); + + // status bar + init_pair(20, prefs_get_statusbartext(), prefs_get_statusbar()); + init_pair(21, prefs_get_statusbarbrackets(), prefs_get_statusbar()); + init_pair(22, prefs_get_statusbaractive(), prefs_get_statusbar()); + init_pair(23, prefs_get_statusbarnew(), prefs_get_statusbar()); + + // chat + init_pair(30, prefs_get_me(), prefs_get_bkgnd()); + init_pair(31, prefs_get_them(), prefs_get_bkgnd()); + + // room chat + init_pair(40, prefs_get_roominfo(), prefs_get_bkgnd()); + + // statuses + init_pair(50, prefs_get_online(), prefs_get_bkgnd()); + init_pair(51, prefs_get_offline(), prefs_get_bkgnd()); + init_pair(52, prefs_get_away(), prefs_get_bkgnd()); + init_pair(53, prefs_get_chat(), prefs_get_bkgnd()); + init_pair(54, prefs_get_dnd(), prefs_get_bkgnd()); + init_pair(55, prefs_get_xa(), prefs_get_bkgnd()); + + // states + init_pair(60, prefs_get_typing(), prefs_get_bkgnd()); + init_pair(61, prefs_get_gone(), prefs_get_bkgnd()); } refresh(); @@ -408,11 +428,11 @@ win_show_incomming_msg(const char * const from, const char * const message, } if (strncmp(message, "/me ", 4) == 0) { - wattron(win, COLOUR_ONLINE); + wattron(win, COLOUR_THEM); wprintw(win, "*%s ", from); wprintw(win, message + 4); wprintw(win, "\n"); - wattroff(win, COLOUR_ONLINE); + wattroff(win, COLOUR_THEM); } else { _win_show_user(win, from, 1); _win_show_message(win, message); @@ -445,11 +465,11 @@ win_show_incomming_msg(const char * const from, const char * const message, } if (strncmp(message, "/me ", 4) == 0) { - wattron(win, COLOUR_ONLINE); + wattron(win, COLOUR_THEM); wprintw(win, "*%s ", from); wprintw(win, message + 4); wprintw(win, "\n"); - wattroff(win, COLOUR_ONLINE); + wattroff(win, COLOUR_THEM); } else { _win_show_user(win, from, 1); _win_show_message(win, message); @@ -499,11 +519,11 @@ win_show_gone(const char * const from) if (win_index < NUM_WINS) { win = _wins[win_index].win; _win_show_time(win); - wattron(win, COLOUR_AWAY); + wattron(win, COLOUR_GONE); wprintw(win, "*%s ", from); wprintw(win, "has left the conversation."); wprintw(win, "\n"); - wattroff(win, COLOUR_AWAY); + wattroff(win, COLOUR_GONE); if (win_index == _curr_prof_win) { dirty = TRUE; } @@ -533,9 +553,7 @@ win_show_system_msg(const char * const from, const char *message) win = _wins[win_index].win; _win_show_time(win); - wattron(win, COLOUR_ONLINE); wprintw(win, "*%s %s\n", bare_jid, message); - wattroff(win, COLOUR_ONLINE); // this is the current window if (win_index == _curr_prof_win) { @@ -645,11 +663,11 @@ win_show_outgoing_msg(const char * const from, const char * const to, _win_show_time(win); if (strncmp(message, "/me ", 4) == 0) { - wattron(win, COLOUR_INC); + wattron(win, COLOUR_ME); wprintw(win, "*%s ", from); wprintw(win, message + 4); wprintw(win, "\n"); - wattroff(win, COLOUR_INC); + wattroff(win, COLOUR_ME); } else { _win_show_user(win, from, 0); _win_show_message(win, message); @@ -679,13 +697,13 @@ win_show_room_roster(const char * const room) GList *roster = room_get_roster(room); if ((roster == NULL) || (g_list_length(roster) == 0)) { - wattron(win, COLOUR_INC); + wattron(win, COLOUR_ROOMINFO); wprintw(win, "You are alone!\n"); - wattroff(win, COLOUR_INC); + wattroff(win, COLOUR_ROOMINFO); } else { - wattron(win, COLOUR_INC); + wattron(win, COLOUR_ROOMINFO); wprintw(win, "Room occupants:\n"); - wattroff(win, COLOUR_INC); + wattroff(win, COLOUR_ROOMINFO); wattron(win, COLOUR_ONLINE); while (roster != NULL) { @@ -757,9 +775,9 @@ win_show_room_member_nick_change(const char * const room, WINDOW *win = _wins[win_index].win; _win_show_time(win); - wattron(win, COLOUR_ONLINE); + wattron(win, COLOUR_THEM); wprintw(win, "** %s is now known as %s\n", old_nick, nick); - wattroff(win, COLOUR_ONLINE); + wattroff(win, COLOUR_THEM); if (win_index == _curr_prof_win) dirty = TRUE; @@ -772,9 +790,9 @@ win_show_room_nick_change(const char * const room, const char * const nick) WINDOW *win = _wins[win_index].win; _win_show_time(win); - wattron(win, COLOUR_ONLINE); + wattron(win, COLOUR_ME); wprintw(win, "** You are now known as %s\n", nick); - wattroff(win, COLOUR_ONLINE); + wattroff(win, COLOUR_ME); if (win_index == _curr_prof_win) dirty = TRUE; @@ -816,11 +834,11 @@ win_show_room_message(const char * const room_jid, const char * const nick, _win_show_time(win); if (strcmp(nick, room_get_nick_for_room(room_jid)) != 0) { if (strncmp(message, "/me ", 4) == 0) { - wattron(win, COLOUR_ONLINE); + wattron(win, COLOUR_THEM); wprintw(win, "*%s ", nick); wprintw(win, message + 4); wprintw(win, "\n"); - wattroff(win, COLOUR_ONLINE); + wattroff(win, COLOUR_THEM); } else { _win_show_user(win, nick, 1); _win_show_message(win, message); @@ -828,11 +846,11 @@ win_show_room_message(const char * const room_jid, const char * const nick, } else { if (strncmp(message, "/me ", 4) == 0) { - wattron(win, COLOUR_INC); + wattron(win, COLOUR_ME); wprintw(win, "*%s ", nick); wprintw(win, message + 4); wprintw(win, "\n"); - wattroff(win, COLOUR_INC); + wattroff(win, COLOUR_ME); } else { _win_show_user(win, nick, 0); _win_show_message(win, message); @@ -879,9 +897,9 @@ win_show_room_subject(const char * const room_jid, const char * const subject) int win_index = _find_prof_win_index(room_jid); WINDOW *win = _wins[win_index].win; - wattron(win, COLOUR_INC); + wattron(win, COLOUR_ROOMINFO); wprintw(win, "Room subject: "); - wattroff(win, COLOUR_INC); + wattroff(win, COLOUR_ROOMINFO); wprintw(win, "%s\n", subject); // currently in groupchat window @@ -901,9 +919,9 @@ win_show_room_broadcast(const char * const room_jid, const char * const message) int win_index = _find_prof_win_index(room_jid); WINDOW *win = _wins[win_index].win; - wattron(win, COLOUR_INC); + wattron(win, COLOUR_ROOMINFO); wprintw(win, "Room message: "); - wattroff(win, COLOUR_INC); + wattroff(win, COLOUR_ROOMINFO); wprintw(win, "%s\n", message); // currently in groupchat window @@ -932,9 +950,9 @@ win_bad_show(const char * const msg) { WINDOW *win = _wins[_curr_prof_win].win; _win_show_time(win); - wattron(win, COLOUR_ERR); + wattron(win, COLOUR_ERROR); wprintw(win, "%s\n", msg); - wattroff(win, COLOUR_ERR); + wattroff(win, COLOUR_ERROR); dirty = TRUE; } @@ -992,9 +1010,9 @@ win_disconnected(void) if (strcmp(_wins[i].from, "") != 0) { WINDOW *win = _wins[i].win; _win_show_time(win); - wattron(win, COLOUR_ERR); + wattron(win, COLOUR_ERROR); wprintw(win, "%s\n", "Lost connection."); - wattroff(win, COLOUR_ERR); + wattroff(win, COLOUR_ERROR); // if current win, set dirty if (i == _curr_prof_win) { @@ -1210,9 +1228,9 @@ cons_bad_show(const char * const msg, ...) GString *fmt_msg = g_string_new(NULL); g_string_vprintf(fmt_msg, msg, arg); _win_show_time(_cons_win); - wattron(_cons_win, COLOUR_ERR); + wattron(_cons_win, COLOUR_ERROR); wprintw(_cons_win, "%s\n", fmt_msg->str); - wattroff(_cons_win, COLOUR_ERR); + wattroff(_cons_win, COLOUR_ERROR); g_string_free(fmt_msg, TRUE); va_end(arg); @@ -1381,13 +1399,9 @@ cons_check_version(gboolean not_available_msg) if (relase_valid) { if (_new_release(latest_release)) { _win_show_time(_cons_win); - wattron(_cons_win, COLOUR_ONLINE); wprintw(_cons_win, "A new version of Profanity is available: %s", latest_release); - wattroff(_cons_win, COLOUR_ONLINE); _win_show_time(_cons_win); - wattron(_cons_win, COLOUR_ONLINE); wprintw(_cons_win, "Check for details.\n"); - wattroff(_cons_win, COLOUR_ONLINE); free(latest_release); _win_show_time(_cons_win); wprintw(_cons_win, "\n"); @@ -1434,39 +1448,39 @@ _cons_splash_logo(void) wprintw(_cons_win, "Welcome to\n"); _win_show_time(_cons_win); - wattron(_cons_win, COLOUR_OFFLINE); + wattron(_cons_win, COLOUR_SPLASH); wprintw(_cons_win, " ___ _ \n"); - wattroff(_cons_win, COLOUR_OFFLINE); + wattroff(_cons_win, COLOUR_SPLASH); _win_show_time(_cons_win); - wattron(_cons_win, COLOUR_OFFLINE); + wattron(_cons_win, COLOUR_SPLASH); wprintw(_cons_win, " / __) (_)_ \n"); - wattroff(_cons_win, COLOUR_OFFLINE); + wattroff(_cons_win, COLOUR_SPLASH); _win_show_time(_cons_win); - wattron(_cons_win, COLOUR_OFFLINE); + wattron(_cons_win, COLOUR_SPLASH); wprintw(_cons_win, " ____ ____ ___ | |__ ____ ____ _| |_ _ _ \n"); - wattroff(_cons_win, COLOUR_OFFLINE); + wattroff(_cons_win, COLOUR_SPLASH); _win_show_time(_cons_win); - wattron(_cons_win, COLOUR_OFFLINE); + wattron(_cons_win, COLOUR_SPLASH); wprintw(_cons_win, "| _ \\ / ___) _ \\| __) _ | _ \\| | _) | | |\n"); - wattroff(_cons_win, COLOUR_OFFLINE); + wattroff(_cons_win, COLOUR_SPLASH); _win_show_time(_cons_win); - wattron(_cons_win, COLOUR_OFFLINE); + wattron(_cons_win, COLOUR_SPLASH); wprintw(_cons_win, "| | | | | | |_| | | ( ( | | | | | | |_| |_| |\n"); - wattroff(_cons_win, COLOUR_OFFLINE); + wattroff(_cons_win, COLOUR_SPLASH); _win_show_time(_cons_win); - wattron(_cons_win, COLOUR_OFFLINE); + wattron(_cons_win, COLOUR_SPLASH); wprintw(_cons_win, "| ||_/|_| \\___/|_| \\_||_|_| |_|_|\\___)__ |\n"); - wattroff(_cons_win, COLOUR_OFFLINE); + wattroff(_cons_win, COLOUR_SPLASH); _win_show_time(_cons_win); - wattron(_cons_win, COLOUR_OFFLINE); + wattron(_cons_win, COLOUR_SPLASH); wprintw(_cons_win, "|_| (____/ \n"); - wattroff(_cons_win, COLOUR_OFFLINE); + wattroff(_cons_win, COLOUR_SPLASH); _win_show_time(_cons_win); wprintw(_cons_win, "\n"); @@ -1543,14 +1557,14 @@ static void _win_show_user(WINDOW *win, const char * const user, const int colour) { if (colour) - wattron(win, COLOUR_ONLINE); + wattron(win, COLOUR_THEM); else - wattron(win, COLOUR_INC); + wattron(win, COLOUR_ME); wprintw(win, "%s: ", user); if (colour) - wattroff(win, COLOUR_ONLINE); + wattroff(win, COLOUR_THEM); else - wattroff(win, COLOUR_INC); + wattroff(win, COLOUR_ME); } static void @@ -1562,9 +1576,9 @@ _win_show_message(WINDOW *win, const char * const message) static void _win_show_error_msg(WINDOW *win, const char * const message) { - wattron(win, COLOUR_ERR); + wattron(win, COLOUR_ERROR); wprintw(win, "%s\n", message); - wattroff(win, COLOUR_ERR); + wattroff(win, COLOUR_ERROR); } static void @@ -1661,18 +1675,18 @@ static void _cons_show_typing(const char * const short_from) { _win_show_time(_cons_win); - wattron(_cons_win, COLOUR_INC); + wattron(_cons_win, COLOUR_TYPING); wprintw(_cons_win, "!! %s is typing a message...\n", short_from); - wattroff(_cons_win, COLOUR_INC); + wattroff(_cons_win, COLOUR_TYPING); } static void _cons_show_incoming_message(const char * const short_from, const int win_index) { _win_show_time(_cons_win); - wattron(_cons_win, COLOUR_INC); + wattron(_cons_win, COLOUR_INCOMING); wprintw(_cons_win, "<< incoming from %s (%d)\n", short_from, win_index + 1); - wattroff(_cons_win, COLOUR_INC); + wattroff(_cons_win, COLOUR_INCOMING); } static void