5 #include "fe-windows.h"
7 #define GUI_PRINT_FLAG_BOLD 0x0001
8 #define GUI_PRINT_FLAG_REVERSE 0x0002
9 #define GUI_PRINT_FLAG_UNDERLINE 0x0004
10 #define GUI_PRINT_FLAG_BLINK 0x0008
11 #define GUI_PRINT_FLAG_MIRC_COLOR 0x0010
12 #define GUI_PRINT_FLAG_INDENT 0x0020
13 #define GUI_PRINT_FLAG_INDENT_FUNC 0x0040
14 #define GUI_PRINT_FLAG_NEWLINE 0x0080
15 #define GUI_PRINT_FLAG_CLRTOEOL 0x0100
17 #define MAX_FORMAT_PARAMS 10
18 #define DEFAULT_FORMAT_ARGLIST_SIZE 200
32 int paramtypes[MAX_FORMAT_PARAMS];
35 #define PRINT_FLAG_SET_LINE_START 0x0001
36 #define PRINT_FLAG_SET_LINE_START_IRSSI 0x0002
37 #define PRINT_FLAG_UNSET_LINE_START 0x0003
39 #define PRINT_FLAG_SET_TIMESTAMP 0x0004
40 #define PRINT_FLAG_UNSET_TIMESTAMP 0x0008
42 #define PRINT_FLAG_SET_SERVERTAG 0x0010
43 #define PRINT_FLAG_UNSET_SERVERTAG 0x0020
48 const char *server_tag; /* if server is non-NULL, must be server->tag */
57 #define window_get_theme(window) \
58 (window != NULL && (window)->theme != NULL ? \
59 (window)->theme : current_theme)
61 int format_find_tag(const char *module, const char *tag);
63 /* Return length of text part in string (ie. without % codes) */
64 int format_get_length(const char *str);
65 /* Return how many characters in `str' must be skipped before `len'
66 characters of text is skipped. Like strip_real_length(), except this
68 int format_real_length(const char *str, int len);
70 char *format_string_expand(const char *text, int *flags);
72 char *format_get_text(const char *module, WINDOW_REC *window,
73 void *server, const char *target,
76 /* good size for buffer is DEFAULT_FORMAT_ARGLIST_SIZE */
77 void format_read_arglist(va_list va, FORMAT_REC *format,
78 char **arglist, int arglist_size,
79 char *buffer, int buffer_size);
80 char *format_get_text_theme(THEME_REC *theme, const char *module,
81 TEXT_DEST_REC *dest, int formatnum, ...);
82 char *format_get_text_theme_args(THEME_REC *theme, const char *module,
83 TEXT_DEST_REC *dest, int formatnum,
85 char *format_get_text_theme_charargs(THEME_REC *theme, const char *module,
86 TEXT_DEST_REC *dest, int formatnum,
89 /* add `linestart' to start of each line in `text'. `text' may contain
90 multiple lines separated with \n. */
91 char *format_add_linestart(const char *text, const char *linestart);
93 /* return the "-!- " text at the start of the line */
94 char *format_get_level_tag(THEME_REC *theme, TEXT_DEST_REC *dest);
96 /* return timestamp + server tag */
97 char *format_get_line_start(THEME_REC *theme, TEXT_DEST_REC *dest, time_t t);
100 /* "private" functions for printtext */
101 void format_create_dest(TEXT_DEST_REC *dest,
102 void *server, const char *target,
103 int level, WINDOW_REC *window);
104 void format_create_dest_tag(TEXT_DEST_REC *dest, void *server,
105 const char *server_tag, const char *target,
106 int level, WINDOW_REC *window);
108 void format_newline(WINDOW_REC *window);
110 /* Return how many characters in `str' must be skipped before `len'
111 characters of text is skipped. */
112 int strip_real_length(const char *str, int len,
113 int *last_color_pos, int *last_color_len);
115 /* strip all color (etc.) codes from `input'.
116 Returns newly allocated string. */
117 char *strip_codes(const char *input);
119 /* send a fully parsed text string for GUI to print */
120 void format_send_to_gui(TEXT_DEST_REC *dest, const char *text);
122 #define FORMAT_COLOR_NOCHANGE ('0'-1) /* don't change this, at least hilighting depends this value */
124 #define FORMAT_STYLE_SPECIAL 0x60
125 #define FORMAT_STYLE_BLINK (0x01 + FORMAT_STYLE_SPECIAL)
126 #define FORMAT_STYLE_UNDERLINE (0x02 + FORMAT_STYLE_SPECIAL)
127 #define FORMAT_STYLE_BOLD (0x03 + FORMAT_STYLE_SPECIAL)
128 #define FORMAT_STYLE_REVERSE (0x04 + FORMAT_STYLE_SPECIAL)
129 #define FORMAT_STYLE_INDENT (0x05 + FORMAT_STYLE_SPECIAL)
130 #define FORMAT_STYLE_INDENT_FUNC (0x06 + FORMAT_STYLE_SPECIAL)
131 #define FORMAT_STYLE_DEFAULTS (0x07 + FORMAT_STYLE_SPECIAL)
132 #define FORMAT_STYLE_CLRTOEOL (0x08 + FORMAT_STYLE_SPECIAL)
133 int format_expand_styles(GString *out, const char **format, int *flags);
135 void formats_init(void);
136 void formats_deinit(void);