summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/SOURCES3
-rw-r--r--apps/action.h8
-rw-r--r--apps/keymaps/keymap-cowond2.c30
-rwxr-xr-xapps/keymaps/keymap-mr500.c5
-rw-r--r--apps/keymaps/keymap-touchpad.c214
-rw-r--r--apps/main.c3
6 files changed, 229 insertions, 34 deletions
diff --git a/apps/SOURCES b/apps/SOURCES
index b1e5cce75d..40aa022842 100644
--- a/apps/SOURCES
+++ b/apps/SOURCES
@@ -138,6 +138,9 @@ metadata/a52.c
#ifdef HAVE_TAGCACHE
tagcache.c
#endif
+#ifdef HAVE_TOUCHPAD
+keymaps/keymap-touchpad.c
+#endif
#if (CONFIG_KEYPAD == IRIVER_H100_PAD) \
|| (CONFIG_KEYPAD == IRIVER_H300_PAD)
keymaps/keymap-h1x0_h3x0.c
diff --git a/apps/action.h b/apps/action.h
index c1c60c9b0b..96e8086baa 100644
--- a/apps/action.h
+++ b/apps/action.h
@@ -25,14 +25,15 @@
#define TIMEOUT_NOBLOCK 0
#define CONTEXT_STOPSEARCHING 0xFFFFFFFF
-#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 */
+#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 */
+#define CONTEXT_CUSTOM2 0x20000000 /* as above */
#define LAST_ITEM_IN_LIST { CONTEXT_STOPSEARCHING, BUTTON_NONE, BUTTON_NONE }
#define LAST_ITEM_IN_LIST__NEXTLIST(a) { a, BUTTON_NONE, BUTTON_NONE }
#ifndef HAS_BUTTON_HOLD
-#define ALLOW_SOFTLOCK 0x20000000 /* will be stripped.. never needed except in calls to get_action() */
+#define ALLOW_SOFTLOCK 0x10000000 /* will be stripped.. never needed except in calls to get_action() */
#else
#define ALLOW_SOFTLOCK 0
#endif
@@ -79,6 +80,7 @@ enum {
ACTION_UNKNOWN,
ACTION_REDRAW, /* returned if keys are locked and we splash()'ed */
ACTION_TOUCHPAD,
+ ACTION_TOUCHPAD_MODE, /* toggle the touchpad mode */
/* standard actions, use these first */
ACTION_STD_PREV,
diff --git a/apps/keymaps/keymap-cowond2.c b/apps/keymaps/keymap-cowond2.c
index ff4fdc5417..59ca7cb123 100644
--- a/apps/keymaps/keymap-cowond2.c
+++ b/apps/keymaps/keymap-cowond2.c
@@ -37,48 +37,27 @@
*/
static const struct button_mapping button_context_standard[] = {
- { ACTION_STD_PREV, BUTTON_UP, BUTTON_NONE },
{ ACTION_STD_PREV, BUTTON_MINUS, BUTTON_NONE },
- { ACTION_STD_PREVREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_STD_PREVREPEAT, BUTTON_MINUS|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_STD_NEXT, BUTTON_DOWN, BUTTON_NONE },
{ ACTION_STD_NEXT, BUTTON_PLUS, BUTTON_NONE },
- { ACTION_STD_NEXTREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_STD_NEXTREPEAT, BUTTON_PLUS|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_STD_OK, BUTTON_MENU|BUTTON_REL, BUTTON_NONE },
- { ACTION_STD_OK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
-
{ ACTION_STD_MENU, BUTTON_MENU|BUTTON_REPEAT, BUTTON_NONE },
// { ACTION_STD_QUICKSCREEN, BUTTON_MENU|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_STD_CONTEXT, BUTTON_PLUS|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_STD_CONTEXT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_STD_CANCEL, BUTTON_POWER, BUTTON_NONE },
- { ACTION_STD_CANCEL, BUTTON_LEFT, BUTTON_NONE },
- { ACTION_STD_CANCEL, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
LAST_ITEM_IN_LIST
}; /* button_context_standard */
static const struct button_mapping button_context_wps[] = {
- { ACTION_WPS_PLAY, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
- { ACTION_WPS_STOP, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
- { ACTION_WPS_SKIPPREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
- { ACTION_WPS_SEEKBACK, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
- { 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_NONE },
- { ACTION_WPS_STOPSEEK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT|BUTTON_REPEAT },
{ ACTION_WPS_VOLDOWN, BUTTON_MINUS, BUTTON_NONE },
{ ACTION_WPS_VOLDOWN, BUTTON_MINUS|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_WPS_VOLUP, BUTTON_PLUS, BUTTON_NONE },
{ ACTION_WPS_VOLUP, BUTTON_PLUS|BUTTON_REPEAT, BUTTON_NONE },
-
- { ACTION_WPS_BROWSE, BUTTON_UP|BUTTON_REL, BUTTON_UP },
- { ACTION_WPS_CONTEXT, BUTTON_UP|BUTTON_REPEAT, BUTTON_UP },
{ ACTION_WPS_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
- { ACTION_WPS_QUICKSCREEN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_DOWN },
LAST_ITEM_IN_LIST
}; /* button_context_wps */
@@ -99,13 +78,9 @@ static const struct button_mapping button_context_listtree_scroll_without_combo[
};
static const struct button_mapping button_context_settings[] = {
- { ACTION_SETTINGS_INC, BUTTON_UP, BUTTON_NONE },
{ ACTION_SETTINGS_INC, BUTTON_PLUS, BUTTON_NONE },
- { ACTION_SETTINGS_INCREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_SETTINGS_INCREPEAT, BUTTON_PLUS|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_SETTINGS_DEC, BUTTON_DOWN, BUTTON_NONE },
{ ACTION_SETTINGS_DEC, BUTTON_MINUS, BUTTON_NONE },
- { ACTION_SETTINGS_DECREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_SETTINGS_DECREPEAT, BUTTON_MINUS|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_STD_OK, BUTTON_MENU, BUTTON_NONE },
{ ACTION_STD_CANCEL, BUTTON_POWER, BUTTON_NONE },
@@ -154,10 +129,9 @@ static const struct button_mapping button_context_keyboard[] = {
//LAST_ITEM_IN_LIST
}; /* button_context_keyboard */
-extern int current_tick;
-const struct button_mapping* get_context_mapping(int context)
+const struct button_mapping* target_get_context_mapping(int context)
{
- switch (context&(~CONTEXT_REMOTE))
+ switch (context)
{
case CONTEXT_STD:
return button_context_standard;
diff --git a/apps/keymaps/keymap-mr500.c b/apps/keymaps/keymap-mr500.c
index b0d75c15bf..c680929efd 100755
--- a/apps/keymaps/keymap-mr500.c
+++ b/apps/keymaps/keymap-mr500.c
@@ -17,7 +17,7 @@
*
****************************************************************************/
-/* Button Code Definitions for the toshiba gigabeat target */
+/* Button Code Definitions for the Olympus M:robe 500 target */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@@ -137,8 +137,7 @@ static const struct button_mapping button_context_keyboard[] = {
LAST_ITEM_IN_LIST
}; /* button_context_keyboard */
-extern int current_tick;
-const struct button_mapping* get_context_mapping(int context)
+const struct button_mapping* target_get_context_mapping(int context)
{
switch (context&(~CONTEXT_REMOTE))
{
diff --git a/apps/keymaps/keymap-touchpad.c b/apps/keymaps/keymap-touchpad.c
new file mode 100644
index 0000000000..48f1103cd3
--- /dev/null
+++ b/apps/keymaps/keymap-touchpad.c
@@ -0,0 +1,214 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id: keymap-mr500.c 16056 2008-01-11 21:48:01Z roolku $
+ *
+ * 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 touchpad targets */
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include "config.h"
+#include "action.h"
+#include "button.h"
+#include "settings.h"
+
+const struct button_mapping* target_get_context_mapping(int context);
+/* How this file is used:
+ get_context_mapping() at the bottom of the file is called by action.c as usual.
+ if the context is for the remote control its then passed straight to
+ target_get_context_mapping().
+ These tables are only used for the touchpad buttons, so at the end of each
+ CONTEXT_CUSTOM2 is OR'ed with the context and then sent to target_get_context_mapping()
+ (NOTE: CONTEXT_CUSTOM2 will be stripped before being sent to make it easier.)
+ In the target keymap, remember to |CONTEXT_CUSTOM2 in the LAST_ITEM_IN_LIST__NEXTLIST() macro
+ to speed it up a tiny bit... if you dont it will go through these tables first before going
+ back to the target file.
+ */
+
+
+/* touchpad "buttons"
+ screen is split into a 3x3 grid for buttons...
+ BUTTON_TOPLEFT BUTTON_TOPMIDDLE BUTTON_TOPRIGHT
+ BUTTON_MIDLEFT BUTTON_CENTER BUTTON_MIDRIGHT
+ BUTTON_BOTTOMLEFT BUTTON_BOTTOMMIDDLE BUTTON_BOTTOMRIGHT
+*/
+
+static const struct button_mapping button_context_standard[] = {
+ { ACTION_STD_PREV, BUTTON_TOPMIDDLE, BUTTON_NONE },
+ { ACTION_STD_PREVREPEAT, BUTTON_TOPMIDDLE|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_STD_NEXT, BUTTON_BOTTOMMIDDLE, BUTTON_NONE },
+ { ACTION_STD_NEXTREPEAT, BUTTON_BOTTOMMIDDLE|BUTTON_REPEAT, BUTTON_NONE },
+
+ { ACTION_STD_OK, BUTTON_CENTER|BUTTON_REL, BUTTON_CENTER },
+ { ACTION_STD_OK, BUTTON_MIDRIGHT|BUTTON_REL, BUTTON_MIDRIGHT },
+ { ACTION_STD_OK, BUTTON_MIDRIGHT|BUTTON_REPEAT, BUTTON_MIDRIGHT },
+
+ { ACTION_STD_MENU, BUTTON_TOPLEFT, BUTTON_NONE },
+ { ACTION_STD_QUICKSCREEN, BUTTON_TOPLEFT|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_STD_CONTEXT, BUTTON_CENTER|BUTTON_REPEAT, BUTTON_CENTER },
+ { ACTION_STD_CANCEL, BUTTON_MIDLEFT, BUTTON_NONE },
+ { ACTION_STD_CANCEL, BUTTON_MIDLEFT|BUTTON_REPEAT, BUTTON_NONE },
+ LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_STD)
+}; /* button_context_standard */
+
+static const struct button_mapping button_context_wps[] = {
+ LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_WPS)
+}; /* button_context_wps */
+
+static const struct button_mapping button_context_list[] = {
+#if 0
+ /* this is all to show how the poor-mans-gestures can be used... */
+ { ACTION_LISTTREE_PGUP, BUTTON_TOPRIGHT, BUTTON_NONE},
+ { ACTION_LISTTREE_PGUP, BUTTON_TOPRIGHT|BUTTON_REPEAT, BUTTON_TOPRIGHT},
+ { ACTION_STD_NEXTREPEAT, BUTTON_CENTER, BUTTON_TOPMIDDLE},
+ { ACTION_STD_NEXTREPEAT, BUTTON_BOTTOMMIDDLE, BUTTON_CENTER},
+ { ACTION_NONE, BUTTON_TOPMIDDLE, BUTTON_NONE },
+ { ACTION_NONE, BUTTON_BOTTOMMIDDLE, BUTTON_NONE },
+ { ACTION_STD_PREV, BUTTON_TOPMIDDLE|BUTTON_REL, BUTTON_NONE },
+ { ACTION_STD_NEXT, BUTTON_BOTTOMMIDDLE|BUTTON_REL, BUTTON_NONE },
+ { ACTION_LISTTREE_PGDOWN, BUTTON_BOTTOMRIGHT, BUTTON_NONE},
+ { ACTION_LISTTREE_PGDOWN, BUTTON_BOTTOMRIGHT|BUTTON_REPEAT, BUTTON_BOTTOMRIGHT},
+ { ACTION_STD_PREVREPEAT, BUTTON_TOPMIDDLE, BUTTON_CENTER},
+ { ACTION_STD_PREVREPEAT, BUTTON_CENTER, BUTTON_BOTTOMMIDDLE},
+#endif
+ LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_LIST)
+}; /* button_context_list */
+
+static const struct button_mapping button_context_tree[] = {
+ LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_CUSTOM2|CONTEXT_TREE)
+}; /* button_context_tree */
+
+static const struct button_mapping button_context_listtree_scroll_with_combo[] = {
+ LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_CUSTOM|CONTEXT_TREE),
+};
+
+static const struct button_mapping button_context_listtree_scroll_without_combo[] = {
+ LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_CUSTOM|CONTEXT_TREE),
+};
+
+static const struct button_mapping button_context_settings[] = {
+ { ACTION_SETTINGS_INC, BUTTON_TOPMIDDLE, BUTTON_NONE },
+ { ACTION_SETTINGS_INCREPEAT, BUTTON_TOPMIDDLE|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_SETTINGS_DEC, BUTTON_BOTTOMMIDDLE, BUTTON_NONE },
+ { ACTION_SETTINGS_DECREPEAT, BUTTON_BOTTOMMIDDLE|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_STD_OK, BUTTON_CENTER, BUTTON_NONE },
+ { ACTION_STD_CANCEL, BUTTON_MIDLEFT, BUTTON_NONE },
+
+ LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_SETTINGS)
+}; /* button_context_settings */
+
+static const struct button_mapping button_context_settings_right_is_inc[] = {
+ { ACTION_STD_PREV, BUTTON_TOPMIDDLE, BUTTON_NONE },
+ { ACTION_STD_PREVREPEAT, BUTTON_TOPMIDDLE|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_STD_NEXT, BUTTON_BOTTOMMIDDLE, BUTTON_NONE },
+ { ACTION_STD_NEXTREPEAT, BUTTON_BOTTOMMIDDLE|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_SETTINGS_INC, BUTTON_MIDRIGHT, BUTTON_NONE },
+ { ACTION_SETTINGS_INCREPEAT, BUTTON_MIDRIGHT|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_SETTINGS_DEC, BUTTON_MIDLEFT, BUTTON_NONE },
+ { ACTION_SETTINGS_DECREPEAT, BUTTON_MIDLEFT|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_STD_OK, BUTTON_CENTER, BUTTON_NONE },
+ { ACTION_STD_CANCEL, BUTTON_TOPLEFT, BUTTON_NONE },
+ LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_CUSTOM|CONTEXT_SETTINGS)
+}; /* button_context_settingsgraphical */
+
+static const struct button_mapping button_context_yesno[] = {
+ { ACTION_YESNO_ACCEPT, BUTTON_MIDLEFT, BUTTON_NONE },
+ LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_YESNOSCREEN)
+}; /* button_context_settings_yesno */
+
+static const struct button_mapping button_context_colorchooser[] = {
+ LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_SETTINGS_COLOURCHOOSER),
+}; /* button_context_colorchooser */
+
+static const struct button_mapping button_context_eq[] = {
+ LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_SETTINGS_EQ),
+}; /* button_context_eq */
+
+/* Bookmark Screen */
+static const struct button_mapping button_context_bmark[] = {
+ LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_BOOKMARKSCREEN),
+}; /* button_context_bmark */
+
+static const struct button_mapping button_context_time[] = {
+ LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_SETTINGS_TIME),
+}; /* button_context_time */
+
+static const struct button_mapping button_context_quickscreen[] = {
+
+ LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_QUICKSCREEN)
+}; /* button_context_quickscreen */
+
+static const struct button_mapping button_context_pitchscreen[] = {
+
+ LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_PITCHSCREEN)
+}; /* button_context_pitchcreen */
+
+static const struct button_mapping button_context_keyboard[] = {
+
+ LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_KEYBOARD)
+}; /* button_context_keyboard */
+
+const struct button_mapping* get_context_mapping(int context)
+{
+ if ((context&CONTEXT_REMOTE) || (context&CONTEXT_CUSTOM2))
+ return target_get_context_mapping(context&(~CONTEXT_CUSTOM2));
+
+ switch (context)
+ {
+ case CONTEXT_STD:
+ return button_context_standard;
+ case CONTEXT_WPS:
+ return button_context_wps;
+
+ case CONTEXT_LIST:
+ return button_context_list;
+ case CONTEXT_MAINMENU:
+ 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|CONTEXT_TREE:
+ return button_context_tree;
+
+ case CONTEXT_SETTINGS:
+ return button_context_settings;
+ case CONTEXT_CUSTOM|CONTEXT_SETTINGS:
+ return button_context_settings_right_is_inc;
+
+ case CONTEXT_SETTINGS_COLOURCHOOSER:
+ return button_context_colorchooser;
+ case CONTEXT_SETTINGS_EQ:
+ return button_context_eq;
+
+ case CONTEXT_SETTINGS_TIME:
+ return button_context_time;
+
+ case CONTEXT_YESNOSCREEN:
+ return button_context_yesno;
+ case CONTEXT_BOOKMARKSCREEN:
+ return button_context_bmark;
+ case CONTEXT_QUICKSCREEN:
+ return button_context_quickscreen;
+ case CONTEXT_PITCHSCREEN:
+ return button_context_pitchscreen;
+ case CONTEXT_KEYBOARD:
+ return button_context_keyboard;
+ }
+ return button_context_standard;
+}
diff --git a/apps/main.c b/apps/main.c
index 3f83850df7..7309d95df2 100644
--- a/apps/main.c
+++ b/apps/main.c
@@ -132,6 +132,9 @@ static void app_main(void)
screens[i].update();
}
tree_gui_init();
+#ifdef HAVE_TOUCHPAD
+ touchpad_set_mode(TOUCHPAD_BUTTON);
+#endif
root_menu();
}