1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Fixed handling OSD color button texts in case a menu item has texts of its own

This commit is contained in:
Klaus Schmidinger 2012-03-02 15:49:57 +01:00
parent e7b0f909ff
commit c5eb60f07a
6 changed files with 61 additions and 10 deletions

View File

@ -1135,6 +1135,8 @@ Rolf Ahrenberg <rahrenbe@cc.hut.fi>
"word by word" "word by word"
for reporting a problem with color palettes in subtitles for reporting a problem with color palettes in subtitles
for adding some typecasts to silence gcc compiler warnings for adding some typecasts to silence gcc compiler warnings
for reporting a bug in handling OSD color button texts in case a menu item has
texts of its own
Ralf Klueber <ralf.klueber@vodafone.com> Ralf Klueber <ralf.klueber@vodafone.com>
for reporting a bug in cutting a recording if there is only a single editing mark for reporting a bug in cutting a recording if there is only a single editing mark

View File

@ -6947,3 +6947,8 @@ Video Disk Recorder Revision History
- Added a Query parameter to cDevice::GetDevice(), so that devices can be queried - Added a Query parameter to cDevice::GetDevice(), so that devices can be queried
without side effects when zapping. without side effects when zapping.
- Replaced min(max()) calls with the new function constrain(). - Replaced min(max()) calls with the new function constrain().
- Fixed handling OSD color button texts in case a menu item has texts of its own
(reported by Rolf Ahrenberg). If a plugin creates derived cMenuEditItems that set
color button texts, these should not set the texts directly by calling
cSkinDisplay::Current()->SetButtons(), but rather call the new member function
cMenuEditItem::SetHelp().

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: menuitems.c 2.10 2011/08/12 13:19:40 kls Exp $ * $Id: menuitems.c 2.11 2012/03/02 15:49:57 kls Exp $
*/ */
#include "menuitems.h" #include "menuitems.h"
@ -26,6 +26,7 @@ const char *FileNameChars = trNOOP("FileNameChars$ abcdefghijklmnopqrstuvwxyz012
cMenuEditItem::cMenuEditItem(const char *Name) cMenuEditItem::cMenuEditItem(const char *Name)
{ {
name = strdup(Name ? Name : "???"); name = strdup(Name ? Name : "???");
SetHelp(NULL);
} }
cMenuEditItem::~cMenuEditItem() cMenuEditItem::~cMenuEditItem()
@ -40,6 +41,27 @@ void cMenuEditItem::SetValue(const char *Value)
cStatus::MsgOsdCurrentItem(buffer); cStatus::MsgOsdCurrentItem(buffer);
} }
void cMenuEditItem::SetHelp(const char *Red, const char *Green, const char *Yellow, const char *Blue)
{
// strings are NOT copied - must be constants!!!
helpRed = Red;
helpGreen = Green;
helpYellow = Yellow;
helpBlue = Blue;
helpDisplayed = false;
}
bool cMenuEditItem::DisplayHelp(void)
{
bool HasHelp = helpRed || helpGreen || helpYellow || helpBlue;
if (HasHelp && !helpDisplayed) {
cSkinDisplay::Current()->SetButtons(helpRed, helpGreen, helpYellow, helpBlue);
cStatus::MsgOsdHelpKeys(helpRed, helpGreen, helpYellow, helpBlue);
helpDisplayed = true;
}
return HasHelp;
}
// --- cMenuEditIntItem ------------------------------------------------------ // --- cMenuEditIntItem ------------------------------------------------------
cMenuEditIntItem::cMenuEditIntItem(const char *Name, int *Value, int Min, int Max, const char *MinString, const char *MaxString) cMenuEditIntItem::cMenuEditIntItem(const char *Name, int *Value, int Min, int Max, const char *MinString, const char *MaxString)
@ -382,9 +404,9 @@ void cMenuEditStrItem::LeaveEditMode(bool SaveValue)
void cMenuEditStrItem::SetHelpKeys(void) void cMenuEditStrItem::SetHelpKeys(void)
{ {
if (InEditMode()) if (InEditMode())
cSkinDisplay::Current()->SetButtons(tr("Button$ABC/abc"), insert ? tr("Button$Overwrite") : tr("Button$Insert"), tr("Button$Delete")); SetHelp(tr("Button$ABC/abc"), insert ? tr("Button$Overwrite") : tr("Button$Insert"), tr("Button$Delete"));
else else
cSkinDisplay::Current()->SetButtons(NULL); SetHelp(NULL);
} }
uint *cMenuEditStrItem::IsAllowed(uint c) uint *cMenuEditStrItem::IsAllowed(uint c)

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: menuitems.h 2.5 2011/06/13 13:46:03 kls Exp $ * $Id: menuitems.h 2.6 2012/03/02 15:49:57 kls Exp $
*/ */
#ifndef __MENUITEMS_H #ifndef __MENUITEMS_H
@ -19,10 +19,15 @@ extern const char *FileNameChars;
class cMenuEditItem : public cOsdItem { class cMenuEditItem : public cOsdItem {
private: private:
char *name; char *name;
const char *helpRed, *helpGreen, *helpYellow, *helpBlue;
bool helpDisplayed;
protected:
void SetHelp(const char *Red, const char *Green = NULL, const char *Yellow = NULL, const char *Blue = NULL);
public: public:
cMenuEditItem(const char *Name); cMenuEditItem(const char *Name);
~cMenuEditItem(); ~cMenuEditItem();
void SetValue(const char *Value); void SetValue(const char *Value);
bool DisplayHelp(void);
}; };
class cMenuEditIntItem : public cMenuEditItem { class cMenuEditIntItem : public cMenuEditItem {

View File

@ -4,13 +4,14 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: osdbase.c 2.3 2010/12/12 13:41:28 kls Exp $ * $Id: osdbase.c 2.4 2012/03/02 15:49:57 kls Exp $
*/ */
#include "osdbase.h" #include "osdbase.h"
#include <string.h> #include <string.h>
#include "device.h" #include "device.h"
#include "i18n.h" #include "i18n.h"
#include "menuitems.h"
#include "remote.h" #include "remote.h"
#include "status.h" #include "status.h"
@ -85,6 +86,7 @@ cOsdMenu::cOsdMenu(const char *Title, int c0, int c1, int c2, int c3, int c4)
current = marked = -1; current = marked = -1;
subMenu = NULL; subMenu = NULL;
helpRed = helpGreen = helpYellow = helpBlue = NULL; helpRed = helpGreen = helpYellow = helpBlue = NULL;
helpDisplayed = false;
status = NULL; status = NULL;
if (!displayMenuCount++) if (!displayMenuCount++)
SetDisplayMenu(); SetDisplayMenu();
@ -154,6 +156,15 @@ void cOsdMenu::SetTitle(const char *Title)
title = strdup(Title); title = strdup(Title);
} }
void cOsdMenu::DisplayHelp(bool Force)
{
if (!helpDisplayed || Force) {
displayMenu->SetButtons(helpRed, helpGreen, helpYellow, helpBlue);
cStatus::MsgOsdHelpKeys(helpRed, helpGreen, helpYellow, helpBlue);
helpDisplayed = true;
}
}
void cOsdMenu::SetHelp(const char *Red, const char *Green, const char *Yellow, const char *Blue) void cOsdMenu::SetHelp(const char *Red, const char *Green, const char *Yellow, const char *Blue)
{ {
// strings are NOT copied - must be constants!!! // strings are NOT copied - must be constants!!!
@ -161,8 +172,7 @@ void cOsdMenu::SetHelp(const char *Red, const char *Green, const char *Yellow, c
helpGreen = Green; helpGreen = Green;
helpYellow = Yellow; helpYellow = Yellow;
helpBlue = Blue; helpBlue = Blue;
displayMenu->SetButtons(helpRed, helpGreen, helpYellow, helpBlue); DisplayHelp(true);
cStatus::MsgOsdHelpKeys(helpRed, helpGreen, helpYellow, helpBlue);
} }
void cOsdMenu::Del(int Index) void cOsdMenu::Del(int Index)
@ -205,8 +215,7 @@ void cOsdMenu::Display(void)
displayMenu->SetTabs(cols[0], cols[1], cols[2], cols[3], cols[4]);//XXX displayMenu->SetTabs(cols[0], cols[1], cols[2], cols[3], cols[4]);//XXX
displayMenu->SetTitle(title); displayMenu->SetTitle(title);
cStatus::MsgOsdTitle(title); cStatus::MsgOsdTitle(title);
displayMenu->SetButtons(helpRed, helpGreen, helpYellow, helpBlue); DisplayHelp(true);
cStatus::MsgOsdHelpKeys(helpRed, helpGreen, helpYellow, helpBlue);
int count = Count(); int count = Count();
if (count > 0) { if (count > 0) {
int ni = 0; int ni = 0;
@ -263,6 +272,12 @@ void cOsdMenu::DisplayCurrent(bool Current)
cStatus::MsgOsdCurrentItem(item->Text()); cStatus::MsgOsdCurrentItem(item->Text());
if (!Current) if (!Current)
item->SetFresh(true); // leaving the current item resets 'fresh' item->SetFresh(true); // leaving the current item resets 'fresh'
if (cMenuEditItem *MenuEditItem = dynamic_cast<cMenuEditItem *>(item)) {
if (!MenuEditItem->DisplayHelp())
DisplayHelp();
else
helpDisplayed = false;
}
} }
} }

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: osdbase.h 2.1 2010/01/16 14:25:31 kls Exp $ * $Id: osdbase.h 2.2 2012/03/02 15:49:57 kls Exp $
*/ */
#ifndef __OSDBASE_H #ifndef __OSDBASE_H
@ -92,9 +92,11 @@ private:
int first, current, marked; int first, current, marked;
cOsdMenu *subMenu; cOsdMenu *subMenu;
const char *helpRed, *helpGreen, *helpYellow, *helpBlue; const char *helpRed, *helpGreen, *helpYellow, *helpBlue;
bool helpDisplayed;
char *status; char *status;
int digit; int digit;
bool hasHotkeys; bool hasHotkeys;
void DisplayHelp(bool Force = false);
protected: protected:
void SetDisplayMenu(void); void SetDisplayMenu(void);
cSkinDisplayMenu *DisplayMenu(void) { return displayMenu; } cSkinDisplayMenu *DisplayMenu(void) { return displayMenu; }