- reenable lcd support
authorFelix Domke <tmbinc@elitedvb.net>
Thu, 1 Sep 2005 00:29:38 +0000 (00:29 +0000)
committerFelix Domke <tmbinc@elitedvb.net>
Thu, 1 Sep 2005 00:29:38 +0000 (00:29 +0000)
lib/gdi/glcddc.cpp
lib/gdi/glcddc.h
lib/gdi/grc.cpp
lib/gdi/lcd.cpp
lib/gdi/lcd.h
main/enigma.cpp

index 1a5e03f..75d256e 100644 (file)
@@ -1,11 +1,13 @@
-#ifndef DISABLE_LCD
-
 #include <lib/gdi/glcddc.h>
+#include <lib/gdi/lcd.h>
+#include <lib/base/init.h>
+#include <lib/base/init_num.h>
 
 gLCDDC *gLCDDC::instance;
 
-gLCDDC::gLCDDC(eLCD *lcd): lcd(lcd)
+gLCDDC::gLCDDC()
 {
+       lcd = new eDBoxLCD();
        instance=this;
        
        update=1;
@@ -24,16 +26,18 @@ gLCDDC::gLCDDC(eLCD *lcd): lcd(lcd)
 
 gLCDDC::~gLCDDC()
 {
+       delete lcd;
        instance=0;
 }
 
 void gLCDDC::exec(gOpcode *o)
 {
+       eDebug("gLCDDC exec!!! %d", o->opcode);
        switch (o->opcode)
        {
-//     case gOpcode::flush:
-       case gOpcode::end:
-               if (update)
+       case gOpcode::flush:
+               eDebug("END! WRITE!");
+//             if (update)
                        lcd->update();
        default:
                gDC::exec(o);
@@ -41,14 +45,9 @@ void gLCDDC::exec(gOpcode *o)
        }
 }
 
-gLCDDC *gLCDDC::getInstance()
-{
-       return instance;
-}
-
 void gLCDDC::setUpdate(int u)
 {
        update=u;
 }
 
-#endif //DISABLE_LCD
+eAutoInitPtr<gLCDDC> init_gLCDDC(eAutoInitNumbers::graphic-1, "gLCDDC");
index d4cfab8..6d5f383 100644 (file)
@@ -1,5 +1,3 @@
-#ifndef DISABLE_LCD
-
 #ifndef __glcddc_h
 #define __glcddc_h
 
@@ -14,14 +12,11 @@ class gLCDDC: public gDC
        void exec(gOpcode *opcode);
        gSurface surface;
 public:
-       gLCDDC(eLCD *lcd);
+       gLCDDC();
        ~gLCDDC();
        void setUpdate(int update);
-       static gLCDDC *getInstance();
+       static int getInstance(ePtr<gLCDDC> &ptr) { if (!instance) return -1; ptr = instance; return 0; }
        int islocked() { return lcd->islocked(); }
 };
 
-
 #endif
-
-#endif //DISABLE_LCD
index 99fe085..05aaa6f 100644 (file)
@@ -373,6 +373,10 @@ void gPainter::notify()
 
 void gPainter::end()
 {
+       gOpcode o;
+       o.opcode = gOpcode::flush;
+       o.dc = m_dc.grabRef();
+       m_rc->submit(o);
 }
 
 gDC::gDC()
index 4de4df0..6b35323 100644 (file)
@@ -1,6 +1,3 @@
-#if 0
-#ifndef DISABLE_LCD
-
 #include <lib/gdi/lcd.h>
 
 #include <unistd.h>
 #include <dbox/fp.h>
 #include <dbox/lcd-ks0713.h>
 
-#include <lib/base/esize.h>
-#include <lib/system/init.h>
-#include <lib/system/init_num.h>
+#include <lib/gdi/esize.h>
+#include <lib/base/init.h>
+#include <lib/base/init_num.h>
 #include <lib/gdi/glcddc.h>
-#include <lib/system/econfig.h>
 
 eDBoxLCD *eDBoxLCD::instance;
 
@@ -53,28 +49,6 @@ void eLCD::unlock()
        locked=0;
 }
 
-/* void eLCD::line(ePoint start, ePoint dst, int color)
-{
-int Ax=start.x(), // dieser code rult ganz ganz doll weil er ganz ganz fast ist und auch sehr gut dokumentiert is
-Ay=start.y(), Bx=dst.x(), // t. es handelt sich immerhin um den weltbekannten bresenham algorithmus der nicht nur
-By=dst.y(); int dX, dY, fbXincr, // sehr schnell ist sondern auch sehr gut dokumentiert und getestet wurde. nicht
-fbYincr, fbXYincr, dPr, dPru, P; __u8 // nur auf dem LCD der dbox, sondern auch ueberall anders. und auch auf der
-*AfbAddr = &buffer()[Ay*stride()+Ax]; __u8 // dbox mit LCD soll das teil nun tun, und ich denke das tut es. ausse
-*BfbAddr = &buffer()[By*stride()+Bx]; fbXincr= // rdem hat dieser algo den vorteil dass man fehler sehr leicht fi
-1; if ( (dX=Bx-Ax) >= 0) goto AFTERNEGX; dX=-dX; // ndet und beheben kann. das liegt nicht zuletzt an den komment
-fbXincr=-1; AFTERNEGX: fbYincr=stride(); if ( (dY=By // aren. und ausserdem, je kuerzer der code, desto weniger k
--Ay) >= 0) goto AFTERNEGY; fbYincr=-stride(); dY=-dY;AFTERNEGY: // ann daran falsch sein. erwaehnte ich schon, da
-fbXYincr = fbXincr+fbYincr; if (dY > dX) goto YisIndependent; dPr = dY+ // s dieser tolle code wahnsinnig schnell
-dY; P = -dX; dPru = P+P; dY = dX>>1; XLOOP: *AfbAddr=color; *BfbAddr=color; if ((P+=dPr) > 0) // ist? bye, tmbinc
-goto RightAndUp;  AfbAddr+=fbXincr; BfbAddr-=fbXincr; if ((dY=dY-1) > 0) goto XLOOP; *AfbAddr=color; if ((dX & 1)
-== 0) return;  *BfbAddr=color; return; RightAndUp: AfbAddr+=fbXYincr; BfbAddr-=fbXYincr; P+=dPru; if ((dY=dY-1) >
-0) goto XLOOP;  *AfbAddr=color; if ((dX & 1) == 0) return; *BfbAddr=color; return; YisIndependent: dPr = dX+dX; P
-= -dY; dPru = P+P; dX = dY>>1; YLOOP: *AfbAddr=color; *BfbAddr=color; if ((P+=dPr) > 0) goto RightAndUp2; AfbAddr
-+=fbYincr;  BfbAddr-=fbYincr; if ((dX=dX-1) > 0) goto YLOOP; *AfbAddr=color; if ((dY & 1) == 0) return; *BfbAddr=
-color;return; RightAndUp2: AfbAddr+=fbXYincr; BfbAddr-=fbXYincr; P+=dPru; if ((dX=dX-1) > 0) goto YLOOP; *AfbAddr
-=color; if((dY & 1) == 0) return; *BfbAddr=color; return; // nun ist der tolle code leider zu ende. tut mir leid.
-} */
-
 eDBoxLCD::eDBoxLCD(): eLCD(eSize(128, 64))
 {
 #ifndef NO_LCD
@@ -92,25 +66,10 @@ eDBoxLCD::eDBoxLCD(): eLCD(eSize(128, 64))
                ioctl(lcdfd, LCD_IOCTL_ASC_MODE, &i);
                int lcdbrightness=0, lcdcontrast=0;
 
-               if( eConfig::getInstance()->getKey("/ezap/lcd/brightness", lcdbrightness) )
-               {
-                       lcdbrightness=130;
-                       eConfig::getInstance()->setKey("/ezap/lcd/brightness", lcdbrightness);
-               }
-               if( eConfig::getInstance()->getKey("/ezap/lcd/contrast", lcdcontrast) )
-               {
-                       lcdcontrast=32;
-                       eConfig::getInstance()->setKey("/ezap/lcd/contrast", lcdcontrast);
-               }
+               lcdbrightness=130;
+               lcdcontrast=32;
                setLCDParameter(lcdbrightness, lcdcontrast);
-               int tmp;
-               if( eConfig::getInstance()->getKey("/ezap/lcd/inverted", tmp ) )
-               {
-                       inverted=0;
-                       eConfig::getInstance()->setKey("/ezap/lcd/inverted", (int) 0 );
-               }
-               else
-                       inverted=(unsigned char)tmp;
+               inverted=0;
        }
 }
 
@@ -142,26 +101,6 @@ int eDBoxLCD::setLCDParameter(int brightness, int contrast)
        return(0);
 }
 
-int eDBoxLCD::switchLCD(int state)
-{
-       int lcdbrightness, lcdcontrast, lcdstandby=0;
-
-       eConfig::getInstance()->getKey("/ezap/lcd/contrast", lcdcontrast);
-
-       if(state==0)
-       {
-               eConfig::getInstance()->getKey("/ezap/lcd/standby", lcdstandby);
-               setLCDParameter(lcdstandby, lcdcontrast);
-       }
-       else
-       {
-               eConfig::getInstance()->getKey("/ezap/lcd/brightness", lcdbrightness);
-               setLCDParameter(lcdbrightness, lcdcontrast);
-               
-       }
-       return(0);
-}
-
 eDBoxLCD::~eDBoxLCD()
 {
        if (lcdfd>0)
@@ -196,18 +135,3 @@ void eDBoxLCD::update()
                write(lcdfd, raw, 120*8);
 }
 
-class eDBoxLCDHardware
-{
-       eDBoxLCD lcd;
-       gLCDDC lcddc;
-public:
-       eDBoxLCDHardware(): lcddc(&lcd)
-       {
-       }
-};
-
-eAutoInitP0<eDBoxLCDHardware> init_eDBoxLCDHardware(eAutoInitNumbers::lowlevel, "d-Box LCD Hardware");
-
-#endif //DISABLE_LCD
-
-#endif
index 88e543f..aee1417 100644 (file)
@@ -1,5 +1,3 @@
-#ifndef DISABLE_LCD
-
 #ifndef __lcd_h
 #define __lcd_h
 
@@ -41,7 +39,6 @@ class eDBoxLCD: public eLCD
        unsigned char inverted;
 public:
        static eDBoxLCD *getInstance();
-       int switchLCD(int state);
        int setLCDParameter(int brightness, int contrast);
        void setInverted( unsigned char );
        eDBoxLCD();
@@ -50,5 +47,3 @@ public:
 };
 
 #endif
-
-#endif //DISABLE_LCD
index f81a3c2..4144742 100644 (file)
@@ -14,6 +14,7 @@
 
 #include <lib/gdi/grc.h>
 #include <lib/gdi/gfbdc.h>
+#include <lib/gdi/glcddc.h>
 #ifdef WITH_SDL
 #error
 #include <lib/gdi/sdl.h>
@@ -69,7 +70,7 @@ void dumpRegion(const gRegion &region)
 
 }
 
-eWidgetDesktop *wdsk;
+eWidgetDesktop *wdsk, *lcddsk;
 
 // typedef struct _object PyObject;
 
@@ -111,7 +112,7 @@ class eMain: public eApplication, public Object
        ePtr<eDVBDB> m_dvbdb;
        ePtr<eDVBLocalTimeHandler> m_locale_time_handler;
        ePtr<eComponentScan> m_scan;
-       ePtr<eEPGCache> m_epgcache;
+//     ePtr<eEPGCache> m_epgcache;
 
 public:
        eMain()
@@ -122,7 +123,7 @@ public:
                m_dvbdb = new eDVBDB();
                m_mgr = new eDVBResourceManager();
                m_locale_time_handler = new eDVBLocalTimeHandler();
-               m_epgcache = new eEPGCache();
+//             m_epgcache = new eEPGCache();
                m_mgr->setChannelList(m_dvbdb);
                
 //             m_scan = new eComponentScan();
@@ -162,9 +163,13 @@ int main(int argc, char **argv)
        double_buffer = my_dc->haveDoubleBuffering();
 #endif
 
+       ePtr<gLCDDC> my_lcd_dc;
+       gLCDDC::getInstance(my_lcd_dc);
+
        fontRenderClass::getInstance()->AddFont(FONTDIR "/arial.ttf", "Arial", 100);
 
        eWidgetDesktop dsk(eSize(720, 576));
+       eWidgetDesktop dsk_lcd(eSize(132, 64));
        
        if (double_buffer)
        {
@@ -173,8 +178,10 @@ int main(int argc, char **argv)
        }
        
        wdsk = &dsk;
+       lcddsk = &dsk_lcd;
 
        dsk.setDC(my_dc);
+       dsk_lcd.setDC(my_lcd_dc);
 
        ePtr<gPixmap> m_pm;
        loadPNG(m_pm, "data/pal.png");
@@ -189,6 +196,21 @@ int main(int argc, char **argv)
 
                /* redrawing is done in an idle-timer, so we have to set the context */
        dsk.setRedrawTask(main);
+       dsk_lcd.setRedrawTask(main);
+
+       eWindow *lcd_win = new eWindow(&dsk_lcd);
+       
+       lcd_win->setFlag(eWindow::wfNoBorder);
+       
+       lcd_win->move(ePoint(0, 0));
+       lcd_win->resize(eSize(132, 64));
+       
+       eLabel *lcd_label = new eLabel(lcd_win);
+       lcd_label->move(ePoint(0, 0));
+       lcd_label->resize(eSize(132, 64));
+       lcd_label->setText("bla bla bla, this lcd\nSUCKS!");
+
+       lcd_win->show();
        
        eRCInput::getInstance()->keyEvent.connect(slot(keyEvent));