Rearranged OSD class names to make 'cOsd' available for the main OSD interface

This commit is contained in:
Klaus Schmidinger 2002-05-18 12:41:18 +02:00
parent 4da8a8e066
commit 3e5b31af5e
9 changed files with 44 additions and 43 deletions

View File

@ -1308,3 +1308,4 @@ Video Disk Recorder Revision History
buffer (thanks to Sven Grothklags).
- Added an error message if the directory specified in the '-L' option can't be
accessed (suggested by Stefan Huelswitt).
- Rearranged OSD class names to make 'cOsd' available for the main OSD interface.

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: dvbosd.c 1.15 2002/05/13 16:29:20 kls Exp $
* $Id: dvbosd.c 1.16 2002/05/18 12:39:39 kls Exp $
*/
#include "dvbosd.h"
@ -14,7 +14,7 @@
#include "tools.h"
cDvbOsd::cDvbOsd(int VideoDev, int x, int y)
:cOsd(x, y)
:cOsdBase(x, y)
{
videoDev = VideoDev;
if (videoDev < 0)

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: dvbosd.h 1.11 2002/05/10 14:22:07 kls Exp $
* $Id: dvbosd.h 1.12 2002/05/18 12:39:31 kls Exp $
*/
#ifndef __DVBOSD_H
@ -13,7 +13,7 @@
#include <ost/osd.h>
#include "osdbase.h"
class cDvbOsd : public cOsd {
class cDvbOsd : public cOsdBase {
private:
int videoDev;
bool SetWindow(cWindow *Window);

8
menu.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: menu.c 1.192 2002/05/13 16:30:50 kls Exp $
* $Id: menu.c 1.193 2002/05/18 12:35:21 kls Exp $
*/
#include "menu.h"
@ -2113,7 +2113,7 @@ eOSState cMenuMain::ProcessKey(eKeys Key)
#define INFOTIMEOUT 5000 //ms
cDisplayChannel::cDisplayChannel(int Number, bool Switched)
:cOsdBase(true)
:cOsdObject(true)
{
group = -1;
withInfo = !Switched || Setup.ShowInfoOnChSwitch;
@ -2130,7 +2130,7 @@ cDisplayChannel::cDisplayChannel(int Number, bool Switched)
}
cDisplayChannel::cDisplayChannel(eKeys FirstKey)
:cOsdBase(true)
:cOsdObject(true)
{
group = -1;
oldNumber = cDvbApi::CurrentChannel();
@ -2322,7 +2322,7 @@ cVolumeBar::cVolumeBar(int Width, int Height, int Current, int Total, const char
cDisplayVolume *cDisplayVolume::displayVolume = NULL;
cDisplayVolume::cDisplayVolume(void)
:cOsdBase(true)
:cOsdObject(true)
{
displayVolume = this;
timeout = time_ms() + (cDvbApi::PrimaryDvbApi->IsMute() ? MUTETIMEOUT : VOLUMETIMEOUT);

8
menu.h
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: menu.h 1.42 2002/04/13 15:31:41 kls Exp $
* $Id: menu.h 1.43 2002/05/18 12:36:06 kls Exp $
*/
#ifndef __MENU_H
@ -24,7 +24,7 @@ public:
virtual eOSState ProcessKey(eKeys Key);
};
class cDisplayChannel : public cOsdBase {
class cDisplayChannel : public cOsdObject {
private:
int group;
bool withInfo;
@ -40,7 +40,7 @@ public:
virtual eOSState ProcessKey(eKeys Key);
};
class cDisplayVolume : public cOsdBase {
class cDisplayVolume : public cOsdObject {
private:
int timeout;
static cDisplayVolume *displayVolume;
@ -108,7 +108,7 @@ public:
static bool Active(void);
};
class cReplayControl : public cOsdBase {
class cReplayControl : public cOsdObject {
private:
cDvbApi *dvbApi;
cMarks marks;

10
osd.h
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: osd.h 1.29 2002/05/12 11:19:22 kls Exp $
* $Id: osd.h 1.30 2002/05/18 12:36:30 kls Exp $
*/
#ifndef __OSD_H
@ -69,19 +69,19 @@ public:
virtual eOSState ProcessKey(eKeys Key);
};
class cOsdBase {
class cOsdObject {
protected:
bool needsFastResponse;
public:
cOsdBase(bool FastResponse = false) { needsFastResponse = FastResponse; }
virtual ~cOsdBase() {}
cOsdObject(bool FastResponse = false) { needsFastResponse = FastResponse; }
virtual ~cOsdObject() {}
int Width(void) { return Interface->Width(); }
int Height(void) { return Interface->Height(); }
bool NeedsFastResponse(void) { return needsFastResponse; }
virtual eOSState ProcessKey(eKeys Key) = 0;
};
class cOsdMenu : public cOsdBase, public cList<cOsdItem> {
class cOsdMenu : public cOsdObject, public cList<cOsdItem> {
private:
char *title;
int cols[cInterface::MaxCols];

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: osdbase.c 1.3 2002/05/18 08:54:31 kls Exp $
* $Id: osdbase.c 1.4 2002/05/18 12:39:16 kls Exp $
*/
#include "osdbase.h"
@ -316,22 +316,22 @@ const char *cWindow::Data(int x, int y)
return cBitmap::Data(x, y);
}
// --- cOsd ------------------------------------------------------------------
// --- cOsdBase --------------------------------------------------------------
cOsd::cOsd(int x, int y)
cOsdBase::cOsdBase(int x, int y)
{
numWindows = 0;
x0 = x;
y0 = y;
}
cOsd::~cOsd()
cOsdBase::~cOsdBase()
{
for (int i = 0; i < numWindows; i++)
delete window[i];
}
tWindowHandle cOsd::Create(int x, int y, int w, int h, int Bpp, bool ClearWithBackground, bool Tiled)
tWindowHandle cOsdBase::Create(int x, int y, int w, int h, int Bpp, bool ClearWithBackground, bool Tiled)
{
if (numWindows < MAXNUMWINDOWS) {
if (x >= 0 && y >= 0 && w > 0 && h > 0 && (Bpp == 1 || Bpp == 2 || Bpp == 4 || Bpp == 8)) {
@ -356,7 +356,7 @@ tWindowHandle cOsd::Create(int x, int y, int w, int h, int Bpp, bool ClearWithBa
return -1;
}
void cOsd::AddColor(eDvbColor Color, tWindowHandle Window)
void cOsdBase::AddColor(eDvbColor Color, tWindowHandle Window)
{
cWindow *w = GetWindow(Window);
if (w) {
@ -365,7 +365,7 @@ void cOsd::AddColor(eDvbColor Color, tWindowHandle Window)
}
}
cWindow *cOsd::GetWindow(int x, int y)
cWindow *cOsdBase::GetWindow(int x, int y)
{
for (int i = 0; i < numWindows; i++) {
if (window[i]->Tiled() && window[i]->Contains(x, y))
@ -374,7 +374,7 @@ cWindow *cOsd::GetWindow(int x, int y)
return NULL;
}
cWindow *cOsd::GetWindow(tWindowHandle Window)
cWindow *cOsdBase::GetWindow(tWindowHandle Window)
{
if (0 <= Window && Window < numWindows)
return window[Window];
@ -383,7 +383,7 @@ cWindow *cOsd::GetWindow(tWindowHandle Window)
return NULL;
}
void cOsd::Flush(void)
void cOsdBase::Flush(void)
{
for (int i = 0; i < numWindows; i++) {
CommitWindow(window[i]);
@ -396,7 +396,7 @@ void cOsd::Flush(void)
}
}
void cOsd::Clear(tWindowHandle Window)
void cOsdBase::Clear(tWindowHandle Window)
{
if (Window == ALL_TILED_WINDOWS || Window == ALL_WINDOWS) {
for (int i = 0; i < numWindows; i++)
@ -410,31 +410,31 @@ void cOsd::Clear(tWindowHandle Window)
}
}
void cOsd::Fill(int x1, int y1, int x2, int y2, eDvbColor Color, tWindowHandle Window)
void cOsdBase::Fill(int x1, int y1, int x2, int y2, eDvbColor Color, tWindowHandle Window)
{
cWindow *w = (Window == ALL_TILED_WINDOWS) ? GetWindow(x1, y1) : GetWindow(Window);
if (w)
w->Fill(x1, y1, x2, y2, Color);
}
void cOsd::SetBitmap(int x, int y, const cBitmap &Bitmap, tWindowHandle Window)
void cOsdBase::SetBitmap(int x, int y, const cBitmap &Bitmap, tWindowHandle Window)
{
cWindow *w = (Window == ALL_TILED_WINDOWS) ? GetWindow(x, y) : GetWindow(Window);
if (w)
w->SetBitmap(x, y, Bitmap);
}
int cOsd::Width(unsigned char c)
int cOsdBase::Width(unsigned char c)
{
return numWindows ? window[0]->Width(c) : 0;
}
int cOsd::Width(const char *s)
int cOsdBase::Width(const char *s)
{
return numWindows ? window[0]->Width(s) : 0;
}
eDvbFont cOsd::SetFont(eDvbFont Font)
eDvbFont cOsdBase::SetFont(eDvbFont Font)
{
eDvbFont oldFont = Font;
for (int i = 0; i < numWindows; i++)
@ -442,14 +442,14 @@ eDvbFont cOsd::SetFont(eDvbFont Font)
return oldFont;
}
void cOsd::Text(int x, int y, const char *s, eDvbColor ColorFg, eDvbColor ColorBg, tWindowHandle Window)
void cOsdBase::Text(int x, int y, const char *s, eDvbColor ColorFg, eDvbColor ColorBg, tWindowHandle Window)
{
cWindow *w = (Window == ALL_TILED_WINDOWS) ? GetWindow(x, y) : GetWindow(Window);
if (w)
w->Text(x, y, s, ColorFg, ColorBg);
}
void cOsd::Relocate(tWindowHandle Window, int x, int y, int NewWidth, int NewHeight)
void cOsdBase::Relocate(tWindowHandle Window, int x, int y, int NewWidth, int NewHeight)
{
cWindow *w = GetWindow(Window);
if (w) {
@ -471,12 +471,12 @@ void cOsd::Relocate(tWindowHandle Window, int x, int y, int NewWidth, int NewHei
}
}
void cOsd::Hide(tWindowHandle Window)
void cOsdBase::Hide(tWindowHandle Window)
{
HideWindow(GetWindow(Window), true);
}
void cOsd::Show(tWindowHandle Window)
void cOsdBase::Show(tWindowHandle Window)
{
HideWindow(GetWindow(Window), false);
}

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: osdbase.h 1.1 2002/05/10 14:26:09 kls Exp $
* $Id: osdbase.h 1.2 2002/05/18 12:38:17 kls Exp $
*/
#ifndef __OSDBASE_H
@ -119,7 +119,7 @@ typedef int tWindowHandle;
#define ALL_TILED_WINDOWS (-3)
#define LAST_CREATED_WINDOW (-4)
class cOsd {
class cOsdBase {
private:
int numWindows;
int x0, y0;
@ -149,9 +149,9 @@ protected:
virtual void CloseWindow(cWindow *Window) = 0;
// Close the window and release any OSD hardware resources allocated for it.
public:
cOsd(int x, int y);
cOsdBase(int x, int y);
// Initializes the OSD, starting at screen coordinates (x, y).
virtual ~cOsd();
virtual ~cOsdBase();
// Destroys all windows and shuts down the OSD.
tWindowHandle Create(int x, int y, int w, int h, int Bpp, bool ClearWithBackground = true, bool Tiled = true);
// Creates a window at coordinates (x, y), which are relative to the OSD's

6
vdr.c
View File

@ -22,7 +22,7 @@
*
* The project's page is at http://www.cadsoft.de/people/kls/vdr
*
* $Id: vdr.c 1.110 2002/05/18 10:33:54 kls Exp $
* $Id: vdr.c 1.111 2002/05/18 12:35:34 kls Exp $
*/
#include <getopt.h>
@ -363,7 +363,7 @@ int main(int argc, char *argv[])
// Main program loop:
cOsdBase *Menu = NULL;
cOsdObject *Menu = NULL;
cReplayControl *ReplayControl = NULL;
int LastChannel = -1;
int PreviousChannel = cDvbApi::CurrentChannel();
@ -409,7 +409,7 @@ int main(int argc, char *argv[])
}
}
// User Input:
cOsdBase **Interact = Menu ? &Menu : (cOsdBase **)&ReplayControl;
cOsdObject **Interact = Menu ? &Menu : (cOsdObject **)&ReplayControl;
eKeys key = Interface->GetKey(!*Interact || !(*Interact)->NeedsFastResponse());
if (NORMALKEY(key) != kNone) {
EITScanner.Activity();