Mailing List archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[vdr] Re: VDR Plugin System - First Step
Stefan Huelswitt wrote:
>
> On 09 May 2002 Klaus Schmidinger <Klaus.Schmidinger@cadsoft.de> wrote:
>
> > I suggest that the authors of VDR patches try to implement the "command line",
> > "menu", "setup" and "i18n" parts of their patches, using the new plugin features, and
> > let me know which remaining functions they would still need to patch VDR
> > source files for. What I already am planning to implement are generalized
>
> Just had a quick view at the documentation. Sounds goods. I
> haven't created any code until now, but I see something missing
> for me: you cannot insert a listobject in the middle of a list. I
> would suggest:
>
> void cListObject::Insert(cListObject *Object)
> {
> if(next) { // Allow inserting an object in the middle of the list
> next->prev = Object;
> Object->next = next;
> }
> Append(Object);
> }
>
> void cListBase::Add(cListObject *Object, cListObject *AfterThis)
> {
> if (lastObject) {
> if(AfterThis) { AfterThis->Insert(Object); return; }
> lastObject->Append(Object);
> }
> else
> objects = Object;
> lastObject = Object;
> }
>
> with the declaration (for default behaviour):
>
> void Add(cListObject *Object, cListObject *AfterThis=NULL);
>
> And for the MenuItem handling (to add an item below the current):
>
> void cOsdMenu::Insert(cOsdItem *Item, bool Current)
> {
> cList<cOsdItem>::Add(Item,Get(current));
> if (Current)
> current = Item->Index();
> }
I'm not sure if this is the right way to do this.
With your method you won't be able to insert an item before the very first item
of a list - and I guess a common solution should provide this capability.
So I'd suggest that cListObject::Insert(cListObject *Object) should insert
'Object' *before* the cListObject, and maybe it would be better to call that
function cListObject::Prepend(cListObject *Object) then (according to the other
function being called 'Append()').
Consequently cListBase::Add(cListObject *Object, cListObject *AfterThis) should
be accompanied by a new cListBase::Ins(cListObject *Object, cListObject *BeforeThis)
to allow full flexibility.
Finally, cOsdMenu::Add() should be the one offering to add *after* a given
item, and cOsdMenu::Ins() should insert *before* a given item.
Klaus
--
_______________________________________________________________
Klaus Schmidinger Phone: +49-8635-6989-10
CadSoft Computer GmbH Fax: +49-8635-6989-40
Hofmark 2 Email: kls@cadsoft.de
D-84568 Pleiskirchen, Germany URL: www.cadsoft.de
_______________________________________________________________
Home |
Main Index |
Thread Index