"remote_control: don't use goto.
[kugel-rb.git] / apps / tree.h
blob3b31d02451d18dcea7a05fb990f70e0f8a0610ad
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2002 Daniel Stenberg
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
21 #ifndef _TREE_H_
22 #define _TREE_H_
24 #include <stdbool.h>
25 #include <applimits.h>
26 #include <file.h>
28 struct entry {
29 short attr; /* FAT attributes + file type flags */
30 unsigned long time_write; /* Last write time */
31 char *name;
35 /* browser context for file or db */
36 struct tree_context {
37 /* The directory we are browsing */
38 char currdir[MAX_PATH];
39 /* the number of directories we have crossed from / */
40 int dirlevel;
41 /* The currently selected file/id3dbitem index (old dircursor+dirfile) */
42 int selected_item;
43 /* The selected item in each directory crossed
44 * (used when we want to return back to a previouws directory)*/
45 int selected_item_history[MAX_DIR_LEVELS];
47 int firstpos; /* which dir entry is on first
48 position in dir buffer */
49 int pos_history[MAX_DIR_LEVELS];
51 int *dirfilter; /* file use */
52 int filesindir; /* The number of files in the dircache */
53 int dirsindir; /* file use */
54 int dirlength; /* total number of entries in dir, incl. those not loaded */
55 #ifdef HAVE_TAGCACHE
56 int table_history[MAX_DIR_LEVELS]; /* db use */
57 int extra_history[MAX_DIR_LEVELS]; /* db use */
58 int currtable; /* db use */
59 int currextra; /* db use */
60 #endif
61 /* A big buffer with plenty of entry structs,
62 * contains all files and dirs in the current
63 * dir (with filters applied) */
64 void* dircache;
65 int dircache_size;
66 char* name_buffer;
67 int name_buffer_size;
68 int dentry_size;
69 bool dirfull;
70 int sort_dir; /* directory sort order */
73 void tree_drawlists(void);
74 void tree_mem_init(void);
75 void tree_gui_init(void);
76 void get_current_file(char* buffer, int buffer_len);
77 void set_dirfilter(int l_dirfilter);
78 void set_current_file(char *path);
79 int rockbox_browse(const char *root, int dirfilter);
80 bool create_playlist(void);
81 void resume_directory(const char *dir);
82 char *getcwd(char *buf, int size);
83 void reload_directory(void);
84 bool check_rockboxdir(void);
85 struct tree_context* tree_get_context(void);
86 void tree_flush(void);
87 void tree_restore(void);
89 bool bookmark_play(char* resume_file, int index, int offset, int seed,
90 char *filename);
92 extern struct gui_synclist tree_lists;
93 #endif