Moved most actions off of button release events.
[kugel-rb.git] / apps / tree.h
blob4b3406416f8d377bafcfec06bddbc08a89f3bb68
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>
24 #if CONFIG_KEYPAD == RECORDER_PAD
25 #define TREE_NEXT BUTTON_DOWN
26 #define TREE_PREV BUTTON_UP
27 #define TREE_EXIT BUTTON_LEFT
28 #define TREE_ENTER BUTTON_RIGHT
29 #define TREE_RUN BUTTON_PLAY
30 #define TREE_MENU BUTTON_F1
31 #define TREE_SHIFT BUTTON_ON
32 #define TREE_OFF BUTTON_OFF
34 #define TREE_RC_NEXT BUTTON_RC_RIGHT
35 #define TREE_RC_REV BUTTON_RC_LEFT
36 #define TREE_RC_EXIT BUTTON_RC_STOP
37 #define TREE_RC_ENTER BUTTON_RC_PLAY
38 #define TREE_RC_RUN BUTTON_RC_PLAY
40 #elif CONFIG_KEYPAD == PLAYER_PAD
41 #define TREE_NEXT BUTTON_RIGHT
42 #define TREE_PREV BUTTON_LEFT
43 #define TREE_EXIT BUTTON_STOP
44 #define TREE_ENTER BUTTON_PLAY
45 #define TREE_RUN BUTTON_PLAY
46 #define TREE_MENU BUTTON_MENU
47 #define TREE_SHIFT BUTTON_ON
49 #define TREE_RC_NEXT BUTTON_RC_RIGHT
50 #define TREE_RC_REV BUTTON_RC_LEFT
51 #define TREE_RC_EXIT BUTTON_RC_STOP
52 #define TREE_RC_ENTER BUTTON_RC_PLAY
53 #define TREE_RC_RUN BUTTON_RC_PLAY
55 #elif CONFIG_KEYPAD == ONDIO_PAD
56 #define TREE_NEXT BUTTON_DOWN
57 #define TREE_PREV BUTTON_UP
58 #define TREE_EXIT BUTTON_LEFT
59 #define TREE_ENTER BUTTON_RIGHT
60 #define TREE_RUN BUTTON_RIGHT
61 #define TREE_MENU (BUTTON_MENU | BUTTON_REPEAT)
62 #define TREE_SHIFT BUTTON_MENU
64 #endif
66 struct entry {
67 short attr; /* FAT attributes + file type flags */
68 unsigned long time_write; /* Last write time */
69 char *name;
72 struct filetype {
73 char* extension;
74 int tree_attr;
75 int icon;
76 int voiceclip;
80 /* using attribute not used by FAT */
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_MASK 0xFFC0 /* which bits tree.c uses (above) */
93 void tree_get_filetypes(const struct filetype**, int*);
94 void tree_init(void);
95 void browse_root(void);
96 void set_current_file(char *path);
97 bool rockbox_browse(const char *root, int dirfilter);
98 bool create_playlist(void);
99 void resume_directory(const char *dir);
100 char *getcwd(char *buf, int size);
101 void reload_directory(void);
102 struct entry* load_and_sort_directory(const char *dirname, const int *dirfilter,
103 int *num_files, bool *buffer_full);
104 bool check_rockboxdir(void);
106 #endif