diff options
Diffstat (limited to 'apps/plugins')
-rw-r--r-- | apps/plugins/keyremap.c | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/apps/plugins/keyremap.c b/apps/plugins/keyremap.c index acd23172f0..593dc5a3b0 100644 --- a/apps/plugins/keyremap.c +++ b/apps/plugins/keyremap.c | |||
@@ -105,7 +105,9 @@ enum { | |||
105 | M_SAVEKEYS, | 105 | M_SAVEKEYS, |
106 | M_LOADKEYS, | 106 | M_LOADKEYS, |
107 | M_DELKEYS, | 107 | M_DELKEYS, |
108 | M_TMPCORE, | ||
108 | M_SETCORE, | 109 | M_SETCORE, |
110 | M_DELCORE, | ||
109 | M_EXIT, | 111 | M_EXIT, |
110 | M_LAST_MAINITEM, //MAIN MENU ITEM COUNT | 112 | M_LAST_MAINITEM, //MAIN MENU ITEM COUNT |
111 | /*Menus not directly accessible from main menu*/ | 113 | /*Menus not directly accessible from main menu*/ |
@@ -126,7 +128,9 @@ MENU_ITEM(M_RESETKEYS, "Reset Keymap", 1), | |||
126 | MENU_ITEM(M_SAVEKEYS, "Save Keymap", 1), | 128 | MENU_ITEM(M_SAVEKEYS, "Save Keymap", 1), |
127 | MENU_ITEM(M_LOADKEYS, "Load Keymaps", 1), | 129 | MENU_ITEM(M_LOADKEYS, "Load Keymaps", 1), |
128 | MENU_ITEM(M_DELKEYS, "Delete Keymaps", 1), | 130 | MENU_ITEM(M_DELKEYS, "Delete Keymaps", 1), |
131 | MENU_ITEM(M_TMPCORE, "Temp Core Remap", 1), | ||
129 | MENU_ITEM(M_SETCORE, "Set Core Remap", 1), | 132 | MENU_ITEM(M_SETCORE, "Set Core Remap", 1), |
133 | MENU_ITEM(M_DELCORE, "Delete Core Remap", 1), | ||
130 | MENU_ITEM(M_EXIT, ID2P(LANG_MENU_QUIT), 0), | 134 | MENU_ITEM(M_EXIT, ID2P(LANG_MENU_QUIT), 0), |
131 | MENU_ITEM(M_ACTIONS, "Actions", LAST_ACTION_PLACEHOLDER), | 135 | MENU_ITEM(M_ACTIONS, "Actions", LAST_ACTION_PLACEHOLDER), |
132 | MENU_ITEM(M_BUTTONS, "Buttons", -1), /* Set at runtime in plugin_start: */ | 136 | MENU_ITEM(M_BUTTONS, "Buttons", -1), /* Set at runtime in plugin_start: */ |
@@ -878,6 +882,17 @@ int menu_action_root(int *action, int selected_item, bool* exit, struct gui_sync | |||
878 | { | 882 | { |
879 | keyset.view_lastcol = -1; | 883 | keyset.view_lastcol = -1; |
880 | } | 884 | } |
885 | else if (cur->menuid == MENU_ID(M_TMPCORE)) | ||
886 | { | ||
887 | int entry_count;/* (ctx_count + ctx_count + act_count + 1) */ | ||
888 | struct button_mapping *keymap = keyremap_create_temp(&entry_count); | ||
889 | if (rb->core_set_keyremap(keymap, entry_count) >= 0) | ||
890 | rb->splash(HZ *2, "Keymap Applied"); | ||
891 | else | ||
892 | rb->splash(HZ *2, "Error Applying"); | ||
893 | |||
894 | goto default_handler; | ||
895 | } | ||
881 | else if (cur->menuid == MENU_ID(M_SETCORE)) | 896 | else if (cur->menuid == MENU_ID(M_SETCORE)) |
882 | { | 897 | { |
883 | if (rb->file_exists(CORE_KEYREMAP_FILE) && 0 == core_savecount++) | 898 | if (rb->file_exists(CORE_KEYREMAP_FILE) && 0 == core_savecount++) |
@@ -887,7 +902,25 @@ int menu_action_root(int *action, int selected_item, bool* exit, struct gui_sync | |||
887 | if (keyremap_save_current(CORE_KEYREMAP_FILE) == 0) | 902 | if (keyremap_save_current(CORE_KEYREMAP_FILE) == 0) |
888 | rb->splash(HZ *2, "Error Saving"); | 903 | rb->splash(HZ *2, "Error Saving"); |
889 | else | 904 | else |
890 | rb->splash(HZ *2, "Saved, Restart Device"); | 905 | { |
906 | rb->splash(HZ *2, "Saved"); | ||
907 | int entry_count;/* (ctx_count + ctx_count + act_count + 1) */ | ||
908 | struct button_mapping *keymap = keyremap_create_temp(&entry_count); | ||
909 | rb->core_set_keyremap(keymap, entry_count); | ||
910 | } | ||
911 | goto default_handler; | ||
912 | } | ||
913 | else if (cur->menuid == MENU_ID(M_DELCORE)) | ||
914 | { | ||
915 | rb->core_set_keyremap(NULL, -1); | ||
916 | if (rb->file_exists(CORE_KEYREMAP_FILE)) | ||
917 | { | ||
918 | rb->rename(CORE_KEYREMAP_FILE, KMFDIR "/core_deleted" KMFEXT2); | ||
919 | rb->splash(HZ *2, "Removed"); | ||
920 | } | ||
921 | else | ||
922 | rb->splash(HZ *2, "Error Removing"); | ||
923 | |||
891 | goto default_handler; | 924 | goto default_handler; |
892 | } | 925 | } |
893 | else if (cur->menuid == MENU_ID(M_SAVEKEYS)) | 926 | else if (cur->menuid == MENU_ID(M_SAVEKEYS)) |