NeoMutt  2024-03-23-147-g885fbc
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
pager.c File Reference

Pager Window. More...

#include "config.h"
#include <stddef.h>
#include <stdbool.h>
#include <sys/stat.h>
#include "mutt/lib.h"
#include "config/lib.h"
#include "core/lib.h"
#include "gui/lib.h"
#include "lib.h"
#include "color/lib.h"
#include "index/lib.h"
#include "display.h"
#include "private_data.h"
+ Include dependency graph for pager.c:

Go to the source code of this file.

Functions

static int config_pager_index_lines (struct MuttWindow *win)
 React to changes to $pager_index_lines.
 
static int pager_recalc (struct MuttWindow *win)
 Recalculate the Pager display - Implements MuttWindow::recalc() -.
 
static int pager_repaint (struct MuttWindow *win)
 Repaint the Pager display - Implements MuttWindow::repaint() -.
 
static int pager_color_observer (struct NotifyCallback *nc)
 Notification that a Color has changed - Implements observer_t -.
 
static int pager_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int pager_global_observer (struct NotifyCallback *nc)
 Notification that a Global Event occurred - Implements observer_t -.
 
static int pager_index_observer (struct NotifyCallback *nc)
 Notification that the Index has changed - Implements observer_t -.
 
static int pager_pager_observer (struct NotifyCallback *nc)
 Notification that the Pager has changed - Implements observer_t -.
 
static int pager_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
struct MuttWindowpager_window_new (struct IndexSharedData *shared, struct PagerPrivateData *priv)
 Create a new Pager Window (list of Emails)
 

Detailed Description

Pager Window.

Authors
  • Richard Russon
  • Pietro Cerutti
  • Tóth János

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/.

Definition in file pager.c.

Function Documentation

◆ config_pager_index_lines()

static int config_pager_index_lines ( struct MuttWindow win)
static

React to changes to $pager_index_lines.

Parameters
winPager Window
Return values
0Successfully handled
-1Error

Definition at line 83 of file pager.c.

84{
85 if (!mutt_window_is_visible(win))
86 return 0;
87
88 struct MuttWindow *dlg = dialog_find(win);
89 struct MuttWindow *panel_index = window_find_child(dlg, WT_INDEX);
90 struct MuttWindow *win_index = window_find_child(panel_index, WT_MENU);
91 if (!win_index)
92 return -1;
93
94 const short c_pager_index_lines = cs_subset_number(NeoMutt->sub, "pager_index_lines");
95
96 if (c_pager_index_lines > 0)
97 {
98 win_index->req_rows = c_pager_index_lines;
99 win_index->size = MUTT_WIN_SIZE_FIXED;
100
101 panel_index->size = MUTT_WIN_SIZE_MINIMISE;
102 panel_index->state.visible = true;
103 }
104 else
105 {
107 win_index->size = MUTT_WIN_SIZE_MAXIMISE;
108
109 panel_index->size = MUTT_WIN_SIZE_MAXIMISE;
110 panel_index->state.visible = false;
111 }
112
114 mutt_debug(LL_DEBUG5, "config, request WA_REFLOW\n");
115 return 0;
116}
short cs_subset_number(const struct ConfigSubset *sub, const char *name)
Get a number config item by name.
Definition: helpers.c:144
struct MuttWindow * dialog_find(struct MuttWindow *win)
Find the parent Dialog of a Window.
Definition: dialog.c:89
#define mutt_debug(LEVEL,...)
Definition: logging2.h:89
@ LL_DEBUG5
Log at debug level 5.
Definition: logging2.h:47
bool mutt_window_is_visible(struct MuttWindow *win)
Is the Window visible?
Definition: mutt_window.c:512
void mutt_window_reflow(struct MuttWindow *win)
Resize a Window and its children.
Definition: mutt_window.c:344
struct MuttWindow * window_find_child(struct MuttWindow *win, enum WindowType type)
Recursively find a child Window of a given type.
Definition: mutt_window.c:533
@ WT_INDEX
A panel containing the Index Window.
Definition: mutt_window.h:97
@ WT_MENU
An Window containing a Menu.
Definition: mutt_window.h:98
#define MUTT_WIN_SIZE_UNLIMITED
Use as much space as possible.
Definition: mutt_window.h:52
@ MUTT_WIN_SIZE_FIXED
Window has a fixed size.
Definition: mutt_window.h:47
@ MUTT_WIN_SIZE_MINIMISE
Window size depends on its children.
Definition: mutt_window.h:49
@ MUTT_WIN_SIZE_MAXIMISE
Window wants as much space as possible.
Definition: mutt_window.h:48
struct WindowState state
Current state of the Window.
Definition: mutt_window.h:127
short req_rows
Number of rows required.
Definition: mutt_window.h:125
enum MuttWindowSize size
Type of Window, e.g. MUTT_WIN_SIZE_FIXED.
Definition: mutt_window.h:131
Container for Accounts, Notifications.
Definition: neomutt.h:41
struct ConfigSubset * sub
Inherited config items.
Definition: neomutt.h:45
bool visible
Window is visible.
Definition: mutt_window.h:59
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pager_window_new()

struct MuttWindow * pager_window_new ( struct IndexSharedData shared,
struct PagerPrivateData priv 
)

Create a new Pager Window (list of Emails)

Parameters
sharedShared Index Data
privPrivate Pager Data
Return values
ptrNew Window

Definition at line 418 of file pager.c.

420{
424 win->wdata = priv;
425 win->recalc = pager_recalc;
426 win->repaint = pager_repaint;
427
434
435 return win;
436}
void mutt_color_observer_add(observer_t callback, void *global_data)
Add an observer.
Definition: notify.c:59
static int pager_pager_observer(struct NotifyCallback *nc)
Notification that the Pager has changed - Implements observer_t -.
Definition: pager.c:366
static int pager_color_observer(struct NotifyCallback *nc)
Notification that a Color has changed - Implements observer_t -.
Definition: pager.c:241
static int pager_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: pager.c:277
static int pager_index_observer(struct NotifyCallback *nc)
Notification that the Index has changed - Implements observer_t -.
Definition: pager.c:323
static int pager_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: pager.c:380
static int pager_global_observer(struct NotifyCallback *nc)
Notification that a Global Event occurred - Implements observer_t -.
Definition: pager.c:299
static int pager_recalc(struct MuttWindow *win)
Recalculate the Pager display - Implements MuttWindow::recalc() -.
Definition: pager.c:121
static int pager_repaint(struct MuttWindow *win)
Repaint the Pager display - Implements MuttWindow::repaint() -.
Definition: pager.c:131
bool notify_observer_add(struct Notify *notify, enum NotifyType type, observer_t callback, void *global_data)
Add an observer to an object.
Definition: notify.c:191
struct MuttWindow * mutt_window_new(enum WindowType type, enum MuttWindowOrientation orient, enum MuttWindowSize size, int cols, int rows)
Create a new Window.
Definition: mutt_window.c:182
@ WT_CUSTOM
Window with a custom drawing function.
Definition: mutt_window.h:95
@ MUTT_WIN_ORIENT_VERTICAL
Window uses all available vertical space.
Definition: mutt_window.h:38
@ NT_WINDOW
MuttWindow has changed, NotifyWindow, EventWindow.
Definition: notify_type.h:57
@ NT_CONFIG
Config has changed, NotifyConfig, EventConfig.
Definition: notify_type.h:43
@ NT_PAGER
Pager data has changed, NotifyPager, PagerPrivateData.
Definition: notify_type.h:53
@ NT_ALL
Register for all notifications.
Definition: notify_type.h:35
@ NT_GLOBAL
Not object-related, NotifyGlobal.
Definition: notify_type.h:46
struct Notify * notify
Notifications: NotifyConfig, EventConfig.
Definition: subset.h:52
struct Notify * notify
Notifications: NotifyIndex, IndexSharedData.
Definition: shared_data.h:44
int(* repaint)(struct MuttWindow *win)
Definition: mutt_window.h:187
void * wdata
Private data.
Definition: mutt_window.h:145
struct Notify * notify
Notifications: NotifyWindow, EventWindow.
Definition: mutt_window.h:138
int(* recalc)(struct MuttWindow *win)
Definition: mutt_window.h:173
struct Notify * notify
Notifications handler.
Definition: neomutt.h:42
+ Here is the call graph for this function:
+ Here is the caller graph for this function: