Renamed keybind-related functions:
[pantumic.git] / src / keybind.h
blob2010f8401f51ba47c0aa90ef55e94839a8394184
1 #ifndef MC__KEYBIND_H
2 #define MC__KEYBIND_H
4 #include "lib/global.h"
6 /*** typedefs(not structures) and defined constants **********************************************/
8 #define KEYMAP_SHORTCUT_LENGTH 32 /* FIXME: is 32 bytes enough for shortcut? */
10 /*** enums ***************************************************************************************/
12 /*** structures declarations (and typedefs of structures)*****************************************/
14 typedef struct name_keymap_t
16 const char *name;
17 unsigned long val;
18 } name_keymap_t;
20 typedef struct key_config_t
22 time_t mtime; /* mtime at the moment we read config file */
23 GArray *keymap;
24 GArray *ext_keymap;
25 gchar *labels[10];
26 } key_config_t;
28 /* The global keymaps are of this type */
29 typedef struct global_keymap_t
31 long key;
32 unsigned long command;
33 char caption[KEYMAP_SHORTCUT_LENGTH];
34 } global_keymap_t;
36 /*** global variables defined in .c file *********************************************************/
38 #ifdef USE_INTERNAL_EDIT
39 extern GArray *editor_keymap;
40 extern GArray *editor_x_keymap;
42 extern const global_keymap_t *editor_map;
43 extern const global_keymap_t *editor_x_map;
44 #endif
46 extern GArray *viewer_keymap;
47 extern GArray *viewer_hex_keymap;
48 extern GArray *main_keymap;
49 extern GArray *main_x_keymap;
50 extern GArray *panel_keymap;
51 extern GArray *input_keymap;
52 extern GArray *listbox_keymap;
53 extern GArray *tree_keymap;
54 extern GArray *help_keymap;
55 extern GArray *dialog_keymap;
56 #ifdef USE_DIFF_VIEW
57 extern GArray *diff_keymap;
58 #endif
60 extern const global_keymap_t *main_map;
61 extern const global_keymap_t *main_x_map;
62 extern const global_keymap_t *panel_map;
63 extern const global_keymap_t *input_map;
64 extern const global_keymap_t *listbox_map;
65 extern const global_keymap_t *tree_map;
66 extern const global_keymap_t *help_map;
67 extern const global_keymap_t *dialog_map;
68 #ifdef USE_DIFF_VIEW
69 extern const global_keymap_t *diff_map;
70 #endif
72 /* viewer/actions_cmd.c */
73 extern const global_keymap_t default_viewer_keymap[];
74 extern const global_keymap_t default_viewer_hex_keymap[];
76 #ifdef USE_INTERNAL_EDIT
77 /* ../edit/editkey.c */
78 extern const global_keymap_t default_editor_keymap[];
79 extern const global_keymap_t default_editor_x_keymap[];
80 #endif
82 /* screen.c */
83 extern const global_keymap_t default_panel_keymap[];
85 /* widget.c */
86 extern const global_keymap_t default_input_keymap[];
87 extern const global_keymap_t default_listbox_keymap[];
89 /* main.c */
90 extern const global_keymap_t default_main_map[];
91 extern const global_keymap_t default_main_x_map[];
93 /* tree.c */
94 extern const global_keymap_t default_tree_keymap[];
96 /* help.c */
97 extern const global_keymap_t default_help_keymap[];
99 /* dialog.c */
100 extern const global_keymap_t default_dialog_keymap[];
102 #ifdef USE_DIFF_VIEW
103 /* ydiff.c */
104 extern const global_keymap_t default_diff_keymap[];
105 #endif
107 /*** declarations of public functions ************************************************************/
109 void keybind_cmd_bind (GArray * keymap, const char *keybind, unsigned long action);
110 unsigned long keybind_lookup_action (const char *name);
111 const char *keybind_lookup_keymap_shortcut (const global_keymap_t * keymap, unsigned long action);
112 unsigned long keybind_lookup_keymap_command (const global_keymap_t * keymap, long key);
114 /*** inline functions ****************************************************************************/
115 #endif /* MC__KEYBIND_H */