X5: Assembler optimised remote LCD update. Speedup: 3 times @11MHz, 3.3 times @45MHz...
[Rockbox.git] / apps / tree.h
blobffe6d478c6e43eab7823d3831494a6807148c1b0
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;
32 struct filetype {
33 char* extension;
34 int tree_attr;
35 int icon;
36 int voiceclip;
39 /* browser context for file or db */
40 struct tree_context {
41 /* The directory we are browsing */
42 char currdir[MAX_PATH];
43 /* the number of directories we have crossed from / */
44 int dirlevel;
45 /* The currently selected file/id3dbitem index (old dircursor+dirfile) */
46 int selected_item;
47 /* The selected item in each directory crossed
48 * (used when we want to return back to a previouws directory)*/
49 int selected_item_history[MAX_DIR_LEVELS];
51 int firstpos; /* which dir entry is on first
52 position in dir buffer */
53 int pos_history[MAX_DIR_LEVELS];
54 int dirpos[MAX_DIR_LEVELS]; /* the dirstart history */
55 int cursorpos[MAX_DIR_LEVELS]; /* the dircursor history */
57 int *dirfilter; /* file use */
58 int filesindir; /* The number of files in the dircache */
59 int dirsindir; /* file use */
60 int dirlength; /* total number of entries in dir, incl. those not loaded */
61 int table_history[MAX_DIR_LEVELS]; /* db use */
62 int extra_history[MAX_DIR_LEVELS]; /* db use */
63 int currtable; /* db use */
64 int currextra; /* db use */
65 int currextra2; /* db use */
66 /* A big buffer with plenty of entry structs,
67 * contains all files and dirs in the current
68 * dir (with filters applied) */
69 void* dircache;
70 int dircache_size;
71 char* name_buffer;
72 int name_buffer_size;
73 int dentry_size;
74 bool dirfull;
77 /* using attribute bits not used by FAT (FAT uses lower 7) */
79 #define TREE_ATTR_THUMBNAIL 0x0080 /* corresponding .talk file exists */
81 /* (this also reflects the sort order if by type) */
82 #define TREE_ATTR_BMARK 0x0100 /* book mark file */
83 #define TREE_ATTR_M3U 0x0200 /* playlist */
84 #define TREE_ATTR_MPA 0x0300 /* mpeg audio file */
85 #define TREE_ATTR_CFG 0x0400 /* config file */
86 #define TREE_ATTR_WPS 0x0500 /* wps config file */
87 #define TREE_ATTR_FONT 0x0600 /* font file */
88 #define TREE_ATTR_LNG 0x0700 /* binary lang file */
89 #define TREE_ATTR_ROCK 0x0800 /* binary rockbox plugin */
90 #define TREE_ATTR_MOD 0x0900 /* firmware file */
91 #define TREE_ATTR_RWPS 0x1000 /* remote-wps config file */
92 #define TREE_ATTR_BMP 0x1100 /* backdrop bmp file */
93 #define TREE_ATTR_KBD 0x1200 /* keyboard file */
94 #define TREE_ATTR_FMR 0x1300 /* preset file */
95 #define TREE_ATTR_MASK 0xFF00 /* which bits tree.c uses for file types */
97 void tree_get_filetypes(const struct filetype**, int*);
98 void tree_init(void);
99 void browse_root(void);
100 void set_current_file(char *path);
101 bool rockbox_browse(const char *root, int dirfilter);
102 bool create_playlist(void);
103 void resume_directory(const char *dir);
104 char *getcwd(char *buf, int size);
105 void reload_directory(void);
106 bool check_rockboxdir(void);
107 struct tree_context* tree_get_context(void);
108 void tree_flush(void);
109 void tree_restore(void);
112 extern struct gui_synclist tree_lists;
113 extern struct gui_syncstatusbar statusbars;
114 #endif