summaryrefslogtreecommitdiff
path: root/osd.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2007-08-26 09:58:10 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2007-08-26 09:58:10 +0200
commita80915ff22ec0103fb95212b0048aa73007f87eb (patch)
tree0ba0885a3deae6239f4b67ee066c8319f4856c13 /osd.c
parent6a737033ad4a4b732198a99c5f227f10278b32b6 (diff)
downloadvdr-a80915ff22ec0103fb95212b0048aa73007f87eb.tar.gz
vdr-a80915ff22ec0103fb95212b0048aa73007f87eb.tar.bz2
There can now be more than one OSD at the same time
Diffstat (limited to 'osd.c')
-rw-r--r--osd.c43
1 files changed, 32 insertions, 11 deletions
diff --git a/osd.c b/osd.c
index 96dfc2e4..1c91184d 100644
--- a/osd.c
+++ b/osd.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: osd.c 1.73 2007/08/17 15:23:50 kls Exp $
+ * $Id: osd.c 1.74 2007/08/26 09:44:50 kls Exp $
*/
#include "osd.h"
@@ -646,18 +646,24 @@ int cOsd::osdLeft = 0;
int cOsd::osdTop = 0;
int cOsd::osdWidth = 0;
int cOsd::osdHeight = 0;
-int cOsd::isOpen = 0;
+cVector<cOsd *> cOsd::Osds;
-cOsd::cOsd(int Left, int Top)
+cOsd::cOsd(int Left, int Top, uint Level)
{
- if (isOpen)
- esyslog("ERROR: OSD opened without closing previous OSD!");
savedRegion = NULL;
numBitmaps = 0;
left = Left;
top = Top;
width = height = 0;
- isOpen++;
+ level = Level;
+ active = false;
+ for (int i = 0; i < Osds.Size(); i++) {
+ if (Osds[i]->level > level) {
+ Osds.Insert(this, i);
+ return;
+ }
+ }
+ Osds.Append(this);
}
cOsd::~cOsd()
@@ -665,7 +671,14 @@ cOsd::~cOsd()
for (int i = 0; i < numBitmaps; i++)
delete bitmaps[i];
delete savedRegion;
- isOpen--;
+ for (int i = 0; i < Osds.Size(); i++) {
+ if (Osds[i] == this) {
+ Osds.Remove(i);
+ if (Osds.Size())
+ Osds[0]->SetActive(true);
+ break;
+ }
+ }
}
void cOsd::SetOsdPosition(int Left, int Top, int Width, int Height)
@@ -803,15 +816,23 @@ cOsdProvider::~cOsdProvider()
osdProvider = NULL;
}
-cOsd *cOsdProvider::NewOsd(int Left, int Top)
+cOsd *cOsdProvider::NewOsd(int Left, int Top, uint Level)
{
if (Level == 0 && cOsd::IsOpen())
esyslog("ERROR: attempt to open OSD while it is already open - using dummy OSD!");
- else if (osdProvider)
- return osdProvider->CreateOsd(Left, Top);
+ else if (osdProvider) {
+ cOsd *ActiveOsd = cOsd::Osds.Size() ? cOsd::Osds[0] : NULL;
+ cOsd *Osd = osdProvider->CreateOsd(Left, Top, Level);
+ if (Osd == cOsd::Osds[0]) {
+ if (ActiveOsd)
+ ActiveOsd->SetActive(false);
+ Osd->SetActive(true);
+ }
+ return Osd;
+ }
else
esyslog("ERROR: no OSD provider available - using dummy OSD!");
- return new cOsd(Left, Top); // create a dummy cOsd, so that access won't result in a segfault
+ return new cOsd(Left, Top, 999); // create a dummy cOsd, so that access won't result in a segfault
}
void cOsdProvider::Shutdown(void)