2004-03-12 10:20:33 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
*
|
|
|
|
* Copyright (C) 2004 Brent Coutts
|
|
|
|
*
|
2008-06-28 18:10:04 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2004-03-12 10:20:33 +00:00
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
#ifndef __ACTION_H__
|
|
|
|
#define __ACTION_H__
|
|
|
|
|
|
|
|
#include "stdbool.h"
|
2006-08-15 12:27:07 +00:00
|
|
|
#include "button.h"
|
2004-03-12 10:20:33 +00:00
|
|
|
|
2006-08-15 12:27:07 +00:00
|
|
|
#define TIMEOUT_BLOCK -1
|
|
|
|
#define TIMEOUT_NOBLOCK 0
|
2006-08-21 11:28:29 +00:00
|
|
|
|
|
|
|
#define CONTEXT_STOPSEARCHING 0xFFFFFFFF
|
2008-04-15 10:35:11 +00:00
|
|
|
#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 */
|
2009-05-31 17:47:56 +00:00
|
|
|
#define CONTEXT_PLUGIN 0x10000000 /* for plugins using get_custom_action */
|
2006-08-15 12:27:07 +00:00
|
|
|
|
2006-08-21 11:28:29 +00:00
|
|
|
#define LAST_ITEM_IN_LIST { CONTEXT_STOPSEARCHING, BUTTON_NONE, BUTTON_NONE }
|
|
|
|
#define LAST_ITEM_IN_LIST__NEXTLIST(a) { a, BUTTON_NONE, BUTTON_NONE }
|
|
|
|
|
2006-08-17 12:33:36 +00:00
|
|
|
#ifndef HAS_BUTTON_HOLD
|
2009-06-01 21:08:49 +00:00
|
|
|
#define ALLOW_SOFTLOCK 0x08000000 /* will be stripped.. never needed except in calls to get_action() */
|
2006-08-17 12:33:36 +00:00
|
|
|
#else
|
|
|
|
#define ALLOW_SOFTLOCK 0
|
|
|
|
#endif
|
|
|
|
|
2006-08-15 12:27:07 +00:00
|
|
|
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,
|
2007-04-08 01:33:01 +00:00
|
|
|
CONTEXT_MAINMENU = 4, /* uses CONTEXT_TREE and ACTION_TREE_* */
|
2006-08-15 12:27:07 +00:00
|
|
|
CONTEXT_ID3DB = 5,
|
|
|
|
/* Add new contexts here, no need to explicitly define a value for them */
|
|
|
|
CONTEXT_LIST,
|
2006-08-21 07:03:15 +00:00
|
|
|
CONTEXT_SETTINGS, /* regular setting screens (and debug screens) */
|
|
|
|
/* bellow are setting screens which may need to redefine the standard
|
|
|
|
setting screen keys, targets should return the CONTEXT_SETTINGS
|
|
|
|
keymap unless they are not adequate for the screen
|
|
|
|
NOTE: uses ACTION_STD_[NEXT|PREV] so make sure they are there also
|
|
|
|
and (possibly) ACTION_SETTINGS_[INC|DEC] */
|
|
|
|
CONTEXT_SETTINGS_EQ,
|
|
|
|
CONTEXT_SETTINGS_COLOURCHOOSER,
|
|
|
|
CONTEXT_SETTINGS_TIME,
|
2008-05-28 10:55:39 +00:00
|
|
|
CONTEXT_SETTINGS_RECTRIGGER,
|
2006-08-21 07:03:15 +00:00
|
|
|
|
|
|
|
/* The following contexts should use ACTION_STD_[NEXT|PREV]
|
|
|
|
and (possibly) ACTION_SETTINGS_[INC|DEC]
|
|
|
|
Also add any extra actions they need */
|
|
|
|
CONTEXT_BOOKMARKSCREEN, /* uses ACTION_BMS_ defines */
|
|
|
|
CONTEXT_ALARMSCREEN, /* uses ACTION_AS_ defines */
|
2006-08-15 12:27:07 +00:00
|
|
|
CONTEXT_QUICKSCREEN, /* uses ACTION_QS_ defines below */
|
2006-08-16 13:25:45 +00:00
|
|
|
CONTEXT_PITCHSCREEN, /* uses ACTION_PS_ defines below */
|
2006-08-21 07:03:15 +00:00
|
|
|
|
|
|
|
CONTEXT_YESNOSCREEN, /*NOTE: make sure your target has this and ACTION_YESNO_ACCEPT */
|
2006-08-20 21:33:40 +00:00
|
|
|
CONTEXT_RECSCREEN,
|
2006-08-22 13:21:13 +00:00
|
|
|
CONTEXT_KEYBOARD,
|
2006-09-22 12:18:58 +00:00
|
|
|
CONTEXT_FM,
|
2009-05-23 14:42:54 +00:00
|
|
|
CONTEXT_USB_HID,
|
2006-08-15 12:27:07 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
enum {
|
|
|
|
|
|
|
|
ACTION_NONE = BUTTON_NONE,
|
|
|
|
ACTION_UNKNOWN,
|
2006-08-17 12:33:36 +00:00
|
|
|
ACTION_REDRAW, /* returned if keys are locked and we splash()'ed */
|
2008-08-23 09:46:38 +00:00
|
|
|
ACTION_TOUCHSCREEN,
|
|
|
|
ACTION_TOUCHSCREEN_MODE, /* toggle the touchscreen mode */
|
2006-08-15 12:27:07 +00:00
|
|
|
|
|
|
|
/* 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,
|
2006-08-17 12:33:36 +00:00
|
|
|
ACTION_STD_KEYLOCK,
|
2007-08-02 12:13:20 +00:00
|
|
|
ACTION_STD_REC,
|
2006-08-15 12:27:07 +00:00
|
|
|
|
2006-08-22 08:23:24 +00:00
|
|
|
ACTION_F3, /* just so everything works again, possibly change me */
|
2006-08-15 12:27:07 +00:00
|
|
|
/* 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_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 */
|
2009-07-22 22:10:25 +00:00
|
|
|
ACTION_WPS_VIEW_PLAYLIST,
|
2007-08-02 12:13:20 +00:00
|
|
|
ACTION_WPS_REC,
|
2006-12-22 05:19:56 +00:00
|
|
|
#if 0
|
|
|
|
ACTION_WPSAB_SINGLE, /* This needs to be #defined in
|
|
|
|
the config-<target>.h to one of the ACTION_WPS_ actions
|
|
|
|
so it can be used */
|
|
|
|
#endif
|
2006-08-16 13:25:45 +00:00
|
|
|
ACTION_WPS_ABSETA_PREVDIR, /* these should be safe to put together seen as */
|
|
|
|
ACTION_WPS_ABSETB_NEXTDIR, /* you shouldnt want to change dir in ab-mode */
|
2007-04-13 15:42:25 +00:00
|
|
|
ACTION_WPS_ABRESET,
|
2006-08-15 12:27:07 +00:00
|
|
|
|
|
|
|
/* list and tree page up/down */
|
|
|
|
ACTION_LISTTREE_PGUP,/* optional */
|
|
|
|
ACTION_LISTTREE_PGDOWN,/* optional */
|
2007-04-08 01:33:01 +00:00
|
|
|
#ifdef HAVE_VOLUME_IN_LIST
|
|
|
|
ACTION_LIST_VOLUP,
|
|
|
|
ACTION_LIST_VOLDOWN,
|
|
|
|
#endif
|
2006-08-15 12:27:07 +00:00
|
|
|
|
|
|
|
/* tree */
|
2006-09-25 10:56:38 +00:00
|
|
|
ACTION_TREE_ROOT_INIT,
|
2006-08-15 12:27:07 +00:00
|
|
|
ACTION_TREE_PGLEFT,/* optional */
|
|
|
|
ACTION_TREE_PGRIGHT,/* optional */
|
|
|
|
ACTION_TREE_STOP,
|
|
|
|
ACTION_TREE_WPS,
|
|
|
|
|
2006-09-22 12:18:58 +00:00
|
|
|
/* radio */
|
|
|
|
ACTION_FM_MENU,
|
|
|
|
ACTION_FM_PRESET,
|
|
|
|
ACTION_FM_RECORD,
|
|
|
|
ACTION_FM_FREEZE,
|
|
|
|
ACTION_FM_STOP,
|
|
|
|
ACTION_FM_MODE,
|
|
|
|
ACTION_FM_EXIT,
|
|
|
|
ACTION_FM_PLAY,
|
|
|
|
ACTION_FM_RECORD_DBLPRE,
|
|
|
|
ACTION_FM_NEXT_PRESET,
|
|
|
|
ACTION_FM_PREV_PRESET,
|
|
|
|
|
2006-08-15 12:27:07 +00:00
|
|
|
/* recording screen */
|
2006-08-20 21:33:40 +00:00
|
|
|
ACTION_REC_LCD,
|
|
|
|
ACTION_REC_PAUSE,
|
|
|
|
ACTION_REC_NEWFILE,
|
|
|
|
ACTION_REC_F2,
|
|
|
|
ACTION_REC_F3,
|
2006-08-15 12:27:07 +00:00
|
|
|
|
|
|
|
/* main menu */
|
2007-04-08 01:33:01 +00:00
|
|
|
/* These are not strictly actions, but must be here
|
|
|
|
so they dont conflict with real actions in the menu code */
|
2007-02-08 04:33:41 +00:00
|
|
|
ACTION_REQUEST_MENUITEM,
|
|
|
|
ACTION_EXIT_MENUITEM,
|
2007-02-27 09:16:47 +00:00
|
|
|
ACTION_EXIT_AFTER_THIS_MENUITEM, /* if a menu returns this the menu will exit
|
|
|
|
once the subitem returns */
|
2007-02-08 04:33:41 +00:00
|
|
|
ACTION_ENTER_MENUITEM,
|
2006-08-15 12:27:07 +00:00
|
|
|
|
|
|
|
/* id3db */
|
|
|
|
|
|
|
|
/* list */
|
|
|
|
|
|
|
|
/* settings */
|
|
|
|
ACTION_SETTINGS_INC,
|
|
|
|
ACTION_SETTINGS_INCREPEAT,
|
2006-08-21 07:03:15 +00:00
|
|
|
ACTION_SETTINGS_INCBIGSTEP,
|
2006-08-15 12:27:07 +00:00
|
|
|
ACTION_SETTINGS_DEC,
|
|
|
|
ACTION_SETTINGS_DECREPEAT,
|
2006-08-21 07:03:15 +00:00
|
|
|
ACTION_SETTINGS_DECBIGSTEP,
|
|
|
|
ACTION_SETTINGS_RESET,
|
2006-08-15 12:27:07 +00:00
|
|
|
|
|
|
|
/* bookmark screen */
|
2006-08-21 07:03:15 +00:00
|
|
|
ACTION_BMS_DELETE,
|
2006-08-15 12:27:07 +00:00
|
|
|
|
2006-08-21 07:03:15 +00:00
|
|
|
/* alarm menu screen */
|
|
|
|
|
2006-08-15 12:27:07 +00:00
|
|
|
/* quickscreen */
|
|
|
|
ACTION_QS_LEFT,
|
|
|
|
ACTION_QS_RIGHT,
|
|
|
|
ACTION_QS_DOWN,
|
|
|
|
ACTION_QS_DOWNINV, /* why is this not called up?? :p */
|
|
|
|
|
2006-08-16 13:25:45 +00:00
|
|
|
/* pitchscreen */
|
|
|
|
/* obviously ignore if you dont have thise screen */
|
|
|
|
ACTION_PS_INC_SMALL,
|
|
|
|
ACTION_PS_INC_BIG,
|
|
|
|
ACTION_PS_DEC_SMALL,
|
|
|
|
ACTION_PS_DEC_BIG,
|
|
|
|
ACTION_PS_NUDGE_LEFT,
|
|
|
|
ACTION_PS_NUDGE_RIGHT,
|
|
|
|
ACTION_PS_NUDGE_LEFTOFF,
|
|
|
|
ACTION_PS_NUDGE_RIGHTOFF,
|
2006-11-06 09:19:40 +00:00
|
|
|
ACTION_PS_TOGGLE_MODE,
|
2006-08-16 13:25:45 +00:00
|
|
|
ACTION_PS_RESET,
|
|
|
|
ACTION_PS_EXIT, /* _STD_* isnt going to work here */
|
2009-06-12 07:20:50 +00:00
|
|
|
ACTION_PS_SLOWER,
|
|
|
|
ACTION_PS_FASTER,
|
2006-08-16 13:25:45 +00:00
|
|
|
|
2006-08-21 07:03:15 +00:00
|
|
|
/* yesno screen */
|
|
|
|
ACTION_YESNO_ACCEPT,
|
|
|
|
|
2006-08-22 13:21:13 +00:00
|
|
|
/* keyboard screen */
|
|
|
|
ACTION_KBD_LEFT,
|
|
|
|
ACTION_KBD_RIGHT,
|
|
|
|
ACTION_KBD_CURSOR_LEFT,
|
|
|
|
ACTION_KBD_CURSOR_RIGHT,
|
|
|
|
ACTION_KBD_SELECT,
|
|
|
|
ACTION_KBD_SELECT_REM,
|
|
|
|
ACTION_KBD_PAGE_FLIP,
|
|
|
|
ACTION_KBD_DONE,
|
|
|
|
ACTION_KBD_ABORT,
|
|
|
|
ACTION_KBD_BACKSPACE,
|
|
|
|
ACTION_KBD_UP,
|
|
|
|
ACTION_KBD_DOWN,
|
|
|
|
ACTION_KBD_MORSE_INPUT,
|
|
|
|
ACTION_KBD_MORSE_SELECT,
|
2009-05-15 05:36:16 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_TOUCHSCREEN
|
|
|
|
/* the following are helper actions for touchscreen targets,
|
|
|
|
* These are for actions which are not doable or required if buttons are
|
|
|
|
* being used, but are nice additions if the touchscreen is used */
|
|
|
|
ACTION_TOUCH_SHUFFLE,
|
|
|
|
ACTION_TOUCH_REPMODE,
|
|
|
|
#endif
|
2006-08-22 13:21:13 +00:00
|
|
|
|
2009-05-23 14:42:54 +00:00
|
|
|
/* USB HID codes */
|
|
|
|
ACTION_USB_HID_PLAY,
|
|
|
|
ACTION_USB_HID_STOP,
|
|
|
|
ACTION_USB_HID_SKIPPREV,
|
|
|
|
ACTION_USB_HID_SKIPNEXT,
|
|
|
|
ACTION_USB_HID_VOLDOWN,
|
|
|
|
ACTION_USB_HID_VOLUP,
|
|
|
|
ACTION_USB_HID_MUTE,
|
|
|
|
ACTION_USB_HID_MENU,
|
2006-11-16 02:53:44 +00:00
|
|
|
|
|
|
|
LAST_ACTION_PLACEHOLDER, /* custom actions should be this + something */
|
2006-08-15 12:27:07 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
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,
|
2006-08-16 00:32:45 +00:00
|
|
|
const struct button_mapping* (*get_context_map)(int));
|
2006-08-15 12:27:07 +00:00
|
|
|
/* 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 if you need to check for ACTION_STD_CANCEL only (i.e user abort! */
|
|
|
|
bool action_userabort(int timeout);
|
|
|
|
|
|
|
|
/* no other code should need this apart from action.c */
|
2006-08-16 00:32:45 +00:00
|
|
|
const struct button_mapping* get_context_mapping(int context);
|
2006-08-17 12:33:36 +00:00
|
|
|
#ifndef HAS_BUTTON_HOLD
|
|
|
|
bool is_keys_locked(void);
|
|
|
|
#endif
|
2007-03-04 07:45:12 +00:00
|
|
|
|
|
|
|
/* returns the status code variable from action.c for the button just pressed
|
|
|
|
If button != NULL it will be set to the actual button code */
|
|
|
|
#define ACTION_REMOTE 0x1 /* remote was pressed */
|
|
|
|
#define ACTION_REPEAT 0x2 /* action was repeated (NOT button) */
|
|
|
|
int get_action_statuscode(int *button);
|
|
|
|
|
2007-07-22 21:02:24 +00:00
|
|
|
/* returns the data value associated with the last action that is not
|
|
|
|
BUTTON_NONE or flagged with SYS_EVENT */
|
|
|
|
intptr_t get_action_data(void);
|
2007-03-04 07:45:12 +00:00
|
|
|
|
2008-08-23 09:46:38 +00:00
|
|
|
#ifdef HAVE_TOUCHSCREEN
|
2007-10-22 12:26:53 +00:00
|
|
|
/* return BUTTON_NONE on error
|
|
|
|
BUTTON_REPEAT if repeated press
|
|
|
|
BUTTON_REL if its a short press
|
2008-08-23 09:46:38 +00:00
|
|
|
BUTTON_TOUCHSCREEN otherwise
|
2007-10-22 12:26:53 +00:00
|
|
|
*/
|
2008-08-23 09:46:38 +00:00
|
|
|
int action_get_touchscreen_press(short *x, short *y);
|
2007-10-22 12:26:53 +00:00
|
|
|
#endif
|
|
|
|
|
2009-07-03 05:08:33 +00:00
|
|
|
/* Don't let get_action*() return any ACTION_* values untill the current buttons
|
|
|
|
* have ben release. SYS_* and BUTTON_NONE will go through.
|
|
|
|
* Any actions relying on _RELEASE won't get seen
|
|
|
|
*/
|
|
|
|
void action_wait_for_release(void);
|
|
|
|
|
2007-07-22 21:02:24 +00:00
|
|
|
#endif /* __ACTION_H__ */
|