uprava merge
[midnight-commander/osp/novacja3.git] / lib / keybind.h
blob3919abe67e7fed7a11bb2578f16609800428b5d8
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 = -1,
38 CK_IgnoreKey = 0,
40 /* common */
41 CK_Enter = 1,
42 CK_Up,
43 CK_Down,
44 CK_Left,
45 CK_Right,
46 CK_Home,
47 CK_End,
48 CK_LeftQuick,
49 CK_RightQuick,
50 CK_PageUp,
51 CK_PageDown,
52 CK_HalfPageUp,
53 CK_HalfPageDown,
54 CK_Top,
55 CK_Bottom,
56 CK_TopOnScreen,
57 CK_MiddleOnScreen,
58 CK_BottomOnScreen,
59 CK_WordLeft,
60 CK_WordRight,
61 CK_Copy,
62 CK_Move,
63 CK_Delete,
64 CK_MakeDir,
65 CK_ChangeMode,
66 CK_ChangeOwn,
67 CK_ChangeOwnAdvanced,
68 CK_Remove,
69 CK_BackSpace,
70 CK_Redo,
71 CK_Clear,
72 CK_Menu,
73 CK_MenuLastSelected,
74 CK_UserMenu,
75 CK_EditUserMenu,
76 CK_Search,
77 CK_SearchContinue,
78 CK_Replace,
79 CK_ReplaceContinue,
80 CK_SearchStop,
81 CK_Help,
82 CK_Edit,
83 CK_Shell,
84 CK_SelectCodepage,
85 CK_History,
86 CK_HistoryNext,
87 CK_HistoryPrev,
88 CK_Complete,
89 CK_SaveAs,
90 CK_Goto,
91 CK_Reread,
92 CK_Refresh,
93 CK_Suspend,
94 CK_Swap,
95 CK_Mark,
96 CK_HotList,
97 CK_ScreenList,
98 CK_ScreenNext,
99 CK_ScreenPrev,
100 CK_FilePrev,
101 CK_FileNext,
102 CK_DeleteToWordBegin,
103 CK_DeleteToWordEnd,
104 CK_ShowNumbers,
105 CK_Store,
106 CK_Cut,
107 CK_Paste,
108 CK_MarkLeft,
109 CK_MarkRight,
110 CK_MarkUp,
111 CK_MarkDown,
112 CK_MarkToWordBegin,
113 CK_MarkToWordEnd,
114 CK_MarkToHome,
115 CK_MarkToEnd,
116 CK_ToggleNavigation,
117 CK_Sort,
118 CK_Options,
119 CK_LearnKeys,
120 CK_Bookmark,
121 CK_Quit,
122 CK_QuitQuiet,
123 /* C-x or similar */
124 CK_ExtendedKeyMap,
126 /* main commands */
127 CK_EditForceInternal = 100,
128 CK_View,
129 CK_ViewRaw,
130 CK_ViewFile,
131 CK_ViewFiltered,
132 CK_Find,
133 CK_DirSize,
134 CK_HotListAdd,
135 CK_PanelListingChange,
136 CK_CompareDirs,
137 CK_OptionsVfs,
138 CK_OptionsConfirm,
139 CK_PutCurrentLink,
140 CK_PutOtherLink,
141 CK_OptionsDisplayBits,
142 CK_EditExtensionsFile,
143 CK_EditFileHighlightFile,
144 CK_LinkSymbolicEdit,
145 CK_ExternalPanelize,
146 CK_Filter,
147 CK_ConnectFish,
148 CK_ConnectFtp,
149 CK_ConnectSmb,
150 CK_PanelInfo,
151 CK_Jobs,
152 CK_OptionsLayout,
153 CK_Link,
154 CK_PanelListing,
155 CK_ListMode,
156 CK_CdQuick,
157 CK_PanelQuickView,
158 CK_VfsList,
159 CK_SaveSetup,
160 CK_LinkSymbolic,
161 CK_PanelListingSwitch,
162 CK_ShowHidden,
163 CK_PanelTree,
164 CK_Tree,
165 CK_Undelete,
166 CK_SplitVertHoriz,
167 CK_SplitEqual,
168 CK_SplitMore,
169 CK_SplitLess,
170 CK_CompareFiles,
171 CK_OptionsPanel,
172 CK_LinkSymbolicRelative,
173 CK_PutCurrentPath,
174 CK_PutOtherPath,
175 CK_PutCurrentTagged,
176 CK_PutOtherTagged,
177 CK_Select,
178 CK_Unselect,
179 CK_SelectInvert,
181 /* panels */
182 CK_PanelOtherCd = 200,
183 CK_PanelOtherCdLink,
184 CK_Panelize,
185 CK_CopySingle,
186 CK_MoveSingle,
187 CK_DeleteSingle,
188 CK_CdChild,
189 CK_CdParent,
190 CK_CdParentSmart,
191 CK_PanelOtherSync,
192 CK_SortNext,
193 CK_SortPrev,
194 CK_SortReverse,
195 CK_SortByName,
196 CK_SortByExt,
197 CK_SortBySize,
198 CK_SortByMTime,
199 CK_ScrollLeft,
200 CK_ScrollRight,
202 /* dialog */
203 CK_Ok = 300,
204 CK_Cancel,
206 /* input */
207 CK_Yank = 350,
209 /* help */
210 CK_Index = 400,
211 CK_Back,
212 CK_LinkNext,
213 CK_LinkPrev,
214 CK_NodeNext,
215 CK_NodePrev,
217 /* tree */
218 CK_Forget = 450,
220 /* editor */
221 /* cursor movements */
222 CK_Tab = 500,
223 CK_Undo,
224 CK_ScrollUp,
225 CK_ScrollDown,
226 CK_Return,
227 CK_ParagraphUp,
228 CK_ParagraphDown,
229 /* file commands */
230 CK_Save,
231 CK_EditFile,
232 CK_EditNew,
233 CK_InsertFile,
234 CK_EditSyntaxFile,
235 /* block commands */
236 CK_BlockSave,
237 CK_BlockShiftLeft,
238 CK_BlockShiftRight,
239 CK_DeleteLine,
240 CK_DeleteToHome,
241 CK_DeleteToEnd,
242 /* bookmarks */
243 CK_BookmarkFlush,
244 CK_BookmarkNext,
245 CK_BookmarkPrev,
246 /* mark commands */
247 CK_MarkColumn,
248 CK_MarkWord,
249 CK_MarkLine,
250 CK_MarkAll,
251 CK_Unmark,
252 CK_MarkPageUp,
253 CK_MarkPageDown,
254 CK_MarkToFileBegin,
255 CK_MarkToFileEnd,
256 CK_MarkToPageBegin,
257 CK_MarkToPageEnd,
258 CK_MarkScrollUp,
259 CK_MarkScrollDown,
260 CK_MarkParagraphUp,
261 CK_MarkParagraphDown,
262 /* column mark commands */
263 CK_MarkColumnPageUp,
264 CK_MarkColumnPageDown,
265 CK_MarkColumnLeft,
266 CK_MarkColumnRight,
267 CK_MarkColumnUp,
268 CK_MarkColumnDown,
269 CK_MarkColumnScrollUp,
270 CK_MarkColumnScrollDown,
271 CK_MarkColumnParagraphUp,
272 CK_MarkColumnParagraphDown,
273 /* macros */
274 CK_MacroStartRecord,
275 CK_MacroStopRecord,
276 CK_MacroStartStopRecord,
277 CK_MacroDelete,
278 CK_RepeatStartRecord,
279 CK_RepeatStopRecord,
280 CK_RepeatStartStopRecord,
281 /* misc commands */
282 CK_InsertOverwrite,
283 CK_ParagraphFormat,
284 CK_MatchBracket,
285 CK_OptionsSaveMode,
286 CK_About,
287 CK_ShowMargin,
288 CK_ShowTabTws,
289 CK_SyntaxOnOff,
290 CK_SyntaxChoose,
291 CK_InsertLiteral,
292 CK_ExternalCommand,
293 CK_Date,
294 CK_Mail,
296 /* viewer */
297 CK_WrapMode = 600,
298 CK_MagicMode,
299 CK_NroffMode,
300 CK_HexMode,
301 CK_HexEditMode,
302 CK_BookmarkGoto,
303 CK_Ruler,
304 CK_SearchForward,
305 CK_SearchBackward,
306 CK_SearchForwardContinue,
307 CK_SearchBackwardContinue,
309 /* diff viewer */
310 CK_ShowSymbols = 700,
311 CK_SplitFull,
312 CK_Tab2,
313 CK_Tab3,
314 CK_Tab4,
315 CK_Tab8,
316 CK_HunkNext,
317 CK_HunkPrev,
318 CK_EditOther,
319 CK_Merge
322 /*** structures declarations (and typedefs of structures)*****************************************/
324 typedef struct name_keymap_t
326 const char *name;
327 unsigned long val;
328 } name_keymap_t;
330 typedef struct key_config_t
332 time_t mtime; /* mtime at the moment we read config file */
333 GArray *keymap;
334 GArray *ext_keymap;
335 gchar *labels[10];
336 } key_config_t;
338 /* The global keymaps are of this type */
339 typedef struct global_keymap_t
341 long key;
342 unsigned long command;
343 char caption[KEYMAP_SHORTCUT_LENGTH];
344 } global_keymap_t;
346 /*** global variables defined in .c file *********************************************************/
348 /*** declarations of public functions ************************************************************/
350 void keybind_cmd_bind (GArray * keymap, const char *keybind, unsigned long action);
351 unsigned long keybind_lookup_action (const char *name);
352 const char *keybind_lookup_actionname (unsigned long action);
353 const char *keybind_lookup_keymap_shortcut (const global_keymap_t * keymap, unsigned long action);
354 unsigned long keybind_lookup_keymap_command (const global_keymap_t * keymap, long key);
356 /*** inline functions ****************************************************************************/
358 #endif /* MC__KEYBIND_H */