diff options
author | louis <louis.braun@gmx.de> | 2013-01-05 16:11:26 +0100 |
---|---|---|
committer | louis <louis.braun@gmx.de> | 2013-01-05 16:11:26 +0100 |
commit | b8081750ed16931b51cb2b293bef1c58413c93d3 (patch) | |
tree | ef8f9d470cc881a91fe70f2c93c81ced4ff0e731 | |
parent | 97aeb93680de0ae99d8be0c3b1f51c043ecd0836 (diff) | |
download | skin-nopacity-b8081750ed16931b51cb2b293bef1c58413c93d3.tar.gz skin-nopacity-b8081750ed16931b51cb2b293bef1c58413c93d3.tar.bz2 |
Fixed again displaying configurable color buttons
-rw-r--r-- | displaymenu.c | 49 | ||||
-rw-r--r-- | displaymenu.h | 2 | ||||
-rw-r--r-- | displaymenuview.c | 4 |
3 files changed, 46 insertions, 9 deletions
diff --git a/displaymenu.c b/displaymenu.c index cc48864..a7c4940 100644 --- a/displaymenu.c +++ b/displaymenu.c @@ -17,6 +17,7 @@ cNopacityDisplayMenu::cNopacityDisplayMenu(void) { detailView = NULL; contentNarrow = true; contentNarrowLast = true; + SetButtonPositions(); menuView = new cNopacityDisplayMenuView(); osd = menuView->createOsd(); menuView->SetGeometry(); @@ -188,7 +189,6 @@ void cNopacityDisplayMenu::SetMenuCategory(eMenuCategory MenuCategory) { timersDrawn = false; } } - esyslog("nopacity: menuCat %d", MenuCategory); } void cNopacityDisplayMenu::SetTitle(const char *Title) { @@ -214,26 +214,57 @@ void cNopacityDisplayMenu::SetTitle(const char *Title) { } } +void cNopacityDisplayMenu::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 cNopacityDisplayMenu::SetButtons(const char *Red, const char *Green, const char *Yellow, const char *Blue) { if (Red) { - menuView->DrawButton(Red, handleButtons[0], Theme.Color(clrButtonRedBorder), Setup.ColorKey0); + menuView->DrawButton(Red, handleButtons[0], Theme.Color(clrButtonRedBorder), positionButtons[0]); } else - menuView->ClearButton(Setup.ColorKey0); + menuView->ClearButton(positionButtons[0]); if (Green) { - menuView->DrawButton(Green, handleButtons[1], Theme.Color(clrButtonGreenBorder), Setup.ColorKey1); + menuView->DrawButton(Green, handleButtons[1], Theme.Color(clrButtonGreenBorder), positionButtons[1]); } else - menuView->ClearButton(Setup.ColorKey1); + menuView->ClearButton(positionButtons[1]); if (Yellow) { - menuView->DrawButton(Yellow, handleButtons[2], Theme.Color(clrButtonYellowBorder), Setup.ColorKey2); + menuView->DrawButton(Yellow, handleButtons[2], Theme.Color(clrButtonYellowBorder), positionButtons[2]); } else - menuView->ClearButton(Setup.ColorKey2); + menuView->ClearButton(positionButtons[2]); if (Blue) { - menuView->DrawButton(Blue, handleButtons[3], Theme.Color(clrButtonBlueBorder), Setup.ColorKey3); + menuView->DrawButton(Blue, handleButtons[3], Theme.Color(clrButtonBlueBorder), positionButtons[3]); } else - menuView->ClearButton(Setup.ColorKey3); + menuView->ClearButton(positionButtons[3]); } void cNopacityDisplayMenu::SetMessage(eMessageType Type, const char *Text) { diff --git a/displaymenu.h b/displaymenu.h index 58abd27..716d60a 100644 --- a/displaymenu.h +++ b/displaymenu.h @@ -22,9 +22,11 @@ private: cList<cNopacityMenuItem> menuItems; int handleBackgrounds[8]; int handleButtons[4]; + int positionButtons[4]; void DrawDisk(void); void DrawTimers(void); void SplitItem(const char *Text, cString *strItems, int *tabItems); + void SetButtonPositions(void); virtual void Action(void); protected: int Tab(int n); diff --git a/displaymenuview.c b/displaymenuview.c index af5992e..f71f0c0 100644 --- a/displaymenuview.c +++ b/displaymenuview.c @@ -483,6 +483,8 @@ void cNopacityDisplayMenuView::ShowDiskUsage(bool show) { } void cNopacityDisplayMenuView::DrawButton(const char *text, int handleImage, tColor borderColor, int num) { + if (num < 0) + return; int top = 2*buttonsBorder; int left = num * buttonWidth + (2*num + 1) * buttonsBorder; pixmapFooter->DrawRectangle(cRect(left, top, buttonWidth, buttonHeight), borderColor); @@ -493,6 +495,8 @@ void cNopacityDisplayMenuView::DrawButton(const char *text, int handleImage, tCo } void cNopacityDisplayMenuView::ClearButton(int num) { + if (num < 0) + return; int top = 2*buttonsBorder; int left = num * buttonWidth + (2*num + 1) * buttonsBorder; pixmapFooter->DrawRectangle(cRect(left, top, buttonWidth, buttonHeight), Theme.Color(clrMenuBack)); |