From: Felix Domke Date: Fri, 15 Apr 2005 18:00:24 +0000 (+0000) Subject: - sdl is now default output X-Git-Tag: 2.6.0~5913 X-Git-Url: https://git.cweiske.de/enigma2.git/commitdiff_plain/44433f650cd3e5f9f66253b74d194fcb01578595 - sdl is now default output - added skinned window style - added background colors - some RGB color support (but still not how i like it) - some minor bugfixes --- diff --git a/lib/components/scan.cpp b/lib/components/scan.cpp index 8fb60b58..c82d04ef 100644 --- a/lib/components/scan.cpp +++ b/lib/components/scan.cpp @@ -59,7 +59,9 @@ int eComponentScan::start() ePtr mgr; eDVBResourceManager::getInstance(mgr); - + + eDVBFrontendParameters *fe = new eDVBFrontendParameters(); +#if 0 eDVBFrontendParametersSatellite fesat; fesat.frequency = 11817000; // 12070000; @@ -69,9 +71,20 @@ int eComponentScan::start() fesat.inversion = eDVBFrontendParametersSatellite::Inversion::Off; fesat.orbital_position = 192; - eDVBFrontendParameters *fe = new eDVBFrontendParameters(); fe->setDVBS(fesat); +#endif + + eDVBFrontendParametersTerrestrial fet; + fet.frequency = 626000000; + fet.inversion = eDVBFrontendParametersTerrestrial::Inversion::Unknown; + fet.bandwidth = eDVBFrontendParametersTerrestrial::Bandwidth::Bw8MHz; + fet.code_rate_HP = fet.code_rate_LP = eDVBFrontendParametersTerrestrial::FEC::fAuto; + fet.modulation = eDVBFrontendParametersTerrestrial::Modulation::QAM16; + fet.transmission_mode = eDVBFrontendParametersTerrestrial::TransmissionMode::TM8k; + fet.guard_interval = eDVBFrontendParametersTerrestrial::GuardInterval::GI_1_32; + fet.hierarchy = eDVBFrontendParametersTerrestrial::Hierarchy::HNone; + fe->setDVBT(fet); ePtr channel; diff --git a/lib/dvb/frontend.cpp b/lib/dvb/frontend.cpp index 690824db..1322ea23 100644 --- a/lib/dvb/frontend.cpp +++ b/lib/dvb/frontend.cpp @@ -261,7 +261,7 @@ eDVBFrontend::eDVBFrontend(int adap, int fe, int &ok): m_type(-1) ok = 0; return; } - eDebug("detected %s frontend", "satellite\0cable\0 terrestrial"+feSatellite*9); + eDebug("detected %s frontend", "satellite\0cable\0 terrestrial"+fe_info.type*9); ok = 1; m_sn = new eSocketNotifier(eApp, m_fd, eSocketNotifier::Read); @@ -365,6 +365,8 @@ RESULT eDVBFrontend::tune(const iDVBFrontendParameters &where) feEvent(-1); + eDebug("eDVBFrontend::tune. type: %d", m_type); + switch (m_type) { case feSatellite: @@ -403,11 +405,69 @@ RESULT eDVBFrontend::tune(const iDVBFrontendParameters &where) { eDVBFrontendParametersTerrestrial feparm; if (where.getDVBT(feparm)) + { + eDebug("no -T data"); + return -EINVAL; + } + parm.frequency = feparm.frequency; + + switch (feparm.bandwidth) + { + case eDVBFrontendParametersTerrestrial::Bandwidth::Bw8MHz: + parm.u.ofdm.bandwidth = BANDWIDTH_8_MHZ; + break; + case eDVBFrontendParametersTerrestrial::Bandwidth::Bw7MHz: + parm.u.ofdm.bandwidth = BANDWIDTH_7_MHZ; + break; + case eDVBFrontendParametersTerrestrial::Bandwidth::Bw6MHz: + parm.u.ofdm.bandwidth = BANDWIDTH_6_MHZ; + break; + case eDVBFrontendParametersTerrestrial::Bandwidth::BwAuto: + parm.u.ofdm.bandwidth = BANDWIDTH_AUTO; + break; + default: + eWarning("invalid OFDM bandwith"); return -EINVAL; - eFatal("terrestrial tuning nyi"); + } + + parm.u.ofdm.code_rate_HP = FEC_AUTO; + parm.u.ofdm.code_rate_LP = FEC_AUTO; + + switch (feparm.modulation) + { + case eDVBFrontendParametersTerrestrial::Modulation::QPSK: + parm.u.ofdm.constellation = QPSK; + break; + case eDVBFrontendParametersTerrestrial::Modulation::QAM16: + parm.u.ofdm.constellation = QAM_16; + break; + case eDVBFrontendParametersTerrestrial::Modulation::Auto: + parm.u.ofdm.constellation = QAM_AUTO; + break; + } + + switch (feparm.transmission_mode) + { + case eDVBFrontendParametersTerrestrial::TransmissionMode::TM2k: + parm.u.ofdm.transmission_mode = TRANSMISSION_MODE_2K; + break; + case eDVBFrontendParametersTerrestrial::TransmissionMode::TM8k: + parm.u.ofdm.transmission_mode = TRANSMISSION_MODE_8K; + break; + case eDVBFrontendParametersTerrestrial::TransmissionMode::TMAuto: + parm.u.ofdm.transmission_mode = TRANSMISSION_MODE_AUTO; + break; + } + + parm.u.ofdm.guard_interval = GUARD_INTERVAL_AUTO; + parm.u.ofdm.hierarchy_information = HIERARCHY_AUTO; + parm.inversion = INVERSION_AUTO; + break; } } + eDebug("setting frontend..\n"); + if (ioctl(m_fd, FE_SET_FRONTEND, &parm) == -1) { perror("FE_SET_FRONTEND failed"); diff --git a/lib/dvb/idvb.h b/lib/dvb/idvb.h index da626866..c201c1a4 100644 --- a/lib/dvb/idvb.h +++ b/lib/dvb/idvb.h @@ -291,7 +291,57 @@ struct eDVBFrontendParametersCable struct eDVBFrontendParametersTerrestrial { - int unknown; + unsigned int frequency; + struct Bandwidth { + enum { Bw8MHz, Bw7MHz, Bw6MHz, BwAuto }; + }; + + struct FEC + { + enum { + fNone, f1_2, f2_3, f3_4, f5_6, f7_8, fAuto + }; + }; + + struct TransmissionMode { + enum { + TM2k, TM8k, TMAuto + }; + }; + + struct GuardInterval { + enum { + GI_1_32, GI_1_16, GI_1_8, GI_1_4, GI_Auto + }; + }; + + struct Hierarchy { + enum { + HNone, H1, H2, H4, HAuto + }; + }; + + struct Modulation { + enum { + QPSK, QAM16, Auto + }; + }; + + struct Inversion + { + enum { + On, Off, Unknown + }; + }; + + int bandwidth; + int code_rate_HP, code_rate_LP; + int modulation; + int transmission_mode; + int guard_interval; + int hierarchy; + int inversion; + void set(const TerrestrialDeliverySystemDescriptor &); }; diff --git a/lib/dvb/specs.h b/lib/dvb/specs.h index 54457342..1a0353e5 100644 --- a/lib/dvb/specs.h +++ b/lib/dvb/specs.h @@ -38,7 +38,7 @@ public: { m_spec.pid = ServiceDescriptionTable::PID; m_spec.tid = ServiceDescriptionTable::TID; - m_spec.timeout = ServiceDescriptionTable::TIMEOUT; + m_spec.timeout = 20000; // ServiceDescriptionTable::TIMEOUT; m_spec.flags = eDVBTableSpec::tfAnyVersion | eDVBTableSpec::tfHaveTID | eDVBTableSpec::tfCheckCRC | eDVBTableSpec::tfHaveTimeout; diff --git a/lib/gdi/epng.cpp b/lib/gdi/epng.cpp index 0d1072f8..8a4c3f4c 100644 --- a/lib/gdi/epng.cpp +++ b/lib/gdi/epng.cpp @@ -66,7 +66,7 @@ int loadPNG(ePtr &result, const char *filename) png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, 0, 0, 0); -// eDebug("%s: %dx%dx%d png, %d", filename, (int)width, (int)height, (int)bit_depth, color_type); + eDebug("%s: %dx%dx%d png, %d", filename, (int)width, (int)height, (int)bit_depth, color_type); if (color_type != 6) { diff --git a/lib/gdi/gfbdc.cpp b/lib/gdi/gfbdc.cpp index d5ce9f3c..83ffed2b 100644 --- a/lib/gdi/gfbdc.cpp +++ b/lib/gdi/gfbdc.cpp @@ -157,4 +157,4 @@ void gFBDC::reloadSettings() setPalette(); } -eAutoInitPtr init_gFBDC(eAutoInitNumbers::graphic-1, "GFBDC"); +// eAutoInitPtr init_gFBDC(eAutoInitNumbers::graphic-1, "GFBDC"); diff --git a/lib/gdi/gpixmap.cpp b/lib/gdi/gpixmap.cpp index fe0c0a1f..e9c469c4 100644 --- a/lib/gdi/gpixmap.cpp +++ b/lib/gdi/gpixmap.cpp @@ -139,9 +139,9 @@ void gPixmap::blit(const gPixmap &src, ePoint pos, const gRegion &clip, int flag { for (unsigned int i=0; idata; __u8 *dstptr=(__u8*)surface->data; - srcptr+=srcarea.left()*surface->bypp+srcarea.top()*src.surface->stride; + srcptr+=srcarea.left()*src.surface->bypp+srcarea.top()*src.surface->stride; dstptr+=area.left()*surface->bypp+area.top()*surface->stride; for (int y=0; ybypp+srcarea.top()*src.surface->stride; + srcptr+=srcarea.left()*src.surface->bypp+srcarea.top()*src.surface->stride; dstptr+=area.left()*surface->bypp+area.top()*surface->stride; for (int y=0; yclut.colors) || (!target.surface->clut.colors)) return; +#if 0 gColor *lookup=new gColor[surface->clut.colors]; for (int i=0; iclut.colors; i++) @@ -253,6 +255,7 @@ void gPixmap::mergePalette(const gPixmap &target) } delete [] lookup; +#endif } static inline int sgn(int a) diff --git a/lib/gdi/gpixmap.h b/lib/gdi/gpixmap.h index f29a0fe7..d598fdbd 100644 --- a/lib/gdi/gpixmap.h +++ b/lib/gdi/gpixmap.h @@ -97,8 +97,9 @@ struct gSurfaceSystem: gSurface ~gSurfaceSystem(); }; -struct gPixmap: public iObject +class gPixmap: public iObject { +private: DECLARE_REF(gPixmap); private: friend class gDC; @@ -121,7 +122,7 @@ public: gPixmap *lock(); void unlock(); - eSize getSize() const { return eSize(surface->x, surface->y); } + eSize size() const { return eSize(surface->x, surface->y); } gPixmap(gSurface *surface); gPixmap(eSize, int bpp); diff --git a/lib/gdi/grc.cpp b/lib/gdi/grc.cpp index 3b5476a2..9cb1a072 100644 --- a/lib/gdi/grc.cpp +++ b/lib/gdi/grc.cpp @@ -1,5 +1,5 @@ // for debugging use: -// #define SYNC_PAINT +#define SYNC_PAINT #include #ifndef SYNC_PAINT #include @@ -116,6 +116,28 @@ void gPainter::setForegroundColor(const gColor &color) m_rc->submit(o); } +void gPainter::setBackgroundColor(const gRGB &color) +{ + gOpcode o; + o.opcode = gOpcode::setBackgroundColorRGB; + o.dc = m_dc.grabRef(); + o.parm.setColorRGB = new gOpcode::para::psetColorRGB; + o.parm.setColorRGB->color = color; + + m_rc->submit(o); +} + +void gPainter::setForegroundColor(const gRGB &color) +{ + gOpcode o; + o.opcode = gOpcode::setForegroundColorRGB; + o.dc = m_dc.grabRef(); + o.parm.setColorRGB = new gOpcode::para::psetColorRGB; + o.parm.setColorRGB->color = color; + + m_rc->submit(o); +} + void gPainter::setFont(gFont *font) { gOpcode o; @@ -221,9 +243,10 @@ void gPainter::setPalette(gRGB *colors, int start, int len) void gPainter::mergePalette(gPixmap *target) { gOpcode o; - o.opcode=gOpcode::mergePalette; + o.opcode = gOpcode::mergePalette; o.dc = m_dc.grabRef(); target->AddRef(); + o.parm.mergePalette = new gOpcode::para::pmergePalette; o.parm.mergePalette->target = target; m_rc->submit(o); } @@ -336,6 +359,14 @@ void gDC::exec(gOpcode *o) m_foreground_color = o->parm.setColor->color; delete o->parm.setColor; break; + case gOpcode::setBackgroundColorRGB: + m_background_color = m_pixmap->surface->clut.findColor(o->parm.setColorRGB->color); + delete o->parm.setColorRGB; + break; + case gOpcode::setForegroundColorRGB: + m_foreground_color = m_pixmap->surface->clut.findColor(o->parm.setColorRGB->color); + delete o->parm.setColorRGB; + break; case gOpcode::setFont: m_current_font = o->parm.setFont->font; o->parm.setFont->font->Release(); @@ -404,7 +435,8 @@ void gDC::exec(gOpcode *o) if (o->parm.blit->clip.valid()) { - clip.intersect(gRegion(o->parm.blit->clip), clip); + o->parm.blit->clip.moveBy(m_current_offset); + clip.intersect(gRegion(o->parm.blit->clip), m_current_clip); } else clip = m_current_clip; @@ -426,12 +458,10 @@ void gDC::exec(gOpcode *o) delete o->parm.setPalette; break; case gOpcode::mergePalette: -#if 0 - pixmap->mergePalette(*o->parm.blit->pixmap); - o->parm.blit->pixmap->unlock(); - delete o->parm.blit; -#endif - break; + m_pixmap->mergePalette(*o->parm.mergePalette->target); + o->parm.mergePalette->target->Release(); + delete o->parm.mergePalette; + break; case gOpcode::line: { ePoint start = o->parm.line->start + m_current_offset, end = o->parm.line->end + m_current_offset; @@ -447,7 +477,7 @@ void gDC::exec(gOpcode *o) break; case gOpcode::setClip: o->parm.clip->region.moveBy(m_current_offset); - m_current_clip = o->parm.clip->region & eRect(ePoint(0, 0), m_pixmap->getSize()); + m_current_clip = o->parm.clip->region & eRect(ePoint(0, 0), m_pixmap->size()); delete o->parm.clip; break; case gOpcode::popClip: diff --git a/lib/gdi/grc.h b/lib/gdi/grc.h index 8de5dadf..57439178 100644 --- a/lib/gdi/grc.h +++ b/lib/gdi/grc.h @@ -41,6 +41,9 @@ struct gOpcode setBackgroundColor, setForegroundColor, + setBackgroundColorRGB, + setForegroundColorRGB, + setOffset, setClip, addClip, popClip, @@ -114,6 +117,11 @@ struct gOpcode gColor color; } *setColor; + struct psetColorRGB + { + gRGB color; + } *setColorRGB; + struct psetOffset { ePoint value; @@ -176,6 +184,9 @@ public: void setBackgroundColor(const gColor &color); void setForegroundColor(const gColor &color); + void setBackgroundColor(const gRGB &color); + void setForegroundColor(const gRGB &color); + void setFont(gFont *font); /* flags only THESE: */ enum @@ -240,7 +251,7 @@ public: gRegion &getClip() { return m_current_clip; } int getPixmap(ePtr &pm) { pm = m_pixmap; return 0; } gRGB getRGB(gColor col); - virtual eSize getSize() { return m_pixmap->getSize(); } + virtual eSize size() { return m_pixmap->size(); } }; #endif diff --git a/lib/gui/Makefile.am b/lib/gui/Makefile.am index 076ee36a..44f5a16d 100644 --- a/lib/gui/Makefile.am +++ b/lib/gui/Makefile.am @@ -7,6 +7,6 @@ noinst_LIBRARIES = libenigma_gui.a libenigma_gui_a_SOURCES = \ ebutton.cpp elabel.cpp eslider.cpp ewidget.cpp ewidgetdesktop.cpp \ ewindow.cpp ewindowstyle.cpp elistbox.cpp elistboxcontent.cpp \ - epixmap.cpp + epixmap.cpp ewindowstyleskinned.cpp diff --git a/lib/gui/elistbox.cpp b/lib/gui/elistbox.cpp index 7764e6b5..2c2525c9 100644 --- a/lib/gui/elistbox.cpp +++ b/lib/gui/elistbox.cpp @@ -135,7 +135,7 @@ int eListbox::event(int event, void *data, void *data2) moveSelection((int)data2); return 1; } - break; + return 0; default: return eWidget::event(event, data, data2); } diff --git a/lib/gui/epixmap.cpp b/lib/gui/epixmap.cpp index a0655aa9..797c6759 100644 --- a/lib/gui/epixmap.cpp +++ b/lib/gui/epixmap.cpp @@ -1,4 +1,6 @@ #include +#include +#include ePixmap::ePixmap(eWidget *parent): eWidget(parent) { @@ -10,6 +12,15 @@ void ePixmap::setPixmap(gPixmap *pixmap) event(evtChangedPixmap); } +void ePixmap::setPixmapFromFile(const char *filename) +{ + loadPNG(m_pixmap, filename); + + // TODO + getDesktop()->makeCompatiblePixmap(*m_pixmap); + event(evtChangedPixmap); +} + int ePixmap::event(int event, void *data, void *data2) { switch (event) diff --git a/lib/gui/epixmap.h b/lib/gui/epixmap.h index 8a12e2e9..220db1ff 100644 --- a/lib/gui/epixmap.h +++ b/lib/gui/epixmap.h @@ -9,6 +9,7 @@ public: ePixmap(eWidget *parent); void setPixmap(gPixmap *pixmap); + void setPixmapFromFile(const char *filename); protected: ePtr m_pixmap; int event(int event, void *data=0, void *data2=0); diff --git a/lib/gui/ewidget.cpp b/lib/gui/ewidget.cpp index 7f089361..3ba248ff 100644 --- a/lib/gui/ewidget.cpp +++ b/lib/gui/ewidget.cpp @@ -7,6 +7,7 @@ eWidget::eWidget(eWidget *parent): m_parent(parent ? parent->child() : 0) { m_vis = 0; m_desktop = 0; + m_have_background_color = 0; if (m_parent) m_vis = wVisShow; @@ -45,10 +46,12 @@ void eWidget::resize(eSize size) fits into the other completely, and invalidate only once. */ eSize old_size = m_size; - event(evtWillChangeSize, &size); + eSize offset = eSize(0, 0); + event(evtWillChangeSize, &size, &offset); if (old_size == m_size) return; - + move(position() + offset); + invalidate(); event(evtChangedSize); recalcClipRegionsWhenVisible(); @@ -145,6 +148,13 @@ void eWidget::destruct() delete this; } +void eWidget::setBackgroundColor(const gRGB &col) +{ + eDebug("set background color in ewidget!"); + m_background_color = col; + m_have_background_color = 1; +} + eWidget::~eWidget() { hide(); @@ -217,9 +227,16 @@ int eWidget::event(int event, void *data, void *data2) // eDebug("eWidget::evtPaint"); // dumpRegion(*(gRegion*)data); - ePtr style; - if (!getStyle(style)) - style->paintBackground(painter, ePoint(0, 0), size()); + if (!m_have_background_color) + { + ePtr style; + if (!getStyle(style)) + style->paintBackground(painter, ePoint(0, 0), size()); + } else + { + painter.setBackgroundColor(m_background_color); + painter.clear(); + } break; } case evtKey: diff --git a/lib/gui/ewidget.h b/lib/gui/ewidget.h index fbe5a92a..cb39a000 100644 --- a/lib/gui/ewidget.h +++ b/lib/gui/ewidget.h @@ -33,6 +33,8 @@ public: int getStyle(ePtr &style) { if (!m_style) return 1; style = m_style; return 0; } void setStyle(eWindowStyle *style) { m_style = style; } + void setBackgroundColor(const gRGB &col); + /* untested code */ int isVisible() { return (m_vis & wVisShow) && ((!m_parent) || m_parent->isVisible()); } /* ... */ @@ -56,6 +58,9 @@ private: void doPaint(gPainter &painter, const gRegion ®ion); void recalcClipRegionsWhenVisible(); + + gRGB m_background_color; + int m_have_background_color; protected: virtual ~eWidget(); public: diff --git a/lib/gui/ewidgetdesktop.cpp b/lib/gui/ewidgetdesktop.cpp index 96f74636..8c489eb3 100644 --- a/lib/gui/ewidgetdesktop.cpp +++ b/lib/gui/ewidgetdesktop.cpp @@ -108,6 +108,21 @@ void eWidgetDesktop::setRedrawTask(eMainloop &ml) m_timer->start(0, 1); } +void eWidgetDesktop::makeCompatiblePixmap(gPixmap &pm) +{ + eDebug("widgetDesktop: make compatible pixmap of %p\n", &pm); + if (!m_dc) + { + eWarning("eWidgetDesktop: no DC to make pixmap compatible with!"); + return; + } + eDebug("painter.."); + gPainter painter(m_dc); + eDebug("merge!"); + painter.mergePalette(&pm); + eDebug("gone!"); +} + eWidgetDesktop::eWidgetDesktop(eSize size): m_screen_size(size), m_mainloop(0), m_timer(0) { } diff --git a/lib/gui/ewidgetdesktop.h b/lib/gui/ewidgetdesktop.h index f76baf60..22914ec5 100644 --- a/lib/gui/ewidgetdesktop.h +++ b/lib/gui/ewidgetdesktop.h @@ -30,6 +30,8 @@ public: void setBackgroundColor(gColor col); void setRedrawTask(eMainloop &ml); + + void makeCompatiblePixmap(gPixmap &pm); private: ePtrList m_root; void calcWidgetClipRegion(eWidget *widget, gRegion &parent_visible); diff --git a/lib/gui/ewindow.cpp b/lib/gui/ewindow.cpp index 1114d258..01f889ff 100644 --- a/lib/gui/ewindow.cpp +++ b/lib/gui/ewindow.cpp @@ -2,10 +2,26 @@ #include #include +#include + +#include eWindow::eWindow(eWidgetDesktop *desktop): eWidget(0) { - setStyle(new eWindowStyleSimple()); + m_flags = 0; + /* ask style manager for current style */ + ePtr mgr; + eWindowStyleManager::getInstance(mgr); + + ePtr style; + if (mgr) + mgr->getStyle(style); + + /* when there is either no style manager or no style, revert to simple style. */ + if (!style) + style = new eWindowStyleSimple(); + + setStyle(style); /* we are the parent for the child window. */ /* as we are in the constructor, this is thread safe. */ @@ -27,30 +43,49 @@ void eWindow::setTitle(const std::string &string) event(evtTitleChanged); } +void eWindow::setFlag(int flags) +{ + m_flags |= flags; +} + +void eWindow::clearFlag(int flags) +{ + m_flags &= ~flags; +} + int eWindow::event(int event, void *data, void *data2) { switch (event) { case evtWillChangeSize: { - ePtr style; - if (!getStyle(style)) + eSize &new_size = *static_cast(data); + eSize &offset = *static_cast(data2); + if (!(m_flags & wfNoBorder)) { - const eSize &new_size = *static_cast(data); + ePtr style; + if (!getStyle(style)) + { // eDebug("eWindow::evtWillChangeSize to %d %d", new_size.width(), new_size.height()); - style->handleNewSize(this, new_size); + style->handleNewSize(this, new_size, offset); + } + } else + { + m_child->resize(new_size); } break; } case evtPaint: { - ePtr style; - if (!getStyle(style)) + if (!(m_flags & wfNoBorder)) { - gPainter &painter = *static_cast(data2); - style->paintWindowDecoration(this, painter, m_title); - } else - eDebug("no style :("); + ePtr style; + if (!getStyle(style)) + { + gPainter &painter = *static_cast(data2); + style->paintWindowDecoration(this, painter, m_title); + } + } return 0; } default: diff --git a/lib/gui/ewindow.h b/lib/gui/ewindow.h index f5bcd51a..33ad7a72 100644 --- a/lib/gui/ewindow.h +++ b/lib/gui/ewindow.h @@ -14,6 +14,13 @@ public: ~eWindow(); void setTitle(const std::string &string); eWidget *child() { return m_child; } + + enum { + wfNoBorder = 1 + }; + + void setFlag(int flags); + void clearFlag(int flags); protected: enum eWindowEvents { @@ -23,6 +30,7 @@ protected: private: std::string m_title; eWidget *m_child; + int m_flags; }; #endif diff --git a/lib/gui/ewindowstyle.cpp b/lib/gui/ewindowstyle.cpp index a2e0efb2..79024a35 100644 --- a/lib/gui/ewindowstyle.cpp +++ b/lib/gui/ewindowstyle.cpp @@ -2,10 +2,35 @@ #include #include #include - +#include +#include eWindowStyle::~eWindowStyle() {} +DEFINE_REF(eWindowStyleManager); + +eWindowStyleManager::eWindowStyleManager() +{ + m_instance = this; +} + +eWindowStyleManager::~eWindowStyleManager() +{ + m_instance = 0; +} + +void eWindowStyleManager::getStyle(ePtr &style) +{ + style = m_current_style; +} + +void eWindowStyleManager::setStyle(eWindowStyle *style) +{ + m_current_style = style; +} + +eWindowStyleManager *eWindowStyleManager::m_instance; + DEFINE_REF(eWindowStyleSimple); eWindowStyleSimple::eWindowStyleSimple() @@ -22,7 +47,7 @@ eWindowStyleSimple::eWindowStyleSimple() m_background_color = gColor(0x19); } -void eWindowStyleSimple::handleNewSize(eWindow *wnd, const eSize &size) +void eWindowStyleSimple::handleNewSize(eWindow *wnd, eSize &size, eSize &offset) { // eDebug("handle new size: %d x %d", size.width(), size.height()); @@ -130,35 +155,4 @@ RESULT eWindowStyleSimple::getFont(int what, ePtr &fnt) return 0; } -#if 0 -DEFINE_REF(eWindowStyleSkinned); - -eWindowStyleSkinned::eWindowStyleSkinned() -{ -} - -void eWindowStyleSkinned::handleNewSize(eWindow *wnd, const eSize &size) -{ -} - -void eWindowStyleSkinned::paintWindowDecoration(eWindow *wnd, gPainter &painter, const std::string &title) -{ -} - -void eWindowStyleSkinned::paintBackground(gPainter &painter, const ePoint &offset, const eSize &size) -{ -} - -void eWindowStyleSkinned::setStyle(gPainter &painter, int what) -{ -} - -void eWindowStyleSkinned::drawFrame(gPainter &painter, const eRect &frame, int what) -{ -} - -void eWindowStyleSkinned::drawBorder(gPainter &painter, const eSize &size, const struct borderSet &border, int where) -{ -} - -#endif +eAutoInitPtr init_eWindowStyleManager(eAutoInitNumbers::skin, "eWindowStyleManager"); diff --git a/lib/gui/ewindowstyle.h b/lib/gui/ewindowstyle.h index f11d99de..08ea0a41 100644 --- a/lib/gui/ewindowstyle.h +++ b/lib/gui/ewindowstyle.h @@ -10,7 +10,7 @@ class gFont; class eWindowStyle: public iObject { public: - virtual void handleNewSize(eWindow *wnd, const eSize &size) = 0; + virtual void handleNewSize(eWindow *wnd, eSize &size, eSize &offset) = 0; virtual void paintWindowDecoration(eWindow *wnd, gPainter &painter, const std::string &title) = 0; virtual void paintBackground(gPainter &painter, const ePoint &offset, const eSize &size) = 0; virtual void setStyle(gPainter &painter, int what) = 0; @@ -38,6 +38,22 @@ public: virtual ~eWindowStyle() = 0; }; +class eWindowStyleManager: public iObject +{ + DECLARE_REF(eWindowStyleManager); +public: + eWindowStyleManager(); + ~eWindowStyleManager(); + void getStyle(ePtr &style); + void setStyle(eWindowStyle *style); + static int getInstance(ePtr &mgr) { mgr = m_instance; if (!mgr) return -1; return 0; } +private: + static eWindowStyleManager *m_instance; + ePtr m_current_style; +}; + +TEMPLATE_TYPEDEF(ePtr, eWindowStyleManagerPtr); + class eWindowStyleSimple: public eWindowStyle { DECLARE_REF(eWindowStyleSimple); @@ -48,7 +64,7 @@ private: int m_border_top, m_border_left, m_border_right, m_border_bottom; public: eWindowStyleSimple(); - void handleNewSize(eWindow *wnd, const eSize &size); + void handleNewSize(eWindow *wnd, eSize &size, eSize &offset); void paintWindowDecoration(eWindow *wnd, gPainter &painter, const std::string &title); void paintBackground(gPainter &painter, const ePoint &offset, const eSize &size); void setStyle(gPainter &painter, int what); @@ -56,45 +72,4 @@ public: RESULT getFont(int what, ePtr &font); }; -#if 0 -class eWindowStyleSkinned: public eWindowStyle -{ - DECLARE_REF(eWindowStyleSkinned); -public: - eWindowStyleSkinned(); - void handleNewSize(eWindow *wnd, const eSize &size); - void paintWindowDecoration(eWindow *wnd, gPainter &painter, const std::string &title); - void paintBackground(gPainter &painter, const ePoint &offset, const eSize &size); - void setStyle(gPainter &painter, int what); - void drawFrame(gPainter &painter, const eRect &frame, int what); - - enum { - bsWindow, - bsButton, -#ifndef SWIG - bsMax -#endif - }; - - enum { - bpTopLeft = 1, - bpTop = 2, - bpTopRight = 4, - bpLeft = 8, - bpRight = 0x10, - bpBottomLeft = 0x20, - bpBottom = 0x40, - bpBottomRight = 0x80, - bpBackground = 0x100 - }; -private: - struct borderSet - { - ePtr m_pixmap[9]; - }; - - void drawBorder(gPainter &painter, const eSize &size, const struct borderSet &border, int where); -}; -#endif - #endif diff --git a/lib/gui/ewindowstyleskinned.cpp b/lib/gui/ewindowstyleskinned.cpp new file mode 100644 index 00000000..a3152e5f --- /dev/null +++ b/lib/gui/ewindowstyleskinned.cpp @@ -0,0 +1,248 @@ +#include +#include +#include +#include +#include + +DEFINE_REF(eWindowStyleSkinned); + +eWindowStyleSkinned::eWindowStyleSkinned() +{ + m_background_color = gRGB(0x808080); +} + +void eWindowStyleSkinned::handleNewSize(eWindow *wnd, eSize &size, eSize &offset) +{ +// eDebug("handle new size: %d x %d", size.width(), size.height()); + + size = eSize( + size.width() + m_border[bsWindow].m_border_left + m_border[bsWindow].m_border_right, + size.height() + m_border[bsWindow].m_border_top + m_border[bsWindow].m_border_bottom + ); + + offset = eSize(-m_border[bsWindow].m_border_left, -m_border[bsWindow].m_border_top); + + eWidget *child = wnd->child(); + + wnd->m_clip_region = eRect(ePoint(0, 0), size); + + child->move(ePoint(m_border[bsWindow].m_border_left, m_border[bsWindow].m_border_top)); + child->resize(eSize(size.width() - m_border[bsWindow].m_border_left - m_border[bsWindow].m_border_right, size.height() - m_border[bsWindow].m_border_top - m_border[bsWindow].m_border_bottom)); +} + +void eWindowStyleSkinned::paintWindowDecoration(eWindow *wnd, gPainter &painter, const std::string &title) +{ + drawBorder(painter, eRect(ePoint(0, 0), wnd->size()), m_border[bsWindow], bpAll); +} + +void eWindowStyleSkinned::paintBackground(gPainter &painter, const ePoint &offset, const eSize &size) +{ + painter.setBackgroundColor(m_background_color); + painter.clear(); +} + +void eWindowStyleSkinned::setStyle(gPainter &painter, int what) +{ + switch (what) + { + case styleLabel: + painter.setForegroundColor(gColor(0x1F)); + break; + case styleListboxSelected: + painter.setForegroundColor(gColor(0x1F)); + painter.setBackgroundColor(gColor(0x1A)); + break; + case styleListboxNormal: + painter.setForegroundColor(gColor(0x1C)); + painter.setBackgroundColor(m_background_color); + break; + case styleListboxMarked: + painter.setForegroundColor(gColor(0x2F)); + painter.setBackgroundColor(gColor(0x2A)); + break; + } +} + +void eWindowStyleSkinned::drawFrame(gPainter &painter, const eRect &frame, int what) +{ + int bs; + switch (what) + { + case frameButton: + bs = bsButton; + break; + case frameListboxEntry: + bs = bsListboxEntry; + break; + default: + eWarning("invalid frame style %d", what); + return; + } + drawBorder(painter, frame, m_border[bs], bpAll); +} + +void eWindowStyleSkinned::drawBorder(gPainter &painter, const eRect &pos, struct borderSet &border, int what) +{ + int x = pos.left(), xm = pos.right(); + + ePtr + &tl = border.m_pixmap[bpiTopLeft], + &t = border.m_pixmap[bpiTop], + &tr = border.m_pixmap[bpiTopRight], + &l = border.m_pixmap[bpiLeft], + &r = border.m_pixmap[bpiRight], + &bl = border.m_pixmap[bpiBottomLeft], + &b = border.m_pixmap[bpiBottom], + &br = border.m_pixmap[bpiBottomRight]; + + if (tl) + { + painter.blit(tl, ePoint(x, pos.top())); + x += tl->size().width(); + } + + if (tr) + { + xm -= tr->size().width(); + painter.blit(tr, ePoint(xm, pos.top()), pos); + } + + if (t) + { + while (x < xm) + { + painter.blit(t, ePoint(x, pos.top()), eRect(x, pos.top(), xm - x, pos.height())); + x += t->size().width(); + } + } + + x = pos.left(); + xm = pos.right(); + + if (bl) + { + painter.blit(bl, ePoint(pos.left(), pos.bottom()-bl->size().height())); + x += bl->size().width(); + } + + if (br) + { + xm -= br->size().width(); + painter.blit(br, ePoint(xm, pos.bottom()-br->size().height()), eRect(x, pos.bottom()-br->size().height(), pos.width() - x, bl->size().height())); + } + + if (b) + { + while (x < xm) + { + painter.blit(b, ePoint(x, pos.bottom()-b->size().height()), eRect(x, pos.bottom()-b->size().height(), xm - x, pos.height())); + x += b->size().width(); + } + } + + int y = 0; + if (tl) + y = tl->size().height(); + + y += pos.top(); + + int ym = pos.bottom(); + if (bl) + ym -= bl->size().height(); + + if (l) + { + while (y < ym) + { + painter.blit(l, ePoint(pos.left(), y), eRect(pos.left(), y, pos.width(), ym - y)); + y += l->size().height(); + } + } + + y = 0; + + if (tr) + y = tr->size().height(); + + y += pos.top(); + + ym = pos.bottom(); + if (br) + ym -= br->size().height(); + + if (r) + { + while (y < ym) + { + painter.blit(r, ePoint(pos.right() - r->size().width(), y), eRect(pos.right()-r->size().width(), y, r->size().width(), ym - y)); + y += r->size().height(); + } + } +} + +RESULT eWindowStyleSkinned::getFont(int what, ePtr &fnt) +{ + fnt = 0; + switch (what) + { + case fontStatic: + fnt = new gFont("Arial", 12); + break; + case fontButton: + fnt = new gFont("Arial", 20); + break; + case fontTitlebar: + fnt = new gFont("Arial", 25); + break; + default: + return -1; + } + return 0; +} + +void eWindowStyleSkinned::setPixmap(int bs, int bp, gPixmap &pixmap) +{ + if ((bs >= bsMax) || (bs < 0)) + return; + + int i = 0; + for (int b = 1; b < bpMax; b <<= 1, ++i) + { + if (bp & b) + m_border[bs].m_pixmap[i] = &pixmap; + } + + /* recalc border sizes */ + m_border[bs].m_border_top = 0; + m_border[bs].m_border_left = 0; + m_border[bs].m_border_bottom = 0; + m_border[bs].m_border_right = 0; + + for (int i = 0; i < 3; ++i) + if (m_border[bs].m_pixmap[i]) + if (m_border[bs].m_border_top < m_border[bs].m_pixmap[i]->size().height()) + m_border[bs].m_border_top = m_border[bs].m_pixmap[i]->size().height(); + for (int i = 6; i < 9; ++i) + if (m_border[bs].m_pixmap[i]) + if (m_border[bs].m_border_bottom < m_border[bs].m_pixmap[i]->size().height()) + m_border[bs].m_border_bottom = m_border[bs].m_pixmap[i]->size().height(); + for (int i = 0; i < 9; i += 3) + if (m_border[bs].m_pixmap[i]) + if (m_border[bs].m_border_left < m_border[bs].m_pixmap[i]->size().width()) + m_border[bs].m_border_left = m_border[bs].m_pixmap[i]->size().width(); + for (int i = 2; i < 9; i += 3) + if (m_border[bs].m_pixmap[i]) + if (m_border[bs].m_border_right < m_border[bs].m_pixmap[i]->size().width()) + m_border[bs].m_border_right = m_border[bs].m_pixmap[i]->size().width(); + eDebug("recalced border size for %d: %d:%d %d:%d", + bs, + m_border[bs].m_border_left, m_border[bs].m_border_top, + m_border[bs].m_border_right, m_border[bs].m_border_bottom); +} + +void eWindowStyleSkinned::setDefaultBackgroundColor(const gRGB &back) +{ + m_background_color = back; + eDebug("set default background color!"); +} + diff --git a/lib/gui/ewindowstyleskinned.h b/lib/gui/ewindowstyleskinned.h new file mode 100644 index 00000000..79557386 --- /dev/null +++ b/lib/gui/ewindowstyleskinned.h @@ -0,0 +1,71 @@ +#ifndef __lib_gui_ewindowstyleskinned_h +#define __lib_gui_ewindowstyleskinned_h + +#include + +class eWindowStyleSkinned: public eWindowStyle +{ + DECLARE_REF(eWindowStyleSkinned); +public: + eWindowStyleSkinned(); + void handleNewSize(eWindow *wnd, eSize &size, eSize &offset); + void paintWindowDecoration(eWindow *wnd, gPainter &painter, const std::string &title); + void paintBackground(gPainter &painter, const ePoint &offset, const eSize &size); + void setStyle(gPainter &painter, int what); + void drawFrame(gPainter &painter, const eRect &frame, int what); + RESULT getFont(int what, ePtr &font); + + enum { + bsWindow, + bsButton, + bsListboxEntry, +#ifndef SWIG + bsMax +#endif + }; + + enum { + bpTopLeft = 1, + bpTop = 2, + bpTopRight = 4, + bpLeft = 8, + bpBackground = 0x10, + bpRight = 0x20, + bpBottomLeft = 0x40, + bpBottom = 0x80, + bpBottomRight = 0x100, + bpAll = 0x1ff, + bpMax = 0x200 + }; + + enum { + bpiTopLeft = 0, + bpiTop = 1, + bpiTopRight = 2, + bpiLeft = 3, + bpiBackground = 4, + bpiRight = 5, + bpiBottomLeft = 6, + bpiBottom = 7, + bpiBottomRight = 8, + }; + + void setPixmap(int bs, int bp, gPixmap &pixmap); + + void setDefaultBackgroundColor(const gRGB &back); + +private: + struct borderSet + { + ePtr m_pixmap[9]; + int m_border_top, m_border_left, m_border_right, m_border_bottom; + }; + + borderSet m_border[bsMax]; + + gRGB m_background_color; + + void drawBorder(gPainter &painter, const eRect &size, struct borderSet &border, int where); +}; + +#endif diff --git a/lib/python/enigma_python.i b/lib/python/enigma_python.i index 7369b646..11faff1c 100644 --- a/lib/python/enigma_python.i +++ b/lib/python/enigma_python.i @@ -53,6 +53,7 @@ is usually caused by not marking PSignals as immutable. #include #include #include +#include #include #include #include @@ -94,9 +95,6 @@ extern PSignal1 &keyPressedSignal(); %immutable eComponentScan::statusChanged; %immutable pNavigation::m_event; - -%include - %include %include %include @@ -111,6 +109,7 @@ extern PSignal1 &keyPressedSignal(); %include %include %include +%include %include %include %include @@ -118,6 +117,7 @@ extern PSignal1 &keyPressedSignal(); %include %include +%include /************** eptr **************/ %template(eActionMapPtr) ePtr; @@ -156,7 +156,6 @@ public: $1 = $input->get(); } - /************** base **************/ %immutable eTimer::timeout; diff --git a/main/Makefile.am b/main/Makefile.am index 1fdf8c32..ad838f5f 100644 --- a/main/Makefile.am +++ b/main/Makefile.am @@ -27,8 +27,10 @@ enigma2_LDADD = \ @MAD_LIBS@ \ @PNG_LIBS@ \ @SIGC_LIBS@ \ + @SDL_LIBS@ \ -ldl -lpthread -lcrypt -lresolv -lpython2.3 enigma2$(EXEEXT): $(enigma2_OBJECTS) $(enigma2_DEPENDENCIES) $(enigma2_LDADD_WHOLE) @rm -f enigma2$(EXEEXT) - $(CXXLINK) $(enigma2_LDFLAGS) $(enigma2_OBJECTS) -Wl,--export-dynamic -Wl,--whole-archive $(enigma2_LDADD_WHOLE) -Wl,--no-whole-archive $(enigma2_LDADD) $(LIBS) +# $(CXXLINK) $(enigma2_LDFLAGS) $(enigma2_OBJECTS) -Wl,--export-dynamic -Wl,--whole-archive $(enigma2_LDADD_WHOLE) -Wl,--no-whole-archive $(enigma2_LDADD) $(LIBS) + g++ -o enigma2$(EXEEXT) $(enigma2_LDFLAGS) $(enigma2_OBJECTS) -Wl,--export-dynamic -Wl,--whole-archive $(enigma2_LDADD_WHOLE) -Wl,--no-whole-archive $(enigma2_LDADD) $(LIBS) diff --git a/main/enigma.cpp b/main/enigma.cpp index 6bf0bb97..222bdebc 100644 --- a/main/enigma.cpp +++ b/main/enigma.cpp @@ -1,3 +1,4 @@ +#define SDLDC #include #include #include @@ -9,6 +10,7 @@ #include #include +#include #include #include @@ -132,8 +134,13 @@ int main(int argc, char **argv) eMain main; #if 1 +#ifdef SDLDC + ePtr my_dc; + gSDLDC::getInstance(my_dc); +#else ePtr my_dc; gFBDC::getInstance(my_dc); +#endif gPainter p(my_dc); @@ -151,9 +158,13 @@ int main(int argc, char **argv) pal[a | 0x30] = (0x110011 * a) | 0xFF00; for (int a=0; a<0x10; ++a) pal[a | 0x40] = (0x001111 * a) | 0xFF0000; + + pal[0x50] = 0x586D88; + pal[0x51] = 0x4075a7; + p.setPalette(pal, 0, 256); - fontRenderClass::getInstance()->AddFont("/dbox2/cdkroot/share/fonts/arial.ttf", "Arial", 100); + fontRenderClass::getInstance()->AddFont("/home/tmbinc/enigma2/fonts/arial.ttf", "Arial", 100); eWidgetDesktop dsk(eSize(720, 576)); diff --git a/mytest.py b/mytest.py index 74ac2736..1a4b0363 100644 --- a/mytest.py +++ b/mytest.py @@ -103,7 +103,7 @@ class Session: gui.parent = dlg.instance gui.create(dlg) - applyGUIskin(dlg, None, dlg.skinName) + applyGUIskin(dlg, None, dlg.skinName, self.desktop) return dlg @@ -162,6 +162,8 @@ def runScreenTest(): import keymapparser keymapparser.readKeymap() +import skin +skin.loadSkin() # first, setup a screen runScreenTest() diff --git a/screens.py b/screens.py index a0d0d7f6..77d064f5 100644 --- a/screens.py +++ b/screens.py @@ -83,14 +83,6 @@ class mainMenu(Screen): ("wie spaet ists?!", self.goClock) ]) -#class mainMenu(Screen): -# def __init__(self): -# GUISkin.__init__(self) -# -# self["title"] = Header("this is the\nMAIN MENU !!!"); -# self["okbutton"] = Button("ok") -# self["okbutton"].onClick = [ self.close ] - class channelSelection(Screen): def __init__(self, session): Screen.__init__(self, session) diff --git a/skin.py b/skin.py index 51433bd7..73d4b02d 100644 --- a/skin.py +++ b/skin.py @@ -11,10 +11,22 @@ def dump(x, i=0): None dom = xml.dom.minidom.parseString( - """ - + """ + + + + + + + + + + + + + - + @@ -23,15 +35,16 @@ dom = xml.dom.minidom.parseString( - - - - - - - - - + + + + + + + + + + @@ -42,12 +55,17 @@ dom = xml.dom.minidom.parseString( - -""") + """) # filters all elements of childNode with the specified function # example: nodes = elementsWithTag(childNodes, lambda x: x == "bla") def elementsWithTag(el, tag): + + # fiiixme! (works but isn't nice) + if tag.__class__ == "".__class__: + str = tag + tag = lambda x: x == str + for x in el: if x.nodeType != xml.dom.minidom.Element.nodeType: continue @@ -63,10 +81,15 @@ def parseSize(str): return eSize(int(x), int(y)) def parseFont(str): - name, size = str.split(':') + name, size = str.split(';') return gFont(name, int(size)) -def applyAttributes(guiObject, node): +def parseColor(str): + if str[0] != '#': + raise "color must be #aarrggbb" + return gRGB(int(str[1:], 0x10)) + +def applyAttributes(guiObject, node, desktop): # walk all attributes for p in range(node.attributes.length): a = node.attributes.item(p) @@ -93,7 +116,12 @@ def applyAttributes(guiObject, node): ptr = gPixmapPtr() if loadPNG(ptr, value): raise "loading PNG failed!" - guiObject.setPixmap(ptr.__deref__()) + x = ptr + ptr = ptr.__deref__() + print desktop + desktop.makeCompatiblePixmap(ptr) + guiObject.setPixmap(ptr) +# guiObject.setPixmapFromFile(value) elif attrib == "valign": try: guiObject.setVAlign( @@ -113,29 +141,74 @@ def applyAttributes(guiObject, node): }[value]) except KeyError: print "halign must be either left, center, right or block!" + elif attrib == "flags": + flags = value.split(',') + for f in flags: + try: + fv = eWindow.__dict__[f] + guiObject.setFlag(fv) + except KeyError: + print "illegal flag %s!" % f + elif attrib == "backgroundColor": + guiObject.setBackgroundColor(parseColor(value)) elif attrib != 'name': print "unsupported attribute " + attrib + "=" + value except AttributeError: print "widget %s (%s) doesn't support attribute %s!" % ("", guiObject.__class__.__name__, attrib) -def applyGUIskin(screen, skin, name): +def loadSkin(): + print "loading skin..." + + def getPNG(x): + g = gPixmapPtr() + loadPNG(g, x) + g = g.grabRef() + return g + + skin = dom.childNodes[0] + assert skin.tagName == "skin", "root element in skin must be 'skin'!" + + for windowstyle in elementsWithTag(skin.childNodes, "windowstyle"): + style = eWindowStyleSkinned() + + for borderset in elementsWithTag(windowstyle.childNodes, "borderset"): + bsName = str(borderset.getAttribute("name")) + for pixmap in elementsWithTag(borderset.childNodes, "pixmap"): + bpName = str(pixmap.getAttribute("pos")) + filename = str(pixmap.getAttribute("filename")) + + style.setPixmap(eWindowStyleSkinned.__dict__[bsName], eWindowStyleSkinned.__dict__[bpName], getPNG(filename)) + + for color in elementsWithTag(windowstyle.childNodes, "color"): + type = str(color.getAttribute("name")) + color = parseColor(color.getAttribute("color")) + + if type == "defaultBackground": + style.setDefaultBackgroundColor(color) + else: + raise "unknown color %s" % (type) + + x = eWindowStyleManagerPtr() + eWindowStyleManager.getInstance(x) + x.setStyle(style) + +def applyGUIskin(screen, skin, name, desktop): myscreen = None # first, find the corresponding screen element skin = dom.childNodes[0] - assert skin.tagName == "skin", "root element in skin must be 'skin'!" - for x in elementsWithTag(skin.childNodes, lambda x: x == "screen"): + for x in elementsWithTag(skin.childNodes, "screen"): if x.getAttribute('name') == name: myscreen = x del skin assert myscreen != None, "no skin for screen '" + name + "' found!" - applyAttributes(screen.instance, myscreen) + applyAttributes(screen.instance, myscreen, desktop) # now walk all widgets - for widget in elementsWithTag(myscreen.childNodes, lambda x: x == "widget"): + for widget in elementsWithTag(myscreen.childNodes, "widget"): wname = widget.getAttribute('name') if wname == None: print "widget has no name!" @@ -147,7 +220,7 @@ def applyGUIskin(screen, skin, name): except: raise str("component with name '" + wname + "' was not found in skin of screen '" + name + "'!") - applyAttributes(guiObject, widget) + applyAttributes(guiObject, widget, desktop) # now walk additional objects for widget in elementsWithTag(myscreen.childNodes, lambda x: x != "widget"): @@ -158,5 +231,5 @@ def applyGUIskin(screen, skin, name): else: raise str("unsupported stuff : %s" % widget.tagName) - applyAttributes(guiObject, widget) + applyAttributes(guiObject, widget, desktop ) guiObject.thisown = 0