ekg2
|
00001 #ifndef __EKG_NCURSES_OLD_H 00002 #define __EKG_NCURSES_OLD_H 00003 00004 #include "ekg2-config.h" 00005 00006 #include "ecurses.h" 00007 00008 #include <ekg/commands.h> 00009 #include <ekg/plugins.h> 00010 #include <ekg/themes.h> 00011 #include <ekg/windows.h> 00012 00013 void ncurses_init(void); 00014 void ncurses_deinit(void); 00015 00016 extern plugin_t ncurses_plugin; 00017 00018 // int ncurses_resize_term; 00019 00020 extern int ncurses_plugin_destroyed; 00021 00022 #define LINE_MAXLEN 1000 /* rozmiar linii */ 00023 #define MULTILINE_INPUT_SIZE 5 00024 00025 #define ncurses_current ((ncurses_window_t *) window_current->priv_data) 00026 00027 void update_statusbar(int commit); 00028 00029 struct screen_line { 00030 int len; /* długość linii */ 00031 00032 CHAR_T *str; /* treść */ 00033 short *attr; /* atrybuty */ 00034 00035 CHAR_T *prompt_str; /* treść promptu */ 00036 short *prompt_attr; /* atrybuty promptu */ 00037 int prompt_len; /* długość promptu */ 00038 00039 char *ts; /* timestamp */ 00040 short *ts_attr; /* attributes of the timestamp */ 00041 00042 int backlog; /* z której linii backlogu pochodzi? */ 00043 int margin_left; /* where the margin should be setted */ 00044 }; 00045 00046 enum window_frame_t { 00047 WF_LEFT = 1, 00048 WF_TOP = 2, 00049 WF_RIGHT = 4, 00050 WF_BOTTOM = 8, 00051 WF_ALL = 15 00052 }; 00053 00054 typedef struct { 00055 WINDOW *window; /* okno okna */ 00056 00057 char *prompt; /* sformatowany prompt lub NULL */ 00058 int prompt_len; /* długość prompta lub 0 */ 00059 00060 int margin_left, margin_right, margin_top, margin_bottom; 00061 /* marginesy */ 00062 00063 fstring_t **backlog; /* bufor z liniami */ 00064 int backlog_size; /* rozmiar backloga */ 00065 00066 int redraw; /* trzeba przerysować przed wyświetleniem */ 00067 00068 int start; /* od której linii zaczyna się wyświetlanie */ 00069 int lines_count; /* ilość linii ekranowych w backlogu */ 00070 struct screen_line *lines; 00071 /* linie ekranowe */ 00072 00073 int overflow; /* ilość nadmiarowych linii w okienku */ 00074 00075 int (*handle_redraw)(window_t *w); 00076 /* obsługa przerysowania zawartości okna */ 00077 00078 void (*handle_mouse)(int x, int y, int state); 00079 00080 CHAR_T *prompt_real; /* prompt shortened to 2/3 of window width & converted to real chartype */ 00081 int prompt_real_len; /* real prompt length, including cutting, in chars instead of bytes */ 00082 time_t last_red_line; /* timestamp for red line marker */ 00083 } ncurses_window_t; 00084 00085 struct format_data { 00086 char *name; /* %{nazwa} */ 00087 char *text; /* treść */ 00088 }; 00089 00090 extern WINDOW *ncurses_contacts; 00091 extern WINDOW *ncurses_input; 00092 00093 QUERY(ncurses_session_disconnect_handler); 00094 00095 void ncurses_update_real_prompt(ncurses_window_t *n); 00096 void ncurses_resize(void); 00097 int ncurses_backlog_add(window_t *w, fstring_t *str); 00098 int ncurses_backlog_split(window_t *w, int full, int removed); 00099 void ncurses_redraw(window_t *w); 00100 void ncurses_redraw_input(unsigned int ch); 00101 void ncurses_clear(window_t *w, int full); 00102 void ncurses_refresh(void); 00103 void ncurses_commit(void); 00104 void ncurses_input_update(int new_line_index); 00105 void ncurses_line_adjust(void); 00106 #define line_adjust ncurses_line_adjust 00107 void ncurses_lines_adjust(void); 00108 #define lines_adjust ncurses_lines_adjust 00109 int ncurses_window_kill(window_t *w); 00110 int ncurses_window_new(window_t *w); 00111 00112 #define input ncurses_input 00113 #define header ncurses_header 00114 #define contacts ncurses_contacts 00115 #define history ncurses_history 00116 #define history_index ncurses_history_index 00117 #define line_index ncurses_line_index 00118 #define line_start ncurses_line_start 00119 #define lines_index ncurses_lines_index 00120 #define lines_start ncurses_lines_start 00121 #define input_size ncurses_input_size 00122 #define yanked ncurses_yanked 00123 00124 #define HISTORY_MAX 1000 00125 extern CHAR_T *ncurses_history[HISTORY_MAX]; 00126 extern int ncurses_history_index; 00127 extern CHAR_T *ncurses_line; 00128 extern CHAR_T *ncurses_yanked; 00129 extern CHAR_T **ncurses_lines; 00130 extern int ncurses_line_start; 00131 extern int ncurses_line_index; 00132 extern int ncurses_lines_start; 00133 extern int ncurses_lines_index; 00134 extern int ncurses_input_size; 00135 extern int ncurses_debug; 00136 00137 void header_statusbar_resize(const char *dummy); 00138 #ifdef WITH_ASPELL 00139 void ncurses_spellcheck_init(); 00140 00141 extern int config_aspell; 00142 extern char *config_aspell_lang; 00143 #endif 00144 void changed_backlog_size(const char *var); 00145 00146 extern int config_backlog_size; 00147 extern int config_display_transparent; 00148 extern int config_enter_scrolls; 00149 extern int config_header_size; 00150 extern int config_margin_size; 00151 extern int config_statusbar_size; 00152 extern int config_kill_irc_window; 00153 00154 extern int config_text_bottomalign; 00155 extern int config_typing_timeout; 00156 extern int config_typing_timeout_empty; 00157 00158 int ncurses_lastlog_update(window_t *w); 00159 void ncurses_lastlog_new(window_t *w); 00160 extern int config_lastlog_size; 00161 extern int config_lastlog_lock; 00162 extern int config_mark_on_window_change; 00163 00164 WATCHER(ncurses_watch_stdin); 00165 WATCHER(ncurses_watch_winch); 00166 int ncurses_command_window(void *data, va_list ap); 00167 COMMAND(cmd_mark); 00168 00169 extern int have_winch_pipe; 00170 extern int winch_pipe[2]; 00171 00172 #ifndef COLOR_DEFAULT 00173 # define COLOR_DEFAULT (-1) 00174 #endif 00175 00176 #endif 00177 00178 /* 00179 * Local Variables: 00180 * mode: c 00181 * c-file-style: "k&r" 00182 * c-basic-offset: 8 00183 * indent-tabs-mode: t 00184 * End: 00185 */