Add proper dflags
[apps/madmutt.git] / lib-ui / curs_main.c
index 3fe1cd3..2103d25 100644 (file)
@@ -86,7 +86,6 @@ static const char *No_visible = N_("No visible messages.");
 #define CURHDR Context->hdrs[Context->v2r[menu->current]]
 #define OLDHDR Context->hdrs[Context->v2r[menu->oldcurrent]]
 #define UNREAD(h) mutt_thread_contains_unread (Context, h)
-#define SW              (option(OPTMBOXPANE)?SidebarWidth:0)
 
 extern size_t UngetCount;
 
@@ -498,13 +497,13 @@ int mutt_index_menu (void)
 
       if (menu->redraw & REDRAW_STATUS) {
         menu_status_line (buf, sizeof (buf), menu, NONULL (Status));
-        CLEARLINE (option (OPTSTATUSONTOP) ? 0 : LINES - 2);
-        SETCOLOR (MT_COLOR_STATUS);
-        BKGDSET (MT_COLOR_STATUS);
-        wmove(stdscr, option (OPTSTATUSONTOP) ? 0 : LINES - 2,SW);
-        mutt_paddstr (COLS-SW, buf);
-        SETCOLOR (MT_COLOR_NORMAL);
-        BKGDSET (MT_COLOR_NORMAL);
+        CLEARLINE(main_w, 0);
+        SETCOLOR(main_w, MT_COLOR_STATUS);
+        BKGDSET(main_w, MT_COLOR_STATUS);
+        wmove(main_w, 0, 0);
+        mutt_paddstr (main_w, getmaxx(main_w), buf);
+        SETCOLOR(main_w, MT_COLOR_NORMAL);
+        BKGDSET(main_w, MT_COLOR_NORMAL);
         sidebar_set_buffystats (Context);
         menu->redraw &= ~REDRAW_STATUS;
         if (option (OPTXTERMSETTITLES)) {
@@ -521,11 +520,6 @@ int mutt_index_menu (void)
         menu->oldcurrent = menu->current;
       else
         menu->oldcurrent = -1;
-
-      if (option (OPTBRAILLEFRIENDLY))
-         wmove (stdscr, menu->current - menu->top + menu->offset, 0);
-      else
-        wmove (stdscr, menu->current - menu->top + menu->offset, COLS - 1);
       mutt_refresh ();
 
       if (SigWinch) {
@@ -559,13 +553,13 @@ int mutt_index_menu (void)
         tag = 1;
 
         /* give visual indication that the next command is a tag- command */
-        mvwaddstr (stdscr, LINES - 1, 0, "tag-");
-        wclrtoeol (stdscr);
+        mvwaddstr (main_w, LINES - 1, 0, "tag-");
+        wclrtoeol (main_w);
 
         /* get the real command */
         if ((op = km_dokey (MENU_MAIN)) == OP_TAG_PREFIX) {
           /* abort tag sequence */
-          CLEARLINE (LINES - 1);
+          CLEARLINE(main_w, LINES - 1);
           continue;
         }
       }
@@ -594,13 +588,13 @@ int mutt_index_menu (void)
         tag = 1;
 
         /* give visual indication that the next command is a tag- command */
-        mvwaddstr (stdscr, LINES - 1, 0, "tag-");
-        wclrtoeol (stdscr);
+        mvwaddstr (main_w, LINES - 1, 0, "tag-");
+        wclrtoeol (main_w);
 
         /* get the real command */
         if ((op = km_dokey (MENU_MAIN)) == OP_TAG_PREFIX) {
           /* abort tag sequence */
-          CLEARLINE (LINES - 1);
+          CLEARLINE(main_w, LINES - 1);
           continue;
         }
       }
@@ -774,7 +768,6 @@ int mutt_index_menu (void)
 #endif
 
     case OP_JUMP:
-
       CHECK_MSGCOUNT;
       CHECK_VISIBLE;
       if (isdigit (LastKey))
@@ -825,7 +818,6 @@ int mutt_index_menu (void)
        */
 
     case OP_MAIN_DELETE_PATTERN:
-
       CHECK_MSGCOUNT;
       CHECK_VISIBLE;
       CHECK_READONLY;
@@ -838,14 +830,12 @@ int mutt_index_menu (void)
       break;
 
     case OP_MAIN_FETCH_MAIL:
-
       CHECK_ATTACH;
       pop_fetch_mail ();
       menu->redraw = REDRAW_FULL;
       break;
 
     case OP_HELP:
-
       mutt_help (MENU_MAIN);
       menu->redraw = REDRAW_FULL;
       break;
@@ -866,7 +856,6 @@ int mutt_index_menu (void)
 
     case OP_MAIN_LIMIT:
     case OP_TOGGLE_READ:
-
       CHECK_IN_MAILBOX;
       menu->oldcurrent = (Context->vcount && menu->current >= 0
                           && menu->current <
@@ -914,7 +903,6 @@ int mutt_index_menu (void)
       break;
 
     case OP_QUIT:
-
       closed = op;
       if (attach_msg) {
         done = 1;
@@ -940,8 +928,7 @@ int mutt_index_menu (void)
       break;
 
     case OP_REDRAW:
-
-      clearok (stdscr, TRUE);
+      clearok (main_w, TRUE);
       menu->redraw = REDRAW_FULL;
       break;
 
@@ -949,7 +936,6 @@ int mutt_index_menu (void)
     case OP_SEARCH_REVERSE:
     case OP_SEARCH_NEXT:
     case OP_SEARCH_OPPOSITE:
-
       CHECK_MSGCOUNT;
       CHECK_VISIBLE;
       if ((menu->current = mutt_search_command (menu->current, op)) == -1)
@@ -960,7 +946,6 @@ int mutt_index_menu (void)
 
     case OP_SORT:
     case OP_SORT_REVERSE:
-
       if (mutt_select_sort ((op == OP_SORT_REVERSE)) == 0) {
         if (Context && Context->msgcount) {
           resort_index (menu);
@@ -970,7 +955,6 @@ int mutt_index_menu (void)
       break;
 
     case OP_TAG:
-
       CHECK_MSGCOUNT;
       CHECK_VISIBLE;
       if (tag && !option (OPTAUTOTAG)) {
@@ -994,7 +978,6 @@ int mutt_index_menu (void)
       break;
 
     case OP_MAIN_TAG_PATTERN:
-
       CHECK_MSGCOUNT;
       CHECK_VISIBLE;
       mutt_pattern_func (M_TAG, _("Tag messages matching: "));
@@ -1002,7 +985,6 @@ int mutt_index_menu (void)
       break;
 
     case OP_MAIN_UNDELETE_PATTERN:
-
       CHECK_MSGCOUNT;
       CHECK_VISIBLE;
       CHECK_READONLY;
@@ -1015,7 +997,6 @@ int mutt_index_menu (void)
       break;
 
     case OP_MAIN_UNTAG_PATTERN:
-
       CHECK_MSGCOUNT;
       CHECK_VISIBLE;
       if (mutt_pattern_func (M_UNTAG, _("Untag messages matching: ")) == 0)
@@ -1032,7 +1013,6 @@ int mutt_index_menu (void)
       break;
 
     case OP_MAIN_SYNC_FOLDER:
-
       if (Context && !Context->msgcount)
         break;
 
@@ -1089,7 +1069,7 @@ int mutt_index_menu (void)
     case OP_MAIN_CHANGE_GROUP:
     case OP_MAIN_CHANGE_GROUP_READONLY:
 #endif
-      if (attach_msg || option (OPTREADONLY) ||
+      if (attach_msg ||
 #ifdef USE_NNTP
           op == OP_MAIN_CHANGE_GROUP_READONLY ||
 #endif
@@ -1136,7 +1116,7 @@ int mutt_index_menu (void)
           break;
       }
       if (!buf[0]) {
-        CLEARLINE (LINES - 1);
+        CLEARLINE(main_w, LINES - 1);
         break;
       }
 
@@ -1232,7 +1212,6 @@ int mutt_index_menu (void)
       continue;
 
     case OP_EXIT:
-
       closed = op;
       if (menu->menu == MENU_MAIN && attach_msg) {
         done = 1;
@@ -1252,7 +1231,6 @@ int mutt_index_menu (void)
       break;
 
     case OP_EDIT_TYPE:
-
       CHECK_MSGCOUNT;
       CHECK_VISIBLE;
       CHECK_ATTACH;
@@ -1267,7 +1245,6 @@ int mutt_index_menu (void)
       break;
 
     case OP_MAIN_BREAK_THREAD:
-
       CHECK_MSGCOUNT;
       CHECK_VISIBLE;
       CHECK_READONLY;
@@ -1297,7 +1274,6 @@ int mutt_index_menu (void)
       break;
 
     case OP_MAIN_LINK_THREADS:
-
       CHECK_MSGCOUNT;
       CHECK_VISIBLE;
       CHECK_READONLY;
@@ -1335,7 +1311,6 @@ int mutt_index_menu (void)
       break;
 
     case OP_MAIN_NEXT_UNDELETED:
-
       CHECK_MSGCOUNT;
       CHECK_VISIBLE;
       if (menu->current >= Context->vcount - 1) {
@@ -1358,7 +1333,6 @@ int mutt_index_menu (void)
       break;
 
     case OP_NEXT_ENTRY:
-
       CHECK_MSGCOUNT;
       CHECK_VISIBLE;
       if (menu->current >= Context->vcount - 1) {
@@ -1377,7 +1351,6 @@ int mutt_index_menu (void)
       break;
 
     case OP_MAIN_PREV_UNDELETED:
-
       CHECK_MSGCOUNT;
       CHECK_VISIBLE;
       if (menu->current < 1) {
@@ -1399,7 +1372,6 @@ int mutt_index_menu (void)
       break;
 
     case OP_PREV_ENTRY:
-
       CHECK_MSGCOUNT;
       CHECK_VISIBLE;
       if (menu->current < 1) {
@@ -1458,7 +1430,6 @@ int mutt_index_menu (void)
     case OP_MAIN_PREV_UNREAD:
     case OP_MAIN_NEXT_NEW_THEN_UNREAD:
     case OP_MAIN_PREV_NEW_THEN_UNREAD:
-
       {
         int first_unread = -1;
         int first_new = -1;
@@ -1540,7 +1511,6 @@ int mutt_index_menu (void)
         break;
       }
     case OP_FLAG_MESSAGE:
-
       CHECK_MSGCOUNT;
       CHECK_VISIBLE;
       CHECK_READONLY;
@@ -1573,7 +1543,6 @@ int mutt_index_menu (void)
       break;
 
     case OP_TOGGLE_NEW:
-
       CHECK_MSGCOUNT;
       CHECK_VISIBLE;
       CHECK_READONLY;
@@ -1615,7 +1584,6 @@ int mutt_index_menu (void)
       break;
 
     case OP_TOGGLE_WRITE:
-
       CHECK_IN_MAILBOX;
       if (mx_toggle_write (Context) == 0)
         menu->redraw |= REDRAW_STATUS;
@@ -1625,7 +1593,6 @@ int mutt_index_menu (void)
     case OP_MAIN_NEXT_SUBTHREAD:
     case OP_MAIN_PREV_THREAD:
     case OP_MAIN_PREV_SUBTHREAD:
-
       CHECK_MSGCOUNT;
       CHECK_VISIBLE;
       switch (op) {
@@ -1663,7 +1630,6 @@ int mutt_index_menu (void)
       break;
 
     case OP_MAIN_PARENT_MESSAGE:
-
       CHECK_MSGCOUNT;
       CHECK_VISIBLE;
 
@@ -1680,7 +1646,6 @@ int mutt_index_menu (void)
 
     case OP_MAIN_SET_FLAG:
     case OP_MAIN_CLEAR_FLAG:
-
       CHECK_MSGCOUNT;
       CHECK_VISIBLE;
       CHECK_READONLY;
@@ -1789,7 +1754,6 @@ int mutt_index_menu (void)
        */
 
     case OP_BOUNCE_MESSAGE:
-
       CHECK_ATTACH;
       CHECK_MSGCOUNT;
       CHECK_VISIBLE;
@@ -1797,7 +1761,6 @@ int mutt_index_menu (void)
       break;
 
     case OP_CREATE_ALIAS:
-
       mutt_create_alias (Context
                          && Context->vcount ? CURHDR->env : NULL, NULL);
       MAYBE_REDRAW (menu->redraw);
@@ -1812,7 +1775,6 @@ int mutt_index_menu (void)
 
     case OP_PURGE_MESSAGE:
     case OP_DELETE:
-
       CHECK_MSGCOUNT;
       CHECK_VISIBLE;
       CHECK_READONLY;
@@ -1852,7 +1814,6 @@ int mutt_index_menu (void)
 
     case OP_DELETE_THREAD:
     case OP_DELETE_SUBTHREAD:
-
       CHECK_MSGCOUNT;
       CHECK_VISIBLE;
       CHECK_READONLY;
@@ -1884,14 +1845,12 @@ int mutt_index_menu (void)
 #endif
 
     case OP_DISPLAY_ADDRESS:
-
       CHECK_MSGCOUNT;
       CHECK_VISIBLE;
       mutt_display_address (CURHDR->env);
       break;
 
     case OP_ENTER_COMMAND:
-
       CurrentMenu = MENU_MAIN;
       mutt_enter_command ();
       mutt_check_rescore (Context);
@@ -1902,7 +1861,6 @@ int mutt_index_menu (void)
       break;
 
     case OP_EDIT_MESSAGE:
-
       CHECK_MSGCOUNT;
       CHECK_VISIBLE;
       CHECK_READONLY;
@@ -1918,7 +1876,6 @@ int mutt_index_menu (void)
       break;
 
     case OP_FORWARD_MESSAGE:
-
       CHECK_MSGCOUNT;
       CHECK_VISIBLE;
       CHECK_ATTACH;
@@ -1930,7 +1887,6 @@ int mutt_index_menu (void)
       break;
 
     case OP_GROUP_REPLY:
-
       CHECK_MSGCOUNT;
       CHECK_VISIBLE;
       CHECK_ATTACH;
@@ -1944,7 +1900,6 @@ int mutt_index_menu (void)
       break;
 
     case OP_LIST_REPLY:
-
       CHECK_ATTACH;
       CHECK_MSGCOUNT;
       CHECK_VISIBLE;
@@ -1958,7 +1913,6 @@ int mutt_index_menu (void)
       break;
 
     case OP_MAIL:
-
       CHECK_ATTACH;
       ci_send_message (0, NULL, NULL, Context, NULL);
       menu->redraw = REDRAW_FULL;
@@ -2020,14 +1974,12 @@ int mutt_index_menu (void)
       break;
 
     case OP_RECALL_MESSAGE:
-
       CHECK_ATTACH;
       ci_send_message (SENDPOSTPONED, NULL, NULL, Context, NULL);
       menu->redraw = REDRAW_FULL;
       break;
 
     case OP_RESEND:
-
       CHECK_ATTACH;
       CHECK_MSGCOUNT;
       CHECK_VISIBLE;
@@ -2049,7 +2001,6 @@ int mutt_index_menu (void)
     case OP_POST:
     case OP_FOLLOWUP:
     case OP_FORWARD_TO_GROUP:
-
       CHECK_ATTACH;
       if ((op == OP_FOLLOWUP || op == OP_FORWARD_TO_GROUP) &&
           Context && Context->msgcount == 0) {
@@ -2085,7 +2036,6 @@ int mutt_index_menu (void)
 #endif
 
     case OP_REPLY:
-
       CHECK_ATTACH;
       CHECK_MSGCOUNT;
       CHECK_VISIBLE;
@@ -2098,14 +2048,12 @@ int mutt_index_menu (void)
       break;
 
     case OP_SHELL_ESCAPE:
-
       mutt_shell_escape ();
       MAYBE_REDRAW (menu->redraw);
       break;
 
     case OP_TAG_THREAD:
     case OP_TAG_SUBTHREAD:
-
       CHECK_MSGCOUNT;
       CHECK_VISIBLE;
       rc = mutt_thread_set_flag (CURHDR, M_TAG, !CURHDR->tagged,
@@ -2123,7 +2071,6 @@ int mutt_index_menu (void)
       break;
 
     case OP_UNDELETE:
-
       CHECK_MSGCOUNT;
       CHECK_VISIBLE;
       CHECK_READONLY;
@@ -2150,7 +2097,6 @@ int mutt_index_menu (void)
 
     case OP_UNDELETE_THREAD:
     case OP_UNDELETE_SUBTHREAD:
-
       CHECK_MSGCOUNT;
       CHECK_VISIBLE;
       CHECK_READONLY;
@@ -2211,6 +2157,7 @@ int mutt_index_menu (void)
     case OP_SIDEBAR_PREV_NEW:
       sidebar_scroll (op);
       break;
+
     default:
       if (menu->menu == MENU_MAIN)
         km_error_key (MENU_MAIN);