2002-09-29 13:40:45 +02:00
|
|
|
/*
|
|
|
|
* keys.h: Remote control Key handling
|
|
|
|
*
|
|
|
|
* See the main source file 'vdr.c' for copyright information and
|
|
|
|
* how to reach the author.
|
|
|
|
*
|
2015-01-27 21:22:53 +01:00
|
|
|
* $Id: keys.h 3.1 2015/01/27 10:45:18 kls Exp $
|
2002-09-29 13:40:45 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __KEYS_H
|
|
|
|
#define __KEYS_H
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
#include "tools.h"
|
|
|
|
|
|
|
|
enum eKeys { // "Up" and "Down" must be the first two keys!
|
|
|
|
kUp,
|
|
|
|
kDown,
|
|
|
|
kMenu,
|
|
|
|
kOk,
|
|
|
|
kBack,
|
|
|
|
kLeft,
|
|
|
|
kRight,
|
|
|
|
kRed,
|
|
|
|
kGreen,
|
|
|
|
kYellow,
|
|
|
|
kBlue,
|
|
|
|
k0, k1, k2, k3, k4, k5, k6, k7, k8, k9,
|
2006-01-06 12:53:28 +01:00
|
|
|
kInfo,
|
2012-12-04 13:37:59 +01:00
|
|
|
kPlayPause, // combined Play/Pause key
|
2002-10-27 14:32:06 +01:00
|
|
|
kPlay,
|
|
|
|
kPause,
|
|
|
|
kStop,
|
|
|
|
kRecord,
|
|
|
|
kFastFwd,
|
|
|
|
kFastRew,
|
2006-04-15 13:46:55 +02:00
|
|
|
kNext,
|
|
|
|
kPrev,
|
2002-09-29 13:40:45 +02:00
|
|
|
kPower,
|
2002-10-27 14:32:06 +01:00
|
|
|
kChanUp,
|
|
|
|
kChanDn,
|
2006-04-15 13:56:03 +02:00
|
|
|
kChanPrev,
|
2002-09-29 13:40:45 +02:00
|
|
|
kVolUp,
|
|
|
|
kVolDn,
|
|
|
|
kMute,
|
2005-01-02 15:11:44 +01:00
|
|
|
kAudio,
|
2007-10-12 14:52:30 +02:00
|
|
|
kSubtitles,
|
2002-10-27 14:32:06 +01:00
|
|
|
kSchedule,
|
|
|
|
kChannels,
|
|
|
|
kTimers,
|
|
|
|
kRecordings,
|
|
|
|
kSetup,
|
|
|
|
kCommands,
|
2010-04-05 10:14:19 +02:00
|
|
|
kUser0, kUser1, kUser2, kUser3, kUser4, kUser5, kUser6, kUser7, kUser8, kUser9,
|
2002-09-29 13:40:45 +02:00
|
|
|
kNone,
|
2002-12-15 10:58:00 +01:00
|
|
|
kKbd,
|
2002-12-01 10:48:08 +01:00
|
|
|
// The following codes are used internally:
|
|
|
|
k_Plugin,
|
2002-09-29 13:40:45 +02:00
|
|
|
k_Setup,
|
|
|
|
// The following flags are OR'd with the above codes:
|
|
|
|
k_Repeat = 0x8000,
|
|
|
|
k_Release = 0x4000,
|
|
|
|
k_Flags = k_Repeat | k_Release,
|
|
|
|
};
|
|
|
|
|
|
|
|
// This is in preparation for having more key codes:
|
|
|
|
#define kMarkToggle k0
|
2015-01-27 21:22:53 +01:00
|
|
|
#define kMarkSkipBack k1
|
|
|
|
#define kMarkSkipForward k3
|
2002-09-29 13:40:45 +02:00
|
|
|
#define kMarkMoveBack k4
|
|
|
|
#define kMarkMoveForward k6
|
|
|
|
#define kMarkJumpBack k7
|
|
|
|
#define kMarkJumpForward k9
|
|
|
|
#define kEditCut k2
|
|
|
|
#define kEditTest k8
|
|
|
|
|
2002-10-27 14:32:06 +01:00
|
|
|
#define RAWKEY(k) (eKeys((k) & ~k_Flags))
|
|
|
|
#define ISRAWKEY(k) ((k) != kNone && ((k) & k_Flags) == 0)
|
|
|
|
#define NORMALKEY(k) (eKeys((k) & ~k_Repeat))
|
|
|
|
#define ISMODELESSKEY(k) (RAWKEY(k) > k9)
|
2007-02-25 10:56:29 +01:00
|
|
|
#define ISREALKEY(k) (k != kNone && k != k_Plugin)
|
2002-09-29 13:40:45 +02:00
|
|
|
|
2002-12-15 10:58:00 +01:00
|
|
|
#define BASICKEY(k) (eKeys((k) & 0xFFFF))
|
|
|
|
#define KBDKEY(k) (eKeys(((k) << 16) | kKbd))
|
|
|
|
#define KEYKBD(k) (((k) >> 16) & 0xFFFF)
|
|
|
|
|
2002-09-29 13:40:45 +02:00
|
|
|
struct tKey {
|
|
|
|
eKeys type;
|
2007-08-24 13:18:21 +02:00
|
|
|
const char *name;
|
2002-09-29 13:40:45 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
class cKey : public cListObject {
|
|
|
|
private:
|
|
|
|
char *remote;
|
|
|
|
char *code;
|
|
|
|
eKeys key;
|
|
|
|
public:
|
|
|
|
cKey(void);
|
|
|
|
cKey(const char *Remote, const char *Code, eKeys Key);
|
|
|
|
~cKey();
|
|
|
|
const char *Remote(void) { return remote; }
|
|
|
|
const char *Code(void) { return code; }
|
|
|
|
eKeys Key(void) { return key; }
|
|
|
|
bool Parse(char *s);
|
|
|
|
bool Save(FILE *f);
|
|
|
|
static eKeys FromString(const char *Name);
|
2007-08-11 12:39:06 +02:00
|
|
|
static const char *ToString(eKeys Key, bool Translate = false);
|
2002-09-29 13:40:45 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
class cKeys : public cConfig<cKey> {
|
|
|
|
public:
|
|
|
|
bool KnowsRemote(const char *Remote);
|
|
|
|
eKeys Get(const char *Remote, const char *Code);
|
|
|
|
const char *GetSetup(const char *Remote);
|
|
|
|
void PutSetup(const char *Remote, const char *Setup);
|
|
|
|
};
|
|
|
|
|
|
|
|
extern cKeys Keys;
|
|
|
|
|
2002-10-27 15:46:30 +01:00
|
|
|
#define MAXKEYSINMACRO 16
|
|
|
|
|
|
|
|
class cKeyMacro : public cListObject {
|
|
|
|
private:
|
|
|
|
eKeys macro[MAXKEYSINMACRO];
|
2006-10-14 10:41:20 +02:00
|
|
|
int numKeys;
|
2002-12-01 10:48:08 +01:00
|
|
|
char *plugin;
|
2002-10-27 15:46:30 +01:00
|
|
|
public:
|
|
|
|
cKeyMacro(void);
|
2002-12-01 10:48:08 +01:00
|
|
|
~cKeyMacro();
|
2002-10-27 15:46:30 +01:00
|
|
|
bool Parse(char *s);
|
2006-10-14 10:41:20 +02:00
|
|
|
int NumKeys(void) const { return numKeys; }
|
|
|
|
///< Returns the number of keys in this macro. The first key (with
|
|
|
|
///< index 0) is the macro code. The actual macro expansion codes
|
|
|
|
///< start at index 1 and go to NumKeys() - 1.
|
2002-10-27 15:46:30 +01:00
|
|
|
const eKeys *Macro(void) const { return macro; }
|
2002-12-01 10:48:08 +01:00
|
|
|
const char *Plugin(void) const { return plugin; }
|
2002-10-27 15:46:30 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
class cKeyMacros : public cConfig<cKeyMacro> {
|
|
|
|
public:
|
|
|
|
const cKeyMacro *Get(eKeys Key);
|
|
|
|
};
|
|
|
|
|
|
|
|
extern cKeyMacros KeyMacros;
|
|
|
|
|
2002-09-29 13:40:45 +02:00
|
|
|
#endif //__KEYS_H
|