summaryrefslogtreecommitdiff
path: root/keys.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2002-10-27 15:46:30 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2002-10-27 15:46:30 +0100
commit64fd9c4a1b44b125c67455b5b1b45fedcec7e4da (patch)
tree67f2e29f237f8b43452ca90c6c5a3a05a6a68da1 /keys.c
parent74c74fb5d2bdc026a611d74473788e4227d35a93 (diff)
downloadvdr-64fd9c4a1b44b125c67455b5b1b45fedcec7e4da.tar.gz
vdr-64fd9c4a1b44b125c67455b5b1b45fedcec7e4da.tar.bz2
Implemented key macros
Diffstat (limited to 'keys.c')
-rw-r--r--keys.c57
1 files changed, 56 insertions, 1 deletions
diff --git a/keys.c b/keys.c
index d3f323e0..4647f3ae 100644
--- a/keys.c
+++ b/keys.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: keys.c 1.2 2002/10/27 14:00:49 kls Exp $
+ * $Id: keys.c 1.3 2002/10/27 15:19:40 kls Exp $
*/
#include "keys.h"
@@ -49,6 +49,15 @@ static tKey keyTable[] = { // "Up" and "Down" must be the first two keys!
{ kRecordings, "Recordings" },
{ kSetup, "Setup" },
{ kCommands, "Commands" },
+ { kUser1, "User1" },
+ { kUser2, "User2" },
+ { kUser3, "User3" },
+ { kUser4, "User4" },
+ { kUser5, "User5" },
+ { kUser6, "User6" },
+ { kUser7, "User7" },
+ { kUser8, "User8" },
+ { kUser9, "User9" },
{ kNone, "" },
{ k_Setup, "_Setup" },
{ kNone, NULL },
@@ -166,3 +175,49 @@ void cKeys::PutSetup(const char *Remote, const char *Setup)
else
esyslog("ERROR: called PutSetup() for %s, but setup has already been defined!", Remote);
}
+
+// -- cKeyMacro --------------------------------------------------------------
+
+cKeyMacro::cKeyMacro(void)
+{
+ for (int i = 0; i < MAXKEYSINMACRO; i++)
+ macro[i] = kNone;
+}
+
+bool cKeyMacro::Parse(char *s)
+{
+ int n = 0;
+ char *p;
+ while ((p = strtok(s, " \t")) != NULL) {
+ if (n < MAXKEYSINMACRO) {
+ macro[n] = cKey::FromString(p);
+ if (macro[n] == kNone) {
+ esyslog("ERROR: unknown key '%s'", p);
+ return false;
+ }
+ n++;
+ s = NULL;
+ }
+ else {
+ esyslog("ERROR: key macro too long");
+ return false;
+ }
+ }
+ if (n < 2) {
+ esyslog("ERROR: empty key macro");
+ }
+ return true;
+}
+
+// -- cKeyMacros -------------------------------------------------------------
+
+cKeyMacros KeyMacros;
+
+const cKeyMacro *cKeyMacros::Get(eKeys Key)
+{
+ for (cKeyMacro *k = First(); k; k = Next(k)) {
+ if (*k->Macro() == Key)
+ return k;
+ }
+ return NULL;
+}