1 /*****************************************************************************
2 * ListViews.h: BeOS interface list view class implementation
3 *****************************************************************************
4 * Copyright (C) 1999, 2000, 2001 VideoLAN
5 * $Id: ListViews.cpp,v 1.3 2003/02/01 12:01:11 stippi Exp $
7 * Authors: Stephan Aßmus <stippi@yellowbites.com>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
22 *****************************************************************************/
34 #include "VlcWrapper.h"
35 #include "InterfaceWindow.h"
36 #include "ListViews.h"
39 #define MAX_DRAG_HEIGHT 200.0
41 #define TEXT_OFFSET 20.0
43 /*****************************************************************************
45 *****************************************************************************/
46 PlaylistItem::PlaylistItem( const char *name )
51 PlaylistItem::~PlaylistItem()
55 /*****************************************************************************
56 * PlaylistItem::DrawItem
57 *****************************************************************************/
59 PlaylistItem::Draw( BView *owner, BRect frame, bool tintedLine,
60 bool active, bool playing )
62 rgb_color color = (rgb_color){ 255, 255, 255, 255 };
64 color = tint_color( color, 1.04 );
67 color = tint_color( color, B_DARKEN_2_TINT );
68 owner->SetLowColor( color );
69 owner->FillRect( frame, B_SOLID_LOW );
71 owner->SetHighColor( 0, 0, 0, 255 );
73 owner->GetFontHeight( &fh );
74 BString truncatedString( Text() );
75 owner->TruncateString( &truncatedString, B_TRUNCATE_MIDDLE,
76 frame.Width() - TEXT_OFFSET - 4.0 );
77 owner->DrawString( truncatedString.String(),
78 BPoint( frame.left + TEXT_OFFSET,
79 frame.top + fh.ascent + 1.0 ) );
83 rgb_color black = (rgb_color){ 0, 0, 0, 255 };
84 rgb_color green = (rgb_color){ 0, 255, 0, 255 };
85 BRect r( 0.0, 0.0, 10.0, 10.0 );
86 r.OffsetTo( frame.left + 4.0,
87 ceilf( ( frame.top + frame.bottom ) / 2.0 ) - 5.0 );
89 green = tint_color( color, B_DARKEN_1_TINT );
90 rgb_color lightGreen = tint_color( green, B_LIGHTEN_2_TINT );
91 rgb_color darkGreen = tint_color( green, B_DARKEN_2_TINT );
93 arrow[0] = r.LeftTop();
94 arrow[1] = r.LeftBottom();
96 arrow[2].y = ( r.top + r.bottom ) / 2.0;
97 owner->BeginLineArray( 6 );
99 owner->AddLine( arrow[0], arrow[1], black );
100 owner->AddLine( BPoint( arrow[1].x + 1.0, arrow[1].y - 1.0 ),
102 owner->AddLine( arrow[0], arrow[2], black );
109 // highlights and shadow
110 owner->AddLine( arrow[1], arrow[2], darkGreen );
111 owner->AddLine( arrow[0], arrow[2], lightGreen );
112 owner->AddLine( arrow[0], arrow[1], lightGreen );
113 owner->EndLineArray();
120 owner->SetHighColor( green );
121 owner->FillPolygon( arrow, 3 );
125 /*****************************************************************************
126 * DragSortableListView class
127 *****************************************************************************/
128 DragSortableListView::DragSortableListView( BRect frame, const char* name,
129 list_view_type type, uint32 resizingMode,
131 : BListView( frame, name, type, resizingMode, flags ),
132 fDropRect( 0.0, 0.0, -1.0, -1.0 ),
135 SetViewColor( B_TRANSPARENT_32_BIT );
138 DragSortableListView::~DragSortableListView()
142 /*****************************************************************************
143 * DragSortableListView::Draw
144 *****************************************************************************/
146 DragSortableListView::Draw( BRect updateRect )
148 int32 firstIndex = IndexOf( updateRect.LeftTop() );
149 int32 lastIndex = IndexOf( updateRect.RightBottom() );
150 if ( firstIndex >= 0 )
152 if ( lastIndex < firstIndex )
153 lastIndex = CountItems() - 1;
154 // update rect contains items
155 BRect r( updateRect );
156 for ( int32 i = firstIndex; i <= lastIndex; i++)
159 DrawListItem( this, i, r );
161 updateRect.top = r.bottom + 1.0;
162 if ( updateRect.IsValid() )
164 SetLowColor( 255, 255, 255, 255 );
165 FillRect( updateRect, B_SOLID_LOW );
170 SetLowColor( 255, 255, 255, 255 );
171 FillRect( updateRect, B_SOLID_LOW );
173 // drop anticipation indication
174 if ( fDropRect.IsValid() )
176 SetHighColor( 255, 0, 0, 255 );
177 StrokeRect( fDropRect );
181 /*****************************************************************************
182 * DragSortableListView::InitiateDrag
183 *****************************************************************************/
185 DragSortableListView::InitiateDrag( BPoint point, int32 index, bool )
187 bool success = false;
188 BListItem* item = ItemAt( CurrentSelection( 0 ) );
191 // workarround a timing problem
193 item = ItemAt( index );
197 // create drag message
198 BMessage msg( B_SIMPLE_DATA );
199 MakeDragMessage( &msg );
200 // figure out drag rect
201 float width = Bounds().Width();
202 BRect dragRect(0.0, 0.0, width, -1.0);
203 // figure out, how many items fit into our bitmap
206 for (numItems = 0; BListItem* item = ItemAt( CurrentSelection( numItems ) ); numItems++) {
207 dragRect.bottom += ceilf( item->Height() ) + 1.0;
208 if ( dragRect.Height() > MAX_DRAG_HEIGHT ) {
210 dragRect.bottom = MAX_DRAG_HEIGHT;
215 BBitmap* dragBitmap = new BBitmap( dragRect, B_RGB32, true );
216 if ( dragBitmap && dragBitmap->IsValid() ) {
217 if ( BView *v = new BView( dragBitmap->Bounds(), "helper", B_FOLLOW_NONE, B_WILL_DRAW ) ) {
218 dragBitmap->AddChild( v );
220 BRect itemBounds( dragRect) ;
221 itemBounds.bottom = 0.0;
222 // let all selected items, that fit into our drag_bitmap, draw
223 for ( int32 i = 0; i < numItems; i++ ) {
224 int32 index = CurrentSelection( i );
225 BListItem* item = ItemAt( index );
226 itemBounds.bottom = itemBounds.top + ceilf( item->Height() );
227 if ( itemBounds.bottom > dragRect.bottom )
228 itemBounds.bottom = dragRect.bottom;
229 DrawListItem( v, index, itemBounds );
230 itemBounds.top = itemBounds.bottom + 1.0;
232 // make a black frame arround the edge
233 v->SetHighColor( 0, 0, 0, 255 );
234 v->StrokeRect( v->Bounds() );
237 uint8 *bits = (uint8 *)dragBitmap->Bits();
238 int32 height = (int32)dragBitmap->Bounds().Height() + 1;
239 int32 width = (int32)dragBitmap->Bounds().Width() + 1;
240 int32 bpr = dragBitmap->BytesPerRow();
243 for ( int32 y = 0; y < height - ALPHA / 2; y++, bits += bpr ) {
244 uint8 *line = bits + 3;
245 for (uint8 *end = line + 4 * width; line < end; line += 4)
248 for ( int32 y = height - ALPHA / 2; y < height; y++, bits += bpr ) {
249 uint8 *line = bits + 3;
250 for (uint8 *end = line + 4 * width; line < end; line += 4)
251 *line = (height - y) << 1;
254 for ( int32 y = 0; y < height; y++, bits += bpr ) {
255 uint8 *line = bits + 3;
256 for (uint8 *end = line + 4 * width; line < end; line += 4)
260 dragBitmap->Unlock();
265 DragMessage( &msg, dragBitmap, B_OP_ALPHA, BPoint( 0.0, 0.0 ) );
268 DragMessage( &msg, dragRect.OffsetToCopy( point ), this );
274 /*****************************************************************************
275 * DragSortableListView::WindowActivated
276 *****************************************************************************/
278 DragSortableListView::WindowActivated( bool active )
280 // workarround for buggy focus indication of BScrollView
281 if ( BView* view = Parent() )
285 /*****************************************************************************
286 * DragSortableListView::MessageReceived
287 *****************************************************************************/
289 DragSortableListView::MessageReceived(BMessage* message)
291 switch ( message->what )
293 case B_MODIFIERS_CHANGED:
298 DragSortableListView *list = NULL;
299 if ( message->FindPointer( "list", (void **)&list ) == B_OK
302 int32 count = CountItems();
303 if ( fDropIndex < 0 || fDropIndex > count )
307 for ( int32 i = 0; message->FindInt32( "index", i, &index ) == B_OK; i++ )
308 if ( BListItem* item = ItemAt(index) )
309 items.AddItem( (void*)item );
310 if ( items.CountItems() > 0 )
312 if ( modifiers() & B_SHIFT_KEY )
313 CopyItems( items, fDropIndex );
315 MoveItems( items, fDropIndex );
322 BListView::MessageReceived( message );
327 /*****************************************************************************
328 * DragSortableListView::MouseMoved
329 *****************************************************************************/
331 DragSortableListView::MouseMoved(BPoint where, uint32 transit, const BMessage *msg)
333 if ( msg && msg->what == B_SIMPLE_DATA )
335 bool replaceAll = !msg->HasPointer("list") && !(modifiers() & B_SHIFT_KEY);
344 r.bottom--; // compensate for scrollbar offset
345 _SetDropAnticipationRect( r );
350 // offset where by half of item height
351 BRect r( ItemFrame( 0 ) );
352 where.y += r.Height() / 2.0;
354 int32 index = IndexOf( where );
356 index = CountItems();
357 _SetDropIndex( index );
363 _RemoveDropAnticipationRect();
366 // remember drag message
367 // this is needed to react on modifier changes
368 fDragMessageCopy = *msg;
372 _RemoveDropAnticipationRect();
373 BListView::MouseMoved(where, transit, msg);
377 /*****************************************************************************
378 * DragSortableListView::MouseUp
379 *****************************************************************************/
381 DragSortableListView::MouseUp( BPoint where )
384 _SetDropAnticipationRect( BRect( 0.0, 0.0, -1.0, -1.0 ) );
385 BListView::MouseUp( where );
388 /*****************************************************************************
389 * DragSortableListView::DrawItem
390 *****************************************************************************/
392 DragSortableListView::DrawItem( BListItem *item, BRect itemFrame, bool complete )
394 DrawListItem( this, IndexOf( item ), itemFrame );
397 /*****************************************************************************
398 * DragSortableListView::ModifiersChaned
399 *****************************************************************************/
401 DragSortableListView::ModifiersChanged()
405 GetMouse( &where, &buttons, false );
406 uint32 transit = Bounds().Contains( where ) ? B_INSIDE_VIEW : B_OUTSIDE_VIEW;
407 MouseMoved( where, transit, &fDragMessageCopy );
410 /*****************************************************************************
411 * DragSortableListView::MoveItems
412 *****************************************************************************/
414 DragSortableListView::MoveItems( BList& items, int32 index )
417 // we remove the items while we look at them, the insertion index is decreased
418 // when the items index is lower, so that we insert at the right spot after
421 int32 count = items.CountItems();
422 for ( int32 i = 0; i < count; i++ )
424 BListItem* item = (BListItem*)items.ItemAt( i );
425 int32 removeIndex = IndexOf( item );
426 if ( RemoveItem( item ) && removedItems.AddItem( (void*)item ) )
428 if ( removeIndex < index )
431 // else ??? -> blow up
433 for ( int32 i = 0; BListItem* item = (BListItem*)removedItems.ItemAt( i ); i++ )
435 if ( AddItem( item, index ) )
437 // after we're done, the newly inserted items will be selected
438 Select( index, true );
439 // next items will be inserted after this one
447 /*****************************************************************************
448 * DragSortableListView::CopyItems
449 *****************************************************************************/
451 DragSortableListView::CopyItems( BList& items, int32 index )
454 // by inserting the items after we copied all items first, we avoid
455 // cloning an item we already inserted and messing everything up
456 // in other words, don't touch the list before we know which items
459 int32 count = items.CountItems();
460 for ( int32 i = 0; i < count; i++ )
462 BListItem* item = CloneItem( IndexOf( (BListItem*)items.ItemAt( i ) ) );
463 if ( item && !clonedItems.AddItem( (void*)item ) )
466 for ( int32 i = 0; BListItem* item = (BListItem*)clonedItems.ItemAt( i ); i++ )
468 if ( AddItem( item, index ) )
470 // after we're done, the newly inserted items will be selected
471 Select( index, true );
472 // next items will be inserted after this one
480 /*****************************************************************************
481 * DragSortableListView::RemoveItemList
482 *****************************************************************************/
484 DragSortableListView::RemoveItemList( BList& items )
486 int32 count = items.CountItems();
487 for ( int32 i = 0; i < count; i++ )
489 BListItem* item = (BListItem*)items.ItemAt( i );
490 if ( RemoveItem( item ) )
495 /*****************************************************************************
496 * DragSortableListView::RemoveSelected
497 *****************************************************************************/
499 DragSortableListView::RemoveSelected()
502 for ( int32 i = 0; BListItem* item = ItemAt( CurrentSelection( i ) ); i++ )
503 items.AddItem( (void*)item );
504 RemoveItemList( items );
507 /*****************************************************************************
508 * DragSortableListView::_SetDropAnticipationRect
509 *****************************************************************************/
511 DragSortableListView::_SetDropAnticipationRect( BRect r )
513 if ( fDropRect != r )
515 if ( fDropRect.IsValid() )
516 Invalidate( fDropRect );
518 if ( fDropRect.IsValid() )
519 Invalidate( fDropRect );
523 /*****************************************************************************
524 * DragSortableListView::_SetDropAnticipationRect
525 *****************************************************************************/
527 DragSortableListView::_SetDropIndex( int32 index )
529 if ( fDropIndex != index )
532 if ( fDropIndex == -1 )
533 _SetDropAnticipationRect( BRect( 0.0, 0.0, -1.0, -1.0 ) );
536 int32 count = CountItems();
537 if ( fDropIndex == count )
540 if ( BListItem* item = ItemAt( count - 1 ) )
542 r = ItemFrame( count - 1 );
543 r.top = r.bottom + 1.0;
544 r.bottom = r.top + 1.0;
549 r.bottom--; // compensate for scrollbars moved slightly out of window
551 _SetDropAnticipationRect( r );
555 BRect r = ItemFrame( fDropIndex );
556 r.bottom = r.top + 1.0;
557 _SetDropAnticipationRect( r );
563 /*****************************************************************************
564 * DragSortableListView::_RemoveDropAnticipationRect
565 *****************************************************************************/
567 DragSortableListView::_RemoveDropAnticipationRect()
569 _SetDropAnticipationRect( BRect( 0.0, 0.0, -1.0, -1.0 ) );
574 /*****************************************************************************
576 *****************************************************************************/
577 PlaylistView::PlaylistView( BRect frame, InterfaceWindow* mainWindow,
579 BMessage* selectionChangeMessage )
580 : DragSortableListView( frame, "playlist listview",
581 B_MULTIPLE_SELECTION_LIST, B_FOLLOW_ALL_SIDES,
582 B_WILL_DRAW | B_NAVIGABLE | B_PULSE_NEEDED
583 | B_FRAME_EVENTS | B_FULL_UPDATE_ON_RESIZE ),
586 fMainWindow( mainWindow ),
587 fSelectionChangeMessage( selectionChangeMessage ),
588 fVlcWrapper( wrapper )
592 PlaylistView::~PlaylistView()
594 delete fSelectionChangeMessage;
597 /*****************************************************************************
598 * PlaylistView::AttachedToWindow
599 *****************************************************************************/
601 PlaylistView::AttachedToWindow()
603 // get pulse message every two frames
604 Window()->SetPulseRate( 80000 );
607 /*****************************************************************************
608 * PlaylistView::MessageReceived
609 *****************************************************************************/
611 PlaylistView::MessageReceived( BMessage* message)
613 switch ( message->what )
616 if ( message->HasPointer( "list" ) )
618 // message comes from ourself
619 DragSortableListView::MessageReceived( message );
623 // message comes from another app (for example Tracker)
624 message->AddInt32( "drop index", fDropIndex );
625 fMainWindow->PostMessage( message, fMainWindow );
629 DragSortableListView::MessageReceived( message );
634 /*****************************************************************************
635 * PlaylistView::MouseDown
636 *****************************************************************************/
638 PlaylistView::MouseDown( BPoint where )
641 Window()->CurrentMessage()->FindInt32( "clicks", &clicks );
642 bool handled = false;
643 for ( int32 i = 0; PlaylistItem* item = (PlaylistItem*)ItemAt( i ); i++ )
645 BRect r = ItemFrame( i );
646 if ( r.Contains( where ) )
650 fVlcWrapper->PlaylistJumpTo( i );
653 else if ( i == fCurrentIndex )
655 r.right = r.left + TEXT_OFFSET;
656 if ( r.Contains ( where ) )
658 fMainWindow->PostMessage( PAUSE_PLAYBACK );
667 DragSortableListView::MouseDown(where);
670 /*****************************************************************************
671 * PlaylistView::KeyDown
672 *****************************************************************************/
674 PlaylistView::KeyDown( const char* bytes, int32 numBytes )
679 if ( ( bytes[0] == B_BACKSPACE ) || ( bytes[0] == B_DELETE ) )
683 DragSortableListView::KeyDown( bytes, numBytes );
686 /*****************************************************************************
687 * PlaylistView::Pulse
688 *****************************************************************************/
690 PlaylistView::Pulse()
692 if ( fMainWindow->IsStopped() )
696 /*****************************************************************************
697 * PlaylistView::SelectionChanged
698 *****************************************************************************/
700 PlaylistView::SelectionChanged()
702 BLooper* looper = Looper();
703 if ( fSelectionChangeMessage && looper )
705 BMessage message( *fSelectionChangeMessage );
706 looper->PostMessage( &message );
711 /*****************************************************************************
712 * PlaylistView::MoveItems
713 *****************************************************************************/
715 PlaylistView::MoveItems( BList& items, int32 index )
718 // we remove the items while we look at them, the insertion index is decreased
719 // when the items index is lower, so that we insert at the right spot after
721 if ( fVlcWrapper->PlaylistLock() )
725 int32 count = items.CountItems();
726 int32 indexOriginal = index;
727 // remember currently playing item
728 int32 currentIndex, size;
729 fVlcWrapper->GetPlaylistInfo( currentIndex, size );
730 BListItem* playingItem = ItemAt( currentIndex );
731 // collect item pointers for removal by index
732 for ( int32 i = 0; i < count; i++ )
734 int32 removeIndex = IndexOf( (BListItem*)items.ItemAt( i ) );
735 void* item = fVlcWrapper->PlaylistItemAt( removeIndex );
736 if ( item && removeItems.AddItem( item ) )
738 if ( removeIndex < index )
741 // else ??? -> blow up
743 // actually remove items using pointers
744 for ( int32 i = 0; i < count; i++ )
746 void* item = fVlcWrapper->PlaylistRemoveItem( removeItems.ItemAt( i ) );
747 if ( item && !removedItems.AddItem( item ) )
750 // add items at index
751 for ( int32 i = 0; void* item = removedItems.ItemAt( i ); i++ )
753 if ( fVlcWrapper->PlaylistAddItem( item, index ) )
754 // next items will be inserted after this one
760 DragSortableListView::MoveItems( items, indexOriginal );
761 // restore currently playing item
762 for ( int32 i = 0; BListItem* item = ItemAt( i ); i++ )
764 if ( item == playingItem )
766 fVlcWrapper->PlaylistSetPlaying( i );
771 fVlcWrapper->PlaylistUnlock();
775 /*****************************************************************************
776 * PlaylistView::CopyItems
777 *****************************************************************************/
779 PlaylistView::CopyItems( BList& items, int32 toIndex )
782 // we remove the items while we look at them, the insertion index is decreased
783 // when the items index is lower, so that we insert at the right spot after
785 if ( fVlcWrapper->PlaylistLock() )
788 int32 count = items.CountItems();
789 // remember currently playing item
790 int32 currentIndex, size;
791 fVlcWrapper->GetPlaylistInfo( currentIndex, size );
792 BListItem* playingItem = ItemAt( currentIndex );
793 // collect cloned item pointers
794 for ( int32 i = 0; i < count; i++ )
796 int32 index = IndexOf( (BListItem*)items.ItemAt( i ) );
797 void* item = fVlcWrapper->PlaylistItemAt( index );
798 void* cloned = fVlcWrapper->PlaylistCloneItem( item );
799 if ( cloned && !clonedItems.AddItem( cloned ) )
803 // add cloned items at index
804 int32 index = toIndex;
805 for ( int32 i = 0; void* item = clonedItems.ItemAt( i ); i++ )
807 if ( fVlcWrapper->PlaylistAddItem( item, index ) )
808 // next items will be inserted after this one
814 DragSortableListView::CopyItems( items, toIndex );
815 // restore currently playing item
816 for ( int32 i = 0; BListItem* item = ItemAt( i ); i++ )
818 if ( item == playingItem )
820 fVlcWrapper->PlaylistSetPlaying( i );
825 fVlcWrapper->PlaylistUnlock();
829 /*****************************************************************************
830 * PlaylistView::RemoveItemList
831 *****************************************************************************/
833 PlaylistView::RemoveItemList( BList& items )
835 if ( fVlcWrapper->PlaylistLock() )
837 // collect item pointers for removal
839 int32 count = items.CountItems();
840 for ( int32 i = 0; i < count; i++ )
842 int32 index = IndexOf( (BListItem*)items.ItemAt( i ) );
843 void* item = fVlcWrapper->PlaylistItemAt( index );
844 if ( item && !removeItems.AddItem( item ) )
847 // remove items from playlist
848 count = removeItems.CountItems();
849 for ( int32 i = 0; void* item = removeItems.ItemAt( i ); i++ )
851 fVlcWrapper->PlaylistRemoveItem( item );
854 DragSortableListView::RemoveItemList( items );
855 fVlcWrapper->PlaylistUnlock();
859 /*****************************************************************************
860 * PlaylistView::CloneItem
861 *****************************************************************************/
863 PlaylistView::CloneItem( int32 atIndex ) const
865 BListItem* clone = NULL;
866 if ( PlaylistItem* item = dynamic_cast<PlaylistItem*>( ItemAt( atIndex ) ) )
867 clone = new PlaylistItem( item->Text() );
871 /*****************************************************************************
872 * PlaylistView::DrawListItem
873 *****************************************************************************/
875 PlaylistView::DrawListItem( BView* owner, int32 index, BRect frame ) const
877 if ( PlaylistItem* item = dynamic_cast<PlaylistItem*>( ItemAt( index ) ) )
878 item->Draw( owner, frame, index % 2, index == fCurrentIndex, fPlaying );
881 /*****************************************************************************
882 * PlaylistView::MakeDragMessage
883 *****************************************************************************/
885 PlaylistView::MakeDragMessage( BMessage* message ) const
889 message->AddPointer( "list", (void*)this );
891 for ( int32 i = 0; ( index = CurrentSelection( i ) ) >= 0; i++ )
892 message->AddInt32( "index", index );
893 // TODO: add refs to message (inter application communication)
897 /*****************************************************************************
898 * PlaylistView::SetCurrent
899 *****************************************************************************/
901 PlaylistView::SetCurrent( int32 index )
903 if ( fCurrentIndex != index )
905 InvalidateItem( fCurrentIndex );
906 fCurrentIndex = index;
907 InvalidateItem( fCurrentIndex );
911 /*****************************************************************************
912 * PlaylistView::SetPlaying
913 *****************************************************************************/
915 PlaylistView::SetPlaying( bool playing )
917 if ( fPlaying != playing )
920 InvalidateItem( fCurrentIndex );
924 /*****************************************************************************
925 * PlaylistView::SetPlaying
926 *****************************************************************************/
928 PlaylistView::RebuildList()
931 int32 count = CountItems();
932 while ( BListItem* item = RemoveItem( --count ) )
935 // rebuild listview from VLC's playlist
936 for ( int i = 0; i < fVlcWrapper->PlaylistSize(); i++ )
937 AddItem( new PlaylistItem( fVlcWrapper->PlaylistItemName( i ) ) );