(create_sequence): reduce variable scope, trivial refactoring.
[midnight-commander.git] / lib / keybind.h
blob4c01f589ccdfdd1204aac38acfa02b060398f4a3
1 #ifndef MC__KEYBIND_H
2 #define MC__KEYBIND_H
4 #include "lib/global.h"
6 /*** typedefs(not structures) and defined constants **********************************************/
8 /* keymap sections */
9 #define KEYMAP_SECTION_FILEMANAGER "filemanager"
10 #define KEYMAP_SECTION_FILEMANAGER_EXT "filemanager:xmap"
11 #define KEYMAP_SECTION_PANEL "panel"
12 #define KEYMAP_SECTION_DIALOG "dialog"
13 #define KEYMAP_SECTION_MENU "menu"
14 #define KEYMAP_SECTION_INPUT "input"
15 #define KEYMAP_SECTION_LISTBOX "listbox"
16 #define KEYMAP_SECTION_RADIO "radio"
17 #define KEYMAP_SECTION_TREE "tree"
18 #define KEYMAP_SECTION_HELP "help"
19 #define KEYMAP_SECTION_CHATTR "chattr"
20 #define KEYMAP_SECTION_EDITOR "editor"
21 #define KEYMAP_SECTION_EDITOR_EXT "editor:xmap"
22 #define KEYMAP_SECTION_VIEWER "viewer"
23 #define KEYMAP_SECTION_VIEWER_HEX "viewer:hex"
24 #define KEYMAP_SECTION_DIFFVIEWER "diffviewer"
26 #define KEYMAP_SHORTCUT_LENGTH 32 /* FIXME: is 32 bytes enough for shortcut? */
28 #define CK_PipeBlock(i) (10000+(i))
29 #define CK_Macro(i) (20000+(i))
30 #define CK_MacroLast CK_Macro(0x7FFF)
32 /*** enums ***************************************************************************************/
34 enum
36 /* special commands */
37 CK_InsertChar = -1L,
38 CK_IgnoreKey = 0L,
40 /* common */
41 CK_Enter = 1L,
42 CK_ChangePanel,
43 CK_Up,
44 CK_Down,
45 CK_Left,
46 CK_Right,
47 CK_Home,
48 CK_End,
49 CK_LeftQuick,
50 CK_RightQuick,
51 CK_PageUp,
52 CK_PageDown,
53 CK_HalfPageUp,
54 CK_HalfPageDown,
55 CK_Top,
56 CK_Bottom,
57 CK_TopOnScreen,
58 CK_MiddleOnScreen,
59 CK_BottomOnScreen,
60 CK_WordLeft,
61 CK_WordRight,
62 CK_Copy,
63 CK_Move,
64 CK_Delete,
65 CK_MakeDir,
66 CK_ChangeMode,
67 CK_ChangeOwn,
68 CK_ChangeOwnAdvanced,
69 CK_ChangeAttributes,
70 CK_Remove,
71 CK_BackSpace,
72 CK_Redo,
73 CK_Clear,
74 CK_Menu,
75 CK_MenuLastSelected,
76 CK_UserMenu,
77 CK_EditUserMenu,
78 CK_Search,
79 CK_SearchContinue,
80 CK_Replace,
81 CK_ReplaceContinue,
82 CK_SearchStop,
83 CK_Help,
84 CK_Edit,
85 CK_EditNew,
86 CK_Shell,
87 CK_SelectCodepage,
88 CK_EditorViewerHistory,
89 CK_History,
90 CK_HistoryNext,
91 CK_HistoryPrev,
92 CK_Complete,
93 CK_Save,
94 CK_SaveAs,
95 CK_Goto,
96 CK_Reread,
97 CK_Refresh,
98 CK_Suspend,
99 CK_Swap,
100 CK_Mark,
101 CK_HotList,
102 CK_ScreenList,
103 CK_ScreenNext,
104 CK_ScreenPrev,
105 CK_FilePrev,
106 CK_FileNext,
107 CK_DeleteToHome,
108 CK_DeleteToEnd,
109 CK_DeleteToWordBegin,
110 CK_DeleteToWordEnd,
111 CK_ShowNumbers,
112 CK_Store,
113 CK_Cut,
114 CK_Paste,
115 CK_MarkLeft,
116 CK_MarkRight,
117 CK_MarkUp,
118 CK_MarkDown,
119 CK_MarkToWordBegin,
120 CK_MarkToWordEnd,
121 CK_MarkToHome,
122 CK_MarkToEnd,
123 CK_ToggleNavigation,
124 CK_Sort,
125 CK_Options,
126 CK_LearnKeys,
127 CK_Bookmark,
128 CK_Quit,
129 CK_QuitQuiet,
130 /* C-x or similar */
131 CK_ExtendedKeyMap,
133 /* main commands */
134 CK_EditForceInternal = 100L,
135 CK_View,
136 CK_ViewRaw,
137 CK_ViewFile,
138 CK_ViewFiltered,
139 CK_Find,
140 CK_DirSize,
141 CK_HotListAdd,
142 CK_SetupListingFormat,
143 CK_CompareDirs,
144 CK_OptionsVfs,
145 CK_OptionsConfirm,
146 CK_PutCurrentLink,
147 CK_PutOtherLink,
148 CK_OptionsDisplayBits,
149 CK_EditExtensionsFile,
150 CK_EditFileHighlightFile,
151 CK_LinkSymbolicEdit,
152 CK_ExternalPanelize,
153 CK_Filter,
154 CK_ConnectShell,
155 CK_ConnectFtp,
156 CK_ConnectSftp,
157 CK_PanelInfo,
158 CK_Jobs,
159 CK_OptionsLayout,
160 CK_OptionsAppearance,
161 CK_Link,
162 CK_PanelListing,
163 CK_ListMode,
164 CK_CdQuick,
165 CK_PanelQuickView,
166 CK_VfsList,
167 CK_SaveSetup,
168 CK_LinkSymbolic,
169 CK_ShowHidden,
170 CK_PanelTree,
171 CK_Tree,
172 CK_Undelete,
173 CK_SplitVertHoriz,
174 CK_SplitEqual,
175 CK_SplitMore,
176 CK_SplitLess,
177 CK_CompareFiles,
178 CK_OptionsPanel,
179 CK_LinkSymbolicRelative,
180 CK_PutCurrentPath,
181 CK_PutOtherPath,
182 CK_PutCurrentSelected,
183 CK_PutCurrentFullSelected,
184 CK_PutCurrentTagged,
185 CK_PutOtherTagged,
186 CK_Select,
187 CK_Unselect,
188 CK_SelectExt,
189 CK_SelectInvert,
191 /* panels */
192 CK_PanelOtherCd = 200L,
193 CK_PanelOtherCdLink,
194 CK_Panelize,
195 CK_CopySingle,
196 CK_MoveSingle,
197 CK_DeleteSingle,
198 CK_CdChild,
199 CK_CdParent,
200 CK_CdParentSmart,
201 CK_PanelOtherSync,
202 CK_SortNext,
203 CK_SortPrev,
204 CK_SortReverse,
205 CK_SortByName,
206 CK_SortByExt,
207 CK_SortBySize,
208 CK_SortByMTime,
209 CK_ScrollLeft,
210 CK_ScrollRight,
211 CK_CycleListingFormat,
213 /* dialog */
214 CK_Ok = 300L,
215 CK_Cancel,
217 /* input */
218 CK_Yank = 350L,
220 /* help */
221 CK_Index = 400L,
222 CK_Back,
223 CK_LinkNext,
224 CK_LinkPrev,
225 CK_NodeNext,
226 CK_NodePrev,
228 /* tree */
229 CK_Forget = 450L,
231 /* chattr dialog */
232 CK_MarkAndDown = 480L,
234 /* editor */
235 /* cursor movements */
236 CK_Tab = 500L,
237 CK_Undo,
238 CK_ScrollUp,
239 CK_ScrollDown,
240 CK_Return,
241 CK_ParagraphUp,
242 CK_ParagraphDown,
243 /* file commands */
244 CK_EditFile,
245 CK_InsertFile,
246 CK_EditSyntaxFile,
247 CK_Close,
248 /* block commands */
249 CK_BlockSave,
250 CK_BlockShiftLeft,
251 CK_BlockShiftRight,
252 CK_DeleteLine,
253 /* bookmarks */
254 CK_BookmarkFlush,
255 CK_BookmarkNext,
256 CK_BookmarkPrev,
257 /* mark commands */
258 CK_MarkColumn,
259 CK_MarkWord,
260 CK_MarkLine,
261 CK_MarkAll,
262 CK_Unmark,
263 CK_MarkPageUp,
264 CK_MarkPageDown,
265 CK_MarkToFileBegin,
266 CK_MarkToFileEnd,
267 CK_MarkToPageBegin,
268 CK_MarkToPageEnd,
269 CK_MarkScrollUp,
270 CK_MarkScrollDown,
271 CK_MarkParagraphUp,
272 CK_MarkParagraphDown,
273 /* column mark commands */
274 CK_MarkColumnPageUp,
275 CK_MarkColumnPageDown,
276 CK_MarkColumnLeft,
277 CK_MarkColumnRight,
278 CK_MarkColumnUp,
279 CK_MarkColumnDown,
280 CK_MarkColumnScrollUp,
281 CK_MarkColumnScrollDown,
282 CK_MarkColumnParagraphUp,
283 CK_MarkColumnParagraphDown,
284 /* macros */
285 CK_MacroStartRecord,
286 CK_MacroStopRecord,
287 CK_MacroStartStopRecord,
288 CK_MacroDelete,
289 CK_RepeatStartRecord,
290 CK_RepeatStopRecord,
291 CK_RepeatStartStopRecord,
292 /* window commands */
293 CK_WindowMove,
294 CK_WindowResize,
295 CK_WindowFullscreen,
296 CK_WindowList,
297 CK_WindowNext,
298 CK_WindowPrev,
299 /* misc commands */
300 CK_SpellCheck,
301 CK_SpellCheckCurrentWord,
302 CK_SpellCheckSelectLang,
303 CK_InsertOverwrite,
304 CK_ParagraphFormat,
305 CK_MatchBracket,
306 CK_OptionsSaveMode,
307 CK_About,
308 CK_ShowMargin,
309 CK_ShowTabTws,
310 CK_SyntaxOnOff,
311 CK_SyntaxChoose,
312 CK_InsertLiteral,
313 CK_ExternalCommand,
314 CK_Date,
315 CK_EditMail,
317 /* viewer */
318 CK_WrapMode = 600L,
319 CK_MagicMode,
320 CK_NroffMode,
321 CK_HexMode,
322 CK_HexEditMode,
323 CK_BookmarkGoto,
324 CK_Ruler,
325 CK_SearchForward,
326 CK_SearchBackward,
327 CK_SearchForwardContinue,
328 CK_SearchBackwardContinue,
329 CK_SearchOppositeContinue,
331 /* diff viewer */
332 CK_ShowSymbols = 700L,
333 CK_SplitFull,
334 CK_Tab2,
335 CK_Tab3,
336 CK_Tab4,
337 CK_Tab8,
338 CK_HunkNext,
339 CK_HunkPrev,
340 CK_EditOther,
341 CK_Merge,
342 CK_MergeOther
345 /*** structures declarations (and typedefs of structures)*****************************************/
347 /* The global keymaps are of this type */
348 typedef struct global_keymap_t
350 long key;
351 long command;
352 char caption[KEYMAP_SHORTCUT_LENGTH];
353 } global_keymap_t;
355 /*** global variables defined in .c file *********************************************************/
357 /*** declarations of public functions ************************************************************/
359 void keybind_cmd_bind (GArray * keymap, const char *keybind, long action);
360 long keybind_lookup_action (const char *name);
361 const char *keybind_lookup_actionname (long action);
362 const char *keybind_lookup_keymap_shortcut (const global_keymap_t * keymap, long action);
363 long keybind_lookup_keymap_command (const global_keymap_t * keymap, long key);
365 /*** inline functions ****************************************************************************/
367 #endif /* MC__KEYBIND_H */