diff options
author | Jonas Häggqvist <rasher@rasher.dk> | 2009-06-22 17:37:36 +0000 |
---|---|---|
committer | Jonas Häggqvist <rasher@rasher.dk> | 2009-06-22 17:37:36 +0000 |
commit | 4b831753e799f969b473b0b0fb48317722d7b98e (patch) | |
tree | e974b3dfd5fcd08fd82340c5d3a1e3a22a189c99 /apps/tree.c | |
parent | c99ab564b0f3a2656521139df6d9524d6b197fe8 (diff) | |
download | rockbox-4b831753e799f969b473b0b0fb48317722d7b98e.tar.gz rockbox-4b831753e799f969b473b0b0fb48317722d7b98e.zip |
Center the list on the currently loaded file in the following screens (FS#10093):
- Font selection
- FM preset selection
- WPS/RWPS selection
- Language selection
Modify the menu wording to make them seem more like a setting and update the manual accordingly.
The code could possibly be more compact - any help on that would be appreciated.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21464 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/tree.c')
-rw-r--r-- | apps/tree.c | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/apps/tree.c b/apps/tree.c index 84224efa85..d1d0ec3b27 100644 --- a/apps/tree.c +++ b/apps/tree.c | |||
@@ -904,6 +904,7 @@ int rockbox_browse(const char *root, int dirfilter) | |||
904 | if (dirfilter >= NUM_FILTER_MODES) | 904 | if (dirfilter >= NUM_FILTER_MODES) |
905 | { | 905 | { |
906 | static struct tree_context backup; | 906 | static struct tree_context backup; |
907 | char current[MAX_PATH]; | ||
907 | int last_context; | 908 | int last_context; |
908 | 909 | ||
909 | backup = tc; | 910 | backup = tc; |
@@ -913,6 +914,58 @@ int rockbox_browse(const char *root, int dirfilter) | |||
913 | start_wps = false; | 914 | start_wps = false; |
914 | last_context = curr_context; | 915 | last_context = curr_context; |
915 | 916 | ||
917 | /* Center on the currently loaded language when browsing languages. */ | ||
918 | if (dirfilter == SHOW_LNG) | ||
919 | { | ||
920 | if (global_settings.lang_file[0]) | ||
921 | { | ||
922 | snprintf(current, sizeof(current), LANG_DIR "/%s.lng", | ||
923 | global_settings.lang_file); | ||
924 | } | ||
925 | else | ||
926 | { | ||
927 | strncpy(current, LANG_DIR "/english.lng", sizeof(current)); | ||
928 | } | ||
929 | } | ||
930 | /* Center on currently loaded WPS */ | ||
931 | else if (dirfilter == SHOW_WPS) | ||
932 | { | ||
933 | snprintf(current, sizeof(current), WPS_DIR "/%s.wps", | ||
934 | global_settings.wps_file); | ||
935 | } | ||
936 | #ifdef HAVE_REMOTE_LCD | ||
937 | /* Center on currently loaded RWPS */ | ||
938 | else if (dirfilter == SHOW_RWPS) | ||
939 | { | ||
940 | snprintf(current, sizeof(current), WPS_DIR "/%s.rwps", | ||
941 | global_settings.rwps_file); | ||
942 | } | ||
943 | #endif | ||
944 | #ifdef HAVE_LCD_BITMAP | ||
945 | /* Center on the currently loaded font when browsing fonts */ | ||
946 | else if (dirfilter == SHOW_FONT) | ||
947 | { | ||
948 | snprintf(current, sizeof(current), FONT_DIR "/%s.fnt", | ||
949 | global_settings.font_file); | ||
950 | } | ||
951 | #endif | ||
952 | #if CONFIG_TUNER | ||
953 | /* Center on the currently loaded FM preset when browsing those */ | ||
954 | else if (dirfilter == SHOW_FMR) | ||
955 | { | ||
956 | snprintf(current, sizeof(current), FMPRESET_PATH "/%s.fmr", | ||
957 | global_settings.fmr_file); | ||
958 | } | ||
959 | #endif | ||
960 | |||
961 | /* If we've found a file to center on, do it */ | ||
962 | if (current[0] == '/') | ||
963 | { | ||
964 | set_current_file(current); | ||
965 | /* set_current_file changes dirlevel, change it back */ | ||
966 | tc.dirlevel = 0; | ||
967 | } | ||
968 | |||
916 | ret_val = dirbrowse(); | 969 | ret_val = dirbrowse(); |
917 | tc = backup; | 970 | tc = backup; |
918 | curr_context = last_context; | 971 | curr_context = last_context; |