1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Renamed Utf8NumSyms() to Utf8StrLen()

This commit is contained in:
Klaus Schmidinger 2007-06-16 09:05:22 +02:00
parent 4011e244ff
commit 81e44bce19
3 changed files with 12 additions and 12 deletions

View File

@ -3,7 +3,7 @@
* *
* See the README file for copyright information and how to reach the author. * See the README file for copyright information and how to reach the author.
* *
* $Id: skincurses.c 1.12 2007/06/15 12:23:31 kls Exp $ * $Id: skincurses.c 1.13 2007/06/16 09:05:04 kls Exp $
*/ */
#include <ncurses.h> #include <ncurses.h>
@ -20,7 +20,7 @@ static const char *MAINMENUENTRY = NULL;
class cCursesFont : public cFont { class cCursesFont : public cFont {
public: public:
virtual int Width(uint c) const { return 1; } virtual int Width(uint c) const { return 1; }
virtual int Width(const char *s) const { return s ? Utf8NumSyms(s) : 0; } virtual int Width(const char *s) const { return s ? Utf8StrLen(s) : 0; }
virtual int Height(void) const { return 1; } 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 {} virtual void DrawText(cBitmap *Bitmap, int x, int y, const char *s, tColor ColorFg, tColor ColorBg, int Width) const {}
}; };
@ -253,7 +253,7 @@ void cSkinCursesDisplayChannel::Flush(void)
{ {
if (!message) { if (!message) {
cString date = DayDateTime(); cString date = DayDateTime();
osd->DrawText(OsdWidth - Utf8NumSyms(date), 0, date, clrWhite, clrBackground, &Font); osd->DrawText(OsdWidth - Utf8StrLen(date), 0, date, clrWhite, clrBackground, &Font);
} }
osd->Flush(); osd->Flush();
} }
@ -388,7 +388,7 @@ void cSkinCursesDisplayMenu::SetEvent(const cEvent *Event)
if (Event->Vps() && Event->Vps() != Event->StartTime()) { if (Event->Vps() && Event->Vps() != Event->StartTime()) {
char *buffer; char *buffer;
asprintf(&buffer, " VPS: %s", *Event->GetVpsString()); asprintf(&buffer, " VPS: %s", *Event->GetVpsString());
osd->DrawText(OsdWidth - Utf8NumSyms(buffer), y, buffer, clrBlack, clrYellow, &Font); osd->DrawText(OsdWidth - Utf8StrLen(buffer), y, buffer, clrBlack, clrYellow, &Font);
free(buffer); free(buffer);
} }
y += ts.Height(); y += ts.Height();
@ -443,7 +443,7 @@ void cSkinCursesDisplayMenu::SetText(const char *Text, bool FixedFont)
void cSkinCursesDisplayMenu::Flush(void) void cSkinCursesDisplayMenu::Flush(void)
{ {
cString date = DayDateTime(); cString date = DayDateTime();
osd->DrawText(OsdWidth - Utf8NumSyms(date) - 2, 0, date, clrBlack, clrCyan, &Font); osd->DrawText(OsdWidth - Utf8StrLen(date) - 2, 0, date, clrBlack, clrCyan, &Font);
osd->Flush(); osd->Flush();
} }
@ -508,12 +508,12 @@ void cSkinCursesDisplayReplay::SetProgress(int Current, int Total)
void cSkinCursesDisplayReplay::SetCurrent(const char *Current) void cSkinCursesDisplayReplay::SetCurrent(const char *Current)
{ {
osd->DrawText(0, 2, Current, clrWhite, clrBackground, &Font, Utf8NumSyms(Current) + 3); osd->DrawText(0, 2, Current, clrWhite, clrBackground, &Font, Utf8StrLen(Current) + 3);
} }
void cSkinCursesDisplayReplay::SetTotal(const char *Total) void cSkinCursesDisplayReplay::SetTotal(const char *Total)
{ {
osd->DrawText(OsdWidth - Utf8NumSyms(Total), 2, Total, clrWhite, clrBackground, &Font); osd->DrawText(OsdWidth - Utf8StrLen(Total), 2, Total, clrWhite, clrBackground, &Font);
} }
void cSkinCursesDisplayReplay::SetJump(const char *Jump) void cSkinCursesDisplayReplay::SetJump(const char *Jump)
@ -569,7 +569,7 @@ void cSkinCursesDisplayVolume::SetVolume(int Current, int Total, bool Mute)
} }
else { else {
const char *Prompt = tr("Volume "); const char *Prompt = tr("Volume ");
int l = Utf8NumSyms(Prompt); int l = Utf8StrLen(Prompt);
int p = (OsdWidth - l) * Current / Total; int p = (OsdWidth - l) * Current / Total;
osd->DrawText(0, 0, Prompt, clrGreen, clrBackground, &Font); osd->DrawText(0, 0, Prompt, clrGreen, clrBackground, &Font);
osd->DrawRectangle(l, 0, l + p - 1, 0, clrGreen); osd->DrawRectangle(l, 0, l + p - 1, 0, clrGreen);

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: tools.c 1.126 2007/06/15 13:11:12 kls Exp $ * $Id: tools.c 1.127 2007/06/16 09:05:11 kls Exp $
*/ */
#include "tools.h" #include "tools.h"
@ -649,7 +649,7 @@ int Utf8SymChars(const char *s, int Symbols)
return n; return n;
} }
int Utf8NumSyms(const char *s) int Utf8StrLen(const char *s)
{ {
if (cCharSetConv::SystemCharacterTable()) if (cCharSetConv::SystemCharacterTable())
return strlen(s); return strlen(s);

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: tools.h 1.99 2007/06/15 12:18:37 kls Exp $ * $Id: tools.h 1.100 2007/06/16 09:05:22 kls Exp $
*/ */
#ifndef __TOOLS_H #ifndef __TOOLS_H
@ -93,7 +93,7 @@ int Utf8CharSet(uint c, char *s = NULL);
int Utf8SymChars(const char *s, int Symbols); int Utf8SymChars(const char *s, int Symbols);
///< Returns the number of character bytes at the beginning of the given ///< Returns the number of character bytes at the beginning of the given
///< string that form at most the given number of UTF-8 symbols. ///< string that form at most the given number of UTF-8 symbols.
int Utf8NumSyms(const char *s); int Utf8StrLen(const char *s);
///< Returns the number of UTF-8 symbols formed by the given string of ///< Returns the number of UTF-8 symbols formed by the given string of
///< character bytes. ///< character bytes.
int Utf8ToArray(const char *s, uint *a, int Size); int Utf8ToArray(const char *s, uint *a, int Size);