From 7b1d6f9860c80c26e298996f152de64c6a7f4c44 Mon Sep 17 00:00:00 2001 From: LiquidFenrir Date: Tue, 10 Apr 2018 01:28:37 +0200 Subject: [PATCH] implement L and R as extra menus instead of extra keys for X (#148) L is now the sorting menu R is unused --- include/instructions.h | 64 ++++++++++++++++++++++---------- source/main.c | 84 ++++++++++++++++++++++++++---------------- 2 files changed, 96 insertions(+), 52 deletions(-) diff --git a/include/instructions.h b/include/instructions.h index 0aa341c..6c663dc 100644 --- a/include/instructions.h +++ b/include/instructions.h @@ -98,27 +98,51 @@ Instructions_s install_instructions = { } }; -Instructions_s extra_instructions = { - .info_line = L"Release \uE002 to cancel or hold \uE006 and release \uE002 to do stuff", - .info_line_color = COLOR_WHITE, - .instructions = { - { - L"\uE079 Jump in the list", - L"\uE07A Reload broken icons" - }, - { - L"\uE07B Browse ThemePlaza", - L"\uE07C Sort by filename" - }, - { - L"\uE004 Sort by name", - L"\uE005 Sort by author" - }, - { - L"Exit", - NULL +Instructions_s extra_instructions[3] = { + { + .info_line = L"Release \uE002 to cancel or hold \uE006 and release \uE002 to sort", + .info_line_color = COLOR_WHITE, + .instructions = { + { + L"\uE079 Sort by name", + L"\uE07A Sort by author" + }, + { + L"\uE07B Sort by filename", + NULL + }, + { + NULL, + NULL + }, + { + L"Exit", + NULL + } } - } + }, + { + .info_line = L"Release \uE002 to cancel or hold \uE006 and release \uE002 to do stuff", + .info_line_color = COLOR_WHITE, + .instructions = { + { + L"\uE079 Jump in the list", + L"\uE07A Reload broken icons" + }, + { + L"\uE07B Browse ThemePlaza", + NULL, + }, + { + L"\uE004 Sorting menu", + NULL + }, + { + L"Exit", + NULL + } + } + }, }; #endif \ No newline at end of file diff --git a/source/main.c b/source/main.c index 3a4c036..c6fb11b 100644 --- a/source/main.c +++ b/source/main.c @@ -347,7 +347,19 @@ int main(void) if(install_mode) instructions = install_instructions; if(extra_mode) - instructions = extra_instructions; + { + int index = 1; + bool key_l = (kDown | kHeld) & KEY_L; + bool key_r = (kDown | kHeld) & KEY_R; + if(key_l ^ key_r) + { + if(key_l) + index = 0; + // else if(key_r) // uncomment when we use the right menu. we don't for now + // index = 2; + } + instructions = extra_instructions[index]; + } if(qr_mode) take_picture(); else if(preview_mode) draw_preview(TEXTURE_PREVIEW, preview_offset); @@ -527,42 +539,50 @@ int main(void) extra_mode = false; if(!extra_mode) { - if((kDown | kHeld) & KEY_DLEFT) + bool key_l = (kDown | kHeld) & KEY_L; + bool key_r = (kDown | kHeld) & KEY_R; + if(!(key_l ^ key_r)) { - browse_themeplaza: - if(themeplaza_browser(current_mode)) + if((kDown | kHeld) & KEY_DLEFT) { - current_mode = MODE_THEMES; - load_lists(lists); + browse_themeplaza: + if(themeplaza_browser(current_mode)) + { + current_mode = MODE_THEMES; + load_lists(lists); + } + } + else if((kDown | kHeld) & KEY_DUP) + { + jump: + jump_menu(current_list); + + } + else if((kDown | kHeld) & KEY_DDOWN) + { + load_icons_first(current_list, false); } } - else if((kDown | kHeld) & KEY_DUP) + else if(key_l) { - jump: - jump_menu(current_list); - - } - else if((kDown | kHeld) & KEY_DRIGHT) - { - sort_path: - sort_by_filename(current_list); - load_icons_first(current_list, false); - } - else if((kDown | kHeld) & KEY_DDOWN) - { - load_icons_first(current_list, false); - } - else if(((kDown | kHeld)) & KEY_L) - { - sort_name: - sort_by_name(current_list); - load_icons_first(current_list, false); - } - else if(((kDown | kHeld)) & KEY_R) - { - sort_author: - sort_by_author(current_list); - load_icons_first(current_list, false); + if((kDown | kHeld) & KEY_DLEFT) + { + sort_path: + sort_by_filename(current_list); + load_icons_first(current_list, false); + } + else if(((kDown | kHeld)) & KEY_DUP) + { + sort_name: + sort_by_name(current_list); + load_icons_first(current_list, false); + } + else if(((kDown | kHeld)) & KEY_DDOWN) + { + sort_author: + sort_by_author(current_list); + load_icons_first(current_list, false); + } } } continue;