X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=lib-ui%2Fcurses.h;h=cab58afe76c2b634d969f3aeb241e585796d1855;hp=4e1c18351283a4277bf6ea0f5bf81346b1d2025f;hb=88d239144bf6f50ca1eda6db7742281f0ad0f97f;hpb=b23d5033080fe9f9fba038e3cf1e3ec2b0a0d33d diff --git a/lib-ui/curses.h b/lib-ui/curses.h index 4e1c183..cab58af 100644 --- a/lib-ui/curses.h +++ b/lib-ui/curses.h @@ -10,48 +10,8 @@ #ifndef _MUTT_CURSES_H #define _MUTT_CURSES_H -#include #include "mutt.h" -#ifdef USE_SLANG_CURSES - -#ifndef unix /* this symbol is not defined by the hp-ux compiler (sigh) */ -#define unix -#endif /* unix */ - -#include "slcurses.h" - -#define KEY_DC SL_KEY_DELETE -#define KEY_IC SL_KEY_IC - -/* - * ncurses and SLang seem to send different characters when the Enter key is - * pressed, so define some macros to properly detect the Enter key. - */ -#define M_ENTER_C '\r' -#define M_ENTER_S "\r" - -#else - -#ifdef HAVE_NCURSESW_NCURSES_H -#include -#else -#ifdef HAVE_NCURSES_NCURSES_H -#include -#else -#ifdef HAVE_NCURSES_H -#include -#else -#include -#endif -#endif -#endif - -#define M_ENTER_C '\n' -#define M_ENTER_S "\n" - -#endif /* USE_SLANG_CURSES */ - /* AIX defines ``lines'' in , but it's used as a var name in * various places in Mutt */ @@ -59,27 +19,14 @@ #undef lines #endif /* lines */ -#define CLEARLINE_WIN(x) move(x,(option(OPTMBOXPANE)?SidebarWidth:0)), clrtoeol() -#define CLEARLINE(x) move(x,0), clrtoeol() -#define CENTERLINE(x,y) move(y, (COLS-strlen(x))/2), addstr(x) -#define BEEP() do { if (option (OPTBEEP)) beep(); } while (0) +#define CLEARLINE(W, x) wmove(W, x,0), wclrtoeol(W) +#define BEEP() do { if (mod_core.beep) beep(); } while (0) -#if ! (defined(USE_SLANG_CURSES) || defined(HAVE_CURS_SET)) -#define curs_set(x) -#endif - -#if !defined(USE_SLANG_CURSES) && defined(HAVE_BKGDSET) -#define BKGDSET(x) bkgdset (ColorDefs[x] | ' ') -#else -#define BKGDSET(x) -#endif +#define BKGDSET(W, x) wbkgdset(W, ColorDefs[x] | ' ') +#define SETCOLOR(W, X) wattrset(W, ColorDefs[X]) +#define ADDCOLOR(W, X) wattron(W, ColorDefs[X]) -#if (defined(USE_SLANG_CURSES) || defined(HAVE_CURS_SET)) void mutt_curs_set (int); -#else -#define mutt_curs_set(x) -#endif -#define PAGELEN (LINES-3) #define ctrl(c) ((c)-'@') @@ -90,13 +37,13 @@ void mutt_curs_set (int); #endif event_t mutt_getch (void); +#define waddwch(win, w) waddnwstr(win, &(w), 1) + +void curses_initialize(void); +void curses_install(void); -void mutt_endwin (const char *); void mutt_flushinp (void); -void mutt_refresh (void); -void mutt_resize_screen (void); void mutt_ungetch (int, int); -void mutt_need_hard_redraw (void); /* ---------------------------------------------------------------------------- * Support for color @@ -127,6 +74,17 @@ enum { MT_COLOR_MAX }; +/* flags for mutt_get_field() */ +#define M_ALIAS (1<<0) /* do alias "completion" by calling up the alias-menu */ +#define M_FILE (1<<1) /* do file completion */ +#define M_EFILE (1<<2) /* do file completion, plus incoming folders */ +#define M_CMD (1<<3) /* do completion on previous word */ +#define M_PASS (1<<4) /* password mode (no echo) */ +#define M_CLEAR (1<<5) /* clear input if printable character is pressed */ +#define M_COMMAND (1<<6) /* do command completion */ +#define M_PATTERN (1<<7) /* pattern mode - only used for history classes */ +#define M_LASTFOLDER (1<<8) /* last-folder mode - hack hack hack */ + typedef struct color_line { regex_t rx; char *pattern; @@ -147,24 +105,24 @@ typedef struct { void mutt_progress_bar (progress_t* progress, long pos); void mutt_clear_error (void); -void mutt_edit_file (const char *, const char *); -void mutt_curses_error (const char *, ...); -void mutt_curses_message (const char *, ...); +void mutt_edit_file (const char *); +void mutt_curses_error (const char *, ...) + __attribute__((format(printf, 1, 2))); +void mutt_curses_message (const char *, ...) + __attribute__((format(printf, 1, 2))); void mutt_format_string (char *, ssize_t, int, int, int, char, const char *, ssize_t, int); void mutt_format_s (char *, ssize_t, const char *, const char *); void mutt_format_s_tree (char *, ssize_t, const char *, const char *); void mutt_free_color (int fg, int bg); -void mutt_paddstr (int, const char *); -#define mutt_perror(a) _mutt_perror (a, __FILE__, __LINE__) -void _mutt_perror (const char*, const char*,int); +void mutt_paddstr(WINDOW *, int, const char *); +#define mutt_perror(s) \ + mutt_error("%s: %m (errno = %d) from %s:%i", s, errno, __FILE__, __LINE__) void mutt_query_exit (void); void mutt_query_menu (char *, ssize_t); void mutt_show_error (void); ssize_t mutt_pretty_size(char *s, ssize_t len, ssize_t n); -int mutt_addwch (wchar_t); -int mutt_alloc_color (int fg, int bg); int mutt_any_key_to_continue (const char *); int mutt_complete (char *, ssize_t); #define mutt_enter_fname(A,B,C,D,E) _mutt_enter_fname(A,B,C,D,E,0,NULL,NULL) @@ -177,13 +135,10 @@ int mutt_get_field_unbuffered (char *, char *, ssize_t, int); int mutt_index_menu (void); int mutt_is_mail_list (address_t *); int mutt_is_subscribed_list (address_t *); -int mutt_multi_choice (char *prompt, char *letters); +int mutt_multi_choice (const char *prompt, const char *letters); int mutt_parse_color (BUFFER *, BUFFER *, unsigned long, BUFFER *); int mutt_parse_uncolor (BUFFER *, BUFFER *, unsigned long, BUFFER *); -int mutt_parse_mono (BUFFER *, BUFFER *, unsigned long, BUFFER *); -int mutt_parse_unmono (BUFFER *, BUFFER *, unsigned long, BUFFER *); int mutt_query_complete (char *, ssize_t); -int mutt_strwidth (const char *); int mutt_user_is_recipient (HEADER *); int mutt_yesorno (const char *, int); void mutt_set_header_color (CONTEXT *, HEADER *); @@ -195,19 +150,12 @@ extern COLOR_LINE *ColorHdrList; extern COLOR_LINE *ColorBodyList; extern COLOR_LINE *ColorIndexList; -void ci_init_color (void); void ci_start_color (void); #define mutt_make_string(A,B,C,D,E) _mutt_make_string(A,B,C,D,E,0) void _mutt_make_string (char *, ssize_t, const char *, CONTEXT *, HEADER *, format_flag); - -#define SETCOLOR(X) attrset(ColorDefs[X]) -#define ADDCOLOR(X) attron(ColorDefs[X]) - #define MAYBE_REDRAW(x) if (option (OPTNEEDREDRAW)) { unset_option (OPTNEEDREDRAW); x = REDRAW_FULL; } -#define SW (option(OPTMBOXPANE)?SidebarWidth:0) - #endif /* !_MUTT_CURSES_H */