diff options
Diffstat (limited to 'displaymenuview.c')
-rw-r--r-- | displaymenuview.c | 608 |
1 files changed, 217 insertions, 391 deletions
diff --git a/displaymenuview.c b/displaymenuview.c index e0a2838..50423c1 100644 --- a/displaymenuview.c +++ b/displaymenuview.c @@ -1,6 +1,7 @@ #include "displaymenuview.h" -cNopacityDisplayMenuView::cNopacityDisplayMenuView() { +cNopacityDisplayMenuView::cNopacityDisplayMenuView(cImageCache *imgCache) { + this->imgCache = imgCache; diskUsageAlert = 95; pixmapStatus = NULL; pixmapHeaderIcon = NULL; @@ -25,93 +26,51 @@ cNopacityDisplayMenuView::~cNopacityDisplayMenuView(void) { osd->DestroyPixmap(pixmapRssFeedBackground); if (pixmapRssFeedIcon) osd->DestroyPixmap(pixmapRssFeedIcon); - delete fontHeader; - delete fontDate; - delete fontMenuitemLarge; - delete fontMenuitemSchedule; - delete fontMenuitemScheduleSmall; - delete fontMenuitemChannel; - delete fontMenuitemChannelSmall; - delete fontMenuitemRecordings; - delete fontMenuitemRecordingsSmall; - delete fontMenuitemTimers; - delete fontMenuitemTimersSmall; - delete fontMenuitemDefault; - delete fontDiskUsage; - delete fontDiskUsagePercent; - delete fontTimers; - delete fontTimersHead; - delete fontButtons; - delete fontMessage; - delete fontEPGInfoWindow; - delete fontEPGInfoWindowLarge; - delete fontRssFeed; } cOsd *cNopacityDisplayMenuView::createOsd(void) { - osdLeft = cOsd::OsdLeft(); - osdTop = cOsd::OsdTop(); - osdWidth = cOsd::OsdWidth(); - osdHeight = cOsd::OsdHeight(); - osd = CreateOsd(osdLeft, osdTop, osdWidth, osdHeight); + osd = CreateOsd(geoManager->osdLeft, geoManager->osdTop, geoManager->osdWidth, geoManager->osdHeight); return osd; } -void cNopacityDisplayMenuView::SetGeometry(void) { - spaceMenu = 5; - widthScrollbar = 20; - dateWidth = osdWidth * 0.3; - headerHeight = osdHeight * config.headerHeight / 100; - footerHeight = osdHeight * config.footerHeight / 100; - rssFeedHeight = (config.displayRSSFeed)?(osdHeight * config.rssFeedHeight / 100):0; - contentHeight = osdHeight - headerHeight - footerHeight - rssFeedHeight; - contentWidthMain = osdWidth * config.menuWidthMain / 100; - contentWidthSchedules = osdWidth * config.menuWidthSchedules / 100; - contentWidthChannels = osdWidth * config.menuWidthChannels / 100; - contentWidthTimers = osdWidth * config.menuWidthTimers / 100; - contentWidthRecordings = osdWidth * config.menuWidthRecordings / 100; - contentWidthSetup = osdWidth * config.menuWidthSetup / 100; - contentWidthFull = osdWidth - widthScrollbar - spaceMenu; - contentWidthMinimum = Minimum(contentWidthMain, - contentWidthSchedules, - contentWidthChannels, - contentWidthTimers, - contentWidthRecordings, - contentWidthSetup); - menuItemWidthDefault = contentWidthFull - 4 * spaceMenu; - menuItemWidthMain = contentWidthMain - 4*spaceMenu; - menuItemWidthSchedule = contentWidthSchedules - 4*spaceMenu; - menuItemWidthChannel = contentWidthChannels - 4*spaceMenu; - menuItemWidthTimer = contentWidthTimers - 4*spaceMenu; - menuItemWidthRecording = contentWidthRecordings - 4*spaceMenu; - menuItemWidthSetup = contentWidthSetup - 4*spaceMenu; - menuItemHeightMain = config.iconHeight + 2; - menuItemHeightSchedule = config.menuItemLogoHeight + 2; - menuItemHeightDefault = contentHeight / config.numDefaultMenuItems - spaceMenu; - menuItemHeightRecordings = config.menuRecFolderSize + 2; - diskUsageWidth = diskUsageHeight = osdWidth * config.menuSizeDiskUsage / 100; - timersWidth = osdWidth * config.menuWidthRightItems / 100; - buttonsBorder = footerHeight / 6; - buttonWidth = (osdWidth / 4) - 2 * buttonsBorder; - buttonHeight = footerHeight - 3 * buttonsBorder; - messageWidth = 0.8 * osdWidth; - messageHeight = 0.1 * osdHeight; - SetDescriptionTextWindowSize(); -} - void cNopacityDisplayMenuView::SetDescriptionTextWindowSize(void) { - int xSchedules = (config.menuAdjustLeft) ? (2 * spaceMenu + contentWidthSchedules + widthScrollbar) : (spaceMenu); - int xRecordings = (config.menuAdjustLeft) ? (2 * spaceMenu + contentWidthRecordings + widthScrollbar) : (spaceMenu); - int xChannels = (config.menuAdjustLeft) ? (2 * spaceMenu + contentWidthChannels + widthScrollbar) : (spaceMenu); - - int heightFull = contentHeight - 2*spaceMenu; + int xSchedules, xRecordings, xChannels; + int widthSchedules, widthRecordings, widthChannels; + if (config.menuAdjustLeft) { + xSchedules = 2 * geoManager->menuSpace + + geoManager->menuContentWidthSchedules + + geoManager->menuWidthScrollbar; + xRecordings = 2 * geoManager->menuSpace + + geoManager->menuContentWidthRecordings + + geoManager->menuWidthScrollbar; + xChannels = 2 * geoManager->menuSpace + + geoManager->menuContentWidthChannels + + geoManager->menuWidthScrollbar; + widthSchedules = geoManager->osdWidth - xSchedules - geoManager->menuSpace; + widthRecordings = geoManager->osdWidth - xRecordings - geoManager->menuSpace; + widthChannels = geoManager->osdWidth - xChannels - geoManager->menuSpace; + } else { + xSchedules = geoManager->menuSpace; + xRecordings = geoManager->menuSpace; + xChannels = geoManager->menuSpace; + widthSchedules = geoManager->osdWidth + - geoManager->menuContentWidthSchedules + - geoManager->menuWidthScrollbar + - 2 * geoManager->menuSpace; + widthRecordings = geoManager->osdWidth + - geoManager->menuContentWidthRecordings + - geoManager->menuWidthScrollbar + - 2 * geoManager->menuSpace; + widthChannels = geoManager->osdWidth + - geoManager->menuContentWidthChannels + - geoManager->menuWidthScrollbar + - 2 * geoManager->menuSpace; + } + int heightFull = geoManager->menuContentHeight - 2*geoManager->menuSpace; int height = config.menuHeightInfoWindow * heightFull / 100; - int y = headerHeight + (contentHeight - height - spaceMenu); - int yFullScreen = headerHeight + spaceMenu; + int y = geoManager->menuHeaderHeight + (geoManager->menuContentHeight - height - geoManager->menuSpace); + int yFullScreen = geoManager->menuHeaderHeight + geoManager->menuSpace; - int widthSchedules = (config.menuAdjustLeft) ? (osdWidth - xSchedules - spaceMenu) : (osdWidth - contentWidthSchedules - widthScrollbar - 2 * spaceMenu); - int widthRecordings = (config.menuAdjustLeft) ? (osdWidth - xRecordings - spaceMenu) : (osdWidth - contentWidthRecordings - widthScrollbar - 2 * spaceMenu); - int widthChannels = (config.menuAdjustLeft) ? (osdWidth - xChannels - spaceMenu) : (osdWidth - contentWidthChannels - widthScrollbar - 2 * spaceMenu); if (config.menuSchedulesWindowMode == 0) textWindowSizeSchedules = cRect(xSchedules,y,widthSchedules,height); else @@ -141,66 +100,66 @@ int cNopacityDisplayMenuView::GetContentWidth(eMenuCategory menuCat) { switch (menuCat) { case mcMain: if (config.narrowMainMenu) - return contentWidthMain; + return geoManager->menuContentWidthMain; else - return contentWidthFull; + return geoManager->menuContentWidthFull; case mcSetup: if (config.narrowSetupMenu) - return contentWidthSetup; + return geoManager->menuContentWidthSetup; else - return contentWidthFull; + return geoManager->menuContentWidthFull; case mcSchedule: case mcScheduleNow: case mcScheduleNext: if (config.narrowScheduleMenu) - return contentWidthSchedules; + return geoManager->menuContentWidthSchedules; else - return contentWidthFull; + return geoManager->menuContentWidthFull; case mcChannel: if (config.narrowChannelMenu) - return contentWidthChannels; + return geoManager->menuContentWidthChannels; else - return contentWidthFull; + return geoManager->menuContentWidthFull; case mcTimer: if (config.narrowTimerMenu) - return contentWidthTimers; + return geoManager->menuContentWidthTimers; else - return contentWidthFull; + return geoManager->menuContentWidthFull; case mcRecording: if (config.narrowRecordingMenu) - return contentWidthRecordings; + return geoManager->menuContentWidthRecordings; else - return contentWidthFull; + return geoManager->menuContentWidthFull; default: - return contentWidthFull; + return geoManager->menuContentWidthFull; } - return contentWidthFull; + return geoManager->menuContentWidthFull; } void cNopacityDisplayMenuView::CreatePixmaps(void) { - pixmapHeader = osd->CreatePixmap(1, cRect(0, 0, osdWidth, headerHeight)); - int dateX = (config.menuAdjustLeft) ? (osdWidth - dateWidth) : 0; - pixmapDate = osd->CreatePixmap(2, cRect(dateX, 0, dateWidth, headerHeight)); - int logoX = (config.menuAdjustLeft) ? 0 : (osdWidth - config.menuHeaderLogoWidth); + pixmapHeader = osd->CreatePixmap(1, cRect(0, 0, geoManager->osdWidth, geoManager->menuHeaderHeight)); + int dateX = (config.menuAdjustLeft) ? (geoManager->osdWidth - geoManager->menuDateWidth) : 0; + pixmapDate = osd->CreatePixmap(2, cRect(dateX, 0, geoManager->menuDateWidth, geoManager->menuHeaderHeight)); + int logoX = (config.menuAdjustLeft) ? 0 : (geoManager->osdWidth - config.menuHeaderLogoWidth); pixmapHeaderLogo = osd->CreatePixmap(-1, cRect(logoX, 0, config.menuHeaderLogoWidth, config.menuHeaderLogoHeight)); - int labelX = (config.menuAdjustLeft) ? 0 : dateWidth; - pixmapHeaderLabel = osd->CreatePixmap(2, cRect(labelX, 0, osdWidth - dateWidth, headerHeight)); - pixmapFooter = osd->CreatePixmap(1, cRect(0, osdHeight - rssFeedHeight - footerHeight, osdWidth, footerHeight)); - int drawPortWidth = osdWidth + contentWidthFull - contentWidthMinimum; - pixmapContent = osd->CreatePixmap(1, cRect(0, headerHeight, osdWidth, contentHeight), - cRect(0, 0, drawPortWidth, contentHeight)); - int diskUsageX = (config.menuAdjustLeft) ? (osdWidth - diskUsageWidth - 10) : 10; - pixmapDiskUsage = osd->CreatePixmap(2, cRect(diskUsageX, headerHeight + spaceMenu, diskUsageWidth, diskUsageHeight)); - pixmapDiskUsageIcon = osd->CreatePixmap(3, cRect(diskUsageX + 2, headerHeight + spaceMenu + 2, diskUsageWidth - 4, diskUsageHeight - 4)); - pixmapDiskUsageLabel = osd->CreatePixmap(4, cRect(diskUsageX + 2, headerHeight + spaceMenu + 2, diskUsageWidth - 4, diskUsageHeight - 4)); - int scrollbarX = (config.menuAdjustLeft) ? contentWidthMain : (osdWidth - contentWidthMain); - pixmapScrollbar = osd->CreatePixmap(2, cRect(scrollbarX, headerHeight + spaceMenu, widthScrollbar, contentHeight - 2 * spaceMenu)); + int labelX = (config.menuAdjustLeft) ? 0 : geoManager->menuDateWidth; + pixmapHeaderLabel = osd->CreatePixmap(2, cRect(labelX, 0, geoManager->osdWidth - geoManager->menuDateWidth, geoManager->menuHeaderHeight)); + pixmapFooter = osd->CreatePixmap(1, cRect(0, geoManager->osdHeight - geoManager->menuRssFeedHeight - 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)); + int diskUsageX = (config.menuAdjustLeft) ? (geoManager->osdWidth - geoManager->menuDiskUsageWidth - 10) : 10; + pixmapDiskUsage = osd->CreatePixmap(2, cRect(diskUsageX, geoManager->menuHeaderHeight + geoManager->menuSpace, geoManager->menuDiskUsageWidth, geoManager->menuDiskUsageHeight)); + pixmapDiskUsageIcon = osd->CreatePixmap(3, cRect(diskUsageX + 2, geoManager->menuHeaderHeight + geoManager->menuSpace + 2, geoManager->menuDiskUsageWidth - 4, geoManager->menuDiskUsageHeight - 4)); + pixmapDiskUsageLabel = osd->CreatePixmap(4, cRect(diskUsageX + 2, geoManager->menuHeaderHeight + geoManager->menuSpace + 2, geoManager->menuDiskUsageWidth - 4, geoManager->menuDiskUsageHeight - 4)); + int scrollbarX = (config.menuAdjustLeft) ? geoManager->menuContentWidthMain : (geoManager->osdWidth - geoManager->menuContentWidthMain); + pixmapScrollbar = osd->CreatePixmap(2, cRect(scrollbarX, geoManager->menuHeaderHeight + geoManager->menuSpace, geoManager->menuWidthScrollbar, geoManager->menuContentHeight - 2 * geoManager->menuSpace)); if (config.displayRSSFeed) { - pixmapRssFeedBackground = osd->CreatePixmap(1, cRect(0, headerHeight + contentHeight + footerHeight, osdWidth, rssFeedHeight)); - pixmapRssFeed = osd->CreatePixmap(2, cRect(0, headerHeight + contentHeight + footerHeight, osdWidth, rssFeedHeight)); - pixmapRssFeedIcon = osd->CreatePixmap(3, cRect(0, headerHeight + contentHeight + footerHeight, rssFeedHeight, rssFeedHeight)); + pixmapRssFeedBackground = osd->CreatePixmap(1, cRect(0, geoManager->menuHeaderHeight + geoManager->menuContentHeight + geoManager->menuFooterHeight, geoManager->osdWidth, geoManager->menuRssFeedHeight)); + pixmapRssFeed = osd->CreatePixmap(2, cRect(0, geoManager->menuHeaderHeight + geoManager->menuContentHeight + geoManager->menuFooterHeight, geoManager->osdWidth, geoManager->menuRssFeedHeight)); + pixmapRssFeedIcon = osd->CreatePixmap(3, cRect(0, geoManager->menuHeaderHeight + geoManager->menuContentHeight + geoManager->menuFooterHeight, geoManager->menuRssFeedHeight, geoManager->menuRssFeedHeight)); } else { pixmapRssFeedBackground = NULL; pixmapRssFeed = NULL; @@ -238,112 +197,43 @@ void cNopacityDisplayMenuView::SetPixmapAlpha(int Alpha) { pixmapDiskUsageLabel->SetAlpha(Alpha); } -void cNopacityDisplayMenuView::CreateFonts(void) { - fontHeader = cFont::CreateFont(config.fontName, headerHeight / 2 + config.fontHeader); - fontDate = cFont::CreateFont(config.fontName, headerHeight / 2 + config.fontDate); - fontMenuitemLarge = cFont::CreateFont(config.fontName, menuItemHeightMain/3 + 4 + config.fontMenuitemLarge); - fontMenuitemSchedule = cFont::CreateFont(config.fontName, menuItemHeightSchedule / 4 + 5 + config.fontMenuitemSchedule); - fontMenuitemScheduleSmall = cFont::CreateFont(config.fontName, menuItemHeightSchedule / 4 - 5 + config.fontMenuitemScheduleSmall); - fontMenuitemChannel = cFont::CreateFont(config.fontName, menuItemHeightSchedule / 3 + config.fontMenuitemChannel); - fontMenuitemChannelSmall = cFont::CreateFont(config.fontName, menuItemHeightSchedule / 5 - 2 + config.fontMenuitemChannelSmall); - fontMenuitemRecordings = cFont::CreateFont(config.fontName, menuItemHeightRecordings / 2 - 14 + config.fontMenuitemRecordings); - fontMenuitemRecordingsSmall = cFont::CreateFont(config.fontName, menuItemHeightRecordings / 4 - 3 + config.fontMenuitemRecordingsSmall); - fontMenuitemTimers = cFont::CreateFont(config.fontName, menuItemHeightSchedule / 3 + config.fontMenuitemTimers); - fontMenuitemTimersSmall = cFont::CreateFont(config.fontName, menuItemHeightSchedule / 4 - 3 + config.fontMenuitemTimersSmall); - fontMenuitemDefault = cFont::CreateFont(config.fontName, menuItemHeightDefault * 2 / 3 + config.fontMenuitemDefault); - fontDiskUsage = cFont::CreateFont(config.fontName, diskUsageHeight/6 - 2 + config.fontDiskUsage); - fontDiskUsagePercent = cFont::CreateFont(config.fontName, diskUsageHeight/5 - 4 + config.fontDiskUsagePercent); - fontTimersHead = cFont::CreateFont(config.fontName, (contentHeight - 3*spaceMenu - diskUsageHeight) / 25 + config.fontTimersHead); - fontTimers = cFont::CreateFont(config.fontName, (contentHeight - 3*spaceMenu - diskUsageHeight) / 25 - 6 + config.fontTimers); - fontButtons = cFont::CreateFont(config.fontName, buttonHeight*0.8 + config.fontButtons); - fontMessage = cFont::CreateFont(config.fontName, messageHeight / 3 + config.fontMessageMenu); - fontEPGInfoWindow = cFont::CreateFont(config.fontName, contentHeight / 30 + config.fontEPGInfoWindow); - fontEPGInfoWindowLarge = cFont::CreateFont(config.fontName, contentHeight / 20 + config.fontEPGInfoWindowLarge); - fontRssFeed = cFont::CreateFont(config.fontName, (rssFeedHeight / 2) + 3 + config.fontRssFeed); -} - -cFont *cNopacityDisplayMenuView::GetMenuItemFont(eMenuCategory menuCat) { - switch (menuCat) { - case mcUnknown: - return fontMenuitemDefault; - case mcMain: - case mcSetup: - return fontMenuitemLarge; - case mcSchedule: - return fontMenuitemSchedule; - case mcChannel: - return fontMenuitemChannel; - case mcTimer: - return fontMenuitemTimers; - case mcRecording: - return fontMenuitemRecordings; - default: - return fontMenuitemDefault; - } - return fontMenuitemDefault; -} - -cFont *cNopacityDisplayMenuView::GetMenuItemFontSmall(eMenuCategory menuCat) { - switch (menuCat) { - case mcSchedule: - return fontMenuitemScheduleSmall; - case mcChannel: - return fontMenuitemChannelSmall; - case mcTimer: - return fontMenuitemTimersSmall; - case mcRecording: - return fontMenuitemRecordingsSmall; - default: - return fontMenuitemScheduleSmall; - } - return fontMenuitemScheduleSmall; -} - -cFont *cNopacityDisplayMenuView::GetEPGWindowFont(void) { - return fontEPGInfoWindow; -} - -cFont *cNopacityDisplayMenuView::GetEPGWindowFontLarge(void) { - return fontEPGInfoWindowLarge; -} - void cNopacityDisplayMenuView::GetMenuItemSize(eMenuCategory menuCat, cPoint *itemSize) { int itemWidth = 0; int itemHeight = 0; switch (menuCat) { case mcUnknown: - itemWidth = menuItemWidthDefault; - itemHeight = menuItemHeightDefault; + itemWidth = geoManager->menuItemWidthDefault; + itemHeight = geoManager->menuItemHeightDefault; break; case mcMain: - itemWidth = menuItemWidthMain; - itemHeight = menuItemHeightMain; + itemWidth = geoManager->menuItemWidthMain; + itemHeight = geoManager->menuItemHeightMain; break; case mcSetup: - itemWidth = menuItemWidthSetup; - itemHeight = menuItemHeightMain; + itemWidth = geoManager->menuItemWidthSetup; + itemHeight = geoManager->menuItemHeightMain; break; case mcSchedule: case mcScheduleNow: case mcScheduleNext: - itemWidth = menuItemWidthSchedule; - itemHeight = menuItemHeightSchedule; + itemWidth = geoManager->menuItemWidthSchedule; + itemHeight = geoManager->menuItemHeightSchedule; break; case mcChannel: - itemWidth = menuItemWidthChannel; - itemHeight = menuItemHeightSchedule; + itemWidth = geoManager->menuItemWidthChannel; + itemHeight = geoManager->menuItemHeightSchedule; break; case mcTimer: - itemWidth = menuItemWidthTimer; - itemHeight = menuItemHeightSchedule; + itemWidth = geoManager->menuItemWidthTimer; + itemHeight = geoManager->menuItemHeightSchedule; break; case mcRecording: - itemWidth = menuItemWidthRecording; - itemHeight = menuItemHeightRecordings; + itemWidth = geoManager->menuItemWidthRecording; + itemHeight = geoManager->menuItemHeightRecordings; break; default: - itemWidth = menuItemWidthDefault; - itemHeight = menuItemHeightDefault; + itemWidth = geoManager->menuItemWidthDefault; + itemHeight = geoManager->menuItemHeightDefault; break; } itemSize->Set(itemWidth, itemHeight); @@ -354,17 +244,17 @@ int cNopacityDisplayMenuView::GetMaxItems(eMenuCategory menuCat) { switch (menuCat) { case mcMain: case mcSetup: - maxItems = contentHeight / (menuItemHeightMain + spaceMenu); + maxItems = geoManager->menuContentHeight / (geoManager->menuItemHeightMain + geoManager->menuSpace); break; case mcSchedule: case mcScheduleNow: case mcScheduleNext: case mcChannel: case mcTimer: - maxItems = contentHeight / (menuItemHeightSchedule + spaceMenu); + maxItems = geoManager->menuContentHeight / (geoManager->menuItemHeightSchedule + geoManager->menuSpace); break; case mcRecording: - maxItems = contentHeight / (menuItemHeightRecordings + spaceMenu); + maxItems = geoManager->menuContentHeight / (geoManager->menuItemHeightRecordings + geoManager->menuSpace); break; default: maxItems = config.numDefaultMenuItems; @@ -373,18 +263,18 @@ int cNopacityDisplayMenuView::GetMaxItems(eMenuCategory menuCat) { } int cNopacityDisplayMenuView::GetMenuTop(int numItems, int itemHeight) { - return headerHeight + (contentHeight - numItems*(itemHeight + spaceMenu))/2; + return geoManager->menuHeaderHeight + (geoManager->menuContentHeight - numItems*(itemHeight + geoManager->menuSpace))/2; } int cNopacityDisplayMenuView::GetMenuItemLeft(int itemWidth) { - int menuLeft = spaceMenu; + int menuLeft = geoManager->menuSpace; if (!config.menuAdjustLeft) - menuLeft = osdWidth - itemWidth - spaceMenu; + menuLeft = geoManager->osdWidth - itemWidth - geoManager->menuSpace; return menuLeft; } void cNopacityDisplayMenuView::SetAvrgFontWidth(void) { - avrgFontWidth = fontMenuitemDefault->Width("x")+3; + avrgFontWidth = fontManager->menuItemDefault->Width("x")+3; } void cNopacityDisplayMenuView::SetTabs(int Tab1, int Tab2, int Tab3, int Tab4, int Tab5) { @@ -403,80 +293,22 @@ void cNopacityDisplayMenuView::SetTabs(int Tab1, int Tab2, int Tab3, int Tab4, i } int cNopacityDisplayMenuView::GetEditableWidth(void) { - return contentWidthFull*0.5; + return geoManager->menuContentWidthFull*0.5; } int cNopacityDisplayMenuView::GetTextAreaWidth(void) { - return contentWidthFull - 2*spaceMenu; + return geoManager->menuContentWidthFull - 2*geoManager->menuSpace; } const cFont *cNopacityDisplayMenuView::GetTextAreaFont(bool FixedFont) { - return cFont::CreateFont(config.fontName, contentHeight / 25 + config.fontDetailView); -} - -void cNopacityDisplayMenuView::CreateBackgroundImages(int *handleBackgrounds, int *handleButtons) { - if (!config.doBlending) - return; - cImageLoader imgLoader; - //Default Menus - imgLoader.DrawBackground(Theme.Color(clrMenuItem), Theme.Color(clrMenuItemBlend), menuItemWidthDefault-2, menuItemHeightDefault-2); - handleBackgrounds[0] = cOsdProvider::StoreImage(imgLoader.GetImage()); - imgLoader.DrawBackground(Theme.Color(clrMenuItemHigh), Theme.Color(clrMenuItemHighBlend), menuItemWidthDefault-2, menuItemHeightDefault-2); - handleBackgrounds[1] = cOsdProvider::StoreImage(imgLoader.GetImage()); - //Main Menu - cPoint itemSize; - GetMenuItemSize(mcMain, &itemSize); - imgLoader.DrawBackground(Theme.Color(clrMenuItem), Theme.Color(clrMenuItemBlend), itemSize.X()-2, itemSize.Y()-2); - handleBackgrounds[2] = cOsdProvider::StoreImage(imgLoader.GetImage()); - imgLoader.DrawBackground(Theme.Color(clrMenuItemHigh), Theme.Color(clrMenuItemHighBlend), itemSize.X()-2, itemSize.Y()-2); - handleBackgrounds[3] = cOsdProvider::StoreImage(imgLoader.GetImage()); - //Schedules Menu - GetMenuItemSize(mcSchedule, &itemSize); - imgLoader.DrawBackground(Theme.Color(clrMenuItem), Theme.Color(clrMenuItemBlend), itemSize.X()-2, itemSize.Y()-2); - handleBackgrounds[4] = cOsdProvider::StoreImage(imgLoader.GetImage()); - imgLoader.DrawBackground(Theme.Color(clrMenuItemHigh), Theme.Color(clrMenuItemHighBlend), itemSize.X()-2, itemSize.Y()-2); - handleBackgrounds[5] = cOsdProvider::StoreImage(imgLoader.GetImage()); - //Channels Menu - GetMenuItemSize(mcChannel, &itemSize); - imgLoader.DrawBackground(Theme.Color(clrMenuItem), Theme.Color(clrMenuItemBlend), itemSize.X()-2, itemSize.Y()-2); - handleBackgrounds[6] = cOsdProvider::StoreImage(imgLoader.GetImage()); - imgLoader.DrawBackground(Theme.Color(clrMenuItemHigh), Theme.Color(clrMenuItemHighBlend), itemSize.X()-2, itemSize.Y()-2); - handleBackgrounds[7] = cOsdProvider::StoreImage(imgLoader.GetImage()); - //Recordings Menu - GetMenuItemSize(mcRecording, &itemSize); - imgLoader.DrawBackground(Theme.Color(clrMenuItem), Theme.Color(clrMenuItemBlend), itemSize.X()-2, itemSize.Y()-2); - handleBackgrounds[8] = cOsdProvider::StoreImage(imgLoader.GetImage()); - imgLoader.DrawBackground(Theme.Color(clrMenuItemHigh), Theme.Color(clrMenuItemHighBlend), itemSize.X()-2, itemSize.Y()-2); - handleBackgrounds[9] = cOsdProvider::StoreImage(imgLoader.GetImage()); - //Timers Menu - GetMenuItemSize(mcTimer, &itemSize); - imgLoader.DrawBackground(Theme.Color(clrMenuItem), Theme.Color(clrMenuItemBlend), itemSize.X()-2, itemSize.Y()-2); - handleBackgrounds[10] = cOsdProvider::StoreImage(imgLoader.GetImage()); - imgLoader.DrawBackground(Theme.Color(clrMenuItemHigh), Theme.Color(clrMenuItemHighBlend), itemSize.X()-2, itemSize.Y()-2); - handleBackgrounds[11] = cOsdProvider::StoreImage(imgLoader.GetImage()); - //Setup Menu - GetMenuItemSize(mcSetup, &itemSize); - imgLoader.DrawBackground(Theme.Color(clrMenuItem), Theme.Color(clrMenuItemBlend), itemSize.X()-2, itemSize.Y()-2); - handleBackgrounds[12] = cOsdProvider::StoreImage(imgLoader.GetImage()); - imgLoader.DrawBackground(Theme.Color(clrMenuItemHigh), Theme.Color(clrMenuItemHighBlend), itemSize.X()-2, itemSize.Y()-2); - handleBackgrounds[13] = cOsdProvider::StoreImage(imgLoader.GetImage()); - //Color Buttons - imgLoader.DrawBackground(Theme.Color(clrMenuBack), Theme.Color(clrButtonRed), buttonWidth-4, buttonHeight-4); - handleButtons[0] = cOsdProvider::StoreImage(imgLoader.GetImage()); - imgLoader.DrawBackground(Theme.Color(clrMenuBack), Theme.Color(clrButtonGreen), buttonWidth-4, buttonHeight-4); - handleButtons[1] = cOsdProvider::StoreImage(imgLoader.GetImage()); - imgLoader.DrawBackground(Theme.Color(clrMenuBack), Theme.Color(clrButtonYellow), buttonWidth-4, buttonHeight-4); - handleButtons[2] = cOsdProvider::StoreImage(imgLoader.GetImage()); - imgLoader.DrawBackground(Theme.Color(clrMenuBack), Theme.Color(clrButtonBlue), buttonWidth-4, buttonHeight-4); - handleButtons[3] = cOsdProvider::StoreImage(imgLoader.GetImage()); + return cFont::CreateFont(config.fontName, geoManager->menuContentHeight / 25 + config.fontDetailView); } void cNopacityDisplayMenuView::DrawBorderDecoration() { if (config.doBlending) { - cImageLoader imgLoader; - bool mirrorHeader = (config.menuAdjustLeft) ? false : true; - imgLoader.DrawBackground(Theme.Color(clrMenuHeaderBlend), Theme.Color(clrMenuHeader), osdWidth, headerHeight, mirrorHeader); - pixmapHeader->DrawImage(cPoint(0,0), imgLoader.GetImage()); + cImage *headerImage = imgCache->GetBackground(btMenuHeader); + if (headerImage) + pixmapHeader->DrawImage(cPoint(0, 0), *headerImage); } else pixmapHeader->Fill(Theme.Color(clrMenuBack)); pixmapFooter->Fill(Theme.Color(clrMenuBack)); @@ -488,43 +320,43 @@ void cNopacityDisplayMenuView::DrawBorderDecoration() { if (config.menuAdjustLeft) { //Background - pixmapContent->DrawRectangle(cRect(0, 0, contentWidthFull - radius, contentHeight), Theme.Color(clrMenuBack)); + pixmapContent->DrawRectangle(cRect(0, 0, geoManager->menuContentWidthFull - radius, geoManager->menuContentHeight), Theme.Color(clrMenuBack)); //Upper and lower Corner Square - pixmapContent->DrawRectangle(cRect(contentWidthFull - radius, 0, radius, radius), Theme.Color(clrMenuBack)); - pixmapContent->DrawRectangle(cRect(contentWidthFull - radius, contentHeight - radius, radius, radius), Theme.Color(clrMenuBack)); + pixmapContent->DrawRectangle(cRect(geoManager->menuContentWidthFull - radius, 0, radius, radius), Theme.Color(clrMenuBack)); + pixmapContent->DrawRectangle(cRect(geoManager->menuContentWidthFull - radius, geoManager->menuContentHeight - radius, radius, radius), Theme.Color(clrMenuBack)); //Upper line - pixmapContent->DrawRectangle(cRect(contentWidthFull, 0, osdWidth - contentWidthMinimum, borderWidth), Theme.Color(clrMenuBorder)); + pixmapContent->DrawRectangle(cRect(geoManager->menuContentWidthFull, 0, geoManager->osdWidth - geoManager->menuContentWidthMinimum, borderWidth), Theme.Color(clrMenuBorder)); //Lower Line - pixmapContent->DrawRectangle(cRect(contentWidthFull, contentHeight - borderWidth, osdWidth - contentWidthMinimum, borderWidth), Theme.Color(clrMenuBorder)); + pixmapContent->DrawRectangle(cRect(geoManager->menuContentWidthFull, geoManager->menuContentHeight - borderWidth, geoManager->osdWidth - geoManager->menuContentWidthMinimum, borderWidth), Theme.Color(clrMenuBorder)); //Vertical line - pixmapContent->DrawRectangle(cRect(contentWidthFull-radius, radius, borderWidth, contentHeight - 2*radius), Theme.Color(clrMenuBorder)); + pixmapContent->DrawRectangle(cRect(geoManager->menuContentWidthFull-radius, radius, borderWidth, geoManager->menuContentHeight - 2*radius), Theme.Color(clrMenuBorder)); if (radius-borderWidth > 2) { //Upper Ellipse - pixmapContent->DrawEllipse(cRect(contentWidthFull - radius, 0, radius, radius), Theme.Color(clrMenuBorder),2); - pixmapContent->DrawEllipse(cRect(contentWidthFull - radius + borderWidth, borderWidth, radius-borderWidth, radius-borderWidth), clrTransparent, 2); + pixmapContent->DrawEllipse(cRect(geoManager->menuContentWidthFull - radius, 0, radius, radius), Theme.Color(clrMenuBorder),2); + pixmapContent->DrawEllipse(cRect(geoManager->menuContentWidthFull - radius + borderWidth, borderWidth, radius-borderWidth, radius-borderWidth), clrTransparent, 2); //Lower Ellipse - pixmapContent->DrawEllipse(cRect(contentWidthFull - radius, contentHeight - radius, radius, radius), Theme.Color(clrMenuBorder),3); - pixmapContent->DrawEllipse(cRect(contentWidthFull - radius + borderWidth, contentHeight - radius, radius-borderWidth, radius-borderWidth), clrTransparent, 3); + pixmapContent->DrawEllipse(cRect(geoManager->menuContentWidthFull - radius, geoManager->menuContentHeight - radius, radius, radius), Theme.Color(clrMenuBorder),3); + pixmapContent->DrawEllipse(cRect(geoManager->menuContentWidthFull - radius + borderWidth, geoManager->menuContentHeight - radius, radius-borderWidth, radius-borderWidth), clrTransparent, 3); } } else { //Background - pixmapContent->DrawRectangle(cRect(osdWidth - contentWidthMinimum + radius, 0, contentWidthFull - radius, contentHeight), Theme.Color(clrMenuBack)); + pixmapContent->DrawRectangle(cRect(geoManager->osdWidth - geoManager->menuContentWidthMinimum + radius, 0, geoManager->menuContentWidthFull - radius, geoManager->menuContentHeight), Theme.Color(clrMenuBack)); //Upper and lower Corner Square - pixmapContent->DrawRectangle(cRect(osdWidth - contentWidthMinimum, 0, radius, radius), Theme.Color(clrMenuBack)); - pixmapContent->DrawRectangle(cRect(osdWidth - contentWidthMinimum, contentHeight - radius, radius, radius), Theme.Color(clrMenuBack)); + pixmapContent->DrawRectangle(cRect(geoManager->osdWidth - geoManager->menuContentWidthMinimum, 0, radius, radius), Theme.Color(clrMenuBack)); + pixmapContent->DrawRectangle(cRect(geoManager->osdWidth - geoManager->menuContentWidthMinimum, geoManager->menuContentHeight - radius, radius, radius), Theme.Color(clrMenuBack)); //Upper line - pixmapContent->DrawRectangle(cRect(0, 0, osdWidth - contentWidthMinimum, borderWidth), Theme.Color(clrMenuBorder)); + pixmapContent->DrawRectangle(cRect(0, 0, geoManager->osdWidth - geoManager->menuContentWidthMinimum, borderWidth), Theme.Color(clrMenuBorder)); //Lower Line - pixmapContent->DrawRectangle(cRect(0, contentHeight - borderWidth, osdWidth - contentWidthMinimum, borderWidth), Theme.Color(clrMenuBorder)); + pixmapContent->DrawRectangle(cRect(0, geoManager->menuContentHeight - borderWidth, geoManager->osdWidth - geoManager->menuContentWidthMinimum, borderWidth), Theme.Color(clrMenuBorder)); //Vertical line - pixmapContent->DrawRectangle(cRect(osdWidth - contentWidthMinimum + radius - borderWidth, radius, borderWidth, contentHeight - 2*radius), Theme.Color(clrMenuBorder)); + pixmapContent->DrawRectangle(cRect(geoManager->osdWidth - geoManager->menuContentWidthMinimum + radius - borderWidth, radius, borderWidth, geoManager->menuContentHeight - 2*radius), Theme.Color(clrMenuBorder)); if (radius-borderWidth > 2) { //Upper Ellipse - pixmapContent->DrawEllipse(cRect(osdWidth - contentWidthMinimum, 0, radius, radius), Theme.Color(clrMenuBorder),1); - pixmapContent->DrawEllipse(cRect(osdWidth - contentWidthMinimum, borderWidth, radius-borderWidth, radius-borderWidth), clrTransparent, 1); + pixmapContent->DrawEllipse(cRect(geoManager->osdWidth - geoManager->menuContentWidthMinimum, 0, radius, radius), Theme.Color(clrMenuBorder),1); + pixmapContent->DrawEllipse(cRect(geoManager->osdWidth - geoManager->menuContentWidthMinimum, borderWidth, radius-borderWidth, radius-borderWidth), clrTransparent, 1); //Lower Ellipse - pixmapContent->DrawEllipse(cRect(osdWidth - contentWidthMinimum, contentHeight - radius, radius, radius), Theme.Color(clrMenuBorder),4); - pixmapContent->DrawEllipse(cRect(osdWidth - contentWidthMinimum, contentHeight - radius, radius-borderWidth, radius-borderWidth), clrTransparent, 4); + pixmapContent->DrawEllipse(cRect(geoManager->osdWidth - geoManager->menuContentWidthMinimum, geoManager->menuContentHeight - radius, radius, radius), Theme.Color(clrMenuBorder),4); + pixmapContent->DrawEllipse(cRect(geoManager->osdWidth - geoManager->menuContentWidthMinimum, geoManager->menuContentHeight - radius, radius-borderWidth, radius-borderWidth), clrTransparent, 4); } } } @@ -534,40 +366,39 @@ void cNopacityDisplayMenuView::AdjustContentBackground(eMenuCategory menuCat, eM int contentWidthLast = GetContentWidth(menuCatLast); int drawportX; if ((contentWidth != contentWidthLast)||(menuCatLast == mcUndefined)) { - if (contentWidth == contentWidthFull) { - drawportX = (config.menuAdjustLeft)?0:(contentWidthMinimum - contentWidthFull); + if (contentWidth == geoManager->menuContentWidthFull) { + drawportX = (config.menuAdjustLeft)?0:(geoManager->menuContentWidthMinimum - geoManager->menuContentWidthFull); pixmapContent->SetDrawPortPoint(cPoint(drawportX, 0)); if (config.scalePicture) { // ask output device to restore full size vidWin = cDevice::PrimaryDevice()->CanScaleVideo(cRect::Null); } } else { - drawportX = (config.menuAdjustLeft)?(contentWidth - contentWidthFull):(contentWidthMinimum - contentWidth); + drawportX = (config.menuAdjustLeft)?(contentWidth - geoManager->menuContentWidthFull):(geoManager->menuContentWidthMinimum - contentWidth); pixmapContent->SetDrawPortPoint(cPoint(drawportX, 0)); if (config.scalePicture) { // ask output device to scale down - int windowX = (config.menuAdjustLeft)?(osdLeft + contentWidth + widthScrollbar + 2 * spaceMenu) - :(osdLeft + 2 * spaceMenu); + int windowX = (config.menuAdjustLeft)?(geoManager->osdLeft + contentWidth + geoManager->menuWidthScrollbar + 2 * geoManager->menuSpace) + :(geoManager->osdLeft + 2 * geoManager->menuSpace); cRect availableRect( windowX, - osdTop + headerHeight, - contentWidthFull - osdLeft - contentWidth - widthScrollbar - 4 * spaceMenu, - contentHeight); + geoManager->osdTop + geoManager->menuHeaderHeight, + geoManager->menuContentWidthFull - geoManager->osdLeft - contentWidth - geoManager->menuWidthScrollbar - 4 * geoManager->menuSpace, + geoManager->menuContentHeight); vidWin = cDevice::PrimaryDevice()->CanScaleVideo(availableRect); } } } osd->DestroyPixmap(pixmapScrollbar); - int scrollbarX = (config.menuAdjustLeft)?(contentWidth):(osdWidth - contentWidth - widthScrollbar); - pixmapScrollbar = osd->CreatePixmap(2, cRect(scrollbarX , headerHeight + spaceMenu, widthScrollbar, contentHeight - 2*spaceMenu)); + int scrollbarX = (config.menuAdjustLeft)?(contentWidth):(geoManager->osdWidth - contentWidth - geoManager->menuWidthScrollbar); + pixmapScrollbar = osd->CreatePixmap(2, cRect(scrollbarX , geoManager->menuHeaderHeight + geoManager->menuSpace, geoManager->menuWidthScrollbar, geoManager->menuContentHeight - 2*geoManager->menuSpace)); pixmapScrollbar->Fill(clrTransparent); } void cNopacityDisplayMenuView::DrawHeaderLogo(void) { - cImageLoader imgLoader; - if (imgLoader.LoadIcon("skinIcons/vdrlogo", config.menuHeaderLogoWidth, config.menuHeaderLogoHeight)) { - pixmapHeaderLogo->DrawImage(cPoint(0,0), imgLoader.GetImage()); - } + cImage *imgIcon = imgCache->GetSkinIcon("skinIcons/vdrlogo"); + if (imgIcon) + pixmapHeaderLogo->DrawImage(cPoint(0,0), *imgIcon); } int cNopacityDisplayMenuView::ShowHeaderLogo(bool show) { @@ -576,7 +407,7 @@ int cNopacityDisplayMenuView::ShowHeaderLogo(bool show) { } else { pixmapHeaderLogo->SetLayer(-1); } - return config.menuHeaderLogoWidth + spaceMenu; + return config.menuHeaderLogoWidth + geoManager->menuSpace; } int cNopacityDisplayMenuView::DrawHeaderIcon(eMenuCategory menuCat) { @@ -608,13 +439,13 @@ int cNopacityDisplayMenuView::DrawHeaderIcon(eMenuCategory menuCat) { int left = 0; if (drawIcon) { - int iconX = (config.menuAdjustLeft) ? 0 : (osdWidth - config.headerIconHeight); + int iconX = (config.menuAdjustLeft) ? 0 : (geoManager->osdWidth - config.headerIconHeight); pixmapHeaderIcon = osd->CreatePixmap(2, cRect(iconX, 0, config.headerIconHeight, config.headerIconHeight)); pixmapHeaderIcon->Fill(clrTransparent); - cImageLoader imgLoader; - if (imgLoader.LoadIcon(*icon, config.headerIconHeight)) { - pixmapHeaderIcon->DrawImage(cPoint(0,0), imgLoader.GetImage()); - left = config.headerIconHeight + spaceMenu; + cImage *imgIcon = imgCache->GetSkinIcon(*icon); + if (imgIcon) { + pixmapHeaderIcon->DrawImage(cPoint(0,0), *imgIcon); + left = config.headerIconHeight + geoManager->menuSpace; } } return left; @@ -622,7 +453,7 @@ int cNopacityDisplayMenuView::DrawHeaderIcon(eMenuCategory menuCat) { int cNopacityDisplayMenuView::ShowHeaderIconChannelLogo(const char *Title) { int left = 0; - int iconX = (config.menuAdjustLeft) ? 0 : (osdWidth - config.menuItemLogoWidth); + int iconX = (config.menuAdjustLeft) ? 0 : (geoManager->osdWidth - config.menuItemLogoWidth); pixmapHeaderIcon = osd->CreatePixmap(2, cRect(iconX, 0, config.menuItemLogoWidth, config.menuItemLogoHeight)); pixmapHeaderIcon->Fill(clrTransparent); std::string channel = Title; @@ -636,7 +467,7 @@ int cNopacityDisplayMenuView::ShowHeaderIconChannelLogo(const char *Title) { cImageLoader imgLoader; if (imgLoader.LoadLogo(channel.c_str(), config.menuItemLogoWidth, config.menuItemLogoHeight)) { pixmapHeaderIcon->DrawImage(cPoint(0, 0), imgLoader.GetImage()); - left = config.menuItemLogoWidth + spaceMenu; + left = config.menuItemLogoWidth + geoManager->menuSpace; } return left; } @@ -650,38 +481,35 @@ void cNopacityDisplayMenuView::DestroyHeaderIcon(void) { void cNopacityDisplayMenuView::DrawHeaderLabel(int left, cString label) { pixmapHeaderLabel->Fill(clrTransparent); - int labelW = fontHeader->Width(label); - int labelX = (config.menuAdjustLeft) ? (left) : (osdWidth - dateWidth - labelW - left - 2*spaceMenu); - pixmapHeaderLabel->DrawText(cPoint(labelX, ((headerHeight - 10) - fontHeader->Height()) / 2), *label, Theme.Color(clrMenuFontHeader), clrTransparent, fontHeader); + int labelW = fontManager->menuHeader->Width(label); + int labelX = (config.menuAdjustLeft) ? (left) : (geoManager->osdWidth - geoManager->menuDateWidth - labelW - left - 2*geoManager->menuSpace); + pixmapHeaderLabel->DrawText(cPoint(labelX, ((geoManager->menuHeaderHeight - 10) - fontManager->menuHeader->Height()) / 2), *label, Theme.Color(clrMenuFontHeader), clrTransparent, fontManager->menuHeader); } void cNopacityDisplayMenuView::DrawDate(bool initial) { cString date = DayDateTime(); if (initial || strcmp(date, lastDate)) { pixmapDate->Fill(clrTransparent); - int dateW = fontDate->Width(date); - int dateX = (config.menuAdjustLeft) ? (dateWidth - dateW - 2*spaceMenu) : (spaceMenu); - pixmapDate->DrawText(cPoint(dateX, (headerHeight - fontDate->Height()) / 2), date, Theme.Color(clrMenuFontDate), clrTransparent, fontDate); + int dateW = fontManager->menuDate->Width(date); + int dateX = (config.menuAdjustLeft) ? (geoManager->menuDateWidth - dateW - 2*geoManager->menuSpace) : (geoManager->menuSpace); + pixmapDate->DrawText(cPoint(dateX, (geoManager->menuHeaderHeight - fontManager->menuDate->Height()) / 2), date, Theme.Color(clrMenuFontDate), clrTransparent, fontManager->menuDate); lastDate = date; } } void cNopacityDisplayMenuView::DrawDiskUsage(void) { - int iconWidth = diskUsageWidth * 3/4; + int iconWidth = geoManager->menuDiskUsageWidth * 3/4; int DiskUsage = cVideoDiskUsage::UsedPercent(); bool DiskAlert = DiskUsage > diskUsageAlert; tColor bgColor = DiskAlert ? Theme.Color(clrDiskAlert) : Theme.Color(clrMenuBack); pixmapDiskUsage->Fill(Theme.Color(clrMenuBorder)); - pixmapDiskUsage->DrawRectangle(cRect(2,2,diskUsageWidth-4, diskUsageHeight-4), bgColor); - cImageLoader imgLoader; - if (imgLoader.LoadIcon("skinIcons/DiskUsage", iconWidth)) { - cImage icon = imgLoader.GetImage(); - pixmapDiskUsageIcon->DrawImage(cPoint((diskUsageWidth - iconWidth)/2,0), icon); - } - if (imgLoader.LoadIcon("skinIcons/discpercent", diskUsageWidth - 4, diskUsageHeight/5, false)) { - cImage icon = imgLoader.GetImage(); - pixmapDiskUsageIcon->DrawImage(cPoint(0,4*diskUsageHeight/5), icon); - } + pixmapDiskUsage->DrawRectangle(cRect(2,2,geoManager->menuDiskUsageWidth-4, geoManager->menuDiskUsageHeight-4), bgColor); + cImage *imgDisc = imgCache->GetSkinIcon("skinIcons/DiskUsage"); + if (imgDisc) + pixmapDiskUsageIcon->DrawImage(cPoint((geoManager->menuDiskUsageWidth - iconWidth)/2,0), *imgDisc); + cImage *imgDiscPerc = imgCache->GetSkinIcon("skinIcons/discpercent"); + if (imgDiscPerc) + pixmapDiskUsageIcon->DrawImage(cPoint(0,4*geoManager->menuDiskUsageHeight/5), *imgDiscPerc); pixmapDiskUsageLabel->Fill(clrTransparent); cString usage = cString::sprintf("%d%%", DiskUsage); cString rest; @@ -689,9 +517,9 @@ void cNopacityDisplayMenuView::DrawDiskUsage(void) { rest = cString::sprintf("%02d:%02dh %s", cVideoDiskUsage::FreeMinutes() / 60, cVideoDiskUsage::FreeMinutes() % 60, tr("free")); else rest = cString::sprintf("%d GB %s", cVideoDiskUsage::FreeMB() / 1024, tr("free")); - pixmapDiskUsageLabel->DrawRectangle(cRect((diskUsageWidth - 4)*DiskUsage/100,4*diskUsageHeight/5, (diskUsageWidth - 4) - (diskUsageWidth - 4)*DiskUsage/100, diskUsageHeight/5), 0xDD000000); - pixmapDiskUsageLabel->DrawText(cPoint((diskUsageWidth - fontDiskUsagePercent->Width(*usage))/2, 4*diskUsageHeight/5), *usage, Theme.Color(clrMenuFontDiscUsage), clrTransparent, fontDiskUsagePercent); - pixmapDiskUsageLabel->DrawText(cPoint((diskUsageWidth - fontDiskUsage->Width(*rest))/2, (diskUsageHeight - fontDiskUsage->Height())/2), *rest, Theme.Color(clrMenuFontDiscUsage), clrTransparent, fontDiskUsage); + pixmapDiskUsageLabel->DrawRectangle(cRect((geoManager->menuDiskUsageWidth - 4)*DiskUsage/100,4*geoManager->menuDiskUsageHeight/5, (geoManager->menuDiskUsageWidth - 4) - (geoManager->menuDiskUsageWidth - 4)*DiskUsage/100, geoManager->menuDiskUsageHeight/5), 0xDD000000); + pixmapDiskUsageLabel->DrawText(cPoint((geoManager->menuDiskUsageWidth - fontManager->menuDiskUsagePercent->Width(*usage))/2, 4*geoManager->menuDiskUsageHeight/5), *usage, Theme.Color(clrMenuFontDiscUsage), clrTransparent, fontManager->menuDiskUsagePercent); + pixmapDiskUsageLabel->DrawText(cPoint((geoManager->menuDiskUsageWidth - fontManager->menuDiskUsage->Width(*rest))/2, (geoManager->menuDiskUsageHeight - fontManager->menuDiskUsage->Height())/2), *rest, Theme.Color(clrMenuFontDiscUsage), clrTransparent, fontManager->menuDiskUsage); pixmapDiskUsage->SetLayer(2); pixmapDiskUsageIcon->SetLayer(3); @@ -710,16 +538,18 @@ void cNopacityDisplayMenuView::ShowDiskUsage(bool show) { } } -void cNopacityDisplayMenuView::DrawButton(const char *text, int handleImage, tColor buttonColor, tColor borderColor, tColor fontColor, int num) { +void cNopacityDisplayMenuView::DrawButton(const char *text, eBackgroundType bgButton, tColor buttonColor, tColor borderColor, tColor fontColor, int num) { if (num < 0) return; - int top = 2*buttonsBorder; - int left = num * buttonWidth + (2*num + 1) * buttonsBorder; + int top = 2*geoManager->menuButtonsBorder; + int left = num * geoManager->menuButtonWidth + (2*num + 1) * geoManager->menuButtonsBorder; if (config.doBlending) { - pixmapFooter->DrawRectangle(cRect(left, top, buttonWidth, buttonHeight), borderColor); - pixmapFooter->DrawImage(cPoint(left+2, top+2), handleImage); + pixmapFooter->DrawRectangle(cRect(left, top, geoManager->menuButtonWidth, geoManager->menuButtonHeight), borderColor); + cImage *back = imgCache->GetBackground(bgButton); + if (back) + pixmapFooter->DrawImage(cPoint(left+2, top+2), *back); } else { - pixmapFooter->DrawRectangle(cRect(left, top, buttonWidth, buttonHeight), buttonColor); + pixmapFooter->DrawRectangle(cRect(left, top, geoManager->menuButtonWidth, geoManager->menuButtonHeight), buttonColor); } if (config.roundedCorners) { int radius = config.cornerRadius; @@ -727,60 +557,60 @@ void cNopacityDisplayMenuView::DrawButton(const char *text, int handleImage, tCo pixmapFooter->DrawEllipse(cRect(left,top,radius,radius), borderColor, -2); pixmapFooter->DrawEllipse(cRect(left-2,top-2,radius,radius), Theme.Color(clrMenuBack), -2); - pixmapFooter->DrawEllipse(cRect(left + buttonWidth -radius, top,radius,radius), borderColor, -1); - pixmapFooter->DrawEllipse(cRect(left + buttonWidth -radius+2,top-2,radius,radius), Theme.Color(clrMenuBack), -1); + pixmapFooter->DrawEllipse(cRect(left + geoManager->menuButtonWidth -radius, top,radius,radius), borderColor, -1); + pixmapFooter->DrawEllipse(cRect(left + geoManager->menuButtonWidth -radius+2,top-2,radius,radius), Theme.Color(clrMenuBack), -1); - pixmapFooter->DrawEllipse(cRect(left,top + buttonHeight -radius,radius,radius), borderColor, -3); - pixmapFooter->DrawEllipse(cRect(left - 2, top + buttonHeight - radius + 2,radius,radius), Theme.Color(clrMenuBack), -3); + pixmapFooter->DrawEllipse(cRect(left,top + geoManager->menuButtonHeight -radius,radius,radius), borderColor, -3); + pixmapFooter->DrawEllipse(cRect(left - 2, top + geoManager->menuButtonHeight - radius + 2,radius,radius), Theme.Color(clrMenuBack), -3); - pixmapFooter->DrawEllipse(cRect(left + buttonWidth -radius, top + buttonHeight -radius,radius,radius), borderColor, -4); - pixmapFooter->DrawEllipse(cRect(left + buttonWidth -radius + 2, top + buttonHeight -radius + 2,radius,radius), Theme.Color(clrMenuBack), -4); + pixmapFooter->DrawEllipse(cRect(left + geoManager->menuButtonWidth -radius, top + geoManager->menuButtonHeight -radius,radius,radius), borderColor, -4); + pixmapFooter->DrawEllipse(cRect(left + geoManager->menuButtonWidth -radius + 2, top + geoManager->menuButtonHeight -radius + 2,radius,radius), Theme.Color(clrMenuBack), -4); } } - int textWidth = fontButtons->Width(text); - int textHeight = fontButtons->Height(); + int textWidth = fontManager->menuButtons->Width(text); + int textHeight = fontManager->menuButtons->Height(); tColor clrFontBack = (config.doBlending)?(clrTransparent):buttonColor; - pixmapFooter->DrawText(cPoint(left + (buttonWidth-textWidth)/2, top + (buttonHeight-textHeight)/2), text, fontColor, clrFontBack, fontButtons); + pixmapFooter->DrawText(cPoint(left + (geoManager->menuButtonWidth-textWidth)/2, top + (geoManager->menuButtonHeight-textHeight)/2), text, fontColor, clrFontBack, fontManager->menuButtons); } 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)); + int top = 2*geoManager->menuButtonsBorder; + int left = num * geoManager->menuButtonWidth + (2*num + 1) * geoManager->menuButtonsBorder; + pixmapFooter->DrawRectangle(cRect(left, top, geoManager->menuButtonWidth, geoManager->menuButtonHeight), Theme.Color(clrMenuBack)); } int cNopacityDisplayMenuView::GetTimersInitHeight(void) { - int initHeight = headerHeight + 2*spaceMenu; + int initHeight = geoManager->menuHeaderHeight + 2*geoManager->menuSpace; if (config.showDiscUsage) - initHeight += diskUsageHeight; + initHeight += geoManager->menuDiskUsageHeight; return initHeight; } int cNopacityDisplayMenuView::GetTimersMaxHeight(void) { - return headerHeight + contentHeight; + return geoManager->menuHeaderHeight + geoManager->menuContentHeight; } cNopacityTimer *cNopacityDisplayMenuView::DrawTimerConflict(int numConflicts, int y) { - cNopacityTimer *t = new cNopacityTimer(osd, numConflicts, fontTimers, fontTimersHead); - t->SetGeometry(timersWidth, y); + cNopacityTimer *t = new cNopacityTimer(osd, imgCache, numConflicts, fontManager->menuTimers, fontManager->menuTimersHead); + t->SetGeometry(geoManager->menuTimersWidth, y); t->CreateConflictText(); - t->CalculateHeight(spaceMenu); - int timerX = (config.menuAdjustLeft) ? (osdWidth - timersWidth - 10) : 10; + t->CalculateHeight(geoManager->menuSpace); + int timerX = (config.menuAdjustLeft) ? (geoManager->osdWidth - geoManager->menuTimersWidth - 10) : 10; t->CreatePixmaps(timerX); t->Render(); return t; } cNopacityTimer *cNopacityDisplayMenuView::DrawTimer(const cTimer *Timer, int y) { - cNopacityTimer *t = new cNopacityTimer(osd, Timer, fontTimers, fontTimersHead); - t->SetGeometry(timersWidth, y); + cNopacityTimer *t = new cNopacityTimer(osd, imgCache, Timer, fontManager->menuTimers, fontManager->menuTimersHead); + t->SetGeometry(geoManager->menuTimersWidth, y); t->CreateDate(); t->CreateShowName(); - t->CalculateHeight(spaceMenu); - int timerX = (config.menuAdjustLeft) ? (osdWidth - timersWidth - 10) : 10; + t->CalculateHeight(geoManager->menuSpace); + int timerX = (config.menuAdjustLeft) ? (geoManager->osdWidth - geoManager->menuTimersWidth - 10) : 10; t->CreatePixmaps(timerX); t->Render(); return t; @@ -791,8 +621,8 @@ void cNopacityDisplayMenuView::DrawScrollbar(double Height, double Offset) { int height = Height * totalHeight; int offset = Offset * totalHeight; pixmapScrollbar->Fill(Theme.Color(clrMenuScrollBar)); - pixmapScrollbar->DrawRectangle(cRect(2,2,widthScrollbar-4,totalHeight+2), Theme.Color(clrMenuScrollBarBack)); - pixmapScrollbar->DrawRectangle(cRect(3,3 + offset,widthScrollbar-6,height), Theme.Color(clrMenuScrollBar)); + pixmapScrollbar->DrawRectangle(cRect(2,2,geoManager->menuWidthScrollbar-4,totalHeight+2), Theme.Color(clrMenuScrollBarBack)); + pixmapScrollbar->DrawRectangle(cRect(3,3 + offset,geoManager->menuWidthScrollbar-6,height), Theme.Color(clrMenuScrollBar)); } void cNopacityDisplayMenuView::ClearScrollbar(void) { @@ -824,19 +654,18 @@ void cNopacityDisplayMenuView::DrawMessage(eMessageType Type, const char *Text) if (pixmapStatus) { ClearMessage(); } - pixmapStatus = osd->CreatePixmap(7, cRect(0.1*osdWidth, 0.8*osdHeight, messageWidth, messageHeight)); + pixmapStatus = osd->CreatePixmap(7, cRect(0.1*geoManager->osdWidth, 0.8*geoManager->osdHeight, geoManager->menuMessageWidth, geoManager->menuMessageHeight)); pixmapStatus->Fill(col); if (config.doBlending) { - cImageLoader imgLoader; - imgLoader.DrawBackground2(Theme.Color(clrMenuBack), col, messageWidth-2, messageHeight-2); - pixmapStatus->DrawImage(cPoint(1, 1), imgLoader.GetImage()); + cImage imgBack = imgCache->GetBackground(Theme.Color(clrMenuBack), col, geoManager->menuMessageWidth-2, geoManager->menuMessageHeight-2, true); + pixmapStatus->DrawImage(cPoint(1, 1), imgBack); } if (config.roundedCorners) { - DrawRoundedCornersWithBorder(pixmapStatus, col, config.cornerRadius, messageWidth, messageHeight); + DrawRoundedCornersWithBorder(pixmapStatus, col, config.cornerRadius, geoManager->menuMessageWidth, geoManager->menuMessageHeight); } - int textWidth = fontMessage->Width(Text); + int textWidth = fontManager->menuMessage->Width(Text); tColor clrFontBack = (config.doBlending)?(clrTransparent):col; - pixmapStatus->DrawText(cPoint((messageWidth - textWidth) / 2, (messageHeight - fontMessage->Height()) / 2), Text, colFont, clrFontBack, fontMessage); + pixmapStatus->DrawText(cPoint((geoManager->menuMessageWidth - textWidth) / 2, (geoManager->menuMessageHeight - fontManager->menuMessage->Height()) / 2), Text, colFont, clrFontBack, fontManager->menuMessage); } void cNopacityDisplayMenuView::ClearMessage(void) { @@ -847,7 +676,7 @@ void cNopacityDisplayMenuView::ClearMessage(void) { } void cNopacityDisplayMenuView::SetDetailViewSize(eDetailViewType detailViewType, cNopacityMenuDetailView *detailView) { - int x = (config.menuAdjustLeft) ? 0 : osdWidth - contentWidthFull + 2*spaceMenu; + int x = (config.menuAdjustLeft) ? 0 : geoManager->osdWidth - geoManager->menuContentWidthFull + 2*geoManager->menuSpace; int width = 0; int height = 0; int top = 0; @@ -869,45 +698,42 @@ void cNopacityDisplayMenuView::SetDetailViewSize(eDetailViewType detailViewType, default: break; } - width = contentWidthFull - 2*spaceMenu; - height = contentHeight; - top = headerHeight; + width = geoManager->menuContentWidthFull - 2*geoManager->menuSpace; + height = geoManager->menuContentHeight; + top = geoManager->menuHeaderHeight; detailView->SetGeometry(x, width, height, top, contentBorder, detailHeaderHeight); } void cNopacityDisplayMenuView::DrawRssFeed(std::string feedName) { pixmapRssFeedBackground->Fill(clrBlack); pixmapRssFeed->Fill(clrTransparent); - feedNameLength = fontRssFeed->Width(feedName.c_str()); - int labelWidth = 2 + rssFeedHeight + 2 + feedNameLength + 6; + feedNameLength = fontManager->menuRssFeed->Width(feedName.c_str()); + int labelWidth = 2 + geoManager->menuRssFeedHeight + 2 + feedNameLength + 6; pixmapRssFeed->Fill(Theme.Color(clrRSSFeedBorder)); - cImageLoader imgLoader; if (config.doBlending) { - imgLoader.DrawBackground(Theme.Color(clrRSSFeedHeaderBack), Theme.Color(clrRSSFeedHeaderBackBlend), labelWidth, rssFeedHeight - 4); - pixmapRssFeed->DrawImage(cPoint(2,2), imgLoader.GetImage()); - - imgLoader.DrawBackground(Theme.Color(clrRSSFeedBack), Theme.Color(clrRSSFeedBackBlend), osdWidth - labelWidth - 2, rssFeedHeight - 4); - pixmapRssFeed->DrawImage(cPoint(labelWidth,2), imgLoader.GetImage()); + cImage imgBack = imgCache->GetBackground(Theme.Color(clrRSSFeedHeaderBack), Theme.Color(clrRSSFeedHeaderBackBlend), labelWidth, geoManager->menuRssFeedHeight - 4); + pixmapRssFeed->DrawImage(cPoint(2,2), imgBack); + cImage imgBack2 = imgCache->GetBackground(Theme.Color(clrRSSFeedBack), Theme.Color(clrRSSFeedBackBlend), geoManager->osdWidth - labelWidth - 2, geoManager->menuRssFeedHeight - 4); + pixmapRssFeed->DrawImage(cPoint(labelWidth,2), imgBack2); } else { - pixmapRssFeed->DrawRectangle(cRect(2, 2, labelWidth, rssFeedHeight - 4), Theme.Color(clrRSSFeedHeaderBack)); - pixmapRssFeed->DrawRectangle(cRect(labelWidth, 2, osdWidth - labelWidth - 2, rssFeedHeight - 4), Theme.Color(clrRSSFeedBack)); + pixmapRssFeed->DrawRectangle(cRect(2, 2, labelWidth, geoManager->menuRssFeedHeight - 4), Theme.Color(clrRSSFeedHeaderBack)); + pixmapRssFeed->DrawRectangle(cRect(labelWidth, 2, geoManager->osdWidth - labelWidth - 2, geoManager->menuRssFeedHeight - 4), Theme.Color(clrRSSFeedBack)); } - pixmapRssFeed->DrawText(cPoint(rssFeedHeight + 2, (rssFeedHeight - fontRssFeed->Height()) / 2), feedName.c_str(), Theme.Color(clrRSSFeedHeaderText), clrTransparent, fontRssFeed); + pixmapRssFeed->DrawText(cPoint(geoManager->menuRssFeedHeight + 2, (geoManager->menuRssFeedHeight - fontManager->menuRssFeed->Height()) / 2), feedName.c_str(), Theme.Color(clrRSSFeedHeaderText), clrTransparent, fontManager->menuRssFeed); pixmapRssFeedIcon->Fill(clrTransparent); - if (imgLoader.LoadIcon("skinIcons/rss", rssFeedHeight-4)) { - cImage icon = imgLoader.GetImage(); - pixmapRssFeedIcon->DrawImage(cPoint(2,2), icon); - } + cImage *imgIcon = imgCache->GetSkinIcon("skinIcons/rss"); + if (imgIcon) + pixmapRssFeedIcon->DrawImage(cPoint(2,2), *imgIcon); } cPoint cNopacityDisplayMenuView::GetRssFeedPosition(void) { - int x = rssFeedHeight + feedNameLength + 10; - int y = osdHeight - rssFeedHeight + 2; + int x = geoManager->menuRssFeedHeight + feedNameLength + 10; + int y = geoManager->osdHeight - geoManager->menuRssFeedHeight + 2; return cPoint(x, y); } cPoint cNopacityDisplayMenuView::GetRssFeedSize(void) { - int width = osdWidth - (rssFeedHeight + feedNameLength + 12); - int height = rssFeedHeight - 4; + int width = geoManager->osdWidth - (geoManager->menuRssFeedHeight + feedNameLength + 12); + int height = geoManager->menuRssFeedHeight - 4; return cPoint(width, height); } |