X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=lib-ui%2Fmenu.c;h=0371dbc74129cb4e2f7a4bef36b20f7174482a1b;hp=b023ece3fe84442a0b1084539c13188d84be7b71;hb=f435868132e200bfa71ac155f037cf64bf5414ba;hpb=84bc6d1930165b21919541b3b24294a9d99c3541 diff --git a/lib-ui/menu.c b/lib-ui/menu.c index b023ece..0371dbc 100644 --- a/lib-ui/menu.c +++ b/lib-ui/menu.c @@ -7,9 +7,8 @@ * please see the file GPL in the top level source directory. */ -#include +#include -#include "curses.h" #include "enter.h" #include "menu.h" @@ -38,87 +37,52 @@ static void print_enriched_string (int attr, unsigned char *s, int do_color) while (*s && *s < M_TREE_MAX) { switch (*s) { case M_TREE_LLCORNER: - if (option (OPTASCIICHARS)) - addch ('`'); - else if (Charset_is_utf8) - addstr ("\342\224\224"); /* WACS_LLCORNER */ - else - addch (ACS_LLCORNER); + waddch (stdscr, ACS_LLCORNER); break; case M_TREE_ULCORNER: - if (option (OPTASCIICHARS)) - addch (','); - else if (Charset_is_utf8) - addstr ("\342\224\214"); /* WACS_ULCORNER */ - else - addch (ACS_ULCORNER); + waddch (stdscr, ACS_ULCORNER); break; case M_TREE_LTEE: - if (option (OPTASCIICHARS)) - addch ('|'); - else if (Charset_is_utf8) - addstr ("\342\224\234"); /* WACS_LTEE */ - else - addch (ACS_LTEE); + waddch (stdscr, ACS_LTEE); break; case M_TREE_HLINE: - if (option (OPTASCIICHARS)) - addch ('-'); - else if (Charset_is_utf8) - addstr ("\342\224\200"); /* WACS_HLINE */ - else - addch (ACS_HLINE); + waddch (stdscr, ACS_HLINE); break; case M_TREE_VLINE: - if (option (OPTASCIICHARS)) - addch ('|'); - else if (Charset_is_utf8) - addstr ("\342\224\202"); /* WACS_VLINE */ - else - addch (ACS_VLINE); + waddch (stdscr, ACS_VLINE); break; case M_TREE_TTEE: - if (option (OPTASCIICHARS)) - addch ('-'); - else if (Charset_is_utf8) - addstr ("\342\224\254"); /* WACS_TTEE */ - else - addch (ACS_TTEE); + waddch (stdscr, ACS_TTEE); break; case M_TREE_BTEE: - if (option (OPTASCIICHARS)) - addch ('-'); - else if (Charset_is_utf8) - addstr ("\342\224\264"); /* WACS_BTEE */ - else - addch (ACS_BTEE); + waddch (stdscr, ACS_BTEE); break; case M_TREE_SPACE: - addch (' '); + waddch (stdscr, ' '); break; case M_TREE_RARROW: - addch ('>'); + waddch (stdscr, '>'); break; case M_TREE_STAR: - addch ('*'); /* fake thread indicator */ + waddch (stdscr, '*'); /* fake thread indicator */ break; case M_TREE_HIDDEN: - addch ('&'); + waddch (stdscr, '&'); break; case M_TREE_EQUALS: - addch ('='); + waddch (stdscr, '='); break; case M_TREE_MISSING: - addch ('?'); + waddch (stdscr, '?'); break; } s++, n--; } if (do_color) - attrset (attr); + wattrset (stdscr, attr); } else if ((k = mbrtowc (&wc, (char *) s, n, &mbstate)) != (size_t)-1) { - addnstr ((char *) s, k); + waddnstr (stdscr, (char *) s, k); s += k, n -= k; } else @@ -150,14 +114,14 @@ static void menu_pad_string (char *s, size_t n) void menu_redraw_full (MUTTMENU * menu) { SETCOLOR (MT_COLOR_NORMAL); - /* clear() doesn't optimize screen redraws */ - move (0, 0); - clrtobot (); + /* wclear(stdscr) doesn't optimize screen redraws */ + wmove (stdscr, 0, 0); + wclrtobot (stdscr); if (option (OPTHELP)) { SETCOLOR (MT_COLOR_STATUS); - move (option (OPTSTATUSONTOP) ? LINES - 2 : 0, SW); - mutt_paddstr (COLS-SW, menu->help); + wmove (stdscr, option (OPTSTATUSONTOP) ? LINES - 2 : 0, SW); + mutt_paddstr (COLS-SW, ""); SETCOLOR (MT_COLOR_NORMAL); menu->offset = 1; menu->pagelen = LINES - 3; @@ -180,7 +144,7 @@ void menu_redraw_status (MUTTMENU * menu) snprintf (buf, sizeof (buf), M_MODEFMT, menu->title); SETCOLOR (MT_COLOR_STATUS); - move (option (OPTSTATUSONTOP) ? 0 : LINES - 2, SW); + wmove (stdscr, option (OPTSTATUSONTOP) ? 0 : LINES - 2, SW); mutt_paddstr (COLS-SW, buf); SETCOLOR (MT_COLOR_NORMAL); menu->redraw &= ~REDRAW_STATUS; @@ -197,7 +161,7 @@ void menu_redraw_index (MUTTMENU * menu) menu_make_entry (buf, sizeof (buf), menu, i); menu_pad_string (buf, sizeof (buf)); - attrset (menu->color (i)); + wattrset (stdscr, menu->color (i)); if (i == menu->current) { ADDCOLOR (MT_COLOR_INDICATOR); @@ -206,7 +170,7 @@ void menu_redraw_index (MUTTMENU * menu) CLEARLINE_WIN (i - menu->top + menu->offset); - move (i - menu->top + menu->offset, SW); + wmove (stdscr, i - menu->top + menu->offset, SW); print_enriched_string (menu->color (i), (unsigned char *) buf, i != menu->current); SETCOLOR (MT_COLOR_NORMAL); @@ -229,13 +193,13 @@ void menu_redraw_motion (MUTTMENU * menu) return; } - move (menu->oldcurrent + menu->offset - menu->top, SW); + wmove (stdscr, menu->oldcurrent + menu->offset - menu->top, SW); SETCOLOR (MT_COLOR_NORMAL); BKGDSET (MT_COLOR_NORMAL); /* erase the current indicator */ - attrset (menu->color (menu->oldcurrent)); - clrtoeol (); + wattrset (stdscr, menu->color (menu->oldcurrent)); + wclrtoeol (stdscr); menu_make_entry (buf, sizeof (buf), menu, menu->oldcurrent); menu_pad_string (buf, sizeof (buf)); print_enriched_string (menu->color (menu->oldcurrent), @@ -244,11 +208,11 @@ void menu_redraw_motion (MUTTMENU * menu) /* now draw the new one to reflect the change */ menu_make_entry (buf, sizeof (buf), menu, menu->current); menu_pad_string (buf, sizeof (buf)); - attrset (menu->color (menu->current)); + wattrset (stdscr, menu->color (menu->current)); ADDCOLOR (MT_COLOR_INDICATOR); BKGDSET (MT_COLOR_INDICATOR); CLEARLINE_WIN (menu->current - menu->top + menu->offset); - move (menu->current + menu->offset - menu->top, SW); + wmove (stdscr, menu->current + menu->offset - menu->top, SW); print_enriched_string (menu->color (menu->current), (unsigned char *) buf, 0); SETCOLOR (MT_COLOR_NORMAL); @@ -261,14 +225,14 @@ void menu_redraw_current (MUTTMENU * menu) { char buf[STRING]; - move (menu->current + menu->offset - menu->top, SW); + wmove (stdscr, menu->current + menu->offset - menu->top, SW); menu_make_entry (buf, sizeof (buf), menu, menu->current); menu_pad_string (buf, sizeof (buf)); - attrset (menu->color (menu->current)); + wattrset (stdscr, menu->color (menu->current)); ADDCOLOR (MT_COLOR_INDICATOR); BKGDSET (MT_COLOR_INDICATOR); - clrtoeol (); + wclrtoeol (stdscr); print_enriched_string (menu->color (menu->current), (unsigned char *) buf, 0); SETCOLOR (MT_COLOR_NORMAL); @@ -289,8 +253,8 @@ static void menu_redraw_prompt (MUTTMENU * menu) mutt_clear_error (); SETCOLOR (MT_COLOR_NORMAL); - mvaddstr (LINES - 1, 0, menu->prompt); - clrtoeol (); + mvwaddstr (stdscr, LINES - 1, 0, menu->prompt); + wclrtoeol (stdscr); } } @@ -736,9 +700,9 @@ int mutt_menuLoop (MUTTMENU * menu) menu->oldcurrent = menu->current; if (option (OPTBRAILLEFRIENDLY)) - move (menu->current - menu->top + menu->offset, SW); + wmove (stdscr, menu->current - menu->top + menu->offset, SW); else - move (menu->current - menu->top + menu->offset, COLS - 1); + wmove (stdscr, menu->current - menu->top + menu->offset, COLS - 1); mutt_refresh (); @@ -750,8 +714,8 @@ int mutt_menuLoop (MUTTMENU * menu) i = km_dokey (menu->menu); if (i == OP_TAG_PREFIX || i == OP_TAG_PREFIX_COND) { if (menu->tagged) { - mvaddstr (LINES - 1, 0, "Tag-"); - clrtoeol (); + mvwaddstr (stdscr, LINES - 1, 0, "Tag-"); + wclrtoeol (stdscr); i = km_dokey (menu->menu); menu->tagprefix = 1; CLEARLINE (LINES - 1); @@ -782,14 +746,12 @@ int mutt_menuLoop (MUTTMENU * menu) mutt_curs_set (1); -#if defined (HAVE_RESIZETERM) if (SigWinch) { mutt_resize_screen (); menu->redraw = REDRAW_FULL; SigWinch = 0; clearok (stdscr, TRUE); /*force complete redraw */ } -#endif if (i == -1) continue;