#include <lib-sys/unix.h>
#include <lib-mime/mime.h>
-#include <lib-ui/curses.h>
+#include <lib-ui/lib-ui.h>
#include <lib-ui/enter.h>
#include <lib-ui/menu.h>
#include <lib-mx/mx.h>
#define HDR_XOFFSET 14
#define TITLE_FMT "%14s" /* Used for Prompts, which are ASCII */
-#define SW (option(OPTMBOXPANE)?SidebarWidth:0)
-#define W (COLS - HDR_XOFFSET - SW)
+#define W (getmaxx(main_w) - HDR_XOFFSET)
static const char *Prompts[] = {
"From: ",
};
static void snd_entry (char *b, ssize_t blen, MUTTMENU * menu, int num) {
- m_strformat(b, blen, COLS - SW, AttachFormat, mutt_attach_fmt,
+ m_strformat(b, blen, getmaxx(main_w), AttachFormat, mutt_attach_fmt,
((ATTACHPTR **)menu->data)[num], M_FORMAT_STAT_FILE);
}
int off = 0;
if (!msg->security)
- mvwaddstr (stdscr, HDR_CRYPT, SW, " Security: ");
+ mvwaddstr (main_w, HDR_CRYPT, 0, " Security: ");
else if (msg->security & APPLICATION_SMIME)
- mvwaddstr (stdscr, HDR_CRYPT, SW, " S/MIME: ");
+ mvwaddstr (main_w, HDR_CRYPT, 0, " S/MIME: ");
else if (msg->security & APPLICATION_PGP)
- mvwaddstr (stdscr, HDR_CRYPT, SW, " PGP: ");
+ mvwaddstr (main_w, HDR_CRYPT, 0, " PGP: ");
if ((msg->security & (ENCRYPT | SIGN)) == (ENCRYPT | SIGN))
- waddstr (stdscr, _("Sign, Encrypt"));
+ waddstr (main_w, _("Sign, Encrypt"));
else if (msg->security & ENCRYPT)
- waddstr (stdscr, _("Encrypt"));
+ waddstr (main_w, _("Encrypt"));
else if (msg->security & SIGN)
- waddstr (stdscr, _("Sign"));
+ waddstr (main_w, _("Sign"));
else
- waddstr (stdscr, _("Clear"));
+ waddstr (main_w, _("Clear"));
if ((msg->security & APPLICATION_PGP)
&& (msg->security & (ENCRYPT | SIGN))) {
if ((msg->security & INLINE))
- waddstr (stdscr, _(" (inline)"));
+ waddstr (main_w, _(" (inline)"));
else
- waddstr (stdscr, _(" (PGP/MIME)"));
+ waddstr (main_w, _(" (PGP/MIME)"));
}
- wclrtoeol (stdscr);
+ wclrtoeol (main_w);
- wmove (stdscr, HDR_CRYPTINFO, SW);
- wclrtoeol (stdscr);
+ wmove (main_w, HDR_CRYPTINFO, 0);
+ wclrtoeol (main_w);
if (msg->security & APPLICATION_PGP && msg->security & SIGN)
- wprintw (stdscr, "%s%s", _(" sign as: "),
+ wprintw (main_w, "%s%s", _(" sign as: "),
PgpSignAs ? PgpSignAs : _("<default>"));
if (msg->security & APPLICATION_SMIME && msg->security & SIGN) {
- wprintw (stdscr, "%s%s", _(" sign as: "),
+ wprintw (main_w, "%s%s", _(" sign as: "),
SmimeDefaultKey ? SmimeDefaultKey : _("<default>"));
}
if ((msg->security & APPLICATION_SMIME)
&& (msg->security & ENCRYPT)
&& SmimeCryptAlg && *SmimeCryptAlg) {
- mvwprintw (stdscr, HDR_CRYPTINFO, SW + 40, "%s%s", _("Encrypt with: "),
+ mvwprintw (main_w, HDR_CRYPTINFO, 40, "%s%s", _("Encrypt with: "),
NONULL (SmimeCryptAlg));
off = 20;
}
buf[0] = 0;
rfc822_addrcat(buf, sizeof (buf), addr, 1);
- mvwprintw (stdscr, line, SW, TITLE_FMT, Prompts[line - 1]);
- mutt_paddstr (W, buf);
+ mvwprintw (main_w, line, 0, TITLE_FMT, Prompts[line - 1]);
+ mutt_paddstr (main_w, W, buf);
}
static void draw_envelope (HEADER * msg, char *fcc)
draw_envelope_addr (HDR_BCC, msg->env->bcc);
#ifdef USE_NNTP
} else {
- mvwprintw (stdscr, HDR_TO, SW, TITLE_FMT, Prompts[HDR_NEWSGROUPS - 1]);
- mutt_paddstr (W, NONULL (msg->env->newsgroups));
- mvwprintw (stdscr, HDR_CC, SW, TITLE_FMT, Prompts[HDR_FOLLOWUPTO - 1]);
- mutt_paddstr (W, NONULL (msg->env->followup_to));
+ mvwprintw (main_w, HDR_TO, 0, TITLE_FMT, Prompts[HDR_NEWSGROUPS - 1]);
+ mutt_paddstr (main_w, W, NONULL (msg->env->newsgroups));
+ mvwprintw (main_w, HDR_CC, 0, TITLE_FMT, Prompts[HDR_FOLLOWUPTO - 1]);
+ mutt_paddstr (main_w, W, NONULL (msg->env->followup_to));
}
#endif
- mvwprintw (stdscr, HDR_SUBJECT, SW, TITLE_FMT, Prompts[HDR_SUBJECT - 1]);
- mutt_paddstr (W, NONULL (msg->env->subject));
+ mvwprintw (main_w, HDR_SUBJECT, 0, TITLE_FMT, Prompts[HDR_SUBJECT - 1]);
+ mutt_paddstr (main_w, W, NONULL (msg->env->subject));
draw_envelope_addr (HDR_REPLYTO, msg->env->reply_to);
- mvwprintw (stdscr, HDR_FCC, SW, TITLE_FMT, Prompts[HDR_FCC - 1]);
- mutt_paddstr (W, fcc);
+ mvwprintw (main_w, HDR_FCC, 0, TITLE_FMT, Prompts[HDR_FCC - 1]);
+ mutt_paddstr (main_w, W, fcc);
redraw_crypt_lines (msg);
- SETCOLOR (MT_COLOR_STATUS);
- mvwaddstr (stdscr, HDR_ATTACH - 1, SW, _("-- Attachments"));
- BKGDSET (MT_COLOR_STATUS);
- wclrtoeol (stdscr);
+ SETCOLOR(main_w, MT_COLOR_STATUS);
+ mvwaddstr (main_w, HDR_ATTACH - 1, 0, _("-- Attachments"));
+ BKGDSET(main_w, MT_COLOR_STATUS);
+ wclrtoeol (main_w);
- BKGDSET (MT_COLOR_NORMAL);
- SETCOLOR (MT_COLOR_NORMAL);
+ BKGDSET(main_w, MT_COLOR_NORMAL);
+ SETCOLOR(main_w, MT_COLOR_NORMAL);
}
static int edit_address_list (int line, address_t ** addr)
/* redraw the expanded list so the user can see the result */
buf[0] = 0;
rfc822_addrcat(buf, sizeof (buf), *addr, 1);
- wmove (stdscr, line, HDR_XOFFSET + SW);
- mutt_paddstr (W, buf);
+ wmove (main_w, line, HDR_XOFFSET);
+ mutt_paddstr (main_w, W, buf);
return 0;
}
static void compose_status_line (char *buf, ssize_t buflen, MUTTMENU * menu,
const char *p)
{
- m_strformat(buf, buflen, COLS - SW, p, compose_format_str, menu, 0);
+ m_strformat(buf, buflen, getmaxx(main_w), p, compose_format_str, menu, 0);
}
/* return values:
p_delete(&msg->env->newsgroups);
m_strrtrim(buf);
msg->env->newsgroups = m_strdup(skipspaces(buf));
- wmove (stdscr, HDR_TO, HDR_XOFFSET);
- wclrtoeol (stdscr);
+ wmove (main_w, HDR_TO, HDR_XOFFSET);
+ wclrtoeol (main_w);
if (msg->env->newsgroups)
- wprintw (stdscr, "%-*.*s", W, W, msg->env->newsgroups);
+ wprintw (main_w, "%-*.*s", W, W, msg->env->newsgroups);
}
}
break;
p_delete(&msg->env->followup_to);
m_strrtrim(buf);
msg->env->followup_to = m_strdup(skipspaces(buf));
- wmove (stdscr, HDR_CC, HDR_XOFFSET);
- wclrtoeol (stdscr);
+ wmove (main_w, HDR_CC, HDR_XOFFSET);
+ wclrtoeol (main_w);
if (msg->env->followup_to)
- wprintw (stdscr, "%-*.*s", W, W, msg->env->followup_to);
+ wprintw (main_w, "%-*.*s", W, W, msg->env->followup_to);
}
}
break;
buf[0] = 0;
if (mutt_get_field ("Subject: ", buf, sizeof (buf), 0) == 0) {
m_strreplace(&msg->env->subject, buf);
- wmove (stdscr, HDR_SUBJECT, HDR_XOFFSET + SW);
- wclrtoeol (stdscr);
+ wmove (main_w, HDR_SUBJECT, HDR_XOFFSET);
+ wclrtoeol (main_w);
if (msg->env->subject)
- mutt_paddstr (W, msg->env->subject);
+ mutt_paddstr (main_w, W, msg->env->subject);
}
mutt_message_hook (NULL, msg, M_SEND2HOOK);
break;
if (mutt_get_field ("Fcc: ", buf, sizeof (buf), M_FILE | M_CLEAR) == 0) {
m_strcpy(fcc, _POSIX_PATH_MAX, buf);
mutt_pretty_mailbox (fcc);
- wmove (stdscr, HDR_FCC, HDR_XOFFSET + SW);
- mutt_paddstr (W, fcc);
+ wmove (main_w, HDR_FCC, HDR_XOFFSET);
+ mutt_paddstr (main_w, W, fcc);
fccSet = 1;
}
MAYBE_REDRAW (menu->redraw);
int itype;
FILE *fp;
- CLEARLINE (LINES - 1);
+ CLEARLINE(main_w, LINES - 1);
fname[0] = 0;
if (mutt_get_field (_("New file: "), fname, sizeof (fname), M_FILE)
!= 0 || !fname[0])
/* Draw formated compose status line */
if (menu->redraw & REDRAW_STATUS) {
compose_status_line (buf, sizeof (buf), menu, NONULL (ComposeFormat));
- CLEARLINE (option (OPTSTATUSONTOP) ? 0 : LINES - 2);
- SETCOLOR (MT_COLOR_STATUS);
- wmove (stdscr, option (OPTSTATUSONTOP) ? 0 : LINES - 2, SW);
- wprintw (stdscr, "%-*.*s", COLS-SW, COLS-SW, buf);
- SETCOLOR (MT_COLOR_NORMAL);
+ CLEARLINE(main_w, option (OPTSTATUSONTOP) ? 0 : LINES - 2);
+ SETCOLOR(main_w, MT_COLOR_STATUS);
+ wmove (main_w, option (OPTSTATUSONTOP) ? 0 : LINES - 2, 0);
+ wprintw (main_w, "%-*.*s", getmaxx(main_w), getmaxx(main_w), buf);
+ SETCOLOR(main_w, MT_COLOR_NORMAL);
menu->redraw &= ~REDRAW_STATUS;
}
}