diff options
-rw-r--r-- | CONTRIBUTORS | 1 | ||||
-rw-r--r-- | HISTORY | 1 | ||||
-rw-r--r-- | osd.c | 13 | ||||
-rw-r--r-- | osd.h | 5 | ||||
-rw-r--r-- | tools.c | 42 | ||||
-rw-r--r-- | tools.h | 6 |
6 files changed, 54 insertions, 14 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 35ef4090..78d3d184 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -133,6 +133,7 @@ Stefan Huelswitt <huels@iname.com> 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 for suggesting to add the cPlugin::Housekeeping() function + for suggesting to add 'insert' capabilities to cList Ulrich Röder <roeder@efr-net.de> for pointing out that there are channels that have a symbol rate higher than @@ -1276,3 +1276,4 @@ Video Disk Recorder Revision History if the plugin will not be able to perform its task (suggested by Stefan Huelswitt). - Added the cPlugin::Housekeeping() function (suggested by Stefan Huelswitt). - Updated channels.conf.cable (thanks to Uwe Scheffler). +- Added 'insert' capabilities to cList (suggested by Stefan Huelswitt). @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * 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" @@ -161,9 +161,16 @@ void cOsdMenu::Del(int Index) 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) current = Item->Index(); } @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * 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 @@ -116,7 +116,8 @@ public: cOsdMenu(const char *Title, int c0 = 0, int c1 = 0, int c2 = 0, int c3 = 0, int c4 = 0); virtual ~cOsdMenu(); 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); virtual eOSState ProcessKey(eKeys Key); }; @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * 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" @@ -724,6 +724,12 @@ void cListObject::Append(cListObject *Object) Object->prev = this; } +void cListObject::Insert(cListObject *Object) +{ + prev = Object; + Object->next = this; +} + void cListObject::Unlink(void) { if (next) @@ -757,13 +763,35 @@ cListBase::~cListBase() Clear(); } -void cListBase::Add(cListObject *Object) +void cListBase::Add(cListObject *Object, cListObject *After) { - if (lastObject) - lastObject->Append(Object); - else - objects = Object; - lastObject = Object; + if (After && After != lastObject) { + After->Next()->Insert(Object); + After->Append(Object); + } + else { + if (lastObject) + lastObject->Append(Object); + else + objects = 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) @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * 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 @@ -120,6 +120,7 @@ public: virtual ~cListObject(); virtual bool operator< (const cListObject &ListObject) { return false; } void Append(cListObject *Object); + void Insert(cListObject *Object); void Unlink(void); int Index(void); cListObject *Prev(void) const { return prev; } @@ -132,7 +133,8 @@ protected: cListBase(void); public: virtual ~cListBase(); - void Add(cListObject *Object); + void Add(cListObject *Object, cListObject *After = NULL); + void Ins(cListObject *Object, cListObject *Before = NULL); void Del(cListObject *Object); virtual void Move(int From, int To); void Move(cListObject *From, cListObject *To); |