summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2006-08-15 12:27:07 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2006-08-15 12:27:07 +0000
commit224c0a13ebb5828b9bc06a9c1c23ae17f0ac19f9 (patch)
treebae2154b272f786983cf8e6de28d33f98f327560 /apps
parentc0f8b187706364f5e4bda2ac26750d14454c901d (diff)
downloadrockbox-224c0a13ebb5828b9bc06a9c1c23ae17f0ac19f9.tar.gz
rockbox-224c0a13ebb5828b9bc06a9c1c23ae17f0ac19f9.tar.bz2
rockbox-224c0a13ebb5828b9bc06a9c1c23ae17f0ac19f9.zip
Finally, the new button action system is here, thanks to Jonathan Gordon. Some button mappings have changed and other things may break. Comments should go to the forum, http://forums.rockbox.org/index.php?topic=5829.0 or the mailing list.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10582 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/SOURCES16
-rw-r--r--apps/action.c215
-rw-r--r--apps/action.h146
-rw-r--r--apps/alarm_menu.c38
-rw-r--r--apps/bookmark.c76
-rw-r--r--apps/bookmark.h48
-rw-r--r--apps/debug_menu.c244
-rw-r--r--apps/eq_menu.c118
-rw-r--r--apps/gui/color_picker.c98
-rw-r--r--apps/gui/gwps-common.c37
-rw-r--r--apps/gui/gwps-common.h3
-rw-r--r--apps/gui/gwps.c316
-rw-r--r--apps/gui/list.c90
-rw-r--r--apps/gui/list.h87
-rw-r--r--apps/gui/quickscreen.c70
-rw-r--r--apps/gui/quickscreen.h36
-rw-r--r--apps/gui/select.c45
-rw-r--r--apps/gui/select.h98
-rw-r--r--apps/gui/yesno.c15
-rw-r--r--apps/gui/yesno.h35
-rw-r--r--apps/keymaps/keymap-h1x0_h3x0.c386
-rw-r--r--apps/keymaps/keymap-ipod.c151
-rw-r--r--apps/keymaps/keymap-newtarget.c77
-rw-r--r--apps/keymaps/keymap-ondio.c135
-rw-r--r--apps/keymaps/keymap-player.c136
-rw-r--r--apps/keymaps/keymap-recorder.c141
-rw-r--r--apps/keymaps/keymap-x5.c141
-rw-r--r--apps/logfdisp.c14
-rw-r--r--apps/main.c2
-rw-r--r--apps/main_menu.c40
-rw-r--r--apps/menu.c42
-rw-r--r--apps/onplay.c6
-rw-r--r--apps/playback.h6
-rw-r--r--apps/playlist.c13
-rw-r--r--apps/playlist_catalog.c44
-rw-r--r--apps/playlist_viewer.c85
-rw-r--r--apps/plugin.c5
-rw-r--r--apps/plugin.h9
-rw-r--r--apps/recorder/radio.c21
-rw-r--r--apps/screens.c86
-rw-r--r--apps/screens.h45
-rw-r--r--apps/settings.c19
-rw-r--r--apps/settings.h111
-rw-r--r--apps/tagtree.c3
-rw-r--r--apps/tree.c108
-rw-r--r--apps/tree.h160
46 files changed, 1976 insertions, 1841 deletions
diff --git a/apps/SOURCES b/apps/SOURCES
index 3548980f28..a5dfc8bc5f 100644
--- a/apps/SOURCES
+++ b/apps/SOURCES
@@ -1,6 +1,7 @@
#ifdef ROCKBOX_HAS_LOGF
logfdisp.c
#endif
+action.c
alarm_menu.c
abrepeat.c
bookmark.c
@@ -81,3 +82,18 @@ eq_menu.c
#endif
metadata.c
tagcache.c
+#if (CONFIG_KEYPAD == IRIVER_H100_PAD) \
+ || (CONFIG_KEYPAD == IRIVER_H300_PAD)
+keymaps/keymap-h1x0_h3x0.c
+#elif ((CONFIG_KEYPAD == IPOD_4G_PAD) \
+ || (CONFIG_KEYPAD == IPOD_3G_PAD))
+keymaps/keymap-ipod.c
+#elif CONFIG_KEYPAD == RECORDER_PAD
+keymaps/keymap-recorder.c
+#elif CONFIG_KEYPAD == ONDIO_PAD
+keymaps/keymap-ondio.c
+#elif CONFIG_KEYPAD == PLAYER_PAD
+keymaps/keymap-player.c
+#elif CONFIG_KEYPAD == IAUDIO_X5_PAD
+keymaps/keymap-x5.c
+#endif
diff --git a/apps/action.c b/apps/action.c
new file mode 100644
index 0000000000..fc5a8b88a9
--- /dev/null
+++ b/apps/action.c
@@ -0,0 +1,215 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ *
+ * Copyright (C) 2006 Jonathan Gordon
+ *
+ * All files in this archive are subject to the GNU General Public License.
+ * See the file COPYING in the source tree root for full license agreement.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include "config.h"
+#include "button.h"
+#include "action.h"
+#include "kernel.h"
+#include "debug.h"
+
+bool ignore_until_release = false;
+int last_button = BUTTON_NONE;
+int soft_unlock_action = ACTION_NONE;
+bool allow_remote_actions = true;
+/*
+ * do_button_check is the worker function for get_default_action.
+ * returns ACTION_UNKNOWN or the requested return value from the list.
+ */
+inline int do_button_check(struct button_mapping *items,
+ int button, int last_button, int *start)
+{
+ int i = 0;
+ int ret = ACTION_UNKNOWN;
+ if (items == NULL)
+ return ACTION_UNKNOWN;
+
+ /* Special case to make the keymaps smaller */
+ if(button & BUTTON_REPEAT)
+ last_button &= ~BUTTON_REPEAT;
+
+ while (items[i].button_code != BUTTON_NONE)
+ {
+ if (items[i].button_code == button)
+ {
+ if (items[i].pre_button_code != BUTTON_NONE)
+ {
+ if ((items[i].pre_button_code == last_button) ||
+ (items[i].button_code == last_button))
+ {
+ ret = items[i].action_code;
+ break;
+ }
+ }
+ else
+ {
+ ret = items[i].action_code;
+ break;
+ }
+ }
+ i++;
+ }
+ *start = i;
+ return ret;
+}
+
+inline int get_next_context(struct button_mapping *items, int i)
+{
+ while (items[i].button_code != BUTTON_NONE)
+ i++;
+ return (items[i].action_code == ACTION_NONE ) ?
+ CONTEXT_STD :
+ items[i].action_code;
+}
+/*
+ * int get_action_worker(int context, struct button_mapping *user_mappings,
+ int timeout)
+ This function searches the button list for the given context for the just
+ pressed button.
+ If there is a match it returns the value from the list.
+ If there is no match..
+ the last item in the list "points" to the next context in a chain
+ so the "chain" is followed until the button is found.
+ putting ACTION_NONE will get CONTEXT_STD which is always the last list checked.
+
+ Timeout can be TIMEOUT_NOBLOCK to return immediatly
+ TIMEOUT_BLOCK to wait for a button press
+ Any number >0 to wait that many ticks for a press
+
+ */
+int get_action_worker(int context, int timeout,
+ struct button_mapping* (*get_context_map)(int) )
+{
+ struct button_mapping *items = NULL;
+ int button;
+ int i=0;
+ int ret = ACTION_UNKNOWN;
+ if (timeout == TIMEOUT_NOBLOCK)
+ button = button_get(false);
+ else if (timeout == TIMEOUT_BLOCK)
+ button = button_get(true);
+ else
+ button = button_get_w_tmo(timeout);
+
+
+ if (button == BUTTON_NONE || button&SYS_EVENT)
+ {
+ return button;
+ }
+
+ if (ignore_until_release == true)
+ {
+ if (button&BUTTON_REL)
+ {
+ ignore_until_release = false;
+ }
+ /*last_button = BUTTON_NONE; this is done by action_signalscreenchange() */
+ return ACTION_UNKNOWN; /* "safest" return value */
+ }
+
+ if (soft_unlock_action != ACTION_NONE)
+ {
+ if ((button&BUTTON_REMOTE) && !allow_remote_actions)
+ return ACTION_NONE;
+ }
+ /* logf("%x,%x",last_button,button); */
+ do
+ {
+ /* logf("context = %x",context); */
+#if (BUTTON_REMOTE != 0)
+ if (button&BUTTON_REMOTE)
+ context |= CONTEXT_REMOTE;
+#endif
+ if ((context&CONTEXT_CUSTOM) && get_context_map)
+ items = get_context_map(context);
+ else
+ items = get_context_mapping(context);
+
+ ret = do_button_check(items,button,last_button,&i);
+
+ if ((context == CONTEXT_STD)
+#if (BUTTON_REMOTE != 0)
+ || ((unsigned)context == (CONTEXT_STD|CONTEXT_REMOTE))
+#endif
+ ) break;
+
+ if (ret == ACTION_UNKNOWN )
+ {
+ context = get_next_context(items,i);
+ i = 0;
+ }
+ else break;
+ } while (1);
+ /* DEBUGF("ret = %x\n",ret); */
+
+ if (soft_unlock_action != ACTION_NONE)
+ {
+ if ((button&BUTTON_REMOTE) == 0)
+ {
+ if (soft_unlock_action == ret)
+ {
+ soft_unlock_action = ACTION_NONE;
+ ret = ACTION_NONE; /* no need to return the code */
+ }
+ }
+ else if (!allow_remote_actions)
+ ret = ACTION_NONE;
+ }
+
+ last_button = button;
+ return ret;
+}
+
+int get_action(int context, int timeout)
+{
+ return get_action_worker(context,timeout,NULL);
+}
+
+int get_custom_action(int context,int timeout,
+ struct button_mapping* (*get_context_map)(int))
+{
+ return get_action_worker(context,timeout,get_context_map);
+}
+
+bool action_userabort(int timeout)
+{
+ action_signalscreenchange();
+ int action = get_action_worker(CONTEXT_STD,timeout,NULL);
+ bool ret = (action == ACTION_STD_CANCEL);
+ action_signalscreenchange();
+ return ret;
+}
+
+void action_signalscreenchange(void)
+{
+ if ((last_button != BUTTON_NONE) &&
+ !(last_button&BUTTON_REL))
+ {
+ ignore_until_release = true;
+ }
+ last_button = BUTTON_NONE;
+}
+
+void action_setsoftwarekeylock(int unlock_action, bool allow_remote)
+{
+ soft_unlock_action = unlock_action;
+ allow_remote_actions = allow_remote;
+ last_button = BUTTON_NONE;
+}
diff --git a/apps/action.h b/apps/action.h
index 3c3db7d54e..24f3d990f0 100644
--- a/apps/action.h
+++ b/apps/action.h
@@ -19,11 +19,147 @@
#define __ACTION_H__
#include "stdbool.h"
+#include "button.h"
-#define CONTEXT_WPS 1
-#define CONTEXT_TREE 2
-#define CONTEXT_RECORD 3
-#define CONTEXT_MAINMENU 4
-#define CONTEXT_ID3DB 5
+#define LAST_ITEM_IN_LIST { ACTION_NONE, BUTTON_NONE, BUTTON_NONE }
+#define LAST_ITEM_IN_LIST__NEXTLIST(a) { a, BUTTON_NONE, BUTTON_NONE }
+
+#define TIMEOUT_BLOCK -1
+#define TIMEOUT_NOBLOCK 0
+#define CONTEXT_REMOTE 0x80000000 /* | this against another context to get remote buttons for that context */
+#define CONTEXT_CUSTOM 0x40000000 /* | this against anything to get your context number */
+
+enum {
+ CONTEXT_STD = 0,
+ /* These CONTEXT_ values were here before me,
+ there values may have significance, so dont touch! */
+ CONTEXT_WPS = 1,
+ CONTEXT_TREE = 2,
+ CONTEXT_RECORD = 3,
+ CONTEXT_MAINMENU = 4,
+ CONTEXT_ID3DB = 5,
+ /* Add new contexts here, no need to explicitly define a value for them */
+ CONTEXT_LIST,
+ CONTEXT_SETTINGS, /* options style settings, like from menus */
+ CONTEXT_SETTINGSGRAPHICAL, /* screens like eq config and colour chooser */
+
+ CONTEXT_YESNOSCREEN, /*NOTE: make sure your target has this and ACTION_YESNO_ACCEPT */
+ CONTEXT_BOOKMARKSCREEN, /*NOTE: requires the action_setting_* mappings also */
+ CONTEXT_QUICKSCREEN, /* uses ACTION_QS_ defines below */
+};
+
+
+enum {
+
+ ACTION_NONE = BUTTON_NONE,
+ ACTION_UNKNOWN,
+
+ /* standard actions, use these first */
+ ACTION_STD_PREV,
+ ACTION_STD_PREVREPEAT,
+ ACTION_STD_NEXT,
+ ACTION_STD_NEXTREPEAT,
+
+ ACTION_STD_OK,
+ ACTION_STD_CANCEL,
+ ACTION_STD_CONTEXT,
+ ACTION_STD_MENU,
+ ACTION_STD_QUICKSCREEN,
+ ACTION_STD_KEYLOCK, /* software keylock in wps screen, very optional
+ use with action_setsoftwarekeylock */
+
+
+ /* code context actions */
+
+ /* WPS codes */
+ ACTION_WPS_BROWSE,
+ ACTION_WPS_PLAY,
+ ACTION_WPS_SEEKBACK,
+ ACTION_WPS_SEEKFWD,
+ ACTION_WPS_STOPSEEK,
+ ACTION_WPS_SKIPNEXT,
+ ACTION_WPS_SKIPPREV,
+ ACTION_WPS_STOP,
+ ACTION_WPS_VOLDOWN,
+ ACTION_WPS_VOLUP,
+ ACTION_WPS_NEXTDIR,/* optional */
+ ACTION_WPS_PREVDIR,/* optional */
+ ACTION_WPS_PITCHSCREEN,/* optional */
+ ACTION_WPS_ID3SCREEN,/* optional */
+ ACTION_WPS_CONTEXT,
+ ACTION_WPS_QUICKSCREEN,/* optional */
+ ACTION_WPS_MENU, /*this should be the same as ACTION_STD_MENU */
+ /* following code are for AB mode in wps,
+ only needed if defined(AB_REPEAT_ENABLE) */
+ ACTION_WPSAB_SINGLE, /* No targets use this, but leave n just-in-case! */
+ ACTION_WPSAB_SETA, /* either #define WPS_AB_SHARE_DIR_BUTTONS */
+ ACTION_WPSAB_SETB, /* OR implement ACTION_WPSAB_SET[AB] */
+ ACTION_WPSAB_RESET,
+
+ /* list and tree page up/down */
+ ACTION_LISTTREE_PGUP,/* optional */
+ ACTION_LISTTREE_PGDOWN,/* optional */
+ ACTION_LISTTREE_RC_PGUP,/* optional */
+ ACTION_LISTTREE_RC_PGDOWN,/* optional */
+
+ /* tree */
+ ACTION_TREE_PGLEFT,/* optional */
+ ACTION_TREE_PGRIGHT,/* optional */
+ ACTION_TREE_STOP,
+ ACTION_TREE_WPS,
+
+ /* recording screen */
+
+ /* main menu */
+
+ /* id3db */
+
+ /* list */
+
+ /* settings */
+ ACTION_SETTINGS_INC,
+ ACTION_SETTINGS_INCREPEAT,
+ ACTION_SETTINGS_DEC,
+ ACTION_SETTINGS_DECREPEAT,
+
+ /* yesno screen */
+ ACTION_YESNO_ACCEPT,
+
+ /* bookmark screen */
+ ACTION_BMARK_DELETE,
+
+ /* quickscreen */
+ ACTION_QS_LEFT,
+ ACTION_QS_RIGHT,
+ ACTION_QS_DOWN,
+ ACTION_QS_DOWNINV, /* why is this not called up?? :p */
+
+};
+
+struct button_mapping {
+ int action_code;
+ int button_code;
+ int pre_button_code;
+};
+/* use if you want to supply your own button mappings, PLUGINS ONLY */
+/* get_context_map is a function which returns a button_mapping* depedning on the given context */
+/* custom button_mappings may "chain" to inbuilt CONTEXT's */
+int get_custom_action(int context,int timeout,
+ struct button_mapping* (*get_context_map)(int));
+/* use if one of the standard CONTEXT_ mappings will work (ALL the core should be using this! */
+int get_action(int context, int timeout);
+/* call this whenever you leave your button loop */
+void action_signalscreenchange(void);
+
+/* call this if you need to check for ACTION_STD_CANCEL only (i.e user abort! */
+bool action_userabort(int timeout);
+
+/* on targets without hardware keylock, use this to to emulate keylock.
+ unlock_action is the action which will disaable the keylock
+ allow_remote should be true if you want the remote buttons to still be usable while locked */
+void action_setsoftwarekeylock(int unlock_action, bool allow_remote);
+
+/* no other code should need this apart from action.c */
+struct button_mapping* get_context_mapping(int context);
#endif
diff --git a/apps/alarm_menu.c b/apps/alarm_menu.c
index ae5d5bb752..03234352d7 100644
--- a/apps/alarm_menu.c
+++ b/apps/alarm_menu.c
@@ -25,7 +25,7 @@
#include "options.h"
#include "lcd.h"
-#include "button.h"
+#include "action.h"
#include "kernel.h"
#include "sprintf.h"
#include <string.h>
@@ -56,6 +56,7 @@ bool alarm_screen(void)
int button;
int i;
bool update = true;
+
rtc_get_alarm(&h, &m);
@@ -84,10 +85,10 @@ bool alarm_screen(void)
screens[i].puts(0, 1, buf);
gui_textarea_update(&screens[i]);
}
- button = button_get_w_tmo(HZ);
+ button = get_action(CONTEXT_SETTINGS,HZ);
switch(button) {
- case BUTTON_PLAY:
+ case ACTION_STD_OK:
/* prevent that an alarm occurs in the shutdown procedure */
/* accept alarms only if they are in 2 minutes or more */
tm = get_time();
@@ -106,8 +107,8 @@ bool alarm_screen(void)
break;
/* inc(m) */
- case BUTTON_RIGHT:
- case BUTTON_RIGHT | BUTTON_REPEAT:
+ case ACTION_SETTINGS_INC:
+ case ACTION_SETTINGS_INCREPEAT:
m += 5;
if (m == 60) {
h += 1;
@@ -118,8 +119,8 @@ bool alarm_screen(void)
break;
/* dec(m) */
- case BUTTON_LEFT:
- case BUTTON_LEFT | BUTTON_REPEAT:
+ case ACTION_SETTINGS_DEC:
+ case ACTION_SETTINGS_DECREPEAT:
m -= 5;
if (m == -5) {
h -= 1;
@@ -129,32 +130,25 @@ bool alarm_screen(void)
h = 23;
break;
-#if CONFIG_KEYPAD == RECORDER_PAD
/* inc(h) */
- case BUTTON_UP:
- case BUTTON_UP | BUTTON_REPEAT:
+ case ACTION_STD_NEXT:
+ case ACTION_STD_NEXTREPEAT:
h = (h+1) % 24;
break;
/* dec(h) */
- case BUTTON_DOWN:
- case BUTTON_DOWN | BUTTON_REPEAT:
+ case ACTION_STD_PREV:
+ case ACTION_STD_NEXTREPEAT:
h = (h+23) % 24;
break;
-#endif
-
-#if CONFIG_KEYPAD == RECORDER_PAD
- case BUTTON_OFF:
-#else
- case BUTTON_STOP:
- case BUTTON_MENU:
-#endif
+
+ case ACTION_STD_CANCEL:
rtc_enable_alarm(false);
gui_syncsplash(HZ*2, true, str(LANG_ALARM_MOD_DISABLE));
done = true;
break;
- case BUTTON_NONE:
+ case ACTION_NONE:
gui_syncstatusbar_draw(&statusbars, false);
break;
@@ -167,7 +161,7 @@ bool alarm_screen(void)
break;
}
}
-
+ action_signalscreenchange();
return false;
}
diff --git a/apps/bookmark.c b/apps/bookmark.c
index 62b286333e..b1fef207a4 100644
--- a/apps/bookmark.c
+++ b/apps/bookmark.c
@@ -24,7 +24,7 @@
#include "applimits.h"
#include "lcd.h"
-#include "button.h"
+#include "action.h"
#include "usb.h"
#include "audio.h"
#include "playlist.h"
@@ -458,30 +458,24 @@ bool bookmark_autoload(const char* file)
while(!done)
{
/* Wait for a key to be pushed */
- key = button_get(true);
+ key = get_action(CONTEXT_SETTINGS,TIMEOUT_BLOCK);
switch(key)
{
#ifdef HAVE_LCD_BITMAP
-#ifdef BOOKMARK_RC_DOWN
- case BOOKMARK_RC_DOWN:
-#endif
- case BOOKMARK_DOWN:
+ case ACTION_STD_NEXT:
return bookmark_load(global_bookmark_file_name, false);
#endif
-#ifdef SETTINGS_RC_OK
- case SETTINGS_RC_OK:
-#endif
- case SETTINGS_OK:
+ case ACTION_STD_OK:
return bookmark_load(global_bookmark_file_name, true);
default:
/* Handle sys events, ignore button releases & repeats */
- if (default_event_handler(key) ||
- !(key & (BUTTON_REPEAT|BUTTON_REL)))
+ if (default_event_handler(key))
done = true;
break;
}
}
+ action_signalscreenchange();
return false;
}
}
@@ -571,7 +565,6 @@ static char* select_bookmark(const char* bookmark_file_name)
int bookmark_id = 0;
int bookmark_id_prev = -1;
int key;
- int lastkey = BUTTON_NONE;
char* bookmark = NULL;
int bookmark_count = 0;
@@ -605,6 +598,7 @@ static char* select_bookmark(const char* bookmark_file_name)
{
gui_syncsplash(HZ, true, str(LANG_BOOKMARK_LOAD_EMPTY));
remove(bookmark_file_name);
+ action_signalscreenchange();
return NULL;
}
else
@@ -621,17 +615,10 @@ static char* select_bookmark(const char* bookmark_file_name)
}
/* waiting for the user to click a button */
- key = button_get(true);
+ key = get_action(CONTEXT_BOOKMARKSCREEN,TIMEOUT_BLOCK);
switch(key)
{
-#ifdef BOOKMARK_RC_SELECT
- case BOOKMARK_RC_SELECT:
-#endif
- case BOOKMARK_SELECT:
-#ifdef BOOKMARK_SELECT_PRE
- if (lastkey != BOOKMARK_SELECT_PRE)
- break;
-#endif
+ case ACTION_STD_OK:
/* User wants to use this bookmark */
#ifdef HAVE_LCD_BITMAP
if (global_settings.statusbar)
@@ -645,11 +632,10 @@ static char* select_bookmark(const char* bookmark_file_name)
screens[i].setmargins(0, 0);
}
#endif
+ action_signalscreenchange();
return bookmark;
-#ifdef BOOKMARK_RC_DELETE
- case BOOKMARK_RC_DELETE:
-#endif
- case BOOKMARK_DELETE:
+
+ case ACTION_BMARK_DELETE:
/* User wants to delete this bookmark */
delete_bookmark(bookmark_file_name, bookmark_id);
bookmark_id_prev=-2;
@@ -658,54 +644,32 @@ static char* select_bookmark(const char* bookmark_file_name)
bookmark_id = bookmark_count -1;
break;
-#ifdef SETTINGS_RC_DEC
- case SETTINGS_RC_DEC:
- case SETTINGS_RC_DEC | BUTTON_REPEAT:
-#endif
- case SETTINGS_DEC:
- case SETTINGS_DEC | BUTTON_REPEAT:
+ case ACTION_SETTINGS_DEC:
bookmark_id--;
break;
-#ifdef SETTINGS_RC_DEC
- case SETTINGS_RC_INC:
- case SETTINGS_RC_INC | BUTTON_REPEAT:
-#endif
- case SETTINGS_INC:
- case SETTINGS_INC | BUTTON_REPEAT:
+ case ACTION_SETTINGS_INC:
bookmark_id++;
break;
-#ifdef SETTINGS_RC_CANCEL
- case SETTINGS_RC_CANCEL:
-#endif
-#ifdef SETTINGS_RC_CANCEL2
- case SETTINGS_RC_CANCEL2:
-#endif
- case SETTINGS_CANCEL:
-#ifdef SETTINGS_CANCEL2
- case SETTINGS_CANCEL2:
-#endif
-#ifdef SETTINGS_RC_OK2
- case SETTINGS_RC_OK2:
-#endif
-#ifdef SETTINGS_OK2
- case SETTINGS_OK2:
-#endif
+ case ACTION_STD_CANCEL:
#ifdef HAVE_LCD_BITMAP
FOR_NB_SCREENS(i)
screens[i].setmargins(x, y);
#endif
+ action_signalscreenchange();
return NULL;
default:
if(default_event_handler(key) == SYS_USB_CONNECTED)
+ {
+ action_signalscreenchange();
return NULL;
+ }
break;
}
- lastkey = key;
}
-
+ action_signalscreenchange();
return NULL;
}
diff --git a/apps/bookmark.h b/apps/bookmark.h
index 72453aaf7f..16f4e5609f 100644
--- a/apps/bookmark.h
+++ b/apps/bookmark.h
@@ -21,54 +21,6 @@
#include <stdbool.h>
-#if CONFIG_KEYPAD == ONDIO_PAD
-#define BOOKMARK_SELECT_PRE BUTTON_RIGHT
-#define BOOKMARK_SELECT (BUTTON_RIGHT | BUTTON_REL)
-#define BOOKMARK_DELETE (BUTTON_RIGHT | BUTTON_REPEAT)
-#define BOOKMARK_DOWN BUTTON_DOWN
-
-#elif (CONFIG_KEYPAD == IRIVER_H100_PAD) || \
- (CONFIG_KEYPAD == IRIVER_H300_PAD)
-#define BOOKMARK_SELECT BUTTON_SELECT
-#define BOOKMARK_DELETE (BUTTON_ON | BUTTON_SELECT)
-#define BOOKMARK_DOWN BUTTON_DOWN
-#define BOOKMARK_RC_SELECT BUTTON_RC_MENU
-#define BOOKMARK_RC_DELETE (BUTTON_RC_ON | BUTTON_RC_MENU)
-#define BOOKMARK_RC_DOWN BUTTON_RC_FF
-#define BOOKMARK_RC_EXIT BUTTON_RC_STOP
-
-#elif (CONFIG_KEYPAD == IPOD_3G_PAD) || (CONFIG_KEYPAD == IPOD_4G_PAD)
-#define BOOKMARK_SELECT BUTTON_SELECT
-#define BOOKMARK_DELETE (BUTTON_RIGHT | BUTTON_REPEAT)
-#define BOOKMARK_DOWN BUTTON_SCROLL_FWD
-
-#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
-#define BOOKMARK_SELECT BUTTON_SELECT
-#define BOOKMARK_DELETE (BUTTON_PLAY | BUTTON_SELECT)
-#define BOOKMARK_DOWN BUTTON_DOWN
-
-#elif CONFIG_KEYPAD == IAUDIO_X5_PAD
-#define BOOKMARK_SELECT BUTTON_SELECT
-#define BOOKMARK_DELETE BUTTON_REC | BUTTON_REPEAT
-#define BOOKMARK_DOWN BUTTON_DOWN
-
-#elif CONFIG_KEYPAD == GIGABEAT_PAD
-#define BOOKMARK_SELECT BUTTON_MENU
-#define BOOKMARK_DELETE BUTTON_POWER
-#define BOOKMARK_DOWN BUTTON_A
-
-#elif CONFIG_KEYPAD == IRIVER_H10_PAD
-#define BOOKMARK_SELECT BUTTON_PLAY
-#define BOOKMARK_DELETE (BUTTON_FF | BUTTON_REPEAT)
-#define BOOKMARK_DOWN BUTTON_SCROLL_DOWN
-
-#else /* player, recorder, gmini */
-#define BOOKMARK_SELECT BUTTON_PLAY
-#define BOOKMARK_DELETE (BUTTON_ON | BUTTON_PLAY)
-#define BOOKMARK_DOWN BUTTON_DOWN
-
-#endif
-
bool bookmark_load_menu(void);
bool bookmark_autobookmark(void);
bool bookmark_create_menu(void);
diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index e79e88de76..469660cbd0 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -27,7 +27,7 @@
#include "debug_menu.h"
#include "kernel.h"
#include "sprintf.h"
-#include "button.h"
+#include "action.h"
#include "adc.h"
#include "mas.h"
#include "power.h"
@@ -86,7 +86,6 @@ extern const char *thread_name[];
bool dbg_os(void)
{
char buf[32];
- int button;
int i;
int usage;
@@ -106,13 +105,8 @@ bool dbg_os(void)
lcd_update();
- button = button_get_w_tmo(HZ/10);
-
- switch(button)
- {
- case SETTINGS_CANCEL:
- return false;
- }
+ if (action_userabort(TIMEOUT_BLOCK))
+ return false;
}
return false;
}
@@ -134,20 +128,21 @@ bool dbg_os(void)
snprintf(buf, 32, "%d: %d%% ", currval, usage);
lcd_puts(0, 1, buf);
- button = button_get_w_tmo(HZ/10);
+ button = get_action(CONTEXT_SETTINGS,HZ/10);
switch(button)
{
- case SETTINGS_CANCEL:
+ case ACTION_STD_CANCEL:
+ action_signalscreenchange();
return false;
- case SETTINGS_DEC:
+ case ACTION_SETTINGS_DEC:
currval--;
if(currval < 0)
currval = num_threads-1;
break;
- case SETTINGS_INC:
+ case ACTION_SETTINGS_INC:
currval++;
if(currval > num_threads-1)
currval = 0;
@@ -163,7 +158,6 @@ bool dbg_os(void)
bool dbg_audio_thread(void)
{
char buf[32];
- int button;
struct audio_debug d;
lcd_setmargins(0, 0);
@@ -171,12 +165,8 @@ bool dbg_audio_thread(void)
while(1)
{
- button = button_get_w_tmo(HZ/5);
- switch(button)
- {
- case SETTINGS_CANCEL:
- return false;
- }
+ if (action_userabort(HZ/5))
+ return false;
audio_get_debugdata(&d);
@@ -242,23 +232,22 @@ bool dbg_audio_thread(void)
lcd_setmargins(0, 0);
lcd_setfont(FONT_SYSFIXED);
-
while(!done)
{
- button = button_get_w_tmo(HZ/5);
+ button = get_action(CONTEXT_STD,HZ/5);
switch(button)
{
- case SETTINGS_NEXT:
+ case ACTION_STD_NEXT:
audio_next();
break;
- case SETTINGS_PREV:
+ case ACTION_STD_PREV:
audio_prev();
break;
- case SETTINGS_CANCEL:
+ case ACTION_STD_CANCEL:
done = true;
break;
}
-
+ action_signalscreenchange();
line = 0;
lcd_clear_display();
@@ -406,7 +395,6 @@ bool dbg_hw_info(void)
{
#if CONFIG_CPU == SH7034
char buf[32];
- int button;
int usb_polarity;
int pr_polarity;
int bitmask = *(unsigned short*)0x20000fc;
@@ -494,13 +482,11 @@ bool dbg_hw_info(void)
while(1)
{
- button = button_get(true);
- if(button == SETTINGS_CANCEL)
+ if (action_userabort(TIMEOUT_BLOCK))
return false;
}
#elif CONFIG_CPU == MCF5249 || CONFIG_CPU == MCF5250
char buf[32];
- int button;
unsigned manu, id; /* flash IDs */
bool got_id; /* flag if we managed to get the flash IDs */
int oldmode; /* saved memory guard mode */
@@ -530,13 +516,11 @@ bool dbg_hw_info(void)
while(1)
{
- button = button_get(true);
- if(button == SETTINGS_CANCEL)
+ if (action_userabort(TIMEOUT_BLOCK))
return false;
}
#elif CONFIG_CPU == PP5020
char buf[32];
- int button;
lcd_setmargins(0, 0);
lcd_setfont(FONT_SYSFIXED);
@@ -551,8 +535,7 @@ bool dbg_hw_info(void)
while(1)
{
- button = button_get(true);
- if(button == SETTINGS_CANCEL)
+ if (action_userabort(TIMEOUT_BLOCK))
return false;
}
#endif /* CONFIG_CPU */
@@ -641,20 +624,21 @@ bool dbg_hw_info(void)
lcd_puts(0, 1, buf);
lcd_update();
- button = button_get(true);
+ button = get_action(CONTEXT_SETTINGS,TIMEOUT_BLOCK);
switch(button)
{
- case SETTINGS_CANCEL:
+ case ACTION_STD_CANCEL:
+ action_signalscreenchange();
return false;
- case SETTINGS_DEC:
+ case ACTION_SETTINGS_DEC:
currval--;
if(currval < 0)
currval = 5;
break;
- case SETTINGS_INC:
+ case ACTION_SETTINGS_INC:
currval++;
if(currval > 5)
currval = 0;
@@ -688,21 +672,21 @@ bool dbg_partitions(void)
lcd_puts(0, 1, buf);
lcd_update();
- button = button_get(true);
+ button = get_action(CONTEXT_SETTINGS,TIMEOUT_BLOCK);
switch(button)
{
- case SETTINGS_OK:
- case SETTINGS_CANCEL:
+ case ACTION_STD_CANCEL:
+ action_signalscreenchange();
return false;
- case SETTINGS_DEC:
+ case ACTION_SETTINGS_DEC:
partition--;
if (partition < 0)
partition = 3;
break;
- case SETTINGS_INC:
+ case ACTION_SETTINGS_INC:
partition++;
if (partition > 3)
partition = 0;
@@ -874,13 +858,8 @@ bool dbg_spdif(void)
lcd_update();
- switch (button_get_w_tmo(HZ/10))
- {
- case SETTINGS_CANCEL:
- case SETTINGS_OK2:
- done = true;
- break;
- }
+ if (action_userabort(HZ/2))
+ return false;
}
#ifdef HAVE_SPDIF_POWER
spdif_power_enable(global_settings.spdif_enable);
@@ -940,13 +919,8 @@ bool dbg_ports(void)
lcd_puts(0, 7, buf);
#endif
lcd_update();
- button = button_get_w_tmo(HZ/10);
-
- switch(button)
- {
- case SETTINGS_CANCEL:
- return false;
- }
+ if (action_userabort(HZ/10))
+ return false;
}
#elif defined(CPU_COLDFIRE)
unsigned int gpio_out;
@@ -962,7 +936,6 @@ bool dbg_ports(void)
int adc_remotedetect;
#endif
char buf[128];
- int button;
int line;
int battery_voltage;
int batt_int, batt_frac;
@@ -1033,13 +1006,8 @@ bool dbg_ports(void)
#endif
lcd_update();
- button = button_get_w_tmo(HZ/10);
-
- switch(button)
- { /* quit on release to allow for reading the cancel button input */
- case (SETTINGS_CANCEL|BUTTON_REL):
- return false;
- }
+ if (action_userabort(HZ/10))
+ return false;
}
#elif CONFIG_CPU == PP5020
@@ -1049,7 +1017,6 @@ bool dbg_ports(void)
unsigned int gpio_i, gpio_j, gpio_k, gpio_l;
char buf[128];
- int button;
int line;
lcd_setmargins(0, 0);
@@ -1091,13 +1058,8 @@ bool dbg_ports(void)
lcd_puts(0, line++, buf);
lcd_update();
- button = button_get_w_tmo(HZ/10);
-
- switch(button)
- {
- case SETTINGS_CANCEL:
- return false;
- }
+ if (action_userabort(HZ/10))
+ return false;
}
#endif /* CPU */
@@ -1170,20 +1132,21 @@ bool dbg_ports(void)
snprintf(buf, 32, "Batt: %d.%02dV", batt_int, batt_frac);
lcd_puts(0, 1, buf);
- button = button_get_w_tmo(HZ/5);
+ button = get_action(CONTEXT_SETTINGS,HZ/5);
switch(button)
{
- case SETTINGS_CANCEL:
+ case ACTION_STD_CANCEL:
+ action_signalscreenchange();
return false;
- case SETTINGS_DEC:
+ case ACTION_SETTINGS_DEC:
currval--;
if(currval < 0)
currval = 10;
break;
- case SETTINGS_INC:
+ case ACTION_SETTINGS_INC:
currval++;
if(currval > 10)
currval = 0;
@@ -1219,43 +1182,25 @@ bool dbg_cpufreq(void)
lcd_puts(0, line++, buf);
lcd_update();
- button = button_get_w_tmo(HZ/10);
+ button = get_action(CONTEXT_STD,HZ/10);
switch(button)
{
-#if (CONFIG_KEYPAD == IPOD_4G_PAD) || (CONFIG_KEYPAD == IPOD_3G_PAD)
- case BUTTON_MENU:
-#else
- case BUTTON_UP:
-#endif
- cpu_boost(true);
- break;
-#if (CONFIG_KEYPAD == IPOD_4G_PAD) || (CONFIG_KEYPAD == IPOD_3G_PAD)
- case BUTTON_PLAY:
-#else
- case BUTTON_DOWN:
-#endif
- cpu_boost(false);
- break;
+ case ACTION_STD_PREV:
+ cpu_boost(true);
+ break;
+ case ACTION_STD_NEXT:
+ cpu_boost(false);
+ break;
-#if (CONFIG_KEYPAD == IRIVER_H100_PAD) || \
- (CONFIG_KEYPAD == IRIVER_H300_PAD) || \
- (CONFIG_KEYPAD == IPOD_4G_PAD) || (CONFIG_KEYPAD == IPOD_3G_PAD)
- case BUTTON_SELECT:
-#else
- case BUTTON_PLAY:
-#endif
- set_cpu_frequency(CPUFREQ_DEFAULT);
- boost_counter = 0;
- break;
+ case ACTION_STD_OK:
+ set_cpu_frequency(CPUFREQ_DEFAULT);
+ boost_counter = 0;
+ break;
-#if (CONFIG_KEYPAD == IPOD_4G_PAD) || (CONFIG_KEYPAD == IPOD_3G_PAD)
- case BUTTON_LEFT:
-#else
- case SETTINGS_CANCEL:
- case SETTINGS_OK2:
-#endif
- return false;
+ case ACTION_STD_CANCEL:
+ action_signalscreenchange();
+ return false;
}
}
@@ -1428,20 +1373,20 @@ bool view_battery(void)
lcd_update();
- switch(button_get_w_tmo(HZ/2))
+ switch(get_action(CONTEXT_SETTINGS,HZ/2))
{
- case SETTINGS_DEC:
+ case ACTION_SETTINGS_DEC:
if (view)
view--;
break;
- case SETTINGS_INC:
+ case ACTION_SETTINGS_INC:
if (view < 3)
view++;
break;
- case SETTINGS_OK:
- case SETTINGS_CANCEL:
+ case ACTION_STD_CANCEL:
+ action_signalscreenchange();
return false;
}
}
@@ -1498,41 +1443,40 @@ static bool view_runtime(void)
lcd_update();
/* Wait for a key to be pushed */
- key = button_get_w_tmo(HZ);
+ key = get_action(CONTEXT_SETTINGS,HZ);
switch(key) {
- case SETTINGS_CANCEL:
+ case ACTION_STD_CANCEL:
done = true;
break;
- case SETTINGS_INC:
- case SETTINGS_DEC:
+ case ACTION_SETTINGS_INC:
+ case ACTION_SETTINGS_DEC:
if (state == 1)
state = 2;
else
state = 1;
break;
- case SETTINGS_OK:
+ case ACTION_STD_OK:
lcd_clear_display();
+ /*NOTE: this needs to be changed to sync splash! */
lcd_puts(0,0,"Clear time?");
lcd_puts(0,1,"PLAY = Yes");
lcd_update();
while (1) {
- key = button_get(true);
- if ( key == SETTINGS_OK ) {
+ key = get_action(CONTEXT_STD,TIMEOUT_BLOCK);
+ if ( key == ACTION_STD_OK ) {
if ( state == 1 )
global_settings.runtime = 0;
else
global_settings.topruntime = 0;
break;
}
- if (!(key & BUTTON_REL)) /* ignore button releases */
- break;
}
break;
}
}
-
+ action_signalscreenchange();
return false;
}
@@ -1620,27 +1564,26 @@ bool dbg_mmc_info(void)
lcd_update();
- switch (button_get_w_tmo(HZ/2))
+ switch (get_action(CONTEXT_SETTINGS,HZ/2))
{
- case SETTINGS_OK:
- case SETTINGS_CANCEL:
+ case ACTION_STD_CANCEL:
done = true;
break;
- case SETTINGS_DEC:
+ case ACTION_SETTINGS_DEC:
currval--;
if (currval < 0)
currval = 3;
break;
- case SETTINGS_INC:
+ case ACTION_SETTINGS_INC:
currval++;
if (currval > 3)
currval = 0;
break;
}
}
-
+ action_signalscreenchange();
return false;
}
#else /* !HAVE_MMC */
@@ -1781,26 +1724,25 @@ static bool dbg_disk_info(void)
lcd_update();
/* Wait for a key to be pushed */
- key = button_get_w_tmo(HZ*5);
+ key = get_action(CONTEXT_SETTINGS,HZ/5);
switch(key) {
- case SETTINGS_OK:
- case SETTINGS_CANCEL:
+ case ACTION_STD_CANCEL:
done = true;
break;
- case SETTINGS_DEC:
+ case ACTION_SETTINGS_DEC:
if (--page < 0)
page = max_page;
break;
- case SETTINGS_INC:
+ case ACTION_SETTINGS_INC:
if (++page > max_page)
page = 0;
break;
}
lcd_stop_scroll();
}
-
+ action_signalscreenchange();
return false;
}
#endif /* !HAVE_MMC */
@@ -1849,13 +1791,8 @@ static bool dbg_dircache_info(void)
lcd_update();
- switch (button_get_w_tmo(HZ/2))
- {
- case SETTINGS_OK:
- case SETTINGS_CANCEL:
- done = true;
- break;
- }
+ if (action_userabort(HZ/2))
+ return false;
}
return false;
@@ -1900,13 +1837,8 @@ static bool dbg_tagcache_info(void)
lcd_update();
- switch (button_get_w_tmo(HZ/2))
- {
- case SETTINGS_OK:
- case SETTINGS_CANCEL:
- done = true;
- break;
- }
+ if (action_userabort(HZ/2))
+ return false;
}
return false;
@@ -1979,7 +1911,6 @@ bool dbg_save_roms(void)
bool dbg_fm_radio(void)
{
char buf[32];
- int button;
bool fm_detected;
#ifdef HAVE_LCD_BITMAP
@@ -2010,13 +1941,8 @@ bool dbg_fm_radio(void)
lcd_update();
- button = button_get_w_tmo(HZ);
-
- switch(button)
- {
- case SETTINGS_CANCEL:
- return false;
- }
+ if (action_userabort(TIMEOUT_BLOCK))
+ return false;
}
return false;
}
diff --git a/apps/eq_menu.c b/apps/eq_menu.c
index 32d16c47e1..7c8b1590c3 100644
--- a/apps/eq_menu.c
+++ b/apps/eq_menu.c
@@ -26,7 +26,7 @@
#include "kernel.h"
#include "lcd.h"
#include "menu.h"
-#include "button.h"
+#include "action.h"
#include "mp3_playback.h"
#include "settings.h"
#include "statusbar.h"
@@ -49,73 +49,6 @@
#include "wm8758.h"
#endif
-/* Key definitions */
-#if (CONFIG_KEYPAD == IRIVER_H100_PAD || \
- CONFIG_KEYPAD == IRIVER_H300_PAD)
-
-#define EQ_BTN_MODIFIER BUTTON_ON
-#define EQ_BTN_DECREMENT BUTTON_LEFT
-#define EQ_BTN_INCREMENT BUTTON_RIGHT
-#define EQ_BTN_NEXT_BAND BUTTON_DOWN
-#define EQ_BTN_PREV_BAND BUTTON_UP
-#define EQ_BTN_CHANGE_MODE BUTTON_SELECT
-#define EQ_BTN_EXIT BUTTON_OFF
-
-#define EQ_BTN_RC_PREV_BAND BUTTON_RC_REW
-#define EQ_BTN_RC_NEXT_BAND BUTTON_RC_FF
-#define EQ_BTN_RC_DECREMENT BUTTON_RC_SOURCE
-#define EQ_BTN_RC_INCREMENT BUTTON_RC_BITRATE
-#define EQ_BTN_RC_CHANGE_MODE BUTTON_RC_MENU
-#define EQ_BTN_RC_EXIT BUTTON_RC_STOP
-
-#elif (CONFIG_KEYPAD == IPOD_4G_PAD) || \
- (CONFIG_KEYPAD == IPOD_3G_PAD)
-
-#define EQ_BTN_DECREMENT BUTTON_SCROLL_BACK
-#define EQ_BTN_INCREMENT BUTTON_SCROLL_FWD
-#define EQ_BTN_NEXT_BAND BUTTON_RIGHT
-#define EQ_BTN_PREV_BAND BUTTON_LEFT
-#define EQ_BTN_CHANGE_MODE BUTTON_SELECT
-#define EQ_BTN_EXIT BUTTON_MENU
-
-#elif CONFIG_KEYPAD == IAUDIO_X5_PAD
-
-#define EQ_BTN_DECREMENT BUTTON_LEFT
-#define EQ_BTN_INCREMENT BUTTON_RIGHT
-#define EQ_BTN_NEXT_BAND BUTTON_DOWN
-#define EQ_BTN_PREV_BAND BUTTON_UP
-#define EQ_BTN_CHANGE_MODE BUTTON_REC
-#define EQ_BTN_EXIT BUTTON_SELECT
-
-#elif (CONFIG_KEYPAD == IRIVER_IFP7XX_PAD)
-
-#define EQ_BTN_DECREMENT BUTTON_LEFT
-#define EQ_BTN_INCREMENT BUTTON_RIGHT
-#define EQ_BTN_NEXT_BAND BUTTON_DOWN
-#define EQ_BTN_PREV_BAND BUTTON_UP
-#define EQ_BTN_CHANGE_MODE BUTTON_SELECT
-#define EQ_BTN_EXIT BUTTON_PLAY
-
-#elif (CONFIG_KEYPAD == GIGABEAT_PAD)
-
-#define EQ_BTN_DECREMENT BUTTON_LEFT
-#define EQ_BTN_INCREMENT BUTTON_RIGHT
-#define EQ_BTN_NEXT_BAND BUTTON_DOWN
-#define EQ_BTN_PREV_BAND BUTTON_UP
-#define EQ_BTN_CHANGE_MODE BUTTON_SELECT
-#define EQ_BTN_EXIT BUTTON_A
-
-#elif CONFIG_KEYPAD == IRIVER_H10_PAD
-
-#define EQ_BTN_DECREMENT BUTTON_LEFT
-#define EQ_BTN_INCREMENT BUTTON_RIGHT
-#define EQ_BTN_NEXT_BAND BUTTON_SCROLL_DOWN
-#define EQ_BTN_PREV_BAND BUTTON_SCROLL_UP
-#define EQ_BTN_CHANGE_MODE BUTTON_PLAY
-#define EQ_BTN_EXIT BUTTON_POWER
-
-#endif
-
/* Various user interface limits and sizes */
#define EQ_CUTOFF_MIN 20
#define EQ_CUTOFF_MAX 22040
@@ -686,27 +619,19 @@ bool eq_menu_graphical(void)
screens[i].update();
}
- button = button_get(true);
+ button = get_action(CONTEXT_SETTINGSGRAPHICAL,TIMEOUT_BLOCK);
switch (button) {
- case EQ_BTN_DECREMENT:
- case EQ_BTN_DECREMENT | BUTTON_REPEAT:
-#ifdef EQ_BTN_RC_DECREMENT
- case EQ_BTN_RC_DECREMENT:
- case EQ_BTN_RC_DECREMENT | BUTTON_REPEAT:
-#endif
+ case ACTION_SETTINGS_DEC:
+ case ACTION_SETTINGS_DECREPEAT:
*(setting) -= step;
has_changed = true;
if (*(setting) < min)
*(setting) = min;
break;
- case EQ_BTN_INCREMENT:
- case EQ_BTN_INCREMENT | BUTTON_REPEAT:
-#ifdef EQ_BTN_RC_INCREMENT
- case EQ_BTN_RC_INCREMENT:
- case EQ_BTN_RC_INCREMENT | BUTTON_REPEAT:
-#endif
+ case ACTION_SETTINGS_INC:
+ case ACTION_SETTINGS_INCREPEAT:
*(setting) += step;
has_changed = true;
if (*(setting) > max)
@@ -731,45 +656,27 @@ bool eq_menu_graphical(void)
break;
#endif
- case EQ_BTN_PREV_BAND:
- case EQ_BTN_PREV_BAND | BUTTON_REPEAT:
-#ifdef EQ_BTN_RC_PREV_BAND
- case EQ_BTN_RC_PREV_BAND:
- case EQ_BTN_RC_PREV_BAND | BUTTON_REPEAT:
-#endif
+ case ACTION_STD_PREV:
+ case ACTION_STD_PREVREPEAT:
current_band--;
if (current_band < 0)
current_band = 4; /* wrap around */
break;
- case EQ_BTN_NEXT_BAND:
- case EQ_BTN_NEXT_BAND | BUTTON_REPEAT:
-#ifdef EQ_BTN_RC_NEXT_BAND
- case EQ_BTN_RC_NEXT_BAND:
- case EQ_BTN_RC_NEXT_BAND | BUTTON_REPEAT:
-#endif
+ case ACTION_STD_NEXT:
+ case ACTION_STD_NEXTREPEAT:
current_band++;
if (current_band > 4)
current_band = 0; /* wrap around */
break;
- case EQ_BTN_CHANGE_MODE:
- case EQ_BTN_CHANGE_MODE | BUTTON_REPEAT:
-#ifdef EQ_BTN_RC_CHANGE_MODE
- case EQ_BTN_RC_CHANGE_MODE:
- case EQ_BTN_RC_CHANGE_MODE | BUTTON_REPEAT:
-#endif
+ case ACTION_STD_OK:
mode++;
if (mode > Q)
mode = GAIN; /* wrap around */
break;
- case EQ_BTN_EXIT:
- case EQ_BTN_EXIT | BUTTON_REPEAT:
-#ifdef EQ_BTN_RC_EXIT
- case EQ_BTN_RC_EXIT:
- case EQ_BTN_RC_EXIT | BUTTON_REPEAT:
-#endif
+ case ACTION_STD_CANCEL:
exit_request = true;
result = false;
break;
@@ -789,6 +696,7 @@ bool eq_menu_graphical(void)
}
}
+ action_signalscreenchange();
/* Reset screen settings */
FOR_NB_SCREENS(i) {
screens[i].setfont(FONT_UI);
diff --git a/apps/gui/color_picker.c b/apps/gui/color_picker.c
index 4618cb6bc0..3decd30207 100644
--- a/apps/gui/color_picker.c
+++ b/apps/gui/color_picker.c
@@ -29,64 +29,11 @@
#include "scrollbar.h"
#include "lang.h"
#include "splash.h"
+#include "action.h"
#define TEXT_MARGIN display->char_width+2
#define SLIDER_START 20
-#if (CONFIG_KEYPAD == IRIVER_H300_PAD)
-#define SLIDER_UP BUTTON_UP
-#define SLIDER_DOWN BUTTON_DOWN
-#define SLIDER_LEFT BUTTON_LEFT
-#define SLIDER_RIGHT BUTTON_RIGHT
-#define SLIDER_OK BUTTON_ON
-#define SLIDER_OK2 BUTTON_SELECT
-#define SLIDER_CANCEL BUTTON_OFF
-
-#define SLIDER_RC_UP BUTTON_RC_REW
-#define SLIDER_RC_DOWN BUTTON_RC_FF
-#define SLIDER_RC_LEFT BUTTON_RC_SOURCE
-#define SLIDER_RC_RIGHT BUTTON_RC_BITRATE
-#define SLIDER_RC_OK BUTTON_RC_ON
-#define SLIDER_RC_CANCEL BUTTON_RC_STOP
-
-#elif (CONFIG_KEYPAD == GIGABEAT_PAD)
-#define SLIDER_UP BUTTON_UP
-#define SLIDER_DOWN BUTTON_DOWN
-#define SLIDER_LEFT BUTTON_LEFT
-#define SLIDER_RIGHT BUTTON_RIGHT
-#define SLIDER_OK BUTTON_POWER
-#define SLIDER_CANCEL BUTTON_A
-
-#elif (CONFIG_KEYPAD == IPOD_4G_PAD)
-#define SLIDER_UP BUTTON_LEFT
-#define SLIDER_DOWN BUTTON_RIGHT
-#define SLIDER_LEFT BUTTON_SCROLL_BACK
-#define SLIDER_RIGHT BUTTON_SCROLL_FWD
-#define SLIDER_OK BUTTON_SELECT
-#define SLIDER_CANCEL BUTTON_MENU
-
-#elif (CONFIG_KEYPAD == IAUDIO_X5_PAD)
-#define SLIDER_UP BUTTON_UP
-#define SLIDER_DOWN BUTTON_DOWN
-#define SLIDER_LEFT BUTTON_LEFT
-#define SLIDER_RIGHT BUTTON_RIGHT
-#define SLIDER_OK BUTTON_SELECT
-#define SLIDER_CANCEL BUTTON_PLAY
-
-/* FIXME: chosen at will to make it compile */
-#define SLIDER_RC_OK BUTTON_RC_PLAY
-#define SLIDER_RC_CANCEL BUTTON_RC_REC
-
-#elif (CONFIG_KEYPAD == IRIVER_H10_PAD)
-#define SLIDER_UP BUTTON_SCROLL_UP
-#define SLIDER_DOWN BUTTON_SCROLL_DOWN
-#define SLIDER_LEFT BUTTON_LEFT
-#define SLIDER_RIGHT BUTTON_RIGHT
-#define SLIDER_OK BUTTON_PLAY
-#define SLIDER_CANCEL BUTTON_POWER
-
-#endif
-
static const int max_val[3] = {LCD_MAX_RED,LCD_MAX_GREEN,LCD_MAX_BLUE};
static void draw_screen(struct screen *display, char *title,
@@ -237,50 +184,30 @@ bool set_color(struct screen *display,char *title, int* color, int banned_color)
draw_screen(&screens[i], title, rgb_val, newcolor, slider);
}
- button = button_get(true);
+ button = get_action(CONTEXT_SETTINGSGRAPHICAL,TIMEOUT_BLOCK);
switch (button)
{
- case SLIDER_UP:
-#ifdef SLIDER_RC_UP
- case SLIDER_RC_UP:
-#endif
+ case ACTION_STD_PREV:
slider = (slider+2)%3;
break;
- case SLIDER_DOWN:
-#ifdef SLIDER_RC_DOWN
- case SLIDER_RC_DOWN:
-#endif
+ case ACTION_STD_NEXT:
slider = (slider+1)%3;
break;
- case SLIDER_RIGHT:
- case SLIDER_RIGHT|BUTTON_REPEAT:
-#ifdef SLIDER_RC_RIGHT
- case SLIDER_RC_RIGHT:
- case SLIDER_RC_RIGHT|BUTTON_REPEAT:
-#endif
+ case ACTION_SETTINGS_INC:
+ case ACTION_SETTINGS_INCREPEAT:
if (rgb_val[slider] < max_val[slider])
rgb_val[slider]++;
break;
- case SLIDER_LEFT:
- case SLIDER_LEFT|BUTTON_REPEAT:
-#ifdef SLIDER_RC_LEFT
- case SLIDER_RC_LEFT:
- case SLIDER_RC_LEFT|BUTTON_REPEAT:
-#endif
+ case ACTION_SETTINGS_DEC:
+ case ACTION_SETTINGS_DECREPEAT:
if (rgb_val[slider] > 0)
rgb_val[slider]--;
break;
- case SLIDER_OK:
-#ifdef HAVE_REMOTE_LCD
- case SLIDER_RC_OK:
-#endif
-#ifdef SLIDER_OK2
- case SLIDER_OK2:
-#endif
+ case ACTION_STD_OK:
if ((banned_color!=-1) && (banned_color == newcolor))
{
gui_syncsplash(HZ*2,true,str(LANG_COLOR_UNACCEPTABLE));
@@ -290,10 +217,7 @@ bool set_color(struct screen *display,char *title, int* color, int banned_color)
exit = 1;
break;
- case SLIDER_CANCEL:
-#ifdef HAVE_REMOTE_LCD
- case SLIDER_RC_CANCEL:
-#endif
+ case ACTION_STD_CANCEL:
exit = 1;
break;
@@ -306,6 +230,6 @@ bool set_color(struct screen *display,char *title, int* color, int banned_color)
}
}
display->set_foreground(fgcolor);
-
+ action_signalscreenchange();
return false;
}
diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c
index d83ac55787..72ad4d6e93 100644
--- a/apps/gui/gwps-common.c
+++ b/apps/gui/gwps-common.c
@@ -52,6 +52,7 @@
#include "backdrop.h"
#endif
#include "dsp.h"
+#include "action.h"
#ifdef HAVE_LCD_CHARCELLS
static bool draw_player_progress(struct gui_wps *gwps);
@@ -2319,19 +2320,18 @@ bool ffwd_rew(int button)
bool usb = false;
int i = 0;
+ if (button == ACTION_NONE)
+ {
+ status_set_ffmode(0);
+ return usb;
+ }
while (!exit)
{
switch ( button )
{
- case WPS_FFWD:
-#ifdef WPS_RC_FFWD
- case WPS_RC_FFWD:
-#endif
+ case ACTION_WPS_SEEKFWD:
direction = 1;
- case WPS_REW:
-#ifdef WPS_RC_REW
- case WPS_RC_REW:
-#endif
+ case ACTION_WPS_SEEKBACK:
if (wps_state.ff_rewind)
{
if (direction == 1)
@@ -2415,12 +2415,7 @@ bool ffwd_rew(int button)
break;
- case WPS_PREV:
- case WPS_NEXT:
-#ifdef WPS_RC_PREV
- case WPS_RC_PREV:
- case WPS_RC_NEXT:
-#endif
+ case ACTION_WPS_STOPSEEK:
wps_state.id3->elapsed = wps_state.id3->elapsed+ff_rewind_count;
audio_ff_rewind(wps_state.id3->elapsed);
ff_rewind_count = 0;
@@ -2445,9 +2440,9 @@ bool ffwd_rew(int button)
break;
}
if (!exit)
- button = button_get(true);
+ button = get_action(CONTEXT_WPS,TIMEOUT_BLOCK);
}
-
+ action_signalscreenchange();
return usb;
}
@@ -2547,7 +2542,7 @@ bool update(struct gui_wps *gwps)
return retcode;
}
-#ifdef WPS_KEYLOCK
+
void display_keylock_text(bool locked)
{
char* s;
@@ -2569,11 +2564,3 @@ void display_keylock_text(bool locked)
gui_syncsplash(HZ, true, s);
}
-void waitfor_nokey(void)
-{
- /* wait until all keys are released */
- while (button_get(false) != BUTTON_NONE)
- yield();
-}
-#endif
-
diff --git a/apps/gui/gwps-common.h b/apps/gui/gwps-common.h
index ecda1d47ea..b4d6df589a 100644
--- a/apps/gui/gwps-common.h
+++ b/apps/gui/gwps-common.h
@@ -35,9 +35,6 @@ bool update(struct gui_wps *gwps);
bool ffwd_rew(int button);
bool wps_data_preload_tags(struct wps_data *data, char *buf,
const char *bmpdir, size_t bmpdirlen);
-#ifdef WPS_KEYLOCK
void display_keylock_text(bool locked);
-void waitfor_nokey(void);
-#endif
#endif
diff --git a/apps/gui/gwps.c b/apps/gui/gwps.c
index 1b19c13547..bd9bb5e07b 100644
--- a/apps/gui/gwps.c
+++ b/apps/gui/gwps.c
@@ -25,7 +25,7 @@
#include "lcd.h"
#include "font.h"
#include "backlight.h"
-#include "button.h"
+#include "action.h"
#include "kernel.h"
#include "tree.h"
#include "debug.h"
@@ -84,14 +84,11 @@ static void gui_wps_set_margin(struct gui_wps *gwps)
long gui_wps_show(void)
{
- long button = 0, lastbutton = 0;
- bool ignore_keyup = true;
+ long button = 0;
bool restore = false;
long restoretimer = 0; /* timer to delay screen redraw temporarily */
bool exit = false;
bool update_track = false;
- unsigned long right_lastclick = 0;
- unsigned long left_lastclick = 0;
int i;
wps_state_init();
@@ -163,8 +160,8 @@ long gui_wps_show(void)
long next_big_refresh = current_tick + HZ / 5;
button = BUTTON_NONE;
while (TIME_BEFORE(current_tick, next_big_refresh)) {
- button = button_get(false);
- if (button != BUTTON_NONE) {
+ button = get_action(CONTEXT_WPS,TIMEOUT_NOBLOCK);
+ if (button != ACTION_NONE) {
break;
}
peak_meter_peek();
@@ -186,35 +183,10 @@ long gui_wps_show(void)
/* The peak meter is disabled
-> no additional screen updates needed */
else {
- button = button_get_w_tmo(HZ/5);
+ button = get_action(CONTEXT_WPS,HZ/5);
}
#else
- button = button_get_w_tmo(HZ/5);
-#endif
-
- /* discard first event if it's a button release */
- if (button && ignore_keyup)
- {
- ignore_keyup = false;
- /* Negative events are system events */
- if (button >= 0 && button & BUTTON_REL )
- continue;
- }
-
-#ifdef WPS_KEYLOCK
- /* ignore non-remote buttons when keys are locked */
- if (keys_locked &&
- ! ((button < 0) ||
- (button == BUTTON_NONE) ||
- ((button & WPS_KEYLOCK) == WPS_KEYLOCK) ||
- (button & BUTTON_REMOTE)
- ))
- {
- if (!(button & BUTTON_REL))
- display_keylock_text(true);
- restore = true;
- button = BUTTON_NONE;
- }
+ button = get_action(CONTEXT_WPS,HZ/5);
#endif
/* Exit if audio has stopped playing. This can happen if using the
@@ -222,17 +194,14 @@ long gui_wps_show(void)
from F1 */
if (!audio_status())
exit = true;
-
+
switch(button)
{
-#ifdef WPS_CONTEXT
- case WPS_CONTEXT:
-#ifdef WPS_RC_CONTEXT
- case WPS_RC_CONTEXT:
-#endif
+ case ACTION_WPS_CONTEXT:
#ifdef HAVE_LCD_COLOR
show_main_backdrop();
#endif
+ action_signalscreenchange();
onplay(wps_state.id3->path, TREE_ATTR_MPA, CONTEXT_WPS);
#ifdef HAVE_LCD_COLOR
show_wps_backdrop();
@@ -245,20 +214,8 @@ long gui_wps_show(void)
#endif
restore = true;
break;
-#endif
-#ifdef WPS_RC_BROWSE
- case WPS_RC_BROWSE:
-#endif
- case WPS_BROWSE:
-#ifdef WPS_BROWSE_PRE
- if ((lastbutton != WPS_BROWSE_PRE)
-#ifdef WPS_RC_BROWSE_PRE
- && (lastbutton != WPS_RC_BROWSE_PRE)
-#endif
- )
- break;
-#endif
+ case ACTION_WPS_BROWSE:
#ifdef HAVE_LCD_CHARCELLS
status_set_record(false);
status_set_audio(false);
@@ -270,26 +227,14 @@ long gui_wps_show(void)
if (global_settings.browse_current &&
wps_state.current_track_path[0] != '\0')
set_current_file(wps_state.current_track_path);
-
+ action_signalscreenchange();
return 0;
break;
/* play/pause */
- case WPS_PAUSE:
-#ifdef WPS_PAUSE_PRE
- if (lastbutton != WPS_PAUSE_PRE)
- break;
-#endif
-#ifdef WPS_RC_PAUSE
- case WPS_RC_PAUSE:
+ case ACTION_WPS_PLAY:
if (global_settings.party_mode)
break;
-#ifdef WPS_RC_PAUSE_PRE
- if ((button == WPS_RC_PAUSE) &&
- (lastbutton != WPS_RC_PAUSE_PRE))
- break;
-#endif
-#endif
if ( wps_state.paused )
{
wps_state.paused = false;
@@ -313,12 +258,7 @@ long gui_wps_show(void)
break;
/* volume up */
- case WPS_INCVOL:
- case WPS_INCVOL | BUTTON_REPEAT:
-#ifdef WPS_RC_INCVOL
- case WPS_RC_INCVOL:
- case WPS_RC_INCVOL | BUTTON_REPEAT:
-#endif
+ case ACTION_WPS_VOLUP:
{
global_settings.volume++;
bool res = false;
@@ -336,12 +276,7 @@ long gui_wps_show(void)
break;
/* volume down */
- case WPS_DECVOL:
- case WPS_DECVOL | BUTTON_REPEAT:
-#ifdef WPS_RC_DECVOL
- case WPS_RC_DECVOL:
- case WPS_RC_DECVOL | BUTTON_REPEAT:
-#endif
+ case ACTION_WPS_VOLDOWN:
{
global_settings.volume--;
setvol();
@@ -357,59 +292,18 @@ long gui_wps_show(void)
}
}
break;
-
/* fast forward / rewind */
-#ifdef WPS_RC_FFWD
- case WPS_RC_FFWD:
-#endif
- case WPS_FFWD:
- if (global_settings.party_mode)
- break;
-
-#ifdef HAVE_DIR_NAVIGATION
- if (current_tick - right_lastclick < HZ)
- {
- audio_next_dir();
- right_lastclick = 0;
- break;
- }
-#endif
-
-#ifdef WPS_RC_REW
- case WPS_RC_REW:
-#endif
- case WPS_REW:
+ case ACTION_WPS_SEEKFWD:
+ case ACTION_WPS_SEEKBACK:
if (global_settings.party_mode)
break;
-
-#ifdef HAVE_DIR_NAVIGATION
- if (current_tick - left_lastclick < HZ)
- {
- audio_prev_dir();
- left_lastclick = 0;
- break;
- }
-#endif
-
ffwd_rew(button);
break;
/* prev / restart */
- case WPS_PREV:
-#ifdef WPS_PREV_PRE
- if (lastbutton != WPS_PREV_PRE)
- break;
-#endif
-#ifdef WPS_RC_PREV
- case WPS_RC_PREV:
+ case ACTION_WPS_SKIPPREV:
if (global_settings.party_mode)
break;
-#ifdef WPS_RC_PREV_PRE
- if ((button == WPS_RC_PREV) && (lastbutton != WPS_RC_PREV_PRE))
- break;
-#endif
-#endif
- left_lastclick = current_tick;
update_track = true;
#ifdef AB_REPEAT_ENABLE
@@ -450,61 +344,10 @@ long gui_wps_show(void)
}
break;
-#ifdef WPS_NEXT_DIR
-#ifdef WPS_RC_NEXT_DIR
- case WPS_RC_NEXT_DIR:
-#endif
- case WPS_NEXT_DIR:
- if (global_settings.party_mode)
- break;
-#if defined(AB_REPEAT_ENABLE) && defined(WPS_AB_SHARE_DIR_BUTTONS)
- if (ab_repeat_mode_enabled())
- {
- ab_set_B_marker(wps_state.id3->elapsed);
- ab_jump_to_A_marker();
- update_track = true;
- }
- else
-#endif
- {
- audio_next_dir();
- }
- break;
-#endif
-#ifdef WPS_PREV_DIR
-#ifdef WPS_RC_PREV_DIR
- case WPS_RC_PREV_DIR:
-#endif
- case WPS_PREV_DIR:
- if (global_settings.party_mode)
- break;
-#if defined(AB_REPEAT_ENABLE) && defined(WPS_AB_SHARE_DIR_BUTTONS)
- if (ab_repeat_mode_enabled())
- ab_set_A_marker(wps_state.id3->elapsed);
- else
-#endif
- {
- audio_prev_dir();
- }
- break;
-#endif
-
/* next */
- case WPS_NEXT:
-#ifdef WPS_NEXT_PRE
- if (lastbutton != WPS_NEXT_PRE)
- break;
-#endif
-#ifdef WPS_RC_NEXT
- case WPS_RC_NEXT:
+ case ACTION_WPS_SKIPNEXT:
if (global_settings.party_mode)
break;
-#ifdef WPS_RC_NEXT_PRE
- if ((button == WPS_RC_NEXT) && (lastbutton != WPS_RC_NEXT_PRE))
- break;
-#endif
-#endif
- right_lastclick = current_tick;
update_track = true;
#ifdef AB_REPEAT_ENABLE
@@ -527,27 +370,44 @@ long gui_wps_show(void)
audio_next();
break;
-
-#ifdef WPS_MENU
- /* menu key functions */
- case WPS_MENU:
-#ifdef WPS_MENU_PRE
- if (lastbutton != WPS_MENU_PRE)
+ /* next / prev directories */
+ case ACTION_WPS_NEXTDIR:
+ if (global_settings.party_mode)
break;
+#if defined(AB_REPEAT_ENABLE) && defined(WPS_AB_SHARE_DIR_BUTTONS)
+ if (ab_repeat_mode_enabled())
+ {
+ ab_set_B_marker(wps_state.id3->elapsed);
+ ab_jump_to_A_marker();
+ update_track = true;
+ }
+ else
#endif
-#ifdef WPS_RC_MENU
- case WPS_RC_MENU:
-#ifdef WPS_RC_MENU_PRE
- if ((button == WPS_RC_MENU) && (lastbutton != WPS_RC_MENU_PRE))
+ {
+ audio_next_dir();
+ }
+ break;
+ case ACTION_WPS_PREVDIR:
+ if (global_settings.party_mode)
break;
+#if defined(AB_REPEAT_ENABLE) && defined(WPS_AB_SHARE_DIR_BUTTONS)
+ if (ab_repeat_mode_enabled())
+ ab_set_A_marker(wps_state.id3->elapsed);
+ else
#endif
-#endif
+ {
+ audio_prev_dir();
+ }
+ break;
+ /* menu key functions */
+ case ACTION_WPS_MENU:
FOR_NB_SCREENS(i)
gui_wps[i].display->stop_scroll();
#ifdef HAVE_LCD_COLOR
show_main_backdrop();
#endif
+ action_signalscreenchange();
if (main_menu())
return true;
#ifdef HAVE_LCD_COLOR
@@ -561,25 +421,17 @@ long gui_wps_show(void)
#endif
restore = true;
break;
-#endif /* WPS_MENU */
-#ifdef WPS_KEYLOCK
/* key lock */
- case WPS_KEYLOCK:
- case WPS_KEYLOCK | BUTTON_REPEAT:
- keys_locked = !keys_locked;
- display_keylock_text(keys_locked);
+ case ACTION_STD_KEYLOCK:
+ action_setsoftwarekeylock(ACTION_STD_KEYLOCK,true);
+ display_keylock_text(true);
restore = true;
- waitfor_nokey();
break;
-#endif
+
#ifdef HAVE_QUICKSCREEN
- /* play settings */
- case WPS_QUICK:
-#ifdef WPS_RC_QUICK
- case WPS_RC_QUICK:
-#endif
+ case ACTION_WPS_QUICKSCREEN:
#ifdef HAVE_LCD_COLOR
show_main_backdrop();
#endif
@@ -595,8 +447,8 @@ long gui_wps_show(void)
}
#endif
restore = true;
- lastbutton = 0;
break;
+#endif /* HAVE_QUICKSCREEN */
/* screen settings */
#ifdef BUTTON_F3
@@ -611,17 +463,14 @@ long gui_wps_show(void)
{
gui_wps_set_margin(&gui_wps[i]);
}
-#endif
+#endif /* BUTTON_F3 */
restore = true;
- lastbutton = 0;
break;
#endif
/* pitch screen */
-#if CONFIG_KEYPAD == RECORDER_PAD || CONFIG_KEYPAD == IRIVER_H100_PAD \
- || CONFIG_KEYPAD == IRIVER_H300_PAD
- case BUTTON_ON | BUTTON_UP:
- case BUTTON_ON | BUTTON_DOWN:
+#ifdef HAVE_PITCHSCREEN
+ case ACTION_WPS_PITCHSCREEN:
#ifdef HAVE_LCD_COLOR
show_main_backdrop();
#endif
@@ -632,17 +481,10 @@ long gui_wps_show(void)
#endif
restore = true;
break;
-#endif
-#endif
+#endif /* HAVE_PITCHSCREEN */
#ifdef AB_REPEAT_ENABLE
-
-#ifdef WPS_AB_SINGLE
- case WPS_AB_SINGLE:
-#ifdef WPS_AB_SINGLE_PRE
- if (lastbutton != WPS_AB_SINGLE_PRE)
- break;
-#endif
+ case ACTION_WPSAB_SINGLE:
/* If we are using the menu option to enable ab_repeat mode, don't do anything
* when it's disabled */
#if (AB_REPEAT_ENABLE == 1)
@@ -661,20 +503,15 @@ long gui_wps_show(void)
}
ab_set_A_marker(wps_state.id3->elapsed);
break;
-#endif
-#ifdef WPS_AB_SET_A_MARKER
/* set A marker for A-B repeat */
- case WPS_AB_SET_A_MARKER:
+ case ACTION_WPSAB_SETA:
if (ab_repeat_mode_enabled())
ab_set_A_marker(wps_state.id3->elapsed);
break;
-#endif
-
-#ifdef WPS_AB_SET_B_MARKER
/* set B marker for A-B repeat and jump to A */
- case WPS_AB_SET_B_MARKER:
+ case ACTION_WPSAB_SETB:
if (ab_repeat_mode_enabled())
{
ab_set_B_marker(wps_state.id3->elapsed);
@@ -682,46 +519,24 @@ long gui_wps_show(void)
update_track = true;
}
break;
-#endif
-
-#ifdef WPS_AB_RESET_AB_MARKERS
/* reset A&B markers */
- case WPS_AB_RESET_AB_MARKERS:
+ case ACTION_WPSAB_RESET:
if (ab_repeat_mode_enabled())
{
ab_reset_markers();
update_track = true;
}
break;
-#endif
-
#endif /* AB_REPEAT_ENABLE */
/* stop and exit wps */
-#ifdef WPS_EXIT
- case WPS_EXIT:
-# ifdef WPS_EXIT_PRE
- if ((lastbutton & ~BUTTON_REPEAT) != WPS_EXIT_PRE)
- break;
-# endif
- if (global_settings.party_mode)
- break;
- exit = true;
-#ifdef WPS_RC_EXIT
- case WPS_RC_EXIT:
-#ifdef WPS_RC_EXIT_PRE
- if ((lastbutton & ~BUTTON_REPEAT) != WPS_RC_EXIT_PRE)
- break;
-#endif
+ case ACTION_WPS_STOP:
if (global_settings.party_mode)
break;
exit = true;
-#endif
break;
-#endif
-#ifdef WPS_ID3
- case WPS_ID3:
+ case ACTION_WPS_ID3SCREEN:
#ifdef HAVE_LCD_COLOR
show_main_backdrop();
#endif
@@ -737,10 +552,10 @@ long gui_wps_show(void)
#endif
restore = true;
break;
-#endif
- case BUTTON_NONE: /* Timeout */
+ case ACTION_NONE: /* Timeout */
update_track = true;
+ ffwd_rew(button); /* hopefully fix the ffw/rwd bug */
break;
case SYS_POWEROFF:
@@ -779,6 +594,7 @@ long gui_wps_show(void)
}
if (exit) {
+ action_signalscreenchange();
#ifdef HAVE_LCD_CHARCELLS
status_set_record(false);
status_set_audio(false);
@@ -830,8 +646,6 @@ long gui_wps_show(void)
gui_wps_refresh(&gui_wps[i], 0, WPS_REFRESH_NON_STATIC);
}
}
- if (button != BUTTON_NONE)
- lastbutton = button;
}
return 0; /* unreachable - just to reduce compiler warnings */
}
diff --git a/apps/gui/list.c b/apps/gui/list.c
index b17e01ed90..f48d4d9ee1 100644
--- a/apps/gui/list.c
+++ b/apps/gui/list.c
@@ -26,6 +26,7 @@
#include "settings.h"
#include "kernel.h"
+#include "action.h"
#include "screen_access.h"
#include "list.h"
#include "scrollbar.h"
@@ -683,106 +684,65 @@ unsigned gui_synclist_do_button(struct gui_synclist * lists, unsigned button)
gui_synclist_limit_scroll(lists, true);
switch(button)
{
- case LIST_PREV:
-#ifdef LIST_RC_PREV
- case LIST_RC_PREV:
-#endif
+ case ACTION_STD_PREV:
gui_synclist_limit_scroll(lists, false);
- case LIST_PREV | BUTTON_REPEAT:
-#ifdef LIST_RC_PREV
- case LIST_RC_PREV | BUTTON_REPEAT:
-#endif
+ case ACTION_STD_PREVREPEAT:
gui_synclist_select_previous(lists);
gui_synclist_draw(lists);
yield();
- return LIST_PREV;
+ return ACTION_STD_PREV;
- case LIST_NEXT:
-#ifdef LIST_RC_NEXT
- case LIST_RC_NEXT:
-#endif
+ case ACTION_STD_NEXT:
gui_synclist_limit_scroll(lists, false);
- case LIST_NEXT | BUTTON_REPEAT:
-#ifdef LIST_RC_NEXT
-
- case LIST_RC_NEXT | BUTTON_REPEAT:
-#endif
+ case ACTION_STD_NEXTREPEAT:
gui_synclist_select_next(lists);
gui_synclist_draw(lists);
yield();
- return LIST_NEXT;
+ return ACTION_STD_NEXT;
-#ifdef LIST_PGRIGHT
- case LIST_PGRIGHT:
-#if !(LIST_PGRIGHT & BUTTON_REPEAT)
- case LIST_PGRIGHT | BUTTON_REPEAT:
-#endif
-#ifdef LIST_RC_PGRIGHT
- case LIST_RC_PGRIGHT:
- case LIST_RC_PGRIGHT | BUTTON_REPEAT:
-#endif
+#ifdef HAVE_LCD_BITMAP
+ case ACTION_TREE_PGRIGHT:
gui_synclist_scroll_right(lists);
gui_synclist_draw(lists);
- return LIST_PGRIGHT;
-#endif
-
-#ifdef LIST_PGLEFT
- case LIST_PGLEFT:
-#if !(LIST_PGLEFT & BUTTON_REPEAT)
- case LIST_PGLEFT | BUTTON_REPEAT:
-#endif
-#ifdef LIST_RC_PGLEFT
- case LIST_RC_PGLEFT:
- case LIST_RC_PGLEFT | BUTTON_REPEAT:
-#endif
+ return ACTION_TREE_PGRIGHT;
+ case ACTION_TREE_PGLEFT:
gui_synclist_scroll_left(lists);
gui_synclist_draw(lists);
- return LIST_PGLEFT;
+ return ACTION_TREE_PGLEFT;
#endif
/* for pgup / pgdown, we are obliged to have a different behaviour depending on the screen
* for which the user pressed the key since for example, remote and main screen doesn't
* have the same number of lines*/
-#ifdef LIST_PGUP
- case LIST_PGUP:
+ case ACTION_LISTTREE_PGUP:
gui_synclist_limit_scroll(lists, false);
- case LIST_PGUP | BUTTON_REPEAT:
gui_synclist_select_previous_page(lists, SCREEN_MAIN);
gui_synclist_draw(lists);
yield();
- return LIST_NEXT;
-#endif
-
-#ifdef LIST_RC_PGUP
- case LIST_RC_PGUP:
+ return ACTION_STD_NEXT;
+
+ case ACTION_LISTTREE_PGDOWN:
gui_synclist_limit_scroll(lists, false);
- case LIST_RC_PGUP | BUTTON_REPEAT:
- gui_synclist_select_previous_page(lists, SCREEN_REMOTE);
+ gui_synclist_select_next_page(lists, SCREEN_MAIN);
gui_synclist_draw(lists);
yield();
- return LIST_NEXT;
-#endif
-
-#ifdef LIST_PGDN
- case LIST_PGDN:
+ return ACTION_STD_PREV;
+#if (REMOTE_BUTTON != 0 )
+ case ACTION_LISTTREE_RC_PGUP:
gui_synclist_limit_scroll(lists, false);
- case LIST_PGDN | BUTTON_REPEAT:
- gui_synclist_select_next_page(lists, SCREEN_MAIN);
+ gui_synclist_select_previous_page(lists, SCREEN_REMOTE);
gui_synclist_draw(lists);
yield();
- return LIST_PREV;
-#endif
-
-#ifdef LIST_RC_PGDN
- case LIST_RC_PGDN:
+ return ACTION_STD_NEXT;
+
+ case ACTION_LISTTREE_RC_PGDOWN:
gui_synclist_limit_scroll(lists, false);
- case LIST_RC_PGDN | BUTTON_REPEAT:
gui_synclist_select_next_page(lists, SCREEN_REMOTE);
gui_synclist_draw(lists);
yield();
- return LIST_PREV;
+ return ACTION_STD_PREV;
#endif
}
return 0;
diff --git a/apps/gui/list.h b/apps/gui/list.h
index 8d3ac9ad4c..2a80298379 100644
--- a/apps/gui/list.h
+++ b/apps/gui/list.h
@@ -26,89 +26,6 @@
#define SCROLLBAR_WIDTH 6
-/* Key assignement */
-#if (CONFIG_KEYPAD == IRIVER_H100_PAD) || \
- (CONFIG_KEYPAD == IRIVER_H300_PAD)
-#define LIST_NEXT BUTTON_DOWN
-#define LIST_PREV BUTTON_UP
-#define LIST_PGUP (BUTTON_ON | BUTTON_UP)
-#define LIST_PGDN (BUTTON_ON | BUTTON_DOWN)
-#define LIST_PGRIGHT (BUTTON_RIGHT | BUTTON_REPEAT)
-#define LIST_PGLEFT (BUTTON_LEFT | BUTTON_REPEAT)
-
-#ifdef CONFIG_REMOTE_KEYPAD
-#define LIST_RC_NEXT BUTTON_RC_FF
-#define LIST_RC_PREV BUTTON_RC_REW
-#define LIST_RC_PGUP BUTTON_RC_SOURCE
-#define LIST_RC_PGDN BUTTON_RC_BITRATE
-#define LIST_RC_PGRIGHT (BUTTON_RC_VOL_UP)
-#define LIST_RC_PGLEFT (BUTTON_RC_VOL_DOWN)
-#endif /* CONFIG_REMOTE_KEYPAD */
-
-#elif CONFIG_KEYPAD == RECORDER_PAD
-#define LIST_NEXT BUTTON_DOWN
-#define LIST_PREV BUTTON_UP
-#define LIST_PGUP (BUTTON_ON | BUTTON_UP)
-#define LIST_PGDN (BUTTON_ON | BUTTON_DOWN)
-#define LIST_PGRIGHT (BUTTON_RIGHT | BUTTON_REPEAT)
-#define LIST_PGLEFT (BUTTON_LEFT | BUTTON_REPEAT)
-
-#define LIST_RC_NEXT BUTTON_RC_RIGHT
-#define LIST_RC_PREV BUTTON_RC_LEFT
-
-#elif CONFIG_KEYPAD == PLAYER_PAD
-#define LIST_NEXT BUTTON_RIGHT
-#define LIST_PREV BUTTON_LEFT
-
-#define LIST_RC_NEXT BUTTON_RC_RIGHT
-#define LIST_RC_PREV BUTTON_RC_LEFT
-
-#elif CONFIG_KEYPAD == ONDIO_PAD
-#define LIST_NEXT BUTTON_DOWN
-#define LIST_PREV BUTTON_UP
-#define LIST_PGRIGHT (BUTTON_MENU | BUTTON_RIGHT)
-#define LIST_PGLEFT (BUTTON_MENU | BUTTON_LEFT)
-
-#elif (CONFIG_KEYPAD == IPOD_3G_PAD) || (CONFIG_KEYPAD == IPOD_4G_PAD)
-#define LIST_NEXT BUTTON_SCROLL_FWD
-#define LIST_PREV BUTTON_SCROLL_BACK
-#define LIST_PGRIGHT (BUTTON_RIGHT | BUTTON_REPEAT)
-#define LIST_PGLEFT (BUTTON_LEFT | BUTTON_REPEAT)
-
-#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
-#define LIST_NEXT BUTTON_DOWN
-#define LIST_PREV BUTTON_UP
-//#define LIST_PGRIGHT (BUTTON_RIGHT | BUTTON_)
-//#define LIST_PGLEFT (BUTTON_LEFT | BUTTON_) Todo: define those
-
-#elif CONFIG_KEYPAD == GMINI100_PAD
-#define LIST_NEXT BUTTON_DOWN
-#define LIST_PREV BUTTON_UP
-#define LIST_PGUP (BUTTON_ON | BUTTON_UP)
-#define LIST_PGDN (BUTTON_ON | BUTTON_DOWN)
-#define LIST_PGRIGHT (BUTTON_RIGHT | BUTTON_REPEAT)
-#define LIST_PGLEFT (BUTTON_LEFT | BUTTON_REPEAT)
-
-#elif CONFIG_KEYPAD == IAUDIO_X5_PAD
-#define LIST_NEXT BUTTON_DOWN
-#define LIST_PREV BUTTON_UP
-#define LIST_PGRIGHT (BUTTON_RIGHT | BUTTON_REPEAT)
-#define LIST_PGLEFT (BUTTON_LEFT | BUTTON_REPEAT)
-
-#elif CONFIG_KEYPAD == GIGABEAT_PAD
-#define LIST_NEXT BUTTON_DOWN
-#define LIST_PREV BUTTON_UP
-#define LIST_PGRIGHT (BUTTON_RIGHT | BUTTON_REPEAT)
-#define LIST_PGLEFT (BUTTON_LEFT | BUTTON_REPEAT)
-
-#elif CONFIG_KEYPAD == IRIVER_H10_PAD
-#define LIST_NEXT BUTTON_SCROLL_DOWN
-#define LIST_PREV BUTTON_SCROLL_UP
-#define LIST_PGRIGHT (BUTTON_RIGHT | BUTTON_REPEAT)
-#define LIST_PGLEFT (BUTTON_LEFT | BUTTON_REPEAT)
-
-#endif
-
/*
* The gui_list is based on callback functions, if you want the list
* to display something you have to provide it a function that
@@ -390,8 +307,8 @@ void gui_synclist_scroll_left(struct gui_synclist * lists);
* - lists : the synchronized lists
* - button : the keycode of a pressed button
* returned value :
- * - LIST_NEXT when moving forward (next item or pgup)
- * - LIST_PREV when moving backward (previous item or pgdown)
+ * - 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);
diff --git a/apps/gui/quickscreen.c b/apps/gui/quickscreen.c
index e998ee61ad..9465a2e5af 100644
--- a/apps/gui/quickscreen.c
+++ b/apps/gui/quickscreen.c
@@ -29,6 +29,7 @@
#include "kernel.h"
#include "misc.h"
#include "statusbar.h"
+#include "action.h"
void gui_quickscreen_init(struct gui_quickscreen * qs,
struct option_select *left_option,
@@ -128,59 +129,28 @@ bool gui_quickscreen_do_button(struct gui_quickscreen * qs, int button)
switch(button)
{
- case QUICKSCREEN_LEFT :
- case QUICKSCREEN_LEFT | BUTTON_REPEAT :
-#ifdef QUICKSCREEN_RC_LEFT
- case QUICKSCREEN_RC_LEFT :
- case QUICKSCREEN_RC_LEFT | BUTTON_REPEAT :
-#endif
+ case ACTION_QS_LEFT:
option_select_next(qs->left_option);
return(true);
- case QUICKSCREEN_BOTTOM :
- case QUICKSCREEN_BOTTOM | BUTTON_REPEAT :
-#ifdef QUICKSCREEN_RC_BOTTOM
- case QUICKSCREEN_RC_BOTTOM :
- case QUICKSCREEN_RC_BOTTOM | BUTTON_REPEAT :
-#endif
+ case ACTION_QS_DOWN:
option_select_next(qs->bottom_option);
return(true);
- case QUICKSCREEN_RIGHT :
- case QUICKSCREEN_RIGHT | BUTTON_REPEAT :
-#ifdef QUICKSCREEN_RC_RIGHT
- case QUICKSCREEN_RC_RIGHT :
- case QUICKSCREEN_RC_RIGHT | BUTTON_REPEAT :
-#endif
+ case ACTION_QS_RIGHT:
option_select_next(qs->right_option);
return(true);
-#ifdef QUICKSCREEN_BOTTOM_INV
- case QUICKSCREEN_BOTTOM_INV :
- case QUICKSCREEN_BOTTOM_INV | BUTTON_REPEAT :
-#endif
-#ifdef QUICKSCREEN_RC_BOTTOM_INV
- case QUICKSCREEN_RC_BOTTOM_INV :
- case QUICKSCREEN_RC_BOTTOM_INV | BUTTON_REPEAT :
-#endif
-#if defined(QUICKSCREEN_RC_BOTTOM_INV) || defined(QUICKSCREEN_BOTTOM_INV)
+ case ACTION_QS_DOWNINV:
option_select_prev(qs->bottom_option);
return(true);
-#endif
}
return(false);
}
-#ifdef BUTTON_REMOTE
-#define uncombine_button(key_read, combined_button) \
- key_read & ~(combined_button & ~BUTTON_REMOTE)
-#else
-#define uncombine_button(key_read, combined_button) \
- key_read & ~combined_button
-#endif
bool gui_syncquickscreen_run(struct gui_quickscreen * qs, int button_enter)
{
- int raw_key, button;
+ int button;
/* To quit we need either :
* - a second press on the button that made us enter
* - an action taken while pressing the enter button,
@@ -188,9 +158,9 @@ bool gui_syncquickscreen_run(struct gui_quickscreen * qs, int button_enter)
bool can_quit=false;
gui_syncquickscreen_draw(qs);
gui_syncstatusbar_draw(&statusbars, true);
+ action_signalscreenchange();
while (true) {
- raw_key = button_get(true);
- button=uncombine_button(raw_key, button_enter);
+ button = get_action(CONTEXT_QUICKSCREEN,TIMEOUT_BLOCK);
if(default_event_handler(button) == SYS_USB_CONNECTED)
return(true);
if(gui_quickscreen_do_button(qs, button))
@@ -200,23 +170,19 @@ bool gui_syncquickscreen_run(struct gui_quickscreen * qs, int button_enter)
qs->callback(qs);
gui_syncquickscreen_draw(qs);
}
- else if(raw_key==button_enter)
+ else if(button==button_enter)
can_quit=true;
- if(raw_key==(button_enter | BUTTON_REL) && can_quit)
- return(false);
-#ifdef QUICKSCREEN_QUIT
- if(raw_key==QUICKSCREEN_QUIT
-#ifdef QUICKSCREEN_QUIT2
- || raw_key==QUICKSCREEN_QUIT2
-#endif
-#if QUICKSCREEN_RC_QUIT
- || raw_key==QUICKSCREEN_RC_QUIT
-#endif
- )
- return(false);
-#endif /* QUICKSCREEN_QUIT */
+
+ if((button == button_enter) && can_quit)
+ break;
+
+ if(button==ACTION_STD_CANCEL)
+ break;
+
gui_syncstatusbar_draw(&statusbars, false);
}
+ action_signalscreenchange();
+ return false;
}
#endif /* HAVE_QUICKSCREEN */
diff --git a/apps/gui/quickscreen.h b/apps/gui/quickscreen.h
index 63214f3c22..ebc7cef61a 100644
--- a/apps/gui/quickscreen.h
+++ b/apps/gui/quickscreen.h
@@ -27,42 +27,6 @@
#include "option_select.h"
#include "screen_access.h"
-#define QUICKSCREEN_LEFT BUTTON_LEFT
-#define QUICKSCREEN_RIGHT BUTTON_RIGHT
-
-#if (CONFIG_KEYPAD == RECORDER_PAD)
-#define QUICKSCREEN_BOTTOM BUTTON_DOWN
-#define QUICKSCREEN_BOTTOM_INV BUTTON_UP
-#define QUICKSCREEN_QUIT BUTTON_F3
-#define QUICKSCREEN_QUIT2 BUTTON_OFF
-#elif (CONFIG_KEYPAD == IRIVER_H100_PAD) || (CONFIG_KEYPAD == IRIVER_H300_PAD)
-#define QUICKSCREEN_BOTTOM BUTTON_DOWN
-#define QUICKSCREEN_BOTTOM_INV BUTTON_UP
-#define QUICKSCREEN_QUIT BUTTON_MODE
-#define QUICKSCREEN_QUIT2 BUTTON_OFF
-#define QUICKSCREEN_RC_QUIT BUTTON_RC_MODE
-#ifdef CONFIG_REMOTE_KEYPAD
-#define QUICKSCREEN_RC_LEFT BUTTON_RC_REW
-#define QUICKSCREEN_RC_BOTTOM BUTTON_RC_VOL_DOWN
-#define QUICKSCREEN_RC_BOTTOM_INV BUTTON_RC_VOL_UP
-#define QUICKSCREEN_RC_RIGHT BUTTON_RC_FF
-#endif
-#elif (CONFIG_KEYPAD == IPOD_4G_PAD) || (CONFIG_KEYPAD == IPOD_3G_PAD)
-#define QUICKSCREEN_BOTTOM BUTTON_PLAY
-#define QUICKSCREEN_QUIT BUTTON_MENU
-#define QUICKSCREEN_QUIT2 BUTTON_SELECT
-#elif (CONFIG_KEYPAD == IAUDIO_X5_PAD)
-#define QUICKSCREEN_BOTTOM BUTTON_DOWN
-#define QUICKSCREEN_BOTTOM_INV BUTTON_UP
-#define QUICKSCREEN_QUIT BUTTON_REC
-#define QUICKSCREEN_QUIT2 BUTTON_POWER
-#elif (CONFIG_KEYPAD == IRIVER_H10_PAD)
-#define QUICKSCREEN_BOTTOM BUTTON_SCROLL_DOWN
-#define QUICKSCREEN_BOTTOM_INV BUTTON_SCROLL_UP
-#define QUICKSCREEN_QUIT BUTTON_REW
-#define QUICKSCREEN_QUIT2 BUTTON_POWER
-#endif
-
struct gui_quickscreen;
/*
* Callback function called each time the quickscreen gets modified
diff --git a/apps/gui/select.c b/apps/gui/select.c
index 89a047890c..12a93fcbcd 100644
--- a/apps/gui/select.c
+++ b/apps/gui/select.c
@@ -23,6 +23,7 @@
#include "textarea.h"
#include "screen_access.h"
#include "kernel.h"
+#include "action.h"
void gui_select_init_numeric(struct gui_select * select,
@@ -79,56 +80,28 @@ bool gui_syncselect_do_button(struct gui_select * select, int button)
{
switch(button)
{
- case SELECT_INC | BUTTON_REPEAT :
-#ifdef SELECT_RC_INC
- case SELECT_RC_INC | BUTTON_REPEAT :
-#endif
+ case ACTION_SETTINGS_INCREPEAT:
select->options.limit_loop = true;
- case SELECT_INC :
-#ifdef SELECT_RC_INC
- case SELECT_RC_INC :
-#endif
+ case ACTION_SETTINGS_INC:
option_select_next(&select->options);
return(true);
- case SELECT_DEC | BUTTON_REPEAT :
-#ifdef SELECT_RC_DEC
- case SELECT_RC_DEC | BUTTON_REPEAT :
-#endif
+ case ACTION_SETTINGS_DECREPEAT:
select->options.limit_loop = true;
- case SELECT_DEC :
-#ifdef SELECT_RC_DEC
- case SELECT_RC_DEC :
-#endif
+ case ACTION_SETTINGS_DEC:
option_select_prev(&select->options);
return(true);
- case SELECT_OK :
-#ifdef SELECT_RC_OK
- case SELECT_RC_OK :
-#endif
-#ifdef SELECT_RC_OK2
- case SELECT_RC_OK2 :
-#endif
-#ifdef SELECT_OK2
- case SELECT_OK2 :
-#endif
+ case ACTION_STD_OK:
+ case ACTION_STD_PREV: /*NOTE: this is in CONTEXT_SETTINGS ! */
select->validated=true;
return(false);
- case SELECT_CANCEL :
-#ifdef SELECT_CANCEL2
- case SELECT_CANCEL2 :
-#endif
-#ifdef SELECT_RC_CANCEL
- case SELECT_RC_CANCEL :
-#endif
-#ifdef SELECT_RC_CANCEL2
- case SELECT_RC_CANCEL2 :
-#endif
+ case ACTION_STD_CANCEL:
select->canceled = true;
gui_syncselect_draw(select);
sleep(HZ/2);
+ action_signalscreenchange();
return(false);
}
return(false);
diff --git a/apps/gui/select.h b/apps/gui/select.h
index 9270214d61..2556a683c8 100644
--- a/apps/gui/select.h
+++ b/apps/gui/select.h
@@ -23,104 +23,6 @@
#include "settings.h"
#include "option_select.h"
-#if (CONFIG_KEYPAD == IRIVER_H100_PAD) || \
- (CONFIG_KEYPAD == IRIVER_H300_PAD)
-#define SELECT_INC BUTTON_UP
-#define SELECT_DEC BUTTON_DOWN
-#define SELECT_OK BUTTON_SELECT
-#define SELECT_OK2 BUTTON_LEFT
-#define SELECT_CANCEL BUTTON_OFF
-#define SELECT_CANCEL2 BUTTON_MODE
-
-#define SELECT_RC_INC BUTTON_RC_FF
-#define SELECT_RC_DEC BUTTON_RC_REW
-#define SELECT_RC_OK BUTTON_RC_ON
-#define SELECT_RC_OK2 BUTTON_RC_MENU
-#define SELECT_RC_CANCEL BUTTON_RC_STOP
-#define SELECT_RC_CANCEL2 BUTTON_RC_MODE
-
-#elif CONFIG_KEYPAD == RECORDER_PAD
-#define SELECT_INC BUTTON_UP
-#define SELECT_DEC BUTTON_DOWN
-#define SELECT_OK BUTTON_PLAY
-#define SELECT_OK2 BUTTON_LEFT
-#define SELECT_CANCEL BUTTON_OFF
-#define SELECT_CANCEL2 BUTTON_F1
-
-#define SELECT_RC_INC BUTTON_RC_RIGHT
-#define SELECT_RC_DEC BUTTON_RC_LEFT
-#define SELECT_RC_OK BUTTON_RC_PLAY
-#define SELECT_RC_CANCEL BUTTON_RC_STOP
-
-#elif CONFIG_KEYPAD == PLAYER_PAD
-#define SELECT_INC BUTTON_RIGHT
-#define SELECT_DEC BUTTON_LEFT
-#define SELECT_OK BUTTON_PLAY
-#define SELECT_CANCEL BUTTON_STOP
-#define SELECT_CANCEL2 BUTTON_MENU
-
-#define SELECT_RC_INC BUTTON_RC_RIGHT
-#define SELECT_RC_DEC BUTTON_RC_LEFT
-#define SELECT_RC_OK BUTTON_RC_PLAY
-#define SELECT_RC_CANCEL BUTTON_RC_STOP
-
-#elif (CONFIG_KEYPAD == IPOD_3G_PAD) || (CONFIG_KEYPAD == IPOD_4G_PAD)
-#define SELECT_INC BUTTON_SCROLL_FWD
-#define SELECT_DEC BUTTON_SCROLL_BACK
-#define SELECT_OK BUTTON_SELECT
-#define SELECT_OK2 BUTTON_LEFT
-#define SELECT_CANCEL BUTTON_MENU
-
-#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
-#define SELECT_INC BUTTON_UP
-#define SELECT_DEC BUTTON_DOWN
-#define SELECT_OK BUTTON_RIGHT
-#define SELECT_OK2 BUTTON_LEFT
-#define SELECT_CANCEL BUTTON_PLAY
-#define SELECT_CANCEL2 BUTTON_MODE
-
-#elif CONFIG_KEYPAD == ONDIO_PAD
-#define SELECT_INC BUTTON_UP
-#define SELECT_DEC BUTTON_DOWN
-#define SELECT_OK BUTTON_RIGHT
-#define SELECT_OK2 BUTTON_LEFT
-#define SELECT_CANCEL BUTTON_MENU
-#define SELECT_CANCEL2 BUTTON_OFF
-
-#elif CONFIG_KEYPAD == GMINI100_PAD
-#define SELECT_INC BUTTON_UP
-#define SELECT_DEC BUTTON_DOWN
-#define SELECT_OK BUTTON_PLAY
-#define SELECT_OK2 BUTTON_LEFT
-#define SELECT_CANCEL BUTTON_OFF
-#define SELECT_CANCEL2 BUTTON_MENU
-
-#elif CONFIG_KEYPAD == IAUDIO_X5_PAD
-#define SELECT_INC BUTTON_UP
-#define SELECT_DEC BUTTON_DOWN
-#define SELECT_OK BUTTON_SELECT
-#define SELECT_OK2 BUTTON_LEFT
-#define SELECT_CANCEL BUTTON_PLAY
-#define SELECT_CANCEL2 BUTTON_POWER
-
-#elif CONFIG_KEYPAD == GIGABEAT_PAD
-#define SELECT_INC BUTTON_UP
-#define SELECT_DEC BUTTON_DOWN
-#define SELECT_OK BUTTON_MENU
-#define SELECT_OK2 BUTTON_LEFT
-#define SELECT_CANCEL BUTTON_A
-#define SELECT_CANCEL2 BUTTON_POWER
-
-#elif CONFIG_KEYPAD == IRIVER_H10_PAD
-#define SELECT_INC BUTTON_SCROLL_UP
-#define SELECT_DEC BUTTON_SCROLL_DOWN
-#define SELECT_OK BUTTON_PLAY
-#define SELECT_OK2 BUTTON_RIGHT
-#define SELECT_CANCEL BUTTON_POWER
-#define SELECT_CANCEL2 BUTTON_LEFT
-
-#endif
-
struct gui_select
{
bool canceled;
diff --git a/apps/gui/yesno.c b/apps/gui/yesno.c
index 225f6d3f43..d567cf9ed4 100644
--- a/apps/gui/yesno.c
+++ b/apps/gui/yesno.c
@@ -3,6 +3,7 @@
#include "kernel.h"
#include "misc.h"
#include "lang.h"
+#include "action.h"
void gui_yesno_init(struct gui_yesno * yn,
struct text_message * main_message,
@@ -54,7 +55,7 @@ bool gui_yesno_draw_result(struct gui_yesno * yn, enum yesno_res result)
gui_textarea_put_message(yn->display, message, 0);
return(true);
}
-
+#include "debug.h"
enum yesno_res gui_syncyesno_run(struct text_message * main_message,
struct text_message * yes_message,
struct text_message * no_message)
@@ -72,23 +73,21 @@ enum yesno_res gui_syncyesno_run(struct text_message * main_message,
}
while (result==-1)
{
- button = button_get(true);
+ button = get_action(CONTEXT_YESNOSCREEN,TIMEOUT_BLOCK);
+ DEBUGF("button=%x\n",button);
switch (button)
{
- case YESNO_OK:
-#ifdef YESNO_RC_OK
- case YESNO_RC_OK:
-#endif
+ case ACTION_YESNO_ACCEPT:
result=YESNO_YES;
break;
default:
if(default_event_handler(button) == SYS_USB_CONNECTED)
return(YESNO_USB);
- if(!(button & BUTTON_REL))
- result=YESNO_NO;
+ result = YESNO_NO;
}
}
+ action_signalscreenchange();
FOR_NB_SCREENS(i)
result_displayed=gui_yesno_draw_result(&(yn[i]), result);
if(result_displayed)
diff --git a/apps/gui/yesno.h b/apps/gui/yesno.h
index 71658a5217..7b60cab132 100644
--- a/apps/gui/yesno.h
+++ b/apps/gui/yesno.h
@@ -4,41 +4,6 @@
#include "screen_access.h"
#include "textarea.h"
-#if (CONFIG_KEYPAD == IRIVER_H100_PAD) || \
- (CONFIG_KEYPAD == IRIVER_H300_PAD)
-#define YESNO_OK BUTTON_SELECT
-#define YESNO_RC_OK BUTTON_RC_MENU
-
-#elif CONFIG_KEYPAD == RECORDER_PAD
-#define YESNO_OK BUTTON_PLAY
-#define YESNO_RC_OK BUTTON_RC_PLAY
-
-#elif CONFIG_KEYPAD == PLAYER_PAD
-#define YESNO_OK BUTTON_PLAY
-#define YESNO_RC_OK BUTTON_RC_PLAY
-
-#elif CONFIG_KEYPAD == ONDIO_PAD
-#define YESNO_OK BUTTON_RIGHT
-
-#elif CONFIG_KEYPAD == GMINI100_PAD
-#define YESNO_OK BUTTON_PLAY
-
-#elif (CONFIG_KEYPAD == IPOD_3G_PAD) || (CONFIG_KEYPAD == IPOD_4G_PAD)
-#define YESNO_OK BUTTON_PLAY
-
-#elif (CONFIG_KEYPAD == IRIVER_IFP7XX_PAD)
-#define YESNO_OK BUTTON_RIGHT
-
-#elif (CONFIG_KEYPAD == IAUDIO_X5_PAD)
-#define YESNO_OK BUTTON_RIGHT
-
-#elif (CONFIG_KEYPAD == GIGABEAT_PAD)
-#define YESNO_OK BUTTON_RIGHT
-
-#elif (CONFIG_KEYPAD == IRIVER_H10_PAD)
-#define YESNO_OK BUTTON_RIGHT
-
-#endif
enum yesno_res
{
YESNO_YES,
diff --git a/apps/keymaps/keymap-h1x0_h3x0.c b/apps/keymaps/keymap-h1x0_h3x0.c
new file mode 100644
index 0000000000..7e11c27dfc
--- /dev/null
+++ b/apps/keymaps/keymap-h1x0_h3x0.c
@@ -0,0 +1,386 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ *
+ * Copyright (C) 2006 Jonathan Gordon
+ *
+ * All files in this archive are subject to the GNU General Public License.
+ * See the file COPYING in the source tree root for full license agreement.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+/* Button Code Definitions for iriver h100/h300 target */
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include "config.h"
+#include "action.h"
+#include "button.h"
+#include "lcd-remote.h" /* for remote_type() */
+#include "settings.h"
+
+/*
+ * The format of the list is as follows
+ * { Action Code, Button code, Prereq button code }
+ * if there's no need to check the previous button's value, use BUTTON_NONE
+ * Insert LAST_ITEM_IN_LIST at the end of each mapping
+ */
+
+/* CONTEXT_CUSTOM's used in this file...
+
+CONTEXT_CUSTOM|CONTEXT_TREE = the standard list/tree defines (without directions)
+
+
+*/
+
+
+struct button_mapping button_context_standard[] = {
+ { ACTION_STD_PREV, BUTTON_UP, BUTTON_NONE },
+ { ACTION_STD_PREVREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_UP },
+ { ACTION_STD_NEXT, BUTTON_DOWN, BUTTON_NONE },
+ { ACTION_STD_NEXTREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_DOWN },
+
+ { ACTION_STD_CANCEL, BUTTON_LEFT, BUTTON_NONE },
+ { ACTION_STD_CANCEL, BUTTON_OFF, BUTTON_NONE },
+ { ACTION_STD_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT,BUTTON_SELECT },
+ { ACTION_STD_QUICKSCREEN, BUTTON_MODE|BUTTON_REPEAT, BUTTON_MODE },
+ { ACTION_STD_MENU, BUTTON_MODE|BUTTON_REL, BUTTON_MODE },
+ { ACTION_STD_OK, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
+ { ACTION_STD_OK, BUTTON_RIGHT, BUTTON_NONE },
+
+ LAST_ITEM_IN_LIST
+}; /* button_context_standard */
+
+
+struct button_mapping button_context_wps[] = {
+ { ACTION_WPS_PLAY, BUTTON_ON|BUTTON_REL, BUTTON_ON },
+ { ACTION_WPS_SKIPNEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
+ { ACTION_WPS_SKIPPREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
+ { ACTION_WPS_SEEKBACK, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
+ { ACTION_WPS_SEEKFWD, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT },
+ { ACTION_WPS_STOPSEEK, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT|BUTTON_REPEAT },
+ { ACTION_WPS_STOPSEEK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT|BUTTON_REPEAT },
+ { ACTION_WPS_NEXTDIR, BUTTON_ON|BUTTON_RIGHT, BUTTON_ON },
+ { ACTION_WPS_PREVDIR, BUTTON_ON|BUTTON_LEFT, BUTTON_ON },
+ { ACTION_WPS_STOP, BUTTON_OFF, BUTTON_NONE },
+ { ACTION_WPS_VOLDOWN, BUTTON_DOWN|BUTTON_REL, BUTTON_DOWN },
+ { ACTION_WPS_VOLDOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_DOWN },
+ { ACTION_WPS_VOLUP, BUTTON_UP|BUTTON_REL, BUTTON_UP },
+ { ACTION_WPS_VOLUP, BUTTON_UP|BUTTON_REPEAT, BUTTON_UP },
+ { ACTION_WPS_PITCHSCREEN, BUTTON_ON|BUTTON_REPEAT, BUTTON_ON },
+ { ACTION_WPS_QUICKSCREEN, BUTTON_MODE|BUTTON_REPEAT, BUTTON_MODE },
+ { ACTION_WPS_MENU, BUTTON_MODE|BUTTON_REL, BUTTON_MODE },
+ { ACTION_WPS_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
+ { ACTION_WPS_BROWSE, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
+ { ACTION_WPSAB_RESET, BUTTON_ON|BUTTON_SELECT, BUTTON_ON },
+
+ LAST_ITEM_IN_LIST
+}; /* button_context_wps */
+
+struct button_mapping button_context_listtree[] = {
+ { ACTION_LISTTREE_PGUP, BUTTON_ON|BUTTON_UP, BUTTON_ON },
+ { ACTION_LISTTREE_PGUP, BUTTON_UP|BUTTON_REL, BUTTON_ON|BUTTON_UP },
+ { ACTION_LISTTREE_PGUP, BUTTON_ON|BUTTON_UP|BUTTON_REPEAT, BUTTON_ON|BUTTON_UP },
+ { ACTION_LISTTREE_PGDOWN, BUTTON_ON|BUTTON_DOWN, BUTTON_ON|BUTTON_UP },
+ { ACTION_LISTTREE_PGDOWN, BUTTON_DOWN|BUTTON_REL, BUTTON_ON|BUTTON_DOWN },
+ { ACTION_LISTTREE_PGDOWN, BUTTON_ON|BUTTON_DOWN|BUTTON_REPEAT, BUTTON_ON|BUTTON_DOWN },
+ LAST_ITEM_IN_LIST
+}; /* button_context_listtree */
+
+struct button_mapping button_context_tree[] = {
+ { ACTION_TREE_WPS, BUTTON_ON|BUTTON_REL, BUTTON_ON },
+ LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST)
+}; /* button_context_listtree */
+
+struct button_mapping button_context_listtree_scroll_with_combo[] = {
+ { ACTION_NONE, BUTTON_ON, BUTTON_NONE },
+ { 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_PGLEFT, BUTTON_ON|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_ON|BUTTON_LEFT },
+ { ACTION_TREE_PGRIGHT, BUTTON_ON|BUTTON_RIGHT, BUTTON_ON },
+ { ACTION_TREE_PGRIGHT, BUTTON_RIGHT|BUTTON_REL, BUTTON_ON|BUTTON_RIGHT },
+ { ACTION_TREE_PGRIGHT, BUTTON_ON|BUTTON_RIGHT, BUTTON_RIGHT|BUTTON_REL },
+ { ACTION_TREE_PGRIGHT, BUTTON_ON|BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_ON|BUTTON_RIGHT },
+ LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|1),
+};
+
+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_PGLEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
+ { ACTION_TREE_PGLEFT, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT|BUTTON_REPEAT },
+ { ACTION_NONE, BUTTON_RIGHT, BUTTON_NONE },
+ { ACTION_STD_OK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
+ { ACTION_TREE_PGRIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT },
+ { ACTION_TREE_PGRIGHT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT|BUTTON_REPEAT },
+ LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|1),
+};
+
+struct button_mapping button_context_settings[] = {
+ { ACTION_SETTINGS_INC, BUTTON_UP, BUTTON_NONE },
+ { ACTION_SETTINGS_INCREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_UP },
+ { ACTION_SETTINGS_DEC, BUTTON_DOWN, BUTTON_NONE },
+ { ACTION_SETTINGS_DECREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_DOWN },
+ { ACTION_NONE, BUTTON_LEFT, BUTTON_NONE },
+ { ACTION_NONE, BUTTON_RIGHT, BUTTON_NONE },
+
+ LAST_ITEM_IN_LIST
+}; /* button_context_settings */
+
+struct button_mapping button_context_settingsgraphical[] = {
+ { ACTION_SETTINGS_INC, BUTTON_RIGHT, BUTTON_NONE },
+ { ACTION_SETTINGS_INCREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT },
+ { ACTION_SETTINGS_DEC, BUTTON_LEFT, BUTTON_NONE },
+ { ACTION_SETTINGS_DECREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
+ { ACTION_STD_PREV, BUTTON_UP, BUTTON_NONE },
+ { ACTION_STD_PREVREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_UP },
+ { ACTION_STD_NEXT, BUTTON_DOWN, BUTTON_NONE },
+ { ACTION_STD_NEXTREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_DOWN },
+
+ LAST_ITEM_IN_LIST
+}; /* button_context_settingsgraphical */
+
+struct button_mapping button_context_yesno[] = {
+ { ACTION_YESNO_ACCEPT, BUTTON_SELECT, BUTTON_NONE },
+ { ACTION_YESNO_ACCEPT, BUTTON_RC_ON, BUTTON_NONE },
+ LAST_ITEM_IN_LIST
+}; /* button_context_settings_yesno */
+
+struct button_mapping button_context_bmark[] = {
+ { ACTION_BMARK_DELETE, BUTTON_REC, BUTTON_NONE },
+ { ACTION_STD_OK, BUTTON_SELECT, BUTTON_NONE },
+ LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGSGRAPHICAL),
+}; /* button_context_settings_bmark */
+
+struct button_mapping button_context_quickscreen[] = {
+ { ACTION_QS_DOWNINV, BUTTON_UP, BUTTON_NONE },
+ { ACTION_QS_DOWNINV, BUTTON_UP|BUTTON_REPEAT, BUTTON_UP },
+ { ACTION_QS_DOWN, BUTTON_DOWN, BUTTON_NONE },
+ { ACTION_QS_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_DOWN },
+ { ACTION_QS_LEFT, BUTTON_LEFT, BUTTON_NONE },
+ { ACTION_QS_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
+ { ACTION_QS_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
+ { ACTION_QS_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT },
+ { ACTION_STD_CANCEL, BUTTON_MODE, BUTTON_NONE },
+
+ LAST_ITEM_IN_LIST
+}; /* button_context_quickscreen */
+/*****************************************************************************
+ * Remote control mappings
+ *****************************************************************************/
+
+
+/********* H100 LCD remote ******/
+struct button_mapping button_context_standard_h100lcdremote[] = {
+ { ACTION_STD_PREV, BUTTON_RC_REW, BUTTON_NONE },
+ { ACTION_STD_PREVREPEAT, BUTTON_RC_REW|BUTTON_REPEAT, BUTTON_RC_REW },
+ { ACTION_STD_NEXT, BUTTON_RC_FF, BUTTON_NONE },
+ { ACTION_STD_NEXTREPEAT, BUTTON_RC_FF|BUTTON_REPEAT, BUTTON_RC_FF },
+
+ { ACTION_STD_OK, BUTTON_RC_ON|BUTTON_REL, BUTTON_RC_ON },
+ { ACTION_STD_CONTEXT, BUTTON_RC_MENU|BUTTON_REPEAT, BUTTON_RC_MENU },
+ { ACTION_STD_CANCEL, BUTTON_RC_STOP, BUTTON_NONE },
+ { ACTION_STD_QUICKSCREEN, BUTTON_RC_MODE|BUTTON_REPEAT, BUTTON_RC_MODE },
+ { ACTION_STD_MENU, BUTTON_RC_MODE|BUTTON_REL, BUTTON_RC_MODE },
+ { ACTION_STD_OK, BUTTON_RC_MENU|BUTTON_REL, BUTTON_RC_MENU },
+
+ LAST_ITEM_IN_LIST
+}; /* button_context_standard_h100lcdremote */
+
+struct button_mapping button_context_wps_h100lcdremote[] = {
+ { ACTION_WPS_PLAY, BUTTON_RC_ON|BUTTON_REL, BUTTON_RC_ON },
+ { ACTION_WPS_SKIPNEXT, BUTTON_RC_FF|BUTTON_REL, BUTTON_RC_FF },
+ { ACTION_WPS_SEEKFWD, BUTTON_RC_FF|BUTTON_REPEAT, BUTTON_RC_FF },
+ { ACTION_WPS_SKIPPREV, BUTTON_RC_REW|BUTTON_REL, BUTTON_RC_REW },
+ { ACTION_WPS_SEEKBACK, BUTTON_RC_REW|BUTTON_REPEAT, BUTTON_RC_REW },
+ { ACTION_WPS_STOP, BUTTON_RC_STOP, BUTTON_NONE },
+ { ACTION_WPS_VOLDOWN, BUTTON_RC_VOL_DOWN, BUTTON_NONE },
+ { ACTION_WPS_VOLDOWN, BUTTON_RC_VOL_DOWN|BUTTON_REPEAT, BUTTON_RC_VOL_DOWN },
+ { ACTION_WPS_VOLUP, BUTTON_RC_VOL_UP, BUTTON_NONE },
+ { ACTION_WPS_VOLUP, BUTTON_RC_VOL_UP|BUTTON_REPEAT, BUTTON_RC_VOL_UP },
+ { ACTION_WPS_NEXTDIR, BUTTON_RC_BITRATE, BUTTON_NONE },
+ { ACTION_WPS_PREVDIR, BUTTON_RC_SOURCE, BUTTON_NONE },
+ { ACTION_WPS_PITCHSCREEN, BUTTON_RC_ON|BUTTON_REPEAT, BUTTON_RC_ON },
+ { ACTION_WPS_QUICKSCREEN, BUTTON_RC_MODE|BUTTON_REPEAT, BUTTON_RC_MODE },
+ { ACTION_WPS_MENU, BUTTON_RC_MODE|BUTTON_REL, BUTTON_RC_MODE },
+ { ACTION_WPS_CONTEXT, BUTTON_RC_MENU|BUTTON_REPEAT, BUTTON_RC_MENU },
+ { ACTION_WPS_BROWSE, BUTTON_RC_MENU|BUTTON_REL, BUTTON_RC_MENU },
+
+ LAST_ITEM_IN_LIST
+}; /* button_context_wps_h100lcdremote */
+
+struct button_mapping button_context_listtree_h100lcdremote[] = {
+ { ACTION_LISTTREE_PGUP, BUTTON_RC_SOURCE, BUTTON_NONE },
+ { ACTION_LISTTREE_PGUP, BUTTON_RC_SOURCE|BUTTON_REPEAT, BUTTON_RC_SOURCE },
+ { ACTION_LISTTREE_PGDOWN, BUTTON_RC_BITRATE, BUTTON_NONE },
+ { ACTION_LISTTREE_PGDOWN, BUTTON_RC_BITRATE|BUTTON_REPEAT, BUTTON_RC_BITRATE },
+ { ACTION_TREE_WPS, BUTTON_RC_ON|BUTTON_REL, BUTTON_RC_ON },
+ { ACTION_TREE_STOP, BUTTON_RC_STOP, BUTTON_NONE },
+
+ LAST_ITEM_IN_LIST
+}; /* button_context_listtree_h100lcdremote */
+/* Not needed? _std_ actions seem to be fine */
+struct button_mapping button_context_settings_h100lcdremote[] = {
+ LAST_ITEM_IN_LIST
+};/* button_context_settings_h100lcdremote */
+
+
+/********* H300 LCD remote ******/
+struct button_mapping button_context_standard_h300lcdremote[] = {
+ { ACTION_STD_PREV, BUTTON_RC_VOL_UP, BUTTON_NONE },
+ { ACTION_STD_PREVREPEAT, BUTTON_RC_VOL_UP|BUTTON_REPEAT, BUTTON_RC_VOL_UP },
+ { ACTION_STD_NEXT, BUTTON_RC_VOL_DOWN, BUTTON_NONE },
+ { ACTION_STD_NEXTREPEAT, BUTTON_RC_VOL_DOWN|BUTTON_REPEAT, BUTTON_RC_VOL_DOWN },
+ { ACTION_STD_OK, BUTTON_RC_ON|BUTTON_REL, BUTTON_RC_ON },
+ { ACTION_STD_CANCEL, BUTTON_RC_REW, BUTTON_NONE },
+ { ACTION_STD_CANCEL, BUTTON_RC_REW|BUTTON_REPEAT, BUTTON_RC_REW },
+ { ACTION_STD_CONTEXT, BUTTON_RC_MENU|BUTTON_REPEAT, BUTTON_RC_MENU },
+ { ACTION_STD_CANCEL, BUTTON_RC_STOP, BUTTON_NONE },
+ { ACTION_STD_QUICKSCREEN, BUTTON_RC_MODE|BUTTON_REPEAT, BUTTON_RC_MODE },
+ { ACTION_STD_MENU, BUTTON_RC_MODE|BUTTON_REL, BUTTON_RC_MODE },
+ { ACTION_STD_OK, BUTTON_RC_MENU|BUTTON_REL, BUTTON_RC_MENU },
+ { ACTION_STD_OK, BUTTON_RC_FF, BUTTON_NONE },
+ { ACTION_STD_OK, BUTTON_RC_FF|BUTTON_REPEAT, BUTTON_NONE},
+
+ LAST_ITEM_IN_LIST
+
+}; /* button_context_standard */
+
+/* the mapping of the 2 LCD remotes in the WPS screen should be the same */
+struct button_mapping *button_context_wps_h300lcdremote =
+ button_context_wps_h100lcdremote;
+
+/* FIXME: the same as h100 ?? */
+struct button_mapping *button_context_listtree_h300lcdremote =
+ button_context_listtree_h100lcdremote;
+/* FIXME: the same as h100 ?? */
+
+struct button_mapping *button_context_settings_h300lcdremote =
+ button_context_settings_h100lcdremote;
+/* FIXME: non lcd remotes need mappings.. ?? */
+
+
+
+
+
+
+/* the actual used tables */
+static struct button_mapping
+ *remote_button_context_std = button_context_standard_h100lcdremote,
+ *remote_button_context_wps = button_context_wps_h100lcdremote,
+ *remote_button_context_listtree = button_context_listtree_h100lcdremote,
+ *remote_button_context_settings = button_context_settings_h100lcdremote;
+static int _remote_type = 0;
+
+static void remap_remote(void)
+{
+ _remote_type = remote_type();
+ switch(_remote_type)
+ {
+ case REMOTETYPE_UNPLUGGED:
+ remote_button_context_std = NULL;
+ remote_button_context_wps = NULL;
+ remote_button_context_listtree = NULL;
+ remote_button_context_settings = NULL;
+ break;
+ case REMOTETYPE_H100_LCD:
+ remote_button_context_std = button_context_standard_h100lcdremote;
+ remote_button_context_wps = button_context_wps_h100lcdremote;
+ remote_button_context_listtree = button_context_listtree_h100lcdremote;
+ remote_button_context_settings = button_context_settings_h100lcdremote;
+ break;
+ case REMOTETYPE_H300_LCD:
+ remote_button_context_std = button_context_standard_h300lcdremote;
+ remote_button_context_wps = button_context_wps_h300lcdremote;
+ remote_button_context_listtree = button_context_listtree_h300lcdremote;
+ remote_button_context_settings = button_context_settings_h300lcdremote;
+ break;
+ case REMOTETYPE_H300_NONLCD: /* FIXME: add its tables */
+ remote_button_context_std = button_context_standard_h300lcdremote;
+ remote_button_context_wps = button_context_wps_h300lcdremote;
+ remote_button_context_listtree = button_context_listtree_h300lcdremote;
+ remote_button_context_settings = button_context_settings_h300lcdremote;
+ break;
+ }
+}
+
+
+
+
+
+
+
+
+struct button_mapping* get_context_mapping_remote(int context)
+{
+ if(remote_type() != _remote_type)
+ remap_remote();
+ context ^= CONTEXT_REMOTE;
+
+ switch (context)
+ {
+ case CONTEXT_STD:
+ case CONTEXT_MAINMENU:
+ case CONTEXT_SETTINGS:
+ return remote_button_context_std;
+ case CONTEXT_WPS:
+ return remote_button_context_wps;
+
+ case CONTEXT_TREE:
+ case CONTEXT_LIST:
+ return remote_button_context_listtree;
+
+
+ case CONTEXT_YESNOSCREEN:
+ case CONTEXT_BOOKMARKSCREEN:
+ ; /* fall out of the switch */
+ }
+ return remote_button_context_std;
+}
+
+struct button_mapping* get_context_mapping(int context)
+{
+ if (context&CONTEXT_REMOTE)
+ return get_context_mapping_remote(context);
+
+ switch (context)
+ {
+ case CONTEXT_STD:
+ case CONTEXT_MAINMENU:
+ return button_context_standard;
+ case CONTEXT_WPS:
+ return button_context_wps;
+
+ case CONTEXT_LIST:
+ return button_context_listtree;
+ case CONTEXT_TREE:
+ if (global_settings.hold_lr_for_scroll_in_list)
+ return button_context_listtree_scroll_without_combo;
+ else return button_context_listtree_scroll_with_combo;
+ case CONTEXT_CUSTOM|1:
+ return button_context_tree;
+ case CONTEXT_SETTINGSGRAPHICAL:
+ return button_context_settingsgraphical;
+
+ case CONTEXT_SETTINGS:
+ return button_context_settings;
+
+ case CONTEXT_YESNOSCREEN:
+ return button_context_yesno;
+
+ case CONTEXT_BOOKMARKSCREEN:
+ return button_context_bmark;
+ case CONTEXT_QUICKSCREEN:
+ return button_context_quickscreen;
+ }
+ return button_context_standard;
+}
diff --git a/apps/keymaps/keymap-ipod.c b/apps/keymaps/keymap-ipod.c
new file mode 100644
index 0000000000..91254a39a8
--- /dev/null
+++ b/apps/keymaps/keymap-ipod.c
@@ -0,0 +1,151 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ *
+ * Copyright (C) 2006 Jonathan Gordon
+ *
+ * All files in this archive are subject to the GNU General Public License.
+ * See the file COPYING in the source tree root for full license agreement.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+/* Button Code Definitions for ipod target */
+
+#include "config.h"
+#include "action.h"
+#include "button.h"
+
+
+/*
+ * The format of the list is as follows
+ * { Action Code, Button code, Prereq button code }
+ * if there's no need to check the previous button's value, use BUTTON_NONE
+ * Insert LAST_ITEM_IN_LIST at the end of each mapping
+ */
+
+/* CONTEXT_CUSTOM's used in this file...
+
+CONTEXT_CUSTOM|1 = the standard list/tree defines (without directions)
+
+
+*/
+
+struct button_mapping button_context_standard[] = {
+ { ACTION_STD_PREV, BUTTON_SCROLL_BACK, BUTTON_NONE },
+ { ACTION_STD_PREVREPEAT, BUTTON_SCROLL_BACK|BUTTON_REPEAT, BUTTON_SCROLL_BACK },
+ { ACTION_STD_NEXT, BUTTON_SCROLL_FWD, BUTTON_NONE },
+ { ACTION_STD_NEXTREPEAT, BUTTON_SCROLL_FWD|BUTTON_REPEAT, BUTTON_SCROLL_FWD },
+ { ACTION_STD_CANCEL, BUTTON_LEFT, BUTTON_NONE },
+ { ACTION_STD_OK, BUTTON_RIGHT, BUTTON_NONE },
+
+ { ACTION_STD_OK, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
+ { ACTION_STD_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
+ { ACTION_STD_QUICKSCREEN, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
+ { ACTION_STD_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
+ { ACTION_STD_CANCEL, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
+
+ LAST_ITEM_IN_LIST
+}; /* button_context_standard */
+struct button_mapping button_context_tree[] = {
+ { ACTION_TREE_WPS, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
+ { ACTION_TREE_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
+
+ LAST_ITEM_IN_LIST
+}; /* button_context_tree */
+
+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_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
+ { ACTION_TREE_PGLEFT, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT|BUTTON_REPEAT },
+ { ACTION_NONE, BUTTON_RIGHT, BUTTON_NONE },
+ { ACTION_STD_OK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
+ { ACTION_TREE_PGRIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT },
+ { ACTION_TREE_PGRIGHT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT|BUTTON_REPEAT },
+ LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|1),
+};
+
+struct button_mapping button_context_wps[] = {
+ { ACTION_WPS_PLAY, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
+ { ACTION_WPS_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
+ { ACTION_WPS_SKIPPREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
+ { ACTION_WPS_SEEKBACK, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
+ { ACTION_WPS_STOPSEEK, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT|BUTTON_REPEAT },
+ { ACTION_WPS_SKIPNEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
+ { ACTION_WPS_SEEKFWD, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT },
+ { ACTION_WPS_STOPSEEK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT|BUTTON_REPEAT },
+ { ACTION_WPS_VOLDOWN, BUTTON_SCROLL_BACK, BUTTON_NONE },
+ { ACTION_WPS_VOLDOWN, BUTTON_SCROLL_BACK|BUTTON_REPEAT, BUTTON_SCROLL_BACK },
+ { ACTION_WPS_VOLUP, BUTTON_SCROLL_FWD, BUTTON_NONE },
+ { ACTION_WPS_VOLUP, BUTTON_SCROLL_FWD|BUTTON_REPEAT, BUTTON_SCROLL_FWD },
+ { ACTION_WPS_BROWSE, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
+ { ACTION_WPS_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
+ { ACTION_WPS_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
+ { ACTION_WPS_QUICKSCREEN, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
+
+ LAST_ITEM_IN_LIST
+}; /* button_context_wps */
+
+struct button_mapping button_context_settings[] = {
+ { ACTION_SETTINGS_INC, BUTTON_SCROLL_FWD, BUTTON_NONE },
+ { ACTION_SETTINGS_INCREPEAT, BUTTON_SCROLL_FWD|BUTTON_REPEAT, BUTTON_SCROLL_FWD },
+ { ACTION_SETTINGS_DEC, BUTTON_SCROLL_BACK, BUTTON_NONE },
+ { ACTION_SETTINGS_DECREPEAT, BUTTON_SCROLL_BACK|BUTTON_REPEAT, BUTTON_SCROLL_BACK },
+ { ACTION_STD_PREV, BUTTON_LEFT, BUTTON_NONE },
+ { ACTION_STD_PREVREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
+ { ACTION_STD_NEXT, BUTTON_RIGHT, BUTTON_NONE },
+ { ACTION_STD_NEXTREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT },
+ { ACTION_STD_CANCEL, BUTTON_MENU|BUTTON_REL, BUTTON_MENU }, /* rel so bmark screen works */
+
+ LAST_ITEM_IN_LIST
+}; /* button_context_settings */
+
+struct button_mapping button_context_yesno[] = {
+ { ACTION_YESNO_ACCEPT, BUTTON_PLAY, BUTTON_NONE },
+ LAST_ITEM_IN_LIST
+}; /* button_context_settings_yesno */
+
+struct button_mapping button_context_bmark[] = {
+ { ACTION_BMARK_DELETE, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
+ LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS),
+}; /* button_context_settings_bmark */
+
+/* get_context_mapping returns a pointer to one of the above defined arrays depending on the context */
+struct button_mapping* get_context_mapping(int context)
+{
+ switch (context)
+ {
+ case CONTEXT_STD:
+ return button_context_standard;
+ case CONTEXT_WPS:
+ return button_context_wps;
+
+ case CONTEXT_TREE:
+ if (global_settings.hold_lr_for_scroll_in_list)
+ return button_context_tree_scroll_lr;
+ /* else fall through to CUSTOM|1 */
+ case CONTEXT_CUSTOM|1:
+ return button_context_tree;
+
+ case CONTEXT_LIST:
+ case CONTEXT_MAINMENU:
+ break;
+ case CONTEXT_SETTINGS:
+ case CONTEXT_SETTINGSGRAPHICAL:
+ return button_context_settings;
+ case CONTEXT_YESNOSCREEN:
+ return button_context_yesno;
+ case CONTEXT_BOOKMARKSCREEN:
+ return button_context_bmark;
+ default:
+ return button_context_standard;
+ }
+ return button_context_standard;
+}
diff --git a/apps/keymaps/keymap-newtarget.c b/apps/keymaps/keymap-newtarget.c
new file mode 100644
index 0000000000..3cd828c0b4
--- /dev/null
+++ b/apps/keymaps/keymap-newtarget.c
@@ -0,0 +1,77 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ *
+ * Copyright (C) 200
+ *
+ * All files in this archive are subject to the GNU General Public License.
+ * See the file COPYING in the source tree root for full license agreement.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+/* Button Code Definitions for <new> target */
+
+#include "config.h"
+#include "action.h"
+#include "button.h"
+
+#define LAST_ITEM_IN_LIST { ACTION_NONE,BUTTON_NONE,BUTTON_NONE }
+/* {Action Code, Button code, Prereq button code } */
+
+/**
+ This file is where all button mappings are defined.
+ In ../action.h there is an enum with all the used ACTION_ codes.
+ Ideally All the ACTION_STD_* and ACTION_WPS_* codes should be defined somehwere in this file.
+
+ Remeber to make a copy of this file and rename it to keymap-<targetname>.c and add it to apps/SOURCES
+
+ Good luck and thanks for porting a new target! :D
+
+**/
+
+/*
+ * The format of the list is as follows
+ * { Action Code, Button code, Prereq button code }
+ * if there's no need to check the previous button's value, use BUTTON_NONE
+ * Insert LAST_ITEM_IN_LIST at the end of each mapping
+ */
+struct button_mapping button_context_standard[] = {
+
+ LAST_ITEM_IN_LIST
+}; /* button_context_standard */
+
+struct button_mapping button_context_wps[] = {
+
+ LAST_ITEM_IN_LIST
+}; /* button_context_wps */
+
+
+
+/* get_context_mapping returns a pointer to one of the above defined arrays depending on the context */
+struct button_mapping* get_context_mapping(int context)
+{
+ switch (context)
+ {
+ case CONTEXT_STD:
+ return button_context_standard;
+ case CONTEXT_WPS:
+ return button_context_wps;
+
+ case CONTEXT_TREE:
+ case CONTEXT_LIST:
+ case CONTEXT_MAINMENU:
+
+ case CONTEXT_SETTINGS:
+ case CONTEXT_SETTINGS|CONTEXT_REMOTE:
+ default:
+ return button_context_standard;
+ }
+ return button_context_standard;
+}
diff --git a/apps/keymaps/keymap-ondio.c b/apps/keymaps/keymap-ondio.c
new file mode 100644
index 0000000000..2ad86c868d
--- /dev/null
+++ b/apps/keymaps/keymap-ondio.c
@@ -0,0 +1,135 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ *
+ * Copyright (C) 2006 Jonathan Gordon
+ *
+ * All files in this archive are subject to the GNU General Public License.
+ * See the file COPYING in the source tree root for full license agreement.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+/* *
+ * Button Code Definitions for archos ondio fm/sp targets
+ *
+ * \TODO test!
+ */
+
+#include "config.h"
+#include "action.h"
+#include "button.h"
+#include "settings.h"
+
+/* CONTEXT_CUSTOM's used in this file...
+
+CONTEXT_CUSTOM|1 = the standard list/tree defines (without directions)
+
+
+*/
+
+struct button_mapping button_context_standard[] = {
+ { ACTION_STD_PREV, BUTTON_UP, BUTTON_NONE },
+ { ACTION_STD_PREVREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_UP },
+ { ACTION_STD_NEXT, BUTTON_DOWN, BUTTON_NONE },
+ { ACTION_STD_NEXTREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_DOWN },
+
+ { ACTION_STD_CONTEXT, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
+ { ACTION_STD_CANCEL, BUTTON_LEFT, BUTTON_NONE },
+ { ACTION_STD_OK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
+ { ACTION_STD_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
+ { ACTION_STD_CANCEL, BUTTON_OFF, BUTTON_NONE },
+
+ LAST_ITEM_IN_LIST
+};
+
+struct button_mapping button_context_wps[] = {
+ { ACTION_WPS_PLAY, BUTTON_OFF|BUTTON_REL, BUTTON_OFF },
+ { ACTION_WPS_SKIPNEXT, BUTTON_RIGHT, BUTTON_NONE },
+ { ACTION_WPS_SKIPPREV, BUTTON_LEFT, BUTTON_NONE },
+ { ACTION_WPS_SEEKBACK, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
+ { ACTION_WPS_SEEKFWD, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT },
+ { ACTION_WPS_STOPSEEK, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT|BUTTON_REPEAT },
+ { ACTION_WPS_STOPSEEK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT|BUTTON_REPEAT },
+ { ACTION_WPS_STOP, BUTTON_OFF|BUTTON_REPEAT, BUTTON_OFF },
+ { ACTION_WPS_VOLDOWN, BUTTON_DOWN, BUTTON_NONE },
+ { ACTION_WPS_VOLDOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_DOWN },
+ { ACTION_WPS_VOLUP, BUTTON_UP, BUTTON_NONE },
+ { ACTION_WPS_VOLUP, BUTTON_UP|BUTTON_REPEAT, BUTTON_UP },
+ { ACTION_WPS_BROWSE, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
+ { ACTION_WPS_MENU, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
+ { ACTION_WPS_CONTEXT, BUTTON_MENU|BUTTON_OFF, BUTTON_MENU }, /* this may trigger ACTION_WPS_BROWSE so may need changing */
+
+ LAST_ITEM_IN_LIST
+};
+
+struct button_mapping button_context_settings[] = {
+ { ACTION_SETTINGS_INC, BUTTON_UP, BUTTON_NONE },
+ { ACTION_SETTINGS_INCREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_UP },
+ { ACTION_SETTINGS_DEC, BUTTON_DOWN, BUTTON_NONE },
+ { ACTION_SETTINGS_DECREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_DOWN },
+ { ACTION_STD_NEXT, BUTTON_MENU, BUTTON_NONE },
+ { ACTION_STD_OK, BUTTON_RIGHT, BUTTON_NONE },
+ { ACTION_STD_CANCEL, BUTTON_LEFT, BUTTON_NONE },
+
+ LAST_ITEM_IN_LIST
+};
+struct button_mapping button_context_tree[] = {
+ { ACTION_TREE_WPS, BUTTON_OFF|BUTTON_REL, BUTTON_OFF },
+ { ACTION_TREE_STOP, BUTTON_OFF|BUTTON_REPEAT, BUTTON_OFF },
+
+ LAST_ITEM_IN_LIST
+}; /* button_context_listtree */
+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_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
+ { ACTION_TREE_PGLEFT, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT|BUTTON_REPEAT },
+ { ACTION_NONE, BUTTON_RIGHT, BUTTON_NONE },
+ { ACTION_STD_OK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
+ { ACTION_TREE_PGRIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT },
+ { ACTION_TREE_PGRIGHT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT|BUTTON_REPEAT },
+ LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|1),
+};
+
+struct button_mapping button_context_yesno[] = {
+ { ACTION_YESNO_ACCEPT, BUTTON_RIGHT, BUTTON_NONE },
+
+ LAST_ITEM_IN_LIST
+};
+
+struct button_mapping* get_context_mapping( int context )
+{
+ switch( context )
+ {
+ case CONTEXT_STD:
+ return button_context_standard;
+
+ case CONTEXT_WPS:
+ return button_context_wps;
+
+ case CONTEXT_SETTINGS:
+ return button_context_settings;
+
+ case CONTEXT_YESNOSCREEN:
+ return button_context_yesno;
+
+ case CONTEXT_TREE:
+ if (global_settings.hold_lr_for_scroll_in_list)
+ return button_context_tree_scroll_lr;
+ /* else fall through to CUSTOM|1 */
+ case CONTEXT_CUSTOM|1:
+ return button_context_tree;
+
+ case CONTEXT_LIST:
+ case CONTEXT_MAINMENU:
+ default:
+ return button_context_standard;
+ }
+}
diff --git a/apps/keymaps/keymap-player.c b/apps/keymaps/keymap-player.c
new file mode 100644
index 0000000000..f1a98d7b35
--- /dev/null
+++ b/apps/keymaps/keymap-player.c
@@ -0,0 +1,136 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ *
+ * Copyright (C) 2006 Jonathan Gordon
+ *
+ * All files in this archive are subject to the GNU General Public License.
+ * See the file COPYING in the source tree root for full license agreement.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+/* *
+ * Button Code Definitions for archos player targets
+ *
+ * \TODO test!
+ */
+
+#include "config.h"
+#include "action.h"
+#include "button.h"
+#include "settings.h"
+
+/* CONTEXT_CUSTOM's used in this file...
+
+CONTEXT_CUSTOM|1 = the standard list/tree defines (without directions)
+
+
+*/
+
+struct button_mapping button_context_standard[] = {
+ { ACTION_STD_PREV, BUTTON_LEFT, BUTTON_NONE },
+ { ACTION_STD_PREVREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
+ { ACTION_STD_NEXT, BUTTON_RIGHT, BUTTON_NONE },
+ { ACTION_STD_NEXTREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT },
+
+ { ACTION_STD_CONTEXT, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
+ { ACTION_STD_CANCEL, BUTTON_STOP, BUTTON_NONE },
+ { ACTION_STD_OK, BUTTON_PLAY, BUTTON_NONE },
+ { ACTION_STD_OK, BUTTON_ON|BUTTON_REL, BUTTON_ON },
+ { ACTION_STD_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
+
+ LAST_ITEM_IN_LIST
+};
+
+struct button_mapping button_context_wps[] = {
+ { ACTION_WPS_PLAY, BUTTON_PLAY, BUTTON_NONE },
+ { ACTION_WPS_SKIPNEXT, BUTTON_RIGHT, BUTTON_NONE },
+ { ACTION_WPS_SKIPPREV, BUTTON_LEFT, BUTTON_NONE },
+ { ACTION_WPS_SEEKBACK, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
+ { ACTION_WPS_SEEKFWD, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT },
+ { ACTION_WPS_STOPSEEK, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT|BUTTON_REPEAT },
+ { ACTION_WPS_STOPSEEK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT|BUTTON_REPEAT },
+ { ACTION_WPS_STOP, BUTTON_STOP, BUTTON_NONE },
+
+ { ACTION_WPS_VOLDOWN, BUTTON_MENU|BUTTON_STOP, BUTTON_MENU },
+ { ACTION_WPS_VOLDOWN, BUTTON_MENU|BUTTON_STOP|BUTTON_REPEAT, BUTTON_MENU|BUTTON_STOP },
+ { ACTION_WPS_VOLUP, BUTTON_MENU|BUTTON_PLAY, BUTTON_MENU },
+ { ACTION_WPS_VOLUP, BUTTON_MENU|BUTTON_PLAY|BUTTON_REPEAT, BUTTON_MENU|BUTTON_PLAY },
+
+ { ACTION_WPS_BROWSE, BUTTON_ON|BUTTON_REL, BUTTON_ON },
+ { ACTION_WPS_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
+ { ACTION_WPS_CONTEXT, BUTTON_ON|BUTTON_REPEAT, BUTTON_ON },
+ { ACTION_WPS_ID3SCREEN, BUTTON_MENU|BUTTON_ON, BUTTON_MENU },
+
+
+ LAST_ITEM_IN_LIST
+};
+
+struct button_mapping button_context_settings[] = {
+ { ACTION_SETTINGS_INC, BUTTON_LEFT, BUTTON_NONE },
+ { ACTION_SETTINGS_INCREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
+ { ACTION_SETTINGS_DEC, BUTTON_RIGHT, BUTTON_NONE },
+ { ACTION_SETTINGS_DECREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT },
+
+ LAST_ITEM_IN_LIST
+};
+
+struct button_mapping button_context_tree[] = {
+ { ACTION_TREE_WPS, BUTTON_PLAY, BUTTON_NONE },
+ { ACTION_TREE_STOP, BUTTON_STOP, BUTTON_NONE },
+
+ LAST_ITEM_IN_LIST
+}; /* button_context_listtree */
+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_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
+ { ACTION_TREE_PGLEFT, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT|BUTTON_REPEAT },
+ { ACTION_NONE, BUTTON_RIGHT, BUTTON_NONE },
+ { ACTION_STD_OK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
+ { ACTION_TREE_PGRIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT },
+ { ACTION_TREE_PGRIGHT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT|BUTTON_REPEAT },
+ LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|1),
+};
+
+struct button_mapping button_context_yesno[] = {
+ { ACTION_YESNO_ACCEPT, BUTTON_PLAY, BUTTON_NONE },
+ LAST_ITEM_IN_LIST
+}; /* button_context_settings_yesno */
+
+struct button_mapping* get_context_mapping( int context )
+{
+ switch( context )
+ {
+ case CONTEXT_STD:
+ return button_context_standard;
+
+ case CONTEXT_WPS:
+ return button_context_wps;
+
+ case CONTEXT_SETTINGS:
+ return button_context_settings;
+
+ case CONTEXT_YESNOSCREEN:
+ return button_context_yesno;
+
+ case CONTEXT_TREE:
+ if (global_settings.hold_lr_for_scroll_in_list)
+ return button_context_tree_scroll_lr;
+ /* else fall through to CUSTOM|1 */
+ case CONTEXT_CUSTOM|1:
+ return button_context_tree;
+
+ case CONTEXT_LIST:
+ case CONTEXT_MAINMENU:
+ default:
+ return button_context_standard;
+ }
+}
diff --git a/apps/keymaps/keymap-recorder.c b/apps/keymaps/keymap-recorder.c
new file mode 100644
index 0000000000..ab75bc51e7
--- /dev/null
+++ b/apps/keymaps/keymap-recorder.c
@@ -0,0 +1,141 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ *
+ * Copyright (C) 2006 Antoine Cellerier <dionoea @t videolan d.t org>
+ *
+ * All files in this archive are subject to the GNU General Public License.
+ * See the file COPYING in the source tree root for full license agreement.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+/* *
+ * Button Code Definitions for archos recorder target
+ *
+ * \TODO handle F3
+ */
+
+#include "config.h"
+#include "action.h"
+#include "button.h"
+#include "settings.h"
+
+/* CONTEXT_CUSTOM's used in this file...
+
+CONTEXT_CUSTOM|1 = the standard list/tree defines (without directions)
+
+
+*/
+
+struct button_mapping button_context_standard[] = {
+ { ACTION_STD_PREV, BUTTON_UP, BUTTON_NONE },
+ { ACTION_STD_PREVREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_UP },
+ { ACTION_STD_NEXT, BUTTON_DOWN, BUTTON_NONE },
+ { ACTION_STD_NEXTREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_DOWN },
+
+ { ACTION_STD_OK, BUTTON_ON, BUTTON_NONE },
+ { ACTION_STD_OK, BUTTON_RIGHT, BUTTON_NONE },
+ { ACTION_STD_OK, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT },
+
+ { ACTION_STD_OK, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
+ { ACTION_STD_MENU, BUTTON_F1, BUTTON_NONE },
+ { ACTION_STD_QUICKSCREEN, BUTTON_F2, BUTTON_NONE },
+ { ACTION_STD_CONTEXT, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
+ { ACTION_STD_CANCEL, BUTTON_OFF, BUTTON_NONE },
+ { ACTION_STD_CANCEL, BUTTON_LEFT, BUTTON_NONE },
+ { ACTION_STD_CANCEL, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
+
+ LAST_ITEM_IN_LIST
+};
+
+struct button_mapping button_context_wps[] = {
+ { ACTION_WPS_PLAY, BUTTON_PLAY, BUTTON_NONE },
+ { ACTION_WPS_SKIPNEXT, BUTTON_RIGHT, BUTTON_NONE },
+ { ACTION_WPS_SKIPPREV, BUTTON_LEFT, BUTTON_NONE },
+ { ACTION_WPS_SEEKBACK, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
+ { ACTION_WPS_SEEKFWD, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT },
+ { ACTION_WPS_STOPSEEK, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT|BUTTON_REPEAT },
+ { ACTION_WPS_STOPSEEK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT|BUTTON_REPEAT },
+ { ACTION_WPS_STOP, BUTTON_OFF, BUTTON_NONE },
+ { ACTION_WPS_VOLDOWN, BUTTON_DOWN, BUTTON_NONE },
+ { ACTION_WPS_VOLDOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_DOWN },
+ { ACTION_WPS_VOLUP, BUTTON_UP, BUTTON_NONE },
+ { ACTION_WPS_VOLUP, BUTTON_UP|BUTTON_REPEAT, BUTTON_UP },
+ { ACTION_WPS_MENU, BUTTON_F1, BUTTON_NONE },
+ { ACTION_WPS_CONTEXT, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
+ { ACTION_WPS_QUICKSCREEN, BUTTON_F2, BUTTON_NONE },
+ { ACTION_WPS_BROWSE, BUTTON_ON|BUTTON_REL, BUTTON_ON },
+ { ACTION_WPS_ID3SCREEN, BUTTON_F1|BUTTON_ON, BUTTON_F1 },
+ { ACTION_WPS_PITCHSCREEN, BUTTON_ON|BUTTON_UP, BUTTON_ON },
+ { ACTION_WPS_PITCHSCREEN, BUTTON_ON|BUTTON_DOWN, BUTTON_ON },
+
+ LAST_ITEM_IN_LIST
+};
+
+struct button_mapping button_context_settings[] = {
+ { ACTION_SETTINGS_INC, BUTTON_UP, BUTTON_NONE },
+ { ACTION_SETTINGS_INCREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_UP },
+ { ACTION_SETTINGS_DEC, BUTTON_DOWN, BUTTON_NONE },
+ { ACTION_SETTINGS_DECREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_DOWN },
+
+ LAST_ITEM_IN_LIST
+};
+
+struct button_mapping button_context_tree[] = {
+ { ACTION_TREE_WPS, BUTTON_PLAY, BUTTON_NONE },
+ { ACTION_TREE_STOP, BUTTON_OFF, BUTTON_NONE },
+
+ LAST_ITEM_IN_LIST
+}; /* button_context_listtree */
+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_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
+ { ACTION_TREE_PGLEFT, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT|BUTTON_REPEAT },
+ { ACTION_NONE, BUTTON_RIGHT, BUTTON_NONE },
+ { ACTION_STD_OK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
+ { ACTION_TREE_PGRIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT },
+ { ACTION_TREE_PGRIGHT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT|BUTTON_REPEAT },
+ LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|1),
+};
+
+struct button_mapping button_context_yesno[] = {
+ { ACTION_YESNO_ACCEPT, BUTTON_PLAY, BUTTON_NONE },
+
+ LAST_ITEM_IN_LIST
+};
+
+struct button_mapping* get_context_mapping( int context )
+{
+ switch( context )
+ {
+ case CONTEXT_WPS:
+ return button_context_wps;
+
+ case CONTEXT_SETTINGS:
+ return button_context_settings;
+
+ case CONTEXT_YESNOSCREEN:
+ return button_context_yesno;
+
+ case CONTEXT_TREE:
+ if (global_settings.hold_lr_for_scroll_in_list)
+ return button_context_tree_scroll_lr;
+ /* else fall through to CUSTOM|1 */
+ case CONTEXT_CUSTOM|1:
+ return button_context_tree;
+
+ case CONTEXT_STD:
+ case CONTEXT_LIST:
+ case CONTEXT_MAINMENU:
+ default:
+ return button_context_standard;
+ }
+}
diff --git a/apps/keymaps/keymap-x5.c b/apps/keymaps/keymap-x5.c
new file mode 100644
index 0000000000..33c1946e6c
--- /dev/null
+++ b/apps/keymaps/keymap-x5.c
@@ -0,0 +1,141 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ *
+ * Copyright (C) 2006 Jonathan Gordon
+ *
+ * All files in this archive are subject to the GNU General Public License.
+ * See the file COPYING in the source tree root for full license agreement.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+/* *
+ * Button Code Definitions for iaudio x5 targets
+ *
+ * \TODO test!
+ */
+
+#include "config.h"
+#include "action.h"
+#include "button.h"
+#include "settings.h"
+
+/* CONTEXT_CUSTOM's used in this file...
+
+CONTEXT_CUSTOM|1 = the standard list/tree defines (without directions)
+
+
+*/
+
+struct button_mapping button_context_standard[] = {
+ { ACTION_STD_PREV, BUTTON_UP, BUTTON_NONE },
+ { ACTION_STD_PREVREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_UP },
+ { ACTION_STD_NEXT, BUTTON_DOWN, BUTTON_NONE },
+ { ACTION_STD_NEXTREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_DOWN },
+
+ { ACTION_STD_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
+ { ACTION_STD_CANCEL, BUTTON_LEFT, BUTTON_NONE },
+ { ACTION_STD_OK, BUTTON_RIGHT, BUTTON_NONE },
+ { ACTION_STD_OK, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
+ { ACTION_STD_OK, BUTTON_PLAY, BUTTON_NONE },
+ { ACTION_STD_MENU, BUTTON_REC|BUTTON_REL, BUTTON_REC },
+ { ACTION_STD_QUICKSCREEN,BUTTON_REC|BUTTON_REPEAT, BUTTON_REC },
+ { ACTION_STD_CANCEL, BUTTON_POWER, BUTTON_NONE },
+
+ LAST_ITEM_IN_LIST
+};
+
+struct button_mapping button_context_wps[] = {
+ { ACTION_WPS_PLAY, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
+ { ACTION_WPS_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
+ { ACTION_WPS_SKIPPREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
+ { ACTION_WPS_SEEKBACK, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
+ { ACTION_WPS_STOPSEEK, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT|BUTTON_REPEAT },
+ { ACTION_WPS_SKIPNEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
+ { ACTION_WPS_SEEKFWD, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT },
+ { ACTION_WPS_STOPSEEK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT|BUTTON_REPEAT },
+
+ { ACTION_WPS_VOLDOWN, BUTTON_DOWN, BUTTON_NONE },
+ { ACTION_WPS_VOLDOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_DOWN },
+ { ACTION_WPS_VOLUP, BUTTON_UP, BUTTON_NONE },
+ { ACTION_WPS_VOLUP, BUTTON_UP|BUTTON_REPEAT, BUTTON_UP },
+
+ { ACTION_WPS_BROWSE, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
+ { ACTION_WPS_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
+ { ACTION_WPS_MENU, BUTTON_REC|BUTTON_REL, BUTTON_REC },
+ { ACTION_WPS_QUICKSCREEN, BUTTON_REC|BUTTON_REPEAT, BUTTON_REC },
+
+
+ LAST_ITEM_IN_LIST
+};
+
+struct button_mapping button_context_settings[] = {
+ { ACTION_SETTINGS_INC, BUTTON_UP, BUTTON_NONE },
+ { ACTION_SETTINGS_INCREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_SETTINGS_DEC, BUTTON_DOWN, BUTTON_NONE },
+ { ACTION_SETTINGS_DECREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_STD_PREV, BUTTON_LEFT, BUTTON_NONE },
+ { ACTION_STD_CANCEL, BUTTON_REC, BUTTON_NONE },
+
+ LAST_ITEM_IN_LIST
+};
+struct button_mapping button_context_tree[] = {
+ { ACTION_NONE, BUTTON_PLAY, BUTTON_NONE },
+ { ACTION_TREE_WPS, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
+ { ACTION_TREE_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
+
+ LAST_ITEM_IN_LIST
+}; /* button_context_listtree */
+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_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
+ { ACTION_TREE_PGLEFT, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT|BUTTON_REPEAT },
+ { ACTION_NONE, BUTTON_RIGHT, BUTTON_NONE },
+ { ACTION_STD_OK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
+ { ACTION_TREE_PGRIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT },
+ { ACTION_TREE_PGRIGHT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT|BUTTON_REPEAT },
+ LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|1),
+};
+
+struct button_mapping button_context_yesno[] = {
+ { ACTION_YESNO_ACCEPT, BUTTON_SELECT, BUTTON_NONE },
+ LAST_ITEM_IN_LIST
+}; /* button_context_settings_yesno */
+
+struct button_mapping* get_context_mapping( int context )
+{
+ switch( context )
+ {
+ case CONTEXT_STD:
+ return button_context_standard;
+
+ case CONTEXT_WPS:
+ return button_context_wps;
+
+ case CONTEXT_SETTINGS:
+ return button_context_settings;
+
+ case CONTEXT_YESNOSCREEN:
+ return button_context_yesno;
+
+ case CONTEXT_TREE:
+ if (global_settings.hold_lr_for_scroll_in_list)
+ return button_context_tree_scroll_lr;
+ /* else fall through to CUSTOM|1 */
+ case CONTEXT_CUSTOM|1:
+ return button_context_tree;
+
+ case CONTEXT_LIST:
+ case CONTEXT_MAINMENU:
+ default:
+ return button_context_standard;
+ }
+}
diff --git a/apps/logfdisp.c b/apps/logfdisp.c
index 9d62383da4..734a6aec63 100644
--- a/apps/logfdisp.c
+++ b/apps/logfdisp.c
@@ -24,20 +24,12 @@
#include <timefuncs.h>
#include <string.h>
#include <kernel.h>
-#include <button.h>
+#include <action.h>
#include <lcd.h>
#include "menu.h"
#include "logf.h"
-#if (CONFIG_KEYPAD == IPOD_3G_PAD) || (CONFIG_KEYPAD == IPOD_4G_PAD)
-#define LOGF_BUTTON_QUIT BUTTON_MENU
-#elif CONFIG_KEYPAD == IAUDIO_X5_PAD
-#define LOGF_BUTTON_QUIT BUTTON_POWER
-#else
-#define LOGF_BUTTON_QUIT BUTTON_OFF
-#endif
-
#ifdef HAVE_LCD_BITMAP
bool logfdisplay(void)
@@ -46,7 +38,6 @@ bool logfdisplay(void)
int lines;
int columns;
int i;
- int button;
bool lcd = false; /* fixed atm */
int index;
@@ -93,8 +84,7 @@ bool logfdisplay(void)
lcd_puts(0, i, buffer);
}
lcd_update();
- button = button_get_w_tmo(HZ/2);
- } while(button != LOGF_BUTTON_QUIT);
+ } while(!action_userabort(HZ));
return false;
}
diff --git a/apps/main.c b/apps/main.c
index 95e6663ba0..c50af865fc 100644
--- a/apps/main.c
+++ b/apps/main.c
@@ -365,7 +365,7 @@ void init(void)
lcd_puts(0, 1, str);
lcd_puts(0, 3, "Press ON to debug");
lcd_update();
- while(!(button_get(true) & BUTTON_REL));
+ while(!(button_get(true) & BUTTON_REL)); /*DO NOT CHANGE TO ACTION SYSTEM */
dbg_ports();
#endif
panicf("ata: %d", rc);
diff --git a/apps/main_menu.c b/apps/main_menu.c
index bce6e20976..04527f9329 100644
--- a/apps/main_menu.c
+++ b/apps/main_menu.c
@@ -24,7 +24,7 @@
#include "tree.h"
#include "lcd.h"
#include "font.h"
-#include "button.h"
+#include "action.h"
#include "kernel.h"
#include "main_menu.h"
#include "debug_menu.h"
@@ -237,48 +237,22 @@ bool show_info(void)
#endif
/* Wait for a key to be pushed */
- key = button_get_w_tmo(HZ*5);
+ key = get_action(CONTEXT_MAINMENU,HZ*5);
switch(key) {
- case SETTINGS_OK:
-#ifdef SETTINGS_RC_OK
- case SETTINGS_RC_OK:
-#endif
-#ifdef SETTINGS_OK2
- case SETTINGS_OK2:
-#endif
-#ifdef SETTINGS_RC_OK2
- case SETTINGS_RC_OK2:
-#endif
-#ifdef SETTINGS_RC_CANCEL
- case SETTINGS_RC_CANCEL:
-#endif
- case SETTINGS_CANCEL:
+ case ACTION_STD_CANCEL:
done = true;
break;
#ifdef HAVE_LCD_CHARCELLS
- case SETTINGS_INC:
- case SETTINGS_DEC:
-#ifdef SETTINGS_RC_INC
- case SETTINGS_RC_INC:
-#endif
-#ifdef SETTINGS_RC_DEC
- case SETTINGS_RC_DEC:
-#endif
+ case ACTION_STD_NEXT:
+ case ACTION_STD_PREV:
page = (page == 0) ? 1 : 0;
break;
#endif
#ifndef SIMULATOR
-#ifdef SETTINGS_RC_ACCEPT
- case SETTINGS_RC_ACCEPT:
-#endif
-#ifdef SETTINGS_ACCEPT
- case SETTINGS_ACCEPT:
-#else
- case SETTINGS_INC: /* Ondio */
-#endif
+ case ACTION_STD_OK:
gui_syncsplash(0, true, str(LANG_DIRCACHE_BUILDING));
fat_recalc_free(IF_MV(0));
#ifdef HAVE_MULTIVOLUME
@@ -295,7 +269,7 @@ bool show_info(void)
break;
}
}
-
+ action_signalscreenchange();
return false;
}
diff --git a/apps/menu.c b/apps/menu.c
index a1c70824ce..f861e0bddf 100644
--- a/apps/menu.c
+++ b/apps/menu.c
@@ -40,6 +40,7 @@
#include "talk.h"
#include "lang.h"
#include "misc.h"
+#include "action.h"
#ifdef HAVE_LCD_BITMAP
#include "icons.h"
@@ -124,13 +125,12 @@ int menu_show(int m)
#endif
bool exit = false;
int key;
- unsigned lastbutton = 0;
gui_synclist_draw(&(menus[m].synclist));
gui_syncstatusbar_draw(&statusbars, true);
menu_talk_selected(m);
while (!exit) {
- key = button_get_w_tmo(HZ/2);
+ key = get_action(CONTEXT_MAINMENU,HZ/2);
/*
* "short-circuit" the default keypresses by running the
* callback function
@@ -144,40 +144,13 @@ int menu_show(int m)
if(gui_synclist_do_button(&(menus[m].synclist), key))
menu_talk_selected(m);
switch( key ) {
- case MENU_ENTER | BUTTON_REL:
- if (lastbutton != MENU_ENTER)
- break;
-#ifdef MENU_ENTER2
- case MENU_ENTER2:
-#endif
-#ifdef MENU_RC_ENTER
- case MENU_RC_ENTER:
-#endif
-#ifdef MENU_RC_ENTER2
- case MENU_RC_ENTER2:
-#endif
+ case ACTION_STD_OK:
+ action_signalscreenchange();
return gui_synclist_get_sel_pos(&(menus[m].synclist));
- case MENU_EXIT | BUTTON_REL:
- if (lastbutton != MENU_EXIT)
- break;
-#ifdef MENU_EXIT2
- case MENU_EXIT2:
-#endif
-#ifdef MENU_EXIT_MENU
- case MENU_EXIT_MENU | BUTTON_REL:
- /* This is important for the Ondio's */
- if ((key == (MENU_EXIT_MENU | BUTTON_REL)) &&
- (lastbutton != MENU_EXIT_MENU))
- break;
-#endif
-#ifdef MENU_RC_EXIT
- case MENU_RC_EXIT:
-#endif
-#ifdef MENU_RC_EXIT_MENU
- case MENU_RC_EXIT_MENU:
-#endif
+ case ACTION_STD_CANCEL:
+ case ACTION_STD_MENU:
exit = true;
break;
@@ -187,9 +160,8 @@ int menu_show(int m)
break;
}
gui_syncstatusbar_draw(&statusbars, false);
- if ( key )
- lastbutton = key;
}
+ action_signalscreenchange();
return MENU_SELECTED_EXIT;
}
diff --git a/apps/onplay.c b/apps/onplay.c
index a81b096e79..231e658ed9 100644
--- a/apps/onplay.c
+++ b/apps/onplay.c
@@ -815,11 +815,7 @@ static int onplay_callback(int key, int menu)
{
(void)menu;
- if (key == MENU_EXIT_MENU
-#ifdef MENU_RC_EXIT_MENU
- || key == MENU_RC_EXIT_MENU
-#endif
- )
+ if (key == ACTION_STD_MENU)
exit_to_main = true;
return key;
diff --git a/apps/playback.h b/apps/playback.h
index 7144974f36..3e501333c1 100644
--- a/apps/playback.h
+++ b/apps/playback.h
@@ -67,9 +67,13 @@ void audio_set_track_unbuffer_event(void (*handler)(struct mp3entry *id3,
void audio_invalidate_tracks(void);
void voice_init(void);
+#if CONFIG_CODEC == SWCODEC /* This #ifdef is better here than gui/gwps.c */
extern void audio_next_dir(void);
extern void audio_prev_dir(void);
-
+#else
+#define audio_next_dir()
+#define audio_prev_dir()
+#endif
void audio_preinit(void);
#endif
diff --git a/apps/playlist.c b/apps/playlist.c
index a51e8f501c..aa84bb090f 100644
--- a/apps/playlist.c
+++ b/apps/playlist.c
@@ -70,6 +70,7 @@
#include <string.h>
#include "playlist.h"
#include "file.h"
+#include "action.h"
#include "dir.h"
#include "sprintf.h"
#include "debug.h"
@@ -1342,7 +1343,7 @@ static int get_next_dir(char *dir, bool is_forward, bool recursion)
for (i=0; i<num_files; i++)
{
/* user abort */
- if (button_get(false) == SETTINGS_CANCEL)
+ if (action_userabort(TIMEOUT_NOBLOCK))
{
result = -1;
exit = true;
@@ -1440,7 +1441,7 @@ static int check_subdir_for_music(char *dir, char *subdir)
{
for (i=0; i<num_files; i++)
{
- if (button_get(false) == SETTINGS_CANCEL)
+ if (action_userabort(TIMEOUT_NOBLOCK))
{
result = -2;
break;
@@ -1888,7 +1889,7 @@ int playlist_resume(void)
str(LANG_OFF_ABORT)
#endif
);
- if (SETTINGS_CANCEL == button_get(false))
+ if (action_userabort(TIMEOUT_NOBLOCK))
{
/* FIXME:
* Not sure how to implement this, somebody more familiar
@@ -2870,7 +2871,7 @@ int playlist_insert_playlist(struct playlist_info* playlist, char *filename,
while ((max = read_line(fd, temp_buf, sizeof(temp_buf))) > 0)
{
/* user abort */
- if (button_get(false) == SETTINGS_CANCEL)
+ if (action_userabort(TIMEOUT_NOBLOCK))
break;
if (temp_buf[0] != '#' && temp_buf[0] != '\0')
@@ -3281,7 +3282,7 @@ int playlist_save(struct playlist_info* playlist, char *filename)
int seek;
/* user abort */
- if (button_get(false) == SETTINGS_CANCEL)
+ if (action_userabort(TIMEOUT_NOBLOCK))
{
result = -1;
break;
@@ -3408,7 +3409,7 @@ int playlist_directory_tracksearch(const char* dirname, bool recurse,
for (i=0; i<num_files; i++)
{
/* user abort */
- if (button_get(false) == SETTINGS_CANCEL)
+ if (action_userabort(TIMEOUT_NOBLOCK))
{
result = -1;
break;
diff --git a/apps/playlist_catalog.c b/apps/playlist_catalog.c
index a1a9bd8ea1..55af178ee4 100644
--- a/apps/playlist_catalog.c
+++ b/apps/playlist_catalog.c
@@ -214,7 +214,6 @@ static int display_playlists(char* playlist, bool view)
{
int result = -1;
int num_playlists = 0;
- int lastbutton = BUTTON_NONE;
bool exit = false;
char temp_buf[MAX_PATH];
char* playlists[MAX_PLAYLISTS];
@@ -240,7 +239,7 @@ static int display_playlists(char* playlist, bool view)
while (!exit)
{
- int button = button_get_w_tmo(HZ/2);
+ int button = get_action(CONTEXT_LIST,HZ/2);
char* sel_file;
gui_synclist_do_button(&playlist_lists, button);
@@ -249,34 +248,11 @@ static int display_playlists(char* playlist, bool view)
switch (button)
{
- case TREE_EXIT:
-#ifdef TREE_RC_EXIT
- case TREE_RC_EXIT:
-#endif
-#ifdef TREE_OFF
- case TREE_OFF:
-#endif
+ case ACTION_STD_CANCEL:
exit = true;
break;
-#ifdef TREE_ENTER
- case TREE_ENTER:
- case TREE_ENTER | BUTTON_REPEAT:
-#endif
-#ifdef TREE_RC_RUN
- case TREE_RC_RUN:
-#endif
- case TREE_RUN:
-#ifdef TREE_RUN_PRE
- if (((button == TREE_RUN)
-#ifdef TREE_RC_RUN_PRE
- || (button == TREE_RC_RUN))
- && ((lastbutton != TREE_RC_RUN_PRE)
-#endif
- && (lastbutton != TREE_RUN_PRE)))
- break;
-#endif
-
+ case ACTION_STD_OK:
if (view)
{
/* In view mode, selecting a playlist starts playback */
@@ -298,13 +274,7 @@ static int display_playlists(char* playlist, bool view)
exit = true;
break;
- case TREE_CONTEXT:
-#ifdef TREE_CONTEXT2
- case TREE_CONTEXT2:
-#endif
-#ifdef TREE_RC_CONTEXT
- case TREE_RC_CONTEXT:
-#endif
+ case ACTION_STD_CONTEXT:
/* context menu only available in view mode */
if (view)
{
@@ -322,7 +292,7 @@ static int display_playlists(char* playlist, bool view)
}
break;
- case BUTTON_NONE:
+ case ACTION_NONE:
gui_syncstatusbar_draw(&statusbars, false);
break;
@@ -334,10 +304,8 @@ static int display_playlists(char* playlist, bool view)
}
break;
}
-
- lastbutton = button;
}
-
+ action_signalscreenchange();
return result;
}
diff --git a/apps/playlist_viewer.c b/apps/playlist_viewer.c
index 46482cb7fa..7c73b2bad9 100644
--- a/apps/playlist_viewer.c
+++ b/apps/playlist_viewer.c
@@ -48,6 +48,7 @@
#include "statusbar.h"
#include "splash.h"
#include "playlist_menu.h"
+#include "action.h"
/* Maximum number of tracks we can have loaded at one time */
#define MAX_PLAYLIST_ENTRIES 200
@@ -614,7 +615,7 @@ bool playlist_viewer_ex(char* filename)
{
bool ret = false; /* return value */
bool exit=false; /* exit viewer */
- int button, lastbutton = BUTTON_NONE;
+ int button;
struct gui_synclist playlist_lists;
if (!playlist_viewer_init(&viewer, filename, false))
goto exit;
@@ -661,7 +662,7 @@ bool playlist_viewer_ex(char* filename)
}
/* Timeout so we can determine if play status has changed */
- button = button_get_w_tmo(HZ/2);
+ button = get_action(CONTEXT_TREE,HZ/2);
int list_action;
if( (list_action=gui_synclist_do_button(&playlist_lists, button))!=0 )
{
@@ -669,7 +670,7 @@ bool playlist_viewer_ex(char* filename)
if(playlist_buffer_needs_reload(&viewer.buffer,
viewer.selected_track))
playlist_buffer_load_entries_screen(&viewer.buffer,
- list_action==LIST_NEXT?
+ list_action==ACTION_STD_NEXT?
FORWARD
:
BACKWARD
@@ -677,36 +678,11 @@ bool playlist_viewer_ex(char* filename)
}
switch (button)
{
- case TREE_EXIT | BUTTON_REL:
- if (lastbutton != TREE_EXIT)
- break;
-#ifdef TREE_RC_EXIT
- case TREE_RC_EXIT:
-#endif
-#ifdef TREE_OFF
- case TREE_OFF:
-#endif
+ case ACTION_STD_CANCEL:
exit = true;
break;
-
-#ifdef TREE_ENTER
- case TREE_ENTER | BUTTON_REL:
- if (lastbutton != TREE_ENTER)
- break;
-#endif
-#ifdef TREE_RC_RUN
- case TREE_RC_RUN:
-#endif
- case TREE_RUN:
-#ifdef TREE_RUN_PRE
- if (((button == TREE_RUN)
-#ifdef TREE_RC_RUN_PRE
- || (button == TREE_RC_RUN))
- && ((lastbutton != TREE_RC_RUN_PRE)
-#endif
- && (lastbutton != TREE_RUN_PRE)))
- break;
-#endif
+ case ACTION_STD_OK:
+ {
struct playlist_entry * current_track =
playlist_buffer_get_track(&viewer.buffer,
viewer.selected_track);
@@ -744,14 +720,8 @@ bool playlist_viewer_ex(char* filename)
gui_synclist_draw(&playlist_lists);
break;
-
- case TREE_CONTEXT:
-#ifdef TREE_CONTEXT2
- case TREE_CONTEXT2:
-#endif
-#ifdef TREE_RC_CONTEXT
- case TREE_RC_CONTEXT:
-#endif
+ }
+ case ACTION_STD_CONTEXT:
{
/* ON+PLAY menu */
int ret;
@@ -774,14 +744,7 @@ bool playlist_viewer_ex(char* filename)
gui_synclist_draw(&playlist_lists);
break;
}
-#ifdef TREE_MENU_PRE
- case TREE_MENU_PRE:
-#else
- case TREE_MENU:
-#endif
-#ifdef TREE_RC_MENU
- case TREE_RC_MENU:
-#endif
+ case ACTION_STD_MENU:
if (viewer_menu())
{
ret = true;
@@ -795,7 +758,7 @@ bool playlist_viewer_ex(char* filename)
gui_synclist_draw(&playlist_lists);
break;
- case BUTTON_NONE:
+ case ACTION_NONE:
gui_syncstatusbar_draw(&statusbars, false);
break;
@@ -807,12 +770,12 @@ bool playlist_viewer_ex(char* filename)
}
break;
}
- lastbutton = button;
}
exit:
if (viewer.playlist)
playlist_close(viewer.playlist);
+ action_signalscreenchange();
return ret;
}
char * playlist_search_callback_name(int selected_item, void * data, char *buffer)
@@ -860,7 +823,7 @@ bool search_playlist(void)
str(LANG_OFF_ABORT)
#endif
);
- if (SETTINGS_CANCEL == button_get(false))
+ if (action_userabort(TIMEOUT_NOBLOCK))
return ret;
playlist_get_track_info(viewer.playlist,i,&track);
if (strcasestr(track.filename,search_str))
@@ -883,35 +846,22 @@ bool search_playlist(void)
gui_synclist_draw(&playlist_lists);
while (!exit)
{
- button = button_get(true);
+ button = get_action(CONTEXT_LIST,TIMEOUT_BLOCK);
if (gui_synclist_do_button(&playlist_lists, button))
continue;
switch (button)
{
- case TREE_EXIT:
-#ifdef TREE_RC_EXIT
- case TREE_RC_EXIT:
-#endif
-#ifdef TREE_OFF
- case TREE_OFF:
-#endif
+ case ACTION_STD_CANCEL:
exit = true;
break;
-#ifdef TREE_ENTER
- case TREE_ENTER:
- case TREE_ENTER | BUTTON_REPEAT:
-#endif
-#ifdef TREE_RC_RUN
- case TREE_RC_RUN:
-#endif
- case TREE_RUN:
+ case ACTION_STD_OK:
playlist_start(
found_indicies[gui_synclist_get_sel_pos(&playlist_lists)]
,0);
exit = 1;
break;
- case BUTTON_NONE:
+ case ACTION_NONE:
break;
default:
if(default_event_handler(button) == SYS_USB_CONNECTED)
@@ -922,6 +872,7 @@ bool search_playlist(void)
break;
}
}
+ action_signalscreenchange();
return ret;
}
diff --git a/apps/plugin.c b/apps/plugin.c
index c9278c8897..ea200b84ad 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -468,6 +468,11 @@ static const struct plugin_api rockbox_api = {
#endif
PREFIX(rmdir),
+ /* action handling */
+ get_custom_action,
+ get_action,
+ action_signalscreenchange,
+ action_userabort,
};
int plugin_load(const char* plugin, void* parameter)
diff --git a/apps/plugin.h b/apps/plugin.h
index 505e7ec666..8384d8b9aa 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -38,6 +38,7 @@
#include "dir.h"
#include "kernel.h"
#include "button.h"
+#include "action.h"
#include "usb.h"
#include "font.h"
#include "system.h"
@@ -104,7 +105,7 @@
#define PLUGIN_MAGIC 0x526F634B /* RocK */
/* increase this every time the api struct changes */
-#define PLUGIN_API_VERSION 28
+#define PLUGIN_API_VERSION 29
/* update this to latest version if a change to the api struct breaks
backwards compatibility (and please take the opportunity to sort in any
@@ -546,6 +547,12 @@ struct plugin_api {
#endif
int (*PREFIX(rmdir))(const char *name);
+ /* action handling */
+ int (*get_custom_action)(int context,int timeout,
+ struct button_mapping* (*get_context_map)(int));
+ int (*get_action)(int context, int timeout);
+ void (*action_signalscreenchange)(void);
+ bool (*action_userabort)(int timeout);
};
/* plugin header */
diff --git a/apps/recorder/radio.c b/apps/recorder/radio.c
index 1d39fefd21..c292909b33 100644
--- a/apps/recorder/radio.c
+++ b/apps/recorder/radio.c
@@ -1359,6 +1359,7 @@ bool handle_radio_presets_menu(void)
int handle_radio_presets_cb(int key, int m)
{
(void)m;
+#if 0 /* this screen needs fixing! */
switch(key)
{
#ifdef FM_PRESET_ADD
@@ -1372,7 +1373,7 @@ int handle_radio_presets_cb(int key, int m)
#ifdef FM_PRESET
case FM_PRESET:
menu_draw(m);
- key = MENU_EXIT; /* Fake an exit */
+ key = ACTION_STD_EXIT; /* Fake an exit */
break;
#endif
#endif
@@ -1409,21 +1410,11 @@ int handle_radio_presets_cb(int key, int m)
case MENU_ENTER2 | BUTTON_REL:
#endif
case MENU_ENTER | BUTTON_REL:
- key = MENU_ENTER; /* fake enter for short press */
+ key = ACTION_STD_SELECT; /* fake enter for short press */
break;
/* ignore down events */
-#ifdef MENU_RC_ENTER
- case MENU_RC_ENTER:
-#endif
-#ifdef MENU_RC_ENTER2
- case MENU_RC_ENTER2:
-#endif
-
-#ifdef MENU_ENTER2
- case MENU_ENTER2:
-#endif
- case MENU_ENTER:
+ case ACTION_STD_SELECT:
/* Ignore the release events */
#ifdef FM_PRESET_ADD
case FM_PRESET_ADD | BUTTON_REL:
@@ -1434,6 +1425,7 @@ int handle_radio_presets_cb(int key, int m)
key = BUTTON_NONE;
break;
}
+#endif
return key;
}
@@ -1611,6 +1603,7 @@ static bool scan_presets(void)
int radio_menu_cb(int key, int m)
{
(void)m;
+#if 0 /* this screen needs fixing! */
switch(key)
{
#if (CONFIG_KEYPAD != IRIVER_H100_PAD) && (CONFIG_KEYPAD != IRIVER_H300_PAD) && (CONFIG_KEYPAD != IAUDIO_X5_PAD)
@@ -1631,7 +1624,7 @@ int radio_menu_cb(int key, int m)
key = MENU_ENTER; /* fake downpress, next menu doesn't like release */
break;
}
-
+#endif
return key;
}
diff --git a/apps/screens.c b/apps/screens.c
index 5a2b58e853..6d9f79e6a5 100644
--- a/apps/screens.c
+++ b/apps/screens.c
@@ -21,7 +21,7 @@
#include <string.h>
#include <stdio.h>
#include "backlight.h"
-#include "button.h"
+#include "action.h"
#include "lcd.h"
#include "lang.h"
#include "icons.h"
@@ -309,11 +309,7 @@ void charging_display_info(bool animate)
2 if Off/Stop key was pressed
3 if On key was pressed
4 if USB was connected */
-#if (CONFIG_KEYPAD==IPOD_3G_PAD) || (CONFIG_KEYPAD==IPOD_4G_PAD)
-# define CHARGE_SCREEN_RESUME BUTTON_SELECT
-#else
-# define CHARGE_SCREEN_RESUME BUTTON_ON
-#endif
+
int charging_screen(void)
{
unsigned int button;
@@ -338,8 +334,8 @@ int charging_screen(void)
{
gui_syncstatusbar_draw(&statusbars, false);
charging_display_info(true);
- button = button_get_w_tmo(HZ/3);
- if (button == CHARGE_SCREEN_RESUME)
+ button = get_action(CONTEXT_STD,HZ/3);
+ if (button == ACTION_STD_OK)
rc = 2;
else if (usb_detect())
rc = 3;
@@ -350,6 +346,7 @@ int charging_screen(void)
#ifdef HAVE_LCD_CHARCELLS
logo_lock_patterns(false);
#endif
+ action_signalscreenchange();
return rc;
}
#endif /* CONFIG_CHARGING && !HAVE_POWEROFF_WHILE_CHARGING */
@@ -423,15 +420,15 @@ bool pitch_screen(void)
{
pitch_screen_draw(pitch);
- button = button_get(true);
+ button = get_action(CONTEXT_SETTINGS,TIMEOUT_BLOCK);
switch (button) {
- case PITCH_UP:
+ case ACTION_SETTINGS_INC:
if ( pitch < 2000 )
pitch++;
sound_set_pitch(pitch);
break;
- case PITCH_UP | BUTTON_REPEAT:
+ case ACTION_SETTINGS_INCREPEAT:
if ( pitch < 1990 )
pitch += 10;
else
@@ -439,13 +436,13 @@ bool pitch_screen(void)
sound_set_pitch(pitch);
break;
- case PITCH_DOWN:
+ case ACTION_SETTINGS_DEC:
if ( pitch > 500 )
pitch--;
sound_set_pitch(pitch);
break;
- case PITCH_DOWN | BUTTON_REPEAT:
+ case ACTION_SETTINGS_DECREPEAT:
if ( pitch > 510 )
pitch -= 10;
else
@@ -453,7 +450,7 @@ bool pitch_screen(void)
sound_set_pitch(pitch);
break;
- case PITCH_RIGHT:
+ case ACTION_STD_NEXT:
if ( pitch < 1980 )
{
pitch += 20;
@@ -461,15 +458,12 @@ bool pitch_screen(void)
pitch_screen_draw(pitch);
- while(button != (PITCH_RIGHT|BUTTON_REL))
- button = button_get(true);
-
pitch -= 20;
sound_set_pitch(pitch);
}
break;
- case PITCH_LEFT:
+ case ACTION_STD_PREV:
if ( pitch > 520 )
{
pitch -= 20;
@@ -477,20 +471,17 @@ bool pitch_screen(void)
pitch_screen_draw(pitch);
- while(button != (PITCH_LEFT|BUTTON_REL))
- button = button_get(true);;
-
pitch += 20;
sound_set_pitch(pitch);
}
break;
- case PITCH_RESET:
+ case ACTION_STD_OK:
pitch = 1000;
sound_set_pitch( pitch );
break;
- case PITCH_EXIT:
+ case ACTION_STD_CANCEL:
exit = true;
break;
@@ -504,6 +495,7 @@ bool pitch_screen(void)
pcmbuf_set_low_latency(false);
#endif
lcd_setfont(FONT_UI);
+ action_signalscreenchange();
return 0;
}
#endif
@@ -923,24 +915,22 @@ bool set_time_screen(const char* string, struct tm *tm)
say_time(cursorpos, tm);
}
- button = button_get_w_tmo(HZ/2);
+ button = get_action(CONTEXT_SETTINGS,HZ/2);
switch ( button ) {
- case SETTINGS_PREV:
+ case ACTION_STD_PREV:
cursorpos = (cursorpos + 6 - 1) % 6;
break;
- case SETTINGS_NEXT:
+ case ACTION_STD_NEXT:
cursorpos = (cursorpos + 6 + 1) % 6;
break;
- case SETTINGS_INC:
- case SETTINGS_INC | BUTTON_REPEAT:
+ case ACTION_SETTINGS_INC:
*valptr = (*valptr + steps - min + 1) %
steps + min;
if(*valptr == 0)
*valptr = min;
say_time(cursorpos, tm);
break;
- case SETTINGS_DEC:
- case SETTINGS_DEC | BUTTON_REPEAT:
+ case ACTION_SETTINGS_DEC:
*valptr = (*valptr + steps - min - 1) %
steps + min;
if(*valptr == 0)
@@ -948,11 +938,11 @@ bool set_time_screen(const char* string, struct tm *tm)
say_time(cursorpos, tm);
break;
- case SETTINGS_ACCEPT:
+ case ACTION_STD_OK:
done = true;
break;
- case SETTINGS_CANCEL:
+ case ACTION_STD_CANCEL:
done = true;
tm->tm_year = -1;
break;
@@ -963,7 +953,7 @@ bool set_time_screen(const char* string, struct tm *tm)
break;
}
}
-
+ action_signalscreenchange();
lcd_set_drawmode(lastmode);
return false;
}
@@ -981,10 +971,10 @@ bool shutdown_screen(void)
while(!done)
{
- button = button_get_w_tmo(HZ*2);
+ button = get_action(CONTEXT_STD,HZ*2);
switch(button)
{
- case BUTTON_OFF:
+ case ACTION_STD_CANCEL:
sys_poweroff();
break;
@@ -998,11 +988,14 @@ bool shutdown_screen(void)
not have released the button yet.
We also ignore REPEAT events, since we don't want to
remove the splash when the user holds OFF to shut down. */
+ /* Is this still needed? commenting out so it compiles..
+ CHECK ME!!
if(!(button & (BUTTON_REL | BUTTON_REPEAT)))
- done = true;
+ */ done = true;
break;
}
}
+ action_signalscreenchange();
return false;
}
#endif
@@ -1123,9 +1116,12 @@ bool browse_id3(void)
gui_synclist_set_nb_items(&id3_lists, ID3_ITEMS*2);
gui_synclist_draw(&id3_lists);
while (true) {
- key = button_get_w_tmo(HZ/2);
- if(key!=BUTTON_NONE && !(key&BUTTON_REL) && !gui_synclist_do_button(&id3_lists, key))
+ key = get_action(CONTEXT_STD,HZ/2);
+ if(key!=ACTION_NONE && /* !(key&BUTTON_REL) && ?? */ !gui_synclist_do_button(&id3_lists, key))
+ {
+ action_signalscreenchange();
return(default_event_handler(key) == SYS_USB_CONNECTED);
+ }
gui_syncstatusbar_draw(&statusbars, false);
}
}
@@ -1147,29 +1143,24 @@ bool set_rating(void)
snprintf(rating_text, sizeof(rating_text), "%d", id3->rating);
lcd_puts(0, 1, (unsigned char *)rating_text);
lcd_update();
- button = button_get(true);
+ button = get_action(CONTEXT_SETTINGS,TIMEOUT_BLOCK);
switch(button)
{
- case SETTINGS_DEC:
+ case ACTION_SETTINGS_DEC:
if (id3->rating > 0)
id3->rating--;
else
id3->rating = 10;
break;
- case SETTINGS_INC:
+ case ACTION_SETTINGS_INC:
if (id3->rating < 10)
id3->rating++;
else
id3->rating = 0;
break;
- case SETTINGS_CANCEL:
-#ifdef SETTINGS_OK2
- case SETTINGS_OK2:
-#endif
- /* eat release event */
- button_get(true);
+ case ACTION_STD_CANCEL:
exit = true;
break;
@@ -1179,5 +1170,6 @@ bool set_rating(void)
break;
}
}
+ action_signalscreenchange();
return false;
}
diff --git a/apps/screens.h b/apps/screens.h
index 34e7c9f603..deece8784d 100644
--- a/apps/screens.h
+++ b/apps/screens.h
@@ -22,51 +22,6 @@
#include "config.h"
#include "timefuncs.h"
-#if (CONFIG_KEYPAD == RECORDER_PAD) || (CONFIG_KEYPAD == IRIVER_H100_PAD) ||\
- (CONFIG_KEYPAD == IRIVER_H300_PAD)
-#define PITCH_UP BUTTON_UP
-#define PITCH_DOWN BUTTON_DOWN
-#define PITCH_RIGHT BUTTON_RIGHT
-#define PITCH_LEFT BUTTON_LEFT
-#define PITCH_EXIT BUTTON_OFF
-#define PITCH_RESET BUTTON_ON
-#elif (CONFIG_KEYPAD == ONDIO_PAD)
-#define PITCH_UP BUTTON_UP
-#define PITCH_DOWN BUTTON_DOWN
-#define PITCH_RIGHT BUTTON_RIGHT
-#define PITCH_LEFT BUTTON_LEFT
-#define PITCH_EXIT BUTTON_OFF
-#define PITCH_RESET BUTTON_MENU
-#elif (CONFIG_KEYPAD == IPOD_4G_PAD) || (CONFIG_KEYPAD == IPOD_3G_PAD)
-#define PITCH_UP BUTTON_SCROLL_FWD
-#define PITCH_DOWN BUTTON_SCROLL_BACK
-#define PITCH_RIGHT BUTTON_RIGHT
-#define PITCH_LEFT BUTTON_LEFT
-#define PITCH_EXIT BUTTON_SELECT
-#define PITCH_RESET BUTTON_MENU
-#elif (CONFIG_KEYPAD == GIGABEAT_PAD)
-#define PITCH_UP BUTTON_UP
-#define PITCH_DOWN BUTTON_DOWN
-#define PITCH_RIGHT BUTTON_RIGHT
-#define PITCH_LEFT BUTTON_LEFT
-#define PITCH_EXIT BUTTON_SELECT
-#define PITCH_RESET BUTTON_A
-#elif (CONFIG_KEYPAD == IAUDIO_X5_PAD)
-#define PITCH_UP BUTTON_UP
-#define PITCH_DOWN BUTTON_DOWN
-#define PITCH_RIGHT BUTTON_RIGHT
-#define PITCH_LEFT BUTTON_LEFT
-#define PITCH_EXIT BUTTON_PLAY
-#define PITCH_RESET BUTTON_POWER
-#elif (CONFIG_KEYPAD == IRIVER_H10_PAD)
-#define PITCH_UP BUTTON_SCROLL_UP
-#define PITCH_DOWN BUTTON_SCROLL_DOWN
-#define PITCH_RIGHT BUTTON_RIGHT
-#define PITCH_LEFT BUTTON_LEFT
-#define PITCH_EXIT BUTTON_PLAY
-#define PITCH_RESET BUTTON_POWER
-#endif
-
struct screen;
void usb_display_info(struct screen * display);
diff --git a/apps/settings.c b/apps/settings.c
index 412fc4bfed..f70e29696b 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -24,7 +24,7 @@
#include "config.h"
#include "kernel.h"
#include "thread.h"
-#include "button.h"
+#include "action.h"
#include "settings.h"
#include "disk.h"
#include "panic.h"
@@ -612,6 +612,7 @@ static const struct bit_entry hd_bits[] =
{2, S_O(eq_hw_band4_cutoff), 1, "eq hardware band 4 cutoff", "5.3kHz,6.9kHz,9kHz,11.7kHz" },
{5|SIGNED, S_O(eq_hw_band4_gain), 12, "eq hardware band 4 gain", NULL },
#endif
+ {1, S_O(hold_lr_for_scroll_in_list), true, "hold_lr_for_scroll_in_list", off_on },
{2, S_O(show_path_in_browser), 0, "show path in browser", "off,current directory,full path" },
@@ -1799,7 +1800,7 @@ void settings_reset(void) {
#ifdef HAVE_LCD_BITMAP
global_settings.kbd_file[0] = '\0';
#endif
-
+ global_settings.hold_lr_for_scroll_in_list = true;
}
bool set_bool(const char* string, bool* variable )
@@ -1891,7 +1892,7 @@ bool do_set_setting(const unsigned char* string, void *variable,
struct value_setting_data *cb_data,
void (*function)(int))
{
- int button;
+ int action;
bool done = false;
struct gui_synclist lists;
int oldvalue;
@@ -1918,11 +1919,11 @@ bool do_set_setting(const unsigned char* string, void *variable,
while (!done)
{
- button = button_get(true);
- if (button == BUTTON_NONE)
+ action = get_action(CONTEXT_LIST,TIMEOUT_BLOCK);
+ if (action == ACTION_NONE)
continue;
- if (gui_synclist_do_button(&lists,button))
+ if (gui_synclist_do_button(&lists,action))
{
if (global_settings.talk_menu)
{
@@ -1946,7 +1947,7 @@ bool do_set_setting(const unsigned char* string, void *variable,
*(bool*)variable = gui_synclist_get_sel_pos(&lists) ? true : false;
else *(int*)variable = gui_synclist_get_sel_pos(&lists);
}
- else if (button == SETTINGS_CANCEL)
+ else if (action == ACTION_STD_CANCEL)
{
gui_syncsplash(HZ/2,true,str(LANG_MENU_SETTING_CANCEL));
if (cb_data->type == INT)
@@ -1954,11 +1955,11 @@ bool do_set_setting(const unsigned char* string, void *variable,
else *(bool*)variable = (bool)oldvalue;
done = true;
}
- else if (button == SETTINGS_OK)
+ else if (action == ACTION_STD_OK)
{
done = true;
}
- else if(default_event_handler(button) == SYS_USB_CONNECTED)
+ else if(default_event_handler(action) == SYS_USB_CONNECTED)
return true;
gui_syncstatusbar_draw(&statusbars, false);
if ( function )
diff --git a/apps/settings.h b/apps/settings.h
index 439a43809a..27f00584a6 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -45,115 +45,6 @@
#define MAX_FILENAME 20
-/* button definitions */
-#if (CONFIG_KEYPAD == IRIVER_H100_PAD) || \
- (CONFIG_KEYPAD == IRIVER_H300_PAD)
-#define SETTINGS_INC BUTTON_UP
-#define SETTINGS_DEC BUTTON_DOWN
-#define SETTINGS_OK BUTTON_SELECT
-#define SETTINGS_OK2 BUTTON_LEFT
-#define SETTINGS_CANCEL BUTTON_OFF
-#define SETTINGS_CANCEL2 BUTTON_MODE
-#define SETTINGS_PREV BUTTON_LEFT
-#define SETTINGS_NEXT BUTTON_RIGHT
-#define SETTINGS_ACCEPT BUTTON_ON
-
-#define SETTINGS_RC_INC BUTTON_RC_FF
-#define SETTINGS_RC_DEC BUTTON_RC_REW
-#define SETTINGS_RC_OK BUTTON_RC_MENU
-#define SETTINGS_RC_OK2 BUTTON_RC_SOURCE
-#define SETTINGS_RC_CANCEL BUTTON_RC_STOP
-#define SETTINGS_RC_CANCEL2 BUTTON_RC_MODE
-#define SETTINGS_RC_PREV BUTTON_RC_SOURCE
-#define SETTINGS_RC_NEXT BUTTON_RC_BITRATE
-#define SETTINGS_RC_ACCEPT BUTTON_RC_ON
-
-#elif CONFIG_KEYPAD == RECORDER_PAD
-#define SETTINGS_INC BUTTON_UP
-#define SETTINGS_DEC BUTTON_DOWN
-#define SETTINGS_OK BUTTON_PLAY
-#define SETTINGS_OK2 BUTTON_LEFT
-#define SETTINGS_CANCEL BUTTON_OFF
-#define SETTINGS_CANCEL2 BUTTON_F1
-#define SETTINGS_PREV BUTTON_LEFT
-#define SETTINGS_NEXT BUTTON_RIGHT
-#define SETTINGS_ACCEPT BUTTON_ON
-
-#elif CONFIG_KEYPAD == PLAYER_PAD
-#define SETTINGS_INC BUTTON_RIGHT
-#define SETTINGS_DEC BUTTON_LEFT
-#define SETTINGS_OK BUTTON_PLAY
-#define SETTINGS_CANCEL BUTTON_STOP
-#define SETTINGS_CANCEL2 BUTTON_MENU
-#define SETTINGS_ACCEPT BUTTON_ON
-
-#elif CONFIG_KEYPAD == ONDIO_PAD
-#define SETTINGS_INC BUTTON_UP
-#define SETTINGS_DEC BUTTON_DOWN
-#define SETTINGS_OK BUTTON_RIGHT
-#define SETTINGS_OK2 BUTTON_LEFT
-#define SETTINGS_CANCEL BUTTON_MENU
-#define SETTINGS_CANCEL2 BUTTON_OFF
-
-#elif CONFIG_KEYPAD == GMINI100_PAD
-#define SETTINGS_INC BUTTON_UP
-#define SETTINGS_DEC BUTTON_DOWN
-#define SETTINGS_OK BUTTON_PLAY
-#define SETTINGS_OK2 BUTTON_LEFT
-#define SETTINGS_CANCEL BUTTON_OFF
-#define SETTINGS_CANCEL2 BUTTON_MENU
-#define SETTINGS_PREV BUTTON_LEFT
-#define SETTINGS_NEXT BUTTON_RIGHT
-#define SETTINGS_ACCEPT BUTTON_MENU
-
-#elif (CONFIG_KEYPAD == IPOD_3G_PAD) || (CONFIG_KEYPAD == IPOD_4G_PAD)
-#define SETTINGS_INC BUTTON_SCROLL_FWD
-#define SETTINGS_DEC BUTTON_SCROLL_BACK
-#define SETTINGS_OK BUTTON_SELECT
-#define SETTINGS_CANCEL BUTTON_MENU
-#define SETTINGS_PREV BUTTON_LEFT
-#define SETTINGS_NEXT BUTTON_RIGHT
-#define SETTINGS_ACCEPT BUTTON_PLAY
-
-#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
-#define SETTINGS_INC BUTTON_UP
-#define SETTINGS_DEC BUTTON_DOWN
-#define SETTINGS_OK BUTTON_SELECT
-#define SETTINGS_CANCEL BUTTON_PLAY
-#define SETTINGS_PREV BUTTON_LEFT
-#define SETTINGS_NEXT BUTTON_RIGHT
-
-#elif CONFIG_KEYPAD == IAUDIO_X5_PAD
-#define SETTINGS_INC BUTTON_UP
-#define SETTINGS_DEC BUTTON_DOWN
-#define SETTINGS_OK BUTTON_SELECT
-#define SETTINGS_OK2 BUTTON_LEFT
-#define SETTINGS_CANCEL BUTTON_REC
-#define SETTINGS_PREV BUTTON_LEFT
-#define SETTINGS_NEXT BUTTON_RIGHT
-#define SETTINGS_ACCEPT BUTTON_PLAY
-
-#elif CONFIG_KEYPAD == GIGABEAT_PAD
-#define SETTINGS_INC BUTTON_UP
-#define SETTINGS_DEC BUTTON_DOWN
-#define SETTINGS_OK BUTTON_MENU
-#define SETTINGS_CANCEL BUTTON_A
-#define SETTINGS_PREV BUTTON_LEFT
-#define SETTINGS_NEXT BUTTON_RIGHT
-#define SETTINGS_ACCEPT BUTTON_SELECT
-
-#elif CONFIG_KEYPAD == IRIVER_H10_PAD
-#define SETTINGS_INC BUTTON_SCROLL_UP
-#define SETTINGS_DEC BUTTON_SCROLL_DOWN
-#define SETTINGS_OK BUTTON_PLAY
-#define SETTINGS_OK2 BUTTON_LEFT
-#define SETTINGS_CANCEL BUTTON_REW
-#define SETTINGS_PREV BUTTON_LEFT
-#define SETTINGS_NEXT BUTTON_RIGHT
-#define SETTINGS_ACCEPT BUTTON_FF
-
-#endif
-
/* data structures */
#define BOOKMARK_NO 0
@@ -564,7 +455,7 @@ struct user_settings
int eq_hw_band4_cutoff;
int eq_hw_band4_gain;
#endif
-
+ bool hold_lr_for_scroll_in_list; /* hold L/R scrolls the list left/right */
int show_path_in_browser; /* 0=off, 1=current directory, 2=full path */
};
diff --git a/apps/tagtree.c b/apps/tagtree.c
index 0727b8ea45..405a1bbf34 100644
--- a/apps/tagtree.c
+++ b/apps/tagtree.c
@@ -29,6 +29,7 @@
#include "splash.h"
#include "icons.h"
#include "tree.h"
+#include "action.h"
#include "settings.h"
#include "tagcache.h"
#include "tagtree.h"
@@ -539,7 +540,7 @@ bool show_search_progress(bool init, int count)
str(LANG_OFF_ABORT)
#endif
);
- if (SETTINGS_CANCEL == button_get(false))
+ if (action_userabort(TIMEOUT_NOBLOCK))
return false;
last_tick = current_tick;
yield();
diff --git a/apps/tree.c b/apps/tree.c
index 2f1d140ad9..34d5d0b1bb 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -72,6 +72,7 @@
#include "splash.h"
#include "buttonbar.h"
#include "textarea.h"
+#include "action.h"
#ifdef HAVE_LCD_BITMAP
#include "widgets.h"
@@ -590,28 +591,11 @@ static bool dirbrowse(void)
boot_changed = false;
}
#endif
- button = button_get_w_tmo(HZ/5);
+ button = get_action(CONTEXT_TREE,HZ/5);
need_update = gui_synclist_do_button(&tree_lists, button);
switch ( button ) {
-#ifdef TREE_ENTER
- case TREE_ENTER | BUTTON_REL:
- if (lastbutton != TREE_ENTER)
- break;
-#endif
-#ifdef TREE_RC_RUN
- case TREE_RC_RUN:
-#endif
- case TREE_RUN:
-#ifdef TREE_RUN_PRE
- if (((button == TREE_RUN)
-#ifdef TREE_RC_RUN_PRE
- || (button == TREE_RC_RUN))
- && ((lastbutton != TREE_RC_RUN_PRE)
-#endif
- && (lastbutton != TREE_RUN_PRE)))
- break;
-#endif
+ case ACTION_STD_OK:
/* nothing to do if no files to display */
if ( numentries == 0 )
break;
@@ -626,31 +610,27 @@ static bool dirbrowse(void)
restore = true;
break;
- case TREE_EXIT | BUTTON_REL:
- if (lastbutton != TREE_EXIT)
- break;
-#ifdef TREE_RC_EXIT
- case TREE_RC_EXIT:
-#endif
+ case ACTION_STD_CANCEL:
if (*tc.dirfilter > NUM_FILTER_MODES && tc.dirlevel < 1) {
exit_func = true;
break;
}
- /* if we are in /, nothing to do */
- if (tc.dirlevel == 0 && !strcmp(currdir,"/"))
+ /* if we are in /, stop playback
+ (skip this and fall into tree_stop)*/
+ if (tc.dirlevel != 0 || strcmp(currdir,"/"))
+ {
+ if (id3db)
+ tagtree_exit(&tc);
+ else
+ if (ft_exit(&tc) == 3)
+ exit_func = true;
+
+ restore = true;
break;
+ }
+ /* else fall through */
- if (id3db)
- tagtree_exit(&tc);
- else
- if (ft_exit(&tc) == 3)
- exit_func = true;
-
- restore = true;
- break;
-
-#ifdef TREE_OFF
- case TREE_OFF:
+ case ACTION_TREE_STOP:
if (*tc.dirfilter < NUM_FILTER_MODES)
{
/* Stop the music if it is playing */
@@ -676,6 +656,7 @@ static bool dirbrowse(void)
#endif
}
break;
+ /* ??
#if defined(CONFIG_CHARGING) && !defined(HAVE_POWEROFF_WHILE_CHARGING)
case TREE_OFF | BUTTON_REPEAT:
if (charger_inserted()) {
@@ -684,25 +665,15 @@ static bool dirbrowse(void)
}
break;
#endif
-#endif /* TREE_OFF */
- case TREE_MENU:
-#ifdef TREE_RC_MENU
- case TREE_RC_MENU:
-#endif
-#ifdef TREE_MENU_PRE
- if (lastbutton != TREE_MENU_PRE
-#ifdef TREE_RC_MENU_PRE
- && lastbutton != TREE_RC_MENU_PRE
-#endif
- )
- break;
-#endif
+ */
+ case ACTION_STD_MENU:
/* don't enter menu from plugin browser */
if (*tc.dirfilter < NUM_FILTER_MODES)
{
int i;
FOR_NB_SCREENS(i)
screens[i].stop_scroll();
+ action_signalscreenchange();
if (main_menu())
reload_dir = true;
restore = true;
@@ -715,18 +686,7 @@ static bool dirbrowse(void)
exit_func = true;
break;
- case TREE_WPS:
-#ifdef TREE_RC_WPS
- case TREE_RC_WPS:
-#endif
-#ifdef TREE_WPS_PRE
- if ((lastbutton != TREE_WPS_PRE)
-#ifdef TREE_RC_WPS
- && (lastbutton != TREE_RC_WPS_PRE)
-#endif
- )
- break;
-#endif
+ case ACTION_TREE_WPS:
/* don't enter wps from plugin browser etc */
if (*tc.dirfilter < NUM_FILTER_MODES)
{
@@ -741,12 +701,8 @@ static bool dirbrowse(void)
}
}
break;
-
#ifdef HAVE_QUICKSCREEN
- case TREE_QUICK:
-#ifdef TREE_RC_QUICK
- case TREE_RC_QUICK:
-#endif
+ case ACTION_STD_QUICKSCREEN:
/* don't enter f2 from plugin browser */
if (*tc.dirfilter < NUM_FILTER_MODES)
{
@@ -759,7 +715,6 @@ static bool dirbrowse(void)
}
break;
#endif
-
#ifdef BUTTON_F3
case BUTTON_F3:
/* don't enter f3 from plugin browser */
@@ -772,13 +727,7 @@ static bool dirbrowse(void)
break;
#endif
- case TREE_CONTEXT:
-#ifdef TREE_RC_CONTEXT
- case TREE_RC_CONTEXT:
-#endif
-#ifdef TREE_CONTEXT2
- case TREE_CONTEXT2:
-#endif
+ case ACTION_STD_CONTEXT:
{
int onplay_result;
int attr = 0;
@@ -827,7 +776,7 @@ static bool dirbrowse(void)
break;
}
- case BUTTON_NONE:
+ case ACTION_NONE:
if (thumbnail_time != -1 &&
TIME_AFTER(current_tick, thumbnail_time))
{ /* a delayed hovering thumbnail is due now */
@@ -947,7 +896,6 @@ static bool dirbrowse(void)
lastfilter = *tc.dirfilter;
lastsortcase = global_settings.sort_case;
restore = true;
- button_clear_queue(); /* clear button queue */
}
if (exit_func)
@@ -1045,7 +993,7 @@ static bool dirbrowse(void)
}
}
}
-
+ action_signalscreenchange();
return true;
}
@@ -1057,7 +1005,7 @@ static bool add_dir(char* dirname, int len, int fd)
DIRCACHED* dir;
/* check for user abort */
- if (button_get(false) == TREE_ABORT)
+ if (action_userabort(TIMEOUT_NOBLOCK))
return true;
dir = opendir_cached(dirname);
diff --git a/apps/tree.h b/apps/tree.h
index 43242d6633..ffe6d478c6 100644
--- a/apps/tree.h
+++ b/apps/tree.h
@@ -23,166 +23,6 @@
#include <applimits.h>
#include <file.h>
-#if (CONFIG_KEYPAD == IRIVER_H100_PAD) || \
- (CONFIG_KEYPAD == IRIVER_H300_PAD)
-#define TREE_EXIT BUTTON_LEFT
-#define TREE_ABORT BUTTON_OFF
-#define TREE_ENTER BUTTON_RIGHT
-#define TREE_RUN (BUTTON_SELECT | BUTTON_REL)
-#define TREE_RUN_PRE BUTTON_SELECT
-#define TREE_MENU ( BUTTON_MODE | BUTTON_REL)
-#define TREE_MENU_PRE BUTTON_MODE
-#define TREE_OFF BUTTON_OFF
-#define TREE_WPS (BUTTON_ON | BUTTON_REL)
-#define TREE_WPS_PRE BUTTON_ON
-#define TREE_CONTEXT (BUTTON_SELECT | BUTTON_REPEAT)
-#define TREE_CONTEXT2 (BUTTON_ON | BUTTON_SELECT)
-#define TREE_QUICK (BUTTON_MODE | BUTTON_REPEAT)
-
-/* Remote keys */
-#define TREE_RC_NEXT BUTTON_RC_FF
-#define TREE_RC_PREV BUTTON_RC_REW
-#define TREE_RC_PGUP BUTTON_RC_SOURCE
-#define TREE_RC_PGDN BUTTON_RC_BITRATE
-#define TREE_RC_EXIT BUTTON_RC_STOP
-#define TREE_RC_RUN (BUTTON_RC_MENU | BUTTON_REL)
-#define TREE_RC_RUN_PRE BUTTON_RC_MENU
-#define TREE_RC_MENU (BUTTON_RC_MODE | BUTTON_REL)
-#define TREE_RC_MENU_PRE BUTTON_RC_MODE
-#define TREE_RC_WPS (BUTTON_RC_ON | BUTTON_REL)
-#define TREE_RC_WPS_PRE BUTTON_RC_ON
-#define TREE_RC_CONTEXT (BUTTON_RC_ON | BUTTON_REPEAT)
-#define TREE_RC_QUICK (BUTTON_RC_MODE | BUTTON_REPEAT)
-
-#elif CONFIG_KEYPAD == RECORDER_PAD
-#define TREE_EXIT BUTTON_LEFT
-#define TREE_ABORT BUTTON_OFF
-#define TREE_ENTER BUTTON_RIGHT
-#define TREE_RUN (BUTTON_PLAY | BUTTON_REL)
-#define TREE_RUN_PRE BUTTON_PLAY
-#define TREE_MENU BUTTON_F1
-#define TREE_OFF BUTTON_OFF
-#define TREE_WPS (BUTTON_ON | BUTTON_REL)
-#define TREE_WPS_PRE BUTTON_ON
-#define TREE_CONTEXT (BUTTON_PLAY | BUTTON_REPEAT)
-#define TREE_CONTEXT2 (BUTTON_ON | BUTTON_PLAY)
-#define TREE_QUICK BUTTON_F2
-
-#define TREE_RC_NEXT BUTTON_RC_RIGHT
-#define TREE_RC_PREV BUTTON_RC_LEFT
-#define TREE_RC_EXIT BUTTON_RC_STOP
-#define TREE_RC_RUN BUTTON_RC_PLAY
-
-#elif CONFIG_KEYPAD == PLAYER_PAD
-#define TREE_EXIT BUTTON_STOP
-#define TREE_ABORT BUTTON_STOP
-#define TREE_RUN (BUTTON_PLAY | BUTTON_REL)
-#define TREE_RUN_PRE BUTTON_PLAY
-#define TREE_MENU BUTTON_MENU
-#define TREE_WPS (BUTTON_ON | BUTTON_REL)
-#define TREE_WPS_PRE BUTTON_ON
-#define TREE_CONTEXT (BUTTON_PLAY | BUTTON_REPEAT)
-#define TREE_CONTEXT2 (BUTTON_ON | BUTTON_PLAY)
-
-#define TREE_RC_NEXT BUTTON_RC_RIGHT
-#define TREE_RC_PREV BUTTON_RC_LEFT
-#define TREE_RC_EXIT BUTTON_RC_STOP
-#define TREE_RC_RUN BUTTON_RC_PLAY
-
-#elif CONFIG_KEYPAD == ONDIO_PAD
-#define TREE_EXIT BUTTON_LEFT
-#define TREE_ABORT BUTTON_OFF
-#define TREE_RUN (BUTTON_RIGHT | BUTTON_REL)
-#define TREE_RUN_PRE BUTTON_RIGHT
-#define TREE_MENU (BUTTON_MENU | BUTTON_REPEAT)
-#define TREE_MENU_PRE BUTTON_MENU
-#define TREE_OFF BUTTON_OFF
-#define TREE_WPS (BUTTON_MENU | BUTTON_REL)
-#define TREE_WPS_PRE BUTTON_MENU
-#define TREE_CONTEXT (BUTTON_RIGHT | BUTTON_REPEAT)
-
-#elif CONFIG_KEYPAD == GMINI100_PAD
-#define TREE_EXIT BUTTON_LEFT
-#define TREE_ENTER BUTTON_RIGHT
-#define TREE_RUN (BUTTON_PLAY | BUTTON_REL)
-#define TREE_RUN_PRE BUTTON_PLAY
-#define TREE_MENU BUTTON_MENU
-#define TREE_WPS (BUTTON_ON | BUTTON_REL)
-#define TREE_WPS_PRE BUTTON_ON
-#define TREE_CONTEXT (BUTTON_PLAY | BUTTON_REPEAT)
-#define TREE_CONTEXT2 (BUTTON_ON | BUTTON_PLAY)
-
-#elif (CONFIG_KEYPAD == IPOD_3G_PAD) || (CONFIG_KEYPAD == IPOD_4G_PAD)
-
-#define TREE_EXIT BUTTON_LEFT
-#define TREE_ABORT BUTTON_LEFT
-#define TREE_ENTER BUTTON_RIGHT
-#define TREE_RUN (BUTTON_SELECT | BUTTON_REL)
-#define TREE_RUN_PRE BUTTON_SELECT
-#define TREE_MENU (BUTTON_MENU | BUTTON_REL)
-#define TREE_MENU_PRE BUTTON_MENU
-#define TREE_WPS (BUTTON_PLAY | BUTTON_REL)
-#define TREE_WPS_PRE BUTTON_PLAY
-#define TREE_CONTEXT (BUTTON_SELECT | BUTTON_REPEAT)
-#define TREE_QUICK (BUTTON_MENU | BUTTON_REPEAT)
-
-#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
-
-#define TREE_EXIT BUTTON_LEFT
-#define TREE_ABORT BUTTON_PLAY
-#define TREE_RUN (BUTTON_RIGHT | BUTTON_REL)
-#define TREE_RUN_PRE BUTTON_RIGHT
-#define TREE_MENU (BUTTON_SELECT | BUTTON_REPEAT)
-#define TREE_MENU_PRE BUTTON_SELECT
-#define TREE_WPS (BUTTON_SELECT | BUTTON_REL)
-#define TREE_WPS_PRE BUTTON_SELECT
-#define TREE_CONTEXT (BUTTON_RIGHT | BUTTON_REPEAT)
-
-#elif CONFIG_KEYPAD == IAUDIO_X5_PAD
-
-#define TREE_EXIT BUTTON_LEFT
-#define TREE_ABORT BUTTON_REC
-#define TREE_ENTER BUTTON_RIGHT
-#define TREE_RUN (BUTTON_SELECT | BUTTON_REL)
-#define TREE_RUN_PRE BUTTON_SELECT
-#define TREE_MENU (BUTTON_REC | BUTTON_REL)
-#define TREE_MENU_PRE BUTTON_REC
-#define TREE_WPS (BUTTON_PLAY | BUTTON_REL)
-#define TREE_WPS_PRE BUTTON_PLAY
-#define TREE_CONTEXT (BUTTON_SELECT | BUTTON_REPEAT)
-#define TREE_QUICK (BUTTON_REC | BUTTON_REPEAT)
-
-#elif CONFIG_KEYPAD == GIGABEAT_PAD
-
-#define TREE_NEXT BUTTON_DOWN
-#define TREE_PREV BUTTON_UP
-#define TREE_EXIT BUTTON_LEFT
-#define TREE_ABORT BUTTON_A
-#define TREE_ENTER BUTTON_RIGHT
-#define TREE_RUN (BUTTON_SELECT | BUTTON_REL)
-#define TREE_RUN_PRE BUTTON_SELECT
-#define TREE_MENU (BUTTON_MENU | BUTTON_REL)
-#define TREE_MENU_PRE BUTTON_MENU
-#define TREE_WPS (BUTTON_POWER | BUTTON_REL)
-#define TREE_WPS_PRE BUTTON_POWER
-#define TREE_CONTEXT (BUTTON_SELECT | BUTTON_REPEAT)
-
-#elif CONFIG_KEYPAD == IRIVER_H10_PAD
-
-#define TREE_EXIT BUTTON_LEFT
-#define TREE_ABORT BUTTON_LEFT
-#define TREE_ENTER BUTTON_RIGHT
-#define TREE_RUN (BUTTON_PLAY | BUTTON_REL)
-#define TREE_RUN_PRE BUTTON_PLAY
-#define TREE_MENU (BUTTON_REW | BUTTON_REL)
-#define TREE_MENU_PRE BUTTON_REW
-#define TREE_WPS (BUTTON_FF | BUTTON_REL)
-#define TREE_WPS_PRE BUTTON_FF
-#define TREE_CONTEXT (BUTTON_PLAY | BUTTON_SCROLL_UP)
-#define TREE_QUICK (BUTTON_PLAY | BUTTON_SCROLL_DOWN)
-
-#endif
-
struct entry {
short attr; /* FAT attributes + file type flags */
unsigned long time_write; /* Last write time */