5 #include "fe-windows.h"
7 #define PRINTFLAG_BOLD 0x01
8 #define PRINTFLAG_REVERSE 0x02
9 #define PRINTFLAG_UNDERLINE 0x04
10 #define PRINTFLAG_BLINK 0x08
11 #define PRINTFLAG_MIRC_COLOR 0x10
12 #define PRINTFLAG_INDENT 0x20
13 #define PRINTFLAG_NEWLINE 0x40
15 #define MAX_FORMAT_PARAMS 10
16 #define DEFAULT_FORMAT_ARGLIST_SIZE 200
30 int paramtypes[MAX_FORMAT_PARAMS];
43 int format_find_tag(const char *module, const char *tag);
45 /* Return length of text part in string (ie. without % codes) */
46 int format_get_length(const char *str);
47 /* Return how many characters in `str' must be skipped before `len'
48 characters of text is skipped. Like strip_real_length(), except this
50 int format_real_length(const char *str, int len);
52 char *format_string_expand(const char *text);
54 char *format_get_text(const char *module, WINDOW_REC *window,
55 void *server, const char *target,
58 /* good size for buffer is DEFAULT_FORMAT_ARGLIST_SIZE */
59 void format_read_arglist(va_list va, FORMAT_REC *format,
60 char **arglist, int arglist_size,
61 char *buffer, int buffer_size);
62 char *format_get_text_theme(THEME_REC *theme, const char *module,
63 TEXT_DEST_REC *dest, int formatnum, ...);
64 char *format_get_text_theme_args(THEME_REC *theme, const char *module,
65 TEXT_DEST_REC *dest, int formatnum,
67 char *format_get_text_theme_charargs(THEME_REC *theme, const char *module,
68 TEXT_DEST_REC *dest, int formatnum,
71 /* add `linestart' to start of each line in `text'. `text' may contain
72 multiple lines separated with \n. */
73 char *format_add_linestart(const char *text, const char *linestart);
75 /* return the "-!- " text at the start of the line */
76 char *format_get_level_tag(THEME_REC *theme, TEXT_DEST_REC *dest);
78 /* return timestamp + server tag */
79 char *format_get_line_start(THEME_REC *theme, TEXT_DEST_REC *dest, time_t t);
82 /* "private" functions for printtext */
83 void format_create_dest(TEXT_DEST_REC *dest,
84 void *server, const char *target,
85 int level, WINDOW_REC *window);
87 void format_newline(WINDOW_REC *window);
89 /* Return how many characters in `str' must be skipped before `len'
90 characters of text is skipped. */
91 int strip_real_length(const char *str, int len,
92 int *last_color_pos, int *last_color_len);
94 /* strip all color (etc.) codes from `input'.
95 Returns newly allocated string. */
96 char *strip_codes(const char *input);
98 /* send a fully parsed text string for GUI to print */
99 void format_send_to_gui(TEXT_DEST_REC *dest, const char *text);
101 #define FORMAT_COLOR_NOCHANGE ('0'-1) /* don't change this, at least hilighting depends this value */
103 #define FORMAT_STYLE_SPECIAL 0x60
104 #define FORMAT_STYLE_BLINK (0x01 + FORMAT_STYLE_SPECIAL)
105 #define FORMAT_STYLE_UNDERLINE (0x02 + FORMAT_STYLE_SPECIAL)
106 #define FORMAT_STYLE_BOLD (0x03 + FORMAT_STYLE_SPECIAL)
107 #define FORMAT_STYLE_REVERSE (0x04 + FORMAT_STYLE_SPECIAL)
108 #define FORMAT_STYLE_INDENT (0x05 + FORMAT_STYLE_SPECIAL)
109 #define FORMAT_STYLE_DEFAULTS (0x06 + FORMAT_STYLE_SPECIAL)
110 int format_expand_styles(GString *out, char format);
112 void formats_init(void);
113 void formats_deinit(void);