summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoranbr <vdr07@deltab.de>2010-04-29 20:44:38 +0200
committeranbr <vdr07@deltab.de>2010-04-29 20:44:38 +0200
commit8b649a7fa73b9449597b1cf3513e75c8f4733002 (patch)
tree56f81ffe7b1360b739ecede52939ea0af0148b71
parentc69752e202af6ccc3caa5857b6fa2da0729b8ffa (diff)
downloadvdr-plugin-targavfd-8b649a7fa73b9449597b1cf3513e75c8f4733002.tar.gz
vdr-plugin-targavfd-8b649a7fa73b9449597b1cf3513e75c8f4733002.tar.bz2
Allow setup font size0.0.4
Show current time, on dual line mode
-rw-r--r--ffont.c8
-rw-r--r--po/de_DE.po18
-rw-r--r--po/it_IT.po14
-rw-r--r--setup.c53
-rw-r--r--setup.h3
-rw-r--r--targavfd.c2
-rw-r--r--vfd.c14
-rw-r--r--vfd.h4
-rw-r--r--watch.c32
-rw-r--r--watch.h2
10 files changed, 110 insertions, 40 deletions
diff --git a/ffont.c b/ffont.c
index 2afac15..8aa15b0 100644
--- a/ffont.c
+++ b/ffont.c
@@ -83,10 +83,10 @@ cVFDFont::cVFDFont(const char *Name, int CharHeight, int CharWidth)
}
else {
error = FT_Set_Char_Size(face, // handle to face object
- CharWidth * 64, // CharWidth in 1/64th of points
- CharHeight * 64, // CharHeight in 1/64th of points
- 0, // horizontal device resolution
- 0); // vertical device resolution
+ CharWidth << 6, // CharWidth in 1/64th of points
+ CharHeight << 6, // CharHeight in 1/64th of points
+ CharWidth > 8 ? 64 : 80, // horizontal device resolution
+ 72); // vertical device resolution
if (!error) {
height = ((face->size->metrics.ascender-face->size->metrics.descender) + 63) / 64;
bottom = abs((face->size->metrics.descender - 63) / 64);
diff --git a/po/de_DE.po b/po/de_DE.po
index 7262aa5..f5dcde0 100644
--- a/po/de_DE.po
+++ b/po/de_DE.po
@@ -1,14 +1,14 @@
# vdr-targavfd-plugin language source file.
# Copyright (C) Andreas Brachold <vdr07 AT deltab de>
# This file is distributed under the same license as the PACKAGE package.
-# Andreas Brachold <vdr07 AT deltab de> 2009
#
+# Andreas Brachold <vdr07 AT deltab de> 2009, 2010.
msgid ""
msgstr ""
"Project-Id-Version: vdr-targavfd-plugin 0.0.1\n"
"Report-Msgid-Bugs-To: <see README>\n"
-"POT-Creation-Date: 2010-04-17 11:55+0200\n"
-"PO-Revision-Date: 2009-05-21 17:13+0200\n"
+"POT-Creation-Date: 2010-04-18 17:28+0200\n"
+"PO-Revision-Date: 2010-04-18 18:22+0200\n"
"Last-Translator: Andreas Brachold <vdr07 AT deltab de>\n"
"Language-Team: Andreas Brachold <vdr07 AT deltab de>\n"
"MIME-Version: 1.0\n"
@@ -21,9 +21,6 @@ msgstr "TargaVFD"
msgid "Brightness"
msgstr "Helligkeit"
-msgid "Default font"
-msgstr "Zeichensatz"
-
msgid "Render mode"
msgstr "Anzeigemodus"
@@ -33,6 +30,15 @@ msgstr "Einzelne Zeile"
msgid "Dual lines"
msgstr "Zwei Zeilen"
+msgid "Default font"
+msgstr "Zeichensatz"
+
+msgid "Height of big font"
+msgstr "Höhe des großen Zeichensatzes"
+
+msgid "Height of small font"
+msgstr "Höhe des kleinen Zeichensatzes"
+
msgid "Do nothing"
msgstr "Nichts unternehmen"
diff --git a/po/it_IT.po b/po/it_IT.po
index 04e0008..e397730 100644
--- a/po/it_IT.po
+++ b/po/it_IT.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: vdr-targavfd-plugin 0.0.1\n"
"Report-Msgid-Bugs-To: <see README>\n"
-"POT-Creation-Date: 2010-04-17 11:55+0200\n"
+"POT-Creation-Date: 2010-04-18 17:28+0200\n"
"PO-Revision-Date: 2009-06-07 23:30+0100\n"
"Last-Translator: Diego Pierotto <vdr-italian@tiscali.it>\n"
"Language-Team: \n"
@@ -24,9 +24,6 @@ msgstr "TargaVFD"
msgid "Brightness"
msgstr ""
-msgid "Default font"
-msgstr "Carattere predefinito"
-
msgid "Render mode"
msgstr ""
@@ -36,6 +33,15 @@ msgstr ""
msgid "Dual lines"
msgstr ""
+msgid "Default font"
+msgstr "Carattere predefinito"
+
+msgid "Height of big font"
+msgstr ""
+
+msgid "Height of small font"
+msgstr ""
+
msgid "Do nothing"
msgstr "Non fare nulla"
diff --git a/setup.c b/setup.c
index 3374da9..b55729c 100644
--- a/setup.c
+++ b/setup.c
@@ -29,6 +29,8 @@
#define DEFAULT_HEIGHT 16
#define DEFAULT_FONT "Sans:Bold"
#define DEFAULT_TWO_LINE_MODE 0
+#define DEFAULT_BIG_FONT_HEIGHT 14
+#define DEFAULT_SMALL_FONT_HEIGHT 7
/// The one and only Stored setup data
cVFDSetup theSetup;
@@ -41,6 +43,8 @@ cVFDSetup::cVFDSetup(void)
m_nOnExit = DEFAULT_ON_EXIT;
m_nBrightness = DEFAULT_BRIGHTNESS;
m_bTwoLineMode = DEFAULT_TWO_LINE_MODE;
+ m_nBigFontHeight = DEFAULT_BIG_FONT_HEIGHT;
+ m_nSmallFontHeight = DEFAULT_SMALL_FONT_HEIGHT;
strncpy(m_szFont,DEFAULT_FONT,sizeof(m_szFont));
}
@@ -58,6 +62,8 @@ cVFDSetup& cVFDSetup::operator = (const cVFDSetup& x)
m_nBrightness = x.m_nBrightness;
m_bTwoLineMode = x.m_bTwoLineMode;
+ m_nBigFontHeight = x.m_nBigFontHeight;
+ m_nSmallFontHeight = x.m_nSmallFontHeight;
strncpy(m_szFont,x.m_szFont,sizeof(m_szFont));
@@ -105,6 +111,28 @@ bool cVFDSetup::SetupParse(const char *szName, const char *szValue)
strncpy(m_szFont,DEFAULT_FONT,sizeof(m_szFont));
return true;
}
+ // BigFont
+ if(!strcasecmp(szName, "BigFont")) {
+ int n = atoi(szValue);
+ if ((n < 5) || (n > 24)) {
+ esyslog("targaVFD: BigFont must be between 5 and 24; using default %d",
+ DEFAULT_BIG_FONT_HEIGHT);
+ n = DEFAULT_BIG_FONT_HEIGHT;
+ }
+ m_nBigFontHeight = n;
+ return true;
+ }
+ // SmallFont
+ if(!strcasecmp(szName, "SmallFont")) {
+ int n = atoi(szValue);
+ if ((n < 5) || (n > 24)) {
+ esyslog("targaVFD: SmallFont must be between 5 and 24; using default %d",
+ DEFAULT_SMALL_FONT_HEIGHT);
+ n = DEFAULT_SMALL_FONT_HEIGHT;
+ }
+ m_nSmallFontHeight = n;
+ return true;
+ }
// Two Line Mode
if(!strcasecmp(szName, "TwoLineMode")) {
@@ -136,6 +164,8 @@ void cVFDMenuSetup::Store(void)
SetupStore("OnExit", theSetup.m_nOnExit);
SetupStore("Brightness", theSetup.m_nBrightness);
SetupStore("Font", theSetup.m_szFont);
+ SetupStore("BigFont", theSetup.m_nBigFontHeight);
+ SetupStore("SmallFont", theSetup.m_nSmallFontHeight);
SetupStore("TwoLineMode",theSetup.m_bTwoLineMode);
}
@@ -152,14 +182,19 @@ cVFDMenuSetup::cVFDMenuSetup(cVFDWatch* pDev)
Add(new cMenuEditIntItem (tr("Brightness"),
&m_tmpSetup.m_nBrightness,
0, 2));
-
- Add(new cMenuEditStraItem(tr("Default font"),
- &fontIndex, fontNames.Size(), &fontNames[0]));
-
Add(new cMenuEditBoolItem(tr("Render mode"),
&m_tmpSetup.m_bTwoLineMode,
tr("Single line"), tr("Dual lines")));
+ Add(new cMenuEditStraItem(tr("Default font"),
+ &fontIndex, fontNames.Size(), &fontNames[0]));
+ Add(new cMenuEditIntItem (tr("Height of big font"),
+ &m_tmpSetup.m_nBigFontHeight,
+ 5, 24));
+ Add(new cMenuEditIntItem (tr("Height of small font"),
+ &m_tmpSetup.m_nSmallFontHeight,
+ 5, 24));
+
static const char * szExitModes[eOnExitMode_LASTITEM];
szExitModes[eOnExitMode_SHOWMSG] = tr("Do nothing");
szExitModes[eOnExitMode_SHOWCLOCK] = tr("Showing clock");
@@ -177,8 +212,14 @@ eOSState cVFDMenuSetup::ProcessKey(eKeys nKey)
// Store edited Values
Utf8Strn0Cpy(m_tmpSetup.m_szFont, fontNames[fontIndex], sizeof(m_tmpSetup.m_szFont));
if (0 != strcmp(m_tmpSetup.m_szFont, theSetup.m_szFont)
- || m_tmpSetup.m_bTwoLineMode != theSetup.m_bTwoLineMode) {
- m_pDev->SetFont(m_tmpSetup.m_szFont, m_tmpSetup.m_bTwoLineMode);
+ || m_tmpSetup.m_bTwoLineMode != theSetup.m_bTwoLineMode
+ || (!m_tmpSetup.m_bTwoLineMode && (m_tmpSetup.m_nBigFontHeight != theSetup.m_nBigFontHeight))
+ || ( m_tmpSetup.m_bTwoLineMode && (m_tmpSetup.m_nSmallFontHeight != theSetup.m_nSmallFontHeight))
+ ) {
+ m_pDev->SetFont(m_tmpSetup.m_szFont,
+ m_tmpSetup.m_bTwoLineMode,
+ m_tmpSetup.m_nBigFontHeight,
+ m_tmpSetup.m_nSmallFontHeight);
}
}
return cMenuSetupPage::ProcessKey(nKey);
diff --git a/setup.h b/setup.h
index 9b74e5e..12650b2 100644
--- a/setup.h
+++ b/setup.h
@@ -33,6 +33,9 @@ struct cVFDSetup
const int m_cWidth;
const int m_cHeight;
+ int m_nBigFontHeight;
+ int m_nSmallFontHeight;
+
char m_szFont[256];
int m_bTwoLineMode; /** enable two line mode */
diff --git a/targavfd.c b/targavfd.c
index 5b7bfc8..3b9461e 100644
--- a/targavfd.c
+++ b/targavfd.c
@@ -20,7 +20,7 @@
#include "status.h"
#include "setup.h"
-static const char *VERSION = "0.0.3";
+static const char *VERSION = "0.0.4";
class cPluginTargaVFD : public cPlugin {
private:
diff --git a/vfd.c b/vfd.c
index 1670eab..2ea935c 100644
--- a/vfd.c
+++ b/vfd.c
@@ -260,7 +260,10 @@ cVFD::~cVFD() {
*/
bool cVFD::open()
{
- if(!SetFont(theSetup.m_szFont,theSetup.m_bTwoLineMode)) {
+ if(!SetFont(theSetup.m_szFont,
+ theSetup.m_bTwoLineMode,
+ theSetup.m_nBigFontHeight,
+ theSetup.m_nSmallFontHeight)) {
return false;
}
if(!cVFDQueue::open()) {
@@ -445,18 +448,17 @@ void cVFD::Brightness(int nBrightness)
this->QueueData((byte) (nBrightness));
}
-bool cVFD::SetFont(const char *szFont, int bTwoLineMode) {
+bool cVFD::SetFont(const char *szFont, int bTwoLineMode, int nBigFontHeight, int nSmallFontHeight) {
cVFDFont* tmpFont = NULL;
cString sFileName = cFont::GetFontFileName(szFont);
if(!isempty(sFileName))
{
- if (bTwoLineMode)
- {
- tmpFont = new cVFDFont(sFileName,6,8);
+ if (bTwoLineMode) {
+ tmpFont = new cVFDFont(sFileName,nSmallFontHeight);
} else {
- tmpFont = new cVFDFont(sFileName,12,11);
+ tmpFont = new cVFDFont(sFileName,nBigFontHeight);
}
} else {
esyslog("targaVFD: unable to find font '%s'",szFont);
diff --git a/vfd.h b/vfd.h
index 8486810..b324b1e 100644
--- a/vfd.h
+++ b/vfd.h
@@ -67,12 +67,12 @@ private:
class cVFD : public cVFDQueue {
- cVFDFont* pFont;
/* framebuffer and backingstore for current contents */
cVFDBitmap* framebuf;
cVFDBitmap* backingstore;
unsigned int lastIconState;
protected:
+ cVFDFont* pFont;
bool SendCmdClock();
bool SendCmdShutdown();
@@ -90,7 +90,7 @@ public:
bool flush ();
void icons(unsigned int state);
- virtual bool SetFont(const char *szFont, int m_bTwoLineMode);
+ virtual bool SetFont(const char *szFont, int bTwoLineMode, int nBigFontHeight, int nSmallFontHeight);
};
diff --git a/watch.c b/watch.c
index 179ae1d..60b564b 100644
--- a/watch.c
+++ b/watch.c
@@ -17,6 +17,7 @@
#include "watch.h"
#include "setup.h"
+#include "ffont.h"
#include <vdr/tools.h>
@@ -206,10 +207,9 @@ void cVFDWatch::Action(void)
// every second the clock need updates.
if (theSetup.m_bTwoLineMode) {
if((0 == (nCnt % 5))) {
- if(m_eWatchMode == eLiveTV) {
- bReDraw = CurrentTime();
- } else {
- bReDraw = ReplayTime();
+ bReDraw = CurrentTime();
+ if(m_eWatchMode != eLiveTV) {
+ bReDraw |= ReplayTime();
}
}
}
@@ -292,6 +292,8 @@ bool cVFDWatch::RenderScreen(bool bReDraw) {
cString* scRender;
cString* scHeader = NULL;
bool bForce = m_bUpdateScreen;
+ bool bAllowCurrentTime = false;
+
if(osdMessage) {
scRender = osdMessage;
} else if(osdItem) {
@@ -302,9 +304,10 @@ bool cVFDWatch::RenderScreen(bool bReDraw) {
if(Program()) {
bForce = true;
}
- if(chPresentTitle)
+ if(chPresentTitle) {
scRender = chPresentTitle;
- else {
+ bAllowCurrentTime = true;
+ } else {
scHeader = currentTime;
scRender = chName;
}
@@ -314,6 +317,7 @@ bool cVFDWatch::RenderScreen(bool bReDraw) {
}
scHeader = replayTime;
scRender = replayTitle;
+ bAllowCurrentTime = true;
}
@@ -328,9 +332,10 @@ bool cVFDWatch::RenderScreen(bool bReDraw) {
int iRet = -1;
if(theSetup.m_bTwoLineMode) {
- iRet = this->DrawText(0 - m_nScrollOffset,8, *scRender);
+ iRet = this->DrawText(0 - m_nScrollOffset,pFont->Height(), *scRender);
} else {
- iRet = this->DrawText(0 - m_nScrollOffset,0, *scRender);
+ int nTop = (theSetup.m_cHeight - pFont->Height())/2;
+ iRet = this->DrawText(0 - m_nScrollOffset,nTop<0?0:nTop, *scRender);
}
if(m_bScrollNeeded) {
switch(iRet) {
@@ -359,6 +364,13 @@ bool cVFDWatch::RenderScreen(bool bReDraw) {
}
if(scHeader && theSetup.m_bTwoLineMode) {
+ 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);
+ }
+ }
this->DrawText(0, 0, *scHeader);
}
@@ -835,9 +847,9 @@ void cVFDWatch::OsdStatusMessage(const char *sz)
}
}
-bool cVFDWatch::SetFont(const char *szFont, int bTwoLineMode) {
+bool cVFDWatch::SetFont(const char *szFont, int bTwoLineMode, int nBigFontHeight, int nSmallFontHeight) {
cMutexLooker m(mutex);
- if(cVFD::SetFont(szFont, bTwoLineMode)) {
+ if(cVFD::SetFont(szFont, bTwoLineMode, nBigFontHeight, nSmallFontHeight)) {
m_bUpdateScreen = true;
return true;
}
diff --git a/watch.h b/watch.h
index 7aed236..0fd81d1 100644
--- a/watch.h
+++ b/watch.h
@@ -120,7 +120,7 @@ public:
void OsdCurrentItem(const char *sz);
void OsdStatusMessage(const char *sz);
- virtual bool SetFont(const char *szFont, int bTwoLineMode);
+ virtual bool SetFont(const char *szFont, int bTwoLineMode, int nBigFontHeight, int nSmallFontHeight);
eIconState ForceIcon(unsigned int nIcon, eIconState nState);
};