diff options
author | Klaus Schmidinger <kls (at) cadsoft (dot) de> | 2009-05-03 17:15:00 +0200 |
---|---|---|
committer | Klaus Schmidinger <kls (at) cadsoft (dot) de> | 2009-05-03 17:15:00 +0200 |
commit | 991eda006700f1703bcec528c1ff178a4cab9048 (patch) | |
tree | 11f216938606e63027bc717e3d36668df646f474 /menuitems.c | |
parent | 733a2becc44a02daf10b97d24b8a9c8b00de3964 (diff) | |
download | vdr-patch-lnbsharing-991eda006700f1703bcec528c1ff178a4cab9048.tar.gz vdr-patch-lnbsharing-991eda006700f1703bcec528c1ff178a4cab9048.tar.bz2 |
Version 1.7.7vdr-1.7.7
- The new function cDevice::GetVideoSize() returns the size and aspect ratio
of the video material currently displayed. This function is used to determine
the proper size of the OSD. Plugin authors should implement this function in
classes derived from cDevice, if they are able to replay video.
- The OSD and font sizes are now defined in percent of the actual video display
size. The maximum OSD size has been raised to 1920x1080, to allow full
screen OSD on HD systems.
- The OSD size is now automatically adjusted to the actual video display
(provided the output device implements the GetVideoSize() function).
- cFrameDetector::Analyze() now syncs on the TS packet sync bytes (thanks to
Oliver Endriss for reporting broken index generation after a buffer overflow).
Diffstat (limited to 'menuitems.c')
-rw-r--r-- | menuitems.c | 68 |
1 files changed, 67 insertions, 1 deletions
diff --git a/menuitems.c b/menuitems.c index 6702384..df14b10 100644 --- a/menuitems.c +++ b/menuitems.c @@ -4,11 +4,12 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: menuitems.c 2.3 2009/04/05 10:15:12 kls Exp $ + * $Id: menuitems.c 2.4 2009/05/03 13:37:55 kls Exp $ */ #include "menuitems.h" #include <ctype.h> +#include <math.h> #include <wctype.h> #include "i18n.h" #include "plugin.h" @@ -200,6 +201,71 @@ eOSState cMenuEditNumItem::ProcessKey(eKeys Key) return state; } +// --- cMenuEditPrcItem ------------------------------------------------------ + +cMenuEditPrcItem::cMenuEditPrcItem(const char *Name, double *Value, double Min, double Max, int Decimals) +:cMenuEditItem(Name) +{ + value = Value; + min = Min; + max = Max; + decimals = Decimals; + factor = 100; + while (Decimals-- > 0) + factor *= 10; + if (*value < min) + *value = min; + else if (*value > max) + *value = max; + Set(); +} + +void cMenuEditPrcItem::Set(void) +{ + char buf[16]; + snprintf(buf, sizeof(buf), "%.*f", decimals, *value * 100); + SetValue(buf); +} + +eOSState cMenuEditPrcItem::ProcessKey(eKeys Key) +{ + eOSState state = cMenuEditItem::ProcessKey(Key); + + if (state == osUnknown) { + double newValue = round(*value * factor); // avoids precision problems + Key = NORMALKEY(Key); + switch (Key) { + case kNone: break; + case k0 ... k9: + if (fresh) { + newValue = 0; + fresh = false; + } + newValue = newValue * 10 + (Key - k0); + break; + case kLeft: // TODO might want to increase the delta if repeated quickly? + newValue--; + fresh = true; + break; + case kRight: + newValue++; + fresh = true; + break; + default: + if (*value < min) { *value = min; Set(); } + if (*value > max) { *value = max; Set(); } + return state; + } + newValue /= factor; + if (newValue != *value && (!fresh || min <= newValue) && newValue <= max) { + *value = newValue; + Set(); + } + state = osContinue; + } + return state; +} + // --- cMenuEditChrItem ------------------------------------------------------ cMenuEditChrItem::cMenuEditChrItem(const char *Name, char *Value, const char *Allowed) |