From: Felix Domke Date: Thu, 1 Sep 2005 00:29:38 +0000 (+0000) Subject: - reenable lcd support X-Git-Url: http://code.vuplus.com/gitweb/?p=vuplus_dvbapp;a=commitdiff_plain;h=b8e9b51fb1a75b1805cf3108ffdc22aff9f75cf2 - reenable lcd support --- diff --git a/lib/gdi/glcddc.cpp b/lib/gdi/glcddc.cpp index 1a5e03f..75d256e 100644 --- a/lib/gdi/glcddc.cpp +++ b/lib/gdi/glcddc.cpp @@ -1,11 +1,13 @@ -#ifndef DISABLE_LCD - #include +#include +#include +#include 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 init_gLCDDC(eAutoInitNumbers::graphic-1, "gLCDDC"); diff --git a/lib/gdi/glcddc.h b/lib/gdi/glcddc.h index d4cfab8..6d5f383 100644 --- a/lib/gdi/glcddc.h +++ b/lib/gdi/glcddc.h @@ -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 &ptr) { if (!instance) return -1; ptr = instance; return 0; } int islocked() { return lcd->islocked(); } }; - #endif - -#endif //DISABLE_LCD diff --git a/lib/gdi/grc.cpp b/lib/gdi/grc.cpp index 99fe085..05aaa6f 100644 --- a/lib/gdi/grc.cpp +++ b/lib/gdi/grc.cpp @@ -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() diff --git a/lib/gdi/lcd.cpp b/lib/gdi/lcd.cpp index 4de4df0..6b35323 100644 --- a/lib/gdi/lcd.cpp +++ b/lib/gdi/lcd.cpp @@ -1,6 +1,3 @@ -#if 0 -#ifndef DISABLE_LCD - #include #include @@ -10,11 +7,10 @@ #include #include -#include -#include -#include +#include +#include +#include #include -#include 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 init_eDBoxLCDHardware(eAutoInitNumbers::lowlevel, "d-Box LCD Hardware"); - -#endif //DISABLE_LCD - -#endif diff --git a/lib/gdi/lcd.h b/lib/gdi/lcd.h index 88e543f..aee1417 100644 --- a/lib/gdi/lcd.h +++ b/lib/gdi/lcd.h @@ -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 diff --git a/main/enigma.cpp b/main/enigma.cpp index f81a3c2..4144742 100644 --- a/main/enigma.cpp +++ b/main/enigma.cpp @@ -14,6 +14,7 @@ #include #include +#include #ifdef WITH_SDL #error #include @@ -69,7 +70,7 @@ void dumpRegion(const gRegion ®ion) } -eWidgetDesktop *wdsk; +eWidgetDesktop *wdsk, *lcddsk; // typedef struct _object PyObject; @@ -111,7 +112,7 @@ class eMain: public eApplication, public Object ePtr m_dvbdb; ePtr m_locale_time_handler; ePtr m_scan; - ePtr m_epgcache; +// ePtr 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 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 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));