From 1ab1f02dfecc8f0b35cf5668398ea327b25828b7 Mon Sep 17 00:00:00 2001 From: Martin Scarratt Date: Mon, 25 Sep 2006 10:56:38 +0000 Subject: [PATCH] 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 --- apps/action.h | 1 + apps/gui/list.c | 15 ++++++++++++++- apps/keymaps/keymap-gigabeat.c | 2 ++ apps/keymaps/keymap-h10.c | 12 ++++++++++-- apps/keymaps/keymap-h1x0_h3x0.c | 5 +++++ apps/keymaps/keymap-ipod.c | 1 + apps/keymaps/keymap-ondio.c | 1 + apps/keymaps/keymap-recorder.c | 1 + apps/keymaps/keymap-x5.c | 1 + 9 files changed, 36 insertions(+), 3 deletions(-) diff --git a/apps/action.h b/apps/action.h index 99612c1ea1..c096abf880 100644 --- a/apps/action.h +++ b/apps/action.h @@ -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, diff --git a/apps/gui/list.c b/apps/gui/list.c index 164bfc8773..7ca5e91b99 100644 --- a/apps/gui/list.c +++ b/apps/gui/list.c @@ -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 diff --git a/apps/keymaps/keymap-gigabeat.c b/apps/keymaps/keymap-gigabeat.c index 042a1f7d8b..9822049214 100644 --- a/apps/keymaps/keymap-gigabeat.c +++ b/apps/keymaps/keymap-gigabeat.c @@ -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 }, diff --git a/apps/keymaps/keymap-h10.c b/apps/keymaps/keymap-h10.c index 415a4e4804..1be904727e 100644 --- a/apps/keymaps/keymap-h10.c +++ b/apps/keymaps/keymap-h10.c @@ -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 */ diff --git a/apps/keymaps/keymap-h1x0_h3x0.c b/apps/keymaps/keymap-h1x0_h3x0.c index d8a5548613..6d30b93628 100644 --- a/apps/keymaps/keymap-h1x0_h3x0.c +++ b/apps/keymaps/keymap-h1x0_h3x0.c @@ -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 }, diff --git a/apps/keymaps/keymap-ipod.c b/apps/keymaps/keymap-ipod.c index 1151f10a20..2157127faf 100644 --- a/apps/keymaps/keymap-ipod.c +++ b/apps/keymaps/keymap-ipod.c @@ -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 }, diff --git a/apps/keymaps/keymap-ondio.c b/apps/keymaps/keymap-ondio.c index 35243c5700..defc4e3762 100644 --- a/apps/keymaps/keymap-ondio.c +++ b/apps/keymaps/keymap-ondio.c @@ -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 }, diff --git a/apps/keymaps/keymap-recorder.c b/apps/keymaps/keymap-recorder.c index 02e720847f..c111af91d8 100644 --- a/apps/keymaps/keymap-recorder.c +++ b/apps/keymaps/keymap-recorder.c @@ -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 }, diff --git a/apps/keymaps/keymap-x5.c b/apps/keymaps/keymap-x5.c index b83cbe6dc1..17b53f9c55 100644 --- a/apps/keymaps/keymap-x5.c +++ b/apps/keymaps/keymap-x5.c @@ -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 },