diff --git a/src/gui/eventlist.cpp b/src/gui/eventlist.cpp index 936606b12..ca9279da9 100644 --- a/src/gui/eventlist.cpp +++ b/src/gui/eventlist.cpp @@ -4,13 +4,6 @@ Copyright (C) 2001 Steffen Hehn 'McClean' Homepage: http://dbox.cyberphoria.org/ - Kommentar: - - Diese GUI wurde von Grund auf neu programmiert und sollte nun vom - Aufbau und auch den Ausbaumoeglichkeiten gut aussehen. Neutrino basiert - auf der Client-Server Idee, diese GUI ist also von der direkten DBox- - Steuerung getrennt. Diese wird dann von Daemons uebernommen. - License: GPL @@ -44,6 +37,7 @@ #include #include #include +#include // FIXME should be included by cc.h in eventlist.h #include #include "widget/hintbox.h" @@ -104,14 +98,13 @@ CNeutrinoEventList::CNeutrinoEventList() m_search_channel_id = 1; m_search_bouquet_id= 1; - fw = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getWidth(); //font width - fh = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight(); //font height - width = w_max (62 * fw, 40); - height = h_max (23 * fh, 20); + full_width = width = fw = 0; + height = fh = 0; - x = frameBuffer->getScreenX() + (frameBuffer->getScreenWidth() - width) / 2; - y = frameBuffer->getScreenY() + (frameBuffer->getScreenHeight() - height) / 2; + x = y = 0; + cc_infozone = NULL; + infozone_text = ""; item_event_ID = 0; FunctionBarHeight = 0; } @@ -247,6 +240,16 @@ int CNeutrinoEventList::exec(const t_channel_id channel_id, const std::string& c showfollow = false; // Calculate iheight struct button_label tmp_button[1] = { { NEUTRINO_ICON_BUTTON_RED, NONEXISTANT_LOCALE } }; + + fw = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getWidth(); //font width + fh = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight(); //font height + + full_width = frameBuffer->getScreenWidthRel(); + x = getScreenStartX(full_width); + + width = full_width / 3 * 2; + height = frameBuffer->getScreenHeightRel(); + iheight = ::paintButtons(0, 0, 0, 1, tmp_button, 0, 0, false, COL_INFOBAR_SHADOW, NULL, 0, false); if(iheight < fh) iheight = fh; @@ -269,9 +272,15 @@ int CNeutrinoEventList::exec(const t_channel_id channel_id, const std::string& c fwidth1 = g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_DATETIME]->getRenderWidth("DDD, 00:00, "); fwidth2 = g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_ITEMSMALL]->getRenderWidth("[999 min] "); - listmaxshow = (height-theight-iheight-0)/fheight; height = theight+iheight+0+listmaxshow*fheight; // recalc height + y = getScreenStartY(height); + + // calculate width of right info_zone + infozone_width = full_width - width; + + // init right info_zone + cc_infozone = new CComponentsInfoBox(x+width+5, y+theight+10, infozone_width-10, listmaxshow*fheight-20); int res = menu_return::RETURN_REPAINT; //printf("CNeutrinoEventList::exec: channel_id %llx\n", channel_id); @@ -355,6 +364,7 @@ int CNeutrinoEventList::exec(const t_channel_id channel_id, const std::string& c selected -= step; if((prev_selected-step) < 0) // because of uint selected = evtlist.size() - 1; + paintDescription(selected); } else if (msg == CRCInput::RC_down || (int) msg == g_settings.key_channelList_pagedown) { @@ -368,6 +378,7 @@ int CNeutrinoEventList::exec(const t_channel_id channel_id, const std::string& c else selected = ((step == (int)listmaxshow) && (selected < (((evtlist.size() / listmaxshow) + 1) * listmaxshow))) ? (evtlist.size() - 1) : 0; } + paintDescription(selected); } paintItem(prev_selected - liststart, channel_id); unsigned int oldliststart = liststart; @@ -653,12 +664,16 @@ int CNeutrinoEventList::exec(const t_channel_id channel_id, const std::string& c hide(); fader.Stop(); + + delete cc_infozone; + cc_infozone = NULL; + return res; } void CNeutrinoEventList::hide() { - frameBuffer->paintBackgroundBoxRel(x,y, width,height); + frameBuffer->paintBackgroundBoxRel(x,y, full_width,height); showFunctionBar (false, 0); } @@ -695,7 +710,6 @@ void CNeutrinoEventList::paintItem(unsigned int pos, t_channel_id channel_idI) bgcolor = COL_MENUCONTENTSELECTED_PLUS_0; if(RADIUS_LARGE) frameBuffer->paintBoxRel(x, ypos, width- 15, fheight, COL_MENUCONTENT_PLUS_0, 0); - } else if (curpos == current_event ) { @@ -783,22 +797,38 @@ void CNeutrinoEventList::paintItem(unsigned int pos, t_channel_id channel_idI) // paint 2nd line text g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_ITEMLARGE]->RenderString(x+10+iw, ypos+ fheight, width- 25- 20 -iw, evtlist[curpos].description, color, 0, true); - - } } + +void CNeutrinoEventList::paintDescription(int index) +{ + CEPGData epgData; + if ( evtlist[index].eventID != 0 ) + CEitManager::getInstance()->getEPGid(evtlist[index].eventID, evtlist[index].startTime, &epgData); + else + CEitManager::getInstance()->getActualEPGServiceKey(evtlist[index].channelID, &epgData ); + + if(!epgData.info2.empty()) + infozone_text = epgData.info2.c_str(); + else + infozone_text = g_Locale->getText(LOCALE_EPGLIST_NOEVENTS); + + cc_infozone->setText(infozone_text, CTextBox::TOP, g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_ITEMLARGE]); + cc_infozone->paint(); +} + void CNeutrinoEventList::paintHead(std::string _channelname, std::string _channelname_prev, std::string _channelname_next) { const short font_h = 8; int iw = 0, ih = 0; frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_INFO, &iw, &ih); - frameBuffer->paintBoxRel(x,y, width,theight+0, COL_MENUHEAD_PLUS_0, RADIUS_LARGE, CORNER_TOP); - int name_width =((width-8-iw)/3); + frameBuffer->paintBoxRel(x,y, full_width,theight+0, COL_MENUHEAD_PLUS_0, RADIUS_LARGE, CORNER_TOP); + int name_width =((full_width-8-iw)/3); short prev_len = g_Font[font_h]->getRenderWidth(_channelname_prev.c_str(),true); short next_len = g_Font[font_h]->getRenderWidth(_channelname_next.c_str(),true); short middle_len = g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_TITLE]->getRenderWidth(_channelname.c_str(),true); - short middle_offset = (width- next_len- prev_len- middle_len-iw-8)/2; + short middle_offset = (full_width- next_len- prev_len- middle_len-iw-8)/2; if(middle_offset < 0){ int fw_h = g_Font[font_h]->getWidth(); int newsize = abs(middle_offset / fw_h) + 1; @@ -810,28 +840,28 @@ void CNeutrinoEventList::paintHead(std::string _channelname, std::string _channe middle_offset = 0; } - g_Font[font_h]->RenderString(x+4,y+theight+1, width, _channelname_prev.c_str(), COL_INFOBAR, 0, true); // UTF-8 - g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_TITLE]->RenderString(x+prev_len+middle_offset,y+theight+1, width, _channelname.c_str(), COL_MENUHEAD, 0, true); // UTF-8 - g_Font[font_h]->RenderString(x+(name_width*3)- next_len,y+theight+1, width, _channelname_next.c_str(), COL_INFOBAR, 0, true); // UTF-8 + g_Font[font_h]->RenderString(x+4,y+theight+1, full_width, _channelname_prev.c_str(), COL_INFOBAR, 0, true); // UTF-8 + g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_TITLE]->RenderString(x+prev_len+middle_offset,y+theight+1, full_width, _channelname.c_str(), COL_MENUHEAD, 0, true); // UTF-8 + g_Font[font_h]->RenderString(x+(name_width*3)- next_len,y+theight+1, full_width, _channelname_next.c_str(), COL_INFOBAR, 0, true); // UTF-8 } void CNeutrinoEventList::paintHead(t_channel_id _channel_id, std::string _channelname) { bool logo_ok = false; - frameBuffer->paintBoxRel(x,y, width,theight+0, COL_MENUHEAD_PLUS_0, RADIUS_LARGE, CORNER_TOP); + frameBuffer->paintBoxRel(x,y, full_width,theight+0, COL_MENUHEAD_PLUS_0, RADIUS_LARGE, CORNER_TOP); std::string lname; int logo_w = 0; int logo_h = 0; - int logo_w_max = width / 4; + int logo_w_max = full_width / 4; if(g_settings.infobar_show_channellogo && g_PicViewer->GetLogoName(_channel_id, _channelname, lname, &logo_w, &logo_h)){ if((logo_h > theight) || (logo_w > logo_w_max)) g_PicViewer->rescaleImageDimensions(&logo_w, &logo_h, logo_w_max, theight); logo_ok = g_PicViewer->DisplayImage(lname, x+10, y+(theight-logo_h)/2, logo_w, logo_h); } else - g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_TITLE]->RenderString(x+15+(logo_ok? 5+logo_w:0),y+theight+1, width, _channelname.c_str(), COL_MENUHEAD, 0, true); // UTF-8 + g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_TITLE]->RenderString(x+15+(logo_ok? 5+logo_w:0),y+theight+1, full_width, _channelname.c_str(), COL_MENUHEAD, 0, true); // UTF-8 } void CNeutrinoEventList::paint(t_channel_id channel_id) @@ -841,15 +871,20 @@ void CNeutrinoEventList::paint(t_channel_id channel_id) int iw = 0, ih = 0; if (evtlist[0].eventID != 0) { frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_INFO, &iw, &ih); - frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_INFO, x+ width - 4 - iw, y, theight); + frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_INFO, x+ full_width - 4 - iw, y, theight); } + // paint background for right box + frameBuffer->paintBoxRel(x+width,y+theight,infozone_width,listmaxshow*fheight,COL_MENUCONTENT_PLUS_0); for(unsigned int count=0;countpaintBoxRel(x+ width- 15,ypos, 15, sb, COL_MENUCONTENT_PLUS_1); @@ -891,7 +926,7 @@ void CNeutrinoEventList::showFunctionBar (bool show, t_channel_id channel_id) { int border_space = 4; int bx = x + 2*border_space; - int bw = width - 16; + int bw = full_width - 16; int bh = iheight; int by = y + height-iheight; int w_button = bw / 4 - border_space;// 4 cells @@ -902,7 +937,7 @@ void CNeutrinoEventList::showFunctionBar (bool show, t_channel_id channel_id) // std::string btncaption; bh = std::max(FunctionBarHeight, bh); - frameBuffer->paintBackgroundBoxRel(x,by,width,bh); + frameBuffer->paintBackgroundBoxRel(x,by,full_width,bh); // -- hide only? if (! show) return; @@ -910,7 +945,7 @@ void CNeutrinoEventList::showFunctionBar (bool show, t_channel_id channel_id) frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_RED, &icol_w, &icol_h); // int fh = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight(); - frameBuffer->paintBoxRel(x, by, width, iheight, COL_INFOBAR_SHADOW_PLUS_1, RADIUS_MID, CORNER_BOTTOM); + frameBuffer->paintBoxRel(x, by, full_width, iheight, COL_INFOBAR_SHADOW_PLUS_1, RADIUS_MID, CORNER_BOTTOM); int tID = -1; //any value, not NULL CTimerd::CTimerEventTypes is_timer = isScheduled(channel_id, &evtlist[selected], &tID); @@ -1307,4 +1342,3 @@ bool CEventFinderMenu::changeNotify(const neutrino_locale_t OptionName, void *) return false; } - diff --git a/src/gui/eventlist.h b/src/gui/eventlist.h index 41a128cfa..e492b72de 100644 --- a/src/gui/eventlist.h +++ b/src/gui/eventlist.h @@ -4,13 +4,6 @@ Copyright (C) 2001 Steffen Hehn 'McClean' Homepage: http://dbox.cyberphoria.org/ - Kommentar: - - Diese GUI wurde von Grund auf neu programmiert und sollte nun vom - Aufbau und auch den Ausbaumoeglichkeiten gut aussehen. Neutrino basiert - auf der Client-Server Idee, diese GUI ist also von der direkten DBox- - Steuerung getrennt. Diese wird dann von Daemons uebernommen. - License: GPL @@ -41,6 +34,7 @@ #include #include #include +#include #include "color.h" #include "infoviewer.h" @@ -100,14 +94,17 @@ class CNeutrinoEventList int key; std::string search_head_name; - int width, fw; - int height, fh; + int full_width, width, infozone_width, fw; + int height, infozone_height, fh; int x; int y; + std::string infozone_text; int sort_mode; event_id_t item_event_ID; + CComponentsInfoBox *cc_infozone; void paintItem(unsigned pos, t_channel_id channel_id = 0); + void paintDescription(int index); void paint(t_channel_id channel_id = 0); void paintHead(t_channel_id channel_id, std::string name); void paintHead(std::string _channelname, std::string _channelname_prev, std::string _channelname_next);