NeoMutt  2025-12-11-117-gc1a713
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
functions.c
Go to the documentation of this file.
1
23
42
43#include "config.h"
44#ifdef _MAKEDOC
45#include "docs/makedoc_defs.h"
46#else
47#ifdef _MAKEDOC
48#include "docs/makedoc_defs.h"
49#else
50#include <stddef.h>
51#include "key/lib.h"
52#include "menu/lib.h"
53#include "opcodes.h"
54#endif
55#endif
56
57// clang-format off
61static const struct MenuFuncOp OpDialog[] = {
62 { "quit", OP_QUIT },
63 { "exit", OP_EXIT },
64 { NULL, 0 },
65};
66
70static const struct MenuFuncOp OpGeneric[] = { /* map: generic */
71 /*
72 ** <para>
73 ** The <emphasis>generic</emphasis> menu is not a real menu, but specifies common functions
74 ** (such as movement) available in all menus except for <emphasis>pager</emphasis> and
75 ** <emphasis>editor</emphasis>. Changing settings for this menu will affect the default
76 ** bindings for all menus (except as noted).
77 ** </para>
78 */
79 { "bottom-page", OP_BOTTOM_PAGE },
80 { "check-stats", OP_CHECK_STATS },
81 { "current-bottom", OP_CURRENT_BOTTOM },
82 { "current-middle", OP_CURRENT_MIDDLE },
83 { "current-top", OP_CURRENT_TOP },
84 { "end-cond", OP_END_COND },
85 { "enter-command", OP_ENTER_COMMAND },
86 { "exit", OP_EXIT },
87 { "first-entry", OP_FIRST_ENTRY },
88 { "half-down", OP_HALF_DOWN },
89 { "half-up", OP_HALF_UP },
90 { "help", OP_HELP },
91 { "jump", OP_JUMP },
92 { "jump", OP_JUMP_1 },
93 { "jump", OP_JUMP_2 },
94 { "jump", OP_JUMP_3 },
95 { "jump", OP_JUMP_4 },
96 { "jump", OP_JUMP_5 },
97 { "jump", OP_JUMP_6 },
98 { "jump", OP_JUMP_7 },
99 { "jump", OP_JUMP_8 },
100 { "jump", OP_JUMP_9 },
101 { "last-entry", OP_LAST_ENTRY },
102 { "middle-page", OP_MIDDLE_PAGE },
103 { "next-entry", OP_NEXT_ENTRY },
104 { "next-line", OP_NEXT_LINE },
105 { "next-page", OP_NEXT_PAGE },
106 { "previous-entry", OP_PREV_ENTRY },
107 { "previous-line", OP_PREV_LINE },
108 { "previous-page", OP_PREV_PAGE },
109 { "redraw-screen", OP_REDRAW },
110 { "search", OP_SEARCH },
111 { "search-next", OP_SEARCH_NEXT },
112 { "search-opposite", OP_SEARCH_OPPOSITE },
113 { "search-reverse", OP_SEARCH_REVERSE },
114 { "select-entry", OP_GENERIC_SELECT_ENTRY },
115 { "shell-escape", OP_SHELL_ESCAPE },
116 { "show-log-messages", OP_SHOW_LOG_MESSAGES },
117 { "show-version", OP_VERSION },
118 { "tag-entry", OP_TAG },
119 { "tag-prefix", OP_TAG_PREFIX },
120 { "tag-prefix-cond", OP_TAG_PREFIX_COND },
121 { "top-page", OP_TOP_PAGE },
122 { "what-key", OP_WHAT_KEY },
123 // Deprecated
124 { "error-history", OP_SHOW_LOG_MESSAGES, MFF_DEPRECATED },
125 { "refresh", OP_REDRAW, MFF_DEPRECATED },
126 { NULL, 0 },
127};
128
132static const struct MenuOpSeq DialogDefaultBindings[] = {
133 { OP_QUIT, "q" },
134 { 0, NULL },
135};
136
140static const struct MenuOpSeq GenericDefaultBindings[] = { /* map: generic */
141 { OP_BOTTOM_PAGE, "L" },
142 { OP_ENTER_COMMAND, ":" },
143 { OP_FIRST_ENTRY, "<home>" },
144 { OP_FIRST_ENTRY, "=" },
145 { OP_GENERIC_SELECT_ENTRY, "<keypadenter>" },
146 { OP_GENERIC_SELECT_ENTRY, "\n" }, // <Enter>
147 { OP_GENERIC_SELECT_ENTRY, "\r" }, // <Return>
148 { OP_HALF_DOWN, "]" },
149 { OP_HALF_UP, "[" },
150 { OP_HELP, "?" },
151 { OP_JUMP_1, "1" },
152 { OP_JUMP_2, "2" },
153 { OP_JUMP_3, "3" },
154 { OP_JUMP_4, "4" },
155 { OP_JUMP_5, "5" },
156 { OP_JUMP_6, "6" },
157 { OP_JUMP_7, "7" },
158 { OP_JUMP_8, "8" },
159 { OP_JUMP_9, "9" },
160 { OP_LAST_ENTRY, "*" },
161 { OP_LAST_ENTRY, "<end>" },
162 { OP_MIDDLE_PAGE, "M" },
163 { OP_NEXT_ENTRY, "<down>" },
164 { OP_NEXT_ENTRY, "j" },
165 { OP_NEXT_LINE, ">" },
166 { OP_NEXT_PAGE, "<pagedown>" },
167 { OP_NEXT_PAGE, "<right>" },
168 { OP_NEXT_PAGE, "z" },
169 { OP_PREV_ENTRY, "<up>" },
170 { OP_PREV_ENTRY, "k" },
171 { OP_PREV_LINE, "<" },
172 { OP_PREV_PAGE, "<left>" },
173 { OP_PREV_PAGE, "<pageup>" },
174 { OP_PREV_PAGE, "Z" },
175 { OP_REDRAW, "\014" }, // <Ctrl-L>
176 { OP_SEARCH, "/" },
177 { OP_SEARCH_NEXT, "n" },
178 { OP_SEARCH_REVERSE, "\033/" }, // <Alt-/>
179 { OP_SHELL_ESCAPE, "!" },
180 { OP_TAG, "t" },
181 { OP_TAG_PREFIX, ";" },
182 { OP_TOP_PAGE, "H" },
183 { OP_VERSION, "V" },
184 { 0, NULL },
185};
186// clang-format on
187
192{
193 struct MenuDefinition *md = NULL;
194 struct SubMenu *sm = NULL;
195 struct SubMenu *sm_generic = NULL;
196
197 sm_generic = km_register_submenu(OpGeneric);
198 md = km_register_menu(MENU_GENERIC, "generic");
199 km_menu_add_submenu(md, sm_generic);
201
203 md = km_register_menu(MENU_DIALOG, "dialog");
204 km_menu_add_submenu(md, sm);
205 km_menu_add_submenu(md, sm_generic);
207
208 return sm_generic;
209}
#define MFF_DEPRECATED
Redraw the pager.
Definition get.h:44
static const struct MenuFuncOp OpGeneric[]
Functions for the Generic Menu.
Definition functions.c:70
static const struct MenuOpSeq GenericDefaultBindings[]
Key bindings for the Generic Menu.
Definition functions.c:140
static const struct MenuOpSeq DialogDefaultBindings[]
Key bindings for Simple Dialogs.
Definition functions.c:132
struct SubMenu * generic_init_keys(void)
Initialise the Generic Keybindings.
Definition functions.c:191
static const struct MenuFuncOp OpDialog[]
Functions for Simple Dialogs.
Definition functions.c:61
void km_menu_add_submenu(struct MenuDefinition *md, struct SubMenu *sm)
Add a SubMenu to a Menu Definition.
Definition init.c:123
struct SubMenu * km_register_submenu(const struct MenuFuncOp functions[])
Register a submenu.
Definition init.c:91
struct MenuDefinition * km_register_menu(int menu, const char *name)
Register a menu.
Definition init.c:107
void km_menu_add_bindings(struct MenuDefinition *md, const struct MenuOpSeq bindings[])
Add Keybindings to a Menu.
Definition init.c:136
Manage keymappings.
GUI present the user with a selectable list.
All user-callable functions.
Functions for a Dialog or Window.
Definition menu.h:81
Mapping between a function and an operation.
Definition menu.h:39
Mapping between an operation and a key sequence.
Definition menu.h:49
Collection of related functions.
Definition menu.h:69
@ MENU_DIALOG
Simple Dialog.
Definition type.h:41
@ MENU_GENERIC
Generic selection list.
Definition type.h:43