From 52867d5436198d9f9e8d020b1bfb4037450e60ea Mon Sep 17 00:00:00 2001 From: louis Date: Sat, 5 Jan 2013 17:57:29 +0100 Subject: Added Separator Items for Schedule Menus --- menuitem.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/menuitem.c b/menuitem.c index 0dcac0f..ce66983 100644 --- a/menuitem.c +++ b/menuitem.c @@ -3,7 +3,6 @@ #include #include - // cNopacityMenuItem ------------- cNopacityMenuItem::cNopacityMenuItem(cOsd *osd, const char *text, bool sel) { @@ -95,7 +94,12 @@ void cNopacityMenuItem::DrawDelimiter(const char *del, const char *icon, int han drawn = true; } std::string delimiter = del; - delimiter.erase(delimiter.find_last_not_of("-")+1); + try { + if (delimiter.find_first_not_of("-") > 0) + delimiter.erase(0, delimiter.find_first_not_of("-")+1); + if (delimiter.find_last_not_of("-") != std::string::npos) + delimiter.erase(delimiter.find_last_not_of("-")+1); + } catch (...) {} int x = config.iconHeight + 3; int y = (height - font->Height()) / 2; pixmap->DrawText(cPoint(x, y), delimiter.c_str(), Theme.Color(clrMenuFontMenuItemSep), clrTransparent, font); @@ -425,9 +429,11 @@ void cNopacityScheduleMenuItem::Render() { infoTextWindow->Start(); } } else { - int handleBgrd = (current)?handleBackgrounds[5]:handleBackgrounds[4]; - pixmap->Fill(Theme.Color(clrMenuBorder)); - pixmap->DrawImage(cPoint(1, 1), handleBgrd); + if (Event) { + DrawDelimiter(Event->Title(), "daydelimiter", handleBackgrounds[4]); + } else if (Channel) { + DrawDelimiter(Channel->Name(), "Channelseparator", handleBackgrounds[4]); + } } } -- cgit v1.2.3