forked from len0rd/rockbox
Brian King's .rockbox browsing patch
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3964 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
d527849e66
commit
de5477cc00
7 changed files with 156 additions and 58 deletions
|
@ -1727,3 +1727,33 @@ id: LANG_RECURSE_DIRECTORY_QUESTION
|
||||||
desc: Asked from onplay screen
|
desc: Asked from onplay screen
|
||||||
eng: "Recursively?"
|
eng: "Recursively?"
|
||||||
new:
|
new:
|
||||||
|
|
||||||
|
id: LANG_CUSTOM_FONT
|
||||||
|
desc: in setting_menu()
|
||||||
|
eng: "Fonts"
|
||||||
|
new:
|
||||||
|
|
||||||
|
id: LANG_FIRMWARE
|
||||||
|
desc: in the main menu
|
||||||
|
eng: "Firmware"
|
||||||
|
new:
|
||||||
|
|
||||||
|
id: LANG_LANGUAGE
|
||||||
|
desc: in settings_menu
|
||||||
|
eng: "Language"
|
||||||
|
new:
|
||||||
|
|
||||||
|
id: LANG_WHILE_PLAYING
|
||||||
|
desc: in settings_menu()
|
||||||
|
eng: "While Playing Screen"
|
||||||
|
new:
|
||||||
|
|
||||||
|
id: LANG_CUSTOM_CFG
|
||||||
|
desc: in setting_menu()
|
||||||
|
eng: "Profiles"
|
||||||
|
new:
|
||||||
|
|
||||||
|
id: LANG_PLUGINS
|
||||||
|
desc: in main_menu()
|
||||||
|
eng: "Plugins"
|
||||||
|
new:
|
||||||
|
|
|
@ -251,6 +251,16 @@ bool show_info(void)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool firmware_browse(void)
|
||||||
|
{
|
||||||
|
return rockbox_browse(ROCKBOX_DIR, SHOW_MOD);
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool plugin_browse(void)
|
||||||
|
{
|
||||||
|
return rockbox_browse(PLUGIN_DIR, SHOW_PLUGINS);
|
||||||
|
}
|
||||||
|
|
||||||
bool main_menu(void)
|
bool main_menu(void)
|
||||||
{
|
{
|
||||||
int m;
|
int m;
|
||||||
|
@ -273,14 +283,8 @@ bool main_menu(void)
|
||||||
#ifdef HAVE_ALARM_MOD
|
#ifdef HAVE_ALARM_MOD
|
||||||
{ str(LANG_ALARM_MOD_ALARM_MENU), alarm_screen },
|
{ str(LANG_ALARM_MOD_ALARM_MENU), alarm_screen },
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_LCD_BITMAP
|
{ str(LANG_PLUGINS), plugin_browse },
|
||||||
#ifdef USE_GAMES
|
{ str(LANG_FIRMWARE), firmware_browse },
|
||||||
{ str(LANG_GAMES), games_menu },
|
|
||||||
#endif
|
|
||||||
#ifdef USE_DEMOS
|
|
||||||
{ str(LANG_DEMOS), demo_menu },
|
|
||||||
#endif /* end USE_DEMOS */
|
|
||||||
#endif
|
|
||||||
{ str(LANG_INFO), show_info },
|
{ str(LANG_INFO), show_info },
|
||||||
{ str(LANG_VERSION), show_credits },
|
{ str(LANG_VERSION), show_credits },
|
||||||
#ifndef SIMULATOR
|
#ifndef SIMULATOR
|
||||||
|
|
|
@ -410,10 +410,11 @@ static int add_directory_to_playlist(char *dirname, int *position, bool queue,
|
||||||
int num_files = 0;
|
int num_files = 0;
|
||||||
bool buffer_full = false;
|
bool buffer_full = false;
|
||||||
int i;
|
int i;
|
||||||
|
int dirfilter = SHOW_ALL;
|
||||||
struct entry *files;
|
struct entry *files;
|
||||||
|
|
||||||
/* use the tree browser dircache to load files */
|
/* use the tree browser dircache to load files */
|
||||||
files = load_and_sort_directory(dirname, SHOW_ALL, &num_files,
|
files = load_and_sort_directory(dirname, &dirfilter, &num_files,
|
||||||
&buffer_full);
|
&buffer_full);
|
||||||
|
|
||||||
if(!files)
|
if(!files)
|
||||||
|
@ -456,7 +457,7 @@ static int add_directory_to_playlist(char *dirname, int *position, bool queue,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* we now need to reload our current directory */
|
/* we now need to reload our current directory */
|
||||||
files = load_and_sort_directory(dirname, SHOW_ALL, &num_files,
|
files = load_and_sort_directory(dirname, &dirfilter, &num_files,
|
||||||
&buffer_full);
|
&buffer_full);
|
||||||
if (!files)
|
if (!files)
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include "file.h"
|
#include "file.h"
|
||||||
|
|
||||||
#define ROCKBOX_DIR "/.rockbox"
|
#define ROCKBOX_DIR "/.rockbox"
|
||||||
|
#define PLUGIN_DIR ROCKBOX_DIR"/rocks"
|
||||||
|
|
||||||
#define MAX_FILENAME 20
|
#define MAX_FILENAME 20
|
||||||
|
|
||||||
|
@ -50,6 +51,7 @@
|
||||||
#define FF_REWIND_45000 12
|
#define FF_REWIND_45000 12
|
||||||
#define FF_REWIND_60000 13
|
#define FF_REWIND_60000 13
|
||||||
|
|
||||||
|
|
||||||
struct user_settings
|
struct user_settings
|
||||||
{
|
{
|
||||||
/* audio settings */
|
/* audio settings */
|
||||||
|
@ -222,7 +224,11 @@ extern char rockboxdir[];
|
||||||
enum { REPEAT_OFF, REPEAT_ALL, REPEAT_ONE, NUM_REPEAT_MODES };
|
enum { REPEAT_OFF, REPEAT_ALL, REPEAT_ONE, NUM_REPEAT_MODES };
|
||||||
|
|
||||||
/* dir filter options */
|
/* dir filter options */
|
||||||
enum { SHOW_ALL, SHOW_SUPPORTED, SHOW_MUSIC, SHOW_PLAYLIST, NUM_FILTER_MODES };
|
/* Note: Any new filter modes need to be added before NUM_FILTER_MODES.
|
||||||
|
* Any new rockbox browse filter modes (accessible through the menu)
|
||||||
|
* must be added after NUM_FILTER_MODES. */
|
||||||
|
enum { SHOW_ALL, SHOW_SUPPORTED, SHOW_MUSIC, SHOW_PLAYLIST, NUM_FILTER_MODES,
|
||||||
|
SHOW_WPS, SHOW_CFG, SHOW_LNG, SHOW_MOD, SHOW_FONT, SHOW_PLUGINS};
|
||||||
|
|
||||||
/* recursive dir insert options */
|
/* recursive dir insert options */
|
||||||
enum { RECURSE_OFF, RECURSE_ON, RECURSE_ASK };
|
enum { RECURSE_OFF, RECURSE_ON, RECURSE_ASK };
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
#include "powermgmt.h"
|
#include "powermgmt.h"
|
||||||
#include "rtc.h"
|
#include "rtc.h"
|
||||||
#include "ata.h"
|
#include "ata.h"
|
||||||
|
#include "tree.h"
|
||||||
#include "screens.h"
|
#include "screens.h"
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
#include "peakmeter.h"
|
#include "peakmeter.h"
|
||||||
|
@ -683,6 +684,28 @@ static bool browse_current(void)
|
||||||
return set_bool( str(LANG_FOLLOW), &global_settings.browse_current );
|
return set_bool( str(LANG_FOLLOW), &global_settings.browse_current );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool custom_wps_browse(void)
|
||||||
|
{
|
||||||
|
return rockbox_browse(ROCKBOX_DIR, SHOW_WPS);
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool custom_cfg_browse(void)
|
||||||
|
{
|
||||||
|
return rockbox_browse(ROCKBOX_DIR, SHOW_CFG);
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool language_browse(void)
|
||||||
|
{
|
||||||
|
return rockbox_browse(ROCKBOX_DIR, SHOW_LNG);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_RECORDER_KEYPAD
|
||||||
|
static bool font_browse(void)
|
||||||
|
{
|
||||||
|
return rockbox_browse(ROCKBOX_DIR, SHOW_FONT);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
static bool scroll_bar(void)
|
static bool scroll_bar(void)
|
||||||
{
|
{
|
||||||
|
@ -894,8 +917,14 @@ bool settings_menu(void)
|
||||||
|
|
||||||
struct menu_items items[] = {
|
struct menu_items items[] = {
|
||||||
{ str(LANG_PLAYBACK), playback_settings_menu },
|
{ str(LANG_PLAYBACK), playback_settings_menu },
|
||||||
|
{ str(LANG_CUSTOM_CFG), custom_cfg_browse },
|
||||||
|
{ str(LANG_WHILE_PLAYING), custom_wps_browse },
|
||||||
|
{ str(LANG_LANGUAGE), language_browse },
|
||||||
{ str(LANG_FILE), fileview_settings_menu },
|
{ str(LANG_FILE), fileview_settings_menu },
|
||||||
{ str(LANG_DISPLAY), display_settings_menu },
|
{ str(LANG_DISPLAY), display_settings_menu },
|
||||||
|
#ifdef HAVE_RECORDER_KEYPAD
|
||||||
|
{ str(LANG_CUSTOM_FONT), font_browse },
|
||||||
|
#endif
|
||||||
{ str(LANG_SYSTEM), system_settings_menu },
|
{ str(LANG_SYSTEM), system_settings_menu },
|
||||||
{ str(LANG_SAVE_SETTINGS), settings_save_config },
|
{ str(LANG_SAVE_SETTINGS), settings_save_config },
|
||||||
};
|
};
|
||||||
|
|
119
apps/tree.c
119
apps/tree.c
|
@ -78,19 +78,20 @@ static int cursorpos[MAX_DIR_LEVELS];
|
||||||
static char lastdir[MAX_PATH];
|
static char lastdir[MAX_PATH];
|
||||||
static char lastfile[MAX_PATH];
|
static char lastfile[MAX_PATH];
|
||||||
static char currdir[MAX_PATH];
|
static char currdir[MAX_PATH];
|
||||||
|
static char currdir_save[MAX_PATH];
|
||||||
static bool reload_dir = false;
|
static bool reload_dir = false;
|
||||||
static int boot_size = 0;
|
static int boot_size = 0;
|
||||||
static int boot_cluster;
|
static int boot_cluster;
|
||||||
static bool boot_changed = false;
|
static bool boot_changed = false;
|
||||||
|
|
||||||
static bool dirbrowse(char *root);
|
static bool dirbrowse(char *root, int *dirfilter);
|
||||||
|
|
||||||
void browse_root(void)
|
void browse_root(void)
|
||||||
{
|
{
|
||||||
#ifndef SIMULATOR
|
#ifndef SIMULATOR
|
||||||
dirbrowse("/");
|
dirbrowse("/", &global_settings.dirfilter);
|
||||||
#else
|
#else
|
||||||
if (!dirbrowse("/")) {
|
if (!dirbrowse("/", &global_settings.dirfilter)) {
|
||||||
DEBUGF("No filesystem found. Have you forgotten to create it?\n");
|
DEBUGF("No filesystem found. Have you forgotten to create it?\n");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -189,7 +190,7 @@ static int compare(const void* p1, const void* p2)
|
||||||
return ( e2->attr & ATTR_DIRECTORY ) - ( e1->attr & ATTR_DIRECTORY );
|
return ( e2->attr & ATTR_DIRECTORY ) - ( e1->attr & ATTR_DIRECTORY );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void showfileline(int line, int direntry, bool scroll)
|
static void showfileline(int line, int direntry, bool scroll, int *dirfilter)
|
||||||
{
|
{
|
||||||
char* name = dircache[direntry].name;
|
char* name = dircache[direntry].name;
|
||||||
int xpos = LINE_X;
|
int xpos = LINE_X;
|
||||||
|
@ -200,7 +201,7 @@ static void showfileline(int line, int direntry, bool scroll)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* if any file filter is on, strip the extension */
|
/* if any file filter is on, strip the extension */
|
||||||
if (global_settings.dirfilter != SHOW_ALL &&
|
if (*dirfilter != SHOW_ALL &&
|
||||||
!(dircache[direntry].attr & ATTR_DIRECTORY))
|
!(dircache[direntry].attr & ATTR_DIRECTORY))
|
||||||
{
|
{
|
||||||
char* dotpos = strrchr(name, '.');
|
char* dotpos = strrchr(name, '.');
|
||||||
|
@ -235,7 +236,7 @@ static void showfileline(int line, int direntry, bool scroll)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* load sorted directory into dircache. returns NULL on failure. */
|
/* load sorted directory into dircache. returns NULL on failure. */
|
||||||
struct entry* load_and_sort_directory(char *dirname, int dirfilter,
|
struct entry* load_and_sort_directory(char *dirname, int *dirfilter,
|
||||||
int *num_files, bool *buffer_full)
|
int *num_files, bool *buffer_full)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -273,7 +274,7 @@ struct entry* load_and_sort_directory(char *dirname, int dirfilter,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* filter out dotfiles and hidden files */
|
/* filter out dotfiles and hidden files */
|
||||||
if (dirfilter != SHOW_ALL &&
|
if (*dirfilter != SHOW_ALL &&
|
||||||
((entry->d_name[0]=='.') ||
|
((entry->d_name[0]=='.') ||
|
||||||
(entry->attribute & ATTR_HIDDEN))) {
|
(entry->attribute & ATTR_HIDDEN))) {
|
||||||
i--;
|
i--;
|
||||||
|
@ -322,25 +323,19 @@ struct entry* load_and_sort_directory(char *dirname, int dirfilter,
|
||||||
boot_cluster = entry->startcluster;
|
boot_cluster = entry->startcluster;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* filter out all non-playlist files */
|
/* filter out non-visible files */
|
||||||
if ( dirfilter == SHOW_PLAYLIST &&
|
if ((*dirfilter == SHOW_PLAYLIST &&
|
||||||
(!(dptr->attr &
|
!(dptr->attr & (ATTR_DIRECTORY|TREE_ATTR_M3U))) ||
|
||||||
(ATTR_DIRECTORY|TREE_ATTR_M3U))) ) {
|
(*dirfilter == SHOW_MUSIC &&
|
||||||
i--;
|
!(dptr->attr & (ATTR_DIRECTORY|TREE_ATTR_MPA|TREE_ATTR_M3U))) ||
|
||||||
continue;
|
(*dirfilter == SHOW_SUPPORTED && !(dptr->attr & TREE_ATTR_MASK)) ||
|
||||||
}
|
(*dirfilter == SHOW_WPS && !(dptr->attr & TREE_ATTR_WPS)) ||
|
||||||
|
(*dirfilter == SHOW_CFG && !(dptr->attr & TREE_ATTR_CFG)) ||
|
||||||
/* filter out non-music files */
|
(*dirfilter == SHOW_LNG && !(dptr->attr & TREE_ATTR_LNG)) ||
|
||||||
if ( dirfilter == SHOW_MUSIC &&
|
(*dirfilter == SHOW_MOD && !(dptr->attr & TREE_ATTR_MOD)) ||
|
||||||
(!(dptr->attr &
|
(*dirfilter == SHOW_FONT && !(dptr->attr & TREE_ATTR_FONT)) ||
|
||||||
(ATTR_DIRECTORY|TREE_ATTR_MPA|TREE_ATTR_M3U))) ) {
|
(*dirfilter == SHOW_PLUGINS && !(dptr->attr & TREE_ATTR_ROCK)))
|
||||||
i--;
|
{
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* filter out non-supported files */
|
|
||||||
if ( dirfilter == SHOW_SUPPORTED &&
|
|
||||||
(!(dptr->attr & TREE_ATTR_MASK)) ) {
|
|
||||||
i--;
|
i--;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -363,7 +358,7 @@ struct entry* load_and_sort_directory(char *dirname, int dirfilter,
|
||||||
return dircache;
|
return dircache;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int showdir(char *path, int start)
|
static int showdir(char *path, int start, int *dirfilter)
|
||||||
{
|
{
|
||||||
int icon_type = 0;
|
int icon_type = 0;
|
||||||
int i;
|
int i;
|
||||||
|
@ -383,7 +378,7 @@ static int showdir(char *path, int start)
|
||||||
|
|
||||||
/* new dir? cache it */
|
/* new dir? cache it */
|
||||||
if (strncmp(path,lastdir,sizeof(lastdir)) || reload_dir) {
|
if (strncmp(path,lastdir,sizeof(lastdir)) || reload_dir) {
|
||||||
if (!load_and_sort_directory(path, global_settings.dirfilter,
|
if (!load_and_sort_directory(path, dirfilter,
|
||||||
&filesindir, &dir_buffer_full))
|
&filesindir, &dir_buffer_full))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
@ -534,7 +529,7 @@ static int showdir(char *path, int start)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
showfileline(i-start, i, false); /* no scroll */
|
showfileline(i-start, i, false, dirfilter); /* no scroll */
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
|
@ -606,7 +601,7 @@ void resume_directory(char *dir)
|
||||||
{
|
{
|
||||||
bool buffer_full;
|
bool buffer_full;
|
||||||
|
|
||||||
if (!load_and_sort_directory(dir, global_settings.dirfilter, &filesindir,
|
if (!load_and_sort_directory(dir, &global_settings.dirfilter, &filesindir,
|
||||||
&buffer_full))
|
&buffer_full))
|
||||||
return;
|
return;
|
||||||
lastdir[0] = 0;
|
lastdir[0] = 0;
|
||||||
|
@ -704,7 +699,7 @@ void set_current_file(char *path)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool handle_on(int* ds, int* dc, int numentries, int tree_max_on_screen)
|
static bool handle_on(int *ds, int *dc, int numentries, int tree_max_on_screen, int *dirfilter)
|
||||||
{
|
{
|
||||||
bool exit = false;
|
bool exit = false;
|
||||||
bool used = false;
|
bool used = false;
|
||||||
|
@ -789,7 +784,7 @@ static bool handle_on(int* ds, int* dc, int numentries, int tree_max_on_screen)
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
int xpos,ypos;
|
int xpos,ypos;
|
||||||
#endif
|
#endif
|
||||||
showdir(currdir, dirstart);
|
showdir(currdir, dirstart, dirfilter);
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
if (global_settings.invert_cursor) {
|
if (global_settings.invert_cursor) {
|
||||||
xpos = lcd_getxmargin();
|
xpos = lcd_getxmargin();
|
||||||
|
@ -808,7 +803,7 @@ static bool handle_on(int* ds, int* dc, int numentries, int tree_max_on_screen)
|
||||||
return used;
|
return used;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool dirbrowse(char *root)
|
static bool dirbrowse(char *root, int *dirfilter)
|
||||||
{
|
{
|
||||||
int numentries=0;
|
int numentries=0;
|
||||||
char buf[MAX_PATH];
|
char buf[MAX_PATH];
|
||||||
|
@ -817,11 +812,11 @@ static bool dirbrowse(char *root)
|
||||||
int button;
|
int button;
|
||||||
int tree_max_on_screen;
|
int tree_max_on_screen;
|
||||||
bool reload_root = false;
|
bool reload_root = false;
|
||||||
int lastfilter = global_settings.dirfilter;
|
int lastfilter = *dirfilter;
|
||||||
bool lastsortcase = global_settings.sort_case;
|
bool lastsortcase = global_settings.sort_case;
|
||||||
int lastdircursor=-1;
|
int lastdircursor=-1;
|
||||||
bool need_update = true;
|
bool need_update = true;
|
||||||
|
bool exit_func = false;
|
||||||
bool update_all = false; /* set this to true when the whole file list
|
bool update_all = false; /* set this to true when the whole file list
|
||||||
has been refreshed on screen */
|
has been refreshed on screen */
|
||||||
|
|
||||||
|
@ -839,9 +834,10 @@ static bool dirbrowse(char *root)
|
||||||
|
|
||||||
memcpy(currdir,root,sizeof(currdir));
|
memcpy(currdir,root,sizeof(currdir));
|
||||||
|
|
||||||
|
if (*dirfilter < NUM_FILTER_MODES)
|
||||||
start_resume(true);
|
start_resume(true);
|
||||||
|
|
||||||
numentries = showdir(currdir, dirstart);
|
numentries = showdir(currdir, dirstart, dirfilter);
|
||||||
if (numentries == -1)
|
if (numentries == -1)
|
||||||
return false; /* currdir is not a directory */
|
return false; /* currdir is not a directory */
|
||||||
update_all = true;
|
update_all = true;
|
||||||
|
@ -899,6 +895,8 @@ static bool dirbrowse(char *root)
|
||||||
|
|
||||||
restore = true;
|
restore = true;
|
||||||
}
|
}
|
||||||
|
if (*dirfilter > NUM_FILTER_MODES)
|
||||||
|
exit_func = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef HAVE_RECORDER_KEYPAD
|
#ifdef HAVE_RECORDER_KEYPAD
|
||||||
|
@ -1083,6 +1081,8 @@ static bool dirbrowse(char *root)
|
||||||
tree_max_on_screen = (LCD_HEIGHT - MARGIN_Y) / fh;
|
tree_max_on_screen = (LCD_HEIGHT - MARGIN_Y) / fh;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
else if (*dirfilter > NUM_FILTER_MODES)
|
||||||
|
exit_func = true;
|
||||||
}
|
}
|
||||||
restore = true;
|
restore = true;
|
||||||
break;
|
break;
|
||||||
|
@ -1099,7 +1099,7 @@ static bool dirbrowse(char *root)
|
||||||
else {
|
else {
|
||||||
if (dirstart) {
|
if (dirstart) {
|
||||||
dirstart--;
|
dirstart--;
|
||||||
numentries = showdir(currdir, dirstart);
|
numentries = showdir(currdir, dirstart, dirfilter);
|
||||||
update_all=true;
|
update_all=true;
|
||||||
put_cursorxy(CURSOR_X, CURSOR_Y + dircursor, true);
|
put_cursorxy(CURSOR_X, CURSOR_Y + dircursor, true);
|
||||||
}
|
}
|
||||||
|
@ -1114,7 +1114,7 @@ static bool dirbrowse(char *root)
|
||||||
else {
|
else {
|
||||||
dirstart = numentries - tree_max_on_screen;
|
dirstart = numentries - tree_max_on_screen;
|
||||||
dircursor = tree_max_on_screen - 1;
|
dircursor = tree_max_on_screen - 1;
|
||||||
numentries = showdir(currdir, dirstart);
|
numentries = showdir(currdir, dirstart, dirfilter);
|
||||||
update_all = true;
|
update_all = true;
|
||||||
put_cursorxy(CURSOR_X, CURSOR_Y +
|
put_cursorxy(CURSOR_X, CURSOR_Y +
|
||||||
tree_max_on_screen - 1, true);
|
tree_max_on_screen - 1, true);
|
||||||
|
@ -1138,7 +1138,7 @@ static bool dirbrowse(char *root)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
dirstart++;
|
dirstart++;
|
||||||
numentries = showdir(currdir, dirstart);
|
numentries = showdir(currdir, dirstart, dirfilter);
|
||||||
update_all = true;
|
update_all = true;
|
||||||
put_cursorxy(CURSOR_X, CURSOR_Y + dircursor, true);
|
put_cursorxy(CURSOR_X, CURSOR_Y + dircursor, true);
|
||||||
}
|
}
|
||||||
|
@ -1151,7 +1151,7 @@ static bool dirbrowse(char *root)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
dirstart = dircursor = 0;
|
dirstart = dircursor = 0;
|
||||||
numentries = showdir(currdir, dirstart);
|
numentries = showdir(currdir, dirstart, dirfilter);
|
||||||
update_all=true;
|
update_all=true;
|
||||||
put_cursorxy(CURSOR_X, CURSOR_Y + dircursor, true);
|
put_cursorxy(CURSOR_X, CURSOR_Y + dircursor, true);
|
||||||
}
|
}
|
||||||
|
@ -1169,7 +1169,7 @@ static bool dirbrowse(char *root)
|
||||||
|
|
||||||
case BUTTON_ON:
|
case BUTTON_ON:
|
||||||
if (handle_on(&dirstart, &dircursor, numentries,
|
if (handle_on(&dirstart, &dircursor, numentries,
|
||||||
tree_max_on_screen))
|
tree_max_on_screen, dirfilter))
|
||||||
{
|
{
|
||||||
/* start scroll */
|
/* start scroll */
|
||||||
restore = true;
|
restore = true;
|
||||||
|
@ -1228,7 +1228,7 @@ static bool dirbrowse(char *root)
|
||||||
|
|
||||||
/* do we need to rescan dir? */
|
/* do we need to rescan dir? */
|
||||||
if (reload_dir || reload_root ||
|
if (reload_dir || reload_root ||
|
||||||
lastfilter != global_settings.dirfilter ||
|
lastfilter != *dirfilter ||
|
||||||
lastsortcase != global_settings.sort_case)
|
lastsortcase != global_settings.sort_case)
|
||||||
{
|
{
|
||||||
if ( reload_root ) {
|
if ( reload_root ) {
|
||||||
|
@ -1242,11 +1242,15 @@ static bool dirbrowse(char *root)
|
||||||
dirstart = 0;
|
dirstart = 0;
|
||||||
lastdir[0] = 0;
|
lastdir[0] = 0;
|
||||||
}
|
}
|
||||||
lastfilter = global_settings.dirfilter;
|
|
||||||
|
lastfilter = *dirfilter;
|
||||||
lastsortcase = global_settings.sort_case;
|
lastsortcase = global_settings.sort_case;
|
||||||
restore = true;
|
restore = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (exit_func)
|
||||||
|
break;
|
||||||
|
|
||||||
if (restore || reload_dir) {
|
if (restore || reload_dir) {
|
||||||
/* restore display */
|
/* restore display */
|
||||||
|
|
||||||
|
@ -1262,7 +1266,7 @@ static bool dirbrowse(char *root)
|
||||||
icon */
|
icon */
|
||||||
lcd_setfont(FONT_UI);
|
lcd_setfont(FONT_UI);
|
||||||
#endif
|
#endif
|
||||||
numentries = showdir(currdir, dirstart);
|
numentries = showdir(currdir, dirstart, dirfilter);
|
||||||
update_all = true;
|
update_all = true;
|
||||||
put_cursorxy(CURSOR_X, CURSOR_Y + dircursor, true);
|
put_cursorxy(CURSOR_X, CURSOR_Y + dircursor, true);
|
||||||
|
|
||||||
|
@ -1280,12 +1284,12 @@ static bool dirbrowse(char *root)
|
||||||
/* So if lastdircursor and dircursor differ, and then full
|
/* So if lastdircursor and dircursor differ, and then full
|
||||||
screen was not refreshed, restore the previous line */
|
screen was not refreshed, restore the previous line */
|
||||||
if ((lastdircursor != dircursor) && !update_all ) {
|
if ((lastdircursor != dircursor) && !update_all ) {
|
||||||
showfileline(lastdircursor, lasti, false); /* no scroll */
|
showfileline(lastdircursor, lasti, false, dirfilter); /* no scroll */
|
||||||
}
|
}
|
||||||
lasti=i;
|
lasti=i;
|
||||||
lastdircursor=dircursor;
|
lastdircursor=dircursor;
|
||||||
|
|
||||||
showfileline(dircursor, i, true); /* scroll please */
|
showfileline(dircursor, i, true, dirfilter); /* scroll please */
|
||||||
need_update = true;
|
need_update = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1402,6 +1406,29 @@ bool create_playlist(void)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool rockbox_browse(char *root, int dirfilter)
|
||||||
|
{
|
||||||
|
bool rc;
|
||||||
|
int dircursor_save = dircursor;
|
||||||
|
int dirstart_save = dirstart;
|
||||||
|
int dirlevel_save = dirlevel;
|
||||||
|
int dirpos_save = dirpos[0];
|
||||||
|
int cursorpos_save = cursorpos[0];
|
||||||
|
|
||||||
|
memcpy(currdir_save, currdir, sizeof(currdir));
|
||||||
|
rc = dirbrowse(root, &dirfilter);
|
||||||
|
memcpy(currdir, currdir_save, sizeof(currdir));
|
||||||
|
|
||||||
|
reload_dir = true;
|
||||||
|
dirstart = dirstart_save;
|
||||||
|
cursorpos[0] = cursorpos_save;
|
||||||
|
dirlevel = dirlevel_save;
|
||||||
|
dircursor = dircursor_save;
|
||||||
|
dirpos[0] = dirpos_save;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void tree_init(void)
|
void tree_init(void)
|
||||||
{
|
{
|
||||||
/* We copy the settings value in case it is changed by the user. We can't
|
/* We copy the settings value in case it is changed by the user. We can't
|
||||||
|
|
|
@ -42,11 +42,12 @@ struct entry {
|
||||||
void tree_init(void);
|
void tree_init(void);
|
||||||
void browse_root(void);
|
void browse_root(void);
|
||||||
void set_current_file(char *path);
|
void set_current_file(char *path);
|
||||||
|
bool rockbox_browse(char *root, int dirfilter);
|
||||||
bool create_playlist(void);
|
bool create_playlist(void);
|
||||||
void resume_directory(char *dir);
|
void resume_directory(char *dir);
|
||||||
char *getcwd(char *buf, int size);
|
char *getcwd(char *buf, int size);
|
||||||
void reload_directory(void);
|
void reload_directory(void);
|
||||||
struct entry* load_and_sort_directory(char *dirname, int dirfilter,
|
struct entry* load_and_sort_directory(char *dirname, int *dirfilter,
|
||||||
int *num_files, bool *buffer_full);
|
int *num_files, bool *buffer_full);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue