X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/44433f650cd3e5f9f66253b74d194fcb01578595..516e72712b0aaff0cd6dc050a3e35d86ff21b31f:/main/enigma.cpp diff --git a/main/enigma.cpp b/main/enigma.cpp index 222bdebc..1260a104 100644 --- a/main/enigma.cpp +++ b/main/enigma.cpp @@ -1,4 +1,7 @@ +#ifdef WITH_SDL #define SDLDC +#endif + #include #include #include @@ -10,7 +13,11 @@ #include #include +#include + +#ifdef WITH_SDL #include +#endif #include #include @@ -29,6 +36,8 @@ #include +#include + #ifdef OBJECT_DEBUG int object_total_remaining; @@ -43,6 +52,7 @@ 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()); +#if 0 for (int y=0; y #include #include +#include +#include class eMain: public eApplication, public Object { @@ -95,9 +109,10 @@ class eMain: public eApplication, public Object ePtr m_mgr; ePtr m_dvbdb; - + ePtr m_locale_time_handler; ePtr m_scan; - + ePtr m_epgcache; + public: eMain() { @@ -106,22 +121,21 @@ public: /* 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_dvbdb->saveServicelist(); m_scan = 0; } }; /************************************************/ +int exit_code; int main(int argc, char **argv) { @@ -129,10 +143,14 @@ int main(int argc, char **argv) atexit(object_dump); #endif + // set pythonpath if unset + setenv("PYTHONPATH", LIBDIR "/enigma2/python", 0); + printf("PYTHONPATH: %s\n", getenv("PYTHONPATH")); + ePython python; eMain main; - + #if 1 #ifdef SDLDC ePtr my_dc; @@ -140,65 +158,92 @@ int main(int argc, char **argv) #else ePtr my_dc; gFBDC::getInstance(my_dc); + + int double_buffer = my_dc->haveDoubleBuffering(); #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; + ePtr my_lcd_dc; + gLCDDC::getInstance(my_lcd_dc); + + fontRenderClass::getInstance()->AddFont(FONTDIR "/md_khmurabi_10.ttf", "Regular", 100); + fontRenderClass::getInstance()->AddFont(FONTDIR "/ae_AlMateen.ttf", "Replacement", 90); + eTextPara::setReplacementFont("Replacement"); - pal[0x50] = 0x586D88; - pal[0x51] = 0x4075a7; + /* some characters are wrong in the regular font, force them to use the replacement font */ + for (int i = 0x60c; i <= 0x66d; ++i) + eTextPara::forceReplacementGlyph(i); + eTextPara::forceReplacementGlyph(0xfdf2); + for (int i = 0xfe80; i < 0xff00; ++i) + eTextPara::forceReplacementGlyph(i); - p.setPalette(pal, 0, 256); - - fontRenderClass::getInstance()->AddFont("/home/tmbinc/enigma2/fonts/arial.ttf", "Arial", 100); eWidgetDesktop dsk(eSize(720, 576)); + eWidgetDesktop dsk_lcd(eSize(132, 64)); + +/* if (double_buffer) + { + eDebug(" - double buffering found, enable buffered graphics mode."); + dsk.setCompositionMode(eWidgetDesktop::cmBuffered); + } */ wdsk = &dsk; - dsk.setBackgroundColor(gColor(0)); + lcddsk = &dsk_lcd; + dsk.setDC(my_dc); + dsk_lcd.setDC(my_lcd_dc); + + ePtr m_pm; + loadPNG(m_pm, DATADIR "/enigma2/pal.png"); + if (!m_pm) + { + eFatal("pal.png not found!"); + } 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 */ dsk.setRedrawTask(main); - + dsk_lcd.setRedrawTask(main); + eRCInput::getInstance()->keyEvent.connect(slot(keyEvent)); printf("executing main\n"); python.execute("mytest", "__main__"); + + dsk.paint(); + dsk_lcd.paint(); + return exit_code; +} -// eApp->exec(); - - return 0; +eWidgetDesktop *getDesktop(int which) +{ + return which ? lcddsk : wdsk; } -eWidgetDesktop *getDesktop() +eApplication *getApplication() { - return wdsk; + return eApp; } void runMainloop() { - eApp->exec(); + eApp->runLoop(); } -void quitMainloop() +void quitMainloop(int exitCode) { + exit_code = exitCode; eApp->quit(0); } + +void setLCD(const char *string) +{ +} + +void setLCDClock(const char *string) +{ +}