diff options
-rw-r--r-- | displaymenu.c | 6 | ||||
-rw-r--r-- | displaymenuview.c | 74 | ||||
-rw-r--r-- | displaymenuview.h | 6 | ||||
-rw-r--r-- | fontmanager.c | 2 | ||||
-rw-r--r-- | geometrymanager.c | 3 | ||||
-rw-r--r-- | geometrymanager.h | 2 | ||||
-rw-r--r-- | imagecache.c | 16 | ||||
-rw-r--r-- | imagecache.h | 4 | ||||
-rw-r--r-- | messagebox.c | 10 | ||||
-rw-r--r-- | messagebox.h | 2 |
10 files changed, 26 insertions, 99 deletions
diff --git a/displaymenu.c b/displaymenu.c index 8a00bd9..a97bc93 100644 --- a/displaymenu.c +++ b/displaymenu.c @@ -361,11 +361,7 @@ void cNopacityDisplayMenu::SetButtons(const char *Red, const char *Green, const } void cNopacityDisplayMenu::SetMessage(eMessageType Type, const char *Text) { - if (Text) { - menuView->DrawMessage(Type, Text); - } else { - menuView->ClearMessage(); - } + menuView->DrawMessage(Type, Text); } bool cNopacityDisplayMenu::SetItemEvent(const cEvent *Event, int Index, bool Current, diff --git a/displaymenuview.c b/displaymenuview.c index 9a94f25..ece34ca 100644 --- a/displaymenuview.c +++ b/displaymenuview.c @@ -3,8 +3,8 @@ cNopacityDisplayMenuView::cNopacityDisplayMenuView(cImageCache *imgCache) { this->imgCache = imgCache; diskUsageAlert = 95; - pixmapStatus = NULL; pixmapHeaderIcon = NULL; + messageBox = NULL; } cNopacityDisplayMenuView::~cNopacityDisplayMenuView(void) { @@ -24,6 +24,7 @@ cNopacityDisplayMenuView::~cNopacityDisplayMenuView(void) { osd->DestroyPixmap(pixmapDiskUsageLabel); if (pixmapHeaderIcon) osd->DestroyPixmap(pixmapHeaderIcon); + delete messageBox; } cOsd *cNopacityDisplayMenuView::createOsd(void) { @@ -673,67 +674,14 @@ void cNopacityDisplayMenuView::ClearScrollbar(void) { void cNopacityDisplayMenuView::DrawMessage(eMessageType Type, const char *Text) { - tColor col = Theme.Color(clrMessageStatus); - tColor colFont = Theme.Color(clrMessageFontStatus); - eSkinElementType seType = seMessageMenuStatus; - switch (Type) { - case mtStatus: - col = Theme.Color(clrMessageStatus); - colFont = Theme.Color(clrMessageFontStatus); - seType = seMessageMenuStatus; - break; - case mtInfo: - col = Theme.Color(clrMessageInfo); - colFont = Theme.Color(clrMessageFontInfo); - seType = seMessageMenuInfo; - break; - case mtWarning: - col = Theme.Color(clrMessageWarning); - colFont = Theme.Color(clrMessageFontWarning); - seType = seMessageMenuWarning; - break; - case mtError: - col = Theme.Color(clrMessageError); - colFont = Theme.Color(clrMessageFontError); - seType = seMessageMenuError; - break; - } - if (pixmapStatus) { - ClearMessage(); - } - pixmapStatus = osd->CreatePixmap(7, cRect(0.1*geoManager->osdWidth, 0.8*geoManager->osdHeight, geoManager->menuMessageWidth, geoManager->menuMessageHeight)); - - pixmapStatus->Fill(clrTransparent); - if (config.GetValue("displayType") == dtGraphical) { - cImage *imgBack = imgCache->GetSkinElement(seType); - if (imgBack) { - pixmapStatus->DrawImage(cPoint(0, 0), *imgBack); - } - } else { - pixmapStatus->Fill(col); - if (config.GetValue("displayType") == dtBlending) { - cImage imgBack = imgCache->GetBackground(Theme.Color(clrMenuBack), col, geoManager->menuMessageWidth-2, geoManager->menuMessageHeight-2, true); - pixmapStatus->DrawImage(cPoint(1, 1), imgBack); - } - if (config.GetValue("roundedCorners")) { - DrawRoundedCornersWithBorder(pixmapStatus, col, config.GetValue("cornerRadius"), geoManager->menuMessageWidth, geoManager->menuMessageHeight); - } - } - int textWidth = fontManager->menuMessage->Width(Text); - tColor clrFontBack = (config.GetValue("displayType") != dtFlat)?(clrTransparent):col; - pixmapStatus->DrawText(cPoint((geoManager->menuMessageWidth - textWidth) / 2, - (geoManager->menuMessageHeight - fontManager->menuMessage->Height()) / 2), - Text, - colFont, - clrFontBack, - fontManager->menuMessage); -} - -void cNopacityDisplayMenuView::ClearMessage(void) { - if (pixmapStatus) { - osd->DestroyPixmap(pixmapStatus); - pixmapStatus = NULL; - } + DELETENULL(messageBox); + if (!Text) + return; + messageBox = new cNopacityMessageBox(osd, imgCache, + cRect((geoManager->osdWidth - geoManager->messageWidth) / 2, + geoManager->osdHeight * 9/10 - geoManager->messageHeight, + geoManager->messageWidth, geoManager->messageHeight), + Type, Text, true); } void cNopacityDisplayMenuView::SetDetailViewSize(eDetailViewType detailViewType, cNopacityDetailView *detailView) { @@ -765,4 +713,4 @@ void cNopacityDisplayMenuView::SetDetailViewSize(eDetailViewType detailViewType, } detailView->SetGeometry(x, width, height, top, contentBorder, detailHeaderHeight); detailView->SetScrollBar(pixmapScrollbar, pixmapScrollbarBack); -}
\ No newline at end of file +} diff --git a/displaymenuview.h b/displaymenuview.h index 974bab7..05a88c8 100644 --- a/displaymenuview.h +++ b/displaymenuview.h @@ -8,6 +8,7 @@ #include "config.h" #include "helpers.h" #include "imageloader.h" +#include "messagebox.h" class cNopacityDisplayMenuView { private: @@ -30,7 +31,7 @@ class cNopacityDisplayMenuView { cPixmap *pixmapDiskUsage; cPixmap *pixmapDiskUsageIcon; cPixmap *pixmapDiskUsageLabel; - cPixmap *pixmapStatus; + cNopacityMessageBox *messageBox; int feedNameLength; int avrgFontWidth; cRect textWindowSizeSchedules; @@ -76,10 +77,9 @@ class cNopacityDisplayMenuView { void DrawScrollbar(double Height, double Offset); void ClearScrollbar(void); void DrawMessage(eMessageType Type, const char *Text); - void ClearMessage(void); void SetDetailViewSize(eDetailViewType detailViewType, cNopacityDetailView *detailView); }; -#endif //__NOPACITY_DISPLAYMENUVIEW_H
\ No newline at end of file +#endif //__NOPACITY_DISPLAYMENUVIEW_H diff --git a/fontmanager.c b/fontmanager.c index 86339df..6715865 100644 --- a/fontmanager.c +++ b/fontmanager.c @@ -51,7 +51,7 @@ void cFontManager::SetFontsMenu(void) { menuTimersHead = CreateFont((geoManager->menuContentHeight - 3*geoManager->menuSpace - geoManager->menuDiskUsageHeight) / 25 + config.GetValue("fontTimersHead")); menuTimers = CreateFont((geoManager->menuContentHeight - 3*geoManager->menuSpace - geoManager->menuDiskUsageHeight) / 25 - 6 + config.GetValue("fontTimers")); menuButtons = CreateFont(geoManager->menuButtonHeight*0.8 + config.GetValue("fontButtons")); - menuMessage = CreateFont(geoManager->menuMessageHeight / 3 + config.GetValue("fontMessageMenu")); + menuMessage = CreateFont(geoManager->messageHeight / 3 + config.GetValue("fontMessageMenu")); menuEPGInfoWindow = CreateFont(geoManager->menuContentHeight / 30 + config.GetValue("fontEPGInfoWindow")); menuEPGInfoWindowLarge = CreateFont(geoManager->menuContentHeight / 20 + config.GetValue("fontEPGInfoWindowLarge")); } diff --git a/geometrymanager.c b/geometrymanager.c index 132686c..9528061 100644 --- a/geometrymanager.c +++ b/geometrymanager.c @@ -106,9 +106,6 @@ void cGeometryManager::SetDisplayMenuSizes() { config.GetValue("logoHeightOriginal")); menuTimersLogoWidth = timersLogoSize.Width(); menuTimersLogoHeight = timersLogoSize.Height(); - - menuMessageWidth = 0.8 * osdWidth; - menuMessageHeight = 0.1 * osdHeight; } void cGeometryManager::SetDisplayChannelSizes(void) { diff --git a/geometrymanager.h b/geometrymanager.h index 7b28b52..7db9084 100644 --- a/geometrymanager.h +++ b/geometrymanager.h @@ -63,8 +63,6 @@ class cGeometryManager { int menuDiskUsageWidth; int menuDiskUsageHeight; int menuTimersWidth; - int menuMessageWidth; - int menuMessageHeight; //DisplayChannel Sizes int channelX, channelTop; int channelWidth, channelHeight; diff --git a/imagecache.c b/imagecache.c index f62873a..f473e2d 100644 --- a/imagecache.c +++ b/imagecache.c @@ -562,25 +562,17 @@ void cImageCache::CreateSkinElementsGraphics(void) { std::string msgWarning = "skinElements/messageWarning"; std::string msgError = "skinElements/messageError"; success = LoadIcon(ctSkinElement, msgStatus); - if (success) { + if (success) InsertIntoSkinElementCache(seMessageStatus, geoManager->messageWidth, geoManager->messageHeight); - InsertIntoSkinElementCache(seMessageMenuStatus, geoManager->menuMessageWidth, geoManager->menuMessageHeight); - } success = LoadIcon(ctSkinElement, msgInfo); - if (success) { + if (success) InsertIntoSkinElementCache(seMessageInfo, geoManager->messageWidth, geoManager->messageHeight); - InsertIntoSkinElementCache(seMessageMenuInfo, geoManager->menuMessageWidth, geoManager->menuMessageHeight); - } success = LoadIcon(ctSkinElement, msgWarning); - if (success) { + if (success) InsertIntoSkinElementCache(seMessageWarning, geoManager->messageWidth, geoManager->messageHeight); - InsertIntoSkinElementCache(seMessageMenuWarning, geoManager->menuMessageWidth, geoManager->menuMessageHeight); - } success = LoadIcon(ctSkinElement, msgError); - if (success) { + if (success) InsertIntoSkinElementCache(seMessageError, geoManager->messageWidth, geoManager->messageHeight); - InsertIntoSkinElementCache(seMessageMenuError, geoManager->menuMessageWidth, geoManager->menuMessageHeight); - } //DisplayChannel Background and Foreground std::string imgChannelBackground; diff --git a/imagecache.h b/imagecache.h index 54a106d..acf3421 100644 --- a/imagecache.h +++ b/imagecache.h @@ -60,10 +60,6 @@ enum eSkinElementType { seMessageInfo, seMessageWarning, seMessageError, - seMessageMenuStatus, - seMessageMenuInfo, - seMessageMenuWarning, - seMessageMenuError, seVolumeBackground, seScrollbar, }; diff --git a/messagebox.c b/messagebox.c index 70398be..47fdbc1 100644 --- a/messagebox.c +++ b/messagebox.c @@ -3,7 +3,7 @@ #include "imageloader.h" #include "messagebox.h" -cNopacityMessageBox::cNopacityMessageBox(cOsd *Osd, cImageCache *imgCache, const cRect &Rect, eMessageType Type, const char *Text) { +cNopacityMessageBox::cNopacityMessageBox(cOsd *Osd, cImageCache *imgCache, const cRect &Rect, eMessageType Type, const char *Text, bool isMenuMessage) { osd = Osd; pixmap = osd->CreatePixmap(7, Rect); pixmapBackground = osd->CreatePixmap(6, Rect); @@ -51,13 +51,13 @@ cNopacityMessageBox::cNopacityMessageBox(cOsd *Osd, cImageCache *imgCache, const DrawRoundedCornersWithBorder(pixmapBackground, col, config.GetValue("cornerRadius"), Rect.Width(), Rect.Height()); } } - int textWidth = fontManager->messageText->Width(Text); - pixmap->DrawText(cPoint((Rect.Width() - textWidth) / 2, - (Rect.Height() - fontManager->messageText->Height()) / 2), + cFont *font = isMenuMessage ? fontManager->menuMessage : fontManager->messageText; + pixmap->DrawText(cPoint((Rect.Width() - font->Width(Text)) / 2, + (Rect.Height() - font->Height()) / 2), Text, colFont, clrTransparent, - fontManager->messageText); + font); } cNopacityMessageBox::~cNopacityMessageBox() { diff --git a/messagebox.h b/messagebox.h index 75c1df4..ed2c803 100644 --- a/messagebox.h +++ b/messagebox.h @@ -10,7 +10,7 @@ private: cPixmap *pixmap; cPixmap *pixmapBackground; public: - cNopacityMessageBox(cOsd *Osd, cImageCache *imgCache, const cRect &Rect, eMessageType Type, const char *Text); + cNopacityMessageBox(cOsd *Osd, cImageCache *imgCache, const cRect &Rect, eMessageType Type, const char *Text, bool isMenuMessage = false); ~cNopacityMessageBox(); void SetAlpha(int Alpha); }; |