From: Oliver Schinagl <oliver(a)schinagl.nl>
I've noticed a nasty typo in menu.c where all 4 buttons would be displayed
as Button0. So a cosmetic issue only! Since there where no comments on my
previous e-mails have not been answerd yet, so sending it as a whole patch
again instead of a simple patch upon patch ;)
VDR currently assumes all remote controls have the same order of buttons.
This is not always the case. This patch allows you to change the order
of buttons in the UI.
This feature obviously only works on patched skins. Classic, lcars and
sttng skins are patched. Unpatched skins will remain to work fine, but
will ignore button order. Patching of the skin takes very minimum effort.
config.*: Load/Save Button information
menu.c : Add button selection to the UI
skin*.c : Use button order from the config file
Signed-off-by: Oliver Schinagl <oliver(a)schinagl.nl>
---
config.c | 12 ++++++++++++
config.h | 4 ++++
menu.c | 9 +++++++++
skinclassic.c | 11 +++++++----
skinlcars.c | 19 +++++++++++--------
skinsttng.c | 11 +++++++----
6 files changed, 50 insertions(+), 16 deletions(-)
diff --git a/config.c b/config.c
index 56454df..165bcee 100644
--- a/config.c
+++ b/config.c
@@ -424,6 +424,10 @@ cSetup::cSetup(void)
UseDolbyDigital = 1;
ChannelInfoPos = 0;
ChannelInfoTime = 5;
+ Button0 = 0;
+ Button1 = 1;
+ Button2 = 2;
+ Button3 = 3;
OSDLeftP = 0.03;
OSDTopP = 0.03;
OSDWidthP = 0.93;
@@ -620,6 +624,10 @@ bool cSetup::Parse(const char *Name, const char *Value)
else if (!strcasecmp(Name, "UseDolbyDigital")) UseDolbyDigital = atoi(Value);
else if (!strcasecmp(Name, "ChannelInfoPos")) ChannelInfoPos = atoi(Value);
else if (!strcasecmp(Name, "ChannelInfoTime")) ChannelInfoTime = atoi(Value);
+ else if (!strcasecmp(Name, "Button0")) Button0 = atoi(Value);
+ else if (!strcasecmp(Name, "Button1")) Button1 = atoi(Value);
+ else if (!strcasecmp(Name, "Button2")) Button2 = atoi(Value);
+ else if (!strcasecmp(Name, "Button3")) Button3 = atoi(Value);
else if (!strcasecmp(Name, "OSDLeftP")) OSDLeftP = atof(Value);
else if (!strcasecmp(Name, "OSDTopP")) OSDTopP = atof(Value);
else if (!strcasecmp(Name, "OSDWidthP")) { OSDWidthP = atof(Value); ChkDoublePlausibility(OSDWidthP, 0.87); }
@@ -719,6 +727,10 @@ bool cSetup::Save(void)
Store("UseDolbyDigital", UseDolbyDigital);
Store("ChannelInfoPos", ChannelInfoPos);
Store("ChannelInfoTime", ChannelInfoTime);
+ Store("Button0", Button0);
+ Store("Button1", Button1);
+ Store("Button2", Button2);
+ Store("Button3", Button3);
Store("OSDLeftP", OSDLeftP);
Store("OSDTopP", OSDTopP);
Store("OSDWidthP", OSDWidthP);
diff --git a/config.h b/config.h
index acdf77a..3dd86ae 100644
--- a/config.h
+++ b/config.h
@@ -294,6 +294,10 @@ public:
int UseDolbyDigital;
int ChannelInfoPos;
int ChannelInfoTime;
+ int Button0;
+ int Button1;
+ int Button2;
+ int Button3;
double OSDLeftP, OSDTopP, OSDWidthP, OSDHeightP;
int OSDLeft, OSDTop, OSDWidth, OSDHeight;
double OSDAspect;
diff --git a/menu.c b/menu.c
index 9f4c54e..bea03b1 100644
--- a/menu.c
+++ b/menu.c
@@ -2510,6 +2510,7 @@ void cMenuSetupBase::Store(void)
class cMenuSetupOSD : public cMenuSetupBase {
private:
const char *useSmallFontTexts[3];
+ const char *buttonColorTexts[4];
int osdLanguageIndex;
int numSkins;
int originalSkinIndex;
@@ -2560,12 +2561,20 @@ void cMenuSetupOSD::Set(void)
useSmallFontTexts[0] = tr("never");
useSmallFontTexts[1] = tr("skin dependent");
useSmallFontTexts[2] = tr("always");
+ buttonColorTexts[0] = tr("Key$Red");
+ buttonColorTexts[1] = tr("Key$Green");
+ buttonColorTexts[2] = tr("Key$Yellow");
+ buttonColorTexts[3] = tr("Key$Blue");
Clear();
SetSection(tr("OSD"));
Add(new cMenuEditStraItem(tr("Setup.OSD$Language"), &osdLanguageIndex, I18nNumLanguagesWithLocale(), &I18nLanguages()->At(0)));
Add(new cMenuEditStraItem(tr("Setup.OSD$Skin"), &skinIndex, numSkins, skinDescriptions));
if (themes.NumThemes())
Add(new cMenuEditStraItem(tr("Setup.OSD$Theme"), &themeIndex, themes.NumThemes(), themes.Descriptions()));
+ Add(new cMenuEditStraItem(tr("Setup.OSD$Button0"), &data.Button0, 4, buttonColorTexts));
+ Add(new cMenuEditStraItem(tr("Setup.OSD$Button1"), &data.Button1, 4, buttonColorTexts));
+ Add(new cMenuEditStraItem(tr("Setup.OSD$Button2"), &data.Button2, 4, buttonColorTexts));
+ Add(new cMenuEditStraItem(tr("Setup.OSD$Button3"), &data.Button3, 4, buttonColorTexts));
Add(new cMenuEditPrcItem( tr("Setup.OSD$Left (%)"), &data.OSDLeftP, 0.0, 0.5));
Add(new cMenuEditPrcItem( tr("Setup.OSD$Top (%)"), &data.OSDTopP, 0.0, 0.5));
Add(new cMenuEditPrcItem( tr("Setup.OSD$Width (%)"), &data.OSDWidthP, 0.5, 1.0));
diff --git a/skinclassic.c b/skinclassic.c
index 64944de..2693036 100644
--- a/skinclassic.c
+++ b/skinclassic.c
@@ -291,16 +291,19 @@ void cSkinClassicDisplayMenu::SetTitle(const char *Title)
void cSkinClassicDisplayMenu::SetButtons(const char *Red, const char *Green, const char *Yellow, const char *Blue)
{
const cFont *font = cFont::GetFont(fontOsd);
+ const char *lutKeys[] = {Red, Green, Yellow, Blue};
+ tColor lutFg[4] = {clrButtonRedFg, clrButtonGreenFg, clrButtonYellowFg, clrButtonBlueFg};
+ tColor lutBg[4] = {clrButtonRedBg, clrButtonGreenBg, clrButtonYellowBg, clrButtonBlueBg};
int w = x3 - x0;
int t0 = x0;
int t1 = x0 + w / 4;
int t2 = x0 + w / 2;
int t3 = x3 - w / 4;
int t4 = x3;
- osd->DrawText(t0, y4, Red, Theme.Color(clrButtonRedFg), Red ? Theme.Color(clrButtonRedBg) : Theme.Color(clrBackground), font, t1 - t0, 0, taCenter);
- osd->DrawText(t1, y4, Green, Theme.Color(clrButtonGreenFg), Green ? Theme.Color(clrButtonGreenBg) : Theme.Color(clrBackground), font, t2 - t1, 0, taCenter);
- osd->DrawText(t2, y4, Yellow, Theme.Color(clrButtonYellowFg), Yellow ? Theme.Color(clrButtonYellowBg) : Theme.Color(clrBackground), font, t3 - t2, 0, taCenter);
- osd->DrawText(t3, y4, Blue, Theme.Color(clrButtonBlueFg), Blue ? Theme.Color(clrButtonBlueBg) : Theme.Color(clrBackground), font, t4 - t3, 0, taCenter);
+ osd->DrawText(t0, y4, lutKeys[Setup.Button0], Theme.Color(lutFg[Setup.Button0]), lutKeys[Setup.Button0] ? Theme.Color(lutBg[Setup.Button0]) : Theme.Color(lutBg[Setup.Button0]), font, t1 - t0, 0, taCenter);
+ osd->DrawText(t1, y4, lutKeys[Setup.Button1], Theme.Color(lutFg[Setup.Button1]), lutKeys[Setup.Button1] ? Theme.Color(lutBg[Setup.Button1]) : Theme.Color(lutBg[Setup.Button1]), font, t2 - t1, 0, taCenter);
+ osd->DrawText(t2, y4, lutKeys[Setup.Button2], Theme.Color(lutFg[Setup.Button2]), lutKeys[Setup.Button2] ? Theme.Color(lutBg[Setup.Button2]) : Theme.Color(lutBg[Setup.Button2]), font, t3 - t2, 0, taCenter);
+ osd->DrawText(t3, y4, lutKeys[Setup.Button3], Theme.Color(lutFg[Setup.Button3]), lutKeys[Setup.Button3] ? Theme.Color(lutBg[Setup.Button3]) : Theme.Color(lutBg[Setup.Button3]), font, t4 - t3, 0, taCenter);
}
void cSkinClassicDisplayMenu::SetMessage(eMessageType Type, const char *Text)
diff --git a/skinlcars.c b/skinlcars.c
index 5937efe..f58b90b 100644
--- a/skinlcars.c
+++ b/skinlcars.c
@@ -1458,19 +1458,22 @@ void cSkinLCARSDisplayMenu::SetTitle(const char *Title)
void cSkinLCARSDisplayMenu::SetButtons(const char *Red, const char *Green, const char *Yellow, const char *Blue)
{
+ const char *lutKeys[] = {Red, Green, Yellow, Blue};
+ tColor lutFg[4] = {clrButtonRedFg, clrButtonGreenFg, clrButtonYellowFg, clrButtonBlueFg};
+ tColor lutBg[4] = {clrButtonRedBg, clrButtonGreenBg, clrButtonYellowBg, clrButtonBlueBg};
const cFont *font = cFont::GetFont(fontSml);
if (MenuCategory() == mcMain) {
- DrawMainButton(Red, xd00, xd01, xd02, xd03, yd02, yd03, Theme.Color(clrButtonRedFg), Theme.Color(clrButtonRedBg), font);
- DrawMainButton(Green, xd04, xd05, xd06, xd07, yd02, yd03, Theme.Color(clrButtonGreenFg), Theme.Color(clrButtonGreenBg), font);
- DrawMainButton(Yellow, xd00, xd01, xd02, xd03, yd04, yd05, Theme.Color(clrButtonYellowFg), Theme.Color(clrButtonYellowBg), font);
- DrawMainButton(Blue, xd04, xd05, xd06, xd07, yd04, yd05, Theme.Color(clrButtonBlueFg), Theme.Color(clrButtonBlueBg), font);
+ DrawMainButton(lutKeys[Setup.Button0], xd00, xd01, xd02, xd03, yd02, yd03, Theme.Color(lutFg[Setup.Button0]), Theme.Color(lutBg[Setup.Button0]), font);
+ DrawMainButton(lutKeys[Setup.Button1], xd04, xd05, xd06, xd07, yd02, yd03, Theme.Color(lutFg[Setup.Button1]), Theme.Color(lutBg[Setup.Button1]), font);
+ DrawMainButton(lutKeys[Setup.Button2], xd00, xd01, xd02, xd03, yd04, yd05, Theme.Color(lutFg[Setup.Button2]), Theme.Color(lutBg[Setup.Button2]), font);
+ DrawMainButton(lutKeys[Setup.Button3], xd04, xd05, xd06, xd07, yd04, yd05, Theme.Color(lutFg[Setup.Button3]), Theme.Color(lutBg[Setup.Button3]), font);
}
else {
int h = yb15 - yb14;
- osd->DrawText(xb02, yb14, Red, Theme.Color(clrButtonRedFg), Theme.Color(clrButtonRedBg), font, xb03 - xb02, h, taLeft | taBorder);
- osd->DrawText(xb06, yb14, Green, Theme.Color(clrButtonGreenFg), Theme.Color(clrButtonGreenBg), font, xb07 - xb06, h, taLeft | taBorder);
- osd->DrawText(xb10, yb14, Yellow, Theme.Color(clrButtonYellowFg), Theme.Color(clrButtonYellowBg), font, xb11 - xb10, h, taLeft | taBorder);
- osd->DrawText(xb14, yb14, Blue, Theme.Color(clrButtonBlueFg), Theme.Color(clrButtonBlueBg), font, xb15 - xb14, h, taLeft | taBorder);
+ osd->DrawText(xb02, yb14, lutKeys[Setup.Button0], Theme.Color(lutFg[Setup.Button0]), Theme.Color(lutBg[Setup.Button0]), font, xb03 - xb02, h, taLeft | taBorder);
+ osd->DrawText(xb06, yb14, lutKeys[Setup.Button1], Theme.Color(lutFg[Setup.Button1]), Theme.Color(lutBg[Setup.Button1]), font, xb07 - xb06, h, taLeft | taBorder);
+ osd->DrawText(xb10, yb14, lutKeys[Setup.Button2], Theme.Color(lutFg[Setup.Button2]), Theme.Color(lutBg[Setup.Button2]), font, xb11 - xb10, h, taLeft | taBorder);
+ osd->DrawText(xb14, yb14, lutKeys[Setup.Button3], Theme.Color(lutFg[Setup.Button3]), Theme.Color(lutBg[Setup.Button3]), font, xb15 - xb14, h, taLeft | taBorder);
}
}
diff --git a/skinsttng.c b/skinsttng.c
index d985538..49c94d4 100644
--- a/skinsttng.c
+++ b/skinsttng.c
@@ -571,6 +571,9 @@ void cSkinSTTNGDisplayMenu::SetTitle(const char *Title)
void cSkinSTTNGDisplayMenu::SetButtons(const char *Red, const char *Green, const char *Yellow, const char *Blue)
{
+ const char *lutKeys[] = {Red, Green, Yellow, Blue};
+ tColor lutFg[4] = {clrButtonRedFg, clrButtonGreenFg, clrButtonYellowFg, clrButtonBlueFg};
+ tColor lutBg[4] = {clrButtonRedBg, clrButtonGreenBg, clrButtonYellowBg, clrButtonBlueBg};
cString date = DayDateTime();
const cFont *font = cFont::GetFont(fontSml);
int d = 2 * Gap;
@@ -585,10 +588,10 @@ void cSkinSTTNGDisplayMenu::SetButtons(const char *Red, const char *Green, const
osd->DrawRectangle(t1 + d2, y6, t2 - d2, y7 - 1, clrBlack);
osd->DrawRectangle(t2 + d2, y6, t3 - d2, y7 - 1, clrBlack);
osd->DrawRectangle(t3 + d2, y6, t4 - d2, y7 - 1, clrBlack);
- osd->DrawText(t0 + d, y6, Red, Theme.Color(clrButtonRedFg), Theme.Color(clrButtonRedBg), font, t1 - t0 - 2 * d, 0, taCenter);
- osd->DrawText(t1 + d, y6, Green, Theme.Color(clrButtonGreenFg), Theme.Color(clrButtonGreenBg), font, t2 - t1 - 2 * d, 0, taCenter);
- osd->DrawText(t2 + d, y6, Yellow, Theme.Color(clrButtonYellowFg), Theme.Color(clrButtonYellowBg), font, t3 - t2 - 2 * d, 0, taCenter);
- osd->DrawText(t3 + d, y6, Blue, Theme.Color(clrButtonBlueFg), Theme.Color(clrButtonBlueBg), font, t4 - t3 - 2 * d, 0, taCenter);
+ osd->DrawText(t0 + d, y6, lutKeys[Setup.Button0], Theme.Color(lutFg[Setup.Button0]), Theme.Color(lutBg[Setup.Button0]), font, t1 - t0 - 2 * d, 0, taCenter);
+ osd->DrawText(t1 + d, y6, lutKeys[Setup.Button1], Theme.Color(lutFg[Setup.Button1]), Theme.Color(lutBg[Setup.Button1]), font, t2 - t1 - 2 * d, 0, taCenter);
+ osd->DrawText(t2 + d, y6, lutKeys[Setup.Button2], Theme.Color(lutFg[Setup.Button2]), Theme.Color(lutBg[Setup.Button2]), font, t3 - t2 - 2 * d, 0, taCenter);
+ osd->DrawText(t3 + d, y6, lutKeys[Setup.Button3], Theme.Color(lutFg[Setup.Button3]), Theme.Color(lutBg[Setup.Button3]), font, t4 - t3 - 2 * d, 0, taCenter);
}
void cSkinSTTNGDisplayMenu::SetMessage(eMessageType Type, const char *Text)
--
1.7.8.6