Finish 256 colour support for Irssi

256 colour patch is cleaned up and the remaining cases are made work,
this includes especially Theme support, which was not implemented
before. Changes not related to colours were reverted again, making a
review of the two patches against master easier to follow.

As a byproduct of the Hex-colour code parser, the 24bit colours are
also implemented. Actually using them in the terminal is guarded by a
compile time switch (as well as a run time switch), as it breaks the
existing colour protocol and requires additional storage.

To make a seamless usage, down-conversion is provided for 8 and 16
colours.

Diverging from Tom's approach, the colour protocol is reverted back to
the original one. Unfortunately, the changes required in the Theme
engine will break the API.

For more details, please refer to the patch documentation at either
http://irssi-docs.wikispaces.com/Notes-256-Colour or
https://github.com/shabble/irssi-docs/wiki/Notes-256-Colour
This commit is contained in:
Ailin Nemui 2014-01-09 15:20:29 +01:00
commit 96a292d40e
28 changed files with 904 additions and 493 deletions

View file

@ -55,9 +55,6 @@ static int no_autoconnect;
static char *cmdline_nick;
static char *cmdline_hostname;
static char *irssi_logfile = NULL;
static FILE * logfile_FILE = NULL;
void fe_core_log_init(void);
void fe_core_log_deinit(void);
@ -123,26 +120,13 @@ static void sig_channel_destroyed(CHANNEL_REC *channel)
void fe_common_core_register_options(void)
{
static GOptionEntry options[]
= {
{ "connect", 'c', 0, G_OPTION_ARG_STRING, &autocon_server,
"Automatically connect to server/network", "SERVER"
},
{ "password", 'w', 0, G_OPTION_ARG_STRING, &autocon_password,
"Autoconnect password", "PASSWORD"
},
{ "port", 'p', 0, G_OPTION_ARG_INT, &autocon_port,
"Autoconnect port", "PORT" },
{ "noconnect", '!', 0, G_OPTION_ARG_NONE, &no_autoconnect,
"Disable autoconnecting", NULL },
static GOptionEntry options[] = {
{ "connect", 'c', 0, G_OPTION_ARG_STRING, &autocon_server, "Automatically connect to server/network", "SERVER" },
{ "password", 'w', 0, G_OPTION_ARG_STRING, &autocon_password, "Autoconnect password", "PASSWORD" },
{ "port", 'p', 0, G_OPTION_ARG_INT, &autocon_port, "Autoconnect port", "PORT" },
{ "noconnect", '!', 0, G_OPTION_ARG_NONE, &no_autoconnect, "Disable autoconnecting", NULL },
{ "nick", 'n', 0, G_OPTION_ARG_STRING, &cmdline_nick, "Specify nick to use", NULL },
{ "hostname", 'h', 0, G_OPTION_ARG_STRING, &cmdline_hostname,
"Specify host name to use", NULL },
{ "logfile", 0, 0, G_OPTION_ARG_FILENAME, &irssi_logfile,
"Logfile to write debugging data which would otherwise be printed " \
"to STDERR or as Irssi internal messages", "PATH"
},
{ "hostname", 'h', 0, G_OPTION_ARG_STRING, &cmdline_hostname, "Specify host name to use", NULL },
{ NULL }
};
@ -159,9 +143,6 @@ void fe_common_core_init(void)
{
const char *str;
logfile_FILE = g_fopen(irssi_logfile, "a");
if (logfile_FILE == NULL) irssi_logfile = NULL;
settings_add_bool("lookandfeel", "timestamps", TRUE);
settings_add_level("lookandfeel", "timestamp_level", "ALL");
settings_add_time("lookandfeel", "timestamp_timeout", "0");
@ -262,10 +243,6 @@ void fe_common_core_deinit(void)
signal_remove("server disconnected", (SIGNAL_FUNC) sig_disconnected);
signal_remove("channel created", (SIGNAL_FUNC) sig_channel_created);
signal_remove("channel destroyed", (SIGNAL_FUNC) sig_channel_destroyed);
if (irssi_logfile && logfile_FILE) {
fclose(logfile_FILE);
}
}
void glog_func(const char *log_domain, GLogLevelFlags log_level,
@ -280,24 +257,17 @@ void glog_func(const char *log_domain, GLogLevelFlags log_level,
case G_LOG_LEVEL_CRITICAL:
reason = "critical";
break;
case G_LOG_LEVEL_MESSAGE:
reason = "msg";
break;
default:
reason = "error";
break;
}
if (irssi_logfile != NULL && logfile_FILE != NULL) {
fprintf(logfile_FILE, "GLib: %s: %s", reason, message);
fflush(logfile_FILE);
} else { // if (windows == NULL)
fprintf(stderr, "GLib %s: %s", reason, message);
if (windows == NULL)
fprintf(stderr, "GLib %s: %s\n", reason, message);
else {
printformat(NULL, NULL, MSGLEVEL_CLIENTERROR,
TXT_GLIB_ERROR, reason, message);
}
/* else { */
/* printformat(NULL, NULL, MSGLEVEL_CLIENTERROR, */
/* TXT_GLIB_ERROR, reason, message); */
/* } */
}
#define MSGS_WINDOW_LEVELS (MSGLEVEL_MSGS|MSGLEVEL_ACTIONS|MSGLEVEL_DCCMSGS)