From patchwork Mon Jul 23 09:21:36 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olliver Schinagl X-Patchwork-Id: 13439 Received: from localhost ([127.0.0.1] helo=www.linuxtv.org) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from ) id 1StEp7-0005ns-OL; Mon, 23 Jul 2012 11:21:05 +0200 Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from ) id 1StEp4-0005na-Rx for vdr@linuxtv.org; Mon, 23 Jul 2012 11:21:04 +0200 X-tubIT-Incoming-IP: 88.159.158.68 Received: from 7of9.schinagl.nl ([88.159.158.68]) by mail.tu-berlin.de (exim-4.75/mailfrontend-3) with esmtp for id 1StEp4-0000LH-Ep; Mon, 23 Jul 2012 11:21:02 +0200 Received: by 7of9.schinagl.nl (Postfix, from userid 1000) id 7B8F524423; Mon, 23 Jul 2012 11:21:52 +0200 (CEST) From: oliver+list@schinagl.nl To: vdr@linuxtv.org Date: Mon, 23 Jul 2012 11:21:36 +0200 Message-Id: <1343035296-23243-1-git-send-email-oliver+list@schinagl.nl> X-Mailer: git-send-email 1.7.8.6 X-PMX-Version: 5.6.1.2065439, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2012.7.23.91231 X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' HTML_00_01 0.05, HTML_00_10 0.05, SUPERLONG_LINE 0.05, BODY_SIZE_10000_PLUS 0, NO_REAL_NAME 0, __ANY_URI 0, __HAS_FROM 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __MIME_TEXT_ONLY 0, __SANE_MSGID 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_PATH 0, __URI_NO_WWW 0, __URI_NS ' X-LSpam-Score: -1.1 (-) X-LSpam-Report: No, score=-1.1 required=5.0 tests=BAYES_00=-1.9, RDNS_NONE=0.793 autolearn=no Cc: Oliver Schinagl Subject: [vdr] [PATCH] Make RGYB buttons customizable (attempt 2) X-BeenThere: vdr@linuxtv.org X-Mailman-Version: 2.1.13 Precedence: list Reply-To: VDR Mailing List List-Id: VDR Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: vdr-bounces@linuxtv.org Errors-To: vdr-bounces@linuxtv.org From: Oliver Schinagl 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 --- 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)