]> granicus.if.org Git - neomutt/commitdiff
refactor: SET_COLOR() to mutt_curses_set_color()
authorRichard Russon <rich@flatcap.org>
Fri, 27 Sep 2019 12:49:29 +0000 (13:49 +0100)
committerRichard Russon <rich@flatcap.org>
Sat, 28 Sep 2019 02:18:27 +0000 (03:18 +0100)
Encapsulate a curses function to reduce dependencies.

12 files changed:
Makefile.autosetup
compose.c
curs_lib.c
index.c
menu.c
mutt_curses.c [new file with mode: 0644]
mutt_curses.h
mutt_logging.c
pager.c
progress.c
remailer.c
sidebar.c

index 359b321196506aa33aaeec94e9300a8d51b2e1b4..4b866b374df074899ed2bb48a2d213d75dec7ce4 100644 (file)
@@ -66,7 +66,7 @@ NEOMUTTOBJS=  addrbook.o alias.o bcache.o browser.o color.o commands.o \
                curs_lib.o edit.o editmsg.o enriched.o enter.o filter.o flags.o \
                git_ver.o handler.o hdrline.o help.o hook.o icommands.o index.o init.o \
                keymap.o mailcap.o main.o menu.o mutt_account.o mutt_attach.o \
-               mutt_body.o mutt_header.o mutt_history.o mutt_logging.o mutt_mailbox.o \
+               mutt_body.o mutt_curses.o mutt_header.o mutt_history.o mutt_logging.o mutt_mailbox.o \
                mutt_parse.o mutt_signal.o mutt_socket.o mutt_thread.o mutt_window.o \
                muttlib.o mx.o myvar.o pager.o pattern.o postpone.o progress.o query.o \
                recvattach.o recvcmd.o resize.o rfc3676.o score.o send.o sendlib.o \
index a806792c513957d4a16ac041fd745fd8882b756f..dd46652e357b3fb39256b1a651762a7116998a57 100644 (file)
--- a/compose.c
+++ b/compose.c
@@ -370,7 +370,7 @@ static void redraw_crypt_lines(struct ComposeRedrawData *rd)
 {
   struct Email *e = rd->email;
 
-  SET_COLOR(MT_COLOR_COMPOSE_HEADER);
+  mutt_curses_set_color(MT_COLOR_COMPOSE_HEADER);
   mutt_window_mvprintw(rd->win, HDR_CRYPT, 0, "%*s", HeaderPadding[HDR_CRYPT],
                        _(Prompts[HDR_CRYPT]));
   NORMAL_COLOR;
@@ -383,23 +383,23 @@ static void redraw_crypt_lines(struct ComposeRedrawData *rd)
 
   if ((e->security & (SEC_ENCRYPT | SEC_SIGN)) == (SEC_ENCRYPT | SEC_SIGN))
   {
-    SET_COLOR(MT_COLOR_COMPOSE_SECURITY_BOTH);
+    mutt_curses_set_color(MT_COLOR_COMPOSE_SECURITY_BOTH);
     addstr(_("Sign, Encrypt"));
   }
   else if (e->security & SEC_ENCRYPT)
   {
-    SET_COLOR(MT_COLOR_COMPOSE_SECURITY_ENCRYPT);
+    mutt_curses_set_color(MT_COLOR_COMPOSE_SECURITY_ENCRYPT);
     addstr(_("Encrypt"));
   }
   else if (e->security & SEC_SIGN)
   {
-    SET_COLOR(MT_COLOR_COMPOSE_SECURITY_SIGN);
+    mutt_curses_set_color(MT_COLOR_COMPOSE_SECURITY_SIGN);
     addstr(_("Sign"));
   }
   else
   {
     /* L10N: This refers to the encryption of the email, e.g. "Security: None" */
-    SET_COLOR(MT_COLOR_COMPOSE_SECURITY_NONE);
+    mutt_curses_set_color(MT_COLOR_COMPOSE_SECURITY_NONE);
     addstr(_("None"));
   }
   NORMAL_COLOR;
@@ -427,7 +427,7 @@ static void redraw_crypt_lines(struct ComposeRedrawData *rd)
   if (((WithCrypto & APPLICATION_PGP) != 0) &&
       (e->security & APPLICATION_PGP) && (e->security & SEC_SIGN))
   {
-    SET_COLOR(MT_COLOR_COMPOSE_HEADER);
+    mutt_curses_set_color(MT_COLOR_COMPOSE_HEADER);
     printw("%*s", HeaderPadding[HDR_CRYPTINFO], _(Prompts[HDR_CRYPTINFO]));
     NORMAL_COLOR;
     printw("%s", C_PgpSignAs ? C_PgpSignAs : _("<default>"));
@@ -436,7 +436,7 @@ static void redraw_crypt_lines(struct ComposeRedrawData *rd)
   if (((WithCrypto & APPLICATION_SMIME) != 0) &&
       (e->security & APPLICATION_SMIME) && (e->security & SEC_SIGN))
   {
-    SET_COLOR(MT_COLOR_COMPOSE_HEADER);
+    mutt_curses_set_color(MT_COLOR_COMPOSE_HEADER);
     printw("%*s", HeaderPadding[HDR_CRYPTINFO], _(Prompts[HDR_CRYPTINFO]));
     NORMAL_COLOR;
     printw("%s", C_SmimeSignAs ? C_SmimeSignAs : _("<default>"));
@@ -445,7 +445,7 @@ static void redraw_crypt_lines(struct ComposeRedrawData *rd)
   if (((WithCrypto & APPLICATION_SMIME) != 0) && (e->security & APPLICATION_SMIME) &&
       (e->security & SEC_ENCRYPT) && C_SmimeEncryptWith)
   {
-    SET_COLOR(MT_COLOR_COMPOSE_HEADER);
+    mutt_curses_set_color(MT_COLOR_COMPOSE_HEADER);
     mutt_window_mvprintw(rd->win, HDR_CRYPTINFO, 40, "%s", _("Encrypt with: "));
     NORMAL_COLOR;
     printw("%s", NONULL(C_SmimeEncryptWith));
@@ -456,21 +456,21 @@ static void redraw_crypt_lines(struct ComposeRedrawData *rd)
   mutt_window_clrtoeol(rd->win);
   if (C_Autocrypt)
   {
-    SET_COLOR(MT_COLOR_COMPOSE_HEADER);
+    mutt_curses_set_color(MT_COLOR_COMPOSE_HEADER);
     printw("%*s", HeaderPadding[HDR_AUTOCRYPT], _(Prompts[HDR_AUTOCRYPT]));
     NORMAL_COLOR;
     if (e->security & SEC_AUTOCRYPT)
     {
-      SET_COLOR(MT_COLOR_COMPOSE_SECURITY_ENCRYPT);
+      mutt_curses_set_color(MT_COLOR_COMPOSE_SECURITY_ENCRYPT);
       addstr(_("Encrypt"));
     }
     else
     {
-      SET_COLOR(MT_COLOR_COMPOSE_SECURITY_NONE);
+      mutt_curses_set_color(MT_COLOR_COMPOSE_SECURITY_NONE);
       addstr(_("Off"));
     }
 
-    SET_COLOR(MT_COLOR_COMPOSE_HEADER);
+    mutt_curses_set_color(MT_COLOR_COMPOSE_HEADER);
     mutt_window_mvprintw(rd->win, HDR_AUTOCRYPT, 40, "%s",
                          /* L10N:
                              The autocrypt compose menu Recommendation field.
@@ -534,7 +534,7 @@ static void redraw_mix_line(struct ListHead *chain, struct ComposeRedrawData *rd
 {
   char *t = NULL;
 
-  SET_COLOR(MT_COLOR_COMPOSE_HEADER);
+  mutt_curses_set_color(MT_COLOR_COMPOSE_HEADER);
   mutt_window_mvprintw(rd->win, HDR_MIX, 0, "%*s", HeaderPadding[HDR_MIX],
                        _(Prompts[HDR_MIX]));
   NORMAL_COLOR;
@@ -617,7 +617,7 @@ static void draw_envelope_addr(int line, struct AddressList *al, struct ComposeR
 
   buf[0] = '\0';
   mutt_addrlist_write(buf, sizeof(buf), al, true);
-  SET_COLOR(MT_COLOR_COMPOSE_HEADER);
+  mutt_curses_set_color(MT_COLOR_COMPOSE_HEADER);
   mutt_window_mvprintw(rd->win, line, 0, "%*s", HeaderPadding[line], _(Prompts[line]));
   NORMAL_COLOR;
   mutt_paddstr(W, buf);
@@ -659,7 +659,7 @@ static void draw_envelope(struct ComposeRedrawData *rd)
   }
 #endif
 
-  SET_COLOR(MT_COLOR_COMPOSE_HEADER);
+  mutt_curses_set_color(MT_COLOR_COMPOSE_HEADER);
   mutt_window_mvprintw(rd->win, HDR_SUBJECT, 0, "%*s",
                        HeaderPadding[HDR_SUBJECT], _(Prompts[HDR_SUBJECT]));
   NORMAL_COLOR;
@@ -667,7 +667,7 @@ static void draw_envelope(struct ComposeRedrawData *rd)
 
   draw_envelope_addr(HDR_REPLYTO, &e->env->reply_to, rd);
 
-  SET_COLOR(MT_COLOR_COMPOSE_HEADER);
+  mutt_curses_set_color(MT_COLOR_COMPOSE_HEADER);
   mutt_window_mvprintw(rd->win, HDR_FCC, 0, "%*s", HeaderPadding[HDR_FCC],
                        _(Prompts[HDR_FCC]));
   NORMAL_COLOR;
@@ -680,7 +680,7 @@ static void draw_envelope(struct ComposeRedrawData *rd)
   redraw_mix_line(&e->chain, rd);
 #endif
 
-  SET_COLOR(MT_COLOR_STATUS);
+  mutt_curses_set_color(MT_COLOR_STATUS);
   mutt_window_mvaddstr(rd->win, HDR_ATTACH_TITLE, 0, _("-- Attachments"));
   mutt_window_clrtoeol(rd->win);
 
@@ -866,7 +866,7 @@ static void compose_custom_redraw(struct Menu *menu)
     compose_status_line(buf, sizeof(buf), 0, menu->statuswin->cols, menu,
                         NONULL(C_ComposeFormat));
     mutt_window_move(menu->statuswin, 0, 0);
-    SET_COLOR(MT_COLOR_STATUS);
+    mutt_curses_set_color(MT_COLOR_STATUS);
     mutt_paddstr(menu->statuswin->cols, buf);
     NORMAL_COLOR;
     menu->redraw &= ~REDRAW_STATUS;
index dbbf0c0eb1cd818dac11caa92b797f4f966ef553..29e6a974226e1799ed8f8a5705ab74c985031ca9 100644 (file)
@@ -262,7 +262,7 @@ int mutt_get_field_full(const char *field, char *buf, size_t buflen, CompletionF
       mutt_menu_current_redraw();
     }
     mutt_window_clearline(MuttMessageWindow, 0);
-    SET_COLOR(MT_COLOR_PROMPT);
+    mutt_curses_set_color(MT_COLOR_PROMPT);
     addstr(field);
     NORMAL_COLOR;
     mutt_refresh();
@@ -392,7 +392,7 @@ enum QuadOption mutt_yesorno(const char *msg, enum QuadOption def)
           ((size_t) prompt_lines * MuttMessageWindow->cols) - answer_string_wid, NULL);
 
       mutt_window_move(MuttMessageWindow, 0, 0);
-      SET_COLOR(MT_COLOR_PROMPT);
+      mutt_curses_set_color(MT_COLOR_PROMPT);
       addnstr(msg, trunc_msg_len);
       addstr(answer_string);
       NORMAL_COLOR;
@@ -488,7 +488,7 @@ void mutt_show_error(void)
   if (OptKeepQuiet || !ErrorBufMessage)
     return;
 
-  SET_COLOR(OptMsgErr ? MT_COLOR_ERROR : MT_COLOR_MESSAGE);
+  mutt_curses_set_color(OptMsgErr ? MT_COLOR_ERROR : MT_COLOR_MESSAGE);
   mutt_window_mvaddstr(MuttMessageWindow, 0, 0, ErrorBuf);
   NORMAL_COLOR;
   mutt_window_clrtoeol(MuttMessageWindow);
@@ -656,7 +656,7 @@ int mutt_buffer_enter_fname_full(const char *prompt, struct Buffer *fname,
 {
   struct KeyEvent ch;
 
-  SET_COLOR(MT_COLOR_PROMPT);
+  mutt_curses_set_color(MT_COLOR_PROMPT);
   mutt_window_mvaddstr(MuttMessageWindow, 0, 0, prompt);
   addstr(_(" ('?' for list): "));
   NORMAL_COLOR;
@@ -890,13 +890,13 @@ int mutt_multi_choice(const char *prompt, const char *letters)
         while ((cur = strchr(prompt, '(')))
         {
           // write the part between prompt and cur using MT_COLOR_PROMPT
-          SET_COLOR(MT_COLOR_PROMPT);
+          mutt_curses_set_color(MT_COLOR_PROMPT);
           addnstr(prompt, cur - prompt);
 
           if (isalnum(cur[1]) && (cur[2] == ')'))
           {
             // we have a single letter within parentheses
-            SET_COLOR(MT_COLOR_OPTIONS);
+            mutt_curses_set_color(MT_COLOR_OPTIONS);
             addch(cur[1]);
             prompt = cur + 3;
           }
@@ -909,7 +909,7 @@ int mutt_multi_choice(const char *prompt, const char *letters)
         }
       }
 
-      SET_COLOR(MT_COLOR_PROMPT);
+      mutt_curses_set_color(MT_COLOR_PROMPT);
       addstr(prompt);
       NORMAL_COLOR;
 
diff --git a/index.c b/index.c
index 25f50207420591d32cd5a9cdcb2addadaf837dd1..6d32ca29d213d7ccc7c2628a1372a2389cd01831 100644 (file)
--- a/index.c
+++ b/index.c
@@ -1009,7 +1009,7 @@ static void index_custom_redraw(struct Menu *menu)
     char buf[1024];
     menu_status_line(buf, sizeof(buf), menu, NONULL(C_StatusFormat));
     mutt_window_move(menu->statuswin, 0, 0);
-    SET_COLOR(MT_COLOR_STATUS);
+    mutt_curses_set_color(MT_COLOR_STATUS);
     mutt_draw_statusline(menu->statuswin->cols, buf, sizeof(buf));
     NORMAL_COLOR;
     menu->redraw &= ~REDRAW_STATUS;
diff --git a/menu.c b/menu.c
index 073f24e99bd6e31d04747e3cfcbd1ab8ad1655ff..a5caa6753697b8fd6579707f4844febb4ab04e43 100644 (file)
--- a/menu.c
+++ b/menu.c
@@ -158,7 +158,7 @@ static void print_enriched_string(int index, int attr, unsigned char *s, bool do
          * may be undefined. */
         ATTR_SET(mutt_color_combine(ColorDefs[MT_COLOR_TREE], attr));
 #else
-        SET_COLOR(MT_COLOR_TREE);
+        mutt_curses_set_color(MT_COLOR_TREE);
 #endif
 
       while (*s && (*s < MUTT_TREE_MAX))
@@ -367,7 +367,7 @@ void menu_redraw_full(struct Menu *menu)
 
   if (C_Help)
   {
-    SET_COLOR(MT_COLOR_STATUS);
+    mutt_curses_set_color(MT_COLOR_STATUS);
     mutt_window_move(MuttHelpWindow, 0, 0);
     mutt_paddstr(MuttHelpWindow->cols, menu->help);
     NORMAL_COLOR;
@@ -392,7 +392,7 @@ void menu_redraw_status(struct Menu *menu)
   char buf[256];
 
   snprintf(buf, sizeof(buf), "-- NeoMutt: %s", menu->title);
-  SET_COLOR(MT_COLOR_STATUS);
+  mutt_curses_set_color(MT_COLOR_STATUS);
   mutt_window_move(menu->statuswin, 0, 0);
   mutt_paddstr(menu->statuswin->cols, buf);
   NORMAL_COLOR;
@@ -436,7 +436,7 @@ void menu_redraw_index(struct Menu *menu)
 
       if (i == menu->current)
       {
-        SET_COLOR(MT_COLOR_INDICATOR);
+        mutt_curses_set_color(MT_COLOR_INDICATOR);
         if (C_ArrowCursor)
         {
           addstr("->");
@@ -497,7 +497,7 @@ void menu_redraw_motion(struct Menu *menu)
     }
 
     /* now draw it in the new location */
-    SET_COLOR(MT_COLOR_INDICATOR);
+    mutt_curses_set_color(MT_COLOR_INDICATOR);
     mutt_window_mvaddstr(menu->indexwin, menu->current + menu->offset - menu->top, 0, "->");
   }
   else
@@ -511,7 +511,7 @@ void menu_redraw_motion(struct Menu *menu)
     const int cur_color = menu->menu_color(menu->current);
     menu_make_entry(buf, sizeof(buf), menu, menu->current);
     menu_pad_string(menu, buf, sizeof(buf));
-    SET_COLOR(MT_COLOR_INDICATOR);
+    mutt_curses_set_color(MT_COLOR_INDICATOR);
     mutt_window_move(menu->indexwin, menu->current + menu->offset - menu->top, 0);
     print_enriched_string(menu->current, cur_color, (unsigned char *) buf, false);
   }
@@ -532,7 +532,7 @@ void menu_redraw_current(struct Menu *menu)
   menu_make_entry(buf, sizeof(buf), menu, menu->current);
   menu_pad_string(menu, buf, sizeof(buf));
 
-  SET_COLOR(MT_COLOR_INDICATOR);
+  mutt_curses_set_color(MT_COLOR_INDICATOR);
   if (C_ArrowCursor)
   {
     addstr("->");
diff --git a/mutt_curses.c b/mutt_curses.c
new file mode 100644 (file)
index 0000000..1214645
--- /dev/null
@@ -0,0 +1,50 @@
+/**
+ * @file
+ * Define wrapper functions around Curses/Slang
+ *
+ * @authors
+ * Copyright (C) 1996-2000,2012 Michael R. Elkins <me@mutt.org>
+ * Copyright (C) 2004 g10 Code GmbH
+ * Copyright (C) 2019 Richard Russon <rich@flatcap.org>
+ *
+ * @copyright
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 2 of the License, or (at your option) any later
+ * version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "config.h"
+#include "mutt_curses.h"
+#include "color.h"
+
+/**
+ * mutt_curses_set_color - Set the current colour for text
+ * @param color Colour to set, e.g. #MT_COLOR_HEADER
+ *
+ * If the system has bkgdset() use it rather than attrset() so that the clr*()
+ * functions will properly set the background attributes all the way to the
+ * right column.
+ */
+void mutt_curses_set_color(enum ColorId color)
+{
+#ifdef HAVE_BKGDSET
+  if (ColorDefs[color] != 0)
+    bkgdset(ColorDefs[color] | ' ');
+  else
+    bkgdset(ColorDefs[MT_COLOR_NORMAL] | ' ');
+#else
+  if (ColorDefs[color] != 0)
+    attrset(ColorDefs[color]);
+  else
+    attrset(ColorDefs[MT_COLOR_NORMAL]);
+#endif
+}
index b6a893f41c9c86636f22bbc5401e2db9c1a5fb86..7ba196586f34db136f0ed0a54d7f83b2f5d7b1d0 100644 (file)
@@ -26,6 +26,7 @@
 
 #include "config.h"
 #include <stdbool.h>
+#include "color.h"
 
 #ifdef USE_SLANG_CURSES
 
@@ -101,31 +102,12 @@ void mutt_curs_set(int cursor);
 #define CI_is_return(ch) (((ch) == '\r') || ((ch) == '\n'))
 #endif
 
+void mutt_curses_set_color(enum ColorId color);
 void mutt_resize_screen(void);
 
-/* If the system has bkgdset() use it rather than attrset() so that the clr*()
- * functions will properly set the background attributes all the way to the
- * right column.
- */
 #ifdef HAVE_BKGDSET
-#define SET_COLOR(X)                                                            \
-  do                                                                           \
-  {                                                                            \
-    if (ColorDefs[X] != 0)                                                     \
-      bkgdset(ColorDefs[X] | ' ');                                             \
-    else                                                                       \
-      bkgdset(ColorDefs[MT_COLOR_NORMAL] | ' ');                               \
-  } while (false)
 #define ATTR_SET(X) bkgdset(X | ' ')
 #else
-#define SET_COLOR(X)                                                            \
-  do                                                                           \
-  {                                                                            \
-    if (ColorDefs[X] != 0)                                                     \
-      attrset(ColorDefs[X]);                                                   \
-    else                                                                       \
-      attrset(ColorDefs[MT_COLOR_NORMAL]);                                     \
-  } while (false)
 #define ATTR_SET attrset
 #endif
 
index e4e0ee910bd3d41159c95087ce77362e42b4b9cd..ba9b88be890393f8f5e817306e464db4d9a9534c 100644 (file)
@@ -172,7 +172,7 @@ int log_disp_curses(time_t stamp, const char *file, int line,
   {
     if (level == LL_ERROR)
       BEEP();
-    SET_COLOR((level == LL_ERROR) ? MT_COLOR_ERROR : MT_COLOR_MESSAGE);
+    mutt_curses_set_color((level == LL_ERROR) ? MT_COLOR_ERROR : MT_COLOR_MESSAGE);
     mutt_window_mvaddstr(MuttMessageWindow, 0, 0, ErrorBuf);
     NORMAL_COLOR;
     mutt_window_clrtoeol(MuttMessageWindow);
diff --git a/pager.c b/pager.c
index 3afa3ab79246f8cb2ad6f5346963ead8c6e66ba5..c9c746e4b65b047d0d10e0753f29326fd2df93b6 100644 (file)
--- a/pager.c
+++ b/pager.c
@@ -376,7 +376,7 @@ static void resolve_color(struct Line *line_info, int n, int cnt,
   {
     if (!cnt && C_Markers)
     {
-      SET_COLOR(MT_COLOR_MARKERS);
+      mutt_curses_set_color(MT_COLOR_MARKERS);
       addch('+');
       last_color = ColorDefs[MT_COLOR_MARKERS];
     }
@@ -1991,7 +1991,7 @@ static void pager_custom_redraw(struct Menu *pager_menu)
 
     if (C_Help)
     {
-      SET_COLOR(MT_COLOR_STATUS);
+      mutt_curses_set_color(MT_COLOR_STATUS);
       mutt_window_move(MuttHelpWindow, 0, 0);
       mutt_paddstr(MuttHelpWindow->cols, rd->helpstr);
       NORMAL_COLOR;
@@ -2134,7 +2134,7 @@ static void pager_custom_redraw(struct Menu *pager_menu)
       rd->last_offset = rd->line_info[rd->curline].offset;
     } while (rd->force_redraw);
 
-    SET_COLOR(MT_COLOR_TILDE);
+    mutt_curses_set_color(MT_COLOR_TILDE);
     while (rd->lines < rd->pager_window->rows)
     {
       mutt_window_clrtoeol(rd->pager_window);
@@ -2177,7 +2177,7 @@ static void pager_custom_redraw(struct Menu *pager_menu)
 
     /* print out the pager status bar */
     mutt_window_move(rd->pager_status_window, 0, 0);
-    SET_COLOR(MT_COLOR_STATUS);
+    mutt_curses_set_color(MT_COLOR_STATUS);
 
     if (IsEmail(rd->extra) || IsMsgAttach(rd->extra))
     {
@@ -2215,7 +2215,7 @@ static void pager_custom_redraw(struct Menu *pager_menu)
     menu_status_line(buf, sizeof(buf), rd->menu, NONULL(C_StatusFormat));
 
     mutt_window_move(rd->index_status_window, 0, 0);
-    SET_COLOR(MT_COLOR_STATUS);
+    mutt_curses_set_color(MT_COLOR_STATUS);
     mutt_draw_statusline(rd->index_status_window->cols, buf, sizeof(buf));
     NORMAL_COLOR;
   }
index 9f41eccdbbb516438e82d6bcfcfba17e8f19927c..d86fa8520ec93cbb52fd0cfc064d0f26f925d73c 100644 (file)
@@ -81,7 +81,7 @@ static void message_bar(int percent, const char *fmt, ...)
     if (l < w)
     {
       /* The string fits within the colour bar */
-      SET_COLOR(MT_COLOR_PROGRESS);
+      mutt_curses_set_color(MT_COLOR_PROGRESS);
       addstr(buf2);
       w -= l;
       while (w-- > 0)
@@ -97,7 +97,7 @@ static void message_bar(int percent, const char *fmt, ...)
 
       char ch = buf2[off];
       buf2[off] = '\0';
-      SET_COLOR(MT_COLOR_PROGRESS);
+      mutt_curses_set_color(MT_COLOR_PROGRESS);
       addstr(buf2);
       buf2[off] = ch;
       NORMAL_COLOR;
index 3bc71617fdecc38d20d35159921ca14f26d6d9e3..0cb794d6b2ca881acab9fe956d80f4911e7261dd 100644 (file)
@@ -331,7 +331,7 @@ static void mix_redraw_ce(struct Remailer **type2_list, struct Coord *coords,
   if (coords[i].r < MIX_MAXROW)
   {
     if (selected)
-      SET_COLOR(MT_COLOR_INDICATOR);
+      mutt_curses_set_color(MT_COLOR_INDICATOR);
     else
       NORMAL_COLOR;
 
@@ -370,7 +370,7 @@ static void mix_redraw_chain(struct Remailer **type2_list, struct Coord *coords,
  */
 static void mix_redraw_head(struct MixChain *chain)
 {
-  SET_COLOR(MT_COLOR_STATUS);
+  mutt_curses_set_color(MT_COLOR_STATUS);
   mutt_window_mvprintw(MuttIndexWindow, MIX_VOFFSET - 1, 0,
                        "-- Remailer chain [Length: %d]", chain ? chain->cl : 0);
   mutt_window_clrtoeol(MuttIndexWindow);
index 8aae4593bd8e0cc4cc48145b7e12f55166c21684..8b2ae9e9cc8582c06b49e307b6ba73241374d24d 100644 (file)
--- a/sidebar.c
+++ b/sidebar.c
@@ -747,7 +747,7 @@ static int draw_divider(int num_rows, int num_cols)
   if (delim_len > num_cols)
     return 0;
 
-  SET_COLOR(MT_COLOR_DIVIDER);
+  mutt_curses_set_color(MT_COLOR_DIVIDER);
 
   int col = C_SidebarOnRight ? 0 : (C_SidebarWidth - delim_len);
 
@@ -836,25 +836,25 @@ static void draw_sidebar(int num_rows, int num_cols, int div_width)
     if (entryidx == OpnIndex)
     {
       if ((ColorDefs[MT_COLOR_SB_INDICATOR] != 0))
-        SET_COLOR(MT_COLOR_SB_INDICATOR);
+        mutt_curses_set_color(MT_COLOR_SB_INDICATOR);
       else
-        SET_COLOR(MT_COLOR_INDICATOR);
+        mutt_curses_set_color(MT_COLOR_INDICATOR);
     }
     else if (entryidx == HilIndex)
-      SET_COLOR(MT_COLOR_HIGHLIGHT);
+      mutt_curses_set_color(MT_COLOR_HIGHLIGHT);
     else if ((m->msg_unread > 0) || (m->has_new))
-      SET_COLOR(MT_COLOR_NEW);
+      mutt_curses_set_color(MT_COLOR_NEW);
     else if (m->msg_flagged > 0)
-      SET_COLOR(MT_COLOR_FLAGGED);
+      mutt_curses_set_color(MT_COLOR_FLAGGED);
     else if ((ColorDefs[MT_COLOR_SB_SPOOLFILE] != 0) &&
              (mutt_str_strcmp(mailbox_path(m), C_Spoolfile) == 0))
     {
-      SET_COLOR(MT_COLOR_SB_SPOOLFILE);
+      mutt_curses_set_color(MT_COLOR_SB_SPOOLFILE);
     }
     else
     {
       if (ColorDefs[MT_COLOR_ORDINARY] != 0)
-        SET_COLOR(MT_COLOR_ORDINARY);
+        mutt_curses_set_color(MT_COLOR_ORDINARY);
       else
         NORMAL_COLOR;
     }