diff options
author | Jonathan Gordon <rockbox@jdgordon.info> | 2008-05-03 12:30:40 +0000 |
---|---|---|
committer | Jonathan Gordon <rockbox@jdgordon.info> | 2008-05-03 12:30:40 +0000 |
commit | ea664e06476cb572bab2eadbb9c060902a95a34a (patch) | |
tree | e76c631343fcc744a24f7f244bf3d3bb73c8192c | |
parent | 6be91cdc8b90184cf6ee623358222c1268f31c25 (diff) | |
download | rockbox-ea664e06476cb572bab2eadbb9c060902a95a34a.tar.gz rockbox-ea664e06476cb572bab2eadbb9c060902a95a34a.zip |
Viewported quickscreen (take 2 :D) (FS#8553)
- no customization support
- no top item
- much better use of the screen
- deprecates 20 odd lang strings (the QS can now use the regular lang strings and user font)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17315 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/SOURCES | 2 | ||||
-rw-r--r-- | apps/gui/gwps.c | 1 | ||||
-rw-r--r-- | apps/gui/option_select.c | 104 | ||||
-rw-r--r-- | apps/gui/option_select.h | 6 | ||||
-rw-r--r-- | apps/gui/quickscreen.c | 361 | ||||
-rw-r--r-- | apps/gui/quickscreen.h | 47 | ||||
-rw-r--r-- | apps/lang/english.lang | 120 | ||||
-rw-r--r-- | apps/menu.c | 1 | ||||
-rw-r--r-- | apps/screens.c | 152 | ||||
-rw-r--r-- | apps/screens.h | 5 | ||||
-rw-r--r-- | apps/tree.c | 1 |
11 files changed, 394 insertions, 406 deletions
diff --git a/apps/SOURCES b/apps/SOURCES index 4a3da0c04a..c4a1cb67bb 100644 --- a/apps/SOURCES +++ b/apps/SOURCES | |||
@@ -60,7 +60,9 @@ gui/bitmap/list.c | |||
60 | gui/charcell/list.c | 60 | gui/charcell/list.c |
61 | #endif | 61 | #endif |
62 | gui/option_select.c | 62 | gui/option_select.c |
63 | #ifdef HAVE_QUICKSCREEN | ||
63 | gui/quickscreen.c | 64 | gui/quickscreen.c |
65 | #endif | ||
64 | gui/scrollbar.c | 66 | gui/scrollbar.c |
65 | gui/splash.c | 67 | gui/splash.c |
66 | gui/statusbar.c | 68 | gui/statusbar.c |
diff --git a/apps/gui/gwps.c b/apps/gui/gwps.c index 0520357002..2e72813d73 100644 --- a/apps/gui/gwps.c +++ b/apps/gui/gwps.c | |||
@@ -57,6 +57,7 @@ | |||
57 | #include "ata_idle_notify.h" | 57 | #include "ata_idle_notify.h" |
58 | #include "root_menu.h" | 58 | #include "root_menu.h" |
59 | #include "backdrop.h" | 59 | #include "backdrop.h" |
60 | #include "quickscreen.h" | ||
60 | 61 | ||
61 | /* currently only on wps_state is needed */ | 62 | /* currently only on wps_state is needed */ |
62 | struct wps_state wps_state; | 63 | struct wps_state wps_state; |
diff --git a/apps/gui/option_select.c b/apps/gui/option_select.c index c6136ebf17..43b5fa6ea1 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,56 +210,37 @@ static int option_talk(int selected_item, void * data) | |||
210 | } | 210 | } |
211 | return 0; | 211 | return 0; |
212 | } | 212 | } |
213 | #if 0 | ||
214 | int option_select_next_val(struct settings_list *setting, | ||
215 | intptr_t temp_var) | ||
216 | { | ||
217 | int val = 0; | ||
218 | if ((setting->flags & F_BOOL_SETTING) == F_BOOL_SETTING) | ||
219 | { | ||
220 | val = (bool)temp_var ? 0 : 1; | ||
221 | } | ||
222 | else if ((setting->flags & F_INT_SETTING) == F_INT_SETTING) | ||
223 | { | ||
224 | struct int_setting *info = setting->int_setting; | ||
225 | val = (int)temp_var + info->step; | ||
226 | if (val > info->max) | ||
227 | val = info->min; | ||
228 | } | ||
229 | else if ((setting->flags & F_T_SOUND) == F_T_SOUND) | ||
230 | { | ||
231 | int setting_id = setting->sound_setting->setting; | ||
232 | int steps = sound_steps(setting_id); | ||
233 | int min = sound_min(setting_id); | ||
234 | int max = sound_max(setting_id); | ||
235 | val = (int)temp_var + steps; | ||
236 | if (val > max) | ||
237 | val = min; | ||
238 | } | ||
239 | else if ((setting->flags & F_CHOICE_SETTING) == F_CHOICE_SETTING) | ||
240 | { | ||
241 | struct choice_setting *info = setting->choice_setting; | ||
242 | val = (int)temp_var; | ||
243 | if (val > info->count) | ||
244 | val = 0; | ||
245 | } | ||
246 | return val; | ||
247 | } | ||
248 | 213 | ||
249 | int option_select_prev_val(struct settings_list *setting, | 214 | #ifdef HAVE_QUICKSCREEN /* only the quickscreen uses this so far */ |
250 | intptr_t temp_var) | 215 | void option_select_next_val(struct settings_list *setting, |
216 | bool previous, bool apply) | ||
251 | { | 217 | { |
252 | int val = 0; | 218 | int val = 0; |
219 | int *value = setting->setting; | ||
253 | if ((setting->flags & F_BOOL_SETTING) == F_BOOL_SETTING) | 220 | if ((setting->flags & F_BOOL_SETTING) == F_BOOL_SETTING) |
254 | { | 221 | { |
255 | val = (bool)temp_var ? 0 : 1; | 222 | *(bool*)value = !*(bool*)value; |
223 | if (apply && setting->bool_setting->option_callback) | ||
224 | setting->bool_setting->option_callback(*(bool*)value); | ||
225 | return; | ||
256 | } | 226 | } |
257 | else if ((setting->flags & F_INT_SETTING) == F_INT_SETTING) | 227 | else if ((setting->flags & F_INT_SETTING) == F_INT_SETTING) |
258 | { | 228 | { |
259 | struct int_setting *info = setting->int_setting; | 229 | struct int_setting *info = (struct int_setting *)setting->int_setting; |
260 | val = (int)temp_var - info->step; | 230 | if (!previous) |
261 | if (val < info->min) | 231 | { |
262 | val = info->max; | 232 | val = *value + info->step; |
233 | if (val > info->max) | ||
234 | val = info->min; | ||
235 | } | ||
236 | else | ||
237 | { | ||
238 | val = *value - info->step; | ||
239 | if (val < info->min) | ||
240 | val = info->max; | ||
241 | } | ||
242 | if (apply && info->option_callback) | ||
243 | info->option_callback(*(int*)value); | ||
263 | } | 244 | } |
264 | else if ((setting->flags & F_T_SOUND) == F_T_SOUND) | 245 | else if ((setting->flags & F_T_SOUND) == F_T_SOUND) |
265 | { | 246 | { |
@@ -267,18 +248,39 @@ int option_select_prev_val(struct settings_list *setting, | |||
267 | int steps = sound_steps(setting_id); | 248 | int steps = sound_steps(setting_id); |
268 | int min = sound_min(setting_id); | 249 | int min = sound_min(setting_id); |
269 | int max = sound_max(setting_id); | 250 | int max = sound_max(setting_id); |
270 | val = (int)temp_var -+ steps; | 251 | if (!previous) |
271 | if (val < min) | 252 | { |
272 | val = max; | 253 | val = *value + steps; |
254 | if (val >= max) | ||
255 | val = min; | ||
256 | } | ||
257 | else | ||
258 | { | ||
259 | val = *value - steps; | ||
260 | if (val < min) | ||
261 | val = max; | ||
262 | } | ||
273 | } | 263 | } |
274 | else if ((setting->flags & F_CHOICE_SETTING) == F_CHOICE_SETTING) | 264 | else if ((setting->flags & F_CHOICE_SETTING) == F_CHOICE_SETTING) |
275 | { | 265 | { |
276 | struct choice_setting *info = setting->choice_setting; | 266 | struct choice_setting *info = (struct choice_setting *)setting->choice_setting; |
277 | val = (int)temp_var; | 267 | val = *value + 1; |
278 | if (val < 0) | 268 | if (!previous) |
279 | val = info->count - 1; | 269 | { |
270 | val = *value + 1; | ||
271 | if (val >= info->count) | ||
272 | val = 0; | ||
273 | } | ||
274 | else | ||
275 | { | ||
276 | val = *value - 1; | ||
277 | if (val < 0) | ||
278 | val = info->count-1; | ||
279 | } | ||
280 | if (apply && info->option_callback) | ||
281 | info->option_callback(*(int*)value); | ||
280 | } | 282 | } |
281 | return val; | 283 | *value = val; |
282 | } | 284 | } |
283 | #endif | 285 | #endif |
284 | 286 | ||
diff --git a/apps/gui/option_select.h b/apps/gui/option_select.h index bb609346a3..8b43af1e5a 100644 --- a/apps/gui/option_select.h +++ b/apps/gui/option_select.h | |||
@@ -69,4 +69,10 @@ extern void option_select_next(struct option_select * opt); | |||
69 | extern void option_select_prev(struct option_select * opt); | 69 | extern void option_select_prev(struct option_select * opt); |
70 | 70 | ||
71 | 71 | ||
72 | |||
73 | void option_select_next_val(struct settings_list *setting, | ||
74 | bool previous, bool apply); | ||
75 | char *option_get_valuestring(struct settings_list *setting, | ||
76 | char *buffer, int buf_len, | ||
77 | intptr_t temp_var); | ||
72 | #endif /* _GUI_OPTION_SELECT_H_ */ | 78 | #endif /* _GUI_OPTION_SELECT_H_ */ |
diff --git a/apps/gui/quickscreen.c b/apps/gui/quickscreen.c index c2da5879fe..8668e9b085 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. |
@@ -17,11 +17,9 @@ | |||
17 | * | 17 | * |
18 | ****************************************************************************/ | 18 | ****************************************************************************/ |
19 | 19 | ||
20 | #include "quickscreen.h" | ||
21 | |||
22 | #ifdef HAVE_QUICKSCREEN | ||
23 | 20 | ||
24 | #include <stdio.h> | 21 | #include <stdio.h> |
22 | #include "config.h" | ||
25 | #include "system.h" | 23 | #include "system.h" |
26 | #include "icons.h" | 24 | #include "icons.h" |
27 | #include "textarea.h" | 25 | #include "textarea.h" |
@@ -30,109 +28,199 @@ | |||
30 | #include "misc.h" | 28 | #include "misc.h" |
31 | #include "statusbar.h" | 29 | #include "statusbar.h" |
32 | #include "action.h" | 30 | #include "action.h" |
31 | #include "settings_list.h" | ||
32 | #include "lang.h" | ||
33 | #include "playlist.h" | ||
34 | #include "dsp.h" | ||
35 | #include "viewport.h" | ||
36 | #include "audio.h" | ||
37 | #include "quickscreen.h" | ||
33 | 38 | ||
34 | void gui_quickscreen_init(struct gui_quickscreen * qs, | 39 | static struct viewport vps[NB_SCREENS][QUICKSCREEN_ITEM_COUNT]; |
35 | struct option_select *left_option, | 40 | static struct viewport vp_icons[NB_SCREENS]; |
36 | struct option_select *bottom_option, | 41 | /* vp_icons will be used like this: |
37 | struct option_select *right_option, | 42 | the side icons will be aligned to the top of this vp and to their sides |
38 | quickscreen_callback callback) | 43 | the bottom icon wil be aligned center and at the bottom of this vp */ |
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 | 44 | ||
46 | /* | 45 | #define MIN_LINES 4 |
47 | * Draws the quickscreen on a given screen | 46 | #define MAX_NEEDED_LINES 8 |
48 | * - qs : the quickscreen | 47 | #define CENTER_MARGIN 10 /* pixels between the 2 center items minimum */ |
49 | * - display : the screen to draw on | 48 | #define CENTER_ICONAREA_WIDTH (CENTER_MARGIN+8*2) |
50 | */ | 49 | |
51 | static void gui_quickscreen_draw(struct gui_quickscreen * qs, struct screen * display) | 50 | static void quickscreen_fix_viewports(struct gui_quickscreen *qs, |
51 | struct screen *display, | ||
52 | struct viewport *parent) | ||
52 | { | 53 | { |
53 | const unsigned char *option; | 54 | int char_height, i, screen = display->screen_type; |
54 | const unsigned char *title; | 55 | int left_width, right_width, bottom_lines = 3; |
55 | int w, font_h; | 56 | unsigned char *s; |
56 | bool statusbar = global_settings.statusbar; | 57 | int nb_lines = viewport_get_nb_lines(parent); |
57 | #ifdef HAS_BUTTONBAR | 58 | char_height = parent->height/nb_lines; |
58 | display->has_buttonbar=false; | 59 | |
59 | #endif | 60 | vp_icons[screen] = *parent; |
60 | gui_textarea_clear(display); | 61 | |
61 | if (display->height / display->char_height < 7) /* we need at leats 7 lines */ | 62 | vps[screen][QUICKSCREEN_BOTTOM] = *parent; |
63 | if (nb_lines <= MIN_LINES) /* make the bottom item use 1 line */ | ||
64 | bottom_lines = 1; | ||
65 | else | ||
66 | bottom_lines = 2; | ||
67 | vps[screen][QUICKSCREEN_BOTTOM].height = bottom_lines*char_height; | ||
68 | vps[screen][QUICKSCREEN_BOTTOM].y = parent->y + parent->height - bottom_lines*char_height; | ||
69 | if (nb_lines >= MAX_NEEDED_LINES) | ||
62 | { | 70 | { |
63 | display->setfont(FONT_SYSFIXED); | 71 | vps[screen][QUICKSCREEN_BOTTOM].y -= char_height; |
64 | } | 72 | } |
65 | display->getstringsize("A", NULL, &font_h); | 73 | |
66 | 74 | /* adjust the left/right items widths to fit the screen nicely */ | |
67 | /* do these calculations once */ | 75 | s = P2STR(ID2P(qs->items[QUICKSCREEN_LEFT]->lang_id)); |
68 | const unsigned int puts_center = display->height/2/font_h; | 76 | left_width = display->getstringsize(s, NULL, NULL); |
69 | const unsigned int puts_bottom = display->height/font_h; | 77 | s = P2STR(ID2P(qs->items[QUICKSCREEN_RIGHT]->lang_id)); |
70 | const unsigned int putsxy_center = display->height/2; | 78 | right_width = display->getstringsize(s, NULL, NULL); |
71 | const unsigned int putsxy_bottom = display->height; | 79 | nb_lines -= bottom_lines; |
72 | 80 | ||
73 | /* Displays the first line of text */ | 81 | vps[screen][QUICKSCREEN_LEFT] = *parent; |
74 | option=(unsigned char *)option_select_get_text(qs->left_option); | 82 | vps[screen][QUICKSCREEN_RIGHT] = *parent; |
75 | title=(unsigned char *)qs->left_option->title; | 83 | vps[screen][QUICKSCREEN_LEFT].x = parent->x; |
76 | display->puts_scroll(2, puts_center-4+!statusbar, title); | 84 | if (nb_lines <= MIN_LINES) |
77 | display->puts_scroll(2, puts_center-3+!statusbar, option); | 85 | i = 0; |
78 | display->mono_bitmap(bitmap_icons_7x8[Icon_FastBackward], 1, | 86 | else |
79 | putsxy_center-(font_h*3), 7, 8); | 87 | i = nb_lines/2; |
80 | 88 | vps[screen][QUICKSCREEN_LEFT].y = parent->y + (i*char_height); | |
81 | /* Displays the second line of text */ | 89 | vps[screen][QUICKSCREEN_RIGHT].y = parent->y + (i*char_height); |
82 | option=(unsigned char *)option_select_get_text(qs->right_option); | 90 | if (nb_lines >= 3) |
83 | title=(unsigned char *)qs->right_option->title; | 91 | i = 3*char_height; |
84 | display->getstringsize(title, &w, NULL); | 92 | else |
85 | if(w > display->width - 8) | 93 | i = nb_lines*char_height; |
94 | |||
95 | vps[screen][QUICKSCREEN_LEFT].height = i; | ||
96 | vps[screen][QUICKSCREEN_RIGHT].height = i; | ||
97 | vp_icons[screen].y = vps[screen][QUICKSCREEN_LEFT].y + (char_height/2); | ||
98 | vp_icons[screen].height = vps[screen][QUICKSCREEN_BOTTOM].y - vp_icons[screen].y; | ||
99 | |||
100 | if (left_width + right_width > display->width - CENTER_MARGIN) /* scrolling needed */ | ||
86 | { | 101 | { |
87 | display->puts_scroll(2, puts_center-2+!statusbar, title); | 102 | int width = (parent->width - CENTER_ICONAREA_WIDTH)/2; |
88 | display->mono_bitmap(bitmap_icons_7x8[Icon_FastForward], 1, | 103 | vps[screen][QUICKSCREEN_LEFT].width = width; |
89 | putsxy_center-font_h, 7, 8); | 104 | vps[screen][QUICKSCREEN_RIGHT].width = width; |
105 | vps[screen][QUICKSCREEN_RIGHT].x = parent->x+parent->width - width; | ||
106 | vp_icons[screen].x = parent->x + width; | ||
107 | vp_icons[screen].width = CENTER_ICONAREA_WIDTH; | ||
90 | } | 108 | } |
91 | else | 109 | else |
92 | { | 110 | { |
93 | display->putsxy(display->width - w - 12, putsxy_center-font_h, title); | 111 | int width, pad = 0; |
94 | display->mono_bitmap(bitmap_icons_7x8[Icon_FastForward], | 112 | if (left_width > right_width) |
95 | display->width - 8, putsxy_center-font_h, 7, 8); | 113 | width = left_width; |
114 | else | ||
115 | width = right_width; | ||
116 | width += CENTER_MARGIN; | ||
117 | if (width*2 < parent->width/2) | ||
118 | { | ||
119 | width += parent->width/6; | ||
120 | /* add some padding on the edges */ | ||
121 | pad = CENTER_MARGIN; | ||
122 | } | ||
123 | vps[screen][QUICKSCREEN_LEFT].width = width; | ||
124 | vps[screen][QUICKSCREEN_RIGHT].width = width; | ||
125 | vps[screen][QUICKSCREEN_RIGHT].x = parent->x + parent->width - width; | ||
126 | vp_icons[screen].x = parent->x + width; | ||
127 | if (pad) | ||
128 | { | ||
129 | vp_icons[screen].x += pad; | ||
130 | vps[screen][QUICKSCREEN_LEFT].x += pad; | ||
131 | vps[screen][QUICKSCREEN_RIGHT].x -= pad; | ||
132 | /* need to add the pad to the bottom to make it all centered nicely */ | ||
133 | vps[screen][QUICKSCREEN_BOTTOM].x += pad; | ||
134 | vps[screen][QUICKSCREEN_BOTTOM].width -= pad; | ||
135 | } | ||
136 | vp_icons[screen].width = vps[screen][QUICKSCREEN_RIGHT].x - width; | ||
137 | |||
96 | } | 138 | } |
97 | display->getstringsize(option, &w, NULL); | 139 | } |
98 | if(w > display->width) | ||
99 | display->puts_scroll(0, puts_center-1+!statusbar, option); | ||
100 | else | ||
101 | display->putsxy(display->width -w-12, putsxy_center, option); | ||
102 | |||
103 | /* Displays the third line of text */ | ||
104 | option=(unsigned char *)option_select_get_text(qs->bottom_option); | ||
105 | title=(unsigned char *)qs->bottom_option->title; | ||
106 | |||
107 | display->getstringsize(title, &w, NULL); | ||
108 | if(w > display->width) | ||
109 | display->puts_scroll(0, puts_bottom-4+!statusbar, title); | ||
110 | else | ||
111 | display->putsxy(display->width/2-w/2, putsxy_bottom-(font_h*3), title); | ||
112 | 140 | ||
113 | display->getstringsize(option, &w, NULL); | 141 | static void quickscreen_draw_text(char *s, int item, bool title, |
114 | if(w > display->width) | 142 | struct screen *display, struct viewport *vp) |
115 | display->puts_scroll(0, puts_bottom-3+!statusbar, option); | 143 | { |
144 | int nb_lines = viewport_get_nb_lines(vp); | ||
145 | int w, h, line = 0, x=0; | ||
146 | display->getstringsize(s, &w, &h); | ||
147 | |||
148 | if (nb_lines > 1 && !title) | ||
149 | line = 1; | ||
150 | switch (item) | ||
151 | { | ||
152 | case QUICKSCREEN_BOTTOM: | ||
153 | x = (vp->width - w)/2; | ||
154 | break; | ||
155 | case QUICKSCREEN_LEFT: | ||
156 | x = 0; | ||
157 | break; | ||
158 | case QUICKSCREEN_RIGHT: | ||
159 | x = vp->width - w; | ||
160 | break; | ||
161 | } | ||
162 | if (w>vp->width) | ||
163 | display->puts_scroll(0,line,s); | ||
116 | else | 164 | else |
117 | display->putsxy(display->width/2-w/2, putsxy_bottom-(font_h*2), option); | 165 | display->putsxy(x, line*h, 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 | } | 166 | } |
124 | 167 | ||
125 | /* | 168 | static void gui_quickscreen_draw(struct gui_quickscreen *qs, |
126 | * Draws the quickscreen on all available screens | 169 | struct screen *display, |
127 | * - qs : the quickscreen | 170 | struct viewport *parent) |
128 | */ | ||
129 | static void gui_syncquickscreen_draw(struct gui_quickscreen * qs) | ||
130 | { | 171 | { |
131 | int i; | 172 | int i; |
132 | FOR_NB_SCREENS(i) | 173 | char buf[MAX_PATH]; |
133 | gui_quickscreen_draw(qs, &screens[i]); | 174 | unsigned char *title, *value; |
175 | void *setting; | ||
176 | int temp; | ||
177 | display->set_viewport(parent); | ||
178 | display->clear_viewport(); | ||
179 | for (i=0; i<QUICKSCREEN_ITEM_COUNT; i++) | ||
180 | { | ||
181 | |||
182 | if (!qs->items[i]) | ||
183 | continue; | ||
184 | display->set_viewport(&vps[display->screen_type][i]); | ||
185 | display->scroll_stop(&vps[display->screen_type][i]); | ||
186 | |||
187 | title = P2STR(ID2P(qs->items[i]->lang_id)); | ||
188 | setting = qs->items[i]->setting; | ||
189 | if ((qs->items[i]->flags & F_BOOL_SETTING) == F_BOOL_SETTING) | ||
190 | temp = *(bool*)setting?1:0; | ||
191 | else | ||
192 | temp = *(int*)setting; | ||
193 | value = option_get_valuestring((struct settings_list*)qs->items[i], buf, MAX_PATH, temp); | ||
194 | |||
195 | if (vps[display->screen_type][i].height < display->char_height*2) | ||
196 | { | ||
197 | char text[MAX_PATH]; | ||
198 | snprintf(text, MAX_PATH, "%s: %s", title, value); | ||
199 | quickscreen_draw_text(text, i, true, display, &vps[display->screen_type][i]); | ||
200 | } | ||
201 | else | ||
202 | { | ||
203 | quickscreen_draw_text(title, i, true, display, &vps[display->screen_type][i]); | ||
204 | quickscreen_draw_text(value, i, false, display, &vps[display->screen_type][i]); | ||
205 | } | ||
206 | display->update_viewport(); | ||
207 | } | ||
208 | /* draw the icons */ | ||
209 | display->set_viewport(&vp_icons[display->screen_type]); | ||
210 | display->mono_bitmap(bitmap_icons_7x8[Icon_FastForward], | ||
211 | vp_icons[display->screen_type].width - 8, 0, 7, 8); | ||
212 | display->mono_bitmap(bitmap_icons_7x8[Icon_FastBackward], 0, 0, 7, 8); | ||
213 | display->mono_bitmap(bitmap_icons_7x8[Icon_DownArrow], | ||
214 | (vp_icons[display->screen_type].width/2) - 4, | ||
215 | vp_icons[display->screen_type].height - 7, 7, 8); | ||
216 | display->update_viewport(); | ||
217 | |||
218 | display->set_viewport(parent); | ||
219 | display->update_viewport(); | ||
220 | display->set_viewport(NULL); | ||
134 | } | 221 | } |
135 | 222 | ||
223 | |||
136 | /* | 224 | /* |
137 | * Does the actions associated to the given button if any | 225 | * Does the actions associated to the given button if any |
138 | * - qs : the quickscreen | 226 | * - qs : the quickscreen |
@@ -141,48 +229,60 @@ static void gui_syncquickscreen_draw(struct gui_quickscreen * qs) | |||
141 | */ | 229 | */ |
142 | static bool gui_quickscreen_do_button(struct gui_quickscreen * qs, int button) | 230 | static bool gui_quickscreen_do_button(struct gui_quickscreen * qs, int button) |
143 | { | 231 | { |
144 | 232 | int item; | |
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 | item = QUICKSCREEN_LEFT; |
149 | return(true); | 237 | break; |
150 | 238 | ||
151 | case ACTION_QS_DOWN: | 239 | case ACTION_QS_DOWN: |
152 | option_select_next(qs->bottom_option); | 240 | case ACTION_QS_DOWNINV: |
153 | return(true); | 241 | item = QUICKSCREEN_BOTTOM; |
242 | break; | ||
154 | 243 | ||
155 | case ACTION_QS_RIGHT: | 244 | case ACTION_QS_RIGHT: |
156 | option_select_next(qs->right_option); | 245 | item = QUICKSCREEN_RIGHT; |
157 | return(true); | 246 | break; |
158 | 247 | ||
159 | case ACTION_QS_DOWNINV: | 248 | default: |
160 | option_select_prev(qs->bottom_option); | 249 | return false; |
161 | return(true); | ||
162 | } | 250 | } |
163 | return(false); | 251 | option_select_next_val((struct settings_list *)qs->items[item], false, true); |
252 | return true; | ||
164 | } | 253 | } |
165 | 254 | ||
166 | bool gui_syncquickscreen_run(struct gui_quickscreen * qs, int button_enter) | 255 | bool gui_syncquickscreen_run(struct gui_quickscreen * qs, int button_enter) |
167 | { | 256 | { |
168 | int button; | 257 | int button, i; |
258 | struct viewport vp[NB_SCREENS]; | ||
259 | bool changed = false; | ||
169 | /* To quit we need either : | 260 | /* To quit we need either : |
170 | * - a second press on the button that made us enter | 261 | * - a second press on the button that made us enter |
171 | * - an action taken while pressing the enter button, | 262 | * - an action taken while pressing the enter button, |
172 | * then release the enter button*/ | 263 | * then release the enter button*/ |
173 | bool can_quit=false; | 264 | bool can_quit=false; |
174 | gui_syncquickscreen_draw(qs); | ||
175 | gui_syncstatusbar_draw(&statusbars, true); | 265 | gui_syncstatusbar_draw(&statusbars, true); |
266 | FOR_NB_SCREENS(i) | ||
267 | { | ||
268 | screens[i].set_viewport(NULL); | ||
269 | screens[i].stop_scroll(); | ||
270 | viewport_set_defaults(&vp[i], i); | ||
271 | quickscreen_fix_viewports(qs, &screens[i], &vp[i]); | ||
272 | gui_quickscreen_draw(qs, &screens[i], &vp[i]); | ||
273 | } | ||
176 | while (true) { | 274 | while (true) { |
177 | button = get_action(CONTEXT_QUICKSCREEN,TIMEOUT_BLOCK); | 275 | button = get_action(CONTEXT_QUICKSCREEN,TIMEOUT_BLOCK); |
178 | if(default_event_handler(button) == SYS_USB_CONNECTED) | 276 | if(default_event_handler(button) == SYS_USB_CONNECTED) |
179 | return(true); | 277 | return(true); |
180 | if(gui_quickscreen_do_button(qs, button)) | 278 | if(gui_quickscreen_do_button(qs, button)) |
181 | { | 279 | { |
280 | changed = true; | ||
182 | can_quit=true; | 281 | can_quit=true; |
183 | if(qs->callback) | 282 | FOR_NB_SCREENS(i) |
283 | gui_quickscreen_draw(qs, &screens[i], &vp[i]); | ||
284 | if (qs->callback) | ||
184 | qs->callback(qs); | 285 | qs->callback(qs); |
185 | gui_syncquickscreen_draw(qs); | ||
186 | } | 286 | } |
187 | else if(button==button_enter) | 287 | else if(button==button_enter) |
188 | can_quit=true; | 288 | can_quit=true; |
@@ -195,8 +295,57 @@ bool gui_syncquickscreen_run(struct gui_quickscreen * qs, int button_enter) | |||
195 | 295 | ||
196 | gui_syncstatusbar_draw(&statusbars, false); | 296 | gui_syncstatusbar_draw(&statusbars, false); |
197 | } | 297 | } |
198 | return false; | 298 | return changed; |
299 | } | ||
300 | |||
301 | bool quick_screen_quick(int button_enter) | ||
302 | { | ||
303 | struct gui_quickscreen qs; | ||
304 | bool oldshuffle = global_settings.playlist_shuffle; | ||
305 | int oldrepeat = global_settings.repeat_mode; | ||
306 | qs.items[QUICKSCREEN_LEFT] = find_setting(&global_settings.playlist_shuffle, NULL); | ||
307 | qs.items[QUICKSCREEN_RIGHT] = find_setting(&global_settings.repeat_mode, NULL); | ||
308 | qs.items[QUICKSCREEN_BOTTOM] = find_setting(&global_settings.dirfilter, NULL); | ||
309 | qs.callback = NULL; | ||
310 | if (gui_syncquickscreen_run(&qs, button_enter)) | ||
311 | { | ||
312 | settings_save(); | ||
313 | settings_apply(false); | ||
314 | /* make sure repeat/shuffle/any other nasty ones get updated */ | ||
315 | if ( oldrepeat != global_settings.repeat_mode && | ||
316 | (audio_status() & AUDIO_STATUS_PLAY) ) | ||
317 | { | ||
318 | audio_flush_and_reload_tracks(); | ||
319 | } | ||
320 | if (oldshuffle != global_settings.playlist_shuffle | ||
321 | && audio_status() & AUDIO_STATUS_PLAY) | ||
322 | { | ||
323 | #if CONFIG_CODEC == SWCODEC | ||
324 | dsp_set_replaygain(); | ||
325 | #endif | ||
326 | if (global_settings.playlist_shuffle) | ||
327 | playlist_randomise(NULL, current_tick, true); | ||
328 | else | ||
329 | playlist_sort(NULL, true); | ||
330 | } | ||
331 | } | ||
332 | return(0); | ||
199 | } | 333 | } |
200 | 334 | ||
201 | #endif /* HAVE_QUICKSCREEN */ | 335 | #ifdef BUTTON_F3 |
336 | bool quick_screen_f3(int button_enter) | ||
337 | { | ||
338 | struct gui_quickscreen qs; | ||
339 | qs.items[QUICKSCREEN_LEFT] = find_setting(&global_settings.scrollbar, NULL); | ||
340 | qs.items[QUICKSCREEN_RIGHT] = find_setting(&global_settings.statusbar, NULL); | ||
341 | qs.items[QUICKSCREEN_BOTTOM] = find_setting(&global_settings.flip_display, NULL); | ||
342 | qs.callback = NULL; | ||
343 | if (gui_syncquickscreen_run(&qs, button_enter)) | ||
344 | { | ||
345 | settings_save(); | ||
346 | settings_apply(false); | ||
347 | } | ||
348 | return(0); | ||
349 | } | ||
350 | #endif /* BUTTON_F3 */ | ||
202 | 351 | ||
diff --git a/apps/gui/quickscreen.h b/apps/gui/quickscreen.h index 179d619883..47361bd472 100644 --- a/apps/gui/quickscreen.h +++ b/apps/gui/quickscreen.h | |||
@@ -27,45 +27,28 @@ | |||
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_BOTTOM, |
34 | */ | 34 | QUICKSCREEN_ITEM_COUNT, |
35 | typedef void (quickscreen_callback)(struct gui_quickscreen * qs); | 35 | }; |
36 | 36 | ||
37 | struct gui_quickscreen | 37 | struct gui_quickscreen |
38 | { | 38 | { |
39 | struct option_select *left_option; | 39 | const struct settings_list *items[QUICKSCREEN_ITEM_COUNT]; |
40 | struct option_select *bottom_option; | 40 | void (*callback)(struct gui_quickscreen * qs); /* called after a |
41 | struct option_select *right_option; | 41 | item is changed */ |
42 | quickscreen_callback *callback; | ||
43 | }; | 42 | }; |
44 | 43 | ||
45 | /* | 44 | bool gui_syncquickscreen_run(struct gui_quickscreen * qs, int button_enter); |
46 | * Initializes a quickscreen | 45 | |
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 | 46 | ||
47 | #ifdef BUTTON_F3 | ||
48 | extern bool quick_screen_f3(int button_enter); | ||
49 | #endif | ||
50 | extern bool quick_screen_quick(int button_enter); | ||
61 | 51 | ||
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); | ||
69 | 52 | ||
70 | #endif /*_GUI_QUICK_SCREEN_H_*/ | 53 | #endif /*_GUI_QUICK_SCREEN_H_*/ |
71 | #endif /* HAVE_QUICKSCREEN */ | 54 | #endif /* HAVE_QUICKSCREEN */ |
diff --git a/apps/lang/english.lang b/apps/lang/english.lang index f4550bad09..eb19bcef3b 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang | |||
@@ -10089,53 +10089,53 @@ | |||
10089 | </phrase> | 10089 | </phrase> |
10090 | <phrase> | 10090 | <phrase> |
10091 | id: LANG_SYSFONT_SET_BOOL_YES | 10091 | id: LANG_SYSFONT_SET_BOOL_YES |
10092 | desc: bool true representation | 10092 | desc: deprecated |
10093 | user: | 10093 | user: |
10094 | <source> | 10094 | <source> |
10095 | *: none | 10095 | *: none |
10096 | lcd_bitmap: "Yes" | 10096 | lcd_bitmap: "" |
10097 | </source> | 10097 | </source> |
10098 | <dest> | 10098 | <dest> |
10099 | *: none | 10099 | *: none |
10100 | lcd_bitmap: "Yes" | 10100 | lcd_bitmap: "" |
10101 | </dest> | 10101 | </dest> |
10102 | <voice> | 10102 | <voice> |
10103 | *: none | 10103 | *: none |
10104 | lcd_bitmap: "Yes" | 10104 | lcd_bitmap: "" |
10105 | </voice> | 10105 | </voice> |
10106 | </phrase> | 10106 | </phrase> |
10107 | <phrase> | 10107 | <phrase> |
10108 | id: LANG_SYSFONT_SET_BOOL_NO | 10108 | id: LANG_SYSFONT_SET_BOOL_NO |
10109 | desc: bool false representation | 10109 | desc: deprecated |
10110 | user: | 10110 | user: |
10111 | <source> | 10111 | <source> |
10112 | *: none | 10112 | *: none |
10113 | lcd_bitmap: "No" | 10113 | lcd_bitmap: "" |
10114 | </source> | 10114 | </source> |
10115 | <dest> | 10115 | <dest> |
10116 | *: none | 10116 | *: none |
10117 | lcd_bitmap: "No" | 10117 | lcd_bitmap: "" |
10118 | </dest> | 10118 | </dest> |
10119 | <voice> | 10119 | <voice> |
10120 | *: none | 10120 | *: none |
10121 | lcd_bitmap: "No" | 10121 | lcd_bitmap: "" |
10122 | </voice> | 10122 | </voice> |
10123 | </phrase> | 10123 | </phrase> |
10124 | <phrase> | 10124 | <phrase> |
10125 | id: LANG_SYSFONT_ON | 10125 | id: LANG_SYSFONT_ON |
10126 | desc: Used in a lot of places | 10126 | desc: deprecated |
10127 | user: | 10127 | user: |
10128 | <source> | 10128 | <source> |
10129 | *: none | 10129 | *: none |
10130 | lcd_bitmap: "On" | 10130 | lcd_bitmap: "" |
10131 | </source> | 10131 | </source> |
10132 | <dest> | 10132 | <dest> |
10133 | *: none | 10133 | *: none |
10134 | lcd_bitmap: "On" | 10134 | lcd_bitmap: "" |
10135 | </dest> | 10135 | </dest> |
10136 | <voice> | 10136 | <voice> |
10137 | *: none | 10137 | *: none |
10138 | lcd_bitmap: "On" | 10138 | lcd_bitmap: "" |
10139 | </voice> | 10139 | </voice> |
10140 | </phrase> | 10140 | </phrase> |
10141 | <phrase> | 10141 | <phrase> |
@@ -10208,206 +10208,206 @@ | |||
10208 | </phrase> | 10208 | </phrase> |
10209 | <phrase> | 10209 | <phrase> |
10210 | id: LANG_SYSFONT_SHUFFLE | 10210 | id: LANG_SYSFONT_SHUFFLE |
10211 | desc: in settings_menu | 10211 | desc: deprecated |
10212 | user: | 10212 | user: |
10213 | <source> | 10213 | <source> |
10214 | *: none | 10214 | *: none |
10215 | lcd_bitmap: "Shuffle" | 10215 | lcd_bitmap: "" |
10216 | </source> | 10216 | </source> |
10217 | <dest> | 10217 | <dest> |
10218 | *: none | 10218 | *: none |
10219 | lcd_bitmap: "Shuffle" | 10219 | lcd_bitmap: "" |
10220 | </dest> | 10220 | </dest> |
10221 | <voice> | 10221 | <voice> |
10222 | *: none | 10222 | *: none |
10223 | lcd_bitmap: "Shuffle" | 10223 | lcd_bitmap: "" |
10224 | </voice> | 10224 | </voice> |
10225 | </phrase> | 10225 | </phrase> |
10226 | <phrase> | 10226 | <phrase> |
10227 | id: LANG_SYSFONT_REPEAT | 10227 | id: LANG_SYSFONT_REPEAT |
10228 | desc: in settings_menu | 10228 | desc: deprecated |
10229 | user: | 10229 | user: |
10230 | <source> | 10230 | <source> |
10231 | *: none | 10231 | *: none |
10232 | lcd_bitmap: "Repeat" | 10232 | lcd_bitmap: "" |
10233 | </source> | 10233 | </source> |
10234 | <dest> | 10234 | <dest> |
10235 | *: none | 10235 | *: none |
10236 | lcd_bitmap: "Repeat" | 10236 | lcd_bitmap: "" |
10237 | </dest> | 10237 | </dest> |
10238 | <voice> | 10238 | <voice> |
10239 | *: none | 10239 | *: none |
10240 | lcd_bitmap: "Repeat" | 10240 | lcd_bitmap: "" |
10241 | </voice> | 10241 | </voice> |
10242 | </phrase> | 10242 | </phrase> |
10243 | <phrase> | 10243 | <phrase> |
10244 | id: LANG_SYSFONT_ALL | 10244 | id: LANG_SYSFONT_ALL |
10245 | desc: repeat playlist once all songs have completed | 10245 | desc: deprecated |
10246 | user: | 10246 | user: |
10247 | <source> | 10247 | <source> |
10248 | *: none | 10248 | *: none |
10249 | lcd_bitmap: "All" | 10249 | lcd_bitmap: "" |
10250 | </source> | 10250 | </source> |
10251 | <dest> | 10251 | <dest> |
10252 | *: none | 10252 | *: none |
10253 | lcd_bitmap: "All" | 10253 | lcd_bitmap: "" |
10254 | </dest> | 10254 | </dest> |
10255 | <voice> | 10255 | <voice> |
10256 | *: none | 10256 | *: none |
10257 | lcd_bitmap: "All" | 10257 | lcd_bitmap: "" |
10258 | </voice> | 10258 | </voice> |
10259 | </phrase> | 10259 | </phrase> |
10260 | <phrase> | 10260 | <phrase> |
10261 | id: LANG_SYSFONT_REPEAT_ONE | 10261 | id: LANG_SYSFONT_REPEAT_ONE |
10262 | desc: repeat one song | 10262 | desc: deprecated |
10263 | user: | 10263 | user: |
10264 | <source> | 10264 | <source> |
10265 | *: none | 10265 | *: none |
10266 | lcd_bitmap: "One" | 10266 | lcd_bitmap: "" |
10267 | </source> | 10267 | </source> |
10268 | <dest> | 10268 | <dest> |
10269 | *: none | 10269 | *: none |
10270 | lcd_bitmap: "One" | 10270 | lcd_bitmap: "" |
10271 | </dest> | 10271 | </dest> |
10272 | <voice> | 10272 | <voice> |
10273 | *: none | 10273 | *: none |
10274 | lcd_bitmap: "One" | 10274 | lcd_bitmap: "" |
10275 | </voice> | 10275 | </voice> |
10276 | </phrase> | 10276 | </phrase> |
10277 | <phrase> | 10277 | <phrase> |
10278 | id: LANG_SYSFONT_REPEAT_AB | 10278 | id: LANG_SYSFONT_REPEAT_AB |
10279 | desc: repeat range from point A to B | 10279 | desc: deprecated |
10280 | user: | 10280 | user: |
10281 | <source> | 10281 | <source> |
10282 | *: none | 10282 | *: none |
10283 | lcd_bitmap: "A-B" | 10283 | lcd_bitmap: "" |
10284 | </source> | 10284 | </source> |
10285 | <dest> | 10285 | <dest> |
10286 | *: none | 10286 | *: none |
10287 | lcd_bitmap: "A-B" | 10287 | lcd_bitmap: "" |
10288 | </dest> | 10288 | </dest> |
10289 | <voice> | 10289 | <voice> |
10290 | *: none | 10290 | *: none |
10291 | lcd_bitmap: "A-B" | 10291 | lcd_bitmap: "" |
10292 | </voice> | 10292 | </voice> |
10293 | </phrase> | 10293 | </phrase> |
10294 | <phrase> | 10294 | <phrase> |
10295 | id: LANG_SYSFONT_FILTER | 10295 | id: LANG_SYSFONT_FILTER |
10296 | desc: setting name for dir filter | 10296 | desc: deprecated |
10297 | user: | 10297 | user: |
10298 | <source> | 10298 | <source> |
10299 | *: none | 10299 | *: none |
10300 | lcd_bitmap: "Show Files" | 10300 | lcd_bitmap: "" |
10301 | </source> | 10301 | </source> |
10302 | <dest> | 10302 | <dest> |
10303 | *: none | 10303 | *: none |
10304 | lcd_bitmap: "Show Files" | 10304 | lcd_bitmap: "" |
10305 | </dest> | 10305 | </dest> |
10306 | <voice> | 10306 | <voice> |
10307 | *: none | 10307 | *: none |
10308 | lcd_bitmap: "Show Files" | 10308 | lcd_bitmap: "" |
10309 | </voice> | 10309 | </voice> |
10310 | </phrase> | 10310 | </phrase> |
10311 | <phrase> | 10311 | <phrase> |
10312 | id: LANG_SYSFONT_FILTER_SUPPORTED | 10312 | id: LANG_SYSFONT_FILTER_SUPPORTED |
10313 | desc: show all file types supported by Rockbox | 10313 | desc: deprecated |
10314 | user: | 10314 | user: |
10315 | <source> | 10315 | <source> |
10316 | *: none | 10316 | *: none |
10317 | lcd_bitmap: "Supported" | 10317 | lcd_bitmap: "" |
10318 | </source> | 10318 | </source> |
10319 | <dest> | 10319 | <dest> |
10320 | *: none | 10320 | *: none |
10321 | lcd_bitmap: "Supported" | 10321 | lcd_bitmap: "" |
10322 | </dest> | 10322 | </dest> |
10323 | <voice> | 10323 | <voice> |
10324 | *: none | 10324 | *: none |
10325 | lcd_bitmap: "Supported" | 10325 | lcd_bitmap: "" |
10326 | </voice> | 10326 | </voice> |
10327 | </phrase> | 10327 | </phrase> |
10328 | <phrase> | 10328 | <phrase> |
10329 | id: LANG_SYSFONT_FILTER_MUSIC | 10329 | id: LANG_SYSFONT_FILTER_MUSIC |
10330 | desc: show only music-related files | 10330 | desc: deprecated |
10331 | user: | 10331 | user: |
10332 | <source> | 10332 | <source> |
10333 | *: none | 10333 | *: none |
10334 | lcd_bitmap: "Music" | 10334 | lcd_bitmap: "" |
10335 | </source> | 10335 | </source> |
10336 | <dest> | 10336 | <dest> |
10337 | *: none | 10337 | *: none |
10338 | lcd_bitmap: "Music" | 10338 | lcd_bitmap: "" |
10339 | </dest> | 10339 | </dest> |
10340 | <voice> | 10340 | <voice> |
10341 | *: none | 10341 | *: none |
10342 | lcd_bitmap: "Music" | 10342 | lcd_bitmap: "" |
10343 | </voice> | 10343 | </voice> |
10344 | </phrase> | 10344 | </phrase> |
10345 | <phrase> | 10345 | <phrase> |
10346 | id: LANG_SYSFONT_FILTER_PLAYLIST | 10346 | id: LANG_SYSFONT_FILTER_PLAYLIST |
10347 | desc: show only playlist | 10347 | desc: deprecated |
10348 | user: | 10348 | user: |
10349 | <source> | 10349 | <source> |
10350 | *: none | 10350 | *: none |
10351 | lcd_bitmap: "Playlists" | 10351 | lcd_bitmap: "" |
10352 | </source> | 10352 | </source> |
10353 | <dest> | 10353 | <dest> |
10354 | *: none | 10354 | *: none |
10355 | lcd_bitmap: "Playlists" | 10355 | lcd_bitmap: "" |
10356 | </dest> | 10356 | </dest> |
10357 | <voice> | 10357 | <voice> |
10358 | *: none | 10358 | *: none |
10359 | lcd_bitmap: "Playlists" | 10359 | lcd_bitmap: "" |
10360 | </voice> | 10360 | </voice> |
10361 | </phrase> | 10361 | </phrase> |
10362 | <phrase> | 10362 | <phrase> |
10363 | id: LANG_SYSFONT_FLIP_DISPLAY | 10363 | id: LANG_SYSFONT_FLIP_DISPLAY |
10364 | desc: in settings_menu, option to turn display+buttos by 180 degreed | 10364 | desc: deprecated |
10365 | user: | 10365 | user: |
10366 | <source> | 10366 | <source> |
10367 | *: none | 10367 | *: none |
10368 | lcd_bitmap: "Upside Down" | 10368 | lcd_bitmap: "" |
10369 | </source> | 10369 | </source> |
10370 | <dest> | 10370 | <dest> |
10371 | *: none | 10371 | *: none |
10372 | lcd_bitmap: "Upside Down" | 10372 | lcd_bitmap: "" |
10373 | </dest> | 10373 | </dest> |
10374 | <voice> | 10374 | <voice> |
10375 | *: none | 10375 | *: none |
10376 | lcd_bitmap: "Upside Down" | 10376 | lcd_bitmap: "" |
10377 | </voice> | 10377 | </voice> |
10378 | </phrase> | 10378 | </phrase> |
10379 | <phrase> | 10379 | <phrase> |
10380 | id: LANG_SYSFONT_SCROLL_BAR | 10380 | id: LANG_SYSFONT_SCROLL_BAR |
10381 | desc: display menu, F3 substitute | 10381 | desc: deprecated |
10382 | user: | 10382 | user: |
10383 | <source> | 10383 | <source> |
10384 | *: none | 10384 | *: none |
10385 | lcd_bitmap: "Scroll Bar" | 10385 | lcd_bitmap: "" |
10386 | </source> | 10386 | </source> |
10387 | <dest> | 10387 | <dest> |
10388 | *: none | 10388 | *: none |
10389 | lcd_bitmap: "Scroll Bar" | 10389 | lcd_bitmap: "" |
10390 | </dest> | 10390 | </dest> |
10391 | <voice> | 10391 | <voice> |
10392 | *: none | 10392 | *: none |
10393 | lcd_bitmap: "Scroll Bar" | 10393 | lcd_bitmap: "" |
10394 | </voice> | 10394 | </voice> |
10395 | </phrase> | 10395 | </phrase> |
10396 | <phrase> | 10396 | <phrase> |
10397 | id: LANG_SYSFONT_STATUS_BAR | 10397 | id: LANG_SYSFONT_STATUS_BAR |
10398 | desc: display menu, F3 substitute | 10398 | desc: deprecated |
10399 | user: | 10399 | user: |
10400 | <source> | 10400 | <source> |
10401 | *: none | 10401 | *: none |
10402 | lcd_bitmap: "Status Bar" | 10402 | lcd_bitmap: "" |
10403 | </source> | 10403 | </source> |
10404 | <dest> | 10404 | <dest> |
10405 | *: none | 10405 | *: none |
10406 | lcd_bitmap: "Status Bar" | 10406 | lcd_bitmap: "" |
10407 | </dest> | 10407 | </dest> |
10408 | <voice> | 10408 | <voice> |
10409 | *: none | 10409 | *: none |
10410 | lcd_bitmap: "Status Bar" | 10410 | lcd_bitmap: "" |
10411 | </voice> | 10411 | </voice> |
10412 | </phrase> | 10412 | </phrase> |
10413 | <phrase> | 10413 | <phrase> |
diff --git a/apps/menu.c b/apps/menu.c index e1998ea2f7..bbe3d697dd 100644 --- a/apps/menu.c +++ b/apps/menu.c | |||
@@ -51,6 +51,7 @@ | |||
51 | #include "gwps-common.h" /* for fade() */ | 51 | #include "gwps-common.h" /* for fade() */ |
52 | #include "audio.h" | 52 | #include "audio.h" |
53 | #include "viewport.h" | 53 | #include "viewport.h" |
54 | #include "quickscreen.h" | ||
54 | 55 | ||
55 | #ifdef HAVE_LCD_BITMAP | 56 | #ifdef HAVE_LCD_BITMAP |
56 | #include "icons.h" | 57 | #include "icons.h" |
diff --git a/apps/screens.c b/apps/screens.c index 0855b12002..f9dd49b995 100644 --- a/apps/screens.c +++ b/apps/screens.c | |||
@@ -633,158 +633,6 @@ bool pitch_screen(void) | |||
633 | } | 633 | } |
634 | #endif /* HAVE_PITCHSCREEN */ | 634 | #endif /* HAVE_PITCHSCREEN */ |
635 | 635 | ||
636 | #ifdef HAVE_QUICKSCREEN | ||
637 | |||
638 | #define bool_to_int(b)\ | ||
639 | b?1:0 | ||
640 | #define int_to_bool(i)\ | ||
641 | i==0?false:true | ||
642 | |||
643 | static void quick_screen_quick_apply(struct gui_quickscreen *qs) | ||
644 | { | ||
645 | global_settings.playlist_shuffle=int_to_bool(qs->left_option->option); | ||
646 | global_settings.dirfilter=qs->bottom_option->option; | ||
647 | global_settings.repeat_mode=qs->right_option->option; | ||
648 | } | ||
649 | |||
650 | bool quick_screen_quick(int button_enter) | ||
651 | { | ||
652 | bool res, oldshuffle; | ||
653 | struct option_select left_option; | ||
654 | struct option_select bottom_option; | ||
655 | struct option_select right_option; | ||
656 | int oldrepeat, old_x_margin, old_y_margin; | ||
657 | |||
658 | static const struct opt_items left_items[] = { | ||
659 | [0]={ STR(LANG_SYSFONT_OFF) }, | ||
660 | [1]={ STR(LANG_SYSFONT_ON) } | ||
661 | }; | ||
662 | static const struct opt_items bottom_items[] = { | ||
663 | [SHOW_ALL]={ STR(LANG_SYSFONT_ALL) }, | ||
664 | [SHOW_SUPPORTED]={ STR(LANG_SYSFONT_FILTER_SUPPORTED) }, | ||
665 | [SHOW_MUSIC]={ STR(LANG_SYSFONT_FILTER_MUSIC) }, | ||
666 | [SHOW_PLAYLIST]={ STR(LANG_SYSFONT_FILTER_PLAYLIST) }, | ||
667 | }; | ||
668 | static const struct opt_items right_items[] = { | ||
669 | [REPEAT_OFF]={ STR(LANG_SYSFONT_OFF) }, | ||
670 | [REPEAT_ALL]={ STR(LANG_SYSFONT_ALL) }, | ||
671 | [REPEAT_ONE]={ STR(LANG_SYSFONT_REPEAT_ONE) }, | ||
672 | [REPEAT_SHUFFLE]={ STR(LANG_SYSFONT_SHUFFLE) }, | ||
673 | #ifdef AB_REPEAT_ENABLE | ||
674 | [REPEAT_AB]={ STR(LANG_SYSFONT_REPEAT_AB) } | ||
675 | #endif | ||
676 | }; | ||
677 | struct gui_quickscreen qs; | ||
678 | |||
679 | old_x_margin = lcd_getxmargin(); | ||
680 | old_y_margin = lcd_getymargin(); | ||
681 | lcd_setmargins(0, 0); | ||
682 | |||
683 | option_select_init_items(&left_option, | ||
684 | (char *)str(LANG_SYSFONT_SHUFFLE), | ||
685 | bool_to_int(global_settings.playlist_shuffle), | ||
686 | left_items, | ||
687 | 2); | ||
688 | option_select_init_items(&bottom_option, | ||
689 | (char *)str(LANG_SYSFONT_FILTER), | ||
690 | global_settings.dirfilter, | ||
691 | bottom_items, | ||
692 | sizeof(bottom_items)/sizeof(struct opt_items)); | ||
693 | option_select_init_items(&right_option, | ||
694 | (char *)str(LANG_SYSFONT_REPEAT), | ||
695 | global_settings.repeat_mode, | ||
696 | right_items, | ||
697 | sizeof(right_items)/sizeof(struct opt_items)); | ||
698 | |||
699 | gui_quickscreen_init(&qs, &left_option, &bottom_option, &right_option, | ||
700 | &quick_screen_quick_apply); | ||
701 | oldrepeat=global_settings.repeat_mode; | ||
702 | oldshuffle=global_settings.playlist_shuffle; | ||
703 | res=gui_syncquickscreen_run(&qs, button_enter); | ||
704 | if(!res) | ||
705 | { | ||
706 | if ( oldrepeat != global_settings.repeat_mode && | ||
707 | (audio_status() & AUDIO_STATUS_PLAY) ) | ||
708 | audio_flush_and_reload_tracks(); | ||
709 | if(oldshuffle != global_settings.playlist_shuffle | ||
710 | && audio_status() & AUDIO_STATUS_PLAY) | ||
711 | { | ||
712 | #if CONFIG_CODEC == SWCODEC | ||
713 | dsp_set_replaygain(); | ||
714 | #endif | ||
715 | if (global_settings.playlist_shuffle) | ||
716 | playlist_randomise(NULL, current_tick, true); | ||
717 | else | ||
718 | playlist_sort(NULL, true); | ||
719 | } | ||
720 | settings_save(); | ||
721 | } | ||
722 | lcd_setmargins(old_x_margin, old_y_margin); | ||
723 | return(res); | ||
724 | } | ||
725 | |||
726 | #ifdef BUTTON_F3 | ||
727 | static void quick_screen_f3_apply(struct gui_quickscreen *qs) | ||
728 | { | ||
729 | global_settings.scrollbar=int_to_bool(qs->left_option->option); | ||
730 | |||
731 | global_settings.flip_display=int_to_bool(qs->bottom_option->option); | ||
732 | button_set_flip(global_settings.flip_display); | ||
733 | lcd_set_flip(global_settings.flip_display); | ||
734 | |||
735 | global_settings.statusbar=int_to_bool(qs->right_option->option); | ||
736 | gui_syncstatusbar_draw(&statusbars, true); | ||
737 | } | ||
738 | |||
739 | bool quick_screen_f3(int button_enter) | ||
740 | { | ||
741 | bool res; | ||
742 | struct option_select left_option; | ||
743 | struct option_select bottom_option; | ||
744 | struct option_select right_option; | ||
745 | int old_x_margin, old_y_margin; | ||
746 | |||
747 | static const struct opt_items onoff_items[] = { | ||
748 | [0]={ STR(LANG_SYSFONT_OFF) }, | ||
749 | [1]={ STR(LANG_SYSFONT_ON) } | ||
750 | }; | ||
751 | static const struct opt_items yesno_items[] = { | ||
752 | [0]={ STR(LANG_SYSFONT_SET_BOOL_NO) }, | ||
753 | [1]={ STR(LANG_SYSFONT_SET_BOOL_YES) } | ||
754 | }; | ||
755 | |||
756 | struct gui_quickscreen qs; | ||
757 | |||
758 | old_x_margin = lcd_getxmargin(); | ||
759 | old_y_margin = lcd_getymargin(); | ||
760 | lcd_setmargins(0, 0); | ||
761 | |||
762 | option_select_init_items(&left_option, | ||
763 | str(LANG_SYSFONT_SCROLL_BAR), | ||
764 | bool_to_int(global_settings.scrollbar), | ||
765 | onoff_items, | ||
766 | 2); | ||
767 | option_select_init_items(&bottom_option, | ||
768 | str(LANG_SYSFONT_FLIP_DISPLAY), | ||
769 | bool_to_int(global_settings.flip_display), | ||
770 | yesno_items, | ||
771 | 2); | ||
772 | option_select_init_items(&right_option, | ||
773 | str(LANG_SYSFONT_STATUS_BAR), | ||
774 | bool_to_int(global_settings.statusbar), | ||
775 | onoff_items, | ||
776 | 2); | ||
777 | gui_quickscreen_init(&qs, &left_option, &bottom_option, &right_option, | ||
778 | &quick_screen_f3_apply); | ||
779 | res=gui_syncquickscreen_run(&qs, button_enter); | ||
780 | if(!res) | ||
781 | settings_save(); | ||
782 | lcd_setmargins(old_x_margin, old_y_margin); | ||
783 | return(res); | ||
784 | } | ||
785 | #endif /* BUTTON_F3 */ | ||
786 | #endif /* CONFIG_KEYPAD in (RECORDER_PAD |IRIVER_H100_PAD | IRIVER_H300_PAD) */ | ||
787 | |||
788 | #if CONFIG_CHARGING | 636 | #if CONFIG_CHARGING |
789 | void charging_splash(void) | 637 | void charging_splash(void) |
790 | { | 638 | { |
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/tree.c b/apps/tree.c index d1d9adb3b2..afe76a3dc8 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 | #include "backdrop.h" | 83 | #include "backdrop.h" |