summaryrefslogtreecommitdiff
path: root/PLUGINS/src/skincurses/skincurses.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <kls (at) cadsoft (dot) de>2007-06-17 18:00:00 +0200
committerKlaus Schmidinger <kls (at) cadsoft (dot) de>2007-06-17 18:00:00 +0200
commitb1e4da3be6552f58f3890bf2ad48879823d2e130 (patch)
treecf42a1e6b296956b82a2820948c7b90dbcddf26e /PLUGINS/src/skincurses/skincurses.c
parentb9b9ace9a8d2d1c0beda1dc0a2ebc6be9b47c305 (diff)
downloadvdr-patch-lnbsharing-b1e4da3be6552f58f3890bf2ad48879823d2e130.tar.gz
vdr-patch-lnbsharing-b1e4da3be6552f58f3890bf2ad48879823d2e130.tar.bz2
Version 1.5.4vdr-1.5.4
- Increased APIVERSION (forgot to do that in 1.5.2 and 1.5.3). - Fixed a crash in i18n character set conversion (thanks to Alexander Riedel, Jose Alberto Reguero and Christian Wieninger for patches that cured part of the problem). - Adjusted the 'skincurses' plugin to UTF-8 handling. - Using nl_langinfo(CODESET) to determine the local codeset to use (thanks to Thomas Günther). The codeset names in 'libsi/si.c' have been changed to the canonical spelling with '-' (thanks to Ludwig Nussel for pointing this out). - Modified handling invalid characters in VFAT mode. - Replaced strn0cpy() with Utf8Strn0Cpy() where necessary. - Now using 'fontconfig' to determine which fonts to use (thanks to Anssi Hannula for code and hints on how to do this). - If no fonts are installed, VDR now uses a dummy font that doesn't actually draw any text, and logs an error message. - The new function cFont::CreateFont() can be used by plugins to create and use fonts of their own, independent of VDR's standard fonts. - Updated the Finnish OSD texts (thanks to Rolf Ahrenberg). - Changed the parameter "OSD font" to "Default font" in "Setup/OSD" (suggested by Rolf Ahrenberg). - Fixed handling detached processes in SystemExec() (thanks to Udo Richter). - The info.vdr file now also stores the name of the channel, and the new function cRecordingInfo::ChannelName() returns this information if available (based on a patch from Alexander Hans). - The new function cOsd::SetOsdPosition() can be used to dynamically change the position and size of the OSD (based on a request from Christoph Haubrich). Plugins that implement skins should no longer use Setup.OSDWidth etc. directly, but should rather use cOsd::OsdWidth() etc. instead. Currently a change to the OSD position will only apply to newly opened OSDs.
Diffstat (limited to 'PLUGINS/src/skincurses/skincurses.c')
-rw-r--r--PLUGINS/src/skincurses/skincurses.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/PLUGINS/src/skincurses/skincurses.c b/PLUGINS/src/skincurses/skincurses.c
index 243ddce..33fe194 100644
--- a/PLUGINS/src/skincurses/skincurses.c
+++ b/PLUGINS/src/skincurses/skincurses.c
@@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
- * $Id: skincurses.c 1.11 2006/09/10 14:23:55 kls Exp $
+ * $Id: skincurses.c 1.13 2007/06/16 09:05:04 kls Exp $
*/
#include <ncurses.h>
@@ -11,7 +11,7 @@
#include <vdr/plugin.h>
#include <vdr/skins.h>
-static const char *VERSION = "0.0.8";
+static const char *VERSION = "0.1.0";
static const char *DESCRIPTION = "A text only skin";
static const char *MAINMENUENTRY = NULL;
@@ -19,12 +19,10 @@ static const char *MAINMENUENTRY = NULL;
class cCursesFont : public cFont {
public:
- cCursesFont(void): cFont(NULL) {}
- virtual int Width(unsigned char c) const { return 1; }
- virtual int Width(const char *s) const { return s ? strlen(s) : 0; }
- virtual int Height(unsigned char c) const { return 1; }
- virtual int Height(const char *s) const { return 1; }
+ virtual int Width(uint c) const { return 1; }
+ virtual int Width(const char *s) const { return s ? Utf8StrLen(s) : 0; }
virtual int Height(void) const { return 1; }
+ virtual void DrawText(cBitmap *Bitmap, int x, int y, const char *s, tColor ColorFg, tColor ColorBg, int Width) const {}
};
static const cCursesFont Font;
@@ -135,6 +133,8 @@ void cCursesOsd::RestoreRegion(void)
void cCursesOsd::DrawText(int x, int y, const char *s, tColor ColorFg, tColor ColorBg, const cFont *Font, int Width, int Height, int Alignment)
{
+ if (!s)
+ return;
int w = Font->Width(s);
int h = Font->Height();
if (Width || Height) {
@@ -253,7 +253,7 @@ void cSkinCursesDisplayChannel::Flush(void)
{
if (!message) {
cString date = DayDateTime();
- osd->DrawText(OsdWidth - strlen(date), 0, date, clrWhite, clrBackground, &Font);
+ osd->DrawText(OsdWidth - Utf8StrLen(date), 0, date, clrWhite, clrBackground, &Font);
}
osd->Flush();
}
@@ -388,7 +388,7 @@ void cSkinCursesDisplayMenu::SetEvent(const cEvent *Event)
if (Event->Vps() && Event->Vps() != Event->StartTime()) {
char *buffer;
asprintf(&buffer, " VPS: %s", *Event->GetVpsString());
- osd->DrawText(OsdWidth - strlen(buffer), y, buffer, clrBlack, clrYellow, &Font);
+ osd->DrawText(OsdWidth - Utf8StrLen(buffer), y, buffer, clrBlack, clrYellow, &Font);
free(buffer);
}
y += ts.Height();
@@ -443,7 +443,7 @@ void cSkinCursesDisplayMenu::SetText(const char *Text, bool FixedFont)
void cSkinCursesDisplayMenu::Flush(void)
{
cString date = DayDateTime();
- osd->DrawText(OsdWidth - strlen(date) - 2, 0, date, clrBlack, clrCyan, &Font);
+ osd->DrawText(OsdWidth - Utf8StrLen(date) - 2, 0, date, clrBlack, clrCyan, &Font);
osd->Flush();
}
@@ -508,12 +508,12 @@ void cSkinCursesDisplayReplay::SetProgress(int Current, int Total)
void cSkinCursesDisplayReplay::SetCurrent(const char *Current)
{
- osd->DrawText(0, 2, Current, clrWhite, clrBackground, &Font, strlen(Current) + 3);
+ osd->DrawText(0, 2, Current, clrWhite, clrBackground, &Font, Utf8StrLen(Current) + 3);
}
void cSkinCursesDisplayReplay::SetTotal(const char *Total)
{
- osd->DrawText(OsdWidth - strlen(Total), 2, Total, clrWhite, clrBackground, &Font);
+ osd->DrawText(OsdWidth - Utf8StrLen(Total), 2, Total, clrWhite, clrBackground, &Font);
}
void cSkinCursesDisplayReplay::SetJump(const char *Jump)
@@ -569,7 +569,7 @@ void cSkinCursesDisplayVolume::SetVolume(int Current, int Total, bool Mute)
}
else {
const char *Prompt = tr("Volume ");
- int l = strlen(Prompt);
+ int l = Utf8StrLen(Prompt);
int p = (OsdWidth - l) * Current / Total;
osd->DrawText(0, 0, Prompt, clrGreen, clrBackground, &Font);
osd->DrawRectangle(l, 0, l + p - 1, 0, clrGreen);