From c5b4fc4a80563390610938e36c6e9dc71337c754 Mon Sep 17 00:00:00 2001 From: James Booth Date: Thu, 22 Nov 2012 02:01:49 +0000 Subject: [PATCH] Added input text to theme --- src/input_win.c | 3 ++- src/status_bar.c | 1 + src/theme.c | 5 +++++ src/theme.h | 23 +++++++++++++++++++++++ src/title_bar.c | 1 + src/ui.h | 22 ---------------------- 6 files changed, 32 insertions(+), 23 deletions(-) diff --git a/src/input_win.c b/src/input_win.c index 7d5a7485..5ad64d80 100644 --- a/src/input_win.c +++ b/src/input_win.c @@ -58,6 +58,7 @@ #include "log.h" #include "preferences.h" #include "profanity.h" +#include "theme.h" #include "ui.h" static WINDOW *inp_win; @@ -79,7 +80,7 @@ create_input_window(void) getmaxyx(stdscr, rows, cols); inp_win = newpad(1, INP_WIN_MAX); - wbkgd(inp_win, COLOR_PAIR(1)); + wbkgd(inp_win, COLOUR_INPUT_TEXT); keypad(inp_win, TRUE); wmove(inp_win, 0, 0); prefresh(inp_win, 0, pad_start, rows-1, 0, rows-1, cols-1); diff --git a/src/status_bar.c b/src/status_bar.c index 37a9bce4..efc12dde 100644 --- a/src/status_bar.c +++ b/src/status_bar.c @@ -32,6 +32,7 @@ #include #endif +#include "theme.h" #include "ui.h" static WINDOW *status_bar; diff --git a/src/theme.c b/src/theme.c index 71c2d5f4..b6e18afa 100644 --- a/src/theme.c +++ b/src/theme.c @@ -69,6 +69,7 @@ static struct colours_t { NCURSES_COLOR_T statusbaractive; NCURSES_COLOR_T statusbarnew; NCURSES_COLOR_T maintext; + NCURSES_COLOR_T inputtext; NCURSES_COLOR_T splashtext; NCURSES_COLOR_T online; NCURSES_COLOR_T away; @@ -156,6 +157,7 @@ theme_init_colours(void) init_pair(2, colour_prefs.splashtext, colour_prefs.bkgnd); init_pair(3, colour_prefs.error, colour_prefs.bkgnd); init_pair(4, colour_prefs.incoming, colour_prefs.bkgnd); + init_pair(5, colour_prefs.inputtext, colour_prefs.bkgnd); // title bar init_pair(10, colour_prefs.titlebartext, colour_prefs.titlebar); @@ -252,6 +254,9 @@ _load_colours(void) gchar *splashtext_val = g_key_file_get_string(theme, "colours", "splashtext", NULL); _set_colour(splashtext_val, &colour_prefs.splashtext, COLOR_CYAN); + gchar *inputtext_val = g_key_file_get_string(theme, "colours", "inputtext", NULL); + _set_colour(inputtext_val, &colour_prefs.inputtext, COLOR_WHITE); + gchar *online_val = g_key_file_get_string(theme, "colours", "online", NULL); _set_colour(online_val, &colour_prefs.online, COLOR_GREEN); diff --git a/src/theme.h b/src/theme.h index 1f348d61..459135d6 100644 --- a/src/theme.h +++ b/src/theme.h @@ -34,6 +34,29 @@ #include #endif +#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_INPUT_TEXT COLOR_PAIR(5) +#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) + void theme_load(const char * const theme_name); void theme_init_colours(void); gboolean theme_change(const char * const theme_name); diff --git a/src/title_bar.c b/src/title_bar.c index 1ebe4f09..08c8c6db 100644 --- a/src/title_bar.c +++ b/src/title_bar.c @@ -24,6 +24,7 @@ #include #include "common.h" +#include "theme.h" #include "ui.h" static WINDOW *title_bar; diff --git a/src/ui.h b/src/ui.h index 2d441abf..5aebf546 100644 --- a/src/ui.h +++ b/src/ui.h @@ -38,28 +38,6 @@ #define INP_WIN_MAX 1000 -#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, WIN_CONSOLE,