Improved speed of setting the Help button texts

This commit is contained in:
Klaus Schmidinger
2002-01-26 11:13:48 +01:00
parent e010ca2106
commit fe7b03d6b5
3 changed files with 13 additions and 12 deletions

View File

@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: interface.c 1.45 2001/12/01 11:59:43 kls Exp $
* $Id: interface.c 1.46 2002/01/26 11:09:58 kls Exp $
*/
#include "interface.h"
@@ -331,13 +331,15 @@ bool cInterface::Confirm(const char *s, int Seconds, bool WaitForTimeout)
void cInterface::HelpButton(int Index, const char *Text, eDvbColor FgColor, eDvbColor BgColor)
{
if (open && Text) {
if (open) {
const int w = Width() / 4;
int l = (w - int(strlen(Text))) / 2;
if (l < 0)
l = 0;
cDvbApi::PrimaryDvbApi->Fill(Index * w, -1, w, 1, BgColor);
cDvbApi::PrimaryDvbApi->Text(Index * w + l, -1, Text, FgColor, BgColor);
cDvbApi::PrimaryDvbApi->Fill(Index * w, -1, w, 1, Text ? BgColor : clrBackground);
if (Text) {
int l = (w - int(strlen(Text))) / 2;
if (l < 0)
l = 0;
cDvbApi::PrimaryDvbApi->Text(Index * w + l, -1, Text, FgColor, BgColor);
}
}
}