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

Added 'insert' capabilities to cList

This commit is contained in:
Klaus Schmidinger 2002-05-12 14:46:46 +02:00
parent 97a5ac7cba
commit 2cc450a67c
6 changed files with 54 additions and 14 deletions

View File

@ -133,6 +133,7 @@ Stefan Huelswitt <huels@iname.com>
for suggesting to make the cPlugin::Start() function return a boolean value that for suggesting to make the cPlugin::Start() function return a boolean value that
indicates if the plugin will not be able to perform its task indicates if the plugin will not be able to perform its task
for suggesting to add the cPlugin::Housekeeping() function for suggesting to add the cPlugin::Housekeeping() function
for suggesting to add 'insert' capabilities to cList
Ulrich Röder <roeder@efr-net.de> Ulrich Röder <roeder@efr-net.de>
for pointing out that there are channels that have a symbol rate higher than for pointing out that there are channels that have a symbol rate higher than

View File

@ -1276,3 +1276,4 @@ Video Disk Recorder Revision History
if the plugin will not be able to perform its task (suggested by Stefan Huelswitt). if the plugin will not be able to perform its task (suggested by Stefan Huelswitt).
- Added the cPlugin::Housekeeping() function (suggested by Stefan Huelswitt). - Added the cPlugin::Housekeeping() function (suggested by Stefan Huelswitt).
- Updated channels.conf.cable (thanks to Uwe Scheffler). - Updated channels.conf.cable (thanks to Uwe Scheffler).
- Added 'insert' capabilities to cList (suggested by Stefan Huelswitt).

13
osd.c
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: osd.c 1.24 2002/05/05 12:00:00 kls Exp $ * $Id: osd.c 1.25 2002/05/12 11:38:39 kls Exp $
*/ */
#include "osd.h" #include "osd.h"
@ -161,9 +161,16 @@ void cOsdMenu::Del(int Index)
first--; first--;
} }
void cOsdMenu::Add(cOsdItem *Item, bool Current) void cOsdMenu::Add(cOsdItem *Item, bool Current, cOsdItem *After)
{ {
cList<cOsdItem>::Add(Item); cList<cOsdItem>::Add(Item, After);
if (Current)
current = Item->Index();
}
void cOsdMenu::Ins(cOsdItem *Item, bool Current, cOsdItem *Before)
{
cList<cOsdItem>::Ins(Item, Before);
if (Current) if (Current)
current = Item->Index(); current = Item->Index();
} }

5
osd.h
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: osd.h 1.28 2002/05/05 12:00:00 kls Exp $ * $Id: osd.h 1.29 2002/05/12 11:19:22 kls Exp $
*/ */
#ifndef __OSD_H #ifndef __OSD_H
@ -116,7 +116,8 @@ public:
cOsdMenu(const char *Title, int c0 = 0, int c1 = 0, int c2 = 0, int c3 = 0, int c4 = 0); cOsdMenu(const char *Title, int c0 = 0, int c1 = 0, int c2 = 0, int c3 = 0, int c4 = 0);
virtual ~cOsdMenu(); virtual ~cOsdMenu();
int Current(void) { return current; } int Current(void) { return current; }
void Add(cOsdItem *Item, bool Current = false); void Add(cOsdItem *Item, bool Current = false, cOsdItem *After = NULL);
void Ins(cOsdItem *Item, bool Current = false, cOsdItem *Before = NULL);
void Display(void); void Display(void);
virtual eOSState ProcessKey(eKeys Key); virtual eOSState ProcessKey(eKeys Key);
}; };

32
tools.c
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.63 2002/05/01 16:20:30 kls Exp $ * $Id: tools.c 1.64 2002/05/12 11:37:24 kls Exp $
*/ */
#include "tools.h" #include "tools.h"
@ -724,6 +724,12 @@ void cListObject::Append(cListObject *Object)
Object->prev = this; Object->prev = this;
} }
void cListObject::Insert(cListObject *Object)
{
prev = Object;
Object->next = this;
}
void cListObject::Unlink(void) void cListObject::Unlink(void)
{ {
if (next) if (next)
@ -757,13 +763,35 @@ cListBase::~cListBase()
Clear(); Clear();
} }
void cListBase::Add(cListObject *Object) void cListBase::Add(cListObject *Object, cListObject *After)
{ {
if (After && After != lastObject) {
After->Next()->Insert(Object);
After->Append(Object);
}
else {
if (lastObject) if (lastObject)
lastObject->Append(Object); lastObject->Append(Object);
else else
objects = Object; objects = Object;
lastObject = Object; lastObject = Object;
}
}
void cListBase::Ins(cListObject *Object, cListObject *Before)
{
if (Before && Before != objects) {
Before->Prev()->Append(Object);
Before->Insert(Object);
}
else {
if (objects)
objects->Insert(Object);
else
objects = Object;
if (!lastObject)
lastObject = Object;
}
} }
void cListBase::Del(cListObject *Object) void cListBase::Del(cListObject *Object)

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.43 2002/05/11 08:35:47 kls Exp $ * $Id: tools.h 1.44 2002/05/12 11:14:18 kls Exp $
*/ */
#ifndef __TOOLS_H #ifndef __TOOLS_H
@ -120,6 +120,7 @@ public:
virtual ~cListObject(); virtual ~cListObject();
virtual bool operator< (const cListObject &ListObject) { return false; } virtual bool operator< (const cListObject &ListObject) { return false; }
void Append(cListObject *Object); void Append(cListObject *Object);
void Insert(cListObject *Object);
void Unlink(void); void Unlink(void);
int Index(void); int Index(void);
cListObject *Prev(void) const { return prev; } cListObject *Prev(void) const { return prev; }
@ -132,7 +133,8 @@ protected:
cListBase(void); cListBase(void);
public: public:
virtual ~cListBase(); virtual ~cListBase();
void Add(cListObject *Object); void Add(cListObject *Object, cListObject *After = NULL);
void Ins(cListObject *Object, cListObject *Before = NULL);
void Del(cListObject *Object); void Del(cListObject *Object);
virtual void Move(int From, int To); virtual void Move(int From, int To);
void Move(cListObject *From, cListObject *To); void Move(cListObject *From, cListObject *To);