- actionmap component will not catch (wrong) exceptions anymore
[enigma2.git] / main / enigma.cpp
index df28bcd..258c5ad 100644 (file)
@@ -1,3 +1,4 @@
+#define SDLDC
 #include <stdio.h>
 #include <libsig_comp.h>
 #include <lib/base/ebase.h>
 #include <stdio.h>
 #include <libsig_comp.h>
 #include <lib/base/ebase.h>
@@ -9,6 +10,7 @@
 
 #include <lib/gdi/grc.h>
 #include <lib/gdi/gfbdc.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/gdi/font.h> 
 
 #include <lib/gui/ewidget.h>
 #include <lib/python/python.h>
 #include <lib/python/connections.h>
 
 #include <lib/python/python.h>
 #include <lib/python/connections.h>
 
+#include <lib/gui/elistboxcontent.h>
+
 #include <lib/driver/rc.h>
 
 #include <lib/driver/rc.h>
 
+#include <lib/actions/action.h>
+
+#include <lib/gdi/epng.h>
+
 #ifdef OBJECT_DEBUG
 int object_total_remaining;
 
 #ifdef OBJECT_DEBUG
 int object_total_remaining;
 
@@ -51,17 +59,6 @@ void dumpRegion(const gRegion &region)
        }
 }
 
        }
 }
 
-
-class eMain: public eApplication, public Object
-{
-       eInit init;
-public:
-       eMain()
-       {
-               init.setRunlevel(eAutoInitNumbers::main);
-       }
-};
-
 eWidgetDesktop *wdsk;
 
 // typedef struct _object PyObject;
 eWidgetDesktop *wdsk;
 
 // typedef struct _object PyObject;
@@ -80,10 +77,54 @@ PSignal1<void,int> &keyPressedSignal()
 
 void keyEvent(const eRCKey &key)
 {
 
 void keyEvent(const eRCKey &key)
 {
-       if (!key.flags)
-               keyPressed(key.code);
+       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>
+
+class eMain: public eApplication, public Object
+{
+       eInit init;
+       
+       ePtr<eDVBResourceManager> m_mgr;
+       ePtr<eDVBDB> m_dvbdb;
+
+       ePtr<eComponentScan> m_scan;
+       
+public:
+       eMain()
+       {
+               init.setRunlevel(eAutoInitNumbers::main);
+
+                               /* TODO: put into init */
+               m_dvbdb = new eDVBDB();
+               m_mgr = new eDVBResourceManager();
+               
+               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
 int main(int argc, char **argv)
 {
 #ifdef OBJECT_DEBUG
@@ -91,37 +132,36 @@ int main(int argc, char **argv)
 #endif
 
 
 #endif
 
 
-#if 1
+       ePython python;
        eMain main;
 
        eMain main;
 
+#if 1
+#ifdef SDLDC
+       ePtr<gSDLDC> my_dc;
+       gSDLDC::getInstance(my_dc);
+#else
        ePtr<gFBDC> my_dc;
        gFBDC::getInstance(my_dc);
        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;
 
        eWidgetDesktop dsk(eSize(720, 576));
        
        wdsk = &dsk;
-       dsk.setBackgroundColor(gColor(0));
+
+
        dsk.setDC(my_dc);
        dsk.setDC(my_dc);
+
+       ePtr<gPixmap> m_pm;
+       loadPNG(m_pm, "data/info-bg.png");
+       if (!m_pm)
+       {
+               eDebug("can't load info-bg :)");
+       } else
+               dsk.setPalette(*m_pm);
+
+       dsk.setBackgroundColor(gRGB(0,0,0,0));
 #endif
 
                /* redrawing is done in an idle-timer, so we have to set the context */
 #endif
 
                /* redrawing is done in an idle-timer, so we have to set the context */
@@ -129,11 +169,12 @@ int main(int argc, char **argv)
        
        eRCInput::getInstance()->keyEvent.connect(slot(keyEvent));
        
        
        eRCInput::getInstance()->keyEvent.connect(slot(keyEvent));
        
-       ePython python;
-       
        printf("executing main\n");
        printf("executing main\n");
+
        python.execute("mytest", "__main__");
 
        python.execute("mytest", "__main__");
 
+//     eApp->exec();
+
        return 0;
 }
 
        return 0;
 }
 
@@ -146,3 +187,8 @@ void runMainloop()
 {
        eApp->exec();
 }
 {
        eApp->exec();
 }
+
+void quitMainloop()
+{
+       eApp->quit(0);
+}