#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;
-SUBDIRS = base dvb dvb_si gdi network service driver nav
-#gui
-
-
-
+SUBDIRS = base dvb dvb_si gdi network service driver nav content gui
#include <stdlib.h>
#include <unistd.h>
-#include <lib/gui/emessage.h>
+#include <lib/base/estring.h>
+
+// #include <lib/gui/emessage.h>
int infatal=0;
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()
{
{
// 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
/////////////////// Default Constructor /////////////////////////////
template <class T>
ePtrList<T>::ePtrList()
- :cur(std::list<T*>::begin()), autoDelete(false)
+ :cur(std::list<T*>::begin())
{
}
/////////////////// 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()
return empty();
}
-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> >
{
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()
{
{
// 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);
/////////////////// Default Constructor /////////////////////////////
template <class T>
eSmartPtrList<T>::eSmartPtrList()
- :cur(std::list<ePtr<T> >::begin()), autoDelete(false)
+ :cur(std::list<ePtr<T> >::begin())
{
}
/////////////////// 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;
}
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
class ServiceDescriptionTable;
-class eDVBDB: public virtual iDVBChannelList
+class eDVBDB: public iDVBChannelList
{
DECLARE_REF;
private:
#include <lib/base/object.h>
#include <lib/dvb/demux.h>
-class eDVBAudio: public virtual iObject
+class eDVBAudio: public iObject
{
DECLARE_REF;
private:
virtual ~eDVBAudio();
};
-class eDVBVideo: public virtual iObject
+class eDVBVideo: public iObject
{
DECLARE_REF;
private:
virtual ~eDVBVideo();
};
-class eTSMPEGDecoder: public virtual iTSMPEGDecoder
+class eTSMPEGDecoder: public iTSMPEGDecoder
{
DECLARE_REF;
private:
#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;
RESULT getMPEGDecoder(ePtr<iTSMPEGDecoder> &reader);
};
-class eDVBSectionReader: public virtual iDVBSectionReader, public Object
+class eDVBSectionReader: public iDVBSectionReader, public Object
{
DECLARE_REF
private:
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)
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;
}
class eDVBChannel;
-class eDVBResourceManager: public virtual iDVBResourceManager
+class eDVBResourceManager: public iDVBResourceManager
{
DECLARE_REF;
int avail, busy;
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;
#include <lib/dvb/isection.h>
#include <set>
-class eGTable: public virtual iObject, public Object
+class eGTable: public iObject, public Object
{
DECLARE_REF;
private:
#include <lib/dvb/idvb.h>
-class eDVBFrontendParameters: public virtual iDVBFrontendParameters
+class eDVBFrontendParameters: public iDVBFrontendParameters
{
DECLARE_REF;
union
RESULT getHash(unsigned long &hash) const;
};
-class eDVBFrontend: public virtual iDVBFrontend, public Object
+class eDVBFrontend: public iDVBFrontend, public Object
{
DECLARE_REF;
int m_type;
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:
/*
void set(const TerrestrialDeliverySystemDescriptor &);
};
-class iDVBFrontendParameters: public virtual iObject
+class iDVBFrontendParameters: public iObject
{
public:
virtual RESULT getSystem(int &type) const = 0;
class iDVBSatelliteEquipmentControl;
-class iDVBFrontend: public virtual iObject
+class iDVBFrontend: public iObject
{
public:
enum {
int enabled;
};
-class iDVBChannel: public virtual iObject
+class iDVBChannel: public iObject
{
public:
enum
class iDVBSectionReader;
class iTSMPEGDecoder;
-class iDVBDemux: public virtual iObject
+class iDVBDemux: public iObject
{
public:
virtual RESULT createSectionReader(eMainloop *context, ePtr<iDVBSectionReader> &reader)=0;
int flags;
};
-class iDVBSectionReader: public virtual iObject
+class iDVBSectionReader: public iObject
{
public:
virtual RESULT start(const eDVBSectionFilterMask &mask)=0;
#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: */
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 ) );
{
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...
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;
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;
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
*****************************************************************************/
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
goto nolfb;
}
- showConsole(1);
+ showConsole(0);
return;
nolfb:
lfb=0;
ioctl(fd, FBIOPUT_VSCREENINFO, &oldscreen);
if (lfb)
munmap(lfb, available);
+ showConsole(1);
}
int fbClass::PutCMAP()
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)
void eTextPara::setFont(Font *fnt, Font *replacement)
{
- if (refcnt)
- eFatal("mod. after lock");
if (!fnt)
return;
current_font=fnt;
{
singleLock s(ftlock);
- if (refcnt)
- eFatal("mod. after lock");
-
if (!current_font)
return -1;
}
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;
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);
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);
#include <lib/gdi/gpixmap.h>
#include <lib/gdi/region.h>
+DEFINE_REF(gFont);
+
gLookup::gLookup()
:size(0), lookup(0)
{
* 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:
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()
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);
}
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;
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
};
/* gRC is the singleton which controls the fifo and dispatches commands */
-class gRC: public virtual iObject
+class gRC: public iObject
{
DECLARE_REF;
private:
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())
{
}
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;
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;
void gRegion::moveBy(ePoint offset)
{
extends.moveBy(offset);
- int i;
+ unsigned int i;
for (i=0; i<rects.size(); ++i)
rects[i].moveBy(offset);
}
#define __lib_gdi_region_h
#include <lib/base/object.h>
+#include <lib/gdi/erect.h>
#include <vector>
class gRegion
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
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
+
eHTTPDynPathResolver::eHTTPDynPathResolver()
{
- dyn.setAutoDelete(true);
+#warning autodelete removed
}
void eHTTPDynPathResolver::addDyn(eString request, eString path, eString (*function)(eString, eString, eString, eHTTPConnection*))
eHTTPFilePathResolver::eHTTPFilePathResolver()
{
- translate.setAutoDelete(true);
+#warning autodelete removed
}
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()
} 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;
}
ePtrList<eXMLRPCVariant> params;
- params.setAutoDelete(true);
+// params.setAutoDelete(true);
+#warning params autodelete remove
for (XMLTreeNode *c=methodCall->GetChild(); c; c=c->GetNext())
{
"<methodResponse>";
ePtrList<eXMLRPCVariant> ret;
- ret.setAutoDelete(true);
+// ret.setAutoDelete(true);
+#warning autodelete removed
int (*proc)(std::vector<eXMLRPCVariant>&, ePtrList<eXMLRPCVariant> &)=rpcproc[methodName];
int fault;
}
};
-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:
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;
#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:
#include <lib/dvb/pmt.h>
-class eServiceFactoryDVB: public virtual iServiceHandler, public virtual iObject
+class eServiceFactoryDVB: public iServiceHandler
{
DECLARE_REF;
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:
#include <lib/service/iservice.h>
-class eServiceFactoryFS: public virtual iServiceHandler, public virtual iObject
+class eServiceFactoryFS: public iServiceHandler
{
DECLARE_REF;
public:
RESULT list(const eServiceReference &, ePtr<iListableService> &ptr);
};
-class eServiceFS: public virtual iListableService, public virtual iObject
+class eServiceFS: public iListableService
{
DECLARE_REF;
private:
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;
}
#include <lib/service/iservice.h>
-class eServiceFactoryMP3: public virtual iServiceHandler, public virtual iObject
+class eServiceFactoryMP3: public iServiceHandler
{
DECLARE_REF;
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:
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)
#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;
}
#endif
+void dumpRegion(const gRegion ®ion)
+{
+ fprintf(stderr, "extends: %d %d -> %d %d (%d rects)\n",
+ region.extends.left(), region.extends.top(),
+ region.extends.right(), region.extends.bottom(), region.rects.size());
+ for (int y=0; y<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;
}