Symbolic names of keymap sections are defined.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2011-02-27 17:03:31 +03:00
parent b3d0a9237b
commit 5ef6375120
3 changed files with 41 additions and 26 deletions

View File

@ -8,6 +8,21 @@
/*** typedefs(not structures) and defined constants **********************************************/ /*** typedefs(not structures) and defined constants **********************************************/
/* keymap sections */
#define KEYMAP_SECTION_MAIN "main"
#define KEYMAP_SECTION_MAIN_EXT "main:xmap"
#define KEYMAP_SECTION_PANEL "panel"
#define KEYMAP_SECTION_DIALOG "dialog"
#define KEYMAP_SECTION_INPUT "input"
#define KEYMAP_SECTION_LISTBOX "listbox"
#define KEYMAP_SECTION_TREE "tree"
#define KEYMAP_SECTION_HELP "help"
#define KEYMAP_SECTION_EDITOR "editor"
#define KEYMAP_SECTION_EDITOR_EXT "editor:xmap"
#define KEYMAP_SECTION_VIEWER "viewer"
#define KEYMAP_SECTION_VIEWER_HEX "viewer:hex"
#define KEYMAP_SECTION_DIFFVIEWER "diffviewer"
#define KEYMAP_SHORTCUT_LENGTH 32 /* FIXME: is 32 bytes enough for shortcut? */ #define KEYMAP_SHORTCUT_LENGTH 32 /* FIXME: is 32 bytes enough for shortcut? */
#define CK_PipeBlock(i) (10000+(i)) #define CK_PipeBlock(i) (10000+(i))

View File

@ -565,22 +565,22 @@ create_default_keymap (void)
keymap = mc_config_init (NULL); keymap = mc_config_init (NULL);
create_default_keymap_section (keymap, "main", default_main_keymap); create_default_keymap_section (keymap, KEYMAP_SECTION_MAIN, default_main_keymap);
create_default_keymap_section (keymap, "main:xmap", default_main_x_keymap); create_default_keymap_section (keymap, KEYMAP_SECTION_MAIN_EXT, default_main_x_keymap);
create_default_keymap_section (keymap, "panel", default_panel_keymap); create_default_keymap_section (keymap, KEYMAP_SECTION_PANEL, default_panel_keymap);
create_default_keymap_section (keymap, "dialog", default_dialog_keymap); create_default_keymap_section (keymap, KEYMAP_SECTION_DIALOG, default_dialog_keymap);
create_default_keymap_section (keymap, "input", default_input_keymap); create_default_keymap_section (keymap, KEYMAP_SECTION_INPUT, default_input_keymap);
create_default_keymap_section (keymap, "listbox", default_listbox_keymap); create_default_keymap_section (keymap, KEYMAP_SECTION_LISTBOX, default_listbox_keymap);
create_default_keymap_section (keymap, "tree", default_tree_keymap); create_default_keymap_section (keymap, KEYMAP_SECTION_TREE, default_tree_keymap);
create_default_keymap_section (keymap, "help", default_help_keymap); create_default_keymap_section (keymap, KEYMAP_SECTION_HELP, default_help_keymap);
#ifdef USE_INTERNAL_EDIT #ifdef USE_INTERNAL_EDIT
create_default_keymap_section (keymap, "editor", default_editor_keymap); create_default_keymap_section (keymap, KEYMAP_SECTION_EDITOR, default_editor_keymap);
create_default_keymap_section (keymap, "editor:xmap", default_editor_x_keymap); create_default_keymap_section (keymap, KEYMAP_SECTION_EDITOR_EXT, default_editor_x_keymap);
#endif #endif
create_default_keymap_section (keymap, "viewer", default_viewer_keymap); create_default_keymap_section (keymap, KEYMAP_SECTION_VIEWER, default_viewer_keymap);
create_default_keymap_section (keymap, "viewer:hex", default_viewer_hex_keymap); create_default_keymap_section (keymap, KEYMAP_SECTION_VIEWER_HEX, default_viewer_hex_keymap);
#ifdef USE_DIFF_VIEW #ifdef USE_DIFF_VIEW
create_default_keymap_section (keymap, "diffviewer", default_diff_keymap); create_default_keymap_section (keymap, KEYMAP_SECTION_DIFFVIEWER, default_diff_keymap);
#endif #endif
return keymap; return keymap;

View File

@ -1171,43 +1171,43 @@ load_keymap_defs (gboolean load_from_file)
if (mc_global_keymap != NULL) if (mc_global_keymap != NULL)
{ {
main_keymap = g_array_new (TRUE, FALSE, sizeof (global_keymap_t)); main_keymap = g_array_new (TRUE, FALSE, sizeof (global_keymap_t));
load_keymap_from_section ("main", main_keymap, mc_global_keymap); load_keymap_from_section (KEYMAP_SECTION_MAIN, main_keymap, mc_global_keymap);
main_x_keymap = g_array_new (TRUE, FALSE, sizeof (global_keymap_t)); main_x_keymap = g_array_new (TRUE, FALSE, sizeof (global_keymap_t));
load_keymap_from_section ("main:xmap", main_x_keymap, mc_global_keymap); load_keymap_from_section (KEYMAP_SECTION_MAIN_EXT, main_x_keymap, mc_global_keymap);
panel_keymap = g_array_new (TRUE, FALSE, sizeof (global_keymap_t)); panel_keymap = g_array_new (TRUE, FALSE, sizeof (global_keymap_t));
load_keymap_from_section ("panel", panel_keymap, mc_global_keymap); load_keymap_from_section (KEYMAP_SECTION_PANEL, panel_keymap, mc_global_keymap);
dialog_keymap = g_array_new (TRUE, FALSE, sizeof (global_keymap_t)); dialog_keymap = g_array_new (TRUE, FALSE, sizeof (global_keymap_t));
load_keymap_from_section ("dialog", dialog_keymap, mc_global_keymap); load_keymap_from_section (KEYMAP_SECTION_DIALOG, dialog_keymap, mc_global_keymap);
input_keymap = g_array_new (TRUE, FALSE, sizeof (global_keymap_t)); input_keymap = g_array_new (TRUE, FALSE, sizeof (global_keymap_t));
load_keymap_from_section ("input", input_keymap, mc_global_keymap); load_keymap_from_section (KEYMAP_SECTION_INPUT, input_keymap, mc_global_keymap);
listbox_keymap = g_array_new (TRUE, FALSE, sizeof (global_keymap_t)); listbox_keymap = g_array_new (TRUE, FALSE, sizeof (global_keymap_t));
load_keymap_from_section ("listbox", listbox_keymap, mc_global_keymap); load_keymap_from_section (KEYMAP_SECTION_LISTBOX, listbox_keymap, mc_global_keymap);
tree_keymap = g_array_new (TRUE, FALSE, sizeof (global_keymap_t)); tree_keymap = g_array_new (TRUE, FALSE, sizeof (global_keymap_t));
load_keymap_from_section ("tree", tree_keymap, mc_global_keymap); load_keymap_from_section (KEYMAP_SECTION_TREE, tree_keymap, mc_global_keymap);
help_keymap = g_array_new (TRUE, FALSE, sizeof (global_keymap_t)); help_keymap = g_array_new (TRUE, FALSE, sizeof (global_keymap_t));
load_keymap_from_section ("help", help_keymap, mc_global_keymap); load_keymap_from_section (KEYMAP_SECTION_HELP, help_keymap, mc_global_keymap);
#ifdef USE_INTERNAL_EDIT #ifdef USE_INTERNAL_EDIT
editor_keymap = g_array_new (TRUE, FALSE, sizeof (global_keymap_t)); editor_keymap = g_array_new (TRUE, FALSE, sizeof (global_keymap_t));
load_keymap_from_section ("editor", editor_keymap, mc_global_keymap); load_keymap_from_section (KEYMAP_SECTION_EDITOR, editor_keymap, mc_global_keymap);
editor_x_keymap = g_array_new (TRUE, FALSE, sizeof (global_keymap_t)); editor_x_keymap = g_array_new (TRUE, FALSE, sizeof (global_keymap_t));
load_keymap_from_section ("editor:xmap", editor_x_keymap, mc_global_keymap); load_keymap_from_section (KEYMAP_SECTION_EDITOR_EXT, editor_x_keymap, mc_global_keymap);
#endif #endif
viewer_keymap = g_array_new (TRUE, FALSE, sizeof (global_keymap_t)); viewer_keymap = g_array_new (TRUE, FALSE, sizeof (global_keymap_t));
load_keymap_from_section ("viewer", viewer_keymap, mc_global_keymap); load_keymap_from_section (KEYMAP_SECTION_VIEWER, viewer_keymap, mc_global_keymap);
viewer_hex_keymap = g_array_new (TRUE, FALSE, sizeof (global_keymap_t)); viewer_hex_keymap = g_array_new (TRUE, FALSE, sizeof (global_keymap_t));
load_keymap_from_section ("viewer:hex", viewer_hex_keymap, mc_global_keymap); load_keymap_from_section (KEYMAP_SECTION_VIEWER_HEX, viewer_hex_keymap, mc_global_keymap);
#ifdef USE_DIFF_VIEW #ifdef USE_DIFF_VIEW
diff_keymap = g_array_new (TRUE, FALSE, sizeof (global_keymap_t)); diff_keymap = g_array_new (TRUE, FALSE, sizeof (global_keymap_t));
load_keymap_from_section ("diffviewer", diff_keymap, mc_global_keymap); load_keymap_from_section (KEYMAP_SECTION_DIFFVIEWER, diff_keymap, mc_global_keymap);
#endif #endif
mc_config_deinit (mc_global_keymap); mc_config_deinit (mc_global_keymap);