From: Felix Domke Date: Sat, 25 Sep 2004 16:13:48 +0000 (+0000) Subject: - new GUI lib X-Git-Url: http://code.vuplus.com/gitweb/?p=vuplus_dvbapp;a=commitdiff_plain;h=1aeefd997cc362c3b37c1587c5f08891b35c3a75 - new GUI lib - fixes --- diff --git a/include/connection.h b/include/connection.h index a085650..ae799c9 100644 --- a/include/connection.h +++ b/include/connection.h @@ -4,7 +4,7 @@ #include #include -class eConnection: public virtual iObject, public Connection +class eConnection: public iObject, public Connection { int ref; ePtr m_owner; diff --git a/lib/Makefile.am b/lib/Makefile.am index 4243911..2ff9992 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -1,5 +1 @@ -SUBDIRS = base dvb dvb_si gdi network service driver nav -#gui - - - +SUBDIRS = base dvb dvb_si gdi network service driver nav content gui diff --git a/lib/base/eerror.cpp b/lib/base/eerror.cpp index ac62f1e..68541d4 100644 --- a/lib/base/eerror.cpp +++ b/lib/base/eerror.cpp @@ -4,7 +4,9 @@ #include #include -#include +#include + +// #include int infatal=0; diff --git a/lib/base/eptrlist.h b/lib/base/eptrlist.h index f1421eb..ae61d78 100644 --- a/lib/base/eptrlist.h +++ b/lib/base/eptrlist.h @@ -59,16 +59,10 @@ public: inline operator bool(); inline bool operator!(); -// added methods for autodelete implementation - inline void setAutoDelete(bool b); - inline bool isAutoDelete(); - // added compare struct ... to sort struct less; private: iterator cur; - bool autoDelete; - public: iterator ePtrList::begin() { @@ -122,9 +116,6 @@ public: { // Remove the item it, if auto-deletion is enabled, than the list call delete for this item // If current is equal to the item that was removed, current is set to the next item in the list - if (autoDelete && *it) - delete *it; - if (cur == it) return cur = std::list::erase(it); else @@ -377,7 +368,7 @@ public: /////////////////// Default Constructor ///////////////////////////// template ePtrList::ePtrList() - :cur(std::list::begin()), autoDelete(false) + :cur(std::list::begin()) { } @@ -385,27 +376,16 @@ ePtrList::ePtrList() /////////////////// Copy Constructor ///////////////////////////// template ePtrList::ePtrList(const ePtrList& e) - :std::list(e), cur(e.cur), autoDelete( false ) + :std::list(e), cur(e.cur) { - if ( e.autoDelete ) - if ( e.size() ) - eDebug("Warning !! We make a Copy of a non empty ePtrList, with autoDelete enabled" - "We disable autoDelete in the new ePtrList !!"); - else - autoDelete=true; } /////////////////// ePtrList Destructor ///////////////////////////// template inline ePtrList::~ePtrList() { -// if autoDelete is enabled, delete is called for all elements in the list - if (autoDelete) - for (std_list_T_iterator it(std::list::begin()); it != std::list::end(); it++) - delete *it; } - /////////////////// ePtrList sort() ///////////////////////// template inline void ePtrList::sort() @@ -655,22 +635,6 @@ bool ePtrList::operator!() } template -void ePtrList::setAutoDelete(bool b) -{ -// switched autoDelete on or off -// if autoDelete is true, than the pointer list controls the heap memory behind the pointer itself -// the list calls delete for the item before it removed from the list - autoDelete=b; -} - -template -bool ePtrList::isAutoDelete() -{ -// returns a bool that contains the state of autoDelete - return autoDelete; -} - -template class eSmartPtrList : public std::list > { public: @@ -724,16 +688,10 @@ public: inline operator bool(); inline bool operator!(); -// added methods for autodelete implementation - inline void setAutoDelete(bool b); - inline bool isAutoDelete(); - // added compare struct ... to sort struct less; private: iterator cur; - bool autoDelete; - public: iterator eSmartPtrList::begin() { @@ -787,8 +745,6 @@ public: { // Remove the item it, if auto-deletion is enabled, than the list call delete for this item // If current is equal to the item that was removed, current is set to the next item in the list - if (autoDelete && *it) - delete *it; if (cur == it) return cur = std::list >::erase(it); @@ -1042,7 +998,7 @@ public: /////////////////// Default Constructor ///////////////////////////// template eSmartPtrList::eSmartPtrList() - :cur(std::list >::begin()), autoDelete(false) + :cur(std::list >::begin()) { } @@ -1050,24 +1006,14 @@ eSmartPtrList::eSmartPtrList() /////////////////// Copy Constructor ///////////////////////////// template eSmartPtrList::eSmartPtrList(const eSmartPtrList& e) - :std::list >(e), cur(e.cur), autoDelete( false ) + :std::list >(e), cur(e.cur) { - if ( e.autoDelete ) - if ( e.size() ) - eDebug("Warning !! We make a Copy of a non empty eSmartPtrList, with autoDelete enabled" - "We disable autoDelete in the new eSmartPtrList !!"); - else - autoDelete=true; } /////////////////// eSmartPtrList Destructor ///////////////////////////// template inline eSmartPtrList::~eSmartPtrList() { -// if autoDelete is enabled, delete is called for all elements in the list - if (autoDelete) - for (std_list_T_iterator it(std::list >::begin()); it != std::list >::end(); it++) - delete *it; } @@ -1319,20 +1265,4 @@ bool eSmartPtrList::operator!() return empty(); } -template -void eSmartPtrList::setAutoDelete(bool b) -{ -// switched autoDelete on or off -// if autoDelete is true, than the pointer list controls the heap memory behind the pointer itself -// the list calls delete for the item before it removed from the list - autoDelete=b; -} - -template -bool eSmartPtrList::isAutoDelete() -{ -// returns a bool that contains the state of autoDelete - return autoDelete; -} - #endif // _E_PTRLIST diff --git a/lib/dvb/db.h b/lib/dvb/db.h index 763df7e..fe4833c 100644 --- a/lib/dvb/db.h +++ b/lib/dvb/db.h @@ -20,7 +20,7 @@ public: class ServiceDescriptionTable; -class eDVBDB: public virtual iDVBChannelList +class eDVBDB: public iDVBChannelList { DECLARE_REF; private: diff --git a/lib/dvb/decoder.h b/lib/dvb/decoder.h index 6694e9f..b1e6561 100644 --- a/lib/dvb/decoder.h +++ b/lib/dvb/decoder.h @@ -4,7 +4,7 @@ #include #include -class eDVBAudio: public virtual iObject +class eDVBAudio: public iObject { DECLARE_REF; private: @@ -17,7 +17,7 @@ public: virtual ~eDVBAudio(); }; -class eDVBVideo: public virtual iObject +class eDVBVideo: public iObject { DECLARE_REF; private: @@ -30,7 +30,7 @@ public: virtual ~eDVBVideo(); }; -class eTSMPEGDecoder: public virtual iTSMPEGDecoder +class eTSMPEGDecoder: public iTSMPEGDecoder { DECLARE_REF; private: diff --git a/lib/dvb/demux.h b/lib/dvb/demux.h index 3b4cbed..c7fa5bc 100644 --- a/lib/dvb/demux.h +++ b/lib/dvb/demux.h @@ -4,7 +4,7 @@ #include #include -class eDVBDemux: public virtual iDVBDemux +class eDVBDemux: public iDVBDemux { int adapter, demux; friend class eDVBSectionReader; @@ -18,7 +18,7 @@ public: RESULT getMPEGDecoder(ePtr &reader); }; -class eDVBSectionReader: public virtual iDVBSectionReader, public Object +class eDVBSectionReader: public iDVBSectionReader, public Object { DECLARE_REF private: diff --git a/lib/dvb/dvb.cpp b/lib/dvb/dvb.cpp index 29ffa15..8acd0c5 100644 --- a/lib/dvb/dvb.cpp +++ b/lib/dvb/dvb.cpp @@ -90,6 +90,8 @@ RESULT eDVBResourceManager::removeChannel(const eDVBChannelID &chid, eDVBChannel return -ENOENT; } +DEFINE_REF(eDVBChannel); + eDVBChannel::eDVBChannel(eDVBResourceManager *mgr, int adapter, int frontend, int demux): eDVBDemux(adapter, demux), m_state(state_idle), m_mgr(mgr) { if (frontend >= 0) @@ -180,7 +182,7 @@ RESULT eDVBChannel::setChannel(const eDVBChannelID &channelid) RESULT eDVBChannel::connectStateChange(const Slot1 &stateChange, ePtr &connection) { - connection = new eConnection(this, m_stateChanged.connect(stateChange)); + connection = new eConnection((iDVBChannel*)this, m_stateChanged.connect(stateChange)); return 0; } diff --git a/lib/dvb/dvb.h b/lib/dvb/dvb.h index f6aae23..52dd9a0 100644 --- a/lib/dvb/dvb.h +++ b/lib/dvb/dvb.h @@ -8,7 +8,7 @@ class eDVBChannel; -class eDVBResourceManager: public virtual iDVBResourceManager +class eDVBResourceManager: public iDVBResourceManager { DECLARE_REF; int avail, busy; @@ -38,8 +38,10 @@ public: RESULT removeChannel(const eDVBChannelID &chid, eDVBChannel *ch); }; -class eDVBChannel: public virtual iDVBChannel, public virtual eDVBDemux, public Object +class eDVBChannel: public iDVBChannel, public eDVBDemux, public Object { + DECLARE_REF; +private: ePtr m_frontend; ePtr m_current_frontend_parameters; eDVBChannelID m_channel_id; diff --git a/lib/dvb/esection.h b/lib/dvb/esection.h index ca63c18..78895e7 100644 --- a/lib/dvb/esection.h +++ b/lib/dvb/esection.h @@ -4,7 +4,7 @@ #include #include -class eGTable: public virtual iObject, public Object +class eGTable: public iObject, public Object { DECLARE_REF; private: diff --git a/lib/dvb/frontend.h b/lib/dvb/frontend.h index ee7f945..c179d57 100644 --- a/lib/dvb/frontend.h +++ b/lib/dvb/frontend.h @@ -3,7 +3,7 @@ #include -class eDVBFrontendParameters: public virtual iDVBFrontendParameters +class eDVBFrontendParameters: public iDVBFrontendParameters { DECLARE_REF; union @@ -30,7 +30,7 @@ public: RESULT getHash(unsigned long &hash) const; }; -class eDVBFrontend: public virtual iDVBFrontend, public Object +class eDVBFrontend: public iDVBFrontend, public Object { DECLARE_REF; int m_type; diff --git a/lib/dvb/idvb.h b/lib/dvb/idvb.h index c4ae488..a69f170 100644 --- a/lib/dvb/idvb.h +++ b/lib/dvb/idvb.h @@ -147,13 +147,13 @@ class iDVBChannel; class iDVBDemux; class iDVBFrontendParameters; -class iDVBChannelList: public virtual iObject +class iDVBChannelList: public iObject { public: virtual RESULT getChannelFrontendData(const eDVBChannelID &id, ePtr &parm)=0; }; -class iDVBResourceManager: public virtual iObject +class iDVBResourceManager: public iObject { public: /* @@ -214,7 +214,7 @@ struct eDVBFrontendParametersTerrestrial void set(const TerrestrialDeliverySystemDescriptor &); }; -class iDVBFrontendParameters: public virtual iObject +class iDVBFrontendParameters: public iObject { public: virtual RESULT getSystem(int &type) const = 0; @@ -236,7 +236,7 @@ struct eDVBDiseqcCommand class iDVBSatelliteEquipmentControl; -class iDVBFrontend: public virtual iObject +class iDVBFrontend: public iObject { public: enum { @@ -275,7 +275,7 @@ struct eDVBCIRouting int enabled; }; -class iDVBChannel: public virtual iObject +class iDVBChannel: public iObject { public: enum @@ -302,7 +302,7 @@ public: class iDVBSectionReader; class iTSMPEGDecoder; -class iDVBDemux: public virtual iObject +class iDVBDemux: public iObject { public: virtual RESULT createSectionReader(eMainloop *context, ePtr &reader)=0; diff --git a/lib/dvb/isection.h b/lib/dvb/isection.h index 04b50f5..f44c163 100644 --- a/lib/dvb/isection.h +++ b/lib/dvb/isection.h @@ -42,7 +42,7 @@ struct eDVBTableSpec int flags; }; -class iDVBSectionReader: public virtual iObject +class iDVBSectionReader: public iObject { public: virtual RESULT start(const eDVBSectionFilterMask &mask)=0; diff --git a/lib/dvb/scan.h b/lib/dvb/scan.h index cc72764..61a211b 100644 --- a/lib/dvb/scan.h +++ b/lib/dvb/scan.h @@ -6,7 +6,7 @@ #include #include -class eDVBScan: public Object, public virtual iObject +class eDVBScan: public Object, public iObject { /* chid helper functions: */ diff --git a/lib/gdi/erect.cpp b/lib/gdi/erect.cpp index b72e5d0..a387879 100644 --- a/lib/gdi/erect.cpp +++ b/lib/gdi/erect.cpp @@ -151,8 +151,8 @@ eRect& eRect::operator&=(const eRect &r) eRect eRect::operator|(const eRect &r) const { - if ( isValid() ) { - if ( r.isValid() ) { + if ( valid() ) { + if ( r.valid() ) { eRect tmp; tmp.setLeft( MIN( x1, r.x1 ) ); tmp.setRight( MAX( x2, r.x2 ) ); diff --git a/lib/gdi/erect.h b/lib/gdi/erect.h index 9eaa790..a67d0fb 100644 --- a/lib/gdi/erect.h +++ b/lib/gdi/erect.h @@ -11,7 +11,8 @@ class eRect // rectangle class { friend class gRegion; public: - eRect() { x1 = y1 = x2 = y2 = 0; } + /* eRect() constructs an INVALID rectangle. */ + eRect() { x1 = y1 = 0; x2 = y2 = -1; } eRect( const ePoint &topleft, const ePoint &bottomright ); // we use this contructor very often... do it inline... @@ -25,9 +26,8 @@ public: eRect( int left, int top, int width, int height ); - bool isNull() const; - bool isEmpty() const; - bool isValid() const; + bool empty() const; + bool valid() const; eRect normalize() const; int left() const; @@ -103,7 +103,10 @@ public: friend bool operator==( const eRect &, const eRect & ); friend bool operator!=( const eRect &, const eRect & ); - + + static eRect emptyRect() { return eRect(0, 0, 0, 0); } + static eRect invalidRect() { return eRect(); } + private: int x1; int y1; @@ -116,28 +119,6 @@ bool operator!=( const eRect &, const eRect & ); /***************************************************************************** - eRect stream functions - *****************************************************************************/ -namespace std -{ - inline ostream &operator<<( ostream & s, const eRect & r ) - { - s << r.left() << r.top() - << r.right() << r.bottom(); - - return s; - } - - inline istream &operator>>( istream & s, eRect & r ) - { - int x1, y1, x2, y2; - s >> x1 >> y1 >> x2 >> y2; - r.setCoords( x1, y1, x2, y2 ); - return s; - } -} - -/***************************************************************************** eRect inline member functions *****************************************************************************/ @@ -149,13 +130,10 @@ inline eRect::eRect( int left, int top, int width, int height ) y2 = top+height; } -inline bool eRect::isNull() const -{ return x2 == x1 && y2 == y1; } - -inline bool eRect::isEmpty() const -{ return x1 >= x2 || y1 >= y2; } +inline bool eRect::empty() const +{ return x1 == x2 && y1 == y2; } -inline bool eRect::isValid() const +inline bool eRect::valid() const { return x1 <= x2 && y1 <= y2; } inline int eRect::left() const diff --git a/lib/gdi/fb.cpp b/lib/gdi/fb.cpp index 4b8a56c..e792204 100644 --- a/lib/gdi/fb.cpp +++ b/lib/gdi/fb.cpp @@ -59,7 +59,7 @@ fbClass::fbClass(const char *fb) goto nolfb; } - showConsole(1); + showConsole(0); return; nolfb: lfb=0; @@ -121,6 +121,7 @@ fbClass::~fbClass() ioctl(fd, FBIOPUT_VSCREENINFO, &oldscreen); if (lfb) munmap(lfb, available); + showConsole(1); } int fbClass::PutCMAP() diff --git a/lib/gdi/font.cpp b/lib/gdi/font.cpp index 2f2823b..a8f0b12 100644 --- a/lib/gdi/font.cpp +++ b/lib/gdi/font.cpp @@ -388,30 +388,10 @@ void eTextPara::newLine(int flags) eTextPara::~eTextPara() { clear(); - if (refcnt>=0) - eFatal("verdammt man der war noch gelockt :/\n"); -} - -void eTextPara::destroy() -{ - singleLock s(refcntlck); - - if (!refcnt--) - delete this; -} - -eTextPara *eTextPara::grab() -{ - singleLock s(refcntlck); - - refcnt++; - return this; } void eTextPara::setFont(const gFont *font) { - if (refcnt) - eFatal("mod. after lock"); ePtr fnt, replacement; fontRenderClass::getInstance()->getFont(fnt, font->family.c_str(), font->pointSize); if (!fnt) @@ -424,8 +404,6 @@ eString eTextPara::replacement_facename; void eTextPara::setFont(Font *fnt, Font *replacement) { - if (refcnt) - eFatal("mod. after lock"); if (!fnt) return; current_font=fnt; @@ -463,9 +441,6 @@ int eTextPara::renderString(const eString &string, int rflags) { singleLock s(ftlock); - if (refcnt) - eFatal("mod. after lock"); - if (!current_font) return -1; @@ -689,8 +664,7 @@ void eTextPara::blit(gDC &dc, const ePoint &offset, const gRGB &background, cons } gRegion area(eRect(0, 0, surface->x, surface->y)); - gRegion clip; - clip.intersect(area, dc.getClip()); + gRegion clip = dc.getClip() & area; int buffer_stride=surface->stride; diff --git a/lib/gdi/font.h b/lib/gdi/font.h index 9977eb3..7b01a42 100644 --- a/lib/gdi/font.h +++ b/lib/gdi/font.h @@ -92,7 +92,6 @@ private: eSize maximum; int left; glyphString glyphs; - int refcnt; int appendGlyph(Font *current_font, FT_Face current_face, FT_UInt glyphIndex, int flags, int rflags); void newLine(int flags); @@ -103,16 +102,13 @@ private: public: eTextPara(eRect area, ePoint start=ePoint(-1, -1)) : current_font(0), replacement_font(0), current_face(0), replacement_face(0), - area(area), cursor(start), maximum(0, 0), left(start.x()), refcnt(0), bboxValid(0) + area(area), cursor(start), maximum(0, 0), left(start.x()), bboxValid(0) { } virtual ~eTextPara(); static void setReplacementFont(eString font) { replacement_facename=font; } - void destroy(); - eTextPara *grab(); - void setFont(const gFont *font); int renderString(const eString &string, int flags=0); diff --git a/lib/gdi/gpixmap.cpp b/lib/gdi/gpixmap.cpp index 1d2a4e3..7b7b91a 100644 --- a/lib/gdi/gpixmap.cpp +++ b/lib/gdi/gpixmap.cpp @@ -1,6 +1,8 @@ #include #include +DEFINE_REF(gFont); + gLookup::gLookup() :size(0), lookup(0) { diff --git a/lib/gdi/gpixmap.h b/lib/gdi/gpixmap.h index 0d123b3..f091233 100644 --- a/lib/gdi/gpixmap.h +++ b/lib/gdi/gpixmap.h @@ -87,7 +87,7 @@ struct gLookup * The font is specified by a name and a size. * \c gFont is part of the \ref gdi. */ -class gFont: public virtual iObject +class gFont: public iObject { DECLARE_REF; public: diff --git a/lib/gdi/grc.cpp b/lib/gdi/grc.cpp index 46181d3..4597034 100644 --- a/lib/gdi/grc.cpp +++ b/lib/gdi/grc.cpp @@ -45,9 +45,11 @@ gRC::~gRC() gOpcode o; o.opcode=gOpcode::shutdown; submit(o); +#ifndef SYNC_PAINT eDebug("waiting for gRC thread shutdown"); pthread_join(the_thread, 0); eDebug("gRC thread has finished"); +#endif } void *gRC::thread() @@ -254,6 +256,7 @@ void gPainter::resetOffset() o.opcode=gOpcode::setOffset; o.dc = m_dc.grabRef(); o.parm.setOffset = new gOpcode::para::psetOffset; + o.parm.setOffset->rel = 0; o.parm.setOffset->value = ePoint(0, 0); m_rc->submit(o); } @@ -326,15 +329,16 @@ void gDC::exec(gOpcode *o) case gOpcode::renderText: { ePtr para = new eTextPara(o->parm.renderText->area); + assert(m_current_font); para->setFont(m_current_font); para->renderString(o->parm.renderText->text, o->parm.renderText->flags); - para->blit(*this, ePoint(0, 0), getRGB(m_foreground_color), getRGB(m_background_color)); + para->blit(*this, m_current_offset, getRGB(m_foreground_color), getRGB(m_background_color)); delete o->parm.renderText; break; } case gOpcode::renderPara: { - o->parm.renderPara->textpara->blit(*this, o->parm.renderPara->offset, getRGB(m_foreground_color), getRGB(m_background_color)); + o->parm.renderPara->textpara->blit(*this, o->parm.renderPara->offset + m_current_offset, getRGB(m_foreground_color), getRGB(m_background_color)); o->parm.renderPara->textpara->Release(); delete o->parm.renderPara; break; @@ -355,7 +359,7 @@ void gDC::exec(gOpcode *o) case gOpcode::blit: { gRegion clip; - if (!o->parm.blit->clip.isValid()) + if (!o->parm.blit->clip.valid()) { clip.intersect(gRegion(o->parm.blit->clip), clip); } else diff --git a/lib/gdi/grc.h b/lib/gdi/grc.h index 4793179..0f66ef0 100644 --- a/lib/gdi/grc.h +++ b/lib/gdi/grc.h @@ -117,7 +117,7 @@ struct gOpcode }; /* gRC is the singleton which controls the fifo and dispatches commands */ -class gRC: public virtual iObject +class gRC: public iObject { DECLARE_REF; private: diff --git a/lib/gdi/region.cpp b/lib/gdi/region.cpp index cbac53f..f79b403 100644 --- a/lib/gdi/region.cpp +++ b/lib/gdi/region.cpp @@ -26,10 +26,11 @@ gRegion::gRegion(const eRect &rect) : extends(rect) { - rects.push_back(rect); + if (rect.valid() && !rect.empty()) + rects.push_back(rect); } -gRegion::gRegion() +gRegion::gRegion() : extends(eRect::emptyRect()) { } @@ -265,8 +266,8 @@ void gRegion::regionOp(const gRegion ®1, const gRegion ®2, int opcode, int bot = min(r1->y2, r2y1); if (top != bot) { curBand = rects.size(); - appendNonO(r1, r1BandEnd, top, bot); - coalesce(prevBand, curBand); + appendNonO(r1, r1BandEnd, top, bot); + coalesce(prevBand, curBand); } } ytop = r2y1; @@ -319,22 +320,24 @@ void gRegion::regionOp(const gRegion ®1, const gRegion ®2, int opcode, int coalesce(prevBand, curBand); AppendRegions(r2BandEnd, r2End); } + extends = eRect(); - for (int a=0; a +#include #include class gRegion @@ -88,6 +89,11 @@ public: void merge(const gRegion &r1, const gRegion &r2); void moveBy(ePoint offset); + + bool empty() const { return extends.empty(); } + bool valid() const { return extends.valid(); } + + static gRegion invalidRegion() { return gRegion(eRect::invalidRect()); } }; #endif diff --git a/lib/gui/Makefile.am b/lib/gui/Makefile.am index b4137a5..a686e1c 100644 --- a/lib/gui/Makefile.am +++ b/lib/gui/Makefile.am @@ -4,4 +4,6 @@ INCLUDES = \ noinst_LIBRARIES = libenigma_gui.a -libenigma_gui_a_SOURCES = +libenigma_gui_a_SOURCES = \ + ebutton.cpp elabel.cpp ewidget.cpp ewidgetdesktop.cpp ewindow.cpp ewindowstyle.cpp + diff --git a/lib/network/http_dyn.cpp b/lib/network/http_dyn.cpp index ea47019..d020133 100644 --- a/lib/network/http_dyn.cpp +++ b/lib/network/http_dyn.cpp @@ -31,7 +31,7 @@ int eHTTPDyn::doWrite(int hm) eHTTPDynPathResolver::eHTTPDynPathResolver() { - dyn.setAutoDelete(true); +#warning autodelete removed } void eHTTPDynPathResolver::addDyn(eString request, eString path, eString (*function)(eString, eString, eString, eHTTPConnection*)) diff --git a/lib/network/http_file.cpp b/lib/network/http_file.cpp index 8991856..19c8a15 100644 --- a/lib/network/http_file.cpp +++ b/lib/network/http_file.cpp @@ -58,7 +58,7 @@ eHTTPFile::~eHTTPFile() eHTTPFilePathResolver::eHTTPFilePathResolver() { - translate.setAutoDelete(true); +#warning autodelete removed } diff --git a/lib/network/httpd.cpp b/lib/network/httpd.cpp index b8ed1a9..acd3ebe 100644 --- a/lib/network/httpd.cpp +++ b/lib/network/httpd.cpp @@ -614,7 +614,7 @@ eHTTPD::eHTTPD(int port, eMainloop *ml): eServerSocket(port, ml), ml(ml) eDebug("[NET] httpd server FAILED on port %d", port); else eDebug("[NET] httpd server started on port %d", port); - resolver.setAutoDelete(true); +#warning resolver autodelete removed } eHTTPConnection::~eHTTPConnection() diff --git a/lib/network/xmlrpc.cpp b/lib/network/xmlrpc.cpp index a53b50a..57b09e8 100644 --- a/lib/network/xmlrpc.cpp +++ b/lib/network/xmlrpc.cpp @@ -256,7 +256,8 @@ static eXMLRPCVariant *fromXML(XMLTreeNode *n) } else if (!strcmp(n->GetType(), "array")) { ePtrList l; - l.setAutoDelete(true); + #warning autodelete removed +// l.setAutoDelete(true); n=n->GetChild(); if (strcmp(data, "data")) return 0; @@ -312,7 +313,8 @@ int eXMLRPCResponse::doCall() } ePtrList params; - params.setAutoDelete(true); +// params.setAutoDelete(true); +#warning params autodelete remove for (XMLTreeNode *c=methodCall->GetChild(); c; c=c->GetNext()) { @@ -342,7 +344,8 @@ int eXMLRPCResponse::doCall() ""; ePtrList ret; - ret.setAutoDelete(true); +// ret.setAutoDelete(true); +#warning autodelete removed int (*proc)(std::vector&, ePtrList &)=rpcproc[methodName]; int fault; diff --git a/lib/service/iservice.h b/lib/service/iservice.h index 9eeb07c..253f8c3 100644 --- a/lib/service/iservice.h +++ b/lib/service/iservice.h @@ -134,20 +134,20 @@ public: } }; -class iServiceInformation: public virtual iObject +class iServiceInformation: public iObject { public: virtual RESULT getName(eString &name)=0; }; -class iPauseableService: public virtual iObject +class iPauseableService: public iObject { public: virtual RESULT pause()=0; virtual RESULT unpause()=0; }; -class iPlayableService: public virtual iObject +class iPlayableService: public iObject { friend class iServiceHandler; public: @@ -163,20 +163,20 @@ public: virtual RESULT getIServiceInformation(ePtr &ptr)=0; }; -class iRecordableService: public virtual iObject +class iRecordableService: public iObject { public: virtual RESULT start()=0; virtual RESULT stop()=0; }; -class iListableService: public virtual iObject +class iListableService: public iObject { public: virtual RESULT getContent(std::list &list)=0; }; -class iServiceHandler: public virtual iObject +class iServiceHandler: public iObject { public: virtual RESULT play(const eServiceReference &, ePtr &ptr)=0; diff --git a/lib/service/service.h b/lib/service/service.h index f32e23d..bd40fb0 100644 --- a/lib/service/service.h +++ b/lib/service/service.h @@ -5,7 +5,7 @@ #include #include -class eServiceCenter: public virtual iServiceHandler, public virtual iObject +class eServiceCenter: public iServiceHandler { DECLARE_REF; private: diff --git a/lib/service/servicedvb.h b/lib/service/servicedvb.h index 1de4586..6e90148 100644 --- a/lib/service/servicedvb.h +++ b/lib/service/servicedvb.h @@ -6,7 +6,7 @@ #include -class eServiceFactoryDVB: public virtual iServiceHandler, public virtual iObject +class eServiceFactoryDVB: public iServiceHandler { DECLARE_REF; public: @@ -20,7 +20,7 @@ public: RESULT list(const eServiceReference &, ePtr &ptr); }; -class eDVBServicePlay: public virtual iPlayableService, public virtual iObject, public Object, public virtual iServiceInformation +class eDVBServicePlay: public iPlayableService, public Object, public iServiceInformation { DECLARE_REF; private: diff --git a/lib/service/servicefs.h b/lib/service/servicefs.h index 9d49b42..f98cbc4 100644 --- a/lib/service/servicefs.h +++ b/lib/service/servicefs.h @@ -3,7 +3,7 @@ #include -class eServiceFactoryFS: public virtual iServiceHandler, public virtual iObject +class eServiceFactoryFS: public iServiceHandler { DECLARE_REF; public: @@ -17,7 +17,7 @@ public: RESULT list(const eServiceReference &, ePtr &ptr); }; -class eServiceFS: public virtual iListableService, public virtual iObject +class eServiceFS: public iListableService { DECLARE_REF; private: diff --git a/lib/service/servicemp3.cpp b/lib/service/servicemp3.cpp index 0ff36db..105ffbf 100644 --- a/lib/service/servicemp3.cpp +++ b/lib/service/servicemp3.cpp @@ -75,7 +75,7 @@ DEFINE_REF(eServiceMP3); RESULT eServiceMP3::connectEvent(const Slot2 &event, ePtr &connection) { - connection = new eConnection(this, m_event.connect(event)); + connection = new eConnection((iPlayableService*)this, m_event.connect(event)); return 0; } diff --git a/lib/service/servicemp3.h b/lib/service/servicemp3.h index d51207f..940e141 100644 --- a/lib/service/servicemp3.h +++ b/lib/service/servicemp3.h @@ -3,7 +3,7 @@ #include -class eServiceFactoryMP3: public virtual iServiceHandler, public virtual iObject +class eServiceFactoryMP3: public iServiceHandler { DECLARE_REF; public: @@ -17,7 +17,7 @@ public: RESULT list(const eServiceReference &, ePtr &ptr); }; -class eServiceMP3: public virtual iPlayableService, public virtual iPauseableService, public virtual iServiceInformation, public virtual iObject, public Object +class eServiceMP3: public iPlayableService, public iPauseableService, public iServiceInformation, public Object { DECLARE_REF; private: diff --git a/main/Makefile.am b/main/Makefile.am index 1e663e7..ff99797 100644 --- a/main/Makefile.am +++ b/main/Makefile.am @@ -8,23 +8,23 @@ enigma2_SOURCES = \ enigma2_LDADD_WHOLE = \ $(top_builddir)/lib/base/libenigma_base.a \ + $(top_builddir)/lib/content/libenigma_content.a \ $(top_builddir)/lib/driver/libenigma_driver.a \ $(top_builddir)/lib/dvb/libenigma_dvb.a \ $(top_builddir)/lib/dvb_si/libenigma_dvb_si.a \ - $(top_builddir)/lib/gui/libenigma_gui.a \ $(top_builddir)/lib/gdi/libenigma_gdi.a \ + $(top_builddir)/lib/gui/libenigma_gui.a \ $(top_builddir)/lib/nav/libenigma_nav.a \ $(top_builddir)/lib/network/libenigma_network.a \ $(top_builddir)/lib/service/libenigma_service.a enigma2_LDADD = \ @FREETYPE_LIBS@ \ + @XMLTREE_LIBS@ \ @ID3TAG_LIBS@ \ @MAD_LIBS@ \ - @MD5SUM_LIBS@ \ @PNG_LIBS@ \ @SIGC_LIBS@ \ - @XMLTREE_LIBS@ \ -ldl -lpthread -lcrypt -lresolv enigma2$(EXEEXT): $(enigma2_OBJECTS) $(enigma2_DEPENDENCIES) $(enigma2_LDADD_WHOLE) diff --git a/main/enigma.cpp b/main/enigma.cpp index 29469ea..dd9084a 100644 --- a/main/enigma.cpp +++ b/main/enigma.cpp @@ -5,135 +5,17 @@ #include #include -#include -#include -#include -#include -#include -#include #include -#include -#include +#include +#include +#include -class eMain: public eApplication, public Object -{ - eInit init; - - ePtr m_mgr; - ePtr m_channel; - ePtr m_dvbdb; - - ePtr m_playservice; - ePtr m_nav; - ePtr m_conn_event; - ePtr m_serviceInformation; -public: - eMain() - { - init.setRunlevel(eAutoInitNumbers::main); - m_dvbdb = new eDVBDB(); - m_mgr = new eDVBResourceManager(); - m_mgr->setChannelList(m_dvbdb); - - ePtr service_center; - eServiceCenter::getInstance(service_center); - - assert(service_center); - m_nav = new eNavigation(service_center); -#if 0 - if (service_center) - { - eServiceReference ref("2:0:1:0:0:0:0:0:0:0:/"); - ePtr lst; - if (service_center->list(ref, lst)) - eDebug("no list available!"); - else - { - std::list list; - if (lst->getContent(list)) - eDebug("list itself SUCKED AROUND!!!"); - else - for (std::list::const_iterator i(list.begin()); - i != list.end(); ++i) - eDebug("%s", i->toString().c_str()); - } - } -#endif - m_nav->connectEvent(slot(*this, &eMain::event), m_conn_event); - -// eServiceReference ref("1:0:1:6de2:44d:1:c00000:0:0:0:"); - eServiceReference ref("4097:47:0:0:0:0:0:0:0:0:/sine_60s_100.mp3"); - eServiceReference ref1("4097:47:0:0:0:0:0:0:0:0:/sine_60s_100.mp31"); - eServiceReference ref2("4097:47:0:0:0:0:0:0:0:0:/sine_60s_100.mp32"); - - if (m_nav->enqueueService(ref)) - eDebug("play sucked around!"); - else - eDebug("play r00lz!"); - - m_nav->enqueueService(ref1); - m_nav->enqueueService(ref2); - m_nav->enqueueService(ref1); - } - - void event(eNavigation *nav, int ev) - { - assert(nav); - - ePtr playlist; - nav->getPlaylist(playlist); - if (playlist) - { - eDebug("PLAYLIST:"); - ePlaylist::iterator i; - for (i=playlist->begin(); i != playlist->end(); ++i) - eDebug("%s %s", i == playlist->m_current ? "-->" : " ", i->toString().c_str()); - } - - switch (ev) - { - case eNavigation::evStopService: - /* very important: the old service should be deallocated, so clear *all* references to it */ - m_serviceInformation = 0; - eDebug("STOP service!"); - break; - case eNavigation::evNewService: - { - ePtr service; - nav->getCurrentService(service); - if (!service) - { - eDebug("no running service!"); - break; - } - if (service->getIServiceInformation(m_serviceInformation)) - { - eDebug("failed to get iserviceinformation"); - break; - } - eString name; - m_serviceInformation->getName(name); - eDebug("NEW running service: %s", name.c_str()); - break; - } - case eNavigation::evPlayFailed: - eDebug("play failed!"); - break; - case eNavigation::evPlaylistDone: - eDebug("playlist done"); - quit(); - break; - default: - eDebug("Navigation event %d", ev); - break; - } - } - - ~eMain() - { - } -}; +#include +#include +#include + +#include #ifdef OBJECT_DEBUG int object_total_remaining; @@ -144,14 +26,143 @@ void object_dump() } #endif +void dumpRegion(const gRegion ®ion) +{ + fprintf(stderr, "extends: %d %d -> %d %d (%d rects)\n", + region.extends.left(), region.extends.top(), + region.extends.right(), region.extends.bottom(), region.rects.size()); + for (int y=0; y my_dc; + gFBDC::getInstance(my_dc); +#if 1 + + gPainter p(my_dc); + + gRGB pal[256]; + pal[0] = 0; + pal[1] = 0xff00ff; + pal[2] = 0xffFFff; + pal[3] = 0x00ff00; + + for (int a=0; a<0x10; ++a) + pal[a | 0x10] = (0x111111 * a) | 0xFF; + p.setPalette(pal, 0, 256); + + fontRenderClass::getInstance()->AddFont("/dbox2/cdkroot/share/fonts/arial.ttf", "Arial", 100); + +#if 0 + p.resetClip(gRegion(eRect(0, 0, 720, 576))); + + + gRegion c; + eDebug("0"); + int i; + + c |= eRect(0, 20, 100, 10); + c |= eRect(0, 50, 100, 10); + c |= eRect(10, 10, 80, 100); + + c -= eRect(20, 20, 40, 40); + + p.setForegroundColor(gColor(3)); + p.fill(eRect(0, 0, 100, 100)); + p.fill(eRect(200, 0, 100, 100)); + + for (int a=0; a %d %d", c.rects[a].left(), c.rects[a].top(), c.rects[a].right(), c.rects[a].bottom()); + eDebug("extends: %d %d %d %d", c.extends.left(), c.extends.top(), c.extends.right(), c.extends.bottom()); + p.setOffset(ePoint(100, 100)); + p.clip(c); + + p.setBackgroundColor(gColor(1)); + p.clear(); + p.setForegroundColor(gColor(2)); + p.line(ePoint(0, 0), ePoint(220, 190)); + p.clippop(); + + p.setBackgroundColor(gColor(0x1f)); + p.setForegroundColor(gColor(0x10)); + + ePtr fnt = new gFont("Arial", 70); + p.setFont(fnt); + p.renderText(eRect(100, 100, 500, 200), "Hello welt!"); +#else + + + eWidgetDesktop dsk(eSize(720, 576)); + dsk.setDC(my_dc); + + eWindow *bla = new eWindow(&dsk); + + bla->move(ePoint(100, 100)); + bla->resize(eSize(200, 200)); + bla->show(); + + eLabel *blablub = new eLabel(bla->child()); + blablub->setText("hello world"); + blablub->move(ePoint(0, 0)); + blablub->resize(eSize(400,400)); + +#if 0 + eWidget *bla2 = new eWidget(0); + dsk.addRootWidget(bla2, 0); + + bla2->move(ePoint(160, 160)); + bla2->resize(eSize(200, 200)); + bla2->show(); +#endif + + dsk.recalcClipRegions(); + +// dumpRegion(bla->m_visible_region); +// dumpRegion(bla2->m_visible_region); +// dumpRegion(blablub->m_visible_region); + + eDebug("painting!"); + + dsk.invalidate(gRegion(eRect(0, 0, 720, 576))); + dsk.paint(); +#endif + +#else + + extern void contentTest(); + + eDebug("Contenttest"); + contentTest(); + +#endif + + p.resetClip(gRegion(eRect(0, 0, 720, 576))); +// p.clear(); + sleep(1); + +// blablub->setText("123"); +// dumpRegion(blablub->m_visible_region); +// dumpRegion(dsk.m_dirty_region); + dsk.paint(); + + return 0; }