diff options
-rw-r--r-- | apps/gui/bitmap/list.c | 11 | ||||
-rw-r--r-- | apps/gui/charcell/list.c | 10 | ||||
-rw-r--r-- | apps/gui/color_picker.c | 2 | ||||
-rw-r--r-- | apps/gui/list.h | 1 | ||||
-rw-r--r-- | apps/menu.c | 66 | ||||
-rw-r--r-- | apps/menus/main_menu.c | 6 | ||||
-rw-r--r-- | apps/menus/time_menu.c | 13 | ||||
-rw-r--r-- | apps/screens.c | 34 |
8 files changed, 75 insertions, 68 deletions
diff --git a/apps/gui/bitmap/list.c b/apps/gui/bitmap/list.c index 7680c876aa..9e222c1973 100644 --- a/apps/gui/bitmap/list.c +++ b/apps/gui/bitmap/list.c | |||
@@ -51,6 +51,17 @@ int gui_list_get_item_offset(struct gui_synclist * gui_list, int item_width, | |||
51 | struct viewport *vp); | 51 | struct viewport *vp); |
52 | bool list_display_title(struct gui_synclist *list, enum screen_type screen); | 52 | bool list_display_title(struct gui_synclist *list, enum screen_type screen); |
53 | 53 | ||
54 | void gui_synclist_scroll_stop(struct gui_synclist *lists) | ||
55 | { | ||
56 | int i; | ||
57 | FOR_NB_SCREENS(i) | ||
58 | { | ||
59 | screens[i].scroll_stop(&list_text[i]); | ||
60 | screens[i].scroll_stop(&title_text[i]); | ||
61 | screens[i].scroll_stop(lists->parent[i]); | ||
62 | } | ||
63 | } | ||
64 | |||
54 | /* Draw the list... | 65 | /* Draw the list... |
55 | internal screen layout: | 66 | internal screen layout: |
56 | ----------------- | 67 | ----------------- |
diff --git a/apps/gui/charcell/list.c b/apps/gui/charcell/list.c index 2374156f0b..220144c356 100644 --- a/apps/gui/charcell/list.c +++ b/apps/gui/charcell/list.c | |||
@@ -39,6 +39,16 @@ | |||
39 | #include "sound.h" | 39 | #include "sound.h" |
40 | #include "misc.h" | 40 | #include "misc.h" |
41 | 41 | ||
42 | void gui_synclist_scroll_stop(struct gui_synclist *lists) | ||
43 | { | ||
44 | int i; | ||
45 | (void)lists; | ||
46 | FOR_NB_SCREENS(i) | ||
47 | { | ||
48 | screens[i].stop_scroll(); | ||
49 | } | ||
50 | } | ||
51 | |||
42 | void list_draw(struct screen *display, struct gui_synclist *gui_list) | 52 | void list_draw(struct screen *display, struct gui_synclist *gui_list) |
43 | { | 53 | { |
44 | int text_pos; | 54 | int text_pos; |
diff --git a/apps/gui/color_picker.c b/apps/gui/color_picker.c index 09d861245a..f8caf4d38f 100644 --- a/apps/gui/color_picker.c +++ b/apps/gui/color_picker.c | |||
@@ -165,7 +165,7 @@ static void draw_screen(struct screen *display, char *title, | |||
165 | viewport_set_defaults(&vp, display->screen_type); | 165 | viewport_set_defaults(&vp, display->screen_type); |
166 | display->set_viewport(&vp); | 166 | display->set_viewport(&vp); |
167 | 167 | ||
168 | display->clear_display(); | 168 | display->clear_viewport(); |
169 | 169 | ||
170 | if (display->depth > 1) | 170 | if (display->depth > 1) |
171 | { | 171 | { |
diff --git a/apps/gui/list.h b/apps/gui/list.h index ef16c719c1..1d4a6bd5b4 100644 --- a/apps/gui/list.h +++ b/apps/gui/list.h | |||
@@ -160,6 +160,7 @@ extern int gui_synclist_get_nb_items(struct gui_synclist * lists); | |||
160 | extern int gui_synclist_get_sel_pos(struct gui_synclist * lists); | 160 | extern int gui_synclist_get_sel_pos(struct gui_synclist * lists); |
161 | 161 | ||
162 | extern void gui_synclist_draw(struct gui_synclist * lists); | 162 | extern void gui_synclist_draw(struct gui_synclist * lists); |
163 | extern void gui_synclist_scroll_stop(struct gui_synclist *lists); | ||
163 | extern void gui_synclist_select_item(struct gui_synclist * lists, | 164 | extern void gui_synclist_select_item(struct gui_synclist * lists, |
164 | int item_number); | 165 | int item_number); |
165 | extern void gui_synclist_add_item(struct gui_synclist * lists); | 166 | extern void gui_synclist_add_item(struct gui_synclist * lists); |
diff --git a/apps/menu.c b/apps/menu.c index eb29b43f3b..eb4bf0e1c9 100644 --- a/apps/menu.c +++ b/apps/menu.c | |||
@@ -73,7 +73,7 @@ static void get_menu_callback(const struct menu_item_ex *m, | |||
73 | { | 73 | { |
74 | if (m->flags&(MENU_HAS_DESC|MENU_DYNAMIC_DESC)) | 74 | if (m->flags&(MENU_HAS_DESC|MENU_DYNAMIC_DESC)) |
75 | *menu_callback= m->callback_and_desc->menu_callback; | 75 | *menu_callback= m->callback_and_desc->menu_callback; |
76 | else | 76 | else |
77 | *menu_callback = m->menu_callback; | 77 | *menu_callback = m->menu_callback; |
78 | } | 78 | } |
79 | 79 | ||
@@ -101,7 +101,7 @@ static const char* get_menu_item_name(int selected_item, | |||
101 | const struct menu_item_ex *menu = (const struct menu_item_ex *)data; | 101 | const struct menu_item_ex *menu = (const struct menu_item_ex *)data; |
102 | int type = (menu->flags&MENU_TYPE_MASK); | 102 | int type = (menu->flags&MENU_TYPE_MASK); |
103 | selected_item = get_menu_selection(selected_item, menu); | 103 | selected_item = get_menu_selection(selected_item, menu); |
104 | 104 | ||
105 | (void)buffer_len; | 105 | (void)buffer_len; |
106 | /* only MT_MENU or MT_RETURN_ID is allowed in here */ | 106 | /* only MT_MENU or MT_RETURN_ID is allowed in here */ |
107 | if (type == MT_RETURN_ID) | 107 | if (type == MT_RETURN_ID) |
@@ -111,13 +111,13 @@ static const char* get_menu_item_name(int selected_item, | |||
111 | menu->menu_get_name_and_icon->list_get_name_data, buffer); | 111 | menu->menu_get_name_and_icon->list_get_name_data, buffer); |
112 | return menu->strings[selected_item]; | 112 | return menu->strings[selected_item]; |
113 | } | 113 | } |
114 | 114 | ||
115 | menu = menu->submenus[selected_item]; | 115 | menu = menu->submenus[selected_item]; |
116 | 116 | ||
117 | if ((menu->flags&MENU_DYNAMIC_DESC) && (type != MT_SETTING_W_TEXT)) | 117 | if ((menu->flags&MENU_DYNAMIC_DESC) && (type != MT_SETTING_W_TEXT)) |
118 | return menu->menu_get_name_and_icon->list_get_name(selected_item, | 118 | return menu->menu_get_name_and_icon->list_get_name(selected_item, |
119 | menu->menu_get_name_and_icon->list_get_name_data, buffer); | 119 | menu->menu_get_name_and_icon->list_get_name_data, buffer); |
120 | 120 | ||
121 | type = (menu->flags&MENU_TYPE_MASK); | 121 | type = (menu->flags&MENU_TYPE_MASK); |
122 | if ((type == MT_SETTING) || (type == MT_SETTING_W_TEXT)) | 122 | if ((type == MT_SETTING) || (type == MT_SETTING_W_TEXT)) |
123 | { | 123 | { |
@@ -135,7 +135,7 @@ static enum themable_icons menu_get_icon(int selected_item, void * data) | |||
135 | const struct menu_item_ex *menu = (const struct menu_item_ex *)data; | 135 | const struct menu_item_ex *menu = (const struct menu_item_ex *)data; |
136 | int menu_icon = Icon_NOICON; | 136 | int menu_icon = Icon_NOICON; |
137 | selected_item = get_menu_selection(selected_item, menu); | 137 | selected_item = get_menu_selection(selected_item, menu); |
138 | 138 | ||
139 | if ((menu->flags&MENU_TYPE_MASK) == MT_RETURN_ID) | 139 | if ((menu->flags&MENU_TYPE_MASK) == MT_RETURN_ID) |
140 | { | 140 | { |
141 | return Icon_Menu_functioncall; | 141 | return Icon_Menu_functioncall; |
@@ -145,7 +145,7 @@ static enum themable_icons menu_get_icon(int selected_item, void * data) | |||
145 | menu_icon = menu->callback_and_desc->icon_id; | 145 | menu_icon = menu->callback_and_desc->icon_id; |
146 | else if (menu->flags&MENU_DYNAMIC_DESC) | 146 | else if (menu->flags&MENU_DYNAMIC_DESC) |
147 | menu_icon = menu->menu_get_name_and_icon->icon_id; | 147 | menu_icon = menu->menu_get_name_and_icon->icon_id; |
148 | 148 | ||
149 | if (menu_icon == Icon_NOICON) | 149 | if (menu_icon == Icon_NOICON) |
150 | { | 150 | { |
151 | switch (menu->flags&MENU_TYPE_MASK) | 151 | switch (menu->flags&MENU_TYPE_MASK) |
@@ -194,7 +194,7 @@ static void init_menu_lists(const struct menu_item_ex *menu, | |||
194 | current_subitems_count++; | 194 | current_subitems_count++; |
195 | } | 195 | } |
196 | } | 196 | } |
197 | else | 197 | else |
198 | { | 198 | { |
199 | current_subitems[current_subitems_count] = i; | 199 | current_subitems[current_subitems_count] = i; |
200 | current_subitems_count++; | 200 | current_subitems_count++; |
@@ -219,7 +219,7 @@ static void init_menu_lists(const struct menu_item_ex *menu, | |||
219 | gui_synclist_set_nb_items(lists,current_subitems_count); | 219 | gui_synclist_set_nb_items(lists,current_subitems_count); |
220 | gui_synclist_limit_scroll(lists,true); | 220 | gui_synclist_limit_scroll(lists,true); |
221 | gui_synclist_select_item(lists, find_menu_selection(selected)); | 221 | gui_synclist_select_item(lists, find_menu_selection(selected)); |
222 | 222 | ||
223 | get_menu_callback(menu,&menu_callback); | 223 | get_menu_callback(menu,&menu_callback); |
224 | if (callback && menu_callback) | 224 | if (callback && menu_callback) |
225 | menu_callback(ACTION_ENTER_MENUITEM,menu); | 225 | menu_callback(ACTION_ENTER_MENUITEM,menu); |
@@ -234,13 +234,13 @@ static int talk_menu_item(int selected_item, void *data) | |||
234 | int type; | 234 | int type; |
235 | unsigned char *str; | 235 | unsigned char *str; |
236 | int sel = get_menu_selection(selected_item, menu); | 236 | int sel = get_menu_selection(selected_item, menu); |
237 | 237 | ||
238 | if ((menu->flags&MENU_TYPE_MASK) == MT_MENU) | 238 | if ((menu->flags&MENU_TYPE_MASK) == MT_MENU) |
239 | { | 239 | { |
240 | type = menu->submenus[sel]->flags&MENU_TYPE_MASK; | 240 | type = menu->submenus[sel]->flags&MENU_TYPE_MASK; |
241 | if ((type == MT_SETTING) || (type == MT_SETTING_W_TEXT)) | 241 | if ((type == MT_SETTING) || (type == MT_SETTING_W_TEXT)) |
242 | talk_setting(menu->submenus[sel]->variable); | 242 | talk_setting(menu->submenus[sel]->variable); |
243 | else | 243 | else |
244 | { | 244 | { |
245 | if (menu->submenus[sel]->flags&(MENU_DYNAMIC_DESC)) | 245 | if (menu->submenus[sel]->flags&(MENU_DYNAMIC_DESC)) |
246 | { | 246 | { |
@@ -264,7 +264,7 @@ static int talk_menu_item(int selected_item, void *data) | |||
264 | else | 264 | else |
265 | id = P2ID(menu->submenus[sel]->callback_and_desc->desc); | 265 | id = P2ID(menu->submenus[sel]->callback_and_desc->desc); |
266 | if (id != -1) | 266 | if (id != -1) |
267 | talk_id(id,false); | 267 | talk_id(id,false); |
268 | } | 268 | } |
269 | } | 269 | } |
270 | else if(((menu->flags&MENU_TYPE_MASK) == MT_RETURN_ID)) | 270 | else if(((menu->flags&MENU_TYPE_MASK) == MT_RETURN_ID)) |
@@ -285,9 +285,8 @@ void do_setting_from_menu(const struct menu_item_ex *temp, | |||
285 | struct viewport parent[NB_SCREENS]) | 285 | struct viewport parent[NB_SCREENS]) |
286 | { | 286 | { |
287 | int setting_id, oldval; | 287 | int setting_id, oldval; |
288 | const struct settings_list *setting = find_setting( | 288 | const struct settings_list *setting = |
289 | temp->variable, | 289 | find_setting(temp->variable, &setting_id); |
290 | &setting_id); | ||
291 | char *title; | 290 | char *title; |
292 | char padded_title[MAX_PATH]; | 291 | char padded_title[MAX_PATH]; |
293 | int var_type = setting->flags&F_T_MASK; | 292 | int var_type = setting->flags&F_T_MASK; |
@@ -305,7 +304,7 @@ void do_setting_from_menu(const struct menu_item_ex *temp, | |||
305 | title = temp->callback_and_desc->desc; | 304 | title = temp->callback_and_desc->desc; |
306 | else | 305 | else |
307 | title = ID2P(setting->lang_id); | 306 | title = ID2P(setting->lang_id); |
308 | 307 | ||
309 | /* Pad the title string by repeating it. This is needed | 308 | /* Pad the title string by repeating it. This is needed |
310 | so the scroll settings title can actually be used to | 309 | so the scroll settings title can actually be used to |
311 | test the setting */ | 310 | test the setting */ |
@@ -328,7 +327,7 @@ void do_setting_from_menu(const struct menu_item_ex *temp, | |||
328 | padded_title[i] = '\0'; | 327 | padded_title[i] = '\0'; |
329 | title = padded_title; | 328 | title = padded_title; |
330 | } | 329 | } |
331 | 330 | ||
332 | option_screen((struct settings_list *)setting, parent, | 331 | option_screen((struct settings_list *)setting, parent, |
333 | setting->flags&F_TEMPVAR, title); | 332 | setting->flags&F_TEMPVAR, title); |
334 | } | 333 | } |
@@ -345,7 +344,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected, | |||
345 | bool redraw_lists; | 344 | bool redraw_lists; |
346 | FOR_NB_SCREENS(i) | 345 | FOR_NB_SCREENS(i) |
347 | viewportmanager_theme_enable(i, !hide_theme, NULL); | 346 | viewportmanager_theme_enable(i, !hide_theme, NULL); |
348 | 347 | ||
349 | const struct menu_item_ex *menu_stack[MAX_MENUS]; | 348 | const struct menu_item_ex *menu_stack[MAX_MENUS]; |
350 | int menu_stack_selected_item[MAX_MENUS]; | 349 | int menu_stack_selected_item[MAX_MENUS]; |
351 | int stack_top = 0; | 350 | int stack_top = 0; |
@@ -370,7 +369,6 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected, | |||
370 | in_stringlist = ((menu->flags&MENU_TYPE_MASK) == MT_RETURN_ID); | 369 | in_stringlist = ((menu->flags&MENU_TYPE_MASK) == MT_RETURN_ID); |
371 | /* load the callback, and only reload it if menu changes */ | 370 | /* load the callback, and only reload it if menu changes */ |
372 | get_menu_callback(menu, &menu_callback); | 371 | get_menu_callback(menu, &menu_callback); |
373 | |||
374 | 372 | ||
375 | #ifdef HAVE_BUTTONBAR | 373 | #ifdef HAVE_BUTTONBAR |
376 | if (!hide_theme) | 374 | if (!hide_theme) |
@@ -391,7 +389,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected, | |||
391 | action = get_action(CONTEXT_MAINMENU, | 389 | action = get_action(CONTEXT_MAINMENU, |
392 | list_do_action_timeout(&lists, HZ)); | 390 | list_do_action_timeout(&lists, HZ)); |
393 | /* HZ so the status bar redraws corectly */ | 391 | /* HZ so the status bar redraws corectly */ |
394 | 392 | ||
395 | if (menu_callback) | 393 | if (menu_callback) |
396 | { | 394 | { |
397 | int old_action = action; | 395 | int old_action = action; |
@@ -477,11 +475,10 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected, | |||
477 | { | 475 | { |
478 | case GO_TO_PREVIOUS: | 476 | case GO_TO_PREVIOUS: |
479 | break; | 477 | break; |
480 | case 0: /* reset setting */ | 478 | case 0: /* reset setting */ |
481 | reset_setting(setting, setting->setting); | 479 | reset_setting(setting, setting->setting); |
482 | break; | ||
483 | #ifdef HAVE_QUICKSCREEN | ||
484 | break; | 480 | break; |
481 | #ifdef HAVE_QUICKSCREEN | ||
485 | case 1: /* set as top QS item */ | 482 | case 1: /* set as top QS item */ |
486 | set_as_qs_item(setting, QUICKSCREEN_TOP); | 483 | set_as_qs_item(setting, QUICKSCREEN_TOP); |
487 | break; | 484 | break; |
@@ -513,10 +510,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected, | |||
513 | bool exiting_menu = false; | 510 | bool exiting_menu = false; |
514 | in_stringlist = false; | 511 | in_stringlist = false; |
515 | /* might be leaving list, so stop scrolling */ | 512 | /* might be leaving list, so stop scrolling */ |
516 | FOR_NB_SCREENS(i) | 513 | gui_synclist_scroll_stop(&lists); |
517 | { | ||
518 | screens[i].scroll_stop(&vps[i]); | ||
519 | } | ||
520 | if (menu_callback) | 514 | if (menu_callback) |
521 | menu_callback(ACTION_EXIT_MENUITEM, menu); | 515 | menu_callback(ACTION_EXIT_MENUITEM, menu); |
522 | 516 | ||
@@ -546,10 +540,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected, | |||
546 | { | 540 | { |
547 | int type; | 541 | int type; |
548 | /* entering an item that may not be a list, so stop scrolling */ | 542 | /* entering an item that may not be a list, so stop scrolling */ |
549 | FOR_NB_SCREENS(i) | 543 | gui_synclist_scroll_stop(&lists); |
550 | { | ||
551 | screens[i].scroll_stop(&vps[i]); | ||
552 | } | ||
553 | #ifdef HAVE_BUTTONBAR | 544 | #ifdef HAVE_BUTTONBAR |
554 | if (!hide_theme) | 545 | if (!hide_theme) |
555 | { | 546 | { |
@@ -562,7 +553,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected, | |||
562 | redraw_lists = true; | 553 | redraw_lists = true; |
563 | if (in_stringlist) | 554 | if (in_stringlist) |
564 | type = (menu->flags&MENU_TYPE_MASK); | 555 | type = (menu->flags&MENU_TYPE_MASK); |
565 | else | 556 | else |
566 | { | 557 | { |
567 | type = (temp->flags&MENU_TYPE_MASK); | 558 | type = (temp->flags&MENU_TYPE_MASK); |
568 | get_menu_callback(temp, &menu_callback); | 559 | get_menu_callback(temp, &menu_callback); |
@@ -592,7 +583,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected, | |||
592 | if (temp->flags&MENU_FUNC_USEPARAM) | 583 | if (temp->flags&MENU_FUNC_USEPARAM) |
593 | return_value = temp->function->function_w_param( | 584 | return_value = temp->function->function_w_param( |
594 | temp->function->param); | 585 | temp->function->param); |
595 | else | 586 | else |
596 | return_value = temp->function->function(); | 587 | return_value = temp->function->function(); |
597 | if (!(menu->flags&MENU_EXITAFTERTHISMENU) || | 588 | if (!(menu->flags&MENU_EXITAFTERTHISMENU) || |
598 | (temp->flags&MENU_EXITAFTERTHISMENU)) | 589 | (temp->flags&MENU_EXITAFTERTHISMENU)) |
@@ -665,7 +656,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected, | |||
665 | ret = MENU_ATTACHED_USB; | 656 | ret = MENU_ATTACHED_USB; |
666 | done = true; | 657 | done = true; |
667 | } | 658 | } |
668 | 659 | ||
669 | if (redraw_lists && !done) | 660 | if (redraw_lists && !done) |
670 | { | 661 | { |
671 | if (menu_callback) | 662 | if (menu_callback) |
@@ -686,8 +677,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected, | |||
686 | *start_selected = get_menu_selection( | 677 | *start_selected = get_menu_selection( |
687 | gui_synclist_get_sel_pos(&lists), menu); | 678 | gui_synclist_get_sel_pos(&lists), menu); |
688 | } | 679 | } |
689 | FOR_NB_SCREENS(i) | 680 | FOR_NB_SCREENS(i) |
690 | viewportmanager_theme_undo(i, false); | 681 | viewportmanager_theme_undo(i, false); |
691 | return ret; | 682 | return ret; |
692 | } | 683 | } |
693 | |||
diff --git a/apps/menus/main_menu.c b/apps/menus/main_menu.c index 505801d3cc..783490284c 100644 --- a/apps/menus/main_menu.c +++ b/apps/menus/main_menu.c | |||
@@ -415,13 +415,13 @@ static int sleep_timer(void) | |||
415 | 415 | ||
416 | #if CONFIG_RTC | 416 | #if CONFIG_RTC |
417 | int time_screen(void* ignored); | 417 | int time_screen(void* ignored); |
418 | MENUITEM_FUNCTION(timedate_item, MENU_FUNC_CHECK_RETVAL, ID2P(LANG_TIME_MENU), time_screen, | 418 | MENUITEM_FUNCTION(timedate_item, MENU_FUNC_CHECK_RETVAL, ID2P(LANG_TIME_MENU), |
419 | NULL, NULL, Icon_Menu_setting ); | 419 | time_screen, NULL, NULL, Icon_Menu_setting ); |
420 | #endif | 420 | #endif |
421 | /* This item is in the time/date screen if there is a RTC */ | 421 | /* This item is in the time/date screen if there is a RTC */ |
422 | MENUITEM_FUNCTION(sleep_timer_call, 0, ID2P(LANG_SLEEP_TIMER), sleep_timer, | 422 | MENUITEM_FUNCTION(sleep_timer_call, 0, ID2P(LANG_SLEEP_TIMER), sleep_timer, |
423 | NULL, NULL, Icon_Menu_setting); /* make it look like a | 423 | NULL, NULL, Icon_Menu_setting); /* make it look like a |
424 | setting to the user */ | 424 | setting to the user */ |
425 | 425 | ||
426 | MENUITEM_FUNCTION(show_credits_item, 0, ID2P(LANG_CREDITS), | 426 | MENUITEM_FUNCTION(show_credits_item, 0, ID2P(LANG_CREDITS), |
427 | (menu_function)show_credits, NULL, NULL, Icon_NOICON); | 427 | (menu_function)show_credits, NULL, NULL, Icon_NOICON); |
diff --git a/apps/menus/time_menu.c b/apps/menus/time_menu.c index 757ce82928..597f7e0c3a 100644 --- a/apps/menus/time_menu.c +++ b/apps/menus/time_menu.c | |||
@@ -62,10 +62,10 @@ static int timedate_set(void) | |||
62 | #define C2DIG2DEC(x) (S100(x)-100) | 62 | #define C2DIG2DEC(x) (S100(x)-100) |
63 | 63 | ||
64 | tm.tm_hour = 0; | 64 | tm.tm_hour = 0; |
65 | tm.tm_min = 0; | 65 | tm.tm_min = 0; |
66 | tm.tm_sec = 0; | 66 | tm.tm_sec = 0; |
67 | tm.tm_mday = C2DIG2DEC(DAY); | 67 | tm.tm_mday = C2DIG2DEC(DAY); |
68 | tm.tm_mon = C2DIG2DEC(MONTH)-1; | 68 | tm.tm_mon = C2DIG2DEC(MONTH)-1; |
69 | tm.tm_wday = 1; | 69 | tm.tm_wday = 1; |
70 | tm.tm_year = YEAR-1900; | 70 | tm.tm_year = YEAR-1900; |
71 | } | 71 | } |
@@ -193,8 +193,8 @@ static void draw_timedate(struct viewport *vp, struct screen *display) | |||
193 | d = str(LANG_UNKNOWN); | 193 | d = str(LANG_UNKNOWN); |
194 | } | 194 | } |
195 | 195 | ||
196 | display->puts_scroll(0, line++, t); | 196 | display->puts(0, line++, t); |
197 | display->puts_scroll(0, line, d); | 197 | display->puts(0, line, d); |
198 | 198 | ||
199 | display->update_viewport(); | 199 | display->update_viewport(); |
200 | display->set_viewport(NULL); | 200 | display->set_viewport(NULL); |
@@ -284,9 +284,6 @@ int time_screen(void* ignored) | |||
284 | } | 284 | } |
285 | 285 | ||
286 | ret = do_menu(&time_menu, NULL, menu, false); | 286 | ret = do_menu(&time_menu, NULL, menu, false); |
287 | FOR_NB_SCREENS(i) | ||
288 | screens[i].scroll_stop(&clock[i]); | ||
289 | |||
290 | /* see comments above in the button callback */ | 287 | /* see comments above in the button callback */ |
291 | if (!menu_was_pressed && ret == GO_TO_PREVIOUS) | 288 | if (!menu_was_pressed && ret == GO_TO_PREVIOUS) |
292 | return 0; | 289 | return 0; |
diff --git a/apps/screens.c b/apps/screens.c index d997590623..2e7dbd84ed 100644 --- a/apps/screens.c +++ b/apps/screens.c | |||
@@ -345,9 +345,10 @@ static void say_time(int cursorpos, const struct tm *tm) | |||
345 | 345 | ||
346 | bool set_time_screen(const char* title, struct tm *tm) | 346 | bool set_time_screen(const char* title, struct tm *tm) |
347 | { | 347 | { |
348 | bool done = false; | 348 | struct viewport viewports[NB_SCREENS]; |
349 | bool done = false, usb = false; | ||
349 | int cursorpos = 0; | 350 | int cursorpos = 0; |
350 | unsigned int statusbar_height = 0; | 351 | unsigned int s; |
351 | unsigned char offsets_ptr[] = | 352 | unsigned char offsets_ptr[] = |
352 | { OFF_HOURS, OFF_MINUTES, OFF_SECONDS, OFF_YEAR, 0, OFF_DAY }; | 353 | { OFF_HOURS, OFF_MINUTES, OFF_SECONDS, OFF_YEAR, 0, OFF_DAY }; |
353 | 354 | ||
@@ -359,15 +360,16 @@ bool set_time_screen(const char* title, struct tm *tm) | |||
359 | offsets_ptr[IDX_DAY] = OFF_YEAR; | 360 | offsets_ptr[IDX_DAY] = OFF_YEAR; |
360 | } | 361 | } |
361 | 362 | ||
362 | if(global_settings.statusbar) | ||
363 | statusbar_height = STATUSBAR_HEIGHT; | ||
364 | |||
365 | /* speak selection when screen is entered */ | 363 | /* speak selection when screen is entered */ |
366 | say_time(cursorpos, tm); | 364 | say_time(cursorpos, tm); |
367 | 365 | ||
366 | #ifdef HAVE_TOUCHSCREEN | ||
367 | enum touchscreen_mode old_mode = touchscreen_get_mode(); | ||
368 | touchscreen_set_mode(TOUCHSCREEN_BUTTON); | ||
369 | #endif | ||
368 | while (!done) { | 370 | while (!done) { |
369 | int button; | 371 | int button; |
370 | unsigned int i, s, realyear, min, max; | 372 | unsigned int i, realyear, min, max; |
371 | unsigned char *ptr[6]; | 373 | unsigned char *ptr[6]; |
372 | unsigned char buffer[20]; | 374 | unsigned char buffer[20]; |
373 | int *valptr = NULL; | 375 | int *valptr = NULL; |
@@ -413,7 +415,6 @@ bool set_time_screen(const char* title, struct tm *tm) | |||
413 | int pos, nb_lines; | 415 | int pos, nb_lines; |
414 | unsigned int separator_width, weekday_width; | 416 | unsigned int separator_width, weekday_width; |
415 | unsigned int j, width, prev_line_height; | 417 | unsigned int j, width, prev_line_height; |
416 | struct viewport viewports[NB_SCREENS]; | ||
417 | /* 6 possible cursor possitions, 2 values stored for each: x, y */ | 418 | /* 6 possible cursor possitions, 2 values stored for each: x, y */ |
418 | unsigned int cursor[6][2]; | 419 | unsigned int cursor[6][2]; |
419 | struct viewport *vp = &viewports[s]; | 420 | struct viewport *vp = &viewports[s]; |
@@ -453,7 +454,7 @@ bool set_time_screen(const char* title, struct tm *tm) | |||
453 | prev_line_height *= 2; | 454 | prev_line_height *= 2; |
454 | } | 455 | } |
455 | screen->getstringsize(ptr[i], &width, NULL); | 456 | screen->getstringsize(ptr[i], &width, NULL); |
456 | cursor[i][INDEX_Y] = prev_line_height + statusbar_height; | 457 | cursor[i][INDEX_Y] = prev_line_height; |
457 | cursor[i][INDEX_X] = j; | 458 | cursor[i][INDEX_X] = j; |
458 | j += width + separator_width; | 459 | j += width + separator_width; |
459 | } | 460 | } |
@@ -527,15 +528,7 @@ bool set_time_screen(const char* title, struct tm *tm) | |||
527 | break; | 528 | break; |
528 | } | 529 | } |
529 | 530 | ||
530 | #ifdef HAVE_TOUCHSCREEN | ||
531 | enum touchscreen_mode old_mode = touchscreen_get_mode(); | ||
532 | |||
533 | touchscreen_set_mode(TOUCHSCREEN_BUTTON); | ||
534 | #endif | ||
535 | button = get_action(CONTEXT_SETTINGS_TIME, TIMEOUT_BLOCK); | 531 | button = get_action(CONTEXT_SETTINGS_TIME, TIMEOUT_BLOCK); |
536 | #ifdef HAVE_TOUCHSCREEN | ||
537 | touchscreen_set_mode(old_mode); | ||
538 | #endif | ||
539 | switch ( button ) { | 532 | switch ( button ) { |
540 | case ACTION_STD_PREV: | 533 | case ACTION_STD_PREV: |
541 | cursorpos = clamp_value_wrap(--cursorpos, 5, 0); | 534 | cursorpos = clamp_value_wrap(--cursorpos, 5, 0); |
@@ -567,11 +560,16 @@ bool set_time_screen(const char* title, struct tm *tm) | |||
567 | 560 | ||
568 | default: | 561 | default: |
569 | if (default_event_handler(button) == SYS_USB_CONNECTED) | 562 | if (default_event_handler(button) == SYS_USB_CONNECTED) |
570 | return true; | 563 | done = usb = true; |
571 | break; | 564 | break; |
572 | } | 565 | } |
573 | } | 566 | } |
574 | return false; | 567 | FOR_NB_SCREENS(s) |
568 | screens[s].scroll_stop(&viewports[s]); | ||
569 | #ifdef HAVE_TOUCHSCREEN | ||
570 | touchscreen_set_mode(old_mode); | ||
571 | #endif | ||
572 | return usb; | ||
575 | } | 573 | } |
576 | #endif /* defined(HAVE_LCD_BITMAP) && (CONFIG_RTC != 0) */ | 574 | #endif /* defined(HAVE_LCD_BITMAP) && (CONFIG_RTC != 0) */ |
577 | 575 | ||