add italics support; don't use standout for reverse

This commit is contained in:
Lukas Mai 2011-11-06 20:40:25 +01:00 committed by Ailin Nemui
commit 0e294d5c2e
12 changed files with 98 additions and 20 deletions

View file

@ -207,6 +207,11 @@ int format_expand_styles(GString *out, const char **format, int *flags)
g_string_append_c(out, 4);
g_string_append_c(out, FORMAT_STYLE_REVERSE);
break;
case 'I':
/* italic */
g_string_append_c(out, 4);
g_string_append_c(out, FORMAT_STYLE_ITALIC);
break;
case ':':
/* Newline */
g_string_append_c(out, '\n');
@ -913,6 +918,14 @@ static const char *get_ansi_color(THEME_REC *theme, const char *str,
/* normal */
flags &= ~GUI_PRINT_FLAG_BOLD;
break;
case 3:
/* italic */
flags |= GUI_PRINT_FLAG_ITALIC;
break;
case 23:
/* not italic */
flags &= ~GUI_PRINT_FLAG_ITALIC;
break;
case 4:
/* underline */
flags |= GUI_PRINT_FLAG_UNDERLINE;
@ -1085,7 +1098,7 @@ static void get_mirc_color(const char **str, int *fg_ret, int *bg_ret)
#define IS_COLOR_CODE(c) \
((c) == 2 || (c) == 3 || (c) == 4 || (c) == 6 || (c) == 7 || \
(c) == 15 || (c) == 22 || (c) == 27 || (c) == 31)
(c) == 15 || (c) == 22 || (c) == 27 || (c) == 29 || (c) == 31)
/* Return how many characters in `str' must be skipped before `len'
characters of text is skipped. */
@ -1282,6 +1295,9 @@ void format_send_to_gui(TEXT_DEST_REC *dest, const char *text)
case FORMAT_STYLE_REVERSE:
flags ^= GUI_PRINT_FLAG_REVERSE;
break;
case FORMAT_STYLE_ITALIC:
flags ^= GUI_PRINT_FLAG_ITALIC;
break;
case FORMAT_STYLE_MONOSPACE:
flags ^= GUI_PRINT_FLAG_MONOSPACE;
break;
@ -1356,6 +1372,11 @@ void format_send_to_gui(TEXT_DEST_REC *dest, const char *text)
if (!hide_text_style)
flags ^= GUI_PRINT_FLAG_REVERSE;
break;
case 29:
/* italic */
if (!hide_text_style)
flags ^= GUI_PRINT_FLAG_ITALIC;
break;
case 31:
/* underline */
if (!hide_text_style)

View file

@ -10,6 +10,7 @@
#define GUI_PRINT_FLAG_BLINK 0x0008
#define GUI_PRINT_FLAG_MIRC_COLOR 0x0010
#define GUI_PRINT_FLAG_INDENT 0x0020
#define GUI_PRINT_FLAG_ITALIC 0x0040
#define GUI_PRINT_FLAG_NEWLINE 0x0080
#define GUI_PRINT_FLAG_CLRTOEOL 0x0100
#define GUI_PRINT_FLAG_MONOSPACE 0x0200
@ -139,6 +140,7 @@ void format_send_to_gui(TEXT_DEST_REC *dest, const char *text);
#define FORMAT_STYLE_BOLD (0x03 + FORMAT_STYLE_SPECIAL)
#define FORMAT_STYLE_REVERSE (0x04 + FORMAT_STYLE_SPECIAL)
#define FORMAT_STYLE_INDENT (0x05 + FORMAT_STYLE_SPECIAL)
#define FORMAT_STYLE_ITALIC (0x06 + FORMAT_STYLE_SPECIAL)
#define FORMAT_STYLE_DEFAULTS (0x07 + FORMAT_STYLE_SPECIAL)
#define FORMAT_STYLE_CLRTOEOL (0x08 + FORMAT_STYLE_SPECIAL)
#define FORMAT_STYLE_MONOSPACE (0x09 + FORMAT_STYLE_SPECIAL)