summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoranbr <vdr07@deltab.de>2014-05-04 11:23:50 +0200
committeranbr <vdr07@deltab.de>2014-05-04 11:23:50 +0200
commit3d87cc0b6a062a39b9385f33bdec88ee25967776 (patch)
tree3c907421cacd9ee7bd8d56e4e85f986d3b45bef1
parentf110173bb35f84b8b6bca4dfd84b910b7deac1ef (diff)
downloadvdr-plugin-targavfd-3d87cc0b6a062a39b9385f33bdec88ee25967776.tar.gz
vdr-plugin-targavfd-3d87cc0b6a062a39b9385f33bdec88ee25967776.tar.bz2
Dual-Line-Mode: Eclipse long channel names (Closes: #1815)
-rw-r--r--HISTORY1
-rw-r--r--ffont.c8
-rw-r--r--vfd.c15
-rw-r--r--vfd.h3
-rw-r--r--watch.c28
5 files changed, 41 insertions, 14 deletions
diff --git a/HISTORY b/HISTORY
index fa8874d..74c917d 100644
--- a/HISTORY
+++ b/HISTORY
@@ -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
diff --git a/ffont.c b/ffont.c
index 8aa15b0..952f891 100644
--- a/ffont.c
+++ b/ffont.c
@@ -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;
}
diff --git a/vfd.c b/vfd.c
index c77fe69..ac30f81 100644
--- a/vfd.c
+++ b/vfd.c
@@ -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.
*/
diff --git a/vfd.h b/vfd.h
index 5565e80..7efa0f9 100644
--- a/vfd.h
+++ b/vfd.h
@@ -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);
diff --git a/watch.c b/watch.c
index e103284..6e7f4da 100644
--- a/watch.c
+++ b/watch.c
@@ -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: