forked from len0rd/rockbox
dont allow the volume setting to wrap
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11445 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
2f444aac29
commit
6a1161b634
11 changed files with 46 additions and 19 deletions
|
@ -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);
|
||||
|
|
|
@ -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_ */
|
||||
|
|
|
@ -141,7 +141,7 @@ int menu_show(int m)
|
|||
if( menus[m].callback != NULL )
|
||||
key = menus[m].callback(key, m);
|
||||
/* If moved, "say" the entry under the cursor */
|
||||
if(gui_synclist_do_button(&(menus[m].synclist), key))
|
||||
if(gui_synclist_do_button(&(menus[m].synclist), key,LIST_WRAP_UNLESS_HELD))
|
||||
menu_talk_selected(m);
|
||||
switch( key ) {
|
||||
case ACTION_STD_OK:
|
||||
|
|
|
@ -248,7 +248,7 @@ static int display_playlists(char* playlist, bool view)
|
|||
int button = get_action(CONTEXT_LIST,HZ/2);
|
||||
char* sel_file;
|
||||
|
||||
gui_synclist_do_button(&playlist_lists, button);
|
||||
gui_synclist_do_button(&playlist_lists, button,LIST_WRAP_UNLESS_HELD);
|
||||
|
||||
sel_file = playlists[gui_synclist_get_sel_pos(&playlist_lists)];
|
||||
|
||||
|
|
|
@ -664,7 +664,7 @@ bool playlist_viewer_ex(char* filename)
|
|||
/* Timeout so we can determine if play status has changed */
|
||||
button = get_action(CONTEXT_TREE,HZ/2);
|
||||
int list_action;
|
||||
if( (list_action=gui_synclist_do_button(&playlist_lists, button))!=0 )
|
||||
if( (list_action=gui_synclist_do_button(&playlist_lists, button,LIST_WRAP_UNLESS_HELD))!=0 )
|
||||
{
|
||||
viewer.selected_track=gui_synclist_get_sel_pos(&playlist_lists);
|
||||
if(playlist_buffer_needs_reload(&viewer.buffer,
|
||||
|
@ -847,7 +847,7 @@ bool search_playlist(void)
|
|||
while (!exit)
|
||||
{
|
||||
button = get_action(CONTEXT_LIST,TIMEOUT_BLOCK);
|
||||
if (gui_synclist_do_button(&playlist_lists, button))
|
||||
if (gui_synclist_do_button(&playlist_lists, button,LIST_WRAP_UNLESS_HELD))
|
||||
continue;
|
||||
switch (button)
|
||||
{
|
||||
|
|
|
@ -275,7 +275,8 @@ struct plugin_api {
|
|||
void (*gui_synclist_scroll_right)(struct gui_synclist * lists);
|
||||
void (*gui_synclist_scroll_left)(struct gui_synclist * lists);
|
||||
#endif
|
||||
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);
|
||||
|
||||
/* button */
|
||||
long (*button_get)(bool block);
|
||||
|
|
|
@ -184,7 +184,7 @@ void edit_list(void)
|
|||
{
|
||||
rb->gui_synclist_draw(&lists);
|
||||
button = rb->get_action(CONTEXT_LIST,TIMEOUT_BLOCK);
|
||||
if (rb->gui_synclist_do_button(&lists,button))
|
||||
if (rb->gui_synclist_do_button(&lists,button,LIST_WRAP_UNLESS_HELD))
|
||||
continue;
|
||||
selection = rb->gui_synclist_get_sel_pos(&lists);
|
||||
switch (button)
|
||||
|
|
|
@ -349,7 +349,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
|
|||
rb->gui_synclist_draw(&lists);
|
||||
cur_sel = rb->gui_synclist_get_sel_pos(&lists);
|
||||
button = rb->get_action(CONTEXT_LIST,TIMEOUT_BLOCK);
|
||||
if (rb->gui_synclist_do_button(&lists,button))
|
||||
if (rb->gui_synclist_do_button(&lists,button,LIST_WRAP_UNLESS_HELD))
|
||||
continue;
|
||||
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
|
||||
rb->cpu_boost(0);
|
||||
|
|
|
@ -1241,7 +1241,7 @@ bool browse_id3(void)
|
|||
gui_syncstatusbar_draw(&statusbars, false);
|
||||
key = get_action(CONTEXT_LIST,HZ/2);
|
||||
if(key!=ACTION_NONE && key!=ACTION_UNKNOWN
|
||||
&& !gui_synclist_do_button(&id3_lists, key))
|
||||
&& !gui_synclist_do_button(&id3_lists, key,LIST_WRAP_UNLESS_HELD))
|
||||
{
|
||||
action_signalscreenchange();
|
||||
return(default_event_handler(key) == SYS_USB_CONNECTED);
|
||||
|
|
|
@ -1982,9 +1982,14 @@ bool do_set_setting(const unsigned char* string, void *variable,
|
|||
bool done = false;
|
||||
struct gui_synclist lists;
|
||||
int oldvalue;
|
||||
bool allow_wrap = true;
|
||||
|
||||
if (cb_data->type == INT)
|
||||
oldvalue = *(int*)variable;
|
||||
{
|
||||
oldvalue = *(int*)variable;
|
||||
if (variable == &global_settings.volume)
|
||||
allow_wrap = false;
|
||||
}
|
||||
else oldvalue = *(bool*)variable;
|
||||
|
||||
gui_synclist_init(&lists,value_setting_get_name_cb,(void*)cb_data,false,1);
|
||||
|
@ -2008,8 +2013,8 @@ bool do_set_setting(const unsigned char* string, void *variable,
|
|||
action = get_action(CONTEXT_LIST,TIMEOUT_BLOCK);
|
||||
if (action == ACTION_NONE)
|
||||
continue;
|
||||
|
||||
if (gui_synclist_do_button(&lists,action))
|
||||
if (gui_synclist_do_button(&lists,action,
|
||||
allow_wrap?LIST_WRAP_UNLESS_HELD:LIST_WRAP_OFF))
|
||||
{
|
||||
if (global_settings.talk_menu)
|
||||
{
|
||||
|
|
|
@ -674,7 +674,7 @@ static bool dirbrowse(void)
|
|||
}
|
||||
#endif
|
||||
button = get_action(CONTEXT_TREE,HZ/5);
|
||||
returned_button = gui_synclist_do_button(&tree_lists, button);
|
||||
returned_button = gui_synclist_do_button(&tree_lists, button,LIST_WRAP_UNLESS_HELD);
|
||||
if (returned_button)
|
||||
need_update = true;
|
||||
if (returned_button == ACTION_STD_CANCEL)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue