aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Domke <tmbinc@elitedvb.net>2004-09-25 16:13:48 +0000
committerFelix Domke <tmbinc@elitedvb.net>2004-09-25 16:13:48 +0000
commit1aeefd997cc362c3b37c1587c5f08891b35c3a75 (patch)
tree621600d89b20531ee9e6497dbc9fb50db8a4d759
parent636a782d8920b4b52a881a4565c46c06f68785b5 (diff)
downloadenigma2-1aeefd997cc362c3b37c1587c5f08891b35c3a75.tar.gz
enigma2-1aeefd997cc362c3b37c1587c5f08891b35c3a75.zip
- new GUI lib
- fixes
-rw-r--r--include/connection.h2
-rw-r--r--lib/Makefile.am6
-rw-r--r--lib/base/eerror.cpp4
-rw-r--r--lib/base/eptrlist.h78
-rw-r--r--lib/dvb/db.h2
-rw-r--r--lib/dvb/decoder.h6
-rw-r--r--lib/dvb/demux.h4
-rw-r--r--lib/dvb/dvb.cpp4
-rw-r--r--lib/dvb/dvb.h6
-rw-r--r--lib/dvb/esection.h2
-rw-r--r--lib/dvb/frontend.h4
-rw-r--r--lib/dvb/idvb.h12
-rw-r--r--lib/dvb/isection.h2
-rw-r--r--lib/dvb/scan.h2
-rw-r--r--lib/gdi/erect.cpp4
-rw-r--r--lib/gdi/erect.h44
-rw-r--r--lib/gdi/fb.cpp3
-rw-r--r--lib/gdi/font.cpp28
-rw-r--r--lib/gdi/font.h6
-rw-r--r--lib/gdi/gpixmap.cpp2
-rw-r--r--lib/gdi/gpixmap.h2
-rw-r--r--lib/gdi/grc.cpp10
-rw-r--r--lib/gdi/grc.h2
-rw-r--r--lib/gdi/region.cpp21
-rw-r--r--lib/gdi/region.h6
-rw-r--r--lib/gui/Makefile.am4
-rw-r--r--lib/network/http_dyn.cpp2
-rw-r--r--lib/network/http_file.cpp2
-rw-r--r--lib/network/httpd.cpp2
-rw-r--r--lib/network/xmlrpc.cpp9
-rw-r--r--lib/service/iservice.h12
-rw-r--r--lib/service/service.h2
-rw-r--r--lib/service/servicedvb.h4
-rw-r--r--lib/service/servicefs.h4
-rw-r--r--lib/service/servicemp3.cpp2
-rw-r--r--lib/service/servicemp3.h4
-rw-r--r--main/Makefile.am6
-rw-r--r--main/enigma.cpp271
38 files changed, 249 insertions, 337 deletions
diff --git a/include/connection.h b/include/connection.h
index a085650d..ae799c98 100644
--- a/include/connection.h
+++ b/include/connection.h
@@ -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;
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 4243911c..2ff99926 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 ac62f1e9..68541d41 100644
--- a/lib/base/eerror.cpp
+++ b/lib/base/eerror.cpp
@@ -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;
diff --git a/lib/base/eptrlist.h b/lib/base/eptrlist.h
index f1421eb2..ae61d78d 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<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
diff --git a/lib/dvb/db.h b/lib/dvb/db.h
index 763df7eb..fe4833cd 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 6694e9fc..b1e65611 100644
--- a/lib/dvb/decoder.h
+++ b/lib/dvb/decoder.h
@@ -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:
diff --git a/lib/dvb/demux.h b/lib/dvb/demux.h
index 3b4cbede..c7fa5bc0 100644
--- a/lib/dvb/demux.h
+++ b/lib/dvb/demux.h
@@ -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:
diff --git a/lib/dvb/dvb.cpp b/lib/dvb/dvb.cpp
index 29ffa151..8acd0c5d 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<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;
}
diff --git a/lib/dvb/dvb.h b/lib/dvb/dvb.h
index f6aae238..52dd9a07 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<eDVBFrontend> m_frontend;
ePtr<iDVBFrontendParameters> m_current_frontend_parameters;
eDVBChannelID m_channel_id;
diff --git a/lib/dvb/esection.h b/lib/dvb/esection.h
index ca63c184..78895e76 100644
--- a/lib/dvb/esection.h
+++ b/lib/dvb/esection.h
@@ -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:
diff --git a/lib/dvb/frontend.h b/lib/dvb/frontend.h
index ee7f945a..c179d574 100644
--- a/lib/dvb/frontend.h
+++ b/lib/dvb/frontend.h
@@ -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;
diff --git a/lib/dvb/idvb.h b/lib/dvb/idvb.h
index c4ae488d..a69f170f 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<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;
diff --git a/lib/dvb/isection.h b/lib/dvb/isection.h
index 04b50f52..f44c1632 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 cc727644..61a211ba 100644
--- a/lib/dvb/scan.h
+++ b/lib/dvb/scan.h
@@ -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: */
diff --git a/lib/gdi/erect.cpp b/lib/gdi/erect.cpp
index b72e5d04..a3878797 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 9eaa7906..a67d0fb9 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 4b8a56c9..e792204d 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 2f2823bb..a8f0b120 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<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;
diff --git a/lib/gdi/font.h b/lib/gdi/font.h
index 9977eb39..7b01a425 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 1d2a4e39..7b7b91a8 100644
--- a/lib/gdi/gpixmap.cpp
+++ b/lib/gdi/gpixmap.cpp
@@ -1,6 +1,8 @@
#include <lib/gdi/gpixmap.h>
#include <lib/gdi/region.h>
+DEFINE_REF(gFont);
+
gLookup::gLookup()
:size(0), lookup(0)
{
diff --git a/lib/gdi/gpixmap.h b/lib/gdi/gpixmap.h
index 0d123b3f..f0912334 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 46181d32..4597034f 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<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
diff --git a/lib/gdi/grc.h b/lib/gdi/grc.h
index 47931792..0f66ef08 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 cbac53f8..f79b403f 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 &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);
}
diff --git a/lib/gdi/region.h b/lib/gdi/region.h
index 7f73be75..d7217dae 100644
--- a/lib/gdi/region.h
+++ b/lib/gdi/region.h
@@ -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
diff --git a/lib/gui/Makefile.am b/lib/gui/Makefile.am
index b4137a52..a686e1ca 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 ea47019b..d020133a 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 89918569..19c8a15f 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 b8ed1a9d..acd3ebe6 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 a53b50a8..57b09e82 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<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;
diff --git a/lib/service/iservice.h b/lib/service/iservice.h
index 9eeb07c8..253f8c3b 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<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;
diff --git a/lib/service/service.h b/lib/service/service.h
index f32e23d9..bd40fb08 100644
--- a/lib/service/service.h
+++ b/lib/service/service.h
@@ -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:
diff --git a/lib/service/servicedvb.h b/lib/service/servicedvb.h
index 1de4586c..6e901483 100644
--- a/lib/service/servicedvb.h
+++ b/lib/service/servicedvb.h
@@ -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:
diff --git a/lib/service/servicefs.h b/lib/service/servicefs.h
index 9d49b42d..f98cbc4c 100644
--- a/lib/service/servicefs.h
+++ b/lib/service/servicefs.h
@@ -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:
diff --git a/lib/service/servicemp3.cpp b/lib/service/servicemp3.cpp
index 0ff36db0..105ffbfa 100644
--- a/lib/service/servicemp3.cpp
+++ b/lib/service/servicemp3.cpp
@@ -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;
}
diff --git a/lib/service/servicemp3.h b/lib/service/servicemp3.h
index d51207ff..940e141d 100644
--- a/lib/service/servicemp3.h
+++ b/lib/service/servicemp3.h
@@ -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:
diff --git a/main/Makefile.am b/main/Makefile.am
index 1e663e76..ff99797d 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 29469eab..dd9084a2 100644
--- a/main/enigma.cpp
+++ b/main/enigma.cpp
@@ -5,135 +5,17 @@
#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;
}