diff options
| author | Felix Domke <tmbinc@elitedvb.net> | 2005-02-27 02:20:31 +0000 |
|---|---|---|
| committer | Felix Domke <tmbinc@elitedvb.net> | 2005-02-27 02:20:31 +0000 |
| commit | dba614edd2aad3c17e244914eaef3809d8300cb1 (patch) | |
| tree | 382782ddff50bf88e421d933b13e35b9e5682cff /lib | |
| parent | 1cdf6cb021fcaa6548b90ba7b6765cf1e8b8b37b (diff) | |
| download | enigma2-dba614edd2aad3c17e244914eaef3809d8300cb1.tar.gz enigma2-dba614edd2aad3c17e244914eaef3809d8300cb1.zip | |
- hopefully fixed some python/refcount stuff (__deref__ is still evil!)
- first work on skin support, not really far
- improved infobar
- deletes components when destroying screens
- fixed elistbox and component
- add ability to change bouqet - real query parser still unfinished
Diffstat (limited to 'lib')
41 files changed, 228 insertions, 123 deletions
diff --git a/lib/base/ebase.h b/lib/base/ebase.h index 187f9548..d9a17b79 100644 --- a/lib/base/ebase.h +++ b/lib/base/ebase.h @@ -171,40 +171,7 @@ public: void setRequested(int req) { requested=req; } }; - // ... und Timer -/** - * \brief Gives a callback after a specified timeout. - * - * This class emits the signal \c eTimer::timeout after the specified timeout. - */ -class eTimer -{ - eMainloop &context; - timeval nextActivation; - long interval; - bool bSingleShot; - bool bActive; -public: - /** - * \brief Constructs a timer. - * - * The timer is not yet active, it has to be started with \c start. - * \param context The thread from which the signal should be emitted. - */ - eTimer(eMainloop *context): context(*context), bActive(false) { } - ~eTimer() { if (bActive) stop(); } - - PSignal0<void> timeout; - void activate(); - - bool isActive() { return bActive; } - timeval &getNextActivation() { return nextActivation; } - - void start(long msec, bool singleShot=false); - void stop(); - void changeInterval(long msek); - bool operator<(const eTimer& t) const { return nextActivation < t.nextActivation; } -}; +class eTimer; // werden in einer mainloop verarbeitet class eMainloop @@ -231,6 +198,7 @@ public: void exit_loop(); }; + /** * \brief The application class. * @@ -250,4 +218,40 @@ public: eApp = 0; } }; + + // ... und Timer +/** + * \brief Gives a callback after a specified timeout. + * + * This class emits the signal \c eTimer::timeout after the specified timeout. + */ +class eTimer +{ + eMainloop &context; + timeval nextActivation; + long interval; + bool bSingleShot; + bool bActive; +public: + /** + * \brief Constructs a timer. + * + * The timer is not yet active, it has to be started with \c start. + * \param context The thread from which the signal should be emitted. + */ + eTimer(eMainloop *context = eApp): context(*context), bActive(false) { } + ~eTimer() { if (bActive) stop(); } + + PSignal0<void> timeout; + void activate(); + + bool isActive() { return bActive; } + timeval &getNextActivation() { return nextActivation; } + + void start(long msec, bool singleShot=false); + void stop(); + void changeInterval(long msek); + bool operator<(const eTimer& t) const { return nextActivation < t.nextActivation; } +}; + #endif diff --git a/lib/base/object.h b/lib/base/object.h index 64d9a88f..edd68a86 100644 --- a/lib/base/object.h +++ b/lib/base/object.h @@ -37,12 +37,22 @@ public: } }; -#define DECLARE_REF private: oRefCount ref; public: void AddRef(); void Release(); +#ifndef SWIG +#define DECLARE_REF(x) private: oRefCount ref; public: void AddRef(); void Release(); #ifdef OBJECT_DEBUG extern int object_total_remaining; #define DEFINE_REF(c) void c::AddRef() { ++object_total_remaining; ++ref; eDebug("OBJECT_DEBUG " #c "+%p now %d", this, (int)ref); } void c::Release() { --object_total_remaining; eDebug("OBJECT_DEBUG " #c "-%p now %d", this, ref-1); if (!--ref) delete this; } #else #define DEFINE_REF(c) void c::AddRef() { ++ref; } void c::Release() { if (!--ref) delete this; } #endif +#else +#define DECLARE_REF(x) private: void AddRef(); void Release(); +#endif + +#ifdef SWIG +class Object +{ +}; +#endif #endif diff --git a/lib/components/scan.h b/lib/components/scan.h index 073919c7..ca64f5e2 100644 --- a/lib/components/scan.h +++ b/lib/components/scan.h @@ -7,7 +7,7 @@ class eDVBScan; class eComponentScan: public Object, public iObject { -DECLARE_REF; +DECLARE_REF(eComponentScan); private: void scanEvent(int event); ePtr<eConnection> m_scan_event_connection; diff --git a/lib/dvb/db.h b/lib/dvb/db.h index 55998ebf..22eb0b74 100644 --- a/lib/dvb/db.h +++ b/lib/dvb/db.h @@ -8,7 +8,7 @@ class ServiceDescriptionTable; class eDVBDB: public iDVBChannelList { -DECLARE_REF; +DECLARE_REF(eDVBDB); friend class eDVBDBQuery; private: struct channel @@ -37,7 +37,7 @@ public: // we have to add a possibility to invalidate here. class eDVBDBQuery: public iDVBChannelListQuery { -DECLARE_REF; +DECLARE_REF(eDVBDBQuery); private: std::map<eServiceReferenceDVB, ePtr<eDVBService> >::iterator m_cursor; ePtr<eDVBDB> m_db; diff --git a/lib/dvb/decoder.h b/lib/dvb/decoder.h index b1e65611..b566df89 100644 --- a/lib/dvb/decoder.h +++ b/lib/dvb/decoder.h @@ -6,7 +6,7 @@ class eDVBAudio: public iObject { -DECLARE_REF; +DECLARE_REF(eDVBAudio); private: ePtr<eDVBDemux> m_demux; int m_fd, m_fd_demux; @@ -19,7 +19,7 @@ public: class eDVBVideo: public iObject { -DECLARE_REF; +DECLARE_REF(eDVBVideo); private: ePtr<eDVBDemux> m_demux; int m_fd, m_fd_demux; @@ -32,7 +32,7 @@ public: class eTSMPEGDecoder: public iTSMPEGDecoder { -DECLARE_REF; +DECLARE_REF(eTSMPEGDecoder); private: ePtr<eDVBDemux> m_demux; ePtr<eDVBAudio> m_audio; diff --git a/lib/dvb/demux.h b/lib/dvb/demux.h index c7fa5bc0..d8c1078e 100644 --- a/lib/dvb/demux.h +++ b/lib/dvb/demux.h @@ -11,7 +11,7 @@ class eDVBDemux: public iDVBDemux friend class eDVBAudio; friend class eDVBVideo; public: - DECLARE_REF + DECLARE_REF(eDVBDemux); eDVBDemux(int adapter, int demux); virtual ~eDVBDemux(); RESULT createSectionReader(eMainloop *context, ePtr<iDVBSectionReader> &reader); @@ -20,7 +20,7 @@ public: class eDVBSectionReader: public iDVBSectionReader, public Object { - DECLARE_REF + DECLARE_REF(eDVBSectionReader); private: int fd; Signal1<void, const __u8*> read; diff --git a/lib/dvb/dvb.h b/lib/dvb/dvb.h index 52dd9a07..8a13b403 100644 --- a/lib/dvb/dvb.h +++ b/lib/dvb/dvb.h @@ -10,7 +10,7 @@ class eDVBChannel; class eDVBResourceManager: public iDVBResourceManager { - DECLARE_REF; + DECLARE_REF(eDVBResourceManager); int avail, busy; struct adapter { @@ -40,7 +40,7 @@ public: class eDVBChannel: public iDVBChannel, public eDVBDemux, public Object { - DECLARE_REF; + DECLARE_REF(eDVBChannel); private: ePtr<eDVBFrontend> m_frontend; ePtr<iDVBFrontendParameters> m_current_frontend_parameters; diff --git a/lib/dvb/esection.h b/lib/dvb/esection.h index 6b8c8784..df0b93e5 100644 --- a/lib/dvb/esection.h +++ b/lib/dvb/esection.h @@ -6,7 +6,7 @@ class eGTable: public iObject, public Object { -DECLARE_REF; +DECLARE_REF(eGTable); private: ePtr<iDVBSectionReader> m_reader; eDVBTableSpec m_table; diff --git a/lib/dvb/frontend.h b/lib/dvb/frontend.h index 9036dc3e..f4e99fae 100644 --- a/lib/dvb/frontend.h +++ b/lib/dvb/frontend.h @@ -6,7 +6,7 @@ class eDVBFrontendParameters: public iDVBFrontendParameters { - DECLARE_REF; + DECLARE_REF(eDVBFrontendParameters); union { eDVBFrontendParametersSatellite sat; @@ -33,7 +33,7 @@ public: class eDVBFrontend: public iDVBFrontend, public Object { - DECLARE_REF; + DECLARE_REF(eDVBFrontend); int m_type; int m_fd; #if HAVE_DVB_API_VERSION < 3 diff --git a/lib/dvb/idvb.h b/lib/dvb/idvb.h index 4d728b4c..da626866 100644 --- a/lib/dvb/idvb.h +++ b/lib/dvb/idvb.h @@ -160,7 +160,7 @@ class eDVBChannelQuery; class eDVBService: public iStaticServiceInformation { - DECLARE_REF; + DECLARE_REF(eDVBService); public: eDVBService(); std::string m_service_name; @@ -194,7 +194,7 @@ public: class eDVBChannelQuery: public iObject { - DECLARE_REF; + DECLARE_REF(eDVBChannelQuery); public: enum { diff --git a/lib/dvb/list.h b/lib/dvb/list.h index 6df49803..80ad20e8 100644 --- a/lib/dvb/list.h +++ b/lib/dvb/list.h @@ -3,7 +3,7 @@ class eDVBTransponderList: iDVBChannelList { - DECLARE_REF; + DECLARE_REF(eDVBTransponderList); private: std::map<eDVBChannelID, ePtr<iDVBFrontendParameters> > channels; public: diff --git a/lib/dvb/scan.h b/lib/dvb/scan.h index 96264e88..2f75291b 100644 --- a/lib/dvb/scan.h +++ b/lib/dvb/scan.h @@ -10,7 +10,7 @@ class eDVBScan: public Object, public iObject { -DECLARE_REF; +DECLARE_REF(eDVBScan); private: /* chid helper functions: */ diff --git a/lib/dvb/sec.h b/lib/dvb/sec.h index 0bda004c..ea01108d 100644 --- a/lib/dvb/sec.h +++ b/lib/dvb/sec.h @@ -7,7 +7,7 @@ class eDVBSatelliteEquipmentControl: public iDVBSatelliteEquipmentControl { public: - DECLARE_REF; + DECLARE_REF(eDVBSatelliteEquipmentControl); eDVBSatelliteEquipmentControl(); RESULT prepare(iDVBFrontend &frontend, FRONTENDPARAMETERS &parm, eDVBFrontendParametersSatellite &sat); }; diff --git a/lib/gdi/font.h b/lib/gdi/font.h index a17fee71..ff2a88c5 100644 --- a/lib/gdi/font.h +++ b/lib/gdi/font.h @@ -79,7 +79,7 @@ class eLCD; class eTextPara: public iObject { -DECLARE_REF; +DECLARE_REF(eTextPara); private: ePtr<Font> current_font, replacement_font; FT_Face current_face, replacement_face; @@ -139,7 +139,7 @@ public: class Font: public iObject { -DECLARE_REF; +DECLARE_REF(Font); public: FTC_Image_Desc font; fontRenderClass *renderer; diff --git a/lib/gdi/gpixmap.h b/lib/gdi/gpixmap.h index 9dd170ac..396d92b7 100644 --- a/lib/gdi/gpixmap.h +++ b/lib/gdi/gpixmap.h @@ -89,7 +89,7 @@ struct gLookup */ class gFont: public iObject { -DECLARE_REF; +DECLARE_REF(gFont); public: std::string family; @@ -133,7 +133,7 @@ struct gSurfaceSystem: gSurface struct gPixmap: public iObject { -DECLARE_REF; +DECLARE_REF(gPixmap); private: friend class gDC; void fill(const gRegion &clip, const gColor &color); diff --git a/lib/gdi/grc.h b/lib/gdi/grc.h index 5eb81314..f6829902 100644 --- a/lib/gdi/grc.h +++ b/lib/gdi/grc.h @@ -124,7 +124,7 @@ struct gOpcode /* gRC is the singleton which controls the fifo and dispatches commands */ class gRC: public iObject { -DECLARE_REF; +DECLARE_REF(gRC); private: static gRC *instance; @@ -212,7 +212,7 @@ public: class gDC: public iObject { -DECLARE_REF; +DECLARE_REF(gDC); protected: ePtr<gPixmap> m_pixmap; diff --git a/lib/gui/elistbox.cpp b/lib/gui/elistbox.cpp index 1dae137f..a3fae34c 100644 --- a/lib/gui/elistbox.cpp +++ b/lib/gui/elistbox.cpp @@ -22,11 +22,17 @@ eListbox::~eListbox() void eListbox::setContent(iListboxContent *content) { m_content = content; + if (content) + m_content->setListbox(this); entryReset(); } void eListbox::moveSelection(int dir) { + /* refuse to do anything without a valid list. */ + if (!m_content) + return; + /* we need the old top/sel to see what we have to redraw */ int oldtop = m_top; int oldsel = m_selected; @@ -98,6 +104,8 @@ int eListbox::event(int event, void *data, void *data2) { ePtr<eWindowStyle> style; + if (!m_content) + return eWidget::event(event, data, data2); assert(m_content); recalcSize(); // move to event @@ -183,9 +191,10 @@ void eListbox::entryChanged(int index) void eListbox::entryReset() { - invalidate(); if (m_content) m_content->cursorHome(); m_top = 0; m_selected = 0; + invalidate(); + eDebug("inval!"); } diff --git a/lib/gui/elistbox.h b/lib/gui/elistbox.h index 78e0fbe9..9e23bde3 100644 --- a/lib/gui/elistbox.h +++ b/lib/gui/elistbox.h @@ -21,6 +21,7 @@ public: anyway. */ #ifndef SWIG protected: + iListboxContent(); friend class eListbox; virtual void cursorHome()=0; virtual void cursorEnd()=0; @@ -72,12 +73,8 @@ public: pageDown, justCheck }; -protected: - int event(int event, void *data=0, void *data2=0); - void recalcSize(); -private: - friend class iListboxContent; - + +#ifndef SWIG /* entryAdded: an entry was added *before* the given index. it's index is the given number. */ void entryAdded(int index); /* entryRemoved: an entry with the given index was removed. */ @@ -86,11 +83,18 @@ private: void entryChanged(int index); /* the complete list changed. you should not attemp to keep the current index. */ void entryReset(); + +protected: + int event(int event, void *data=0, void *data2=0); + void recalcSize(); +private: int m_top, m_selected; int m_itemheight; int m_items_per_page; ePtr<iListboxContent> m_content; +#endif + }; #endif diff --git a/lib/gui/elistboxcontent.cpp b/lib/gui/elistboxcontent.cpp index 0a10b27a..209b5250 100644 --- a/lib/gui/elistboxcontent.cpp +++ b/lib/gui/elistboxcontent.cpp @@ -29,6 +29,10 @@ iListboxContent::~iListboxContent() { } +iListboxContent::iListboxContent(): m_listbox(0) +{ +} + void iListboxContent::setListbox(eListbox *lb) { m_listbox = lb; diff --git a/lib/gui/elistboxcontent.h b/lib/gui/elistboxcontent.h index deea3000..a2e1fd36 100644 --- a/lib/gui/elistboxcontent.h +++ b/lib/gui/elistboxcontent.h @@ -6,7 +6,7 @@ class eListboxTestContent: public virtual iListboxContent { - DECLARE_REF; + DECLARE_REF(eListboxTestContent); public: #ifndef SWIG @@ -37,7 +37,7 @@ private: class eListboxStringContent: public virtual iListboxContent { - DECLARE_REF; + DECLARE_REF(eListboxStringContent); public: eListboxStringContent(); void setList(std::list<std::string> &list); @@ -75,7 +75,7 @@ private: class eListboxPythonStringContent: public virtual iListboxContent { - DECLARE_REF; + DECLARE_REF(eListboxPythonStringContent); public: eListboxPythonStringContent(); ~eListboxPythonStringContent(); diff --git a/lib/gui/ewidget.h b/lib/gui/ewidget.h index 12d2e743..97eb1434 100644 --- a/lib/gui/ewidget.h +++ b/lib/gui/ewidget.h @@ -5,8 +5,6 @@ #include <lib/base/eptrlist.h> /* for eSmartPtrList */ #include <lib/gui/ewindowstyle.h> /* for eWindowStyle */ -class eWindowStyle; - class eWidget { friend class eWidgetDesktop; diff --git a/lib/gui/ewindowstyle.cpp b/lib/gui/ewindowstyle.cpp index ccf7299f..3b8271f6 100644 --- a/lib/gui/ewindowstyle.cpp +++ b/lib/gui/ewindowstyle.cpp @@ -105,3 +105,34 @@ void eWindowStyleSimple::drawFrame(gPainter &painter, const eRect &frame, int wh painter.line(frame.bottomRight1(), frame.bottomLeft1()); painter.line(frame.bottomLeft1(), frame.topLeft1()); } + +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) +{ +} + diff --git a/lib/gui/ewindowstyle.h b/lib/gui/ewindowstyle.h index 74ff88d5..6431c242 100644 --- a/lib/gui/ewindowstyle.h +++ b/lib/gui/ewindowstyle.h @@ -32,7 +32,7 @@ public: class eWindowStyleSimple: public eWindowStyle { - DECLARE_REF; + DECLARE_REF(eWindowStyleSimple); private: ePtr<gFont> m_fnt; gColor m_border_color_tl, m_border_color_br, m_title_color_back, m_title_color, m_background_color; @@ -47,4 +47,43 @@ public: void drawFrame(gPainter &painter, const eRect &frame, int what); }; +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<gPixmap> m_pixmap[9]; + }; + + void drawBorder(gPainter &painter, const eSize &size, const struct borderSet &border, int where); +}; + #endif diff --git a/lib/nav/core.h b/lib/nav/core.h index c049e43d..6c94fe2c 100644 --- a/lib/nav/core.h +++ b/lib/nav/core.h @@ -8,7 +8,7 @@ class eNavigation: public iObject, public Object { - DECLARE_REF; + DECLARE_REF(eNavigation); private: ePtr<iPlayableService> m_runningService; ePtr<iServiceHandler> m_servicehandler; diff --git a/lib/nav/pcore.h b/lib/nav/pcore.h index 004bab27..1a910b82 100644 --- a/lib/nav/pcore.h +++ b/lib/nav/pcore.h @@ -8,7 +8,7 @@ class pNavigation: public iObject, public Object { -DECLARE_REF; +DECLARE_REF(pNavigation); public: PSignal1<void, int> m_event; diff --git a/lib/nav/playlist.h b/lib/nav/playlist.h index 6d89406e..e69de29b 100644 --- a/lib/nav/playlist.h +++ b/lib/nav/playlist.h @@ -1,17 +0,0 @@ -#ifndef __lib_nav_playlist_h -#define __lib_nav_playlist_h - -#include <list> -#include <lib/base/object.h> -#include <lib/service/iservice.h> - -class ePlaylist: public iObject, public std::list<eServiceReference> -{ -DECLARE_REF; -public: - ePlaylist(); - virtual ~ePlaylist(); - std::list<eServiceReference>::iterator m_current; -}; - -#endif diff --git a/lib/network/http_dyn.h b/lib/network/http_dyn.h index 61116409..24e4dba1 100644 --- a/lib/network/http_dyn.h +++ b/lib/network/http_dyn.h @@ -5,7 +5,7 @@ class eHTTPDyn: public eHTTPDataSource { - DECLARE_REF; + DECLARE_REF(eHTTPDyn); private: std::string result; int wptr, size; @@ -17,11 +17,11 @@ public: class eHTTPDynPathResolver: public iHTTPPathResolver { - DECLARE_REF; + DECLARE_REF(eHTTPDynPathResolver); private: - struct eHTTPDynEntry + struct eHTTPDynEntry: public iObject { - DECLARE_REF; + DECLARE_REF(eHTTPDynEntry); public: std::string request, path; std::string (*function)(std::string request, std::string path, std::string opt, eHTTPConnection *content); diff --git a/lib/network/http_file.h b/lib/network/http_file.h index 6feb562d..a9c86c5c 100644 --- a/lib/network/http_file.h +++ b/lib/network/http_file.h @@ -5,7 +5,7 @@ class eHTTPFile: public eHTTPDataSource { - DECLARE_REF; + DECLARE_REF(eHTTPFile); private: int fd, size; const char *mime; @@ -20,7 +20,7 @@ public: class eHTTPFilePathResolver: public iHTTPPathResolver { - DECLARE_REF; + DECLARE_REF(eHTTPFilePathResolver); public: struct eHTTPFilePath { diff --git a/lib/network/httpd.h b/lib/network/httpd.h index 30c3c032..aa8c5288 100644 --- a/lib/network/httpd.h +++ b/lib/network/httpd.h @@ -41,7 +41,7 @@ typedef ePtr<eHTTPDataSource> eHTTPDataSourcePtr; class eHTTPError: public eHTTPDataSource { - DECLARE_REF; + DECLARE_REF(eHTTPError); private: int errcode; public: diff --git a/lib/network/xmlrpc.h b/lib/network/xmlrpc.h index 05fd3cca..b43e8e3d 100644 --- a/lib/network/xmlrpc.h +++ b/lib/network/xmlrpc.h @@ -71,7 +71,7 @@ int xmlrpc_checkArgs(std::string args, std::vector<eXMLRPCVariant>&, ePtrList<eX class eHTTPXMLRPCResolver: public iHTTPPathResolver { - DECLARE_REF; + DECLARE_REF(eHTTPXMLRPCResolver); public: eHTTPXMLRPCResolver(); eHTTPDataSource *getDataSource(std::string request, std::string path, eHTTPConnection *conn); diff --git a/lib/python/Makefile.am b/lib/python/Makefile.am index e82cb650..dbcf489e 100644 --- a/lib/python/Makefile.am +++ b/lib/python/Makefile.am @@ -9,3 +9,9 @@ libenigma_python_a_SOURCES = \ enigma_python_wrap.cxx: enigma_python.i swig -I$(top_srcdir)/ -c++ -python enigma_python.i + +enigma_python.i: enigma_iobject.i + +enigma_iobject.i: + find ../../.. -name "*.cpp" | xargs grep -h "DEFINE_REF" > enigma_iobject.i +
\ No newline at end of file diff --git a/lib/python/enigma_python.i b/lib/python/enigma_python.i index 33fc0a14..096254f9 100644 --- a/lib/python/enigma_python.i +++ b/lib/python/enigma_python.i @@ -32,14 +32,9 @@ Oh, things like "operator= is private in this context" etc. is usually caused by not marking PSignals as immutable. */ -%define RefCount(...) -%typemap(newfree) __VA_ARGS__ * { eDebug("adding ref"); $1->AddRef(); } -%extend __VA_ARGS__ { ~__VA_ARGS__() { eDebug("removing ref!"); self->Release(); } } -%ignore __VA_ARGS__::~__VA_ARGS__(); -%enddef - %module enigma %{ + #define SWIG_COMPILE #include <lib/base/ebase.h> #include <lib/base/smartptr.h> @@ -54,6 +49,7 @@ is usually caused by not marking PSignals as immutable. #include <lib/gui/ebutton.h> #include <lib/gui/ewindow.h> #include <lib/gui/ewidgetdesktop.h> +#include <lib/gui/ewindowstyle.h> #include <lib/gui/eslider.h> #include <lib/python/connections.h> #include <lib/gui/elistbox.h> @@ -69,9 +65,10 @@ extern void quitMainloop(); extern PSignal1<void,int> &keyPressedSignal(); %} -RefCount(eListboxPythonStringContent) -RefCount(eListboxServiceContent) -RefCount(eComponentScan) +%feature("ref") iObject "$this->AddRef(); eDebug(\"AddRef (%s:%d)!\", __FILE__, __LINE__); " +%feature("unref") iObject "$this->Release(); eDebug(\"Release! %s:%d\", __FILE__, __LINE__); " + +%newobject eDebugClassPtr::operator->; #define DEBUG %include "typemaps.i" @@ -82,6 +79,7 @@ RefCount(eComponentScan) %include <lib/base/smartptr.h> %include <lib/service/iservice.h> %include <lib/service/service.h> + %template(eServiceCenterPtr) ePtr<eServiceCenter>; %include <lib/service/event.h> @@ -103,6 +101,7 @@ RefCount(eComponentScan) %include <lib/gui/ewidgetdesktop.h> %include <lib/gui/elistbox.h> %include <lib/gui/elistboxcontent.h> +%include <lib/gui/ewindowstyle.h> %include <lib/service/listboxservice.h> %include <lib/components/scan.h> %include <lib/nav/pcore.h> @@ -111,7 +110,6 @@ RefCount(eComponentScan) /************** eptr **************/ %template(eActionMapPtr) ePtr<eActionMap>; -RefCount(eActionMap) %apply eActionMapPtr OUTPUT { eActionMapPtr &ptr } %apply eActionMap* *OUTPUT { eActionMap **ptr } @@ -169,3 +167,4 @@ void runMainloop(); void quitMainloop(); %immutable keyPressed; PSignal1<void,int> &keyPressedSignal(); + diff --git a/lib/service/event.cpp b/lib/service/event.cpp index 7ea16560..58079da0 100644 --- a/lib/service/event.cpp +++ b/lib/service/event.cpp @@ -8,8 +8,7 @@ DEFINE_REF(eServiceEvent); RESULT eServiceEvent::parseFrom(Event *evt) { m_begin = 0; // ich bin FAUL - m_duration = evt->getDuration(); - + m_duration = (evt->getDuration() & 0xFF) + ((evt->getDuration() >> 8) & 0xFF) * 60 + ((evt->getDuration() >> 16) & 0xFF) * 24 * 60; for (DescriptorConstIterator desc = evt->getDescriptors()->begin(); desc != evt->getDescriptors()->end(); ++desc) { @@ -24,4 +23,7 @@ RESULT eServiceEvent::parseFrom(Event *evt) } } } + return 0; } + +DEFINE_REF(eDebugClass); diff --git a/lib/service/event.h b/lib/service/event.h index 094b080a..99ce5b24 100644 --- a/lib/service/event.h +++ b/lib/service/event.h @@ -8,7 +8,7 @@ class Event; class eServiceEvent: public iObject { -DECLARE_REF; +DECLARE_REF(eServiceEvent); public: time_t m_begin; int m_duration; @@ -20,4 +20,16 @@ public: TEMPLATE_TYPEDEF(ePtr<eServiceEvent>, eServiceEventPtr); +class eDebugClass: public iObject +{ + DECLARE_REF(eDebugClass); +public: + int x; + static void getDebug(ePtr<eDebugClass> &ptr, int x) { ptr = new eDebugClass(x); } + eDebugClass(int i) { printf("build debug class %d\n", i); x = i; } + ~eDebugClass() { printf("remove debug class %d\n", x); } +}; + +// TEMPLATE_TYPEDEF(ePtr<eDebugClass>, eDebugClassPtr); + #endif diff --git a/lib/service/listboxservice.cpp b/lib/service/listboxservice.cpp index 881047df..647dbdb9 100644 --- a/lib/service/listboxservice.cpp +++ b/lib/service/listboxservice.cpp @@ -3,6 +3,7 @@ void eListboxServiceContent::setRoot(const eServiceReference &root) { + m_list.clear(); m_root = root; assert(m_service_center); @@ -16,6 +17,9 @@ void eListboxServiceContent::setRoot(const eServiceReference &root) m_size = m_list.size(); cursorHome(); + + if (m_listbox) + m_listbox->entryReset(); } void eListboxServiceContent::getCurrent(eServiceReference &ref) diff --git a/lib/service/listboxservice.h b/lib/service/listboxservice.h index 9d0cb721..231bab16 100644 --- a/lib/service/listboxservice.h +++ b/lib/service/listboxservice.h @@ -8,7 +8,7 @@ class eServiceCenter; class eListboxServiceContent: public virtual iListboxContent { - DECLARE_REF; + DECLARE_REF(eListboxServiceContent); public: eListboxServiceContent(); void setRoot(const eServiceReference &ref); diff --git a/lib/service/service.h b/lib/service/service.h index 9f4b4560..2dd01acc 100644 --- a/lib/service/service.h +++ b/lib/service/service.h @@ -11,7 +11,7 @@ typedef ePtr<eServiceCenter> eServiceCenterPtr; class eServiceCenter: public iServiceHandler { -DECLARE_REF; +DECLARE_REF(eServiceCenter); private: std::map<int,iServiceHandlerPtr> handler; static eServiceCenter *instance; diff --git a/lib/service/servicedvb.h b/lib/service/servicedvb.h index 2e8d899a..d414d69b 100644 --- a/lib/service/servicedvb.h +++ b/lib/service/servicedvb.h @@ -9,7 +9,7 @@ class eServiceFactoryDVB: public iServiceHandler { -DECLARE_REF; +DECLARE_REF(eServiceFactoryDVB); public: eServiceFactoryDVB(); virtual ~eServiceFactoryDVB(); @@ -24,7 +24,7 @@ public: class eDVBServiceList: public iListableService { -DECLARE_REF; +DECLARE_REF(eDVBServiceList); private: eServiceReference m_parent; friend class eServiceFactoryDVB; @@ -36,7 +36,7 @@ public: class eDVBServicePlay: public iPlayableService, public Object, public iServiceInformation { -DECLARE_REF; +DECLARE_REF(eDVBServicePlay); private: friend class eServiceFactoryDVB; eServiceReference m_reference; diff --git a/lib/service/servicefs.cpp b/lib/service/servicefs.cpp index 5a945679..9db85028 100644 --- a/lib/service/servicefs.cpp +++ b/lib/service/servicefs.cpp @@ -14,7 +14,7 @@ class eStaticServiceFSInformation: public iStaticServiceInformation { - DECLARE_REF; + DECLARE_REF(eStaticServiceFSInformation); public: RESULT getName(const eServiceReference &ref, std::string &name); }; diff --git a/lib/service/servicefs.h b/lib/service/servicefs.h index 337ff620..61fcb4a9 100644 --- a/lib/service/servicefs.h +++ b/lib/service/servicefs.h @@ -5,7 +5,7 @@ class eServiceFactoryFS: public iServiceHandler { -DECLARE_REF; +DECLARE_REF(eServiceFactoryFS); public: eServiceFactoryFS(); virtual ~eServiceFactoryFS(); @@ -22,7 +22,7 @@ private: class eServiceFS: public iListableService { -DECLARE_REF; +DECLARE_REF(eServiceFS); private: std::string path; friend class eServiceFactoryFS; diff --git a/lib/service/servicemp3.h b/lib/service/servicemp3.h index 40287ae5..4bec7365 100644 --- a/lib/service/servicemp3.h +++ b/lib/service/servicemp3.h @@ -7,7 +7,7 @@ class eStaticServiceMP3Info; class eServiceFactoryMP3: public iServiceHandler { -DECLARE_REF; +DECLARE_REF(eServiceFactoryMP3); public: eServiceFactoryMP3(); virtual ~eServiceFactoryMP3(); @@ -24,7 +24,7 @@ private: class eStaticServiceMP3Info: public iServiceInformation { - DECLARE_REF; + DECLARE_REF(eStaticServiceMP3Info); friend class eServiceFactoryMP3; eStaticServiceMP3Info(); public: @@ -33,7 +33,7 @@ public: class eServiceMP3: public iPlayableService, public iPauseableService, public iServiceInformation, public Object { -DECLARE_REF; +DECLARE_REF(eServiceMP3); private: friend class eServiceFactoryMP3; std::string filename; |
