From 6a1161b634e43225ae12bf669ad3bbe1ea1edab0 Mon Sep 17 00:00:00 2001 From: Jonathan Gordon Date: Mon, 6 Nov 2006 10:11:51 +0000 Subject: dont allow the volume setting to wrap git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11445 a1c6a512-1295-4272-9138-f99709370657 --- apps/gui/list.c | 24 ++++++++++++++++++------ apps/gui/list.h | 11 ++++++++++- 2 files changed, 28 insertions(+), 7 deletions(-) (limited to 'apps/gui') diff --git a/apps/gui/list.c b/apps/gui/list.c index 0653343604..1f23ca5e68 100644 --- a/apps/gui/list.c +++ b/apps/gui/list.c @@ -720,18 +720,32 @@ void gui_synclist_scroll_left(struct gui_synclist * lists) } #endif /* HAVE_LCD_BITMAP */ -unsigned gui_synclist_do_button(struct gui_synclist * lists, unsigned button) +unsigned gui_synclist_do_button(struct gui_synclist * lists, + unsigned button,enum list_wrap wrap) { #ifdef HAVE_LCD_BITMAP static bool scrolling_left = false; #endif - gui_synclist_limit_scroll(lists, true); + switch (wrap) + { + case LIST_WRAP_ON: + gui_synclist_limit_scroll(lists, false); + break; + case LIST_WRAP_OFF: + gui_synclist_limit_scroll(lists, true); + break; + case LIST_WRAP_UNLESS_HELD: + if (button == ACTION_STD_PREVREPEAT || + button == ACTION_STD_NEXTREPEAT) + gui_synclist_limit_scroll(lists, true); + else gui_synclist_limit_scroll(lists, false); + break; + }; + switch(button) { case ACTION_STD_PREV: - gui_synclist_limit_scroll(lists, false); - case ACTION_STD_PREVREPEAT: gui_synclist_select_previous(lists); gui_synclist_draw(lists); @@ -739,8 +753,6 @@ unsigned gui_synclist_do_button(struct gui_synclist * lists, unsigned button) return ACTION_STD_PREV; case ACTION_STD_NEXT: - gui_synclist_limit_scroll(lists, false); - case ACTION_STD_NEXTREPEAT: gui_synclist_select_next(lists); gui_synclist_draw(lists); diff --git a/apps/gui/list.h b/apps/gui/list.h index 914563a597..e61780ffe3 100644 --- a/apps/gui/list.h +++ b/apps/gui/list.h @@ -26,6 +26,12 @@ #define SCROLLBAR_WIDTH 6 +enum list_wrap { + LIST_WRAP_ON = 0, + LIST_WRAP_OFF, + LIST_WRAP_UNLESS_HELD, +}; + /* * The gui_list is based on callback functions, if you want the list * to display something you have to provide it a function that @@ -312,10 +318,13 @@ void gui_synclist_scroll_left(struct gui_synclist * lists); * returns the action taken if any, 0 else * - lists : the synchronized lists * - button : the keycode of a pressed button + * - specifies weather to allow the list to wrap or not, values at top of page * returned value : * - ACTION_STD_NEXT when moving forward (next item or pgup) * - ACTION_STD_PREV when moving backward (previous item or pgdown) */ -extern unsigned gui_synclist_do_button(struct gui_synclist * lists, unsigned button); +extern unsigned gui_synclist_do_button(struct gui_synclist * lists, + unsigned button, + enum list_wrap); #endif /* _GUI_LIST_H_ */ -- cgit v1.2.3