ekg2  GIT master
nc-stuff.h
Idź do dokumentacji tego pliku.
1 #ifndef __EKG_NCURSES_NC_STUFF_H
2 #define __EKG_NCURSES_NC_STUFF_H
3 
4 #include "ecurses.h"
5 
6 void ncurses_init(void);
7 void ncurses_deinit(void);
8 
10 
11 // int ncurses_resize_term;
12 
13 extern int ncurses_plugin_destroyed;
14 
15 #define LINE_MAXLEN 1000 /* max line length */
16 #define MULTILINE_INPUT_SIZE 5
17 
18 #define ncurses_current ((ncurses_window_t *) window_current->priv_data)
19 
20 void update_statusbar(int commit);
21 
22 struct screen_line { /* everything locale-encoded */
23  int len; /* line length */
24 
25  unsigned char *str; /* content */
26  fstr_attr_t *attr; /* attributes */
27 
28  unsigned char *prompt_str; /* prompt string */
29  fstr_attr_t *prompt_attr; /* prompt attributes */
30  int prompt_len; /* prompt length */
31 
32  char *ts; /* timestamp */
33  fstr_attr_t *ts_attr; /* attributes of the timestamp */
34 
35  int backlog; /* backlog line it comes from */
36  int margin_left; /* where the margin should be set */
37 };
38 
40  WF_LEFT = 1,
41  WF_TOP = 2,
42  WF_RIGHT = 4,
43  WF_BOTTOM = 8,
44  WF_ALL = 15
45 };
46 
47 typedef struct {
48  WINDOW *window; /* WINDOW of a window */
49 
50  /* -- the input prompt -- */
51  gchar *prompt; /* prompt target or NULL */
52  int prompt_len; /* prompt length or 0 */
53 
54  int margin_left, margin_right, margin_top, margin_bottom;
55  /* margins */
56 
57  fstring_t **backlog; /* buffer with lines */
58  int backlog_size; /* backlog size */
59 
60  int redraw; /* does it have to be redrawn before display */
61 
62  int start; /* from which line displaying starts */
63  int lines_count; /* number of screen lines in backlog */
64  struct screen_line *lines;
65  /* screen lines */
66 
67  int overflow; /* number of superfluous lines in a window */
68 
69  int (*handle_redraw)(window_t *w);
70  /* window contents redraw handler */
71 
72  void (*handle_mouse)(int x, int y, int state);
73 
74  time_t last_red_line; /* timestamp for red line marker */
76 
77 extern WINDOW *ncurses_contacts;
78 extern WINDOW *ncurses_input;
79 
81 
82 gboolean ncurses_simple_print(WINDOW *w, const char *s, fstr_attr_t attr, gssize maxx);
83 const char *ncurses_fstring_print(WINDOW *w, const char *s, const fstr_attr_t *attr, gssize maxx);
84 
85 void ncurses_prompt_set(window_t *w, const gchar *str);
87 void ncurses_resize(void);
88 void ncurses_redraw(window_t *w);
89 void ncurses_redraw_input(unsigned int ch);
90 void ncurses_clear(window_t *w, int full);
91 void ncurses_refresh(void);
92 void ncurses_commit(void);
95 
96 #define contacts ncurses_contacts
97 #define history ncurses_history
98 #define history_index ncurses_history_index
99 
100 #define HISTORY_MAX 1000
102 extern int ncurses_history_index;
103 extern int ncurses_debug;
104 
105 void header_statusbar_resize(const char *dummy);
106 void changed_backlog_size(const char *var);
107 
108 extern int config_backlog_size;
110 
111 extern int config_display_transparent;
112 extern int config_enter_scrolls;
113 extern int config_margin_size;
114 extern int config_kill_irc_window;
115 
116 extern int config_text_bottomalign;
117 
120 extern int config_lastlog_size;
121 extern int config_lastlog_lock;
123 
126 int ncurses_command_window(void *data, va_list ap);
128 
129 extern int have_winch_pipe;
130 extern int winch_pipe[2];
131 
132 extern int ncurses_screen_height;
133 extern int ncurses_screen_width;
134 
135 int color_pair(int fg, int bg);
136 int ncurses_backlog_add_real(window_t *w, /*locale*/ fstring_t *str);
137 
139 
140 #ifndef COLOR_DEFAULT
141 # define COLOR_DEFAULT (-1)
142 #endif
143 
144 #endif
145 
146 /*
147  * Local Variables:
148  * mode: c
149  * c-file-style: "k&r"
150  * c-basic-offset: 8
151  * indent-tabs-mode: t
152  * End:
153  */
int config_lastlog_size
Definition: main.c:50
int margin_left
Definition: nc-stuff.h:36
WINDOW * window
Definition: nc-stuff.h:48
int ncurses_lastlog_update(window_t *w)
Definition: lastlog.c:111
int config_backlog_scroll_half_page
Definition: main.c:44
int ncurses_debug
Definition: nc-stuff.c:53
int prompt_len
Definition: nc-stuff.h:30
WINDOW * ncurses_input
Definition: nc-stuff.c:47
Definition: nc-stuff.h:22
int config_lastlog_lock
Definition: main.c:51
Definition: nc-stuff.h:44
int ncurses_command_window(void *data, va_list ap)
Definition: themes.h:36
void ncurses_prompt_set(window_t *w, const gchar *str)
Definition: nc-stuff.c:71
WATCHER(ncurses_watch_stdin)
void ncurses_redraw_input(unsigned int ch)
Definition: input.c:464
WINDOW * ncurses_contacts
Definition: nc-stuff.c:48
int cmd_mark(const char *name, const char **params, session_t *session, const char *target, int quiet)
Definition: nc-stuff.c:435
void changed_backlog_size(const char *var)
Definition: backlog.c:346
void ncurses_update_real_prompt(ncurses_window_t *n)
Definition: input.c:123
#define HISTORY_MAX
Definition: nc-stuff.h:100
int backlog
Definition: nc-stuff.h:35
int config_display_transparent
Definition: main.c:45
void ncurses_commit(void)
Definition: nc-stuff.c:126
int ncurses_watch_winch(int type, int fd, watch_type_t watch, void *data)
Definition: input.c:380
fstr_attr_t * prompt_attr
Definition: nc-stuff.h:29
Definition: plugins.h:76
void update_statusbar(int commit)
Definition: statusbar.c:310
char * ts
Definition: nc-stuff.h:32
int have_winch_pipe
Definition: nc-stuff.c:61
int ncurses_plugin_destroyed
Definition: main.c:59
COMMAND(cmd_mark)
int len
Definition: nc-stuff.h:23
struct screen_line * lines
Definition: nc-stuff.h:64
void ncurses_init(void)
Definition: nc-stuff.c:815
char ch
Definition: completion.c:638
void ncurses_redraw(window_t *w)
Definition: nc-stuff.c:483
int config_kill_irc_window
Definition: main.c:49
int color_pair(int fg, int bg)
Definition: nc-stuff.c:104
void ncurses_refresh(void)
Definition: nc-stuff.c:722
void ncurses_clear(window_t *w, int full)
Definition: nc-stuff.c:675
QUERY(ncurses_session_disconnect_handler)
int ncurses_session_disconnect_handler(void *data, va_list ap)
Definition: nc-stuff.c:81
int ncurses_screen_height
Definition: nc-stuff.c:55
Definition: nc-stuff.h:40
time_t last_red_line
Definition: nc-stuff.h:74
fstr_attr_t * attr
Definition: nc-stuff.h:26
wchar_t ncurses_fixchar(wchar_t ch, int *attr)
Definition: nc-stuff.c:338
gboolean ncurses_simple_print(WINDOW *w, const char *s, fstr_attr_t attr, gssize maxx)
Definition: nc-stuff.c:375
gchar * prompt
Definition: nc-stuff.h:51
Definition: httprc_xajax.c:45
unsigned char * str
Definition: nc-stuff.h:25
window_frame_t
Definition: nc-stuff.h:39
const char * ncurses_fstring_print(WINDOW *w, const char *s, const fstr_attr_t *attr, gssize maxx)
Definition: nc-stuff.c:409
int ncurses_window_new(window_t *w)
Definition: nc-stuff.c:984
plugin_t ncurses_plugin
Definition: main.c:41
guint16 fstr_attr_t
Definition: themes.h:34
int config_margin_size
Definition: main.c:47
#define CHAR_T
Definition: nc-strings.h:37
void ncurses_deinit(void)
Definition: nc-stuff.c:922
int ncurses_history_index
Definition: nc-stuff.c:51
Definition: windows.h:67
wchar_t * ncurses_history[1000]
Definition: nc-stuff.c:50
int config_backlog_size
Definition: main.c:43
Definition: nc-stuff.h:43
int config_enter_scrolls
Definition: main.c:46
void ncurses_resize(void)
Definition: nc-stuff.c:145
int winch_pipe[2]
Definition: nc-stuff.c:60
int ncurses_window_kill(window_t *w)
Definition: nc-stuff.c:771
int config_text_bottomalign
Definition: main.c:52
Definition: nc-stuff.h:42
unsigned char * prompt_str
Definition: nc-stuff.h:28
#define s
int ncurses_screen_width
Definition: nc-stuff.c:56
Definition: nc-stuff.h:41
int config_mark_on_window_change
Definition: main.c:48
void header_statusbar_resize(const char *dummy)
Definition: statusbar.c:504
int ncurses_watch_stdin(int type, int fd, watch_type_t watch, void *data)
Definition: input.c:587
int ncurses_backlog_add_real(window_t *w, fstring_t *str)
Definition: backlog.c:290
void ncurses_lastlog_new(window_t *w)
Definition: lastlog.c:164
fstr_attr_t * ts_attr
Definition: nc-stuff.h:33