diff 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
line wrap: on
line diff
--- a/ui.h	Fri Jun 01 06:11:11 2012 +0300
+++ b/ui.h	Fri Jun 01 12:00:11 2012 +0300
@@ -19,47 +19,48 @@
 #include "th_string.h"
 
 
-#define SET_MAX_WINDOWS (32)
+#define SET_MAX_WINDOWS   (32)
 #define NN_BACKBUF_LEN    (512)       // Backbuffer size (in lines)
 
+
+typedef struct
+{
+    char *buf;
+    size_t chlen, len, bufsize;
+} nn_line_t;
+
+
 typedef struct
 {
     qringbuf_t *data;   // "Backbuffer" data for this window
     int pos;            // Current position in the window, 0 = real time
     BOOL dirty;
 
+    int num;
     char *id;           // Chatter ID, NULL = main window
-    int num;		// Window number
 
-    char *buf;
-    size_t len, bufsize;
-    size_t chlen;
+    nn_line_t *line;
 } nn_window_t;
 
 
 extern nn_window_t *currWin;
 extern BOOL cursesInit;
-extern WINDOW *mainWin, *statusWin, *editWin;
 
-BOOL nnwin_init(int delay);
-void nnwin_shutdown();
+BOOL           nnwin_init(int delay);
+void           nnwin_shutdown();
+void           nnwin_reset(void);
 
-BOOL nnwin_init_windows(void);
-void nnwin_close_windows(void);
+void           nnwin_update(BOOL force, nn_editbuf_t *ebuf, char *optUserName, int optUserColor);
 
-nn_window_t *nnwin_main_window();
-nn_window_t *nnwin_get(const int index);
-nn_window_t *nnwin_find(const char *id);
-
-BOOL     nnwin_open(const char *name, BOOL curwin);
-void     nnwin_close(nn_window_t *win);
+nn_window_t *  nnwin_main_window();
+nn_window_t *  nnwin_get(const int index);
+nn_window_t *  nnwin_find(const char *id);
+void           nnwin_set_current(nn_window_t *);
 
-void     nnwin_update_statusline(char *optUserName, int optUserColor);
-void     nnwin_update_editbuf(nn_editbuf_t *buf);
-int      nnwin_print(WINDOW *win, const char *fmt);
-int      nnwin_print_buf(nn_window_t *win, const char *fmt);
-char *   nnwin_prompt_requester(WINDOW *win, const char *info, BOOL allowEmpty);
-BOOL     nnwin_update_main(BOOL force);
+BOOL           nnwin_open(const char *name, BOOL curwin);
+void           nnwin_close(nn_window_t *win);
 
+int            nnwin_print(nn_window_t *win, const char *fmt);
+char *         nnwin_prompt_requester(const char *info, BOOL allowEmpty);
 
 #endif