X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/4c54cecb6020cde399b564f17dacb048b937018a..fef70b939aea15a2438f480d7bdd679e181dcb06:/main/enigma.cpp diff --git a/main/enigma.cpp b/main/enigma.cpp index 7b30f6b2..92982e5b 100644 --- a/main/enigma.cpp +++ b/main/enigma.cpp @@ -5,168 +5,127 @@ #include #include -#include -#include -#include -#include -#include -#include #include -#include -#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +#include +#include + +#ifdef OBJECT_DEBUG +int object_total_remaining; + +void object_dump() +{ + printf("%d items left\n", 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 class eMain: public eApplication, public Object { eInit init; - - ePtr m_mgr; - ePtr m_channel; - ePtr m_dvbdb; - - ePtr m_playservice; - ePtr m_nav; - ePtr m_conn_event; - ePtr m_serviceInformation; public: eMain() { init.setRunlevel(eAutoInitNumbers::main); - m_dvbdb = new eDVBDB(); - m_mgr = new eDVBResourceManager(); - m_mgr->setChannelList(m_dvbdb); - - ePtr 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 lst; - if (service_center->list(ref, lst)) - eDebug("no list available!"); - else - { - std::list list; - if (lst->getContent(list)) - eDebug("list itself SUCKED AROUND!!!"); - else - for (std::list::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 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 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() - { } }; -#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); } -#endif -int main() +int main(int argc, char **argv) { #ifdef OBJECT_DEBUG atexit(object_dump); #endif -#if 0 - eCLI cli; - eString res; + +#if 1 + eMain main; + + ePtr my_dc; + gFBDC::getInstance(my_dc); + + gPainter p(my_dc); - while (1) - { - char line[1024]; - if (!fgets(line, 1024, stdin)) - break; - line[strlen(line)-1]=0; - int rn = cli.doCommand(res, line); - eDebug("%s%d", res.c_str(), rn); - } + 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 - eMain app; - int res = app.exec(); - eDebug("after exec"); + + /* redrawing is done in an idle-timer, so we have to set the context */ + dsk.setRedrawTask(main); + + ePython python; + + printf("executing main\n"); + python.execute("mytest", "__main__"); + + return 0; +} + +eWidgetDesktop *getDesktop() +{ + return wdsk; +} + +void runMainloop() +{ + eApp->exec(); }