+#define SDLDC
#include <stdio.h>
#include <libsig_comp.h>
#include <lib/base/ebase.h>
#include <lib/gdi/grc.h>
#include <lib/gdi/gfbdc.h>
+#include <lib/gdi/sdl.h>
#include <lib/gdi/font.h>
#include <lib/gui/ewidget.h>
#include <lib/gui/ewindow.h>
#include <lib/python/python.h>
+#include <lib/python/connections.h>
+
+#include <lib/gui/elistboxcontent.h>
+
+#include <lib/driver/rc.h>
+
+#include <lib/actions/action.h>
+
+#include <lib/gdi/epng.h>
#ifdef OBJECT_DEBUG
int object_total_remaining;
printf("%d items left\n", object_total_remaining);
}
#endif
-using namespace std;
- void print(const string &str, const char *c)
- {
- printf("%s (%s)\n", str.c_str(), c);
- }
void dumpRegion(const gRegion ®ion)
{
}
}
+eWidgetDesktop *wdsk;
+
+// typedef struct _object PyObject;
+
+void print(int i)
+{
+ printf("C++ says: it's a %d!!!\n", i);
+}
+
+PSignal1<void,int> keyPressed;
+
+PSignal1<void,int> &keyPressedSignal()
+{
+ return keyPressed;
+}
+
+void keyEvent(const eRCKey &key)
+{
+ ePtr<eActionMap> ptr;
+ eActionMap::getInstance(ptr);
+ ptr->keyPressed(0, key.code, key.flags);
+// if (!key.flags)
+// keyPressed(key.code);
+}
+
+/************************************************/
+#include <unistd.h>
+#include <lib/components/scan.h>
+#include <lib/dvb/idvb.h>
+#include <lib/dvb/dvb.h>
+#include <lib/dvb/db.h>
+#include <lib/dvb/dvbtime.h>
+#include <lib/dvb/epgcache.h>
class eMain: public eApplication, public Object
{
eInit init;
+
+ ePtr<eDVBResourceManager> m_mgr;
+ ePtr<eDVBDB> m_dvbdb;
+ ePtr<eDVBLocalTimeHandler> m_locale_time_handler;
+ ePtr<eComponentScan> m_scan;
+ ePtr<eEPGCache> m_epgcache;
+
public:
eMain()
{
init.setRunlevel(eAutoInitNumbers::main);
+
+ /* TODO: put into init */
+ m_dvbdb = new eDVBDB();
+ m_mgr = new eDVBResourceManager();
+ m_locale_time_handler = new eDVBLocalTimeHandler();
+ m_epgcache = new eEPGCache();
+ m_mgr->setChannelList(m_dvbdb);
+
+// m_scan = new eComponentScan();
+// m_scan->start();
+
+ }
+
+ ~eMain()
+ {
+ m_scan = 0;
}
};
-eWidgetDesktop *wdsk;
+/************************************************/
+
int main(int argc, char **argv)
{
#endif
-#if 1
+ ePython python;
eMain main;
+#if 1
+#ifdef SDLDC
+ ePtr<gSDLDC> my_dc;
+ gSDLDC::getInstance(my_dc);
+#else
ePtr<gFBDC> my_dc;
gFBDC::getInstance(my_dc);
+#endif
- 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);
+ fontRenderClass::getInstance()->AddFont("/home/tmbinc/enigma2/fonts/arial.ttf", "Arial", 100);
eWidgetDesktop dsk(eSize(720, 576));
wdsk = &dsk;
- dsk.setDC(my_dc);
- eWindow *wnd = new eWindow(&dsk);
- wnd->move(ePoint(100, 100));
- wnd->resize(eSize(200, 200));
- wnd->show();
- eLabel *label = new eButton(wnd);
- label->setText("Hello!!");
- label->move(ePoint(40, 40));
- label->resize(eSize(100, 40));
+ dsk.setDC(my_dc);
- label = new eButton(wnd);
- label->setText("2nd!!");
- label->move(ePoint(40, 90));
- label->resize(eSize(100, 40));
+ ePtr<gPixmap> m_pm;
+ loadPNG(m_pm, "data/pal.png");
+ if (!m_pm)
+ {
+ eFatal("hi ghost, please copy pal.png into your ./data, thanks!");
+ } else
+ dsk.setPalette(*m_pm);
-#if 0
- eWidget *bla2 = new eWidget(0);
- dsk.addRootWidget(bla2, 0);
-
- bla2->move(ePoint(160, 160));
- bla2->resize(eSize(200, 200));
- bla2->show();
+ dsk.setBackgroundColor(gRGB(0,0,0,0xFF));
#endif
-// dsk.recalcClipRegions();
-// dsk.paint();
-// dsk.invalidate(gRegion(eRect(0, 0, 720, 576)));
-
-// dumpRegion(wnd->m_visible_region);
-// dumpRegion(label->m_visible_region);
-// dumpRegion(label->m_visible_region);
+ /* redrawing is done in an idle-timer, so we have to set the context */
+ dsk.setRedrawTask(main);
- eDebug("painting!");
+ eRCInput::getInstance()->keyEvent.connect(slot(keyEvent));
+ printf("executing main\n");
- ePython python;
-
- printf("about to execute TEST :)\n");
- python.execute("mytest", "test");
-
- sleep(2);
-#endif
+ python.execute("mytest", "__main__");
-#if 0
-
- // connections mit parametern: geht! :)
- using namespace std;
- using namespace SigC;
-
-
- Signal1<void,const string &> printer;
- int i;
- for (i=1; i<argc; ++i)
- printer.connect(bind(slot(print), argv[i]));
- printer("hello world\n");
-#endif
+// eApp->exec();
return 0;
}
return wdsk;
}
+void runMainloop()
+{
+ eApp->exec();
+}
+
+void quitMainloop()
+{
+ eApp->quit(0);
+}