X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/84670d3dc9c9dc29fd3af42b2f25092b3b6c2a09..5db1b523e89c6abca92c70916ef7a63b6d51b7e3:/main/enigma.cpp diff --git a/main/enigma.cpp b/main/enigma.cpp index df28bcd7..3d84db7d 100644 --- a/main/enigma.cpp +++ b/main/enigma.cpp @@ -1,3 +1,6 @@ +#ifdef WITH_SDL +#define SDLDC +#endif #include #include #include @@ -9,6 +12,9 @@ #include #include +#ifdef WITH_SDL +#include +#endif #include #include @@ -21,8 +27,14 @@ #include #include +#include + #include +#include + +#include + #ifdef OBJECT_DEBUG int object_total_remaining; @@ -51,17 +63,6 @@ void dumpRegion(const gRegion ®ion) } } - -class eMain: public eApplication, public Object -{ - eInit init; -public: - eMain() - { - init.setRunlevel(eAutoInitNumbers::main); - } -}; - eWidgetDesktop *wdsk; // typedef struct _object PyObject; @@ -80,10 +81,58 @@ PSignal1 &keyPressedSignal() void keyEvent(const eRCKey &key) { - if (!key.flags) - keyPressed(key.code); + ePtr ptr; + eActionMap::getInstance(ptr); + ptr->keyPressed(0, key.code, key.flags); +// if (!key.flags) +// keyPressed(key.code); } +/************************************************/ +#include +#include +#include +#include +#include +#include +#include + +class eMain: public eApplication, public Object +{ + eInit init; + + ePtr m_mgr; + ePtr m_dvbdb; + ePtr m_locale_time_handler; + ePtr m_scan; + ePtr 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; + } +}; + +/************************************************/ + + int main(int argc, char **argv) { #ifdef OBJECT_DEBUG @@ -91,37 +140,36 @@ int main(int argc, char **argv) #endif -#if 1 + ePython python; eMain main; +#if 1 +#ifdef SDLDC + ePtr my_dc; + gSDLDC::getInstance(my_dc); +#else ePtr 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(FONTDIR "/arial.ttf", "Arial", 100); eWidgetDesktop dsk(eSize(720, 576)); wdsk = &dsk; - dsk.setBackgroundColor(gColor(0)); + + dsk.setDC(my_dc); + + ePtr 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); + + dsk.setBackgroundColor(gRGB(0,0,0,0xFF)); #endif /* redrawing is done in an idle-timer, so we have to set the context */ @@ -129,11 +177,12 @@ int main(int argc, char **argv) eRCInput::getInstance()->keyEvent.connect(slot(keyEvent)); - ePython python; - printf("executing main\n"); + python.execute("mytest", "__main__"); +// eApp->exec(); + return 0; } @@ -146,3 +195,8 @@ void runMainloop() { eApp->exec(); } + +void quitMainloop() +{ + eApp->quit(0); +}