Re: [vdr] [PATCH] Make RGYB buttons customizable (attempt 2)

2012-08-11 Thread Oliver Schinagl

Patch reminder, in case it was missed the first time around :)

On 07/23/12 11:21, oliver+l...@schinagl.nl wrote:

From: Oliver Schinagloli...@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 Schinagloli...@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 

Re: [vdr] [PATCH] Make RGYB buttons customizable (attempt 2)

2012-08-11 Thread VDR User
On Mon, Jul 23, 2012 at 2:21 AM,  oliver+l...@schinagl.nl wrote:
 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.

The ability to customize the order of the colored buttons is something
I was hoping to see in the VDR
reboot/redesign/next-generation/whatever, after 2.0 is released. If
your patch is adopted before that, I don't think an altered button
order should be displayed if the skin doesn't support it since it
could cause confusion for the user -- more specifically the wives and
kids in VDR world. :)

In other words,
does the skin support button reorder?
  if yes, then reorder them in the osd
  if no, do not reorder them in the osd

___
vdr mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr


Re: [vdr] [PATCH] Make RGYB buttons customizable (attempt 2)

2012-08-11 Thread Oliver Schinagl

On 08/11/12 23:48, VDR User wrote:

On Mon, Jul 23, 2012 at 2:21 AM,oliver+l...@schinagl.nl  wrote:

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.


The ability to customize the order of the colored buttons is something
I was hoping to see in the VDR
reboot/redesign/next-generation/whatever, after 2.0 is released. If
your patch is adopted before that,

I would hope so, it is a rather trivial patch



I don't think an altered button
order should be displayed if the skin doesn't support it since it
could cause confusion for the user -- more specifically the wives and
kids in VDR world. :)

Indeed :)



In other words,
does the skin support button reorder?
   if yes, then reorder them in the osd
   if no, do not reorder them in the osd


It should exactly do that. Button order is stored in VDR, but the skin 
decides whether it uses it or not.


I patched the default 3 skins included in VDR to follow the reordering. 
3rd party skins I have not patched and thus are not using the re-ording. 
It is fully optional for skin devs. That said, in the skin it is also 
very trivial to use :)




___
vdr mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr



___
vdr mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr