summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkamel5 <vdr.kamel5 (at) gmx (dot) net>2021-06-04 14:30:54 +0200
committerkamel5 <vdr.kamel5 (at) gmx (dot) net>2021-06-04 14:34:09 +0200
commita14b280f74d683b1fee9e06009929a9689b1ae7a (patch)
treee0dc97d0d8b2503c8dab6b475e515109a3afbe78
parent3e5e592efd2c46a135ca9d2e7bf157537e7972fe (diff)
downloadskin-nopacity-a14b280f74d683b1fee9e06009929a9689b1ae7a.tar.gz
skin-nopacity-a14b280f74d683b1fee9e06009929a9689b1ae7a.tar.bz2
Simplify cNopacityDisplayMenu::SetButtons()
This simplification makes it possible to eliminate the pixmapButtonsText in cNopacityDisplayMenuView.
-rw-r--r--displaymenu.c20
-rw-r--r--displaymenuview.c17
-rw-r--r--displaymenuview.h2
3 files changed, 9 insertions, 30 deletions
diff --git a/displaymenu.c b/displaymenu.c
index 6207a9e..445be51 100644
--- a/displaymenu.c
+++ b/displaymenu.c
@@ -330,25 +330,15 @@ void cNopacityDisplayMenu::SetButtonPositions(void) {
}
void cNopacityDisplayMenu::SetButtons(const char *Red, const char *Green, const char *Yellow, const char *Blue) {
- if (Red) {
+ menuView->ClearButton();
+ if (Red)
menuView->DrawButton(Red, seButtonRed, Theme.Color(clrButtonRed), Theme.Color(clrButtonRedBorder), Theme.Color(clrButtonRedFont), positionButtons[0]);
- } else
- menuView->ClearButton(positionButtons[0]);
-
- if (Green) {
+ if (Green)
menuView->DrawButton(Green, seButtonGreen,Theme.Color(clrButtonGreen), Theme.Color(clrButtonGreenBorder), Theme.Color(clrButtonGreenFont), positionButtons[1]);
- } else
- menuView->ClearButton(positionButtons[1]);
-
- if (Yellow) {
+ if (Yellow)
menuView->DrawButton(Yellow, seButtonYellow, Theme.Color(clrButtonYellow), Theme.Color(clrButtonYellowBorder), Theme.Color(clrButtonYellowFont), positionButtons[2]);
- } else
- menuView->ClearButton(positionButtons[2]);
-
- if (Blue) {
+ if (Blue)
menuView->DrawButton(Blue, seButtonBlue, Theme.Color(clrButtonBlue), Theme.Color(clrButtonBlueBorder), Theme.Color(clrButtonBlueFont), positionButtons[3]);
- } else
- menuView->ClearButton(positionButtons[3]);
}
void cNopacityDisplayMenu::SetMessage(eMessageType Type, const char *Text) {
diff --git a/displaymenuview.c b/displaymenuview.c
index e4e34b6..7b72b74 100644
--- a/displaymenuview.c
+++ b/displaymenuview.c
@@ -14,7 +14,6 @@ cNopacityDisplayMenuView::~cNopacityDisplayMenuView(void) {
osd->DestroyPixmap(pixmapDate);
osd->DestroyPixmap(pixmapFooter);
osd->DestroyPixmap(pixmapFooterBack);
- osd->DestroyPixmap(pixmapButtonsText);
osd->DestroyPixmap(pixmapContent);
osd->DestroyPixmap(pixmapScrollbar);
osd->DestroyPixmap(pixmapScrollbarBack);
@@ -161,7 +160,6 @@ void cNopacityDisplayMenuView::CreatePixmaps(void) {
pixmapHeaderLabel = osd->CreatePixmap(2, cRect(labelX, 0, geoManager->osdWidth - geoManager->menuDateWidth, geoManager->menuHeaderHeight));
pixmapFooter = osd->CreatePixmap(2, cRect(0, geoManager->osdHeight - geoManager->menuFooterHeight, geoManager->osdWidth, geoManager->menuFooterHeight));
pixmapFooterBack = osd->CreatePixmap(1, cRect(0, geoManager->osdHeight - geoManager->menuFooterHeight, geoManager->osdWidth, geoManager->menuFooterHeight));
- pixmapButtonsText = osd->CreatePixmap(3, cRect(0, geoManager->osdHeight - geoManager->menuFooterHeight, geoManager->osdWidth, geoManager->menuFooterHeight));
int drawPortWidth = geoManager->osdWidth + geoManager->menuContentWidthFull - geoManager->menuContentWidthMinimum;
pixmapContent = osd->CreatePixmap(1, cRect(0, geoManager->menuHeaderHeight, geoManager->osdWidth, geoManager->menuContentHeight),
cRect(0, 0, drawPortWidth, geoManager->menuContentHeight));
@@ -186,7 +184,6 @@ void cNopacityDisplayMenuView::CreatePixmaps(void) {
pixmapDate->SetAlpha(0);
pixmapFooter->SetAlpha(0);
pixmapFooterBack->SetAlpha(0);
- pixmapButtonsText->SetAlpha(0);
pixmapContent->SetAlpha(0);
pixmapScrollbarBack->SetAlpha(0);
pixmapScrollbar->SetAlpha(0);
@@ -205,7 +202,6 @@ void cNopacityDisplayMenuView::SetPixmapAlpha(int Alpha) {
pixmapContent->SetAlpha(Alpha);
pixmapFooter->SetAlpha(Alpha);
pixmapFooterBack->SetAlpha(Alpha);
- pixmapButtonsText->SetAlpha(Alpha);
pixmapScrollbarBack->SetAlpha(Alpha);
pixmapScrollbar->SetAlpha(Alpha);
pixmapDiskUsage->SetAlpha(Alpha);
@@ -318,7 +314,6 @@ void cNopacityDisplayMenuView::DrawBorderDecoration() {
}
pixmapFooter->Fill(clrTransparent);
pixmapFooterBack->Fill(Theme.Color(clrMenuBack));
- pixmapButtonsText->Fill(clrTransparent);
int borderWidth = 2;
int radius = 10;
@@ -599,17 +594,11 @@ void cNopacityDisplayMenuView::DrawButton(const char *text, eSkinElementType seB
}
int textWidth = fontManager->menuButtons->Width(text);
int textHeight = fontManager->menuButtons->Height();
- pixmapButtonsText->DrawRectangle(cRect(left, top, geoManager->menuButtonWidth, geoManager->menuButtonHeight), clrTransparent);
- pixmapButtonsText->DrawText(cPoint(left + (geoManager->menuButtonWidth-textWidth)/2, top + (geoManager->menuButtonHeight-textHeight)/2), text, fontColor, clrTransparent, fontManager->menuButtons);
+ pixmapFooter->DrawText(cPoint(left + (geoManager->menuButtonWidth-textWidth)/2, top + (geoManager->menuButtonHeight-textHeight)/2), text, fontColor, clrTransparent, fontManager->menuButtons);
}
-void cNopacityDisplayMenuView::ClearButton(int num) {
- if (num < 0)
- return;
- int top = 2*geoManager->menuButtonsBorder;
- int left = num * geoManager->menuButtonWidth + (2*num + 1) * geoManager->menuButtonsBorder;
- pixmapFooter->DrawRectangle(cRect(left, top, geoManager->menuButtonWidth, geoManager->menuButtonHeight), clrTransparent);
- pixmapButtonsText->DrawRectangle(cRect(left, top, geoManager->menuButtonWidth, geoManager->menuButtonHeight), clrTransparent);
+void cNopacityDisplayMenuView::ClearButton(void) {
+ pixmapFooter->Fill(clrTransparent);
}
int cNopacityDisplayMenuView::GetTimersInitHeight(void) {
diff --git a/displaymenuview.h b/displaymenuview.h
index 0caa00c..6f5f094 100644
--- a/displaymenuview.h
+++ b/displaymenuview.h
@@ -67,7 +67,7 @@ class cNopacityDisplayMenuView {
void DrawDiskUsage(void);
void ShowDiskUsage(bool show);
void DrawButton(const char *text, eSkinElementType seButton, tColor buttonColor, tColor borderColor, tColor fontColor, int num);
- void ClearButton(int num);
+ void ClearButton(void);
int GetTimersInitHeight(void);
int GetTimersMaxHeight(void);
cNopacityTimer *DrawTimerConflict(int numConflicts, int y);