diff options
-rw-r--r-- | ffont.c | 9 | ||||
-rw-r--r-- | imon.c | 14 | ||||
-rw-r--r-- | imon.h | 4 | ||||
-rw-r--r-- | imonlcd.c | 2 | ||||
-rw-r--r-- | po/de_DE.po | 12 | ||||
-rw-r--r-- | po/it_IT.po | 8 | ||||
-rw-r--r-- | setup.c | 46 | ||||
-rw-r--r-- | setup.h | 3 | ||||
-rw-r--r-- | watch.c | 36 | ||||
-rw-r--r-- | watch.h | 2 |
10 files changed, 104 insertions, 32 deletions
@@ -82,11 +82,12 @@ ciMonFont::ciMonFont(const char *Name, int CharHeight, int CharWidth) } } else { + //int xdpi = (int) ( ( 72.0 * 0.9 ) + 0.5 ); 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); @@ -132,7 +132,10 @@ ciMonLCD::~ciMonLCD() { */ int ciMonLCD::open(const char* szDevice, eProtocol pro) { - if(!SetFont(theSetup.m_szFont,theSetup.m_bTwoLineMode)) { + if(!SetFont(theSetup.m_szFont, + theSetup.m_bTwoLineMode, + theSetup.m_nBigFontHeight, + theSetup.m_nSmallFontHeight)) { return -1; } @@ -636,18 +639,17 @@ int ciMonLCD::lengthToPixels(int length) return (pixLen[32 + length] ^ 0xffffffff); } -bool ciMonLCD::SetFont(const char *szFont, int bTwoLineMode) { +bool ciMonLCD::SetFont(const char *szFont, int bTwoLineMode, int nBigFontHeight, int nSmallFontHeight) { ciMonFont* tmpFont = NULL; cString sFileName = cFont::GetFontFileName(szFont); if(!isempty(sFileName)) { - if (bTwoLineMode) - { - tmpFont = new ciMonFont(sFileName,6,8); + if (bTwoLineMode) { + tmpFont = new ciMonFont(sFileName,nSmallFontHeight); } else { - tmpFont = new ciMonFont(sFileName,12,11); + tmpFont = new ciMonFont(sFileName,nBigFontHeight); } } else { esyslog("iMonLCD: unable to find file for font '%s'",szFont); @@ -88,7 +88,6 @@ class ciMonLCD { int imon_fd; - ciMonFont* pFont; /* framebuffer and backingstore for current contents */ ciMonBitmap* framebuf; ciMonBitmap* backingstore; @@ -106,6 +105,7 @@ class ciMonLCD { int last_cd_state; protected: + ciMonFont* pFont; void setLineLength(int topLine, int botLine, int topProgress, int botProgress); void setBuiltinProgressBars(int topLine, int botLine, int topProgress, int botProgress); @@ -128,7 +128,7 @@ public: bool flush (); bool 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); }; #endif @@ -20,7 +20,7 @@ #include "status.h" #include "setup.h" -static const char *VERSION = "0.0.3"; +static const char *VERSION = "0.0.4"; static const char *DEFAULT_LCDDEVICE = "/dev/lcd0"; diff --git a/po/de_DE.po b/po/de_DE.po index e658c3b..5569c82 100644 --- a/po/de_DE.po +++ b/po/de_DE.po @@ -1,14 +1,14 @@ # vdr-imonlcd-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-imonlcd-plugin 0.0.3\n" "Report-Msgid-Bugs-To: <see README>\n" -"POT-Creation-Date: 2009-09-29 19:13+0200\n" -"PO-Revision-Date: 2009-05-21 17:13+0200\n" +"POT-Creation-Date: 2010-04-18 18:17+0200\n" +"PO-Revision-Date: 2010-04-18 18:21+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" @@ -27,6 +27,12 @@ msgstr "Kontrast" 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 "Disc spinning mode" msgstr "Disc Rotationsmode" diff --git a/po/it_IT.po b/po/it_IT.po index b01daa9..ae48c84 100644 --- a/po/it_IT.po +++ b/po/it_IT.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: vdr-imonlcd-plugin 0.0.1\n" "Report-Msgid-Bugs-To: <see README>\n" -"POT-Creation-Date: 2009-09-29 19:55+0200\n" +"POT-Creation-Date: 2010-04-18 18:17+0200\n" "PO-Revision-Date: 2009-06-07 23:30+0100\n" "Last-Translator: Diego Pierotto <vdr-italian@tiscali.it>\n" "Language-Team: \n" @@ -30,6 +30,12 @@ msgstr "Contrasto" msgid "Default font" msgstr "Carattere predefinito" +msgid "Height of big font" +msgstr "" + +msgid "Height of small font" +msgstr "" + msgid "Disc spinning mode" msgstr "Modalità rotazione disco" @@ -31,6 +31,8 @@ #define DEFAULT_FONT "Sans:Bold" #define DEFAULT_WAKEUP 5 #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 cIMonSetup theSetup; @@ -47,6 +49,8 @@ cIMonSetup::cIMonSetup(void) m_nWakeup = DEFAULT_WAKEUP; 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)); } @@ -67,6 +71,8 @@ cIMonSetup& cIMonSetup::operator = (const cIMonSetup& x) m_nWakeup = x.m_nWakeup; m_bTwoLineMode = x.m_bTwoLineMode; + m_nBigFontHeight = x.m_nBigFontHeight; + m_nSmallFontHeight = x.m_nSmallFontHeight; strncpy(m_szFont,x.m_szFont,sizeof(m_szFont)); @@ -155,6 +161,28 @@ bool cIMonSetup::SetupParse(const char *szName, const char *szValue) m_nWakeup = n; 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")) { @@ -189,6 +217,8 @@ void ciMonMenuSetup::Store(void) SetupStore("Contrast", theSetup.m_nContrast); SetupStore("DiscMode", theSetup.m_bDiscMode); SetupStore("Font", theSetup.m_szFont); + SetupStore("BigFont", theSetup.m_nBigFontHeight); + SetupStore("SmallFont", theSetup.m_nSmallFontHeight); SetupStore("Wakeup", theSetup.m_nWakeup); SetupStore("TwoLineMode",theSetup.m_bTwoLineMode); } @@ -209,6 +239,12 @@ ciMonMenuSetup::ciMonMenuSetup(ciMonWatch* pDev) 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)); Add(new cMenuEditBoolItem(tr("Disc spinning mode"), &m_tmpSetup.m_bDiscMode, @@ -250,8 +286,14 @@ eOSState ciMonMenuSetup::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); @@ -35,6 +35,9 @@ struct cIMonSetup int m_nWidth; int m_nHeight; + int m_nBigFontHeight; + int m_nSmallFontHeight; + char m_szFont[256]; int m_nWakeup; @@ -18,6 +18,7 @@ #include "watch.h" #include "setup.h" +#include "ffont.h" #include <vdr/tools.h> @@ -233,16 +234,15 @@ void ciMonWatch::Action(void) // every second the clock need updates. if((0 == (nCnt % 5))) { - if(m_eWatchMode == eLiveTV) { - if (theSetup.m_bTwoLineMode) { - bReDraw = CurrentTime(); - } - } else { + if (theSetup.m_bTwoLineMode) { + bReDraw = CurrentTime(); + } + if(m_eWatchMode != eLiveTV) { current = 0; total = 0; if (ReplayPosition(current,total) && theSetup.m_bTwoLineMode) { - bReDraw = ReplayTime(current,total); + bReDraw |= ReplayTime(current,total); } } } @@ -398,6 +398,8 @@ bool ciMonWatch::RenderScreen(bool bReDraw) { cString* scRender; cString* scHeader = NULL; bool bForce = m_bUpdateScreen; + bool bAllowCurrentTime = false; + if(osdMessage) { scRender = osdMessage; } else if(osdItem) { @@ -408,9 +410,10 @@ bool ciMonWatch::RenderScreen(bool bReDraw) { if(Program()) { bForce = true; } - if(chPresentTitle) + if(chPresentTitle) { scRender = chPresentTitle; - else { + bAllowCurrentTime = true; + } else { scHeader = currentTime; scRender = chName; } @@ -420,6 +423,7 @@ bool ciMonWatch::RenderScreen(bool bReDraw) { } scHeader = replayTime; scRender = replayTitle; + bAllowCurrentTime = true; } @@ -434,9 +438,10 @@ bool ciMonWatch::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_nHeight - pFont->Height())/2; + iRet = this->DrawText(0 - m_nScrollOffset,nTop<0?0:nTop, *scRender); } if(m_bScrollNeeded) { switch(iRet) { @@ -465,6 +470,13 @@ bool ciMonWatch::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_nWidth && t < theSetup.m_nWidth) { + this->DrawText(theSetup.m_nWidth - t, 0, *currentTime); + } + } this->DrawText(0, 0, *scHeader); } @@ -963,9 +975,9 @@ void ciMonWatch::OsdStatusMessage(const char *sz) } } -bool ciMonWatch::SetFont(const char *szFont, int bTwoLineMode) { +bool ciMonWatch::SetFont(const char *szFont, int bTwoLineMode, int nBigFontHeight, int nSmallFontHeight) { cMutexLooker m(mutex); - if(ciMonLCD::SetFont(szFont, bTwoLineMode)) { + if(ciMonLCD::SetFont(szFont, bTwoLineMode, nBigFontHeight, nSmallFontHeight)) { m_bUpdateScreen = true; return true; } @@ -149,7 +149,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); }; |