fix the bug where when scrolling text left in the filebrowser you could suddenly find yourself in the root directory. A long press on the left scrolling button will still take you to the root quickly.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11042 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Martin Scarratt 2006-09-25 10:56:38 +00:00
parent ec2a5cce1a
commit 1ab1f02dfe
9 changed files with 36 additions and 3 deletions

View file

@ -123,6 +123,7 @@ enum {
ACTION_LISTTREE_RC_PGDOWN,/* optional */
/* tree */
ACTION_TREE_ROOT_INIT,
ACTION_TREE_PGLEFT,/* optional */
ACTION_TREE_PGRIGHT,/* optional */
ACTION_TREE_STOP,

View file

@ -722,6 +722,8 @@ void gui_synclist_scroll_left(struct gui_synclist * lists)
unsigned gui_synclist_do_button(struct gui_synclist * lists, unsigned button)
{
static bool scrolling_left = false;
gui_synclist_limit_scroll(lists, true);
switch(button)
{
@ -744,15 +746,26 @@ unsigned gui_synclist_do_button(struct gui_synclist * lists, unsigned button)
return ACTION_STD_NEXT;
#ifdef HAVE_LCD_BITMAP
case ACTION_TREE_ROOT_INIT:
/* After this button press ACTION_TREE_PGLEFT is allowed to skip to root.
ACTION_TREE_ROOT_INIT must be defined in the keymaps as a repeated
button press (the same as the repeated ACTION_TREE_PGLEFT) with the
pre condition being the non-repeated button press */
if (lists->gui_list[0].offset_position == 0)
{
scrolling_left = false;
return ACTION_STD_CANCEL;
}
case ACTION_TREE_PGRIGHT:
gui_synclist_scroll_right(lists);
gui_synclist_draw(lists);
return ACTION_TREE_PGRIGHT;
case ACTION_TREE_PGLEFT:
if (lists->gui_list[0].offset_position == 0)
if(!scrolling_left && (lists->gui_list[0].offset_position == 0))
return ACTION_STD_CANCEL;
gui_synclist_scroll_left(lists);
gui_synclist_draw(lists);
scrolling_left = true; /* stop ACTION_TREE_PAGE_LEFT skipping to root */
return ACTION_TREE_PGLEFT;
#endif

View file

@ -116,6 +116,7 @@ const struct button_mapping button_context_listtree_scroll_with_combo[] = {
{ ACTION_TREE_PGLEFT, BUTTON_POWER|BUTTON_LEFT, BUTTON_POWER },
{ ACTION_TREE_PGLEFT, BUTTON_LEFT|BUTTON_REL, BUTTON_POWER|BUTTON_LEFT },
{ ACTION_TREE_PGLEFT, BUTTON_POWER|BUTTON_LEFT, BUTTON_LEFT|BUTTON_REL },
{ ACTION_TREE_ROOT_INIT, BUTTON_POWER|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_POWER|BUTTON_LEFT },
{ ACTION_TREE_PGLEFT, BUTTON_POWER|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_TREE_PGRIGHT, BUTTON_POWER|BUTTON_RIGHT, BUTTON_POWER },
{ ACTION_TREE_PGRIGHT, BUTTON_RIGHT|BUTTON_REL, BUTTON_POWER|BUTTON_RIGHT },
@ -127,6 +128,7 @@ const struct button_mapping button_context_listtree_scroll_with_combo[] = {
const struct button_mapping button_context_listtree_scroll_without_combo[] = {
{ ACTION_NONE, BUTTON_LEFT, BUTTON_NONE },
{ ACTION_STD_CANCEL, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
{ ACTION_TREE_ROOT_INIT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
{ ACTION_TREE_PGLEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_TREE_PGLEFT, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT|BUTTON_REPEAT },
{ ACTION_NONE, BUTTON_RIGHT, BUTTON_NONE },

View file

@ -106,8 +106,9 @@ const struct button_mapping button_context_tree[] = {
}; /* button_context_tree */
const struct button_mapping button_context_listtree_scroll_without_combo[] = {
{ ACTION_TREE_PGLEFT, BUTTON_REW|BUTTON_REPEAT, BUTTON_REW },
{ ACTION_TREE_PGRIGHT, BUTTON_FF|BUTTON_REPEAT, BUTTON_FF },
{ ACTION_TREE_ROOT_INIT, BUTTON_REW|BUTTON_REPEAT, BUTTON_REW },
{ ACTION_TREE_PGLEFT, BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_TREE_PGRIGHT, BUTTON_FF|BUTTON_REPEAT, BUTTON_NONE },
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE),
}; /* button_context_listtree_scroll_without_combo */
@ -115,7 +116,14 @@ const struct button_mapping button_context_listtree_scroll_with_combo[] = {
{ ACTION_LISTTREE_PGUP, BUTTON_REW|BUTTON_REPEAT, BUTTON_REW },
{ ACTION_LISTTREE_PGDOWN, BUTTON_FF|BUTTON_REPEAT, BUTTON_FF },
{ ACTION_TREE_PGLEFT, BUTTON_REW|BUTTON_PLAY, BUTTON_PLAY },
{ ACTION_TREE_PGLEFT, BUTTON_REW|BUTTON_REL, BUTTON_REW|BUTTON_PLAY },
{ ACTION_TREE_PGLEFT, BUTTON_REW|BUTTON_PLAY, BUTTON_REW|BUTTON_REL },
{ ACTION_TREE_ROOT_INIT, BUTTON_REW|BUTTON_PLAY|BUTTON_REPEAT, BUTTON_REW|BUTTON_PLAY },
{ ACTION_TREE_PGLEFT, BUTTON_REW|BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_TREE_PGRIGHT, BUTTON_FF|BUTTON_PLAY, BUTTON_PLAY },
{ ACTION_TREE_PGRIGHT, BUTTON_FF|BUTTON_REL, BUTTON_FF|BUTTON_PLAY },
{ ACTION_TREE_PGRIGHT, BUTTON_FF|BUTTON_PLAY, BUTTON_FF|BUTTON_REL },
{ ACTION_TREE_PGRIGHT, BUTTON_FF|BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE },
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE),
}; /* button_context_listtree_scroll_with_combo */

View file

@ -118,6 +118,7 @@ const struct button_mapping button_context_listtree_scroll_with_combo[] = {
{ ACTION_TREE_PGLEFT, BUTTON_ON|BUTTON_LEFT, BUTTON_ON },
{ ACTION_TREE_PGLEFT, BUTTON_LEFT|BUTTON_REL, BUTTON_ON|BUTTON_LEFT },
{ ACTION_TREE_PGLEFT, BUTTON_ON|BUTTON_LEFT, BUTTON_LEFT|BUTTON_REL },
{ ACTION_TREE_ROOT_INIT, BUTTON_ON|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_ON|BUTTON_LEFT },
{ ACTION_TREE_PGLEFT, BUTTON_ON|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_TREE_PGRIGHT, BUTTON_ON|BUTTON_RIGHT, BUTTON_ON },
{ ACTION_TREE_PGRIGHT, BUTTON_RIGHT|BUTTON_REL, BUTTON_ON|BUTTON_RIGHT },
@ -129,6 +130,7 @@ const struct button_mapping button_context_listtree_scroll_with_combo[] = {
const struct button_mapping button_context_listtree_scroll_without_combo[] = {
{ ACTION_NONE, BUTTON_LEFT, BUTTON_NONE },
{ ACTION_STD_CANCEL, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
{ ACTION_TREE_ROOT_INIT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
{ ACTION_TREE_PGLEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_TREE_PGLEFT, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT|BUTTON_REPEAT },
{ ACTION_NONE, BUTTON_RIGHT, BUTTON_NONE },
@ -394,6 +396,7 @@ const struct button_mapping button_context_listtree_scroll_w_cmb_h300lcdremote[]
{ ACTION_TREE_PGLEFT, BUTTON_RC_MENU|BUTTON_RC_SOURCE, BUTTON_RC_MENU },
{ ACTION_TREE_PGLEFT, BUTTON_RC_SOURCE|BUTTON_REL, BUTTON_RC_MENU|BUTTON_RC_SOURCE },
{ ACTION_TREE_PGLEFT, BUTTON_RC_MENU|BUTTON_RC_SOURCE, BUTTON_RC_SOURCE|BUTTON_REL },
{ ACTION_TREE_ROOT_INIT, BUTTON_RC_MENU|BUTTON_RC_SOURCE|BUTTON_REPEAT, BUTTON_RC_MENU|BUTTON_RC_SOURCE },
{ ACTION_TREE_PGLEFT, BUTTON_RC_MENU|BUTTON_RC_SOURCE|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_TREE_PGRIGHT, BUTTON_RC_MENU|BUTTON_RC_BITRATE, BUTTON_RC_MENU },
{ ACTION_TREE_PGRIGHT, BUTTON_RC_BITRATE|BUTTON_REL, BUTTON_RC_MENU|BUTTON_RC_BITRATE },
@ -404,6 +407,7 @@ const struct button_mapping button_context_listtree_scroll_w_cmb_h300lcdremote[]
const struct button_mapping button_context_listtree_scroll_wo_cmb_h100remote[] = {
{ ACTION_TREE_PGLEFT, BUTTON_RC_VOL_DOWN, BUTTON_NONE },
{ ACTION_TREE_ROOT_INIT, BUTTON_RC_VOL_DOWN|BUTTON_REPEAT, BUTTON_RC_VOL_DOWN },
{ ACTION_TREE_PGLEFT, BUTTON_RC_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_TREE_PGRIGHT, BUTTON_RC_VOL_UP, BUTTON_NONE },
{ ACTION_TREE_PGRIGHT, BUTTON_RC_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
@ -413,6 +417,7 @@ const struct button_mapping button_context_listtree_scroll_wo_cmb_h100remote[]
const struct button_mapping button_context_listtree_scroll_wo_cmb_h300lcdremote[] = {
{ ACTION_NONE, BUTTON_RC_REW, BUTTON_NONE },
{ ACTION_STD_CANCEL, BUTTON_RC_REW|BUTTON_REL, BUTTON_RC_REW },
{ ACTION_TREE_ROOT_INIT, BUTTON_RC_REW|BUTTON_REPEAT, BUTTON_RC_REW },
{ ACTION_TREE_PGLEFT, BUTTON_RC_REW|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_TREE_PGLEFT, BUTTON_RC_REW|BUTTON_REL, BUTTON_RC_REW|BUTTON_REPEAT },
{ ACTION_NONE, BUTTON_RC_FF, BUTTON_NONE },

View file

@ -64,6 +64,7 @@ const struct button_mapping button_context_tree[] = {
const struct button_mapping button_context_tree_scroll_lr[] = {
{ ACTION_NONE, BUTTON_LEFT, BUTTON_NONE },
{ ACTION_STD_CANCEL, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
{ ACTION_TREE_ROOT_INIT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
{ ACTION_TREE_PGLEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_TREE_PGLEFT, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT|BUTTON_REPEAT },
{ ACTION_NONE, BUTTON_RIGHT, BUTTON_NONE },

View file

@ -89,6 +89,7 @@ const struct button_mapping button_context_tree_scroll_lr[] = {
{ ACTION_NONE, BUTTON_LEFT, BUTTON_NONE },
{ ACTION_STD_CANCEL, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
{ ACTION_TREE_PGLEFT, BUTTON_MENU|BUTTON_LEFT, BUTTON_NONE },
{ ACTION_TREE_ROOT_INIT, BUTTON_MENU|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_MENU|BUTTON_LEFT },
{ ACTION_TREE_PGLEFT, BUTTON_MENU|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_TREE_PGLEFT, BUTTON_MENU|BUTTON_RIGHT|BUTTON_REL, BUTTON_MENU|BUTTON_RIGHT|BUTTON_REPEAT },
{ ACTION_NONE, BUTTON_RIGHT, BUTTON_NONE },

View file

@ -106,6 +106,7 @@ static const struct button_mapping button_context_tree[] = {
static const struct button_mapping button_context_tree_scroll_lr[] = {
{ ACTION_NONE, BUTTON_LEFT, BUTTON_NONE },
{ ACTION_STD_CANCEL, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
{ ACTION_TREE_ROOT_INIT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
{ ACTION_TREE_PGLEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_TREE_PGLEFT, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT|BUTTON_REPEAT },
{ ACTION_NONE, BUTTON_RIGHT, BUTTON_NONE },

View file

@ -159,6 +159,7 @@ const struct button_mapping remote_button_context_tree[] = {
const struct button_mapping button_context_tree_scroll_lr[] = {
{ ACTION_NONE, BUTTON_LEFT, BUTTON_NONE },
{ ACTION_STD_CANCEL, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
{ ACTION_TREE_ROOT_INIT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
{ ACTION_TREE_PGLEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_TREE_PGLEFT, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT|BUTTON_REPEAT },
{ ACTION_NONE, BUTTON_RIGHT, BUTTON_NONE },