include/screen.h
changeset 79 05328c643696
child 81 9008e2daa1b1
equal deleted inserted replaced
78:1253cacc0f21 79:05328c643696
       
     1 #ifndef __SCREEN_H__
       
     2 #define __SCREEN_H__ 1
       
     3 
       
     4 #include <glib.h>
       
     5 
       
     6 #if HAVE_NCURSESW_NCURSES_H
       
     7 # include <ncursesw/ncurses.h>
       
     8 # include <ncursesw/panel.h>
       
     9 #elif HAVE_NCURSES_NCURSES_H
       
    10 # include <ncurses/ncurses.h>
       
    11 # include <ncurses/panel.h>
       
    12 #else
       
    13 # include <ncurses.h>
       
    14 # include <panel.h>
       
    15 #endif
       
    16 
       
    17 #ifdef WITH_ASPELL
       
    18 void spellcheck_init(void);
       
    19 void spellcheck_deinit(void);
       
    20 //static void spellcheck(char*, char*);
       
    21 #endif
       
    22 
       
    23 #include "hbuf.h"
       
    24 #include "logprint.h"
       
    25 #include "roster.h"
       
    26 
       
    27 #define INPUTLINE_LENGTH  1024
       
    28 
       
    29 // Only used in screen.c; this is the maximum line number
       
    30 // in a multi-line message.  Should be < 1000
       
    31 // Note: message length is limited by the HBB_BLOCKSIZE size too
       
    32 #define MULTILINE_MAX_LINE_NUMBER 299
       
    33 
       
    34 // When chatstates are enabled, timeout (in seconds) before "composing"
       
    35 // becomes "paused" because of user inactivity.
       
    36 // Warning: setting this very low will cause more network traffic.
       
    37 #define COMPOSING_TIMEOUT 6L
       
    38 
       
    39 enum colors {
       
    40   COLOR_GENERAL = 3,
       
    41   COLOR_MSGOUT,
       
    42   COLOR_MSGHL,
       
    43   COLOR_STATUS,
       
    44   COLOR_ROSTER,
       
    45   COLOR_ROSTERSEL,
       
    46   COLOR_ROSTERSELNMSG,
       
    47   COLOR_ROSTERNMSG,
       
    48   COLOR_INFO,
       
    49   COLOR_MSGIN,
       
    50   COLOR_max
       
    51 };
       
    52 
       
    53 int COLOR_ATTRIB[COLOR_max];
       
    54 
       
    55 extern int update_roster;
       
    56 
       
    57 typedef struct {
       
    58   int value;
       
    59   int utf8;
       
    60   enum {
       
    61     MKEY_META = 1,
       
    62     MKEY_EQUIV,
       
    63     MKEY_CTRL_PGUP,
       
    64     MKEY_CTRL_PGDOWN,
       
    65     MKEY_SHIFT_PGUP,
       
    66     MKEY_SHIFT_PGDOWN,
       
    67     MKEY_CTRL_SHIFT_PGUP,
       
    68     MKEY_CTRL_SHIFT_PGDOWN,
       
    69     MKEY_CTRL_HOME,
       
    70     MKEY_CTRL_END,
       
    71     MKEY_CTRL_INS,
       
    72     MKEY_CTRL_DEL,
       
    73     MKEY_CTRL_SHIFT_HOME,
       
    74     MKEY_CTRL_SHIFT_END,
       
    75     MKEY_MOUSE
       
    76   } mcode;
       
    77 } keycode;
       
    78 
       
    79 typedef enum {
       
    80   MC_ALL,
       
    81   MC_PRESET,
       
    82   MC_OFF,
       
    83   MC_REMOVE
       
    84 } muccoltype;
       
    85 
       
    86 void scr_init_bindings(void);
       
    87 
       
    88 void scr_Getch(keycode *kcode);
       
    89 void process_key(keycode kcode);
       
    90 
       
    91 void scr_InitLocaleCharSet(void);
       
    92 void scr_InitCurses(void);
       
    93 void scr_TerminateCurses(void);
       
    94 void scr_DrawMainWindow(unsigned int fullinit);
       
    95 void scr_DrawRoster(void);
       
    96 void scr_UpdateMainStatus(int forceupdate);
       
    97 void scr_UpdateChatStatus(int forceupdate);
       
    98 void scr_RosterVisibility(int status);
       
    99 void scr_WriteIncomingMessage(const char *jidfrom, const char *text,
       
   100                               time_t timestamp, guint prefix,
       
   101                               unsigned mucnicklen);
       
   102 void scr_WriteOutgoingMessage(const char *jidto,   const char *text,
       
   103                               guint prefix, gpointer xep184);
       
   104 void scr_RemoveReceiptFlag(const char *jidto, gpointer xep184);
       
   105 void scr_ShowBuddyWindow(void);
       
   106 int  scr_BuddyBufferExists(const char *jid);
       
   107 void scr_UpdateBuddyWindow(void);
       
   108 void scr_set_chatmode(int enable);
       
   109 int  scr_get_chatmode(void);
       
   110 void scr_set_multimode(int enable, char *subject);
       
   111 int  scr_get_multimode(void);
       
   112 void scr_setmsgflag_if_needed(const char *jid, int special);
       
   113 void scr_append_multiline(const char *line);
       
   114 const char *scr_get_multiline(void);
       
   115 const char *scr_get_multimode_subj(void);
       
   116 
       
   117 guint scr_getprefixwidth(void);
       
   118 void  scr_line_prefix(hbb_line *line, char *prefix, guint preflen);
       
   119 
       
   120 void scr_Beep(void);
       
   121 
       
   122 bool Autoaway;
       
   123 
       
   124 void scr_CheckAutoAway(int activity);
       
   125 
       
   126 #if defined JEP0022 || defined JEP0085
       
   127 gboolean scr_ChatStatesTimeout();
       
   128 #endif
       
   129 int chatstates_disabled;
       
   130 
       
   131 // For commands...
       
   132 void scr_RosterTop(void);
       
   133 void scr_RosterBottom(void);
       
   134 void scr_RosterUpDown(int updown, unsigned int n);
       
   135 void scr_RosterPrevGroup(void);
       
   136 void scr_RosterNextGroup(void);
       
   137 void scr_RosterSearch(char *);
       
   138 void scr_RosterJumpJid(char *);
       
   139 void scr_RosterDisplay(const char *);
       
   140 void scr_BufferTopBottom(int topbottom);
       
   141 void scr_BufferClear(void);
       
   142 void scr_BufferScrollLock(int lock);
       
   143 void scr_BufferPurge(int, const char*);
       
   144 void scr_BufferPurgeAll(int);
       
   145 void scr_BufferSearch(int direction, const char *text);
       
   146 void scr_BufferPercent(int pc);
       
   147 void scr_BufferDate(time_t t);
       
   148 void scr_BufferDump(const char *file);
       
   149 void scr_RosterUnreadMessage(int);
       
   150 void scr_RosterJumpAlternate(void);
       
   151 void scr_BufferScrollUpDown(int updown, unsigned int nblines);
       
   152 bool scr_RosterColor(const char *status, const char *wildcard,
       
   153                      const char *color);
       
   154 void scr_RosterClearColor(void);
       
   155 void scr_MucColor(const char *muc, muccoltype type);
       
   156 void scr_MucNickColor(const char *nick, const char *color);
       
   157 void scr_BufferList(void);
       
   158 
       
   159 void readline_transpose_chars(void);
       
   160 void readline_forward_kill_word(void);
       
   161 void readline_backward_kill_word(void);
       
   162 void readline_backward_word(void);
       
   163 void readline_forward_word(void);
       
   164 void readline_updowncase_word(int);
       
   165 void readline_capitalize_word(void);
       
   166 void readline_backward_char(void);
       
   167 void readline_forward_char(void);
       
   168 int  readline_accept_line(int down_history);
       
   169 void readline_cancel_completion(void);
       
   170 void readline_do_completion(void);
       
   171 void readline_refresh_screen(void);
       
   172 void readline_disable_chat_mode(void);
       
   173 void readline_hist_beginning_search_bwd(void);
       
   174 void readline_hist_beginning_search_fwd(void);
       
   175 void readline_hist_prev(void);
       
   176 void readline_hist_next(void);
       
   177 void readline_backward_kill_char(void);
       
   178 void readline_forward_kill_char(void);
       
   179 void readline_iline_start(void);
       
   180 void readline_iline_end(void);
       
   181 void readline_backward_kill_iline(void);
       
   182 void readline_forward_kill_iline(void);
       
   183 void readline_send_multiline(void);
       
   184 
       
   185 #endif
       
   186 
       
   187 /* vim: set expandtab cindent cinoptions=>2\:2(0:  For Vim users... */