its a bad idea to open a screen at every place..
[enigma2.git] / lib / gui / esubtitle.cpp
index ab07a8bfb2d71081fa6dc3369522c3a1558faeef..80211b4d33dbb43536f0b224db50310ae1817ee8 100644 (file)
@@ -52,11 +52,15 @@ void eSubtitleWidget::setPage(const eDVBTeletextSubtitlePage &p)
 
 void eSubtitleWidget::setPage(const eDVBSubtitlePage &p)
 {
+       eDebug("setPage");
        m_dvb_page = p;
        invalidate(m_visible_region);  // invalidate old visible regions
        m_visible_region.rects.clear();
        for (std::list<eDVBSubtitleRegion>::iterator it(m_dvb_page.m_regions.begin()); it != m_dvb_page.m_regions.end(); ++it)
+       {
+               eDebug("add %d %d %d %d", it->m_position.x(), it->m_position.y(), it->m_pixmap->size().width(), it->m_pixmap->size().height());
                m_visible_region.rects.push_back(eRect(it->m_position, it->m_pixmap->size()));
+       }
        m_dvb_page_ok = 1;
        m_hide_subtitles_timer.start(7500, true);
        invalidate(m_visible_region);  // invalidate new regions
@@ -71,6 +75,12 @@ void eSubtitleWidget::clearPage()
        m_visible_region.rects.clear();
 }
 
+void eSubtitleWidget::setPixmap(ePtr<gPixmap> &pixmap, gRegion changed)
+{
+       m_pixmap = pixmap;
+       invalidate(changed);
+}
+
 int eSubtitleWidget::event(int event, void *data, void *data2)
 {
        switch (event)
@@ -81,14 +91,15 @@ int eSubtitleWidget::event(int event, void *data, void *data2)
                gPainter &painter = *(gPainter*)data2;
 
                getStyle(style);
-               
                eWidget::event(event, data, data2);
-               ePtr<gFont> font = new gFont("Regular", 38);
-               painter.setFont(font);
-               
-               if (m_page_ok)
+
+               if (m_pixmap)
+                       painter.blit(m_pixmap, ePoint(0,0));
+               else if (m_page_ok)
                {
                        int elements = m_page.m_elements.size();
+                       ePtr<gFont> font = new gFont("Regular", 38);
+                       painter.setFont(font);
                        for (int i=0; i<elements; ++i)
                        {
                                eDVBTeletextSubtitlePageElement &element = m_page.m_elements[i];