menu->make_entry (s, l, menu, i);
}
-static void menu_pad_string (char *s, size_t n)
+static void menu_pad_string (MUTTMENU *menu, char *s, size_t n)
{
char *scratch = safe_strdup (s);
int shift = option (OPTARROWCURSOR) ? 3 : 0;
- int cols = COLS - shift;
+ int cols = menu->indexwin->cols - shift;
mutt_format_string (s, n, cols, cols, FMT_LEFT, ' ', scratch, mutt_strlen (scratch), 1);
s[n - 1] = 0;
void menu_redraw_full (MUTTMENU *menu)
{
+#if ! (defined (USE_SLANG_CURSES) || defined (HAVE_RESIZETERM))
+ mutt_reflow_windows ();
+#endif
NORMAL_COLOR;
/* clear() doesn't optimize screen redraws */
move (0, 0);
if (option (OPTHELP))
{
SETCOLOR (MT_COLOR_STATUS);
- move (option (OPTSTATUSONTOP) ? LINES-2 : 0, 0);
- mutt_paddstr (COLS, menu->help);
+ mutt_window_move (menu->helpwin, 0, 0);
+ mutt_paddstr (menu->helpwin->cols, menu->help);
NORMAL_COLOR;
- menu->offset = 1;
- menu->pagelen = LINES - 3;
- }
- else
- {
- menu->offset = option (OPTSTATUSONTOP) ? 1 : 0;
- menu->pagelen = LINES - 2;
}
+ menu->offset = 0;
+ menu->pagelen = menu->indexwin->rows;
mutt_show_error ();
snprintf (buf, sizeof (buf), M_MODEFMT, menu->title);
SETCOLOR (MT_COLOR_STATUS);
- move (option (OPTSTATUSONTOP) ? 0 : LINES - 2, 0);
- mutt_paddstr (COLS, buf);
+ mutt_window_move (menu->statuswin, 0, 0);
+ mutt_paddstr (menu->statuswin->cols, buf);
NORMAL_COLOR;
menu->redraw &= ~REDRAW_STATUS;
}
attr = menu->color(i);
menu_make_entry (buf, sizeof (buf), menu, i);
- menu_pad_string (buf, sizeof (buf));
+ menu_pad_string (menu, buf, sizeof (buf));
ATTRSET(attr);
- move(i - menu->top + menu->offset, 0);
+ mutt_window_move (menu->indexwin, i - menu->top + menu->offset, 0);
do_color = 1;
if (i == menu->current)
else
{
NORMAL_COLOR;
- CLEARLINE(i - menu->top + menu->offset);
+ mutt_window_clearline (menu->indexwin, i - menu->top + menu->offset);
}
}
NORMAL_COLOR;
return;
}
- move (menu->oldcurrent + menu->offset - menu->top, 0);
+ mutt_window_move (menu->indexwin, menu->oldcurrent + menu->offset - menu->top, 0);
ATTRSET(menu->color (menu->oldcurrent));
if (option (OPTARROWCURSOR))
if (menu->redraw & REDRAW_MOTION_RESYNCH)
{
menu_make_entry (buf, sizeof (buf), menu, menu->oldcurrent);
- menu_pad_string (buf, sizeof (buf));
- move (menu->oldcurrent + menu->offset - menu->top, 3);
+ menu_pad_string (menu, buf, sizeof (buf));
+ mutt_window_move (menu->indexwin, menu->oldcurrent + menu->offset - menu->top, 3);
print_enriched_string (menu->color(menu->oldcurrent), (unsigned char *) buf, 1);
}
/* now draw it in the new location */
SETCOLOR(MT_COLOR_INDICATOR);
- mvaddstr(menu->current + menu->offset - menu->top, 0, "->");
+ mutt_window_mvaddstr (menu->indexwin, menu->current + menu->offset - menu->top, 0, "->");
}
else
{
/* erase the current indicator */
menu_make_entry (buf, sizeof (buf), menu, menu->oldcurrent);
- menu_pad_string (buf, sizeof (buf));
+ menu_pad_string (menu, buf, sizeof (buf));
print_enriched_string (menu->color(menu->oldcurrent), (unsigned char *) buf, 1);
/* now draw the new one to reflect the change */
menu_make_entry (buf, sizeof (buf), menu, menu->current);
- menu_pad_string (buf, sizeof (buf));
+ menu_pad_string (menu, buf, sizeof (buf));
SETCOLOR(MT_COLOR_INDICATOR);
- move(menu->current - menu->top + menu->offset, 0);
+ mutt_window_move (menu->indexwin, menu->current + menu->offset - menu->top, 0);
print_enriched_string (menu->color(menu->current), (unsigned char *) buf, 0);
}
menu->redraw &= REDRAW_STATUS;
{
char buf[LONG_STRING];
int attr = menu->color (menu->current);
-
- move (menu->current + menu->offset - menu->top, 0);
+
+ mutt_window_move (menu->indexwin, menu->current + menu->offset - menu->top, 0);
menu_make_entry (buf, sizeof (buf), menu, menu->current);
- menu_pad_string (buf, sizeof (buf));
+ menu_pad_string (menu, buf, sizeof (buf));
SETCOLOR(MT_COLOR_INDICATOR);
if (option (OPTARROWCURSOR))
addstr ("->");
ATTRSET(attr);
addch (' ');
- menu_pad_string (buf, sizeof (buf));
+ menu_pad_string (menu, buf, sizeof (buf));
print_enriched_string (attr, (unsigned char *) buf, 1);
}
else
if (*Errorbuf)
mutt_clear_error ();
- mvaddstr (LINES - 1, 0, menu->prompt);
- clrtoeol ();
+ mutt_window_mvaddstr (menu->messagewin, 0, 0, menu->prompt);
+ mutt_window_clrtoeol (menu->messagewin);
}
}
p->menu = menu;
p->current = 0;
p->top = 0;
- p->offset = 1;
+ p->offset = 0;
p->redraw = REDRAW_FULL;
- p->pagelen = PAGELEN;
+ p->pagelen = MuttIndexWindow->rows;
+ p->indexwin = MuttIndexWindow;
+ p->statuswin = MuttStatusWindow;
+ p->helpwin = MuttHelpWindow;
+ p->messagewin = MuttMessageWindow;
p->color = default_color;
p->search = menu_search_generic;
return (p);
if (option (OPTARROWCURSOR))
- move (menu->current - menu->top + menu->offset, 2);
+ mutt_window_move (menu->indexwin, menu->current - menu->top + menu->offset, 2);
else if (option (OPTBRAILLEFRIENDLY))
- move (menu->current - menu->top + menu->offset, 0);
+ mutt_window_move (menu->indexwin, menu->current - menu->top + menu->offset, 0);
else
- move (menu->current - menu->top + menu->offset, COLS - 1);
+ mutt_window_move (menu->indexwin, menu->current - menu->top + menu->offset,
+ menu->indexwin->cols - 1);
mutt_refresh ();
{
if (menu->tagged)
{
- mvaddstr (LINES - 1, 0, "Tag-");
- clrtoeol ();
+ mutt_window_mvaddstr (menu->messagewin, 0, 0, "Tag-");
+ mutt_window_clrtoeol (menu->messagewin);
i = km_dokey (menu->menu);
menu->tagprefix = 1;
- CLEARLINE (LINES - 1);
+ mutt_window_clearline (menu->messagewin, 0);
}
else if (i == OP_TAG_PREFIX)
{