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
16 #define GUI_PRINT_FLAG_MONOSPACE 0x0200
18 #define MAX_FORMAT_PARAMS 10
19 #define DEFAULT_FORMAT_ARGLIST_SIZE 200
33 int paramtypes[MAX_FORMAT_PARAMS];
36 #define PRINT_FLAG_SET_LINE_START 0x0001
37 #define PRINT_FLAG_SET_LINE_START_IRSSI 0x0002
38 #define PRINT_FLAG_UNSET_LINE_START 0x0003
40 #define PRINT_FLAG_SET_TIMESTAMP 0x0004
41 #define PRINT_FLAG_UNSET_TIMESTAMP 0x0008
43 #define PRINT_FLAG_SET_SERVERTAG 0x0010
44 #define PRINT_FLAG_UNSET_SERVERTAG 0x0020
46 typedef struct _TEXT_DEST_REC {
49 const char *server_tag; /* if server is non-NULL, must be server->tag */
58 #define window_get_theme(window) \
59 (window != NULL && (window)->theme != NULL ? \
60 (window)->theme : current_theme)
62 int format_find_tag(const char *module, const char *tag);
64 /* Return length of text part in string (ie. without % codes) */
65 int format_get_length(const char *str);
66 /* Return how many characters in `str' must be skipped before `len'
67 characters of text is skipped. Like strip_real_length(), except this
69 int format_real_length(const char *str, int len);
71 char *format_string_expand(const char *text, int *flags);
73 char *format_get_text(const char *module, WINDOW_REC *window,
74 void *server, const char *target,
77 /* good size for buffer is DEFAULT_FORMAT_ARGLIST_SIZE */
78 void format_read_arglist(va_list va, FORMAT_REC *format,
79 char **arglist, int arglist_size,
80 char *buffer, int buffer_size);
81 char *format_get_text_theme(THEME_REC *theme, const char *module,
82 TEXT_DEST_REC *dest, int formatnum, ...);
83 char *format_get_text_theme_args(THEME_REC *theme, const char *module,
84 TEXT_DEST_REC *dest, int formatnum,
86 char *format_get_text_theme_charargs(THEME_REC *theme, const char *module,
87 TEXT_DEST_REC *dest, int formatnum,
90 /* add `linestart' to start/end of each line in `text'. `text' may contain
91 multiple lines separated with \n. */
92 char *format_add_linestart(const char *text, const char *linestart);
93 char *format_add_lineend(const char *text, const char *linestart);
95 /* return the "-!- " text at the start of the line */
96 char *format_get_level_tag(THEME_REC *theme, TEXT_DEST_REC *dest);
98 /* return timestamp + server tag */
99 char *format_get_line_start(THEME_REC *theme, TEXT_DEST_REC *dest, time_t t);
102 /* "private" functions for printtext */
103 void format_create_dest(TEXT_DEST_REC *dest,
104 void *server, const char *target,
105 int level, WINDOW_REC *window);
106 void format_create_dest_tag(TEXT_DEST_REC *dest, void *server,
107 const char *server_tag, const char *target,
108 int level, WINDOW_REC *window);
110 void format_newline(WINDOW_REC *window);
112 /* Return how many characters in `str' must be skipped before `len'
113 characters of text is skipped. */
114 int strip_real_length(const char *str, int len,
115 int *last_color_pos, int *last_color_len);
117 /* strip all color (etc.) codes from `input'.
118 Returns newly allocated string. */
119 char *strip_codes(const char *input);
121 /* send a fully parsed text string for GUI to print */
122 void format_send_to_gui(TEXT_DEST_REC *dest, const char *text);
124 #define FORMAT_COLOR_NOCHANGE ('0'-1) /* don't change this, at least hilighting depends this value */
126 #define FORMAT_STYLE_SPECIAL 0x60
127 #define FORMAT_STYLE_BLINK (0x01 + FORMAT_STYLE_SPECIAL)
128 #define FORMAT_STYLE_UNDERLINE (0x02 + FORMAT_STYLE_SPECIAL)
129 #define FORMAT_STYLE_BOLD (0x03 + FORMAT_STYLE_SPECIAL)
130 #define FORMAT_STYLE_REVERSE (0x04 + FORMAT_STYLE_SPECIAL)
131 #define FORMAT_STYLE_INDENT (0x05 + FORMAT_STYLE_SPECIAL)
132 #define FORMAT_STYLE_INDENT_FUNC (0x06 + FORMAT_STYLE_SPECIAL)
133 #define FORMAT_STYLE_DEFAULTS (0x07 + FORMAT_STYLE_SPECIAL)
134 #define FORMAT_STYLE_CLRTOEOL (0x08 + FORMAT_STYLE_SPECIAL)
135 #define FORMAT_STYLE_MONOSPACE (0x09 + FORMAT_STYLE_SPECIAL)
136 int format_expand_styles(GString *out, const char **format, int *flags);
138 void formats_init(void);
139 void formats_deinit(void);