- new GUI lib
authorFelix Domke <tmbinc@elitedvb.net>
Sat, 25 Sep 2004 16:13:48 +0000 (16:13 +0000)
committerFelix Domke <tmbinc@elitedvb.net>
Sat, 25 Sep 2004 16:13:48 +0000 (16:13 +0000)
 - fixes

38 files changed:
include/connection.h
lib/Makefile.am
lib/base/eerror.cpp
lib/base/eptrlist.h
lib/dvb/db.h
lib/dvb/decoder.h
lib/dvb/demux.h
lib/dvb/dvb.cpp
lib/dvb/dvb.h
lib/dvb/esection.h
lib/dvb/frontend.h
lib/dvb/idvb.h
lib/dvb/isection.h
lib/dvb/scan.h
lib/gdi/erect.cpp
lib/gdi/erect.h
lib/gdi/fb.cpp
lib/gdi/font.cpp
lib/gdi/font.h
lib/gdi/gpixmap.cpp
lib/gdi/gpixmap.h
lib/gdi/grc.cpp
lib/gdi/grc.h
lib/gdi/region.cpp
lib/gdi/region.h
lib/gui/Makefile.am
lib/network/http_dyn.cpp
lib/network/http_file.cpp
lib/network/httpd.cpp
lib/network/xmlrpc.cpp
lib/service/iservice.h
lib/service/service.h
lib/service/servicedvb.h
lib/service/servicefs.h
lib/service/servicemp3.cpp
lib/service/servicemp3.h
main/Makefile.am
main/enigma.cpp

index a085650..ae799c9 100644 (file)
@@ -4,7 +4,7 @@
 #include <libsig_comp.h>
 #include <lib/base/object.h>
 
-class eConnection: public virtual iObject, public Connection
+class eConnection: public iObject, public Connection
 {
        int ref;
        ePtr<iObject> m_owner;
index 4243911..2ff9992 100644 (file)
@@ -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
index ac62f1e..68541d4 100644 (file)
@@ -4,7 +4,9 @@
 #include <stdlib.h>
 #include <unistd.h>
 
-#include <lib/gui/emessage.h>
+#include <lib/base/estring.h>
+
+// #include <lib/gui/emessage.h>
 
 int infatal=0;
 
index f1421eb..ae61d78 100644 (file)
@@ -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<T>::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<T*>::erase(it);
                else
@@ -377,7 +368,7 @@ public:
 /////////////////// Default Constructor /////////////////////////////
 template <class T>
 ePtrList<T>::ePtrList()
-    :cur(std::list<T*>::begin()), autoDelete(false)            
+    :cur(std::list<T*>::begin())
 {              
 
 }
@@ -385,27 +376,16 @@ ePtrList<T>::ePtrList()
 /////////////////// Copy Constructor /////////////////////////////
 template <class T>
 ePtrList<T>::ePtrList(const ePtrList& e)
-       :std::list<T*>(e), cur(e.cur), autoDelete( false )
+       :std::list<T*>(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 <class T>
 inline ePtrList<T>::~ePtrList()
 {
-// if autoDelete is enabled, delete is called for all elements in the list
-       if (autoDelete)
-               for (std_list_T_iterator it(std::list<T*>::begin()); it != std::list<T*>::end(); it++)
-                       delete *it;
 }
 
-
 /////////////////// ePtrList sort() /////////////////////////
 template <class T>
 inline void ePtrList<T>::sort()
@@ -655,22 +635,6 @@ bool ePtrList<T>::operator!()
 }
 
 template <class T>
-void ePtrList<T>::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 <class T>
-bool ePtrList<T>::isAutoDelete()
-{
-// returns a bool that contains the state of autoDelete
-       return autoDelete;
-}
-
-template <class T>
 class eSmartPtrList : public std::list<ePtr<T> >
 {
 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<T>::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<ePtr<T> >::erase(it);
@@ -1042,7 +998,7 @@ public:
 /////////////////// Default Constructor /////////////////////////////
 template <class T>
 eSmartPtrList<T>::eSmartPtrList()
-    :cur(std::list<ePtr<T> >::begin()), autoDelete(false)              
+    :cur(std::list<ePtr<T> >::begin())
 {              
 
 }
@@ -1050,24 +1006,14 @@ eSmartPtrList<T>::eSmartPtrList()
 /////////////////// Copy Constructor /////////////////////////////
 template <class T>
 eSmartPtrList<T>::eSmartPtrList(const eSmartPtrList& e)
-       :std::list<ePtr<T> >(e), cur(e.cur), autoDelete( false )
+       :std::list<ePtr<T> >(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 <class T>
 inline eSmartPtrList<T>::~eSmartPtrList()
 {
-// if autoDelete is enabled, delete is called for all elements in the list
-       if (autoDelete)
-               for (std_list_T_iterator it(std::list<ePtr<T> >::begin()); it != std::list<ePtr<T> >::end(); it++)
-                       delete *it;
 }
 
 
@@ -1319,20 +1265,4 @@ bool eSmartPtrList<T>::operator!()
        return empty(); 
 }
 
-template <class T>
-void eSmartPtrList<T>::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 <class T>
-bool eSmartPtrList<T>::isAutoDelete()
-{
-// returns a bool that contains the state of autoDelete
-       return autoDelete;
-}
-
 #endif // _E_PTRLIST
index 763df7e..fe4833c 100644 (file)
@@ -20,7 +20,7 @@ public:
 
 class ServiceDescriptionTable;
 
-class eDVBDB: public virtual iDVBChannelList
+class eDVBDB: public iDVBChannelList
 {
 DECLARE_REF;
 private:
index 6694e9f..b1e6561 100644 (file)
@@ -4,7 +4,7 @@
 #include <lib/base/object.h>
 #include <lib/dvb/demux.h>
 
-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:
index 3b4cbed..c7fa5bc 100644 (file)
@@ -4,7 +4,7 @@
 #include <lib/dvb/idvb.h>
 #include <lib/dvb/isection.h>
 
-class eDVBDemux: public virtual iDVBDemux
+class eDVBDemux: public iDVBDemux
 {
        int adapter, demux;
        friend class eDVBSectionReader;
@@ -18,7 +18,7 @@ public:
        RESULT getMPEGDecoder(ePtr<iTSMPEGDecoder> &reader);
 };
 
-class eDVBSectionReader: public virtual iDVBSectionReader, public Object
+class eDVBSectionReader: public iDVBSectionReader, public Object
 {
        DECLARE_REF
 private:
index 29ffa15..8acd0c5 100644 (file)
@@ -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<void,iDVBChannel*> &stateChange, ePtr<eConnection> &connection)
 {
-       connection = new eConnection(this, m_stateChanged.connect(stateChange));
+       connection = new eConnection((iDVBChannel*)this, m_stateChanged.connect(stateChange));
        return 0;
 }
 
index f6aae23..52dd9a0 100644 (file)
@@ -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<eDVBFrontend> m_frontend;
        ePtr<iDVBFrontendParameters> m_current_frontend_parameters;
        eDVBChannelID m_channel_id;
index ca63c18..78895e7 100644 (file)
@@ -4,7 +4,7 @@
 #include <lib/dvb/isection.h>
 #include <set>
 
-class eGTable: public virtual iObject, public Object
+class eGTable: public iObject, public Object
 {
 DECLARE_REF;
 private:
index ee7f945..c179d57 100644 (file)
@@ -3,7 +3,7 @@
 
 #include <lib/dvb/idvb.h>
 
-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;
index c4ae488..a69f170 100644 (file)
@@ -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<iDVBFrontendParameters> &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<iDVBSectionReader> &reader)=0;
index 04b50f5..f44c163 100644 (file)
@@ -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;
index cc72764..61a211b 100644 (file)
@@ -6,7 +6,7 @@
 #include <lib/dvb_si/bat.h>
 #include <lib/dvb/db.h>
 
-class eDVBScan: public Object, public virtual iObject
+class eDVBScan: public Object, public iObject
 {
                /* chid helper functions: */
                
index b72e5d0..a387879 100644 (file)
@@ -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 ) );
index 9eaa790..a67d0fb 100644 (file)
@@ -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
index 4b8a56c..e792204 100644 (file)
@@ -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()
index 2f2823b..a8f0b12 100644 (file)
@@ -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<Font> 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;
 
index 9977eb3..7b01a42 100644 (file)
@@ -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);
 
index 1d2a4e3..7b7b91a 100644 (file)
@@ -1,6 +1,8 @@
 #include <lib/gdi/gpixmap.h>
 #include <lib/gdi/region.h>
 
+DEFINE_REF(gFont);
+
 gLookup::gLookup()
        :size(0), lookup(0)
 {
index 0d123b3..f091233 100644 (file)
@@ -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:
index 46181d3..4597034 100644 (file)
@@ -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<eTextPara> 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
index 4793179..0f66ef0 100644 (file)
@@ -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:
index cbac53f..f79b403 100644 (file)
 
 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 &reg1, const gRegion &reg2, 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 &reg1, const gRegion &reg2, int opcode, int
                coalesce(prevBand, curBand);
                AppendRegions(r2BandEnd, r2End);
        }
+       
        extends = eRect();
 
-       for (int a=0; a<rects.size(); ++a)
-               extends = extends | eRect(rects[0].topLeft(), rects[rects.size()-1].bottomRight());
+       for (unsigned int a = 0; a<rects.size(); ++a)
+               extends = extends | rects[a];
 }
        
 void gRegion::intersect(const gRegion &r1, const gRegion &r2)
 {
+               /* in case one region is empty, the resulting regions is empty, too. */
        if (r1.rects.empty())
        {
-               *this = r2;
+               *this = r1;
                return;
        }
        if (r2.rects.empty())
        {
-               *this = r1;
+               *this = r2;
                return;
        }
        int overlap;
@@ -416,7 +419,7 @@ gRegion &gRegion::operator|=(const gRegion &r2)
 void gRegion::moveBy(ePoint offset)
 {
        extends.moveBy(offset);
-       int i;
+       unsigned int i;
        for (i=0; i<rects.size(); ++i)
                rects[i].moveBy(offset);
 }
index 7f73be7..d7217da 100644 (file)
@@ -2,6 +2,7 @@
 #define __lib_gdi_region_h
 
 #include <lib/base/object.h>
+#include <lib/gdi/erect.h>
 #include <vector>
 
 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
index b4137a5..a686e1c 100644 (file)
@@ -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
+
index ea47019..d020133 100644 (file)
@@ -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*))
index 8991856..19c8a15 100644 (file)
@@ -58,7 +58,7 @@ eHTTPFile::~eHTTPFile()
 
 eHTTPFilePathResolver::eHTTPFilePathResolver()
 {
-       translate.setAutoDelete(true);
+#warning autodelete removed
 }
 
 
index b8ed1a9..acd3ebe 100644 (file)
@@ -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()
index a53b50a..57b09e8 100644 (file)
@@ -256,7 +256,8 @@ static eXMLRPCVariant *fromXML(XMLTreeNode *n)
        } else if (!strcmp(n->GetType(), "array"))
        {
                ePtrList<eXMLRPCVariant> 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<eXMLRPCVariant> 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()
                "<methodResponse>";
        
        ePtrList<eXMLRPCVariant> ret;
-       ret.setAutoDelete(true);
+//     ret.setAutoDelete(true);
+#warning autodelete removed
 
        int (*proc)(std::vector<eXMLRPCVariant>&, ePtrList<eXMLRPCVariant> &)=rpcproc[methodName];
        int fault;
index 9eeb07c..253f8c3 100644 (file)
@@ -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<iServiceInformation> &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<eServiceReference> &list)=0;
 };
 
-class iServiceHandler: public virtual iObject
+class iServiceHandler: public iObject
 {
 public:
        virtual RESULT play(const eServiceReference &, ePtr<iPlayableService> &ptr)=0;
index f32e23d..bd40fb0 100644 (file)
@@ -5,7 +5,7 @@
 #include <lib/base/object.h>
 #include <lib/service/iservice.h>
 
-class eServiceCenter: public virtual iServiceHandler, public virtual iObject
+class eServiceCenter: public iServiceHandler
 {
 DECLARE_REF;
 private:
index 1de4586..6e90148 100644 (file)
@@ -6,7 +6,7 @@
 
 #include <lib/dvb/pmt.h>
 
-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<iListableService> &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:
index 9d49b42..f98cbc4 100644 (file)
@@ -3,7 +3,7 @@
 
 #include <lib/service/iservice.h>
 
-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<iListableService> &ptr);
 };
 
-class eServiceFS: public virtual iListableService, public virtual iObject
+class eServiceFS: public iListableService
 {
 DECLARE_REF;
 private:
index 0ff36db..105ffbf 100644 (file)
@@ -75,7 +75,7 @@ DEFINE_REF(eServiceMP3);
 
 RESULT eServiceMP3::connectEvent(const Slot2<void,iPlayableService*,int> &event, ePtr<eConnection> &connection)
 {
-       connection = new eConnection(this, m_event.connect(event));
+       connection = new eConnection((iPlayableService*)this, m_event.connect(event));
        return 0;
 }
 
index d51207f..940e141 100644 (file)
@@ -3,7 +3,7 @@
 
 #include <lib/service/iservice.h>
 
-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<iListableService> &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:
index 1e663e7..ff99797 100644 (file)
@@ -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)
index 29469ea..dd9084a 100644 (file)
 #include <lib/base/init.h>
 #include <lib/base/init_num.h>
 
-#include <lib/dvb/dvb.h>
-#include <lib/dvb/db.h>
-#include <lib/dvb/isection.h>
-#include <lib/dvb/esection.h>
-#include <lib/dvb_si/pmt.h>
-#include <lib/dvb/scan.h>
 #include <unistd.h>
 
-#include <lib/service/iservice.h>
-#include <lib/nav/core.h>
+#include <lib/gdi/grc.h>
+#include <lib/gdi/gfbdc.h>
+#include <lib/gdi/font.h> 
 
-class eMain: public eApplication, public Object
-{
-       eInit init;
-       
-       ePtr<eDVBResourceManager> m_mgr;
-       ePtr<iDVBChannel> m_channel;
-       ePtr<eDVBDB> m_dvbdb;
-
-       ePtr<iPlayableService> m_playservice;
-       ePtr<eNavigation> m_nav;
-       ePtr<eConnection> m_conn_event;
-       ePtr<iServiceInformation> m_serviceInformation;
-public:
-       eMain()
-       {
-               init.setRunlevel(eAutoInitNumbers::main);
-               m_dvbdb = new eDVBDB();
-               m_mgr = new eDVBResourceManager();
-               m_mgr->setChannelList(m_dvbdb);
-               
-               ePtr<eServiceCenter> 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<iListableService> lst;
-                       if (service_center->list(ref, lst))
-                               eDebug("no list available!");
-                       else
-                       {
-                               std::list<eServiceReference> list;
-                               if (lst->getContent(list))
-                                       eDebug("list itself SUCKED AROUND!!!");
-                               else
-                                       for (std::list<eServiceReference>::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<ePlaylist> 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<iPlayableService> 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 <lib/gui/ewidget.h>
+#include <lib/gui/ewidgetdesktop.h>
+#include <lib/gui/elabel.h>
+
+#include <lib/gui/ewindow.h>
 
 #ifdef OBJECT_DEBUG
 int object_total_remaining;
@@ -144,14 +26,143 @@ void object_dump()
 }
 #endif
 
+void dumpRegion(const gRegion &region)
+{
+       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<region.extends.bottom(); ++y)
+       {
+               for (int x=0; x<region.extends.right(); ++x)
+               {
+                       unsigned char res = ' ';
+                       for (unsigned int i=0; i < region.rects.size(); ++i)
+                               if (region.rects[i].contains(ePoint(x, y)))
+                                       res = '0' + i;
+                       fprintf(stderr, "%c", res);
+               }
+               fprintf(stderr, "\n");
+       }
+}
+
 int main()
 {
 #ifdef OBJECT_DEBUG
        atexit(object_dump);
 #endif
 
-       eMain app;
-       int res = app.exec();
-       eDebug("after exec");
-       return res;
+       eInit init;
+
+       init.setRunlevel(eAutoInitNumbers::main);
+       ePtr<gFBDC> 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<c.rects.size(); ++a)
+               eDebug("%d %d -> %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<gFont> 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;
 }