+ eServiceReference ref = *m_cursor;
+ bool isPlayable = !(ref.flags & eServiceReference::isDirectory || ref.flags & eServiceReference::isMarker);
+
+ if (!marked && isPlayable && service_info && m_is_playable_ignore.valid() && !service_info->isPlayable(*m_cursor, m_is_playable_ignore))
+ {
+ if (m_color_set[serviceNotAvail])
+ painter.setForegroundColor(m_color[serviceNotAvail]);
+ else
+ painter.setForegroundColor(gRGB(0xbbbbbb));
+ }
+
+ if (selected && local_style && local_style->m_selection)
+ painter.blit(local_style->m_selection, offset, eRect(), gPainter::BT_ALPHATEST);
+
+ int xoffset=0; // used as offset when painting the folder/marker symbol
+
+ for (int e = 0; e < celElements; ++e)
+ {
+ if (m_element_font[e])
+ {
+ int flags=gPainter::RT_VALIGN_CENTER,
+ yoffs = 0,
+ xoffs = xoffset;
+ eRect &area = m_element_position[e];
+ std::string text = "<n/a>";
+ xoffset=0;
+
+ switch (e)
+ {
+ case celServiceNumber:
+ {
+ if (m_cursor->flags & eServiceReference::isMarker)
+ continue;
+ char bla[10];
+ /* how we can do this better? :) */
+ int markers_before=0;
+ {
+ list::iterator tmp=m_cursor;
+ while(tmp != m_list.begin())
+ {
+ --tmp;
+ if (tmp->flags & eServiceReference::isMarker)
+ ++markers_before;
+ }
+ }
+ sprintf(bla, "%d", m_numberoffset + m_cursor_number + 1 - markers_before);
+ text = bla;
+ flags|=gPainter::RT_HALIGN_RIGHT;
+ break;
+ }
+ case celServiceName:
+ {
+ if (service_info)
+ service_info->getName(*m_cursor, text);
+ break;
+ }
+ case celServiceInfo:
+ {
+ ePtr<eServiceEvent> evt;
+ if ( isPlayable && service_info && !service_info->getEvent(*m_cursor, evt) )
+ {
+ std::string name = evt->getEventName();
+ if (!name.length())
+ continue;
+ text = '(' + evt->getEventName() + ')';
+ }
+ else
+ continue;
+ break;
+ }
+ }
+
+ eRect tmp = area;
+ tmp.setWidth(tmp.width()-xoffs);
+
+ eTextPara *para = new eTextPara(tmp);
+ para->setFont(m_element_font[e]);
+ para->renderString(text.c_str());
+
+ if (e == celServiceName)
+ {
+ eRect bbox = para->getBoundBox();
+ int name_width = bbox.width()+8;
+ m_element_position[celServiceInfo].setLeft(area.left()+name_width);
+ m_element_position[celServiceInfo].setTop(area.top());
+ m_element_position[celServiceInfo].setWidth(area.width()-name_width);
+ m_element_position[celServiceInfo].setHeight(area.height());
+ }
+
+ if (flags & gPainter::RT_HALIGN_RIGHT)
+ para->realign(eTextPara::dirRight);
+ else if (flags & gPainter::RT_HALIGN_CENTER)
+ para->realign(eTextPara::dirCenter);
+ else if (flags & gPainter::RT_HALIGN_BLOCK)
+ para->realign(eTextPara::dirBlock);
+
+ if (flags & gPainter::RT_VALIGN_CENTER)
+ {
+ eRect bbox = para->getBoundBox();
+ int vcentered_top = (area.height() - bbox.height()) / 2;
+ yoffs = vcentered_top - bbox.top();
+ }
+
+ painter.renderPara(para, offset+ePoint(xoffs, yoffs));
+ }
+ else if (e == celServiceTypePixmap || e == celFolderPixmap || e == celMarkerPixmap)
+ {
+ int orbpos = m_cursor->getUnsignedData(4) >> 16;
+ ePtr<gPixmap> &pixmap =
+ (e == celFolderPixmap) ? m_pixmaps[picFolder] :
+ (e == celMarkerPixmap) ? m_pixmaps[picMarker] :
+ (m_cursor->flags & eServiceReference::isGroup) ? m_pixmaps[picServiceGroup] :
+ (orbpos == 0xFFFF) ? m_pixmaps[picDVB_C] :
+ (orbpos == 0xEEEE) ? m_pixmaps[picDVB_T] : m_pixmaps[picDVB_S];
+ if (pixmap)
+ {
+ eSize pixmap_size = pixmap->size();
+ int p = celServiceInfo;
+ if (e == celFolderPixmap)
+ p = celServiceName;
+ else if (e == celMarkerPixmap)
+ p = celServiceNumber;
+ eRect area = m_element_position[p];
+ int correction = (area.height() - pixmap_size.height()) / 2;
+
+ if (isPlayable)
+ {
+ if (e != celServiceTypePixmap)
+ continue;
+ m_element_position[celServiceInfo] = area;
+ m_element_position[celServiceInfo].setLeft(area.left() + pixmap_size.width() + 8);
+ m_element_position[celServiceInfo].setWidth(area.width() - pixmap_size.width() - 8);
+ }
+ else if (m_cursor->flags & eServiceReference::isDirectory)
+ {
+ if (e != celFolderPixmap)
+ continue;
+ xoffset = pixmap_size.width() + 8;
+ }
+ else if (m_cursor->flags & eServiceReference::isMarker)
+ {
+ if (e != celMarkerPixmap)
+ continue;
+ }
+ else
+ eFatal("unknown service type in listboxservice");
+
+ area.moveBy(offset);
+ painter.clip(area);
+ painter.blit(pixmap, offset+ePoint(area.left(), correction), area, gPainter::BT_ALPHATEST);
+ painter.clippop();
+ }
+ }
+ }