char *C_MixEntryFormat; ///< Config: (mixmaster) printf-like format string for the mixmaster chain
char *C_Mixmaster; ///< Config: (mixmaster) External command to route a mixmaster message
+#define MIX_HOFFSET 2
+#define MIX_VOFFSET (win->rows - 4)
+#define MIX_MAXROW (win->rows - 1)
+
/**
* struct Coord - Screen coordinates
*/
FREE(type2_list);
}
-#define MIX_HOFFSET 2
-#define MIX_VOFFSET (MuttIndexWindow->rows - 4)
-#define MIX_MAXROW (MuttIndexWindow->rows - 1)
-
/**
* mix_screen_coordinates - Get the screen coordinates to place a chain
+ * @param[in] win Window
* @param[out] type2_list Remailer List
* @param[out] coordsp On screen coordinates
* @param[in] chain Chain
* @param[in] i Index in chain
*/
-static void mix_screen_coordinates(struct Remailer **type2_list, struct Coord **coordsp,
- struct MixChain *chain, int i)
+static void mix_screen_coordinates(struct MuttWindow *win, struct Remailer **type2_list,
+ struct Coord **coordsp, struct MixChain *chain, int i)
{
if (!chain->cl)
return;
short oc = c;
c += strlen(type2_list[chain->ch[i]]->shortname) + 2;
- if (c >= MuttIndexWindow->cols)
+ if (c >= win->cols)
{
oc = MIX_HOFFSET;
c = MIX_HOFFSET;
/**
* mix_redraw_ce - Redraw the Remailer chain
+ * @param[in] win Window
* @param[out] type2_list Remailer List
* @param[in] coords Screen Coordinates
* @param[in] chain Chain
* @param[in] i Index in chain
* @param[in] selected true, if this item is selected
*/
-static void mix_redraw_ce(struct Remailer **type2_list, struct Coord *coords,
- struct MixChain *chain, int i, bool selected)
+static void mix_redraw_ce(struct MuttWindow *win, struct Remailer **type2_list,
+ struct Coord *coords, struct MixChain *chain, int i, bool selected)
{
if (!coords || !chain)
return;
else
mutt_curses_set_color(MT_COLOR_NORMAL);
- mutt_window_mvaddstr(MuttIndexWindow, coords[i].r, coords[i].c,
- type2_list[chain->ch[i]]->shortname);
+ mutt_window_mvaddstr(win, coords[i].r, coords[i].c, type2_list[chain->ch[i]]->shortname);
mutt_curses_set_color(MT_COLOR_NORMAL);
if (i + 1 < chain->cl)
/**
* mix_redraw_chain - Redraw the chain on screen
+ * @param[in] win Window
* @param[out] type2_list Remailer List
* @param[in] coords Where to draw the list on screen
* @param[in] chain Chain to display
* @param[in] cur Chain index of current selection
*/
-static void mix_redraw_chain(struct Remailer **type2_list, struct Coord *coords,
- struct MixChain *chain, int cur)
+static void mix_redraw_chain(struct MuttWindow *win, struct Remailer **type2_list,
+ struct Coord *coords, struct MixChain *chain, int cur)
{
for (int i = MIX_VOFFSET; i < MIX_MAXROW; i++)
{
- mutt_window_move(MuttIndexWindow, i, 0);
- mutt_window_clrtoeol(MuttIndexWindow);
+ mutt_window_move(win, i, 0);
+ mutt_window_clrtoeol(win);
}
for (int i = 0; i < chain->cl; i++)
- mix_redraw_ce(type2_list, coords, chain, i, i == cur);
+ mix_redraw_ce(win, type2_list, coords, chain, i, i == cur);
}
/**
* mix_redraw_head - Redraw the Chain info
+ * @param win Window
* @param chain Chain
*/
-static void mix_redraw_head(struct MixChain *chain)
+static void mix_redraw_head(struct MuttWindow *win, struct MixChain *chain)
{
mutt_curses_set_color(MT_COLOR_STATUS);
- mutt_window_mvprintw(MuttIndexWindow, MIX_VOFFSET - 1, 0,
+ mutt_window_mvprintw(win, MIX_VOFFSET - 1, 0,
"-- Remailer chain [Length: %d]", chain ? chain->cl : 0);
- mutt_window_clrtoeol(MuttIndexWindow);
+ mutt_window_clrtoeol(win);
mutt_curses_set_color(MT_COLOR_NORMAL);
}
/**
* mix_make_chain - Create a Mixmaster chain
+ * @param win Window
* @param chainhead List if chain links
+ * @param cols Number of screen columns
*
* Ask the user to select Mixmaster hosts to create a chain.
*/
-void mix_make_chain(struct ListHead *chainhead)
+void mix_make_chain(struct MuttWindow *win, struct ListHead *chainhead, int cols)
{
int c_cur = 0, c_old = 0;
bool c_redraw = true;
chain->ch[i] = 0;
}
- mix_screen_coordinates(type2_list, &coords, chain, 0);
+ mix_screen_coordinates(win, type2_list, &coords, chain, 0);
menu = mutt_menu_new(MENU_MIX);
menu->max = ttll;
if (c_redraw)
{
- mix_redraw_head(chain);
- mix_redraw_chain(type2_list, coords, chain, c_cur);
+ mix_redraw_head(menu->indexwin, chain);
+ mix_redraw_chain(menu->indexwin, type2_list, coords, chain, c_cur);
c_redraw = false;
}
else if (c_cur != c_old)
{
- mix_redraw_ce(type2_list, coords, chain, c_old, false);
- mix_redraw_ce(type2_list, coords, chain, c_cur, true);
+ mix_redraw_ce(menu->indexwin, type2_list, coords, chain, c_old, false);
+ mix_redraw_ce(menu->indexwin, type2_list, coords, chain, c_cur, true);
}
c_old = c_cur;
case OP_REDRAW:
{
menu_redraw_status(menu);
- mix_redraw_head(chain);
- mix_screen_coordinates(type2_list, &coords, chain, 0);
- mix_redraw_chain(type2_list, coords, chain, c_cur);
+ mix_redraw_head(menu->indexwin, chain);
+ mix_screen_coordinates(menu->indexwin, type2_list, &coords, chain, 0);
+ mix_redraw_chain(menu->indexwin, type2_list, coords, chain, c_cur);
menu->pagelen = MIX_VOFFSET - 1;
break;
}
{
chain->cl++;
chain->ch[0] = menu->current;
- mix_screen_coordinates(type2_list, &coords, chain, c_cur);
+ mix_screen_coordinates(menu->indexwin, type2_list, &coords, chain, c_cur);
c_redraw = true;
}
chain->ch[i] = chain->ch[i - 1];
chain->ch[c_cur] = menu->current;
- mix_screen_coordinates(type2_list, &coords, chain, c_cur);
+ mix_screen_coordinates(menu->indexwin, type2_list, &coords, chain, c_cur);
c_redraw = true;
}
else
if ((c_cur == chain->cl) && c_cur)
c_cur--;
- mix_screen_coordinates(type2_list, &coords, chain, c_cur);
+ mix_screen_coordinates(menu->indexwin, type2_list, &coords, chain, c_cur);
c_redraw = true;
}
else