comparison ui.h @ 501:ca88945d8eda

Begin work on integrating the removal of ncurses "windowing" and transition to internally managing the screen as whole.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 01 Jun 2012 12:00:11 +0300
parents 56689f94e827
children 60e04709ce0f
comparison
equal deleted inserted replaced
500:78447d70f9d3 501:ca88945d8eda
17 #endif 17 #endif
18 #include "th_types.h" 18 #include "th_types.h"
19 #include "th_string.h" 19 #include "th_string.h"
20 20
21 21
22 #define SET_MAX_WINDOWS (32) 22 #define SET_MAX_WINDOWS (32)
23 #define NN_BACKBUF_LEN (512) // Backbuffer size (in lines) 23 #define NN_BACKBUF_LEN (512) // Backbuffer size (in lines)
24
25
26 typedef struct
27 {
28 char *buf;
29 size_t chlen, len, bufsize;
30 } nn_line_t;
31
24 32
25 typedef struct 33 typedef struct
26 { 34 {
27 qringbuf_t *data; // "Backbuffer" data for this window 35 qringbuf_t *data; // "Backbuffer" data for this window
28 int pos; // Current position in the window, 0 = real time 36 int pos; // Current position in the window, 0 = real time
29 BOOL dirty; 37 BOOL dirty;
30 38
39 int num;
31 char *id; // Chatter ID, NULL = main window 40 char *id; // Chatter ID, NULL = main window
32 int num; // Window number
33 41
34 char *buf; 42 nn_line_t *line;
35 size_t len, bufsize;
36 size_t chlen;
37 } nn_window_t; 43 } nn_window_t;
38 44
39 45
40 extern nn_window_t *currWin; 46 extern nn_window_t *currWin;
41 extern BOOL cursesInit; 47 extern BOOL cursesInit;
42 extern WINDOW *mainWin, *statusWin, *editWin;
43 48
44 BOOL nnwin_init(int delay); 49 BOOL nnwin_init(int delay);
45 void nnwin_shutdown(); 50 void nnwin_shutdown();
51 void nnwin_reset(void);
46 52
47 BOOL nnwin_init_windows(void); 53 void nnwin_update(BOOL force, nn_editbuf_t *ebuf, char *optUserName, int optUserColor);
48 void nnwin_close_windows(void);
49 54
50 nn_window_t *nnwin_main_window(); 55 nn_window_t * nnwin_main_window();
51 nn_window_t *nnwin_get(const int index); 56 nn_window_t * nnwin_get(const int index);
52 nn_window_t *nnwin_find(const char *id); 57 nn_window_t * nnwin_find(const char *id);
58 void nnwin_set_current(nn_window_t *);
53 59
54 BOOL nnwin_open(const char *name, BOOL curwin); 60 BOOL nnwin_open(const char *name, BOOL curwin);
55 void nnwin_close(nn_window_t *win); 61 void nnwin_close(nn_window_t *win);
56 62
57 void nnwin_update_statusline(char *optUserName, int optUserColor); 63 int nnwin_print(nn_window_t *win, const char *fmt);
58 void nnwin_update_editbuf(nn_editbuf_t *buf); 64 char * nnwin_prompt_requester(const char *info, BOOL allowEmpty);
59 int nnwin_print(WINDOW *win, const char *fmt);
60 int nnwin_print_buf(nn_window_t *win, const char *fmt);
61 char * nnwin_prompt_requester(WINDOW *win, const char *info, BOOL allowEmpty);
62 BOOL nnwin_update_main(BOOL force);
63
64 65
65 #endif 66 #endif