mirror of
https://github.com/vdr-projects/vdr.git
synced 2025-03-01 10:50:46 +00:00
Completely moved OSD handling out of the cDvbApi class, into the new cOsd
This commit is contained in:
31
interface.c
31
interface.c
@@ -4,13 +4,14 @@
|
||||
* See the main source file 'vdr.c' for copyright information and
|
||||
* how to reach the author.
|
||||
*
|
||||
* $Id: interface.c 1.48 2002/05/13 16:30:22 kls Exp $
|
||||
* $Id: interface.c 1.49 2002/05/18 13:08:20 kls Exp $
|
||||
*/
|
||||
|
||||
#include "interface.h"
|
||||
#include <ctype.h>
|
||||
#include <unistd.h>
|
||||
#include "i18n.h"
|
||||
#include "osd.h"
|
||||
|
||||
cInterface *Interface = NULL;
|
||||
|
||||
@@ -50,7 +51,7 @@ void cInterface::Open(int NumCols, int NumLines)
|
||||
NumCols = Setup.OSDwidth;
|
||||
if (NumLines == 0)
|
||||
NumLines = Setup.OSDheight;
|
||||
cDvbApi::PrimaryDvbApi->Open(width = NumCols, height = NumLines);
|
||||
cOsd::Open(width = NumCols, height = NumLines);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +60,7 @@ void cInterface::Close(void)
|
||||
if (open == 1)
|
||||
Clear();
|
||||
if (!--open) {
|
||||
cDvbApi::PrimaryDvbApi->Close();
|
||||
cOsd::Close();
|
||||
width = height = 0;
|
||||
}
|
||||
}
|
||||
@@ -125,31 +126,31 @@ eKeys cInterface::Wait(int Seconds, bool KeepChar)
|
||||
void cInterface::Clear(void)
|
||||
{
|
||||
if (open)
|
||||
cDvbApi::PrimaryDvbApi->Clear();
|
||||
cOsd::Clear();
|
||||
}
|
||||
|
||||
void cInterface::ClearEol(int x, int y, eDvbColor Color)
|
||||
{
|
||||
if (open)
|
||||
cDvbApi::PrimaryDvbApi->ClrEol(x, y, Color);
|
||||
cOsd::ClrEol(x, y, Color);
|
||||
}
|
||||
|
||||
void cInterface::Fill(int x, int y, int w, int h, eDvbColor Color)
|
||||
{
|
||||
if (open)
|
||||
cDvbApi::PrimaryDvbApi->Fill(x, y, w, h, Color);
|
||||
cOsd::Fill(x, y, w, h, Color);
|
||||
}
|
||||
|
||||
void cInterface::SetBitmap(int x, int y, const cBitmap &Bitmap)
|
||||
{
|
||||
if (open)
|
||||
cDvbApi::PrimaryDvbApi->SetBitmap(x, y, Bitmap);
|
||||
cOsd::SetBitmap(x, y, Bitmap);
|
||||
}
|
||||
|
||||
void cInterface::Flush(void)
|
||||
{
|
||||
if (open)
|
||||
cDvbApi::PrimaryDvbApi->Flush();
|
||||
cOsd::Flush();
|
||||
}
|
||||
|
||||
void cInterface::SetCols(int *c)
|
||||
@@ -163,7 +164,7 @@ void cInterface::SetCols(int *c)
|
||||
|
||||
eDvbFont cInterface::SetFont(eDvbFont Font)
|
||||
{
|
||||
return cDvbApi::PrimaryDvbApi->SetFont(Font);
|
||||
return cOsd::SetFont(Font);
|
||||
}
|
||||
|
||||
char *cInterface::WrapText(const char *Text, int Width, int *Height)
|
||||
@@ -183,7 +184,7 @@ char *cInterface::WrapText(const char *Text, int Width, int *Height)
|
||||
char *Delim = NULL;
|
||||
int w = 0;
|
||||
|
||||
Width *= cDvbApi::PrimaryDvbApi->CellWidth();
|
||||
Width *= cOsd::CellWidth();
|
||||
|
||||
while (*t && t[strlen(t) - 1] == '\n')
|
||||
t[strlen(t) - 1] = 0; // skips trailing newlines
|
||||
@@ -198,7 +199,7 @@ char *cInterface::WrapText(const char *Text, int Width, int *Height)
|
||||
}
|
||||
else if (isspace(*p))
|
||||
Blank = p;
|
||||
int cw = cDvbApi::PrimaryDvbApi->Width(*p);
|
||||
int cw = cOsd::Width(*p);
|
||||
if (w + cw > Width) {
|
||||
if (Blank) {
|
||||
*Blank = '\n';
|
||||
@@ -237,7 +238,7 @@ char *cInterface::WrapText(const char *Text, int Width, int *Height)
|
||||
void cInterface::Write(int x, int y, const char *s, eDvbColor FgColor, eDvbColor BgColor)
|
||||
{
|
||||
if (open)
|
||||
cDvbApi::PrimaryDvbApi->Text(x, y, s, FgColor, BgColor);
|
||||
cOsd::Text(x, y, s, FgColor, BgColor);
|
||||
}
|
||||
|
||||
void cInterface::WriteText(int x, int y, const char *s, eDvbColor FgColor, eDvbColor BgColor)
|
||||
@@ -278,7 +279,7 @@ void cInterface::Title(const char *s)
|
||||
strn0cpy(buffer, s, n + 1);
|
||||
Write(1, 0, buffer, clrBlack, clrCyan);
|
||||
t++;
|
||||
Write(-(cDvbApi::PrimaryDvbApi->WidthInCells(t) + 1), 0, t, clrBlack, clrCyan);
|
||||
Write(-(cOsd::WidthInCells(t) + 1), 0, t, clrBlack, clrCyan);
|
||||
}
|
||||
else {
|
||||
int x = (Width() - strlen(s)) / 2;
|
||||
@@ -337,12 +338,12 @@ void cInterface::HelpButton(int Index, const char *Text, eDvbColor FgColor, eDvb
|
||||
{
|
||||
if (open) {
|
||||
const int w = Width() / 4;
|
||||
cDvbApi::PrimaryDvbApi->Fill(Index * w, -1, w, 1, Text ? BgColor : clrBackground);
|
||||
cOsd::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);
|
||||
cOsd::Text(Index * w + l, -1, Text, FgColor, BgColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user