]> granicus.if.org Git - neomutt/commitdiff
DLG
authorRichard Russon <rich@flatcap.org>
Wed, 21 Aug 2019 16:26:15 +0000 (17:26 +0100)
committerRichard Russon <rich@flatcap.org>
Sun, 27 Oct 2019 03:31:20 +0000 (03:31 +0000)
curs_lib.c
main.c
mutt_window.c

index 2f6e8131113c840327dd0899e89c21cd458acd3e..6d616abb475336273004738f4e1b59a0be379ef1 100644 (file)
@@ -48,6 +48,7 @@
 #include "curs_lib.h"
 #include "browser.h"
 #include "color.h"
+#include "dialog.h"
 #include "enter_state.h"
 #include "globals.h"
 #include "mutt_curses.h"
@@ -635,8 +636,22 @@ int mutt_do_pager(const char *banner, const char *tempfile, PagerFlags do_color,
   if (!info)
     info = &info2;
 
-  info->pager_status_window = MuttPagerBarWindow;
-  info->pager_window = MuttPagerWindow;
+  struct MuttWindow *root = mutt_window_new(MUTT_WIN_ORIENT_VERTICAL, MUTT_WIN_SIZE_MAXIMISE, MUTT_WIN_SIZE_UNLIMITED, MUTT_WIN_SIZE_UNLIMITED);
+  struct MuttWindow *pager = mutt_window_new(MUTT_WIN_ORIENT_VERTICAL, MUTT_WIN_SIZE_MAXIMISE, MUTT_WIN_SIZE_UNLIMITED, MUTT_WIN_SIZE_UNLIMITED);
+  struct MuttWindow *pbar = mutt_window_new(MUTT_WIN_ORIENT_VERTICAL, MUTT_WIN_SIZE_FIXED, 1, MUTT_WIN_SIZE_UNLIMITED);
+
+  struct Dialog *dialog = mutt_mem_calloc(1, sizeof (*dialog));
+  dialog->root = root;
+
+  mutt_window_add_child(root, pager);
+  mutt_window_add_child(root, pbar);
+
+  dialog_push(dialog);
+
+  info->index_status_window = NULL;
+  info->index_window = NULL;
+  info->pager_status_window = pbar;
+  info->pager_window = pager;
 
   int rc;
 
@@ -659,6 +674,9 @@ int mutt_do_pager(const char *banner, const char *tempfile, PagerFlags do_color,
     mutt_buffer_pool_release(&cmd);
   }
 
+  dialog_pop();
+  mutt_window_free(&root);
+  FREE(&dialog);
   return rc;
 }
 
diff --git a/main.c b/main.c
index 2cfe0aaaa834d6afaa714440bc18496f220a9678..0bb7e17d367de39a4dc966eedb7069138c52d387 100644 (file)
--- a/main.c
+++ b/main.c
@@ -57,6 +57,7 @@
 #include "color.h"
 #include "context.h"
 #include "curs_lib.h"
+#include "dialog.h"
 #include "globals.h"
 #include "hook.h"
 #include "index.h"
@@ -401,6 +402,36 @@ bool get_user_info(struct ConfigSet *cs)
   return true;
 }
 
+static struct Dialog *index_pager_init(void)
+{
+  struct MuttWindow *root = mutt_window_new(MUTT_WIN_ORIENT_HORIZONTAL, MUTT_WIN_SIZE_MAXIMISE, MUTT_WIN_SIZE_UNLIMITED, MUTT_WIN_SIZE_UNLIMITED);
+  struct MuttWindow *right = mutt_window_new(MUTT_WIN_ORIENT_VERTICAL, MUTT_WIN_SIZE_MAXIMISE, MUTT_WIN_SIZE_UNLIMITED, MUTT_WIN_SIZE_UNLIMITED);
+  struct MuttWindow *index = mutt_window_new(MUTT_WIN_ORIENT_VERTICAL, MUTT_WIN_SIZE_MAXIMISE, MUTT_WIN_SIZE_UNLIMITED, MUTT_WIN_SIZE_UNLIMITED);
+  struct MuttWindow *pager = mutt_window_new(MUTT_WIN_ORIENT_VERTICAL, MUTT_WIN_SIZE_MAXIMISE, MUTT_WIN_SIZE_UNLIMITED, MUTT_WIN_SIZE_UNLIMITED);
+  pager->state.visible = false; // The Pager and Pager Bar are initially hidden
+
+  MuttIndexWindow = mutt_window_new(MUTT_WIN_ORIENT_VERTICAL, MUTT_WIN_SIZE_MAXIMISE, MUTT_WIN_SIZE_UNLIMITED, MUTT_WIN_SIZE_UNLIMITED);
+  MuttPagerBarWindow = mutt_window_new(MUTT_WIN_ORIENT_VERTICAL, MUTT_WIN_SIZE_FIXED, 1, MUTT_WIN_SIZE_UNLIMITED);
+  MuttPagerWindow = mutt_window_new(MUTT_WIN_ORIENT_VERTICAL, MUTT_WIN_SIZE_MAXIMISE, MUTT_WIN_SIZE_UNLIMITED, MUTT_WIN_SIZE_UNLIMITED);
+  MuttSidebarWindow = mutt_window_new(MUTT_WIN_ORIENT_HORIZONTAL, MUTT_WIN_SIZE_FIXED, MUTT_WIN_SIZE_UNLIMITED, 20);
+  MuttStatusWindow = mutt_window_new(MUTT_WIN_ORIENT_VERTICAL, MUTT_WIN_SIZE_FIXED, 1, MUTT_WIN_SIZE_UNLIMITED);
+
+  mutt_window_add_child(root, MuttSidebarWindow);
+  mutt_window_add_child(root, right);
+
+  mutt_window_add_child(right, index);
+  mutt_window_add_child(index, MuttIndexWindow);
+  mutt_window_add_child(index, MuttStatusWindow);
+
+  mutt_window_add_child(right, pager);
+  mutt_window_add_child(pager, MuttPagerWindow);
+  mutt_window_add_child(pager, MuttPagerBarWindow);
+
+  struct Dialog *dlg = mutt_mem_calloc(1, sizeof(*dlg));
+  dlg->root = root;
+  return dlg;
+}
+
 /**
  * main - Start NeoMutt
  * @param argc Number of command line arguments
@@ -1243,7 +1274,12 @@ int main(int argc, char *argv[], char *envp[])
 #ifdef USE_SIDEBAR
       mutt_sb_set_open_mailbox(Context ? Context->mailbox : NULL);
 #endif
+      struct Dialog *dlg = index_pager_init();
+      dialog_push(dlg);
       mutt_index_menu();
+      dialog_pop();
+      mutt_window_free(&dlg->root);
+      FREE(&dlg);
       ctx_free(&Context);
     }
 #ifdef USE_IMAP
index ad422965199f3bf08c7701edc2ea47dd4708fd00..1f686399429dc5ed227bf2b82429693f9fec25c7 100644 (file)
@@ -320,6 +320,9 @@ void mutt_window_reflow_prep(void)
     TAILQ_INSERT_TAIL(&parent->children, first, entries);
   }
 
+  if (!MuttIndexWindow || !MuttPagerWindow)
+    return;
+
   parent = MuttIndexWindow->parent;
   first = TAILQ_FIRST(&parent->children);