summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeruaki Kawashima <teru@rockbox.org>2010-02-11 10:41:06 +0000
committerTeruaki Kawashima <teru@rockbox.org>2010-02-11 10:41:06 +0000
commit93f9e7cbfb3905791feccb4da68f6cc969d1e148 (patch)
treefb6e01220844fa1c0a9f92643ccaddb70fcb66b4
parent0a291fff12c27ba6b46521ecaf126bdb4726c24e (diff)
downloadrockbox-93f9e7cbfb3905791feccb4da68f6cc969d1e148.tar.gz
rockbox-93f9e7cbfb3905791feccb4da68f6cc969d1e148.tar.bz2
rockbox-93f9e7cbfb3905791feccb4da68f6cc969d1e148.zip
fix text scrolling handling in do_menu, set_time_screen and time_screen.
Don't scroll text in time_screen(). the lines will be redrawn before scrolling statrs, so they don't scroll anyway. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24591 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/gui/bitmap/list.c11
-rw-r--r--apps/gui/charcell/list.c10
-rw-r--r--apps/gui/color_picker.c2
-rw-r--r--apps/gui/list.h1
-rw-r--r--apps/menu.c66
-rw-r--r--apps/menus/main_menu.c6
-rw-r--r--apps/menus/time_menu.c13
-rw-r--r--apps/screens.c34
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,
struct viewport *vp);
bool list_display_title(struct gui_synclist *list, enum screen_type screen);
+void gui_synclist_scroll_stop(struct gui_synclist *lists)
+{
+ int i;
+ FOR_NB_SCREENS(i)
+ {
+ screens[i].scroll_stop(&list_text[i]);
+ screens[i].scroll_stop(&title_text[i]);
+ screens[i].scroll_stop(lists->parent[i]);
+ }
+}
+
/* Draw the list...
internal screen layout:
-----------------
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 @@
#include "sound.h"
#include "misc.h"
+void gui_synclist_scroll_stop(struct gui_synclist *lists)
+{
+ int i;
+ (void)lists;
+ FOR_NB_SCREENS(i)
+ {
+ screens[i].stop_scroll();
+ }
+}
+
void list_draw(struct screen *display, struct gui_synclist *gui_list)
{
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,
viewport_set_defaults(&vp, display->screen_type);
display->set_viewport(&vp);
- display->clear_display();
+ display->clear_viewport();
if (display->depth > 1)
{
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);
extern int gui_synclist_get_sel_pos(struct gui_synclist * lists);
extern void gui_synclist_draw(struct gui_synclist * lists);
+extern void gui_synclist_scroll_stop(struct gui_synclist *lists);
extern void gui_synclist_select_item(struct gui_synclist * lists,
int item_number);
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,
{
if (m->flags&(MENU_HAS_DESC|MENU_DYNAMIC_DESC))
*menu_callback= m->callback_and_desc->menu_callback;
- else
+ else
*menu_callback = m->menu_callback;
}
@@ -101,7 +101,7 @@ static const char* get_menu_item_name(int selected_item,
const struct menu_item_ex *menu = (const struct menu_item_ex *)data;
int type = (menu->flags&MENU_TYPE_MASK);
selected_item = get_menu_selection(selected_item, menu);
-
+
(void)buffer_len;
/* only MT_MENU or MT_RETURN_ID is allowed in here */
if (type == MT_RETURN_ID)
@@ -111,13 +111,13 @@ static const char* get_menu_item_name(int selected_item,
menu->menu_get_name_and_icon->list_get_name_data, buffer);
return menu->strings[selected_item];
}
-
+
menu = menu->submenus[selected_item];
-
+
if ((menu->flags&MENU_DYNAMIC_DESC) && (type != MT_SETTING_W_TEXT))
return menu->menu_get_name_and_icon->list_get_name(selected_item,
menu->menu_get_name_and_icon->list_get_name_data, buffer);
-
+
type = (menu->flags&MENU_TYPE_MASK);
if ((type == MT_SETTING) || (type == MT_SETTING_W_TEXT))
{
@@ -135,7 +135,7 @@ static enum themable_icons menu_get_icon(int selected_item, void * data)
const struct menu_item_ex *menu = (const struct menu_item_ex *)data;
int menu_icon = Icon_NOICON;
selected_item = get_menu_selection(selected_item, menu);
-
+
if ((menu->flags&MENU_TYPE_MASK) == MT_RETURN_ID)
{
return Icon_Menu_functioncall;
@@ -145,7 +145,7 @@ static enum themable_icons menu_get_icon(int selected_item, void * data)
menu_icon = menu->callback_and_desc->icon_id;
else if (menu->flags&MENU_DYNAMIC_DESC)
menu_icon = menu->menu_get_name_and_icon->icon_id;
-
+
if (menu_icon == Icon_NOICON)
{
switch (menu->flags&MENU_TYPE_MASK)
@@ -194,7 +194,7 @@ static void init_menu_lists(const struct menu_item_ex *menu,
current_subitems_count++;
}
}
- else
+ else
{
current_subitems[current_subitems_count] = i;
current_subitems_count++;
@@ -219,7 +219,7 @@ static void init_menu_lists(const struct menu_item_ex *menu,
gui_synclist_set_nb_items(lists,current_subitems_count);
gui_synclist_limit_scroll(lists,true);
gui_synclist_select_item(lists, find_menu_selection(selected));
-
+
get_menu_callback(menu,&menu_callback);
if (callback && menu_callback)
menu_callback(ACTION_ENTER_MENUITEM,menu);
@@ -234,13 +234,13 @@ static int talk_menu_item(int selected_item, void *data)
int type;
unsigned char *str;
int sel = get_menu_selection(selected_item, menu);
-
+
if ((menu->flags&MENU_TYPE_MASK) == MT_MENU)
{
type = menu->submenus[sel]->flags&MENU_TYPE_MASK;
if ((type == MT_SETTING) || (type == MT_SETTING_W_TEXT))
talk_setting(menu->submenus[sel]->variable);
- else
+ else
{
if (menu->submenus[sel]->flags&(MENU_DYNAMIC_DESC))
{
@@ -264,7 +264,7 @@ static int talk_menu_item(int selected_item, void *data)
else
id = P2ID(menu->submenus[sel]->callback_and_desc->desc);
if (id != -1)
- talk_id(id,false);
+ talk_id(id,false);
}
}
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,
struct viewport parent[NB_SCREENS])
{
int setting_id, oldval;
- const struct settings_list *setting = find_setting(
- temp->variable,
- &setting_id);
+ const struct settings_list *setting =
+ find_setting(temp->variable, &setting_id);
char *title;
char padded_title[MAX_PATH];
int var_type = setting->flags&F_T_MASK;
@@ -305,7 +304,7 @@ void do_setting_from_menu(const struct menu_item_ex *temp,
title = temp->callback_and_desc->desc;
else
title = ID2P(setting->lang_id);
-
+
/* Pad the title string by repeating it. This is needed
so the scroll settings title can actually be used to
test the setting */
@@ -328,7 +327,7 @@ void do_setting_from_menu(const struct menu_item_ex *temp,
padded_title[i] = '\0';
title = padded_title;
}
-
+
option_screen((struct settings_list *)setting, parent,
setting->flags&F_TEMPVAR, title);
}
@@ -345,7 +344,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
bool redraw_lists;
FOR_NB_SCREENS(i)
viewportmanager_theme_enable(i, !hide_theme, NULL);
-
+
const struct menu_item_ex *menu_stack[MAX_MENUS];
int menu_stack_selected_item[MAX_MENUS];
int stack_top = 0;
@@ -370,7 +369,6 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
in_stringlist = ((menu->flags&MENU_TYPE_MASK) == MT_RETURN_ID);
/* load the callback, and only reload it if menu changes */
get_menu_callback(menu, &menu_callback);
-
#ifdef HAVE_BUTTONBAR
if (!hide_theme)
@@ -391,7 +389,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
action = get_action(CONTEXT_MAINMENU,
list_do_action_timeout(&lists, HZ));
/* HZ so the status bar redraws corectly */
-
+
if (menu_callback)
{
int old_action = action;
@@ -477,11 +475,10 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
{
case GO_TO_PREVIOUS:
break;
- case 0: /* reset setting */
- reset_setting(setting, setting->setting);
- break;
-#ifdef HAVE_QUICKSCREEN
+ case 0: /* reset setting */
+ reset_setting(setting, setting->setting);
break;
+#ifdef HAVE_QUICKSCREEN
case 1: /* set as top QS item */
set_as_qs_item(setting, QUICKSCREEN_TOP);
break;
@@ -513,10 +510,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
bool exiting_menu = false;
in_stringlist = false;
/* might be leaving list, so stop scrolling */
- FOR_NB_SCREENS(i)
- {
- screens[i].scroll_stop(&vps[i]);
- }
+ gui_synclist_scroll_stop(&lists);
if (menu_callback)
menu_callback(ACTION_EXIT_MENUITEM, menu);
@@ -546,10 +540,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
{
int type;
/* entering an item that may not be a list, so stop scrolling */
- FOR_NB_SCREENS(i)
- {
- screens[i].scroll_stop(&vps[i]);
- }
+ gui_synclist_scroll_stop(&lists);
#ifdef HAVE_BUTTONBAR
if (!hide_theme)
{
@@ -562,7 +553,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
redraw_lists = true;
if (in_stringlist)
type = (menu->flags&MENU_TYPE_MASK);
- else
+ else
{
type = (temp->flags&MENU_TYPE_MASK);
get_menu_callback(temp, &menu_callback);
@@ -592,7 +583,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
if (temp->flags&MENU_FUNC_USEPARAM)
return_value = temp->function->function_w_param(
temp->function->param);
- else
+ else
return_value = temp->function->function();
if (!(menu->flags&MENU_EXITAFTERTHISMENU) ||
(temp->flags&MENU_EXITAFTERTHISMENU))
@@ -665,7 +656,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
ret = MENU_ATTACHED_USB;
done = true;
}
-
+
if (redraw_lists && !done)
{
if (menu_callback)
@@ -686,8 +677,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
*start_selected = get_menu_selection(
gui_synclist_get_sel_pos(&lists), menu);
}
- FOR_NB_SCREENS(i)
- viewportmanager_theme_undo(i, false);
+ FOR_NB_SCREENS(i)
+ viewportmanager_theme_undo(i, false);
return ret;
}
-
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)
#if CONFIG_RTC
int time_screen(void* ignored);
-MENUITEM_FUNCTION(timedate_item, MENU_FUNC_CHECK_RETVAL, ID2P(LANG_TIME_MENU), time_screen,
- NULL, NULL, Icon_Menu_setting );
+MENUITEM_FUNCTION(timedate_item, MENU_FUNC_CHECK_RETVAL, ID2P(LANG_TIME_MENU),
+ time_screen, NULL, NULL, Icon_Menu_setting );
#endif
/* This item is in the time/date screen if there is a RTC */
MENUITEM_FUNCTION(sleep_timer_call, 0, ID2P(LANG_SLEEP_TIMER), sleep_timer,
NULL, NULL, Icon_Menu_setting); /* make it look like a
- setting to the user */
+ setting to the user */
MENUITEM_FUNCTION(show_credits_item, 0, ID2P(LANG_CREDITS),
(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)
#define C2DIG2DEC(x) (S100(x)-100)
tm.tm_hour = 0;
- tm.tm_min = 0;
- tm.tm_sec = 0;
+ tm.tm_min = 0;
+ tm.tm_sec = 0;
tm.tm_mday = C2DIG2DEC(DAY);
- tm.tm_mon = C2DIG2DEC(MONTH)-1;
+ tm.tm_mon = C2DIG2DEC(MONTH)-1;
tm.tm_wday = 1;
tm.tm_year = YEAR-1900;
}
@@ -193,8 +193,8 @@ static void draw_timedate(struct viewport *vp, struct screen *display)
d = str(LANG_UNKNOWN);
}
- display->puts_scroll(0, line++, t);
- display->puts_scroll(0, line, d);
+ display->puts(0, line++, t);
+ display->puts(0, line, d);
display->update_viewport();
display->set_viewport(NULL);
@@ -284,9 +284,6 @@ int time_screen(void* ignored)
}
ret = do_menu(&time_menu, NULL, menu, false);
- FOR_NB_SCREENS(i)
- screens[i].scroll_stop(&clock[i]);
-
/* see comments above in the button callback */
if (!menu_was_pressed && ret == GO_TO_PREVIOUS)
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)
bool set_time_screen(const char* title, struct tm *tm)
{
- bool done = false;
+ struct viewport viewports[NB_SCREENS];
+ bool done = false, usb = false;
int cursorpos = 0;
- unsigned int statusbar_height = 0;
+ unsigned int s;
unsigned char offsets_ptr[] =
{ OFF_HOURS, OFF_MINUTES, OFF_SECONDS, OFF_YEAR, 0, OFF_DAY };
@@ -359,15 +360,16 @@ bool set_time_screen(const char* title, struct tm *tm)
offsets_ptr[IDX_DAY] = OFF_YEAR;
}
- if(global_settings.statusbar)
- statusbar_height = STATUSBAR_HEIGHT;
-
/* speak selection when screen is entered */
say_time(cursorpos, tm);
+#ifdef HAVE_TOUCHSCREEN
+ enum touchscreen_mode old_mode = touchscreen_get_mode();
+ touchscreen_set_mode(TOUCHSCREEN_BUTTON);
+#endif
while (!done) {
int button;
- unsigned int i, s, realyear, min, max;
+ unsigned int i, realyear, min, max;
unsigned char *ptr[6];
unsigned char buffer[20];
int *valptr = NULL;
@@ -413,7 +415,6 @@ bool set_time_screen(const char* title, struct tm *tm)
int pos, nb_lines;
unsigned int separator_width, weekday_width;
unsigned int j, width, prev_line_height;
- struct viewport viewports[NB_SCREENS];
/* 6 possible cursor possitions, 2 values stored for each: x, y */
unsigned int cursor[6][2];
struct viewport *vp = &viewports[s];
@@ -453,7 +454,7 @@ bool set_time_screen(const char* title, struct tm *tm)
prev_line_height *= 2;
}
screen->getstringsize(ptr[i], &width, NULL);
- cursor[i][INDEX_Y] = prev_line_height + statusbar_height;
+ cursor[i][INDEX_Y] = prev_line_height;
cursor[i][INDEX_X] = j;
j += width + separator_width;
}
@@ -527,15 +528,7 @@ bool set_time_screen(const char* title, struct tm *tm)
break;
}
-#ifdef HAVE_TOUCHSCREEN
- enum touchscreen_mode old_mode = touchscreen_get_mode();
-
- touchscreen_set_mode(TOUCHSCREEN_BUTTON);
-#endif
button = get_action(CONTEXT_SETTINGS_TIME, TIMEOUT_BLOCK);
-#ifdef HAVE_TOUCHSCREEN
- touchscreen_set_mode(old_mode);
-#endif
switch ( button ) {
case ACTION_STD_PREV:
cursorpos = clamp_value_wrap(--cursorpos, 5, 0);
@@ -567,11 +560,16 @@ bool set_time_screen(const char* title, struct tm *tm)
default:
if (default_event_handler(button) == SYS_USB_CONNECTED)
- return true;
+ done = usb = true;
break;
}
}
- return false;
+ FOR_NB_SCREENS(s)
+ screens[s].scroll_stop(&viewports[s]);
+#ifdef HAVE_TOUCHSCREEN
+ touchscreen_set_mode(old_mode);
+#endif
+ return usb;
}
#endif /* defined(HAVE_LCD_BITMAP) && (CONFIG_RTC != 0) */