diff options
author | anbr <vdr07@deltab.de> | 2014-05-04 11:23:50 +0200 |
---|---|---|
committer | anbr <vdr07@deltab.de> | 2014-05-04 11:23:50 +0200 |
commit | 3d87cc0b6a062a39b9385f33bdec88ee25967776 (patch) | |
tree | 3c907421cacd9ee7bd8d56e4e85f986d3b45bef1 | |
parent | f110173bb35f84b8b6bca4dfd84b910b7deac1ef (diff) | |
download | vdr-plugin-targavfd-3d87cc0b6a062a39b9385f33bdec88ee25967776.tar.gz vdr-plugin-targavfd-3d87cc0b6a062a39b9385f33bdec88ee25967776.tar.bz2 |
Dual-Line-Mode: Eclipse long channel names (Closes: #1815)
-rw-r--r-- | HISTORY | 1 | ||||
-rw-r--r-- | ffont.c | 8 | ||||
-rw-r--r-- | vfd.c | 15 | ||||
-rw-r--r-- | vfd.h | 3 | ||||
-rw-r--r-- | watch.c | 28 |
5 files changed, 41 insertions, 14 deletions
@@ -4,6 +4,7 @@ VDR Plugin 'targavfd' Revision History 2013-xx-xx: Version 0.3.0 - New render mode - multiple pages - New option, show replay progress as bargraph (Request #666) +- Dual-Line-Mode: Eclipse long channel names (Request: #1815) - Fix display wrong time for HD recording if they greater than one hour (Bug #1568) 2013-04-12: Version 0.2.1 @@ -206,7 +206,7 @@ int cVFDFont::DrawText(cVFDBitmap *Bitmap, int x, int y, const char *s, int Widt uchar *buffer = g->Bitmap(); int symWidth = g->Width(); if (Width && x + symWidth + g->Left() + kerning - 1 > Width) - return 1; // we don't draw partial characters + return x; // we don't draw partial characters if (x + symWidth + g->Left() + kerning > 0) { for (int row = 0; row < g->Rows(); row++) { for (int pitch = 0; pitch < g->Pitch(); pitch++) { @@ -222,11 +222,11 @@ int cVFDFont::DrawText(cVFDBitmap *Bitmap, int x, int y, const char *s, int Widt } x += g->AdvanceX() + kerning; if (x > Bitmap->Width() - 1) - return 1; + return x - (g->AdvanceX() + kerning); } - return 0; + return x; } - return -1; + return 0; } @@ -456,13 +456,24 @@ bool cVFD::flush(bool refreshAll) * \param y Vertical character position (row). * \param string String that gets written. */ -int cVFD::DrawText(int x, int y, const char* string) +int cVFD::DrawText(int x, int y, const char* string, int nMaxWidth /* = 1024*/) { if(pFont && framebuf) - return pFont->DrawText(framebuf, x, y, string, 1024); + return pFont->DrawText(framebuf, x, y, string, nMaxWidth); return -1; } +int cVFD::DrawTextEclipsed(int x, int y, const char* string, int nMaxWidth /* = 1024*/) +{ + static const char* szEclipse = ".."; + int d = pFont->Width(szEclipse); + int w = this->DrawText(x, y, string, nMaxWidth - d); + if(w > 0 && ((w-x) != pFont->Width(string))) { + this->DrawText(w, y, szEclipse); + } + return w; +} + /** * Height of framebuffer from current device. */ @@ -89,7 +89,8 @@ public: void clear (); - int DrawText(int x, int y, const char* string); + int DrawText(int x, int y, const char* string, int nMaxWidth = 1024); + int DrawTextEclipsed(int x, int y, const char* string, int nMaxWidth = 1024); int Height() const; int Width() const; bool Rectangle(int x1, int y1, int x2, int y2, bool filled); @@ -423,11 +423,20 @@ bool cVFDWatch::RenderScreenSinglePage(bool bReDraw) { if(scRender) { int iRet = -1; + int w = pFont->Width(*scRender); if(theSetup.m_nRenderMode == eRenderMode_DualLine) { iRet = this->DrawText(0 - m_nScrollOffset,pFont->Height(), *scRender); + if((w - m_nScrollOffset) == iRet) + iRet = 0; // Text fits into screen + else + iRet = 1; // Text large then screen } else { int nTop = (theSetup.m_cHeight - pFont->Height())/2; iRet = this->DrawText(0 - m_nScrollOffset,nTop<0?0:nTop, *scRender); + if((w - m_nScrollOffset) == iRet) + iRet = 0; // Text fits into screen + else + iRet = 1; // Text large then screen } if(m_bScrollNeeded) { switch(iRet) { @@ -456,14 +465,13 @@ bool cVFDWatch::RenderScreenSinglePage(bool bReDraw) { } if(scHeader && theSetup.m_nRenderMode == eRenderMode_DualLine) { + int t = 0; if(bAllowCurrentTime && currentTime) { - int t = pFont->Width(*currentTime); - int w = pFont->Width(*scHeader); - if((w + t + 3) < theSetup.m_cWidth && t < theSetup.m_cWidth) { - this->DrawText(theSetup.m_cWidth - t, 0, *currentTime); - } + t = pFont->Width(*currentTime); + this->DrawText(theSetup.m_cWidth - t, 0, *currentTime); + t += 1; } - this->DrawText(0, 0, *scHeader); + this->DrawTextEclipsed(0, 0, *scHeader, theSetup.m_cWidth - t); } m_bUpdateScreen = false; @@ -539,11 +547,17 @@ bool cVFDWatch::RenderText(bool bForce, bool bReDraw, cString* scText) { if(scText) { int iRet = -1; int nTop = (theSetup.m_cHeight - pFont->Height())/2; - int nAlign = (this->Width() - pFont->Width(*scText)) / 2; + int w = pFont->Width(*scText); + int nAlign = (this->Width() - w) / 2; if(nAlign < 0) { nAlign = 0; } iRet = this->DrawText(nAlign - m_nScrollOffset,nTop<0?0:nTop, *scText); + if((nAlign + (w - m_nScrollOffset)) == iRet) + iRet = 0; // Text fits into screen + else + iRet = 1; // Text large then screen + if(m_bScrollNeeded) { switch(iRet) { case 0: |