summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/settings.c398
-rw-r--r--apps/settings.h234
2 files changed, 320 insertions, 312 deletions
diff --git a/apps/settings.c b/apps/settings.c
index ed104d9b82..b0f016e418 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -22,36 +22,23 @@
22#include <limits.h> 22#include <limits.h>
23#include "inttypes.h" 23#include "inttypes.h"
24#include "config.h" 24#include "config.h"
25#include "kernel.h"
26#include "thread.h"
27#include "action.h" 25#include "action.h"
28#include "crc32.h" 26#include "crc32.h"
29#include "settings.h" 27#include "settings.h"
30#include "disk.h"
31#include "panic.h"
32#include "debug.h" 28#include "debug.h"
33#include "usb.h" 29#include "usb.h"
34#include "backlight.h" 30#include "backlight.h"
35#include "lcd.h"
36#include "audio.h" 31#include "audio.h"
37#include "mp3_playback.h"
38#include "mpeg.h" 32#include "mpeg.h"
39#include "talk.h" 33#include "talk.h"
40#include "string.h" 34#include "string.h"
41#include "ata.h"
42#include "ata_idle_notify.h" 35#include "ata_idle_notify.h"
43#include "fat.h"
44#include "power.h"
45#include "powermgmt.h"
46#include "status.h"
47#include "atoi.h" 36#include "atoi.h"
48#include "screens.h" 37#include "screens.h"
49#include "ctype.h" 38#include "ctype.h"
50#include "file.h" 39#include "file.h"
51#include "errno.h"
52#include "system.h" 40#include "system.h"
53#include "misc.h" 41#include "misc.h"
54#include "timefuncs.h"
55#ifdef HAVE_LCD_BITMAP 42#ifdef HAVE_LCD_BITMAP
56#include "icons.h" 43#include "icons.h"
57#include "font.h" 44#include "font.h"
@@ -62,11 +49,9 @@
62#include "language.h" 49#include "language.h"
63#include "gwps.h" 50#include "gwps.h"
64#include "powermgmt.h" 51#include "powermgmt.h"
65#include "bookmark.h"
66#include "sprintf.h" 52#include "sprintf.h"
67#include "keyboard.h" 53#include "keyboard.h"
68#include "version.h" 54#include "version.h"
69#include "rtc.h"
70#include "sound.h" 55#include "sound.h"
71#include "rbunicode.h" 56#include "rbunicode.h"
72#include "dircache.h" 57#include "dircache.h"
@@ -117,7 +102,7 @@ const char rec_base_directory[] = REC_BASE_DIR;
117 102
118long lasttime = 0; 103long lasttime = 0;
119 104
120/* NVRAM stuff, if the target doesnt have NVRAM it is saved in ROCKBOX_DIR /nvram.bin */ 105/** NVRAM stuff, if the target doesnt have NVRAM it is saved in ROCKBOX_DIR /nvram.bin **/
121/* NVRAM is set out as 106/* NVRAM is set out as
122[0] 'R' 107[0] 'R'
123[1] 'b' 108[1] 'b'
@@ -227,6 +212,139 @@ static bool write_nvram_data(char* buf, int max_len)
227 return true; 212 return true;
228} 213}
229 214
215/** Reading from a config file **/
216/*
217 * load settings from disk or RTC RAM
218 */
219void settings_load(int which)
220{
221 DEBUGF( "reload_all_settings()\n" );
222 if (which&SETTINGS_RTC)
223 read_nvram_data(nvram_buffer,NVRAM_BLOCK_SIZE);
224 if (which&SETTINGS_HD)
225 {
226 settings_load_config(CONFIGFILE,false);
227 settings_load_config(FIXEDSETTINGSFILE,false);
228 }
229}
230
231
232static bool cfg_string_to_int(int setting_id, int* out, char* str)
233{
234 const char* start = settings[setting_id].cfg_vals;
235 char* end = NULL;
236 char temp[MAX_PATH];
237 int count = 0;
238 while (1)
239 {
240 end = strchr(start, ',');
241 if (!end)
242 {
243 if (!strcmp(str, start))
244 {
245 *out = count;
246 return true;
247 }
248 else return false;
249 }
250 strncpy(temp, start, end-start);
251 temp[end-start] = '\0';
252 if (!strcmp(str, temp))
253 {
254 *out = count;
255 return true;
256 }
257 start = end +1;
258 count++;
259 }
260 return false;
261}
262
263bool settings_load_config(const char* file, bool apply)
264{
265 int fd;
266 char line[128];
267 char* name;
268 char* value;
269 int i;
270 fd = open(file, O_RDONLY);
271 if (fd < 0)
272 return false;
273
274 while (read_line(fd, line, sizeof line) > 0)
275 {
276 if (!settings_parseline(line, &name, &value))
277 continue;
278 for(i=0; i<nb_settings; i++)
279 {
280 if (settings[i].cfg_name == NULL)
281 continue;
282 if (!strcasecmp(name,settings[i].cfg_name))
283 {
284 switch (settings[i].flags&F_T_MASK)
285 {
286 case F_T_INT:
287 case F_T_UINT:
288#ifdef HAVE_LCD_COLOR
289 if (settings[i].flags&F_RGB)
290 *(int*)settings[i].setting = hex_to_rgb(value);
291 else
292#endif
293 if (settings[i].cfg_vals == NULL)
294 {
295 *(int*)settings[i].setting = atoi(value);
296 }
297 else
298 {
299 cfg_string_to_int(i,(int*)settings[i].setting,value);
300 }
301 break;
302 case F_T_BOOL:
303 {
304 int temp;
305 if (cfg_string_to_int(i,&temp,value))
306 *(bool*)settings[i].setting = (temp==0?false:true);
307 break;
308 }
309 case F_T_CHARPTR:
310 case F_T_UCHARPTR:
311 {
312 char storage[MAX_PATH];
313 if (settings[i].filename_setting->prefix)
314 {
315 int len = strlen(settings[i].filename_setting->prefix);
316 if (!strncmp(value,settings[i].filename_setting->prefix,len))
317 {
318 strncpy(storage,&value[len],MAX_PATH);
319 }
320 else strncpy(storage,value,MAX_PATH);
321 }
322 else strncpy(storage,value,MAX_PATH);
323 if (settings[i].filename_setting->suffix)
324 {
325 char *s = strcasestr(storage,settings[i].filename_setting->suffix);
326 if (s) *s = '\0';
327 }
328 strncpy((char*)settings[i].setting,storage,
329 settings[i].filename_setting->max_len);
330 ((char*)settings[i].setting)
331 [settings[i].filename_setting->max_len-1] = '\0';
332 break;
333 }
334 }
335 break;
336 } /* if (!strcmp(name,settings[i].cfg_name)) */
337 } /* for(...) */
338 } /* while(...) */
339
340 close(fd);
341 settings_save();
342 if (apply)
343 settings_apply();
344 return true;
345}
346
347/** Writing to a config file and saving settings **/
230#ifdef HAVE_LCD_COLOR 348#ifdef HAVE_LCD_COLOR
231/* 349/*
232 * Helper function to convert a string of 6 hex digits to a native colour 350 * Helper function to convert a string of 6 hex digits to a native colour
@@ -258,7 +376,7 @@ static int hex_to_rgb(const char* hex)
258 376
259 return 0; 377 return 0;
260} 378}
261#endif 379#endif /* HAVE_LCD_COLOR */
262static bool cfg_int_to_string(int setting_id, int val, char* buf) 380static bool cfg_int_to_string(int setting_id, int val, char* buf)
263{ 381{
264 const char* start = settings[setting_id].cfg_vals; 382 const char* start = settings[setting_id].cfg_vals;
@@ -416,9 +534,35 @@ int settings_save( void )
416 } 534 }
417 return 0; 535 return 0;
418} 536}
537bool settings_save_config(void)
538{
539 char filename[MAX_PATH];
540
541 create_numbered_filename(filename, ROCKBOX_DIR, "config", ".cfg", 2
542 IF_CNFN_NUM_(, NULL));
543
544 /* allow user to modify filename */
545 while (true) {
546 if (!kbd_input(filename, sizeof filename)) {
547 break;
548 }
549 else {
550 gui_syncsplash(HZ, true, str(LANG_MENU_SETTING_CANCEL));
551 return false;
552 }
553 }
554
555 if (settings_write_config(filename))
556 gui_syncsplash(HZ, true, str(LANG_SETTINGS_SAVED));
557 else gui_syncsplash(HZ, true, str(LANG_FAILED));
558 return true;
559}
560
561/** Apply and Reset settings **/
562
419 563
420#ifdef HAVE_LCD_BITMAP 564#ifdef HAVE_LCD_BITMAP
421/** 565/*
422 * Applies the range infos stored in global_settings to 566 * Applies the range infos stored in global_settings to
423 * the peak meter. 567 * the peak meter.
424 */ 568 */
@@ -671,189 +815,6 @@ void settings_apply(void)
671#endif 815#endif
672} 816}
673 817
674/*
675 * load settings from disk or RTC RAM
676 */
677void settings_load(int which)
678{
679 DEBUGF( "reload_all_settings()\n" );
680 if (which&SETTINGS_RTC)
681 read_nvram_data(nvram_buffer,NVRAM_BLOCK_SIZE);
682 if (which&SETTINGS_HD)
683 {
684 settings_load_config(CONFIGFILE,false);
685 settings_load_config(FIXEDSETTINGSFILE,false);
686 }
687}
688
689void set_file(char* filename, char* setting, int maxlen)
690{
691 char* fptr = strrchr(filename,'/');
692 int len;
693 int extlen = 0;
694 char* ptr;
695
696 if (!fptr)
697 return;
698
699 *fptr = 0;
700 fptr++;
701
702 len = strlen(fptr);
703 ptr = fptr + len;
704 while ((*ptr != '.') && (ptr != fptr)) {
705 extlen++;
706 ptr--;
707 }
708 if(ptr == fptr) extlen = 0;
709
710 if (strncasecmp(ROCKBOX_DIR, filename ,strlen(ROCKBOX_DIR)) ||
711 (len-extlen > maxlen))
712 return;
713
714 strncpy(setting, fptr, len-extlen);
715 setting[len-extlen]=0;
716
717 settings_save();
718}
719static bool cfg_string_to_int(int setting_id, int* out, char* str)
720{
721 const char* start = settings[setting_id].cfg_vals;
722 char* end = NULL;
723 char temp[MAX_PATH];
724 int count = 0;
725 while (1)
726 {
727 end = strchr(start, ',');
728 if (!end)
729 {
730 if (!strcmp(str, start))
731 {
732 *out = count;
733 return true;
734 }
735 else return false;
736 }
737 strncpy(temp, start, end-start);
738 temp[end-start] = '\0';
739 if (!strcmp(str, temp))
740 {
741 *out = count;
742 return true;
743 }
744 start = end +1;
745 count++;
746 }
747 return false;
748}
749
750bool settings_load_config(const char* file, bool apply)
751{
752 int fd;
753 char line[128];
754 char* name;
755 char* value;
756 int i;
757 fd = open(file, O_RDONLY);
758 if (fd < 0)
759 return false;
760
761 while (read_line(fd, line, sizeof line) > 0)
762 {
763 if (!settings_parseline(line, &name, &value))
764 continue;
765 for(i=0; i<nb_settings; i++)
766 {
767 if (settings[i].cfg_name == NULL)
768 continue;
769 if (!strcasecmp(name,settings[i].cfg_name))
770 {
771 switch (settings[i].flags&F_T_MASK)
772 {
773 case F_T_INT:
774 case F_T_UINT:
775#ifdef HAVE_LCD_COLOR
776 if (settings[i].flags&F_RGB)
777 *(int*)settings[i].setting = hex_to_rgb(value);
778 else
779#endif
780 if (settings[i].cfg_vals == NULL)
781 {
782 *(int*)settings[i].setting = atoi(value);
783 }
784 else
785 {
786 cfg_string_to_int(i,(int*)settings[i].setting,value);
787 }
788 break;
789 case F_T_BOOL:
790 {
791 int temp;
792 if (cfg_string_to_int(i,&temp,value))
793 *(bool*)settings[i].setting = (temp==0?false:true);
794 break;
795 }
796 case F_T_CHARPTR:
797 case F_T_UCHARPTR:
798 {
799 char storage[MAX_PATH];
800 if (settings[i].filename_setting->prefix)
801 {
802 int len = strlen(settings[i].filename_setting->prefix);
803 if (!strncmp(value,settings[i].filename_setting->prefix,len))
804 {
805 strncpy(storage,&value[len],MAX_PATH);
806 }
807 else strncpy(storage,value,MAX_PATH);
808 }
809 else strncpy(storage,value,MAX_PATH);
810 if (settings[i].filename_setting->suffix)
811 {
812 char *s = strcasestr(storage,settings[i].filename_setting->suffix);
813 if (s) *s = '\0';
814 }
815 strncpy((char*)settings[i].setting,storage,
816 settings[i].filename_setting->max_len);
817 ((char*)settings[i].setting)
818 [settings[i].filename_setting->max_len-1] = '\0';
819 break;
820 }
821 }
822 break;
823 } /* if (!strcmp(name,settings[i].cfg_name)) */
824 } /* for(...) */
825 } /* while(...) */
826
827 close(fd);
828 settings_save();
829 if (apply)
830 settings_apply();
831 return true;
832}
833
834bool settings_save_config(void)
835{
836 char filename[MAX_PATH];
837
838 create_numbered_filename(filename, ROCKBOX_DIR, "config", ".cfg", 2
839 IF_CNFN_NUM_(, NULL));
840
841 /* allow user to modify filename */
842 while (true) {
843 if (!kbd_input(filename, sizeof filename)) {
844 break;
845 }
846 else {
847 gui_syncsplash(HZ, true, str(LANG_MENU_SETTING_CANCEL));
848 return false;
849 }
850 }
851
852 if (settings_write_config(filename))
853 gui_syncsplash(HZ, true, str(LANG_SETTINGS_SAVED));
854 else gui_syncsplash(HZ, true, str(LANG_FAILED));
855 return true;
856}
857 818
858 819
859 820
@@ -893,6 +854,8 @@ void settings_reset(void) {
893#endif 854#endif
894} 855}
895 856
857/** Changing setting values **/
858
896bool set_bool(const char* string, bool* variable ) 859bool set_bool(const char* string, bool* variable )
897{ 860{
898 return set_bool_options(string, variable, 861 return set_bool_options(string, variable,
@@ -1114,6 +1077,39 @@ bool set_option(const char* string, void* variable, enum optiontype type,
1114 selected, &data,function); 1077 selected, &data,function);
1115} 1078}
1116 1079
1080/** extra stuff which is probably misplaced **/
1081
1082void set_file(char* filename, char* setting, int maxlen)
1083{
1084 char* fptr = strrchr(filename,'/');
1085 int len;
1086 int extlen = 0;
1087 char* ptr;
1088
1089 if (!fptr)
1090 return;
1091
1092 *fptr = 0;
1093 fptr++;
1094
1095 len = strlen(fptr);
1096 ptr = fptr + len;
1097 while ((*ptr != '.') && (ptr != fptr)) {
1098 extlen++;
1099 ptr--;
1100 }
1101 if(ptr == fptr) extlen = 0;
1102
1103 if (strncasecmp(ROCKBOX_DIR, filename ,strlen(ROCKBOX_DIR)) ||
1104 (len-extlen > maxlen))
1105 return;
1106
1107 strncpy(setting, fptr, len-extlen);
1108 setting[len-extlen]=0;
1109
1110 settings_save();
1111}
1112
1117#ifdef HAVE_RECORDING 1113#ifdef HAVE_RECORDING
1118/* This array holds the record timer interval lengths, in seconds */ 1114/* This array holds the record timer interval lengths, in seconds */
1119static const unsigned long rec_timer_seconds[] = 1115static const unsigned long rec_timer_seconds[] =
diff --git a/apps/settings.h b/apps/settings.h
index 7d30dfa5d7..7b7f91abe0 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -37,6 +37,10 @@
37#include "backlight.h" /* for [MIN|MAX]_BRIGHTNESS_SETTING */ 37#include "backlight.h" /* for [MIN|MAX]_BRIGHTNESS_SETTING */
38#endif 38#endif
39 39
40/** Setting values defines **/
41
42/* name of directory where configuration, fonts and other data
43 * files are stored */
40#ifdef __PCTOOL__ 44#ifdef __PCTOOL__
41#define ROCKBOX_DIR "." 45#define ROCKBOX_DIR "."
42#define ROCKBOX_DIR_LEN 1 46#define ROCKBOX_DIR_LEN 1
@@ -61,7 +65,6 @@
61 65
62#define MAX_FILENAME 20 66#define MAX_FILENAME 20
63 67
64/* data structures */
65 68
66#define BOOKMARK_NO 0 69#define BOOKMARK_NO 0
67#define BOOKMARK_YES 1 70#define BOOKMARK_YES 1
@@ -100,6 +103,69 @@ extern const char * const trig_durations[TRIG_DURATION_COUNT];
100#define FOLDER_ADVANCE_NEXT 1 103#define FOLDER_ADVANCE_NEXT 1
101#define FOLDER_ADVANCE_RANDOM 2 104#define FOLDER_ADVANCE_RANDOM 2
102 105
106/* system defines */
107#ifndef TARGET_TREE
108
109#ifndef HAVE_LCD_COLOR
110#define DEFAULT_CONTRAST_SETTING 40
111#endif
112
113#if defined HAVE_LCD_CHARCELLS
114#define MIN_CONTRAST_SETTING 5
115#define MAX_CONTRAST_SETTING 31
116#else
117#define MIN_CONTRAST_SETTING 5
118#define MAX_CONTRAST_SETTING 63
119#endif
120
121/* As it was */
122#ifdef HAVE_REMOTE_LCD
123#ifndef DEFAULT_REMOTE_CONTRAST_SETTING
124/* May be defined in config file if driver code needs the value */
125#define DEFAULT_REMOTE_CONTRAST_SETTING 42
126#endif
127#define MIN_REMOTE_CONTRAST_SETTING MIN_CONTRAST_SETTING
128#define MAX_REMOTE_CONTRAST_SETTING MAX_CONTRAST_SETTING
129#endif
130
131#endif /* !TARGET_TREE */
132
133#if !defined(HAVE_LCD_COLOR)
134#define HAVE_LCD_CONTRAST
135#endif
136
137/* repeat mode options */
138enum
139{
140 REPEAT_OFF,
141 REPEAT_ALL,
142 REPEAT_ONE,
143 REPEAT_SHUFFLE,
144#if (AB_REPEAT_ENABLE == 1)
145 REPEAT_AB,
146#endif
147 NUM_REPEAT_MODES
148};
149
150/* dir filter options */
151/* Note: Any new filter modes need to be added before NUM_FILTER_MODES.
152 * Any new rockbox browse filter modes (accessible through the menu)
153 * must be added after NUM_FILTER_MODES. */
154enum { SHOW_ALL, SHOW_SUPPORTED, SHOW_MUSIC, SHOW_PLAYLIST, SHOW_ID3DB,
155 NUM_FILTER_MODES,
156 SHOW_WPS, SHOW_RWPS, SHOW_FMR, SHOW_CFG, SHOW_LNG, SHOW_MOD, SHOW_FONT, SHOW_PLUGINS};
157
158/* recursive dir insert options */
159enum { RECURSE_OFF, RECURSE_ON, RECURSE_ASK };
160
161/* replaygain types */
162enum { REPLAYGAIN_TRACK = 0, REPLAYGAIN_ALBUM, REPLAYGAIN_SHUFFLE };
163
164/* show path types */
165enum { SHOW_PATH_OFF = 0, SHOW_PATH_CURRENT, SHOW_PATH_FULL };
166
167
168/** virtual pointer stuff.. move to another .h maybe? **/
103/* These define "virtual pointers", which could either be a literal string, 169/* These define "virtual pointers", which could either be a literal string,
104 or a mean a string ID if the pointer is in a certain range. 170 or a mean a string ID if the pointer is in a certain range.
105 This helps to save space for menus and options. */ 171 This helps to save space for menus and options. */
@@ -126,9 +192,58 @@ extern unsigned char vp_dummy[VIRT_SIZE];
126/* !defined(HAVE_LCD_COLOR) implies HAVE_LCD_CONTRAST with default 40. 192/* !defined(HAVE_LCD_COLOR) implies HAVE_LCD_CONTRAST with default 40.
127 Explicitly define HAVE_LCD_CONTRAST in config file for newer ports for 193 Explicitly define HAVE_LCD_CONTRAST in config file for newer ports for
128 simplicity. */ 194 simplicity. */
129#if !defined(HAVE_LCD_COLOR) 195
130#define HAVE_LCD_CONTRAST 196
131#endif 197
198/** function prototypes **/
199
200/* argument bits for settings_load() */
201#define SETTINGS_RTC 1 /* only the settings from the RTC nonvolatile RAM */
202#define SETTINGS_HD 2 /* only the settings from the disk sector */
203#define SETTINGS_ALL 3 /* both */
204void settings_load(int which);
205bool settings_load_config(const char* file, bool apply);
206
207void status_save( void );
208int settings_save(void);
209bool settings_save_config(void);
210
211void settings_reset(void);
212void sound_settings_apply(void);
213void settings_apply(void);
214void settings_apply_pm_range(void);
215void settings_display(void);
216
217enum optiontype { INT, BOOL };
218
219struct opt_items {
220 unsigned const char* string;
221 long voice_id;
222};
223bool set_bool_options(const char* string, bool* variable,
224 const char* yes_str, int yes_voice,
225 const char* no_str, int no_voice,
226 void (*function)(bool));
227
228bool set_bool(const char* string, bool* variable );
229bool set_option(const char* string, void* variable, enum optiontype type,
230 const struct opt_items* options, int numoptions, void (*function)(int));
231bool set_int(const unsigned char* string, const char* unit, int voice_unit,
232 int* variable,
233 void (*function)(int), int step, int min, int max,
234 void (*formatter)(char*, int, int, const char*) );
235
236/* the following are either not in setting.c or shouldnt be */
237bool set_time_screen(const char* string, struct tm *tm);
238int read_line(int fd, char* buffer, int buffer_size);
239void set_file(char* filename, char* setting, int maxlen);
240unsigned int rec_timesplit_seconds(void);
241unsigned long rec_sizesplit_bytes(void);
242void settings_apply_trigger(void);
243
244
245/** global_settings and global_status struct definitions **/
246
132struct system_status 247struct system_status
133{ 248{
134 int resume_index; /* index in playlist (-1 for no active resume) */ 249 int resume_index; /* index in playlist (-1 for no active resume) */
@@ -547,116 +662,13 @@ struct user_settings
547#endif /* CONFIG_CODEC == SWCODEC */ 662#endif /* CONFIG_CODEC == SWCODEC */
548}; 663};
549 664
550enum optiontype { INT, BOOL }; 665/** global variables **/
551 666extern long lasttime;
552struct opt_items { 667/* Recording base directory */
553 unsigned const char* string; 668extern const char rec_base_directory[];
554 long voice_id;
555};
556
557/* prototypes */
558void status_save( void );
559int settings_save(void);
560void settings_load(int which);
561void settings_reset(void);
562void sound_settings_apply(void);
563void settings_apply(void);
564void settings_apply_pm_range(void);
565void settings_display(void);
566
567bool settings_load_config(const char* file, bool apply);
568bool settings_save_config(void);
569bool set_bool_options(const char* string, bool* variable,
570 const char* yes_str, int yes_voice,
571 const char* no_str, int no_voice,
572 void (*function)(bool));
573
574bool set_bool(const char* string, bool* variable );
575bool set_option(const char* string, void* variable, enum optiontype type,
576 const struct opt_items* options, int numoptions, void (*function)(int));
577bool set_int(const unsigned char* string, const char* unit, int voice_unit,
578 int* variable,
579 void (*function)(int), int step, int min, int max,
580 void (*formatter)(char*, int, int, const char*) );
581bool set_time_screen(const char* string, struct tm *tm);
582int read_line(int fd, char* buffer, int buffer_size);
583void set_file(char* filename, char* setting, int maxlen);
584
585unsigned int rec_timesplit_seconds(void);
586unsigned long rec_sizesplit_bytes(void);
587void settings_apply_trigger(void);
588
589/* global settings */ 669/* global settings */
590extern struct user_settings global_settings; 670extern struct user_settings global_settings;
591/* global status */ 671/* global status */
592extern struct system_status global_status; 672extern struct system_status global_status;
593/* name of directory where configuration, fonts and other data
594 * files are stored */
595extern long lasttime;
596
597/* Recording base directory */
598extern const char rec_base_directory[];
599
600/* system defines */
601#ifndef TARGET_TREE
602
603#ifndef HAVE_LCD_COLOR
604#define DEFAULT_CONTRAST_SETTING 40
605#endif
606
607#if defined HAVE_LCD_CHARCELLS
608#define MIN_CONTRAST_SETTING 5
609#define MAX_CONTRAST_SETTING 31
610#else
611#define MIN_CONTRAST_SETTING 5
612#define MAX_CONTRAST_SETTING 63
613#endif
614
615/* As it was */
616#ifdef HAVE_REMOTE_LCD
617#ifndef DEFAULT_REMOTE_CONTRAST_SETTING
618/* May be defined in config file if driver code needs the value */
619#define DEFAULT_REMOTE_CONTRAST_SETTING 42
620#endif
621#define MIN_REMOTE_CONTRAST_SETTING MIN_CONTRAST_SETTING
622#define MAX_REMOTE_CONTRAST_SETTING MAX_CONTRAST_SETTING
623#endif
624
625#endif /* !TARGET_TREE */
626
627/* argument bits for settings_load() */
628#define SETTINGS_RTC 1 /* only the settings from the RTC nonvolatile RAM */
629#define SETTINGS_HD 2 /* only the settings from the disk sector */
630#define SETTINGS_ALL 3 /* both */
631
632/* repeat mode options */
633enum
634{
635 REPEAT_OFF,
636 REPEAT_ALL,
637 REPEAT_ONE,
638 REPEAT_SHUFFLE,
639#if (AB_REPEAT_ENABLE == 1)
640 REPEAT_AB,
641#endif
642 NUM_REPEAT_MODES
643};
644
645/* dir filter options */
646/* Note: Any new filter modes need to be added before NUM_FILTER_MODES.
647 * Any new rockbox browse filter modes (accessible through the menu)
648 * must be added after NUM_FILTER_MODES. */
649enum { SHOW_ALL, SHOW_SUPPORTED, SHOW_MUSIC, SHOW_PLAYLIST, SHOW_ID3DB,
650 NUM_FILTER_MODES,
651 SHOW_WPS, SHOW_RWPS, SHOW_FMR, SHOW_CFG, SHOW_LNG, SHOW_MOD, SHOW_FONT, SHOW_PLUGINS};
652
653/* recursive dir insert options */
654enum { RECURSE_OFF, RECURSE_ON, RECURSE_ASK };
655
656/* replaygain types */
657enum { REPLAYGAIN_TRACK = 0, REPLAYGAIN_ALBUM, REPLAYGAIN_SHUFFLE };
658
659/* show path types */
660enum { SHOW_PATH_OFF = 0, SHOW_PATH_CURRENT, SHOW_PATH_FULL };
661 673
662#endif /* __SETTINGS_H__ */ 674#endif /* __SETTINGS_H__ */