2000-04-26 04:03:38 -04:00
|
|
|
#ifndef __GUI_WINDOWS_H
|
|
|
|
#define __GUI_WINDOWS_H
|
|
|
|
|
2000-08-26 11:39:44 -04:00
|
|
|
#include "servers.h"
|
2000-05-04 06:32:42 -04:00
|
|
|
#include "mainwindows.h"
|
2000-04-26 04:03:38 -04:00
|
|
|
|
|
|
|
#define WINDOW_GUI(a) ((GUI_WINDOW_REC *) ((a)->gui_data))
|
|
|
|
|
|
|
|
#define is_window_visible(win) \
|
|
|
|
(WINDOW_GUI(win)->parent->active == (win))
|
|
|
|
|
|
|
|
#define LINE_TEXT_CHUNK_SIZE 2048
|
|
|
|
|
|
|
|
/* 7 first bits of LINE_REC's info byte. */
|
2000-05-04 06:32:42 -04:00
|
|
|
enum {
|
|
|
|
LINE_CMD_EOL=0x80, /* line ends here. */
|
|
|
|
LINE_CMD_CONTINUE, /* line continues in next block */
|
2000-07-16 13:08:53 -04:00
|
|
|
LINE_CMD_COLOR0, /* change to black, would be same as \0\0 but it breaks things.. */
|
2000-05-04 06:32:42 -04:00
|
|
|
LINE_CMD_COLOR8, /* change to dark grey, normally 8 = bold black */
|
|
|
|
LINE_CMD_UNDERLINE, /* enable/disable underlining */
|
2000-11-12 15:20:05 -05:00
|
|
|
LINE_CMD_INDENT, /* if line is split, indent it at this position */
|
|
|
|
LINE_CMD_BLINK, /* blinking background */
|
2000-11-20 22:00:05 -05:00
|
|
|
LINE_CMD_FORMAT, /* end of line, but next will come the format that was used to create the
|
2000-11-12 15:20:05 -05:00
|
|
|
text in format <module><format_name><arg><arg2...> - fields are separated
|
|
|
|
with \0<format> and last argument ends with \0<eol>. \0<continue> is allowed
|
|
|
|
anywhere */
|
2000-11-20 22:00:05 -05:00
|
|
|
LINE_CMD_FORMAT_CONT /* multiline format, continues to next line */
|
2000-04-26 04:03:38 -04:00
|
|
|
};
|
|
|
|
|
2000-05-15 04:25:45 -04:00
|
|
|
typedef struct {
|
|
|
|
char *start;
|
|
|
|
int indent;
|
|
|
|
int color;
|
2000-11-23 16:40:07 -05:00
|
|
|
unsigned int continues:1; /* first word in line belong to the end of the last word in previous line */
|
2000-05-15 04:25:45 -04:00
|
|
|
} LINE_CACHE_SUB_REC;
|
|
|
|
|
|
|
|
typedef struct {
|
2000-06-14 16:12:51 -04:00
|
|
|
time_t last_access;
|
|
|
|
|
2000-05-15 04:25:45 -04:00
|
|
|
int count; /* number of real lines */
|
|
|
|
LINE_CACHE_SUB_REC *lines;
|
|
|
|
} LINE_CACHE_REC;
|
|
|
|
|
2000-05-04 06:32:42 -04:00
|
|
|
typedef struct {
|
|
|
|
/* text in the line. \0 means that the next char will be a
|
|
|
|
color or command. <= 127 = color or if 8.bit is set, the
|
2000-07-16 13:08:53 -04:00
|
|
|
first 7 bits are the command. See LINE_CMD_xxxx.
|
|
|
|
|
|
|
|
DO NOT ADD BLACK WITH \0\0 - this will break things. Use
|
|
|
|
LINE_CMD_COLOR0 instead. */
|
2000-05-04 06:32:42 -04:00
|
|
|
char *text;
|
|
|
|
|
|
|
|
int level;
|
|
|
|
time_t time;
|
|
|
|
} LINE_REC;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
char buffer[LINE_TEXT_CHUNK_SIZE];
|
|
|
|
int pos;
|
|
|
|
int lines;
|
|
|
|
} TEXT_CHUNK_REC;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
MAIN_WINDOW_REC *parent;
|
|
|
|
|
|
|
|
GMemChunk *line_chunk;
|
|
|
|
GSList *text_chunks;
|
|
|
|
GList *lines;
|
2000-05-15 04:25:45 -04:00
|
|
|
GHashTable *line_cache;
|
2000-05-04 06:32:42 -04:00
|
|
|
|
2000-11-20 22:00:05 -05:00
|
|
|
LINE_REC *cur_line, *temp_line;
|
2000-05-04 06:32:42 -04:00
|
|
|
TEXT_CHUNK_REC *cur_text;
|
|
|
|
|
|
|
|
int xpos, ypos; /* cursor position in screen */
|
|
|
|
GList *startline; /* line at the top of the screen */
|
|
|
|
int subline; /* number of "real lines" to skip from `startline' */
|
|
|
|
|
|
|
|
GList *bottom_startline; /* marks the bottom of the text buffer */
|
|
|
|
int bottom_subline;
|
|
|
|
int empty_linecount; /* how many empty lines are in screen.
|
|
|
|
a screenful when started or used /CLEAR */
|
2000-11-23 16:40:07 -05:00
|
|
|
unsigned int bottom:1; /* window is at the bottom of the text buffer */
|
|
|
|
unsigned int eol_marked:1; /* last line marked for eol */
|
2000-05-04 06:32:42 -04:00
|
|
|
|
2000-06-15 19:00:52 -04:00
|
|
|
/* For /LAST -new and -away */
|
|
|
|
GList *lastlog_last_check;
|
|
|
|
GList *lastlog_last_away;
|
|
|
|
|
2000-05-04 06:32:42 -04:00
|
|
|
/* for gui-printtext.c */
|
|
|
|
int last_subline;
|
|
|
|
int last_color, last_flags;
|
|
|
|
} GUI_WINDOW_REC;
|
2000-04-26 04:03:38 -04:00
|
|
|
|
|
|
|
void gui_windows_init(void);
|
|
|
|
void gui_windows_deinit(void);
|
|
|
|
|
|
|
|
WINDOW_REC *gui_window_create(MAIN_WINDOW_REC *parent);
|
|
|
|
|
|
|
|
void gui_window_set_server(WINDOW_REC *window, SERVER_REC *server);
|
2000-05-04 06:32:42 -04:00
|
|
|
GList *gui_window_find_text(WINDOW_REC *window, char *text, GList *startline, int regexp, int fullword);
|
2000-04-26 04:03:38 -04:00
|
|
|
|
|
|
|
/* get number of real lines that line record takes */
|
2000-05-04 06:32:42 -04:00
|
|
|
int gui_window_get_linecount(GUI_WINDOW_REC *gui, LINE_REC *line);
|
2000-05-15 04:25:45 -04:00
|
|
|
void gui_window_cache_remove(GUI_WINDOW_REC *gui, LINE_REC *line);
|
2000-05-04 06:32:42 -04:00
|
|
|
int gui_window_line_draw(GUI_WINDOW_REC *gui, LINE_REC *line, int ypos, int skip, int max);
|
2000-04-26 04:03:38 -04:00
|
|
|
|
|
|
|
void gui_window_clear(WINDOW_REC *window);
|
|
|
|
void gui_window_redraw(WINDOW_REC *window);
|
2000-11-20 22:00:05 -05:00
|
|
|
void gui_window_reformat_line(WINDOW_REC *window, LINE_REC *line);
|
2000-05-04 06:32:42 -04:00
|
|
|
void gui_window_resize(WINDOW_REC *window, int ychange, int xchange);
|
|
|
|
void gui_window_reparent(WINDOW_REC *window, MAIN_WINDOW_REC *parent);
|
2000-04-26 04:03:38 -04:00
|
|
|
|
2000-06-30 15:45:28 -04:00
|
|
|
#define is_window_bottom(gui) \
|
|
|
|
((gui)->ypos >= -1 && (gui)->ypos <= (gui)->parent->last_line-(gui)->parent->first_line)
|
|
|
|
|
2000-12-17 02:39:22 -05:00
|
|
|
void window_update_prompt(void);
|
2000-05-15 04:25:45 -04:00
|
|
|
void gui_window_newline(GUI_WINDOW_REC *gui, int visible);
|
2000-05-04 06:32:42 -04:00
|
|
|
void gui_window_scroll(WINDOW_REC *window, int lines);
|
2000-06-30 15:45:28 -04:00
|
|
|
void gui_window_update_ypos(GUI_WINDOW_REC *gui);
|
2000-04-26 04:03:38 -04:00
|
|
|
|
|
|
|
#endif
|