Merge branch '3729_vfs_date_fixes'
[midnight-commander.git] / lib / keybind.h
blob2362479608af246b4bfb888c79a6e8ed15c3ce84
1 #ifndef MC__KEYBIND_H
2 #define MC__KEYBIND_H
4 #include <sys/types.h>
5 #include <sys/time.h> /* time_t */
7 #include "lib/global.h"
9 /*** typedefs(not structures) and defined constants **********************************************/
11 /* keymap sections */
12 #define KEYMAP_SECTION_MAIN "main"
13 #define KEYMAP_SECTION_MAIN_EXT "main:xmap"
14 #define KEYMAP_SECTION_PANEL "panel"
15 #define KEYMAP_SECTION_DIALOG "dialog"
16 #define KEYMAP_SECTION_INPUT "input"
17 #define KEYMAP_SECTION_LISTBOX "listbox"
18 #define KEYMAP_SECTION_TREE "tree"
19 #define KEYMAP_SECTION_HELP "help"
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_Remove,
70 CK_BackSpace,
71 CK_Redo,
72 CK_Clear,
73 CK_Menu,
74 CK_MenuLastSelected,
75 CK_UserMenu,
76 CK_EditUserMenu,
77 CK_Search,
78 CK_SearchContinue,
79 CK_Replace,
80 CK_ReplaceContinue,
81 CK_SearchStop,
82 CK_Help,
83 CK_Edit,
84 CK_EditNew,
85 CK_Shell,
86 CK_SelectCodepage,
87 CK_History,
88 CK_HistoryNext,
89 CK_HistoryPrev,
90 CK_Complete,
91 CK_Save,
92 CK_SaveAs,
93 CK_Goto,
94 CK_Reread,
95 CK_Refresh,
96 CK_Suspend,
97 CK_Swap,
98 CK_Mark,
99 CK_HotList,
100 CK_ScreenList,
101 CK_ScreenNext,
102 CK_ScreenPrev,
103 CK_FilePrev,
104 CK_FileNext,
105 CK_DeleteToHome,
106 CK_DeleteToEnd,
107 CK_DeleteToWordBegin,
108 CK_DeleteToWordEnd,
109 CK_ShowNumbers,
110 CK_Store,
111 CK_Cut,
112 CK_Paste,
113 CK_MarkLeft,
114 CK_MarkRight,
115 CK_MarkUp,
116 CK_MarkDown,
117 CK_MarkToWordBegin,
118 CK_MarkToWordEnd,
119 CK_MarkToHome,
120 CK_MarkToEnd,
121 CK_ToggleNavigation,
122 CK_Sort,
123 CK_Options,
124 CK_LearnKeys,
125 CK_Bookmark,
126 CK_Quit,
127 CK_QuitQuiet,
128 /* C-x or similar */
129 CK_ExtendedKeyMap,
131 /* main commands */
132 CK_EditForceInternal = 100L,
133 CK_View,
134 CK_ViewRaw,
135 CK_ViewFile,
136 CK_ViewFiltered,
137 CK_Find,
138 CK_DirSize,
139 CK_HotListAdd,
140 CK_PanelListingChange,
141 CK_CompareDirs,
142 CK_OptionsVfs,
143 CK_OptionsConfirm,
144 CK_PutCurrentLink,
145 CK_PutOtherLink,
146 CK_OptionsDisplayBits,
147 CK_EditExtensionsFile,
148 CK_EditFileHighlightFile,
149 CK_LinkSymbolicEdit,
150 CK_ExternalPanelize,
151 CK_Filter,
152 CK_ConnectFish,
153 CK_ConnectFtp,
154 CK_ConnectSftp,
155 CK_ConnectSmb,
156 CK_PanelInfo,
157 CK_Jobs,
158 CK_OptionsLayout,
159 CK_OptionsAppearance,
160 CK_Link,
161 CK_PanelListing,
162 CK_ListMode,
163 CK_CdQuick,
164 CK_PanelQuickView,
165 CK_VfsList,
166 CK_SaveSetup,
167 CK_LinkSymbolic,
168 CK_PanelListingSwitch,
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,
212 /* dialog */
213 CK_Ok = 300L,
214 CK_Cancel,
216 /* input */
217 CK_Yank = 350L,
219 /* help */
220 CK_Index = 400L,
221 CK_Back,
222 CK_LinkNext,
223 CK_LinkPrev,
224 CK_NodeNext,
225 CK_NodePrev,
227 /* tree */
228 CK_Forget = 450L,
230 /* editor */
231 /* cursor movements */
232 CK_Tab = 500L,
233 CK_Undo,
234 CK_ScrollUp,
235 CK_ScrollDown,
236 CK_Return,
237 CK_ParagraphUp,
238 CK_ParagraphDown,
239 /* file commands */
240 CK_EditFile,
241 CK_InsertFile,
242 CK_EditSyntaxFile,
243 CK_Close,
244 /* block commands */
245 CK_BlockSave,
246 CK_BlockShiftLeft,
247 CK_BlockShiftRight,
248 CK_DeleteLine,
249 /* bookmarks */
250 CK_BookmarkFlush,
251 CK_BookmarkNext,
252 CK_BookmarkPrev,
253 /* mark commands */
254 CK_MarkColumn,
255 CK_MarkWord,
256 CK_MarkLine,
257 CK_MarkAll,
258 CK_Unmark,
259 CK_MarkPageUp,
260 CK_MarkPageDown,
261 CK_MarkToFileBegin,
262 CK_MarkToFileEnd,
263 CK_MarkToPageBegin,
264 CK_MarkToPageEnd,
265 CK_MarkScrollUp,
266 CK_MarkScrollDown,
267 CK_MarkParagraphUp,
268 CK_MarkParagraphDown,
269 /* column mark commands */
270 CK_MarkColumnPageUp,
271 CK_MarkColumnPageDown,
272 CK_MarkColumnLeft,
273 CK_MarkColumnRight,
274 CK_MarkColumnUp,
275 CK_MarkColumnDown,
276 CK_MarkColumnScrollUp,
277 CK_MarkColumnScrollDown,
278 CK_MarkColumnParagraphUp,
279 CK_MarkColumnParagraphDown,
280 /* macros */
281 CK_MacroStartRecord,
282 CK_MacroStopRecord,
283 CK_MacroStartStopRecord,
284 CK_MacroDelete,
285 CK_RepeatStartRecord,
286 CK_RepeatStopRecord,
287 CK_RepeatStartStopRecord,
288 /* window commands */
289 CK_WindowMove,
290 CK_WindowResize,
291 CK_WindowFullscreen,
292 CK_WindowList,
293 CK_WindowNext,
294 CK_WindowPrev,
295 /* misc commands */
296 CK_SpellCheck,
297 CK_SpellCheckCurrentWord,
298 CK_SpellCheckSelectLang,
299 CK_InsertOverwrite,
300 CK_ParagraphFormat,
301 CK_MatchBracket,
302 CK_OptionsSaveMode,
303 CK_About,
304 CK_ShowMargin,
305 CK_ShowTabTws,
306 CK_SyntaxOnOff,
307 CK_SyntaxChoose,
308 CK_InsertLiteral,
309 CK_ExternalCommand,
310 CK_Date,
311 CK_Mail,
313 /* viewer */
314 CK_WrapMode = 600L,
315 CK_MagicMode,
316 CK_NroffMode,
317 CK_HexMode,
318 CK_HexEditMode,
319 CK_BookmarkGoto,
320 CK_Ruler,
321 CK_SearchForward,
322 CK_SearchBackward,
323 CK_SearchForwardContinue,
324 CK_SearchBackwardContinue,
326 /* diff viewer */
327 CK_ShowSymbols = 700L,
328 CK_SplitFull,
329 CK_Tab2,
330 CK_Tab3,
331 CK_Tab4,
332 CK_Tab8,
333 CK_HunkNext,
334 CK_HunkPrev,
335 CK_EditOther,
336 CK_Merge,
337 CK_MergeOther
340 /*** structures declarations (and typedefs of structures)*****************************************/
342 typedef struct name_keymap_t
344 const char *name;
345 long val;
346 } name_keymap_t;
348 typedef struct key_config_t
350 time_t mtime; /* mtime at the moment we read config file */
351 GArray *keymap;
352 GArray *ext_keymap;
353 gchar *labels[10];
354 } key_config_t;
356 /* The global keymaps are of this type */
357 typedef struct global_keymap_t
359 long key;
360 long command;
361 char caption[KEYMAP_SHORTCUT_LENGTH];
362 } global_keymap_t;
364 /*** global variables defined in .c file *********************************************************/
366 /*** declarations of public functions ************************************************************/
368 void keybind_cmd_bind (GArray * keymap, const char *keybind, long action);
369 long keybind_lookup_action (const char *name);
370 const char *keybind_lookup_actionname (long action);
371 const char *keybind_lookup_keymap_shortcut (const global_keymap_t * keymap, long action);
372 long keybind_lookup_keymap_command (const global_keymap_t * keymap, long key);
374 /*** inline functions ****************************************************************************/
376 #endif /* MC__KEYBIND_H */