diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2013-08-21 11:02:52 +0200 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2013-08-21 11:02:52 +0200 |
commit | cd10b439d0465afa6bce38188a4e9d8a5e74d859 (patch) | |
tree | 54480623232fb0e8e94fd37a5c9e31603301dd35 /menuitems.c | |
parent | 5b76eec1afbe435b5d1dfabaaa9546f8e400cba7 (diff) | |
download | vdr-cd10b439d0465afa6bce38188a4e9d8a5e74d859.tar.gz vdr-cd10b439d0465afa6bce38188a4e9d8a5e74d859.tar.bz2 |
Added basic support for positioners to control steerable satellite dishes
Diffstat (limited to 'menuitems.c')
-rw-r--r-- | menuitems.c | 52 |
1 files changed, 48 insertions, 4 deletions
diff --git a/menuitems.c b/menuitems.c index f7ec7761..4eea6bab 100644 --- a/menuitems.c +++ b/menuitems.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: menuitems.c 2.16 2013/02/15 14:20:29 kls Exp $ + * $Id: menuitems.c 3.1 2013/05/24 10:26:01 kls Exp $ */ #include "menuitems.h" @@ -51,14 +51,14 @@ void cMenuEditItem::SetHelp(const char *Red, const char *Green, const char *Yell helpDisplayed = false; } -bool cMenuEditItem::DisplayHelp(void) +bool cMenuEditItem::DisplayHelp(bool Current) { bool HasHelp = helpRed || helpGreen || helpYellow || helpBlue; - if (HasHelp && !helpDisplayed) { + if (HasHelp && !helpDisplayed && Current) { cSkinDisplay::Current()->SetButtons(helpRed, helpGreen, helpYellow, helpBlue); cStatus::MsgOsdHelpKeys(helpRed, helpGreen, helpYellow, helpBlue); - helpDisplayed = true; } + helpDisplayed = Current; return HasHelp; } @@ -223,6 +223,50 @@ eOSState cMenuEditNumItem::ProcessKey(eKeys Key) return state; } +// --- cMenuEditIntxItem ----------------------------------------------------- + +cMenuEditIntxItem::cMenuEditIntxItem(const char *Name, int *Value, int Min, int Max, int Factor, const char *NegString, const char *PosString) +:cMenuEditIntItem(Name, Value, Min, Max) +{ + factor = ::max(Factor, 1); + negString = NegString; + posString = PosString; + Set(); +} + +void cMenuEditIntxItem::SetHelpKeys(void) +{ + if (negString && posString) + SetHelp(NULL, (*value < 0) ? posString : negString); +} + +void cMenuEditIntxItem::Set(void) +{ + const char *s = (*value < 0) ? negString : posString; + int v = *value; + if (negString && posString) + v = abs(v); + SetValue(cString::sprintf(s ? "%.*f %s" : "%.*f", factor / 10, double(v) / factor, s)); + SetHelpKeys(); +} + +eOSState cMenuEditIntxItem::ProcessKey(eKeys Key) +{ + eOSState state = cMenuEditIntItem::ProcessKey(Key); + if (state == osUnknown) { + switch (Key) { + case kGreen: if (negString && posString) { + *value = -*value; + Set(); + state = osContinue; + } + break; + default: ; + } + } + return state; +} + // --- cMenuEditPrcItem ------------------------------------------------------ cMenuEditPrcItem::cMenuEditPrcItem(const char *Name, double *Value, double Min, double Max, int Decimals) |