mirror of
				https://projects.vdr-developer.org/git/vdr-plugin-tvguide.git
				synced 2023-10-05 13:01:48 +00:00 
			
		
		
		
	color buttons displayed as configured in VDR
This commit is contained in:
		
							
								
								
									
										1
									
								
								HISTORY
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								HISTORY
									
									
									
									
									
								
							| @@ -56,3 +56,4 @@ VDR Plugin 'tvguide' Revision History | |||||||
|   folders are read from VDRs folders list |   folders are read from VDRs folders list | ||||||
| - recording folder also choosable for series timers | - recording folder also choosable for series timers | ||||||
| - blue button also available in detail view | - blue button also available in detail view | ||||||
|  | - color buttons displayed as configured in VDR | ||||||
|   | |||||||
							
								
								
									
										43
									
								
								footer.c
									
									
									
									
									
								
							
							
						
						
									
										43
									
								
								footer.c
									
									
									
									
									
								
							| @@ -7,6 +7,7 @@ cFooter::cFooter(cChannelGroups *channelGroups) { | |||||||
|     buttonWidth = (tvguideConfig.osdWidth - tvguideConfig.timeLineWidth - 5*buttonBorder)/4; |     buttonWidth = (tvguideConfig.osdWidth - tvguideConfig.timeLineWidth - 5*buttonBorder)/4; | ||||||
|     buttonHeight= tvguideConfig.footerHeight - 2*buttonBorder; |     buttonHeight= tvguideConfig.footerHeight - 2*buttonBorder; | ||||||
|     buttonY = (tvguideConfig.footerHeight - buttonHeight)/2; |     buttonY = (tvguideConfig.footerHeight - buttonHeight)/2; | ||||||
|  |     SetButtonPositions(); | ||||||
|      |      | ||||||
|     footer = osdManager.requestPixmap(2, cRect( tvguideConfig.timeLineWidth,  |     footer = osdManager.requestPixmap(2, cRect( tvguideConfig.timeLineWidth,  | ||||||
|                                                 tvguideConfig.osdHeight - tvguideConfig.footerHeight,  |                                                 tvguideConfig.osdHeight - tvguideConfig.footerHeight,  | ||||||
| @@ -20,6 +21,36 @@ cFooter::~cFooter(void) { | |||||||
|     osdManager.releasePixmap(footer); |     osdManager.releasePixmap(footer); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | void cFooter::SetButtonPositions(void) { | ||||||
|  |     for (int i=0; i < 4; i++) { | ||||||
|  |         positionButtons[i] = -1; | ||||||
|  |     } | ||||||
|  |     /* | ||||||
|  |     red button = 0 | ||||||
|  |     green button = 1 | ||||||
|  |     yellow button = 2 | ||||||
|  |     blue button = 3 | ||||||
|  |     */ | ||||||
|  |     for (int button=0; button<4; button++) { | ||||||
|  |         if (Setup.ColorKey0 == button) { | ||||||
|  |             positionButtons[button] = 0; | ||||||
|  |             continue; | ||||||
|  |         } | ||||||
|  |         if (Setup.ColorKey1 == button) { | ||||||
|  |             positionButtons[button] = 1; | ||||||
|  |             continue; | ||||||
|  |         } | ||||||
|  |         if (Setup.ColorKey2 == button) { | ||||||
|  |             positionButtons[button] = 2; | ||||||
|  |             continue; | ||||||
|  |         } | ||||||
|  |         if (Setup.ColorKey3 == button) { | ||||||
|  |             positionButtons[button] = 3; | ||||||
|  |             continue; | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | } | ||||||
|  |  | ||||||
| void cFooter::DrawButton(const char *text, tColor color, tColor borderColor, int num) { | void cFooter::DrawButton(const char *text, tColor color, tColor borderColor, int num) { | ||||||
|     tColor colorTextBack = (tvguideConfig.useBlending==0)?color:clrTransparent; |     tColor colorTextBack = (tvguideConfig.useBlending==0)?color:clrTransparent; | ||||||
|     int left = num * buttonWidth + (num + 1) * buttonBorder; |     int left = num * buttonWidth + (num + 1) * buttonBorder; | ||||||
| @@ -39,27 +70,27 @@ void cFooter::DrawButton(const char *text, tColor color, tColor borderColor, int | |||||||
|  |  | ||||||
| void cFooter::drawRedButton() { | void cFooter::drawRedButton() { | ||||||
|     cString text(tr("Search & Rec")); |     cString text(tr("Search & Rec")); | ||||||
|     DrawButton(*text, theme.Color(clrButtonRed), theme.Color(clrButtonRedBorder), 0); |     DrawButton(*text, theme.Color(clrButtonRed), theme.Color(clrButtonRedBorder), positionButtons[0]); | ||||||
| } | } | ||||||
|  |  | ||||||
| void cFooter::drawGreenButton() { | void cFooter::drawGreenButton() { | ||||||
|     cString text = cString::sprintf("%d %s", tvguideConfig.jumpChannels, tr("Channels back")); |     cString text = cString::sprintf("%d %s", tvguideConfig.jumpChannels, tr("Channels back")); | ||||||
|     DrawButton(*text, theme.Color(clrButtonGreen), theme.Color(clrButtonGreenBorder), 1); |     DrawButton(*text, theme.Color(clrButtonGreen), theme.Color(clrButtonGreenBorder), positionButtons[1]); | ||||||
| } | } | ||||||
|  |  | ||||||
| void cFooter::drawGreenButton(const char *text) { | void cFooter::drawGreenButton(const char *text) { | ||||||
|     std::string cuttedText = CutText(text, buttonWidth-6, tvguideConfig.FontButton); |     std::string cuttedText = CutText(text, buttonWidth-6, tvguideConfig.FontButton); | ||||||
|     DrawButton(cuttedText.c_str(), theme.Color(clrButtonGreen), theme.Color(clrButtonGreenBorder), 1); |     DrawButton(cuttedText.c_str(), theme.Color(clrButtonGreen), theme.Color(clrButtonGreenBorder), positionButtons[1]); | ||||||
| } | } | ||||||
|  |  | ||||||
| void cFooter::drawYellowButton() { | void cFooter::drawYellowButton() { | ||||||
|     cString text = cString::sprintf("%d %s", tvguideConfig.jumpChannels, tr("Channels forward")); |     cString text = cString::sprintf("%d %s", tvguideConfig.jumpChannels, tr("Channels forward")); | ||||||
|     DrawButton(*text, theme.Color(clrButtonYellow), theme.Color(clrButtonYellowBorder), 2); |     DrawButton(*text, theme.Color(clrButtonYellow), theme.Color(clrButtonYellowBorder), positionButtons[2]); | ||||||
| } | } | ||||||
|  |  | ||||||
| void cFooter::drawYellowButton(const char *text) { | void cFooter::drawYellowButton(const char *text) { | ||||||
|     std::string cuttedText = CutText(text, buttonWidth-6, tvguideConfig.FontButton); |     std::string cuttedText = CutText(text, buttonWidth-6, tvguideConfig.FontButton); | ||||||
|     DrawButton(cuttedText.c_str(), theme.Color(clrButtonYellow), theme.Color(clrButtonYellowBorder), 2); |     DrawButton(cuttedText.c_str(), theme.Color(clrButtonYellow), theme.Color(clrButtonYellowBorder), positionButtons[2]); | ||||||
| } | } | ||||||
|  |  | ||||||
| void cFooter::drawBlueButton() { | void cFooter::drawBlueButton() { | ||||||
| @@ -68,7 +99,7 @@ void cFooter::drawBlueButton() { | |||||||
|         text = tr("Switch to Channel"); |         text = tr("Switch to Channel"); | ||||||
|     else if (tvguideConfig.blueKeyMode == 1) |     else if (tvguideConfig.blueKeyMode == 1) | ||||||
|         text = tr("Detailed EPG"); |         text = tr("Detailed EPG"); | ||||||
|     DrawButton(*text, theme.Color(clrButtonBlue), theme.Color(clrButtonBlueBorder), 3); |     DrawButton(*text, theme.Color(clrButtonBlue), theme.Color(clrButtonBlueBorder), positionButtons[3]); | ||||||
| } | } | ||||||
|  |  | ||||||
| void cFooter::UpdateGroupButtons(const cChannel *channel) { | void cFooter::UpdateGroupButtons(const cChannel *channel) { | ||||||
|   | |||||||
							
								
								
									
										2
									
								
								footer.h
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								footer.h
									
									
									
									
									
								
							| @@ -10,8 +10,10 @@ private: | |||||||
|     int buttonHeight; |     int buttonHeight; | ||||||
|     int buttonY; |     int buttonY; | ||||||
|     int buttonBorder; |     int buttonBorder; | ||||||
|  |     int positionButtons[4]; | ||||||
|     cChannelGroups *channelGroups; |     cChannelGroups *channelGroups; | ||||||
|     int currentGroup; |     int currentGroup; | ||||||
|  |     void SetButtonPositions(void); | ||||||
|     void DrawButton(const char *text, tColor color, tColor borderColor, int num); |     void DrawButton(const char *text, tColor color, tColor borderColor, int num); | ||||||
| public: | public: | ||||||
|     cFooter(cChannelGroups *channelGroups); |     cFooter(cChannelGroups *channelGroups); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user