Now you can exit the clock plugin again
[kugel-rb.git] / apps / settings.h
blobcf53ae736cc995a85a93109976ddf8bbe27b3b08
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2002 by wavey@wavey.org
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 ****************************************************************************/
20 #ifndef __SETTINGS_H__
21 #define __SETTINGS_H__
23 #include <stdbool.h>
24 #include "config.h"
25 #include "file.h"
26 #include "timefuncs.h"
28 #define ROCKBOX_DIR "/.rockbox"
29 #define FONT_DIR "/fonts"
30 #define LANG_DIR "/langs"
31 #define PLUGIN_DIR ROCKBOX_DIR"/rocks"
32 #define REC_BASE_DIR "/recordings"
34 #define MAX_FILENAME 20
36 /* data structures */
38 #define RESUME_OFF 0
39 #define RESUME_ASK 1
40 #define RESUME_ASK_ONCE 2
41 #define RESUME_ON 3
43 #define BOOKMARK_NO 0
44 #define BOOKMARK_YES 1
45 #define BOOKMARK_ASK 2
46 #define BOOKMARK_UNIQUE_ONLY 2
47 #define BOOKMARK_RECENT_ONLY_YES 3
48 #define BOOKMARK_RECENT_ONLY_ASK 4
49 #define FF_REWIND_1000 0
50 #define FF_REWIND_2000 1
51 #define FF_REWIND_3000 2
52 #define FF_REWIND_4000 3
53 #define FF_REWIND_5000 4
54 #define FF_REWIND_6000 5
55 #define FF_REWIND_8000 6
56 #define FF_REWIND_10000 7
57 #define FF_REWIND_15000 8
58 #define FF_REWIND_20000 9
59 #define FF_REWIND_25000 10
60 #define FF_REWIND_30000 11
61 #define FF_REWIND_45000 12
62 #define FF_REWIND_60000 13
65 struct user_settings
67 /* audio settings */
69 int volume; /* audio output volume: 0-100 0=off 100=max */
70 int balance; /* stereo balance: 0-100 0=left 50=bal 100=right */
71 int bass; /* bass eq: 0-100 0=off 100=max */
72 int treble; /* treble eq: 0-100 0=low 100=high */
73 int loudness; /* loudness eq: 0-100 0=off 100=max */
74 int avc; /* auto volume correct: 0=off, 1=20ms, 2=2s 3=4s 4=8s */
75 int channel_config; /* Stereo, Mono, Mono left, Mono right */
76 int mdb_strength; /* 0-127dB */
77 int mdb_harmonics; /* 0-100% */
78 int mdb_center; /* 20-300Hz */
79 int mdb_shape; /* 50-300Hz */
80 bool mdb_enable; /* true/false */
81 bool superbass; /* true/false */
83 int rec_quality; /* 0-7 */
84 int rec_source; /* 0=mic, 1=line, 2=S/PDIF */
85 int rec_frequency; /* 0 = 44.1kHz
86 1 = 48kHz
87 2 = 32kHz
88 3 = 22.05kHz
89 4 = 24kHz
90 5 = 16kHz */
91 int rec_channels; /* 0=Stereo, 1=Mono */
92 int rec_mic_gain; /* 0-15 */
93 int rec_left_gain; /* 0-15 */
94 int rec_right_gain; /* 0-15 */
95 bool rec_editable; /* true means that the bit reservoir is off */
97 /* note: timesplit setting is not saved */
98 int rec_timesplit; /* 0 = off,
99 1 = 00:05, 2 = 00:10, 3 = 00:15, 4 = 00:30
100 5 = 01:00, 6 = 02:00, 7 = 04:00, 8 = 06:00
101 9 = 08:00, 10= 10:00, 11= 12:00, 12= 18:00,
102 13= 24:00 */
104 int rec_prerecord_time; /* In seconds, 0-30, 0 means OFF */
105 int rec_directory; /* 0=base dir, 1=current dir */
107 /* device settings */
109 int contrast; /* lcd contrast: 0-63 0=low 63=high */
110 bool invert; /* invert display */
111 bool invert_cursor; /* invert the current file in dir browser and menu
112 instead of using the default cursor */
113 bool flip_display; /* turn display (and button layout) by 180 degrees */
114 int poweroff; /* power off timer */
115 int backlight_timeout; /* backlight off timeout: 0-18 0=never,
116 1=always,
117 then according to timeout_values[] */
118 bool backlight_on_when_charging;
119 bool discharge; /* maintain charge of at least: false = 85%, true = 10% */
120 bool trickle_charge; /* do trickle charging: 0=off, 1=on */
121 int battery_capacity; /* in mAh */
123 /* resume settings */
125 int resume; /* resume option: 0=off, 1=ask, 2=on */
126 int resume_index; /* index in playlist (-1 for no active resume) */
127 int resume_first_index; /* index of first track in playlist */
128 int resume_offset; /* byte offset in mp3 file */
129 int resume_seed; /* shuffle seed (-1=no resume shuffle 0=sorted
130 >0=shuffled) */
132 unsigned char font_file[MAX_FILENAME+1]; /* last font */
133 unsigned char wps_file[MAX_FILENAME+1]; /* last wps */
134 unsigned char lang_file[MAX_FILENAME+1]; /* last language */
136 /* misc options */
138 int repeat_mode; /* 0=off 1=repeat all 2=repeat one */
139 int dirfilter; /* 0=display all, 1=only supported, 2=only music */
140 bool sort_case; /* dir sort order: 0=case insensitive, 1=sensitive */
141 int volume_type; /* how volume is displayed: 0=graphic, 1=percent */
142 int battery_type; /* how battery is displayed: 0=graphic, 1=percent */
143 int timeformat; /* time format: 0=24 hour clock, 1=12 hour clock */
144 int scroll_speed; /* long texts scrolling speed: 1-30 */
145 bool playlist_shuffle;
146 bool play_selected; /* Plays selected file even in shuffle mode */
147 int ff_rewind_min_step; /* FF/Rewind minimum step size */
148 int ff_rewind_accel; /* FF/Rewind acceleration (in seconds per doubling) */
149 int disk_spindown; /* time until disk spindown, in seconds (0=off) */
150 bool disk_poweroff; /* whether to cut disk power after spindown or not */
151 int buffer_margin; /* MP3 buffer watermark margin, in seconds */
153 int peak_meter_release; /* units per read out */
154 int peak_meter_hold; /* hold time for peak meter in 1/100 s */
155 int peak_meter_clip_hold; /* hold time for clips */
156 bool peak_meter_dbfs; /* show linear or dbfs values */
157 bool peak_meter_performance; /* true: high performance, else save energy*/
158 int peak_meter_min; /* range minimum */
159 int peak_meter_max; /* range maximum */
160 bool car_adapter_mode; /* 0=off 1=on */
162 /* show status bar */
163 bool statusbar; /* 0=hide, 1=show */
165 /* show button bar */
166 bool buttonbar; /* 0=hide, 1=show */
168 /* show scroll bar */
169 bool scrollbar; /* 0=hide, 1=show */
171 /* goto current song when exiting WPS */
172 bool browse_current; /* 1=goto current song,
173 0=goto previous location */
175 int runtime; /* current runtime since last charge */
176 int topruntime; /* top known runtime */
178 int bidir_limit; /* bidir scroll length limit */
179 int scroll_delay; /* delay (in 1/10s) before starting scroll */
180 int scroll_step; /* pixels to advance per update */
182 /* auto bookmark settings */
183 int autoloadbookmark; /* auto load option: 0=off, 1=ask, 2=on */
184 int autocreatebookmark; /* auto create option: 0=off, 1=ask, 2=on */
185 int usemrb; /* use MRB list: 0=No, 1=Yes*/
186 #ifdef HAVE_LCD_CHARCELLS
187 int jump_scroll; /* Fast jump when scrolling */
188 int jump_scroll_delay; /* Delay between jump scroll screens */
189 #endif
190 bool fade_on_stop; /* fade on pause/unpause/stop */
191 bool caption_backlight; /* turn on backlight at end and start of track */
193 #ifdef HAVE_FMRADIO
194 int fm_freq_step; /* Frequency step for manual tuning, in kHz */
195 bool fm_force_mono; /* Forces Mono mode if true */
196 bool fm_full_range; /* Enables full 10MHz-160MHz range if true, else
197 only 88MHz-108MHz */
198 int last_frequency; /* Last frequency for resuming, in FREQ_STEP units,
199 relative to MIN_FREQ */
200 #endif
202 int max_files_in_dir; /* Max entries in directory (file browser) */
203 int max_files_in_playlist; /* Max entries in playlist */
204 bool show_icons; /* 0=hide 1=show */
205 int recursive_dir_insert; /* should directories be inserted recursively */
207 bool line_in; /* false=off, true=active */
209 /* playlist viewer settings */
210 bool playlist_viewer_icons; /* display icons on viewer */
211 bool playlist_viewer_indices; /* display playlist indices on viewer */
212 int playlist_viewer_track_display; /* how to display tracks in viewer */
214 /* voice UI settings */
215 bool talk_menu; /* enable voice UI */
216 int talk_dir; /* talkbox mode: 0=off 1=number 2=clip@enter 3=clip@hover */
217 int talk_file; /* voice filename mode: 0=off, 1=number, other t.b.d. */
219 /* file browser sorting */
220 int sort_file; /* 0=alpha, 1=date, 2=date (new first), 3=type */
221 int sort_dir; /* 0=alpha, 1=date (old first), 2=date (new first) */
224 enum optiontype { INT, BOOL };
226 struct opt_items {
227 char* string;
228 int voice_id;
231 /* prototypes */
233 int settings_save(void);
234 void settings_load(int which);
235 void settings_reset(void);
236 void sound_settings_apply(void);
237 void settings_apply(void);
238 void settings_apply_pm_range(void);
239 void settings_display(void);
241 bool settings_load_config(char* file);
242 bool settings_save_config(void);
243 bool set_bool_options(char* string, bool* variable,
244 char* yes_str, int yes_voice,
245 char* no_str, int no_voice,
246 void (*function)(bool));
248 bool set_bool(char* string, bool* variable );
249 bool set_option(char* string, void* variable, enum optiontype type,
250 struct opt_items* options, int numoptions, void (*function)(int));
251 bool set_int(char* string, char* unit, int voice_unit, int* variable,
252 void (*function)(int), int step, int min, int max );
253 bool set_time_screen(char* string, struct tm *tm);
254 int read_line(int fd, char* buffer, int buffer_size);
255 void set_file(char* filename, char* setting, int maxlen);
257 #ifdef HAVE_MAS3587F
258 unsigned int rec_timesplit_seconds(void);
259 #endif
261 /* global settings */
262 extern struct user_settings global_settings;
263 /* name of directory where configuration, fonts and other data
264 * files are stored */
265 extern long lasttime;
267 /* Recording base directory */
268 extern char rec_base_directory[];
270 /* system defines */
272 #ifdef HAVE_LCD_CHARCELLS
273 #define MAX_CONTRAST_SETTING 31
274 #define DEFAULT_CONTRAST_SETTING 30
275 #else
276 #define MAX_CONTRAST_SETTING 63
277 #define DEFAULT_CONTRAST_SETTING 38
278 #endif
279 #define MIN_CONTRAST_SETTING 5
281 /* argument bits for settings_load() */
282 #define SETTINGS_RTC 1 /* only the settings from the RTC nonvolatile RAM */
283 #define SETTINGS_HD 2 /* only the settings fron the disk sector */
284 #define SETTINGS_ALL 3 /* both */
286 /* repeat mode options */
287 enum { REPEAT_OFF, REPEAT_ALL, REPEAT_ONE, NUM_REPEAT_MODES };
289 /* dir filter options */
290 /* Note: Any new filter modes need to be added before NUM_FILTER_MODES.
291 * Any new rockbox browse filter modes (accessible through the menu)
292 * must be added after NUM_FILTER_MODES. */
293 enum { SHOW_ALL, SHOW_SUPPORTED, SHOW_MUSIC, SHOW_PLAYLIST, NUM_FILTER_MODES,
294 SHOW_WPS, SHOW_CFG, SHOW_LNG, SHOW_MOD, SHOW_FONT, SHOW_PLUGINS};
296 /* recursive dir insert options */
297 enum { RECURSE_OFF, RECURSE_ON, RECURSE_ASK };
299 #endif /* __SETTINGS_H__ */