autodetection: convert path to native separators before displaying it.
[Rockbox.git] / apps / tree.h
blobe6742d3c1ab51061560cf064bdb12491d15841bf
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2002 Daniel Stenberg
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
19 #ifndef _TREE_H_
20 #define _TREE_H_
22 #include <stdbool.h>
23 #include <applimits.h>
24 #include <file.h>
26 struct entry {
27 short attr; /* FAT attributes + file type flags */
28 unsigned long time_write; /* Last write time */
29 char *name;
33 /* browser context for file or db */
34 struct tree_context {
35 /* The directory we are browsing */
36 char currdir[MAX_PATH];
37 /* the number of directories we have crossed from / */
38 int dirlevel;
39 /* The currently selected file/id3dbitem index (old dircursor+dirfile) */
40 int selected_item;
41 /* The selected item in each directory crossed
42 * (used when we want to return back to a previouws directory)*/
43 int selected_item_history[MAX_DIR_LEVELS];
45 int firstpos; /* which dir entry is on first
46 position in dir buffer */
47 int pos_history[MAX_DIR_LEVELS];
49 int *dirfilter; /* file use */
50 int filesindir; /* The number of files in the dircache */
51 int dirsindir; /* file use */
52 int dirlength; /* total number of entries in dir, incl. those not loaded */
53 #ifdef HAVE_TAGCACHE
54 int table_history[MAX_DIR_LEVELS]; /* db use */
55 int extra_history[MAX_DIR_LEVELS]; /* db use */
56 int currtable; /* db use */
57 int currextra; /* db use */
58 #endif
59 /* A big buffer with plenty of entry structs,
60 * contains all files and dirs in the current
61 * dir (with filters applied) */
62 void* dircache;
63 int dircache_size;
64 char* name_buffer;
65 int name_buffer_size;
66 int dentry_size;
67 bool dirfull;
70 void tree_mem_init(void);
71 void tree_gui_init(void);
72 void get_current_file(char* buffer, int buffer_len);
73 void set_dirfilter(int l_dirfilter);
74 void set_current_file(char *path);
75 int rockbox_browse(const char *root, int dirfilter);
76 bool create_playlist(void);
77 void resume_directory(const char *dir);
78 char *getcwd(char *buf, int size);
79 void reload_directory(void);
80 bool check_rockboxdir(void);
81 struct tree_context* tree_get_context(void);
82 void tree_flush(void);
83 void tree_restore(void);
85 bool bookmark_play(char* resume_file, int index, int offset, int seed,
86 char *filename);
88 extern struct gui_synclist tree_lists;
89 extern struct gui_syncstatusbar statusbars;
90 #endif