diff options
author | Jonathan Gordon <rockbox@jdgordon.info> | 2008-02-05 05:50:20 +0000 |
---|---|---|
committer | Jonathan Gordon <rockbox@jdgordon.info> | 2008-02-05 05:50:20 +0000 |
commit | 2c82494e66a59f5bea0e31eaf66800ca9db6f8c8 (patch) | |
tree | 91bd21ccee1546112622663ce6d06b25bab0844b /apps | |
parent | 47412cbc358647bec82bc7a15bb48a14853d3403 (diff) | |
download | rockbox-2c82494e66a59f5bea0e31eaf66800ca9db6f8c8.tar.gz rockbox-2c82494e66a59f5bea0e31eaf66800ca9db6f8c8.zip |
updated the quickscreen's:
- use viewports
- dont change to system font, fiddle with item positions to make them fit small screens
- user customizable options (use the .cfg settings "quickscreen_left, quickscreen_right, quickscreen_top, quickscreen_bottom" for the name and the .cfg name for the setting you want to use. it can be any except the string settings... (e.g. quickscreen_left:talk menu)
- a top item! if there is none set the up button will exit the screen
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16220 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r-- | apps/gui/gwps.c | 1 | ||||
-rw-r--r-- | apps/gui/option_select.c | 63 | ||||
-rw-r--r-- | apps/gui/option_select.h | 5 | ||||
-rw-r--r-- | apps/gui/quickscreen.c | 334 | ||||
-rw-r--r-- | apps/gui/quickscreen.h | 49 | ||||
-rw-r--r-- | apps/lang/english.lang | 120 | ||||
-rw-r--r-- | apps/screens.c | 152 | ||||
-rw-r--r-- | apps/screens.h | 5 | ||||
-rw-r--r-- | apps/settings.c | 15 | ||||
-rw-r--r-- | apps/settings.h | 6 | ||||
-rw-r--r-- | apps/settings_list.c | 10 | ||||
-rw-r--r-- | apps/tree.c | 1 |
12 files changed, 366 insertions, 395 deletions
diff --git a/apps/gui/gwps.c b/apps/gui/gwps.c index ad9fce7a8f..e75c16aa07 100644 --- a/apps/gui/gwps.c +++ b/apps/gui/gwps.c | |||
@@ -56,6 +56,7 @@ | |||
56 | #include "cuesheet.h" | 56 | #include "cuesheet.h" |
57 | #include "ata_idle_notify.h" | 57 | #include "ata_idle_notify.h" |
58 | #include "root_menu.h" | 58 | #include "root_menu.h" |
59 | #include "quickscreen.h" | ||
59 | 60 | ||
60 | #if (LCD_DEPTH > 1) || (defined(HAVE_LCD_REMOTE) && (LCD_REMOTE_DEPTH > 1)) | 61 | #if (LCD_DEPTH > 1) || (defined(HAVE_LCD_REMOTE) && (LCD_REMOTE_DEPTH > 1)) |
61 | #include "backdrop.h" | 62 | #include "backdrop.h" |
diff --git a/apps/gui/option_select.c b/apps/gui/option_select.c index cb5b6eee36..b4b1b716bb 100644 --- a/apps/gui/option_select.c +++ b/apps/gui/option_select.c | |||
@@ -60,7 +60,7 @@ static const char *unit_strings[] = | |||
60 | /* these two vars are needed so arbitrary values can be added to the | 60 | /* these two vars are needed so arbitrary values can be added to the |
61 | TABLE_SETTING settings if the F_ALLOW_ARBITRARY_VALS flag is set */ | 61 | TABLE_SETTING settings if the F_ALLOW_ARBITRARY_VALS flag is set */ |
62 | static int table_setting_oldval = 0, table_setting_array_position = 0; | 62 | static int table_setting_oldval = 0, table_setting_array_position = 0; |
63 | static char *option_get_valuestring(struct settings_list *setting, | 63 | char *option_get_valuestring(struct settings_list *setting, |
64 | char *buffer, int buf_len, | 64 | char *buffer, int buf_len, |
65 | intptr_t temp_var) | 65 | intptr_t temp_var) |
66 | { | 66 | { |
@@ -210,19 +210,20 @@ static int option_talk(int selected_item, void * data) | |||
210 | } | 210 | } |
211 | return 0; | 211 | return 0; |
212 | } | 212 | } |
213 | #if 0 | 213 | |
214 | int option_select_next_val(struct settings_list *setting, | 214 | void option_select_next_val(struct settings_list *setting) |
215 | intptr_t temp_var) | ||
216 | { | 215 | { |
217 | int val = 0; | 216 | int val = 0; |
217 | int *value = setting->setting; | ||
218 | if ((setting->flags & F_BOOL_SETTING) == F_BOOL_SETTING) | 218 | if ((setting->flags & F_BOOL_SETTING) == F_BOOL_SETTING) |
219 | { | 219 | { |
220 | val = (bool)temp_var ? 0 : 1; | 220 | *(bool*)value = !*(bool*)value; |
221 | return; | ||
221 | } | 222 | } |
222 | else if ((setting->flags & F_INT_SETTING) == F_INT_SETTING) | 223 | else if ((setting->flags & F_INT_SETTING) == F_INT_SETTING) |
223 | { | 224 | { |
224 | struct int_setting *info = setting->int_setting; | 225 | struct int_setting *info = (struct int_setting *)setting->int_setting; |
225 | val = (int)temp_var + info->step; | 226 | val = *value + info->step; |
226 | if (val > info->max) | 227 | if (val > info->max) |
227 | val = info->min; | 228 | val = info->min; |
228 | } | 229 | } |
@@ -232,55 +233,19 @@ int option_select_next_val(struct settings_list *setting, | |||
232 | int steps = sound_steps(setting_id); | 233 | int steps = sound_steps(setting_id); |
233 | int min = sound_min(setting_id); | 234 | int min = sound_min(setting_id); |
234 | int max = sound_max(setting_id); | 235 | int max = sound_max(setting_id); |
235 | val = (int)temp_var + steps; | 236 | val = *value + steps; |
236 | if (val > max) | 237 | if (val >= max) |
237 | val = min; | 238 | val = min; |
238 | } | 239 | } |
239 | else if ((setting->flags & F_CHOICE_SETTING) == F_CHOICE_SETTING) | 240 | else if ((setting->flags & F_CHOICE_SETTING) == F_CHOICE_SETTING) |
240 | { | 241 | { |
241 | struct choice_setting *info = setting->choice_setting; | 242 | struct choice_setting *info = (struct choice_setting *)setting->choice_setting; |
242 | val = (int)temp_var; | 243 | val = *value + 1; |
243 | if (val > info->count) | 244 | if (val >= info->count) |
244 | val = 0; | 245 | val = 0; |
245 | } | 246 | } |
246 | return val; | 247 | *value = val; |
247 | } | ||
248 | |||
249 | int option_select_prev_val(struct settings_list *setting, | ||
250 | intptr_t temp_var) | ||
251 | { | ||
252 | int val = 0; | ||
253 | if ((setting->flags & F_BOOL_SETTING) == F_BOOL_SETTING) | ||
254 | { | ||
255 | val = (bool)temp_var ? 0 : 1; | ||
256 | } | ||
257 | else if ((setting->flags & F_INT_SETTING) == F_INT_SETTING) | ||
258 | { | ||
259 | struct int_setting *info = setting->int_setting; | ||
260 | val = (int)temp_var - info->step; | ||
261 | if (val < info->min) | ||
262 | val = info->max; | ||
263 | } | ||
264 | else if ((setting->flags & F_T_SOUND) == F_T_SOUND) | ||
265 | { | ||
266 | int setting_id = setting->sound_setting->setting; | ||
267 | int steps = sound_steps(setting_id); | ||
268 | int min = sound_min(setting_id); | ||
269 | int max = sound_max(setting_id); | ||
270 | val = (int)temp_var -+ steps; | ||
271 | if (val < min) | ||
272 | val = max; | ||
273 | } | ||
274 | else if ((setting->flags & F_CHOICE_SETTING) == F_CHOICE_SETTING) | ||
275 | { | ||
276 | struct choice_setting *info = setting->choice_setting; | ||
277 | val = (int)temp_var; | ||
278 | if (val < 0) | ||
279 | val = info->count - 1; | ||
280 | } | ||
281 | return val; | ||
282 | } | 248 | } |
283 | #endif | ||
284 | 249 | ||
285 | static int selection_to_val(struct settings_list *setting, int selection) | 250 | static int selection_to_val(struct settings_list *setting, int selection) |
286 | { | 251 | { |
diff --git a/apps/gui/option_select.h b/apps/gui/option_select.h index e46570f303..63299bc599 100644 --- a/apps/gui/option_select.h +++ b/apps/gui/option_select.h | |||
@@ -65,4 +65,9 @@ extern void option_select_next(struct option_select * opt); | |||
65 | */ | 65 | */ |
66 | extern void option_select_prev(struct option_select * opt); | 66 | extern void option_select_prev(struct option_select * opt); |
67 | 67 | ||
68 | |||
69 | void option_select_next_val(struct settings_list *setting); | ||
70 | char *option_get_valuestring(struct settings_list *setting, | ||
71 | char *buffer, int buf_len, | ||
72 | intptr_t temp_var); | ||
68 | #endif /* _GUI_OPTION_SELECT_H_ */ | 73 | #endif /* _GUI_OPTION_SELECT_H_ */ |
diff --git a/apps/gui/quickscreen.c b/apps/gui/quickscreen.c index c2da5879fe..f0eafb7299 100644 --- a/apps/gui/quickscreen.c +++ b/apps/gui/quickscreen.c | |||
@@ -7,7 +7,7 @@ | |||
7 | * \/ \/ \/ \/ \/ | 7 | * \/ \/ \/ \/ \/ |
8 | * $Id$ | 8 | * $Id$ |
9 | * | 9 | * |
10 | * Copyright (C) 2005 by Kevin Ferrare | 10 | * Copyright (C) 2008 by Jonathan Gordon |
11 | * | 11 | * |
12 | * All files in this archive are subject to the GNU General Public License. | 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. | 13 | * See the file COPYING in the source tree root for full license agreement. |
@@ -30,109 +30,198 @@ | |||
30 | #include "misc.h" | 30 | #include "misc.h" |
31 | #include "statusbar.h" | 31 | #include "statusbar.h" |
32 | #include "action.h" | 32 | #include "action.h" |
33 | #include "settings_list.h" | ||
34 | #include "lang.h" | ||
35 | #include "option_select.h" | ||
33 | 36 | ||
34 | void gui_quickscreen_init(struct gui_quickscreen * qs, | 37 | static struct viewport vps[NB_SCREENS][QUICKSCREEN_ITEM_COUNT]; |
35 | struct option_select *left_option, | ||
36 | struct option_select *bottom_option, | ||
37 | struct option_select *right_option, | ||
38 | quickscreen_callback callback) | ||
39 | { | ||
40 | qs->left_option=left_option; | ||
41 | qs->bottom_option=bottom_option; | ||
42 | qs->right_option=right_option; | ||
43 | qs->callback=callback; | ||
44 | } | ||
45 | 38 | ||
46 | /* | 39 | static void quickscreen_fix_viewports(struct gui_quickscreen *qs, |
47 | * Draws the quickscreen on a given screen | 40 | struct screen *display, |
48 | * - qs : the quickscreen | 41 | struct viewport *parent) |
49 | * - display : the screen to draw on | ||
50 | */ | ||
51 | static void gui_quickscreen_draw(struct gui_quickscreen * qs, struct screen * display) | ||
52 | { | 42 | { |
53 | const unsigned char *option; | 43 | int height, i, count=0, top; |
54 | const unsigned char *title; | 44 | int nb_lines = parent->height/display->char_height; |
55 | int w, font_h; | 45 | bool single_line_bottom = false; |
56 | bool statusbar = global_settings.statusbar; | 46 | |
57 | #ifdef HAS_BUTTONBAR | 47 | for(i=0; i<QUICKSCREEN_ITEM_COUNT; i++) |
58 | display->has_buttonbar=false; | ||
59 | #endif | ||
60 | gui_textarea_clear(display); | ||
61 | if (display->height / display->char_height < 7) /* we need at leats 7 lines */ | ||
62 | { | 48 | { |
63 | display->setfont(FONT_SYSFIXED); | 49 | if (qs->items[i]) |
50 | count++; | ||
51 | vps[display->screen_type][i] = *parent; | ||
64 | } | 52 | } |
65 | display->getstringsize("A", NULL, &font_h); | 53 | |
66 | 54 | /* special handling when there is only enough room for 2 items. | |
67 | /* do these calculations once */ | 55 | discard the top and bottom items, so only show the 2 side ones */ |
68 | const unsigned int puts_center = display->height/2/font_h; | 56 | if (nb_lines < 4) |
69 | const unsigned int puts_bottom = display->height/font_h; | ||
70 | const unsigned int putsxy_center = display->height/2; | ||
71 | const unsigned int putsxy_bottom = display->height; | ||
72 | |||
73 | /* Displays the first line of text */ | ||
74 | option=(unsigned char *)option_select_get_text(qs->left_option); | ||
75 | title=(unsigned char *)qs->left_option->title; | ||
76 | display->puts_scroll(2, puts_center-4+!statusbar, title); | ||
77 | display->puts_scroll(2, puts_center-3+!statusbar, option); | ||
78 | display->mono_bitmap(bitmap_icons_7x8[Icon_FastBackward], 1, | ||
79 | putsxy_center-(font_h*3), 7, 8); | ||
80 | |||
81 | /* Displays the second line of text */ | ||
82 | option=(unsigned char *)option_select_get_text(qs->right_option); | ||
83 | title=(unsigned char *)qs->right_option->title; | ||
84 | display->getstringsize(title, &w, NULL); | ||
85 | if(w > display->width - 8) | ||
86 | { | 57 | { |
87 | display->puts_scroll(2, puts_center-2+!statusbar, title); | 58 | qs->items[QUICKSCREEN_TOP] = NULL; |
88 | display->mono_bitmap(bitmap_icons_7x8[Icon_FastForward], 1, | 59 | qs->items[QUICKSCREEN_BOTTOM] = NULL; |
89 | putsxy_center-font_h, 7, 8); | 60 | vps[display->screen_type][QUICKSCREEN_RIGHT].y = parent->y; |
61 | vps[display->screen_type][QUICKSCREEN_LEFT].height = parent->height/2; | ||
62 | vps[display->screen_type][QUICKSCREEN_RIGHT].y = parent->y+parent->height/2; | ||
63 | vps[display->screen_type][QUICKSCREEN_RIGHT].height = parent->height/2; | ||
64 | return; | ||
90 | } | 65 | } |
91 | else | 66 | else if (nb_lines < 5 && count == 4) /* drop the top item */ |
92 | { | 67 | { |
93 | display->putsxy(display->width - w - 12, putsxy_center-font_h, title); | 68 | qs->items[QUICKSCREEN_TOP] = NULL; |
94 | display->mono_bitmap(bitmap_icons_7x8[Icon_FastForward], | 69 | single_line_bottom = true; |
95 | display->width - 8, putsxy_center-font_h, 7, 8); | 70 | } |
71 | |||
72 | height = display->char_height*2; | ||
73 | if (nb_lines > 8 || | ||
74 | (nb_lines > 5 && qs->items[QUICKSCREEN_TOP] == NULL)) | ||
75 | height += display->char_height; | ||
76 | /* Top item */ | ||
77 | if (qs->items[QUICKSCREEN_TOP]) | ||
78 | { | ||
79 | vps[display->screen_type][QUICKSCREEN_TOP].y = parent->y; | ||
80 | vps[display->screen_type][QUICKSCREEN_TOP].height = height; | ||
96 | } | 81 | } |
97 | display->getstringsize(option, &w, NULL); | ||
98 | if(w > display->width) | ||
99 | display->puts_scroll(0, puts_center-1+!statusbar, option); | ||
100 | else | 82 | else |
101 | display->putsxy(display->width -w-12, putsxy_center, option); | 83 | { |
102 | 84 | vps[display->screen_type][QUICKSCREEN_TOP].height = 0; | |
103 | /* Displays the third line of text */ | 85 | } |
104 | option=(unsigned char *)option_select_get_text(qs->bottom_option); | 86 | /* bottom item */ |
105 | title=(unsigned char *)qs->bottom_option->title; | 87 | if (qs->items[QUICKSCREEN_BOTTOM]) |
106 | 88 | { | |
107 | display->getstringsize(title, &w, NULL); | 89 | if (single_line_bottom) |
108 | if(w > display->width) | 90 | height = display->char_height; |
109 | display->puts_scroll(0, puts_bottom-4+!statusbar, title); | 91 | vps[display->screen_type][QUICKSCREEN_BOTTOM].y = parent->y+parent->height - height; |
92 | vps[display->screen_type][QUICKSCREEN_BOTTOM].height = height; | ||
93 | } | ||
110 | else | 94 | else |
111 | display->putsxy(display->width/2-w/2, putsxy_bottom-(font_h*3), title); | 95 | { |
96 | vps[display->screen_type][QUICKSCREEN_BOTTOM].height = 0; | ||
97 | } | ||
98 | |||
99 | /* side items */ | ||
100 | height = parent->height - | ||
101 | vps[display->screen_type][QUICKSCREEN_BOTTOM].height - | ||
102 | vps[display->screen_type][QUICKSCREEN_TOP].height ; | ||
103 | top = parent->y+vps[display->screen_type][QUICKSCREEN_TOP].height; | ||
104 | vps[display->screen_type][QUICKSCREEN_LEFT].y = top; | ||
105 | vps[display->screen_type][QUICKSCREEN_RIGHT].y = top; | ||
106 | vps[display->screen_type][QUICKSCREEN_LEFT].height = height; | ||
107 | vps[display->screen_type][QUICKSCREEN_RIGHT].height = height; | ||
108 | |||
109 | vps[display->screen_type][QUICKSCREEN_RIGHT].x = parent->x+parent->width/2; | ||
110 | |||
111 | vps[display->screen_type][QUICKSCREEN_LEFT].width = parent->width/2; | ||
112 | vps[display->screen_type][QUICKSCREEN_RIGHT].width = parent->width/2; | ||
113 | } | ||
112 | 114 | ||
113 | display->getstringsize(option, &w, NULL); | 115 | static void quickscreen_draw_text(char *s, int item, bool title, |
114 | if(w > display->width) | 116 | struct screen *display, struct viewport *vp) |
115 | display->puts_scroll(0, puts_bottom-3+!statusbar, option); | 117 | { |
118 | int nb_lines = vp->height/display->char_height; | ||
119 | int w, line = 0, x=0; | ||
120 | display->getstringsize(s, &w, NULL); | ||
121 | switch (item) | ||
122 | { | ||
123 | case QUICKSCREEN_TOP: | ||
124 | if (nb_lines > 2) | ||
125 | { | ||
126 | if (title) | ||
127 | { | ||
128 | display->mono_bitmap(bitmap_icons_7x8[Icon_UpArrow], | ||
129 | (vp->width/2)-4, 0, 7, 8); | ||
130 | line = 1; | ||
131 | } | ||
132 | else | ||
133 | line = 2; | ||
134 | } | ||
135 | else | ||
136 | line = title?0:1; | ||
137 | x = (vp->width - w)/2; | ||
138 | break; | ||
139 | case QUICKSCREEN_BOTTOM: | ||
140 | if (title && nb_lines > 2 && item == QUICKSCREEN_BOTTOM) | ||
141 | { | ||
142 | display->mono_bitmap(bitmap_icons_7x8[Icon_DownArrow], | ||
143 | (vp->width/2)-4, vp->height-8, 7, 8); | ||
144 | } | ||
145 | line = title?0:1; | ||
146 | x = (vp->width - w)/2; | ||
147 | break; | ||
148 | case QUICKSCREEN_LEFT: | ||
149 | if (nb_lines > 1) | ||
150 | { | ||
151 | line = nb_lines/2; | ||
152 | if (title) | ||
153 | line--; | ||
154 | } | ||
155 | else | ||
156 | line = 0; | ||
157 | if (title) | ||
158 | display->mono_bitmap(bitmap_icons_7x8[Icon_FastBackward], 1, | ||
159 | line*display->char_height+display->char_height/2, 7, 8); | ||
160 | x = 12; | ||
161 | break; | ||
162 | case QUICKSCREEN_RIGHT: | ||
163 | line = nb_lines/2; | ||
164 | if (title == false) | ||
165 | line++; | ||
166 | if (title) | ||
167 | display->mono_bitmap(bitmap_icons_7x8[Icon_FastForward], | ||
168 | vp->width - 8, | ||
169 | line*display->char_height+display->char_height/2, 7, 8); | ||
170 | x = vp->width - w - 12; | ||
171 | break; | ||
172 | } | ||
173 | if (w>vp->width) | ||
174 | display->puts_scroll(0,line,s); | ||
116 | else | 175 | else |
117 | display->putsxy(display->width/2-w/2, putsxy_bottom-(font_h*2), option); | 176 | display->putsxy(x, line*display->char_height, s); |
118 | display->mono_bitmap(bitmap_icons_7x8[Icon_DownArrow], display->width/2-4, | ||
119 | putsxy_bottom-font_h, 7, 8); | ||
120 | |||
121 | gui_textarea_update(display); | ||
122 | display->setfont(FONT_UI); | ||
123 | } | 177 | } |
124 | 178 | ||
125 | /* | 179 | static void gui_quickscreen_draw(struct gui_quickscreen *qs, |
126 | * Draws the quickscreen on all available screens | 180 | struct screen *display, |
127 | * - qs : the quickscreen | 181 | struct viewport *parent) |
128 | */ | ||
129 | static void gui_syncquickscreen_draw(struct gui_quickscreen * qs) | ||
130 | { | 182 | { |
131 | int i; | 183 | int i; |
132 | FOR_NB_SCREENS(i) | 184 | char buf[MAX_PATH]; |
133 | gui_quickscreen_draw(qs, &screens[i]); | 185 | unsigned char *title, *value; |
186 | void *setting; | ||
187 | int temp; | ||
188 | display->set_viewport(parent); | ||
189 | display->clear_viewport(); | ||
190 | for (i=0; i<QUICKSCREEN_ITEM_COUNT; i++) | ||
191 | { | ||
192 | |||
193 | if (!qs->items[i]) | ||
194 | continue; | ||
195 | display->set_viewport(&vps[display->screen_type][i]); | ||
196 | display->scroll_stop(&vps[display->screen_type][i]); | ||
197 | |||
198 | title = P2STR(ID2P(qs->items[i]->lang_id)); | ||
199 | setting = qs->items[i]->setting; | ||
200 | if (qs->items[i]->flags&F_T_BOOL) | ||
201 | temp = *(bool*)setting?1:0; | ||
202 | else | ||
203 | temp = *(int*)setting; | ||
204 | value = option_get_valuestring((struct settings_list*)qs->items[i], buf, MAX_PATH, temp); | ||
205 | |||
206 | if (vps[display->screen_type][i].height < display->char_height*2) | ||
207 | { | ||
208 | char text[MAX_PATH]; | ||
209 | snprintf(text, MAX_PATH, "%s: %s", title, value); | ||
210 | quickscreen_draw_text(text, i, true, display, &vps[display->screen_type][i]); | ||
211 | } | ||
212 | else | ||
213 | { | ||
214 | quickscreen_draw_text(title, i, true, display, &vps[display->screen_type][i]); | ||
215 | quickscreen_draw_text(value, i, false, display, &vps[display->screen_type][i]); | ||
216 | } | ||
217 | display->update_viewport(); | ||
218 | } | ||
219 | display->set_viewport(parent); | ||
220 | display->update_viewport(); | ||
221 | display->set_viewport(NULL); | ||
134 | } | 222 | } |
135 | 223 | ||
224 | |||
136 | /* | 225 | /* |
137 | * Does the actions associated to the given button if any | 226 | * Does the actions associated to the given button if any |
138 | * - qs : the quickscreen | 227 | * - qs : the quickscreen |
@@ -141,23 +230,26 @@ static void gui_syncquickscreen_draw(struct gui_quickscreen * qs) | |||
141 | */ | 230 | */ |
142 | static bool gui_quickscreen_do_button(struct gui_quickscreen * qs, int button) | 231 | static bool gui_quickscreen_do_button(struct gui_quickscreen * qs, int button) |
143 | { | 232 | { |
144 | |||
145 | switch(button) | 233 | switch(button) |
146 | { | 234 | { |
147 | case ACTION_QS_LEFT: | 235 | case ACTION_QS_LEFT: |
148 | option_select_next(qs->left_option); | 236 | if (qs->items[QUICKSCREEN_LEFT]) |
237 | option_select_next_val((struct settings_list *)qs->items[QUICKSCREEN_LEFT]); | ||
149 | return(true); | 238 | return(true); |
150 | 239 | ||
151 | case ACTION_QS_DOWN: | 240 | case ACTION_QS_DOWN: |
152 | option_select_next(qs->bottom_option); | 241 | if (qs->items[QUICKSCREEN_BOTTOM]) |
242 | option_select_next_val((struct settings_list *)qs->items[QUICKSCREEN_BOTTOM]); | ||
153 | return(true); | 243 | return(true); |
154 | 244 | ||
155 | case ACTION_QS_RIGHT: | 245 | case ACTION_QS_RIGHT: |
156 | option_select_next(qs->right_option); | 246 | if (qs->items[QUICKSCREEN_RIGHT]) |
247 | option_select_next_val((struct settings_list *)qs->items[QUICKSCREEN_RIGHT]); | ||
157 | return(true); | 248 | return(true); |
158 | 249 | ||
159 | case ACTION_QS_DOWNINV: | 250 | case ACTION_QS_DOWNINV: |
160 | option_select_prev(qs->bottom_option); | 251 | if (qs->items[QUICKSCREEN_TOP]) |
252 | option_select_next_val((struct settings_list *)qs->items[QUICKSCREEN_TOP]); | ||
161 | return(true); | 253 | return(true); |
162 | } | 254 | } |
163 | return(false); | 255 | return(false); |
@@ -165,24 +257,48 @@ static bool gui_quickscreen_do_button(struct gui_quickscreen * qs, int button) | |||
165 | 257 | ||
166 | bool gui_syncquickscreen_run(struct gui_quickscreen * qs, int button_enter) | 258 | bool gui_syncquickscreen_run(struct gui_quickscreen * qs, int button_enter) |
167 | { | 259 | { |
168 | int button; | 260 | int button, i; |
261 | bool changed = false; | ||
262 | struct viewport vp[NB_SCREENS]; | ||
169 | /* To quit we need either : | 263 | /* To quit we need either : |
170 | * - a second press on the button that made us enter | 264 | * - a second press on the button that made us enter |
171 | * - an action taken while pressing the enter button, | 265 | * - an action taken while pressing the enter button, |
172 | * then release the enter button*/ | 266 | * then release the enter button*/ |
173 | bool can_quit=false; | 267 | bool can_quit=false; |
174 | gui_syncquickscreen_draw(qs); | ||
175 | gui_syncstatusbar_draw(&statusbars, true); | 268 | gui_syncstatusbar_draw(&statusbars, true); |
269 | FOR_NB_SCREENS(i) | ||
270 | { | ||
271 | vp[i].x = 0; | ||
272 | vp[i].width = screens[i].width; | ||
273 | vp[i].y = STATUSBAR_HEIGHT; | ||
274 | vp[i].height = screens[i].height - STATUSBAR_HEIGHT; | ||
275 | #ifdef HAVE_LCD_COLOR | ||
276 | if (screens[i].is_color) | ||
277 | { | ||
278 | vp[i].fg_pattern = screens[i].get_foreground(); | ||
279 | vp[i].bg_pattern = screens[i].get_background(); | ||
280 | } | ||
281 | #endif | ||
282 | vp[i].xmargin = 0; | ||
283 | vp[i].ymargin = 0; | ||
284 | vp[i].font = FONT_UI; | ||
285 | vp[i].drawmode = STYLE_DEFAULT; | ||
286 | quickscreen_fix_viewports(qs, &screens[i], &vp[i]); | ||
287 | gui_quickscreen_draw(qs, &screens[i], &vp[i]); | ||
288 | } | ||
176 | while (true) { | 289 | while (true) { |
177 | button = get_action(CONTEXT_QUICKSCREEN,TIMEOUT_BLOCK); | 290 | button = get_action(CONTEXT_QUICKSCREEN,TIMEOUT_BLOCK); |
178 | if(default_event_handler(button) == SYS_USB_CONNECTED) | 291 | if(default_event_handler(button) == SYS_USB_CONNECTED) |
179 | return(true); | 292 | return(true); |
180 | if(gui_quickscreen_do_button(qs, button)) | 293 | if(gui_quickscreen_do_button(qs, button)) |
181 | { | 294 | { |
295 | changed = true; | ||
182 | can_quit=true; | 296 | can_quit=true; |
183 | if(qs->callback) | 297 | if (button == ACTION_QS_DOWNINV && |
184 | qs->callback(qs); | 298 | !qs->items[QUICKSCREEN_TOP]) |
185 | gui_syncquickscreen_draw(qs); | 299 | break; |
300 | FOR_NB_SCREENS(i) | ||
301 | gui_quickscreen_draw(qs, &screens[i], &vp[i]); | ||
186 | } | 302 | } |
187 | else if(button==button_enter) | 303 | else if(button==button_enter) |
188 | can_quit=true; | 304 | can_quit=true; |
@@ -195,8 +311,36 @@ bool gui_syncquickscreen_run(struct gui_quickscreen * qs, int button_enter) | |||
195 | 311 | ||
196 | gui_syncstatusbar_draw(&statusbars, false); | 312 | gui_syncstatusbar_draw(&statusbars, false); |
197 | } | 313 | } |
314 | if (changed) | ||
315 | settings_apply(); | ||
198 | return false; | 316 | return false; |
199 | } | 317 | } |
200 | 318 | ||
319 | bool quick_screen_quick(int button_enter) | ||
320 | { | ||
321 | struct gui_quickscreen qs; | ||
322 | qs.items[QUICKSCREEN_LEFT] = find_setting_from_string(global_settings.quickscreen_left, NULL); | ||
323 | qs.items[QUICKSCREEN_RIGHT] = find_setting_from_string(global_settings.quickscreen_right,NULL); | ||
324 | qs.items[QUICKSCREEN_BOTTOM] = find_setting_from_string(global_settings.quickscreen_bottom, NULL); | ||
325 | qs.items[QUICKSCREEN_TOP] = find_setting_from_string(global_settings.quickscreen_top,NULL); | ||
326 | qs.callback = NULL; | ||
327 | gui_syncquickscreen_run(&qs, button_enter); | ||
328 | return(0); | ||
329 | } | ||
330 | |||
331 | #ifdef BUTTON_F3 | ||
332 | bool quick_screen_f3(int button_enter) | ||
333 | { | ||
334 | struct gui_quickscreen qs; | ||
335 | qs.items[QUICKSCREEN_LEFT] = find_setting(&global_settings.scrollbar, NULL); | ||
336 | qs.items[QUICKSCREEN_RIGHT] = find_setting(&global_settings.statusbar, NULL); | ||
337 | qs.items[QUICKSCREEN_BOTTOM] = find_setting(&global_settings.flip_display, NULL); | ||
338 | qs.items[QUICKSCREEN_TOP] = NULL; | ||
339 | qs.callback = NULL; | ||
340 | gui_syncquickscreen_run(&qs, button_enter); | ||
341 | return(0); | ||
342 | } | ||
343 | #endif /* BUTTON_F3 */ | ||
344 | |||
201 | #endif /* HAVE_QUICKSCREEN */ | 345 | #endif /* HAVE_QUICKSCREEN */ |
202 | 346 | ||
diff --git a/apps/gui/quickscreen.h b/apps/gui/quickscreen.h index 179d619883..a264a9383d 100644 --- a/apps/gui/quickscreen.h +++ b/apps/gui/quickscreen.h | |||
@@ -27,45 +27,30 @@ | |||
27 | #include "option_select.h" | 27 | #include "option_select.h" |
28 | #include "screen_access.h" | 28 | #include "screen_access.h" |
29 | 29 | ||
30 | struct gui_quickscreen; | 30 | enum QUICKSCREEN_ITEM { |
31 | /* | 31 | QUICKSCREEN_LEFT = 0, |
32 | * Callback function called each time the quickscreen gets modified | 32 | QUICKSCREEN_RIGHT, |
33 | * - qs : the quickscreen that did the modification | 33 | QUICKSCREEN_TOP, |
34 | */ | 34 | QUICKSCREEN_BOTTOM, |
35 | typedef void (quickscreen_callback)(struct gui_quickscreen * qs); | 35 | QUICKSCREEN_ITEM_COUNT, |
36 | }; | ||
36 | 37 | ||
37 | struct gui_quickscreen | 38 | struct gui_quickscreen |
38 | { | 39 | { |
39 | struct option_select *left_option; | 40 | const struct settings_list *items[QUICKSCREEN_ITEM_COUNT]; |
40 | struct option_select *bottom_option; | 41 | void (*callback)(struct gui_quickscreen * qs); |
41 | struct option_select *right_option; | ||
42 | quickscreen_callback *callback; | ||
43 | }; | 42 | }; |
44 | 43 | ||
45 | /* | ||
46 | * Initializes a quickscreen | ||
47 | * - qs : the quickscreen | ||
48 | * - left_option, bottom_option, right_option : a list of choices | ||
49 | * for each option | ||
50 | * - left_right_title : the 2nd line of the title | ||
51 | * on the left and on the right | ||
52 | * - callback : a callback function called each time the quickscreen | ||
53 | * gets modified | ||
54 | */ | ||
55 | void gui_quickscreen_init(struct gui_quickscreen * qs, | ||
56 | struct option_select *left_option, | ||
57 | struct option_select *bottom_option, | ||
58 | struct option_select *right_option, | ||
59 | quickscreen_callback *callback); | ||
60 | 44 | ||
61 | 45 | struct gui_quickscreen; | |
62 | /* | ||
63 | * Runs the quickscreen on all available screens, if button_enter is released, quits | ||
64 | * - qs : the quickscreen | ||
65 | * - button_enter : button pressed at the same time the quickscreen is displayed | ||
66 | * returns : true if usb was connected, false otherwise | ||
67 | */ | ||
68 | bool gui_syncquickscreen_run(struct gui_quickscreen * qs, int button_enter); | 46 | bool gui_syncquickscreen_run(struct gui_quickscreen * qs, int button_enter); |
69 | 47 | ||
48 | |||
49 | #ifdef BUTTON_F3 | ||
50 | extern bool quick_screen_f3(int button_enter); | ||
51 | #endif | ||
52 | extern bool quick_screen_quick(int button_enter); | ||
53 | |||
54 | |||
70 | #endif /*_GUI_QUICK_SCREEN_H_*/ | 55 | #endif /*_GUI_QUICK_SCREEN_H_*/ |
71 | #endif /* HAVE_QUICKSCREEN */ | 56 | #endif /* HAVE_QUICKSCREEN */ |
diff --git a/apps/lang/english.lang b/apps/lang/english.lang index 96c076a8be..0e84b088fd 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang | |||
@@ -10087,53 +10087,53 @@ | |||
10087 | </phrase> | 10087 | </phrase> |
10088 | <phrase> | 10088 | <phrase> |
10089 | id: LANG_SYSFONT_SET_BOOL_YES | 10089 | id: LANG_SYSFONT_SET_BOOL_YES |
10090 | desc: bool true representation | 10090 | desc: deprecated |
10091 | user: | 10091 | user: |
10092 | <source> | 10092 | <source> |
10093 | *: none | 10093 | *: none |
10094 | lcd_bitmap: "Yes" | 10094 | lcd_bitmap: "" |
10095 | </source> | 10095 | </source> |
10096 | <dest> | 10096 | <dest> |
10097 | *: none | 10097 | *: none |
10098 | lcd_bitmap: "Yes" | 10098 | lcd_bitmap: "" |
10099 | </dest> | 10099 | </dest> |
10100 | <voice> | 10100 | <voice> |
10101 | *: none | 10101 | *: none |
10102 | lcd_bitmap: "Yes" | 10102 | lcd_bitmap: "" |
10103 | </voice> | 10103 | </voice> |
10104 | </phrase> | 10104 | </phrase> |
10105 | <phrase> | 10105 | <phrase> |
10106 | id: LANG_SYSFONT_SET_BOOL_NO | 10106 | id: LANG_SYSFONT_SET_BOOL_NO |
10107 | desc: bool false representation | 10107 | desc: deprecated |
10108 | user: | 10108 | user: |
10109 | <source> | 10109 | <source> |
10110 | *: none | 10110 | *: none |
10111 | lcd_bitmap: "No" | 10111 | lcd_bitmap: "" |
10112 | </source> | 10112 | </source> |
10113 | <dest> | 10113 | <dest> |
10114 | *: none | 10114 | *: none |
10115 | lcd_bitmap: "No" | 10115 | lcd_bitmap: "" |
10116 | </dest> | 10116 | </dest> |
10117 | <voice> | 10117 | <voice> |
10118 | *: none | 10118 | *: none |
10119 | lcd_bitmap: "No" | 10119 | lcd_bitmap: "" |
10120 | </voice> | 10120 | </voice> |
10121 | </phrase> | 10121 | </phrase> |
10122 | <phrase> | 10122 | <phrase> |
10123 | id: LANG_SYSFONT_ON | 10123 | id: LANG_SYSFONT_ON |
10124 | desc: Used in a lot of places | 10124 | desc: deprecated |
10125 | user: | 10125 | user: |
10126 | <source> | 10126 | <source> |
10127 | *: none | 10127 | *: none |
10128 | lcd_bitmap: "On" | 10128 | lcd_bitmap: "" |
10129 | </source> | 10129 | </source> |
10130 | <dest> | 10130 | <dest> |
10131 | *: none | 10131 | *: none |
10132 | lcd_bitmap: "On" | 10132 | lcd_bitmap: "" |
10133 | </dest> | 10133 | </dest> |
10134 | <voice> | 10134 | <voice> |
10135 | *: none | 10135 | *: none |
10136 | lcd_bitmap: "On" | 10136 | lcd_bitmap: "" |
10137 | </voice> | 10137 | </voice> |
10138 | </phrase> | 10138 | </phrase> |
10139 | <phrase> | 10139 | <phrase> |
@@ -10206,206 +10206,206 @@ | |||
10206 | </phrase> | 10206 | </phrase> |
10207 | <phrase> | 10207 | <phrase> |
10208 | id: LANG_SYSFONT_SHUFFLE | 10208 | id: LANG_SYSFONT_SHUFFLE |
10209 | desc: in settings_menu | 10209 | desc: deprecated |
10210 | user: | 10210 | user: |
10211 | <source> | 10211 | <source> |
10212 | *: none | 10212 | *: none |
10213 | lcd_bitmap: "Shuffle" | 10213 | lcd_bitmap: "" |
10214 | </source> | 10214 | </source> |
10215 | <dest> | 10215 | <dest> |
10216 | *: none | 10216 | *: none |
10217 | lcd_bitmap: "Shuffle" | 10217 | lcd_bitmap: "" |
10218 | </dest> | 10218 | </dest> |
10219 | <voice> | 10219 | <voice> |
10220 | *: none | 10220 | *: none |
10221 | lcd_bitmap: "Shuffle" | 10221 | lcd_bitmap: "" |
10222 | </voice> | 10222 | </voice> |
10223 | </phrase> | 10223 | </phrase> |
10224 | <phrase> | 10224 | <phrase> |
10225 | id: LANG_SYSFONT_REPEAT | 10225 | id: LANG_SYSFONT_REPEAT |
10226 | desc: in settings_menu | 10226 | desc: deprecated |
10227 | user: | 10227 | user: |
10228 | <source> | 10228 | <source> |
10229 | *: none | 10229 | *: none |
10230 | lcd_bitmap: "Repeat" | 10230 | lcd_bitmap: "" |
10231 | </source> | 10231 | </source> |
10232 | <dest> | 10232 | <dest> |
10233 | *: none | 10233 | *: none |
10234 | lcd_bitmap: "Repeat" | 10234 | lcd_bitmap: "" |
10235 | </dest> | 10235 | </dest> |
10236 | <voice> | 10236 | <voice> |
10237 | *: none | 10237 | *: none |
10238 | lcd_bitmap: "Repeat" | 10238 | lcd_bitmap: "" |
10239 | </voice> | 10239 | </voice> |
10240 | </phrase> | 10240 | </phrase> |
10241 | <phrase> | 10241 | <phrase> |
10242 | id: LANG_SYSFONT_ALL | 10242 | id: LANG_SYSFONT_ALL |
10243 | desc: repeat playlist once all songs have completed | 10243 | desc: deprecated |
10244 | user: | 10244 | user: |
10245 | <source> | 10245 | <source> |
10246 | *: none | 10246 | *: none |
10247 | lcd_bitmap: "All" | 10247 | lcd_bitmap: "" |
10248 | </source> | 10248 | </source> |
10249 | <dest> | 10249 | <dest> |
10250 | *: none | 10250 | *: none |
10251 | lcd_bitmap: "All" | 10251 | lcd_bitmap: "" |
10252 | </dest> | 10252 | </dest> |
10253 | <voice> | 10253 | <voice> |
10254 | *: none | 10254 | *: none |
10255 | lcd_bitmap: "All" | 10255 | lcd_bitmap: "" |
10256 | </voice> | 10256 | </voice> |
10257 | </phrase> | 10257 | </phrase> |
10258 | <phrase> | 10258 | <phrase> |
10259 | id: LANG_SYSFONT_REPEAT_ONE | 10259 | id: LANG_SYSFONT_REPEAT_ONE |
10260 | desc: repeat one song | 10260 | desc: deprecated |
10261 | user: | 10261 | user: |
10262 | <source> | 10262 | <source> |
10263 | *: none | 10263 | *: none |
10264 | lcd_bitmap: "One" | 10264 | lcd_bitmap: "" |
10265 | </source> | 10265 | </source> |
10266 | <dest> | 10266 | <dest> |
10267 | *: none | 10267 | *: none |
10268 | lcd_bitmap: "One" | 10268 | lcd_bitmap: "" |
10269 | </dest> | 10269 | </dest> |
10270 | <voice> | 10270 | <voice> |
10271 | *: none | 10271 | *: none |
10272 | lcd_bitmap: "One" | 10272 | lcd_bitmap: "" |
10273 | </voice> | 10273 | </voice> |
10274 | </phrase> | 10274 | </phrase> |
10275 | <phrase> | 10275 | <phrase> |
10276 | id: LANG_SYSFONT_REPEAT_AB | 10276 | id: LANG_SYSFONT_REPEAT_AB |
10277 | desc: repeat range from point A to B | 10277 | desc: deprecated |
10278 | user: | 10278 | user: |
10279 | <source> | 10279 | <source> |
10280 | *: none | 10280 | *: none |
10281 | lcd_bitmap: "A-B" | 10281 | lcd_bitmap: "" |
10282 | </source> | 10282 | </source> |
10283 | <dest> | 10283 | <dest> |
10284 | *: none | 10284 | *: none |
10285 | lcd_bitmap: "A-B" | 10285 | lcd_bitmap: "" |
10286 | </dest> | 10286 | </dest> |
10287 | <voice> | 10287 | <voice> |
10288 | *: none | 10288 | *: none |
10289 | lcd_bitmap: "A-B" | 10289 | lcd_bitmap: "" |
10290 | </voice> | 10290 | </voice> |
10291 | </phrase> | 10291 | </phrase> |
10292 | <phrase> | 10292 | <phrase> |
10293 | id: LANG_SYSFONT_FILTER | 10293 | id: LANG_SYSFONT_FILTER |
10294 | desc: setting name for dir filter | 10294 | desc: deprecated |
10295 | user: | 10295 | user: |
10296 | <source> | 10296 | <source> |
10297 | *: none | 10297 | *: none |
10298 | lcd_bitmap: "Show Files" | 10298 | lcd_bitmap: "" |
10299 | </source> | 10299 | </source> |
10300 | <dest> | 10300 | <dest> |
10301 | *: none | 10301 | *: none |
10302 | lcd_bitmap: "Show Files" | 10302 | lcd_bitmap: "" |
10303 | </dest> | 10303 | </dest> |
10304 | <voice> | 10304 | <voice> |
10305 | *: none | 10305 | *: none |
10306 | lcd_bitmap: "Show Files" | 10306 | lcd_bitmap: "" |
10307 | </voice> | 10307 | </voice> |
10308 | </phrase> | 10308 | </phrase> |
10309 | <phrase> | 10309 | <phrase> |
10310 | id: LANG_SYSFONT_FILTER_SUPPORTED | 10310 | id: LANG_SYSFONT_FILTER_SUPPORTED |
10311 | desc: show all file types supported by Rockbox | 10311 | desc: deprecated |
10312 | user: | 10312 | user: |
10313 | <source> | 10313 | <source> |
10314 | *: none | 10314 | *: none |
10315 | lcd_bitmap: "Supported" | 10315 | lcd_bitmap: "" |
10316 | </source> | 10316 | </source> |
10317 | <dest> | 10317 | <dest> |
10318 | *: none | 10318 | *: none |
10319 | lcd_bitmap: "Supported" | 10319 | lcd_bitmap: "" |
10320 | </dest> | 10320 | </dest> |
10321 | <voice> | 10321 | <voice> |
10322 | *: none | 10322 | *: none |
10323 | lcd_bitmap: "Supported" | 10323 | lcd_bitmap: "" |
10324 | </voice> | 10324 | </voice> |
10325 | </phrase> | 10325 | </phrase> |
10326 | <phrase> | 10326 | <phrase> |
10327 | id: LANG_SYSFONT_FILTER_MUSIC | 10327 | id: LANG_SYSFONT_FILTER_MUSIC |
10328 | desc: show only music-related files | 10328 | desc: deprecated |
10329 | user: | 10329 | user: |
10330 | <source> | 10330 | <source> |
10331 | *: none | 10331 | *: none |
10332 | lcd_bitmap: "Music" | 10332 | lcd_bitmap: "" |
10333 | </source> | 10333 | </source> |
10334 | <dest> | 10334 | <dest> |
10335 | *: none | 10335 | *: none |
10336 | lcd_bitmap: "Music" | 10336 | lcd_bitmap: "" |
10337 | </dest> | 10337 | </dest> |
10338 | <voice> | 10338 | <voice> |
10339 | *: none | 10339 | *: none |
10340 | lcd_bitmap: "Music" | 10340 | lcd_bitmap: "" |
10341 | </voice> | 10341 | </voice> |
10342 | </phrase> | 10342 | </phrase> |
10343 | <phrase> | 10343 | <phrase> |
10344 | id: LANG_SYSFONT_FILTER_PLAYLIST | 10344 | id: LANG_SYSFONT_FILTER_PLAYLIST |
10345 | desc: show only playlist | 10345 | desc: deprecated |
10346 | user: | 10346 | user: |
10347 | <source> | 10347 | <source> |
10348 | *: none | 10348 | *: none |
10349 | lcd_bitmap: "Playlists" | 10349 | lcd_bitmap: "" |
10350 | </source> | 10350 | </source> |
10351 | <dest> | 10351 | <dest> |
10352 | *: none | 10352 | *: none |
10353 | lcd_bitmap: "Playlists" | 10353 | lcd_bitmap: "" |
10354 | </dest> | 10354 | </dest> |
10355 | <voice> | 10355 | <voice> |
10356 | *: none | 10356 | *: none |
10357 | lcd_bitmap: "Playlists" | 10357 | lcd_bitmap: "" |
10358 | </voice> | 10358 | </voice> |
10359 | </phrase> | 10359 | </phrase> |
10360 | <phrase> | 10360 | <phrase> |
10361 | id: LANG_SYSFONT_FLIP_DISPLAY | 10361 | id: LANG_SYSFONT_FLIP_DISPLAY |
10362 | desc: in settings_menu, option to turn display+buttos by 180 degreed | 10362 | desc: deprecated |
10363 | user: | 10363 | user: |
10364 | <source> | 10364 | <source> |
10365 | *: none | 10365 | *: none |
10366 | lcd_bitmap: "Upside Down" | 10366 | lcd_bitmap: "" |
10367 | </source> | 10367 | </source> |
10368 | <dest> | 10368 | <dest> |
10369 | *: none | 10369 | *: none |
10370 | lcd_bitmap: "Upside Down" | 10370 | lcd_bitmap: "" |
10371 | </dest> | 10371 | </dest> |
10372 | <voice> | 10372 | <voice> |
10373 | *: none | 10373 | *: none |
10374 | lcd_bitmap: "Upside Down" | 10374 | lcd_bitmap: "" |
10375 | </voice> | 10375 | </voice> |
10376 | </phrase> | 10376 | </phrase> |
10377 | <phrase> | 10377 | <phrase> |
10378 | id: LANG_SYSFONT_SCROLL_BAR | 10378 | id: LANG_SYSFONT_SCROLL_BAR |
10379 | desc: display menu, F3 substitute | 10379 | desc: deprecated |
10380 | user: | 10380 | user: |
10381 | <source> | 10381 | <source> |
10382 | *: none | 10382 | *: none |
10383 | lcd_bitmap: "Scroll Bar" | 10383 | lcd_bitmap: "" |
10384 | </source> | 10384 | </source> |
10385 | <dest> | 10385 | <dest> |
10386 | *: none | 10386 | *: none |
10387 | lcd_bitmap: "Scroll Bar" | 10387 | lcd_bitmap: "" |
10388 | </dest> | 10388 | </dest> |
10389 | <voice> | 10389 | <voice> |
10390 | *: none | 10390 | *: none |
10391 | lcd_bitmap: "Scroll Bar" | 10391 | lcd_bitmap: "" |
10392 | </voice> | 10392 | </voice> |
10393 | </phrase> | 10393 | </phrase> |
10394 | <phrase> | 10394 | <phrase> |
10395 | id: LANG_SYSFONT_STATUS_BAR | 10395 | id: LANG_SYSFONT_STATUS_BAR |
10396 | desc: display menu, F3 substitute | 10396 | desc: deprecated |
10397 | user: | 10397 | user: |
10398 | <source> | 10398 | <source> |
10399 | *: none | 10399 | *: none |
10400 | lcd_bitmap: "Status Bar" | 10400 | lcd_bitmap: "" |
10401 | </source> | 10401 | </source> |
10402 | <dest> | 10402 | <dest> |
10403 | *: none | 10403 | *: none |
10404 | lcd_bitmap: "Status Bar" | 10404 | lcd_bitmap: "" |
10405 | </dest> | 10405 | </dest> |
10406 | <voice> | 10406 | <voice> |
10407 | *: none | 10407 | *: none |
10408 | lcd_bitmap: "Status Bar" | 10408 | lcd_bitmap: "" |
10409 | </voice> | 10409 | </voice> |
10410 | </phrase> | 10410 | </phrase> |
10411 | <phrase> | 10411 | <phrase> |
diff --git a/apps/screens.c b/apps/screens.c index 6654be4961..60b61f779f 100644 --- a/apps/screens.c +++ b/apps/screens.c | |||
@@ -636,158 +636,6 @@ bool pitch_screen(void) | |||
636 | } | 636 | } |
637 | #endif /* HAVE_PITCHSCREEN */ | 637 | #endif /* HAVE_PITCHSCREEN */ |
638 | 638 | ||
639 | #ifdef HAVE_QUICKSCREEN | ||
640 | |||
641 | #define bool_to_int(b)\ | ||
642 | b?1:0 | ||
643 | #define int_to_bool(i)\ | ||
644 | i==0?false:true | ||
645 | |||
646 | static void quick_screen_quick_apply(struct gui_quickscreen *qs) | ||
647 | { | ||
648 | global_settings.playlist_shuffle=int_to_bool(qs->left_option->option); | ||
649 | global_settings.dirfilter=qs->bottom_option->option; | ||
650 | global_settings.repeat_mode=qs->right_option->option; | ||
651 | } | ||
652 | |||
653 | bool quick_screen_quick(int button_enter) | ||
654 | { | ||
655 | bool res, oldshuffle; | ||
656 | struct option_select left_option; | ||
657 | struct option_select bottom_option; | ||
658 | struct option_select right_option; | ||
659 | int oldrepeat, old_x_margin, old_y_margin; | ||
660 | |||
661 | static const struct opt_items left_items[] = { | ||
662 | [0]={ STR(LANG_SYSFONT_OFF) }, | ||
663 | [1]={ STR(LANG_SYSFONT_ON) } | ||
664 | }; | ||
665 | static const struct opt_items bottom_items[] = { | ||
666 | [SHOW_ALL]={ STR(LANG_SYSFONT_ALL) }, | ||
667 | [SHOW_SUPPORTED]={ STR(LANG_SYSFONT_FILTER_SUPPORTED) }, | ||
668 | [SHOW_MUSIC]={ STR(LANG_SYSFONT_FILTER_MUSIC) }, | ||
669 | [SHOW_PLAYLIST]={ STR(LANG_SYSFONT_FILTER_PLAYLIST) }, | ||
670 | }; | ||
671 | static const struct opt_items right_items[] = { | ||
672 | [REPEAT_OFF]={ STR(LANG_SYSFONT_OFF) }, | ||
673 | [REPEAT_ALL]={ STR(LANG_SYSFONT_ALL) }, | ||
674 | [REPEAT_ONE]={ STR(LANG_SYSFONT_REPEAT_ONE) }, | ||
675 | [REPEAT_SHUFFLE]={ STR(LANG_SYSFONT_SHUFFLE) }, | ||
676 | #ifdef AB_REPEAT_ENABLE | ||
677 | [REPEAT_AB]={ STR(LANG_SYSFONT_REPEAT_AB) } | ||
678 | #endif | ||
679 | }; | ||
680 | struct gui_quickscreen qs; | ||
681 | |||
682 | old_x_margin = lcd_getxmargin(); | ||
683 | old_y_margin = lcd_getymargin(); | ||
684 | lcd_setmargins(0, 0); | ||
685 | |||
686 | option_select_init_items(&left_option, | ||
687 | (char *)str(LANG_SYSFONT_SHUFFLE), | ||
688 | bool_to_int(global_settings.playlist_shuffle), | ||
689 | left_items, | ||
690 | 2); | ||
691 | option_select_init_items(&bottom_option, | ||
692 | (char *)str(LANG_SYSFONT_FILTER), | ||
693 | global_settings.dirfilter, | ||
694 | bottom_items, | ||
695 | sizeof(bottom_items)/sizeof(struct opt_items)); | ||
696 | option_select_init_items(&right_option, | ||
697 | (char *)str(LANG_SYSFONT_REPEAT), | ||
698 | global_settings.repeat_mode, | ||
699 | right_items, | ||
700 | sizeof(right_items)/sizeof(struct opt_items)); | ||
701 | |||
702 | gui_quickscreen_init(&qs, &left_option, &bottom_option, &right_option, | ||
703 | &quick_screen_quick_apply); | ||
704 | oldrepeat=global_settings.repeat_mode; | ||
705 | oldshuffle=global_settings.playlist_shuffle; | ||
706 | res=gui_syncquickscreen_run(&qs, button_enter); | ||
707 | if(!res) | ||
708 | { | ||
709 | if ( oldrepeat != global_settings.repeat_mode && | ||
710 | (audio_status() & AUDIO_STATUS_PLAY) ) | ||
711 | audio_flush_and_reload_tracks(); | ||
712 | if(oldshuffle != global_settings.playlist_shuffle | ||
713 | && audio_status() & AUDIO_STATUS_PLAY) | ||
714 | { | ||
715 | #if CONFIG_CODEC == SWCODEC | ||
716 | dsp_set_replaygain(); | ||
717 | #endif | ||
718 | if (global_settings.playlist_shuffle) | ||
719 | playlist_randomise(NULL, current_tick, true); | ||
720 | else | ||
721 | playlist_sort(NULL, true); | ||
722 | } | ||
723 | settings_save(); | ||
724 | } | ||
725 | lcd_setmargins(old_x_margin, old_y_margin); | ||
726 | return(res); | ||
727 | } | ||
728 | |||
729 | #ifdef BUTTON_F3 | ||
730 | static void quick_screen_f3_apply(struct gui_quickscreen *qs) | ||
731 | { | ||
732 | global_settings.scrollbar=int_to_bool(qs->left_option->option); | ||
733 | |||
734 | global_settings.flip_display=int_to_bool(qs->bottom_option->option); | ||
735 | button_set_flip(global_settings.flip_display); | ||
736 | lcd_set_flip(global_settings.flip_display); | ||
737 | |||
738 | global_settings.statusbar=int_to_bool(qs->right_option->option); | ||
739 | gui_syncstatusbar_draw(&statusbars, true); | ||
740 | } | ||
741 | |||
742 | bool quick_screen_f3(int button_enter) | ||
743 | { | ||
744 | bool res; | ||
745 | struct option_select left_option; | ||
746 | struct option_select bottom_option; | ||
747 | struct option_select right_option; | ||
748 | int old_x_margin, old_y_margin; | ||
749 | |||
750 | static const struct opt_items onoff_items[] = { | ||
751 | [0]={ STR(LANG_SYSFONT_OFF) }, | ||
752 | [1]={ STR(LANG_SYSFONT_ON) } | ||
753 | }; | ||
754 | static const struct opt_items yesno_items[] = { | ||
755 | [0]={ STR(LANG_SYSFONT_SET_BOOL_NO) }, | ||
756 | [1]={ STR(LANG_SYSFONT_SET_BOOL_YES) } | ||
757 | }; | ||
758 | |||
759 | struct gui_quickscreen qs; | ||
760 | |||
761 | old_x_margin = lcd_getxmargin(); | ||
762 | old_y_margin = lcd_getymargin(); | ||
763 | lcd_setmargins(0, 0); | ||
764 | |||
765 | option_select_init_items(&left_option, | ||
766 | str(LANG_SYSFONT_SCROLL_BAR), | ||
767 | bool_to_int(global_settings.scrollbar), | ||
768 | onoff_items, | ||
769 | 2); | ||
770 | option_select_init_items(&bottom_option, | ||
771 | str(LANG_SYSFONT_FLIP_DISPLAY), | ||
772 | bool_to_int(global_settings.flip_display), | ||
773 | yesno_items, | ||
774 | 2); | ||
775 | option_select_init_items(&right_option, | ||
776 | str(LANG_SYSFONT_STATUS_BAR), | ||
777 | bool_to_int(global_settings.statusbar), | ||
778 | onoff_items, | ||
779 | 2); | ||
780 | gui_quickscreen_init(&qs, &left_option, &bottom_option, &right_option, | ||
781 | &quick_screen_f3_apply); | ||
782 | res=gui_syncquickscreen_run(&qs, button_enter); | ||
783 | if(!res) | ||
784 | settings_save(); | ||
785 | lcd_setmargins(old_x_margin, old_y_margin); | ||
786 | return(res); | ||
787 | } | ||
788 | #endif /* BUTTON_F3 */ | ||
789 | #endif /* CONFIG_KEYPAD in (RECORDER_PAD |IRIVER_H100_PAD | IRIVER_H300_PAD) */ | ||
790 | |||
791 | #if CONFIG_CHARGING | 639 | #if CONFIG_CHARGING |
792 | void charging_splash(void) | 640 | void charging_splash(void) |
793 | { | 641 | { |
diff --git a/apps/screens.h b/apps/screens.h index 4d7704f7d5..8037900846 100644 --- a/apps/screens.h +++ b/apps/screens.h | |||
@@ -40,11 +40,6 @@ int mmc_remove_request(void); | |||
40 | bool pitch_screen(void); | 40 | bool pitch_screen(void); |
41 | #endif | 41 | #endif |
42 | 42 | ||
43 | #ifdef BUTTON_F3 | ||
44 | extern bool quick_screen_f3(int button_enter); | ||
45 | #endif | ||
46 | extern bool quick_screen_quick(int button_enter); | ||
47 | |||
48 | #if CONFIG_RTC | 43 | #if CONFIG_RTC |
49 | bool set_time_screen(const char* title, struct tm *tm); | 44 | bool set_time_screen(const char* title, struct tm *tm); |
50 | #endif | 45 | #endif |
diff --git a/apps/settings.c b/apps/settings.c index 26b9434ba4..5d148effe8 100644 --- a/apps/settings.c +++ b/apps/settings.c | |||
@@ -1000,7 +1000,20 @@ const struct settings_list* find_setting(void* variable, int *id) | |||
1000 | } | 1000 | } |
1001 | return NULL; | 1001 | return NULL; |
1002 | } | 1002 | } |
1003 | 1003 | const struct settings_list* find_setting_from_string(char* setting, int *id) | |
1004 | { | ||
1005 | int i; | ||
1006 | for(i=0;i<nb_settings;i++) | ||
1007 | { | ||
1008 | if (settings[i].cfg_name && !strcmp(setting, settings[i].cfg_name)) | ||
1009 | { | ||
1010 | if (id) | ||
1011 | *id = i; | ||
1012 | return &settings[i]; | ||
1013 | } | ||
1014 | } | ||
1015 | return NULL; | ||
1016 | } | ||
1004 | void talk_setting(void *global_settings_variable) | 1017 | void talk_setting(void *global_settings_variable) |
1005 | { | 1018 | { |
1006 | const struct settings_list *setting; | 1019 | const struct settings_list *setting; |
diff --git a/apps/settings.h b/apps/settings.h index bdbe8d922e..5ac40fc901 100644 --- a/apps/settings.h +++ b/apps/settings.h | |||
@@ -224,6 +224,7 @@ void settings_display(void); | |||
224 | enum optiontype { INT, BOOL }; | 224 | enum optiontype { INT, BOOL }; |
225 | 225 | ||
226 | const struct settings_list* find_setting(void* variable, int *id); | 226 | const struct settings_list* find_setting(void* variable, int *id); |
227 | const struct settings_list* find_setting_from_string(char* setting, int *id); | ||
227 | bool cfg_int_to_string(int setting_id, int val, char* buf, int buf_len); | 228 | bool cfg_int_to_string(int setting_id, int val, char* buf, int buf_len); |
228 | void talk_setting(void *global_settings_variable); | 229 | void talk_setting(void *global_settings_variable); |
229 | bool set_sound(const unsigned char * string, | 230 | bool set_sound(const unsigned char * string, |
@@ -725,6 +726,11 @@ struct user_settings | |||
725 | int keyclick_repeats; /* keyclick on repeats */ | 726 | int keyclick_repeats; /* keyclick on repeats */ |
726 | #endif | 727 | #endif |
727 | unsigned char playlist_catalog_dir[MAX_FILENAME+1]; | 728 | unsigned char playlist_catalog_dir[MAX_FILENAME+1]; |
729 | |||
730 | unsigned char quickscreen_left[MAX_FILENAME+1]; | ||
731 | unsigned char quickscreen_right[MAX_FILENAME+1]; | ||
732 | unsigned char quickscreen_top[MAX_FILENAME+1]; | ||
733 | unsigned char quickscreen_bottom[MAX_FILENAME+1]; | ||
728 | }; | 734 | }; |
729 | 735 | ||
730 | /** global variables **/ | 736 | /** global variables **/ |
diff --git a/apps/settings_list.c b/apps/settings_list.c index 5dc3b9ec60..478bc6365d 100644 --- a/apps/settings_list.c +++ b/apps/settings_list.c | |||
@@ -1188,7 +1188,15 @@ const struct settings_list settings[] = { | |||
1188 | OFFON_SETTING(0, keyclick_repeats, LANG_KEYCLICK_REPEATS, false, "keyclick repeats", NULL), | 1188 | OFFON_SETTING(0, keyclick_repeats, LANG_KEYCLICK_REPEATS, false, "keyclick repeats", NULL), |
1189 | #endif /* CONFIG_CODEC == SWCODEC */ | 1189 | #endif /* CONFIG_CODEC == SWCODEC */ |
1190 | FILENAME_SETTING(0, playlist_catalog_dir, "playlist catalog directory", | 1190 | FILENAME_SETTING(0, playlist_catalog_dir, "playlist catalog directory", |
1191 | PLAYLIST_CATALOG_DEFAULT_DIR, NULL, NULL, MAX_FILENAME+1), | 1191 | PLAYLIST_CATALOG_DEFAULT_DIR, NULL, NULL, MAX_FILENAME+1), |
1192 | FILENAME_SETTING(0, quickscreen_left, "quickscreen left", | ||
1193 | "shuffle", NULL, NULL, MAX_FILENAME+1), | ||
1194 | FILENAME_SETTING(0, quickscreen_right, "quickscreen right", | ||
1195 | "repeat", NULL, NULL, MAX_FILENAME+1), | ||
1196 | FILENAME_SETTING(0, quickscreen_top, "quickscreen top", | ||
1197 | "", NULL, NULL, MAX_FILENAME+1), | ||
1198 | FILENAME_SETTING(0, quickscreen_bottom, "quickscreen bottom", | ||
1199 | "show files", NULL, NULL, MAX_FILENAME+1), | ||
1192 | }; | 1200 | }; |
1193 | 1201 | ||
1194 | const int nb_settings = sizeof(settings)/sizeof(*settings); | 1202 | const int nb_settings = sizeof(settings)/sizeof(*settings); |
diff --git a/apps/tree.c b/apps/tree.c index 5c4b752751..f70c07ca15 100644 --- a/apps/tree.c +++ b/apps/tree.c | |||
@@ -77,6 +77,7 @@ | |||
77 | #include "buttonbar.h" | 77 | #include "buttonbar.h" |
78 | #include "textarea.h" | 78 | #include "textarea.h" |
79 | #include "action.h" | 79 | #include "action.h" |
80 | #include "quickscreen.h" | ||
80 | 81 | ||
81 | #include "root_menu.h" | 82 | #include "root_menu.h" |
82 | 83 | ||