diff options
author | Jonathan Gordon <rockbox@jdgordon.info> | 2007-01-29 13:18:57 +0000 |
---|---|---|
committer | Jonathan Gordon <rockbox@jdgordon.info> | 2007-01-29 13:18:57 +0000 |
commit | 41bd24e7dc595f8f3ffdc8a81567293010f88e75 (patch) | |
tree | 11605c4f34237a8f14e6a52bba5ce0043662e33d /apps/settings.h | |
parent | bc60af1dafe4f223cca8a8b4fe58e6b537a419c4 (diff) | |
download | rockbox-41bd24e7dc595f8f3ffdc8a81567293010f88e75.tar.gz rockbox-41bd24e7dc595f8f3ffdc8a81567293010f88e75.zip |
Rearrange these files so they are more managable. No real code changes. Some functions/variables in these are possibly out of place and
should be considered for moving.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12142 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/settings.h')
-rw-r--r-- | apps/settings.h | 234 |
1 files changed, 123 insertions, 111 deletions
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 */ | ||
138 | enum | ||
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. */ | ||
154 | enum { 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 */ | ||
159 | enum { RECURSE_OFF, RECURSE_ON, RECURSE_ASK }; | ||
160 | |||
161 | /* replaygain types */ | ||
162 | enum { REPLAYGAIN_TRACK = 0, REPLAYGAIN_ALBUM, REPLAYGAIN_SHUFFLE }; | ||
163 | |||
164 | /* show path types */ | ||
165 | enum { 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 */ | ||
204 | void settings_load(int which); | ||
205 | bool settings_load_config(const char* file, bool apply); | ||
206 | |||
207 | void status_save( void ); | ||
208 | int settings_save(void); | ||
209 | bool settings_save_config(void); | ||
210 | |||
211 | void settings_reset(void); | ||
212 | void sound_settings_apply(void); | ||
213 | void settings_apply(void); | ||
214 | void settings_apply_pm_range(void); | ||
215 | void settings_display(void); | ||
216 | |||
217 | enum optiontype { INT, BOOL }; | ||
218 | |||
219 | struct opt_items { | ||
220 | unsigned const char* string; | ||
221 | long voice_id; | ||
222 | }; | ||
223 | bool 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 | |||
228 | bool set_bool(const char* string, bool* variable ); | ||
229 | bool set_option(const char* string, void* variable, enum optiontype type, | ||
230 | const struct opt_items* options, int numoptions, void (*function)(int)); | ||
231 | bool 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 */ | ||
237 | bool set_time_screen(const char* string, struct tm *tm); | ||
238 | int read_line(int fd, char* buffer, int buffer_size); | ||
239 | void set_file(char* filename, char* setting, int maxlen); | ||
240 | unsigned int rec_timesplit_seconds(void); | ||
241 | unsigned long rec_sizesplit_bytes(void); | ||
242 | void settings_apply_trigger(void); | ||
243 | |||
244 | |||
245 | /** global_settings and global_status struct definitions **/ | ||
246 | |||
132 | struct system_status | 247 | struct 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 | ||
550 | enum optiontype { INT, BOOL }; | 665 | /** global variables **/ |
551 | 666 | extern long lasttime; | |
552 | struct opt_items { | 667 | /* Recording base directory */ |
553 | unsigned const char* string; | 668 | extern const char rec_base_directory[]; |
554 | long voice_id; | ||
555 | }; | ||
556 | |||
557 | /* prototypes */ | ||
558 | void status_save( void ); | ||
559 | int settings_save(void); | ||
560 | void settings_load(int which); | ||
561 | void settings_reset(void); | ||
562 | void sound_settings_apply(void); | ||
563 | void settings_apply(void); | ||
564 | void settings_apply_pm_range(void); | ||
565 | void settings_display(void); | ||
566 | |||
567 | bool settings_load_config(const char* file, bool apply); | ||
568 | bool settings_save_config(void); | ||
569 | bool 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 | |||
574 | bool set_bool(const char* string, bool* variable ); | ||
575 | bool set_option(const char* string, void* variable, enum optiontype type, | ||
576 | const struct opt_items* options, int numoptions, void (*function)(int)); | ||
577 | bool 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*) ); | ||
581 | bool set_time_screen(const char* string, struct tm *tm); | ||
582 | int read_line(int fd, char* buffer, int buffer_size); | ||
583 | void set_file(char* filename, char* setting, int maxlen); | ||
584 | |||
585 | unsigned int rec_timesplit_seconds(void); | ||
586 | unsigned long rec_sizesplit_bytes(void); | ||
587 | void settings_apply_trigger(void); | ||
588 | |||
589 | /* global settings */ | 669 | /* global settings */ |
590 | extern struct user_settings global_settings; | 670 | extern struct user_settings global_settings; |
591 | /* global status */ | 671 | /* global status */ |
592 | extern struct system_status global_status; | 672 | extern struct system_status global_status; |
593 | /* name of directory where configuration, fonts and other data | ||
594 | * files are stored */ | ||
595 | extern long lasttime; | ||
596 | |||
597 | /* Recording base directory */ | ||
598 | extern 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 */ | ||
633 | enum | ||
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. */ | ||
649 | enum { 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 */ | ||
654 | enum { RECURSE_OFF, RECURSE_ON, RECURSE_ASK }; | ||
655 | |||
656 | /* replaygain types */ | ||
657 | enum { REPLAYGAIN_TRACK = 0, REPLAYGAIN_ALBUM, REPLAYGAIN_SHUFFLE }; | ||
658 | |||
659 | /* show path types */ | ||
660 | enum { SHOW_PATH_OFF = 0, SHOW_PATH_CURRENT, SHOW_PATH_FULL }; | ||
661 | 673 | ||
662 | #endif /* __SETTINGS_H__ */ | 674 | #endif /* __SETTINGS_H__ */ |