diff options
Diffstat (limited to 'apps/debug_menu.c')
-rw-r--r-- | apps/debug_menu.c | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c index 442bc8b162..809644b3d2 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <stdbool.h> | 25 | #include <stdbool.h> |
26 | #include <string.h> | 26 | #include <string.h> |
27 | #include "lcd.h" | 27 | #include "lcd.h" |
28 | #include "lang.h" | ||
28 | #include "menu.h" | 29 | #include "menu.h" |
29 | #include "debug_menu.h" | 30 | #include "debug_menu.h" |
30 | #include "kernel.h" | 31 | #include "kernel.h" |
@@ -45,6 +46,7 @@ | |||
45 | #include "screens.h" | 46 | #include "screens.h" |
46 | #include "misc.h" | 47 | #include "misc.h" |
47 | #include "splash.h" | 48 | #include "splash.h" |
49 | #include "shortcuts.h" | ||
48 | #include "dircache.h" | 50 | #include "dircache.h" |
49 | #include "viewport.h" | 51 | #include "viewport.h" |
50 | #ifdef HAVE_TAGCACHE | 52 | #ifdef HAVE_TAGCACHE |
@@ -2120,15 +2122,23 @@ static const struct the_menu_item menuitems[] = { | |||
2120 | }; | 2122 | }; |
2121 | static int menu_action_callback(int btn, struct gui_synclist *lists) | 2123 | static int menu_action_callback(int btn, struct gui_synclist *lists) |
2122 | { | 2124 | { |
2125 | int selection = gui_synclist_get_sel_pos(lists); | ||
2123 | if (btn == ACTION_STD_OK) | 2126 | if (btn == ACTION_STD_OK) |
2124 | { | 2127 | { |
2125 | FOR_NB_SCREENS(i) | 2128 | FOR_NB_SCREENS(i) |
2126 | viewportmanager_theme_enable(i, false, NULL); | 2129 | viewportmanager_theme_enable(i, false, NULL); |
2127 | menuitems[gui_synclist_get_sel_pos(lists)].function(); | 2130 | menuitems[selection].function(); |
2128 | btn = ACTION_REDRAW; | 2131 | btn = ACTION_REDRAW; |
2129 | FOR_NB_SCREENS(i) | 2132 | FOR_NB_SCREENS(i) |
2130 | viewportmanager_theme_undo(i, false); | 2133 | viewportmanager_theme_undo(i, false); |
2131 | } | 2134 | } |
2135 | else if (btn == ACTION_STD_CONTEXT) | ||
2136 | { | ||
2137 | MENUITEM_STRINGLIST(menu_items, "Debug Menu", NULL, ID2P(LANG_ADD_TO_FAVES)); | ||
2138 | if (do_menu(&menu_items, NULL, NULL, false) == 0) | ||
2139 | shortcuts_add(SHORTCUT_DEBUGITEM, menuitems[selection].desc); | ||
2140 | return ACTION_STD_CANCEL; | ||
2141 | } | ||
2132 | return btn; | 2142 | return btn; |
2133 | } | 2143 | } |
2134 | 2144 | ||
@@ -2148,3 +2158,22 @@ bool debug_menu(void) | |||
2148 | info.get_name = dbg_menu_getname; | 2158 | info.get_name = dbg_menu_getname; |
2149 | return simplelist_show_list(&info); | 2159 | return simplelist_show_list(&info); |
2150 | } | 2160 | } |
2161 | |||
2162 | bool run_debug_screen(char* screen) | ||
2163 | { | ||
2164 | unsigned i; | ||
2165 | for (i=0; i<ARRAYLEN(menuitems); i++) | ||
2166 | { | ||
2167 | if (!strcmp(screen, menuitems[i].desc)) | ||
2168 | { | ||
2169 | FOR_NB_SCREENS(j) | ||
2170 | viewportmanager_theme_enable(j, false, NULL); | ||
2171 | menuitems[i].function(); | ||
2172 | FOR_NB_SCREENS(j) | ||
2173 | viewportmanager_theme_undo(j, false); | ||
2174 | return true; | ||
2175 | } | ||
2176 | } | ||
2177 | return false; | ||
2178 | } | ||
2179 | |||