#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
+#include <lib/gui/ewidget.h>
+#include <lib/gui/ewidgetdesktop.h>
+#include <lib/gui/elabel.h>
+#include <lib/gui/ebutton.h>
+
+#include <lib/gui/ewindow.h>
+
+#include <lib/python/python.h>
+#include <lib/python/connections.h>
+
+#include <lib/driver/rc.h>
+
+#ifdef OBJECT_DEBUG
+int object_total_remaining;
+
+void object_dump()
{
- eInit init;
-
- ePtr<eDVBResourceManager> m_mgr;
- ePtr<iDVBChannel> m_channel;
- ePtr<eDVBDB> m_dvbdb;
+ printf("%d items left\n", object_total_remaining);
+}
+#endif
- ePtr<iPlayableService> m_playservice;
- ePtr<eNavigation> m_nav;
- ePtr<eConnection> m_conn_event;
-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);
-
- m_nav = new eNavigation(service_center);
-#if 1
- 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)
+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)
{
- switch (ev)
- {
- case eNavigation::evNewService:
+ for (int x=0; x<region.extends.right(); ++x)
{
- ePtr<iPlayableService> service;
- nav->getCurrentService(service);
- if (!service)
- {
- eDebug("no running service!");
- break;
- }
- ePtr<iServiceInformation> s;
- if (service->getIServiceInformation(s))
- {
- eDebug("failed to get iserviceinformation");
- break;
- }
- eString name;
- s->getName(name);
- eDebug("NEW running service: %s", name.c_str());
- break;
- }
- case eNavigation::evPlayFailed:
- eDebug("play failed!");
- break;
- case eNavigation::evPlaylistDone:
- eDebug("playlist done");
- break;
- default:
- eDebug("Navigation event %d", ev);
- break;
+ 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");
}
-
- ~eMain()
+}
+
+
+class eMain: public eApplication, public Object
+{
+ eInit init;
+public:
+ eMain()
{
-
+ init.setRunlevel(eAutoInitNumbers::main);
}
};
-#ifdef OBJECT_DEBUG
-int object_total_remaining;
+eWidgetDesktop *wdsk;
-void object_dump()
+// typedef struct _object PyObject;
+
+void print(int i)
{
- printf("%d items left\n", object_total_remaining);
+ printf("C++ says: it's a %d!!!\n", i);
+}
+
+PSignal1<void,int> keyPressed;
+
+PSignal1<void,int> &keyPressedSignal()
+{
+ return keyPressed;
}
-#endif
-int main()
-{
+void keyEvent(const eRCKey &key)
+{
+ if (!key.flags)
+ keyPressed(key.code);
+}
+
+int main(int argc, char **argv)
+{
#ifdef OBJECT_DEBUG
atexit(object_dump);
#endif
- eMain app;
- return app.exec();
+
+
+#if 1
+ eMain main;
+
+ ePtr<gFBDC> my_dc;
+ gFBDC::getInstance(my_dc);
+
+ 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;
+ for (int a=0; a<0x10; ++a)
+ pal[a | 0x20] = (0x111100 * a) | 0xFF;
+ for (int a=0; a<0x10; ++a)
+ pal[a | 0x30] = (0x110011 * a) | 0xFF00;
+ for (int a=0; a<0x10; ++a)
+ pal[a | 0x40] = (0x001111 * a) | 0xFF0000;
+ p.setPalette(pal, 0, 256);
+
+ fontRenderClass::getInstance()->AddFont("/dbox2/cdkroot/share/fonts/arial.ttf", "Arial", 100);
+
+ eWidgetDesktop dsk(eSize(720, 576));
+
+ wdsk = &dsk;
+ dsk.setBackgroundColor(gColor(0));
+ dsk.setDC(my_dc);
+#endif
+
+ /* redrawing is done in an idle-timer, so we have to set the context */
+ dsk.setRedrawTask(main);
+
+ eRCInput::getInstance()->keyEvent.connect(slot(keyEvent));
+
+ ePython python;
+
+ printf("executing main\n");
+ python.execute("mytest", "__main__");
+
+ return 0;
+}
+
+eWidgetDesktop *getDesktop()
+{
+ return wdsk;
+}
+
+void runMainloop()
+{
+ eApp->exec();
}