[o_outline_view setTarget: self];
[o_outline_view setDelegate: self];
[o_outline_view setDataSource: self];
+ [o_outline_view setAllowsEmptySelection: NO];
vlc_object_release( p_playlist );
[self initStrings];
int i_return = 0;
playlist_item_t *p_item = NULL;
playlist_t * p_playlist = pl_Yield( VLCIntf );
- assert( outlineView != o_outline_view );
+ assert( outlineView == o_outline_view );
if( !item )
p_item = p_playlist->p_root_category;
}
else
{
- o_value = @"-:--:--";
+ o_value = @"--:--";
}
}
free( psz_artist );
}
-
- return( o_value );
+ return o_value;
}
@end
for( i = 0; ppsz_services[i]; i++ )
{
bool b_enabled;
- char *objectname;
NSMenuItem *o_lmi;
char * name = ppsz_name[i] ? ppsz_name[i] : ppsz_services[i];
/* Check whether to enable these menuitems */
- b_enabled = playlist_IsServicesDiscoveryLoaded( p_playlist, objectname );
+ b_enabled = playlist_IsServicesDiscoveryLoaded( p_playlist, ppsz_services[i] );
/* Create the menu entries used in the playlist menu */
o_lmi = [[o_mi_services submenu] addItemWithTitle:
if( playlist_CurrentSize( p_playlist ) >= 2 )
{
[o_status_field setStringValue: [NSString stringWithFormat:
- _NS("%i items in the playlist"),
+ _NS("%i items"),
playlist_CurrentSize( p_playlist )]];
}
else
if( playlist_IsEmpty( p_playlist ) )
[o_status_field setStringValue: _NS("No items in the playlist")];
else
- [o_status_field setStringValue: _NS("1 item in the playlist")];
+ [o_status_field setStringValue: _NS("1 item")];
}
vlc_object_release( p_playlist );
}
vlc_object_release( p_playlist );
}
+- (void)outlineViewSelectionDidChange:(NSNotification *)notification
+{
+ // FIXME: unsafe
+ playlist_item_t * p_item = [[o_outline_view itemAtRow:[o_outline_view selectedRow]] pointerValue];
+
+ if( p_item )
+ {
+ /* update our info-panel to reflect the new item */
+ [[[VLCMain sharedInstance] getInfo] updatePanelWithItem:p_item->p_input];
+ }
+}
+
+- (BOOL)isSelectionEmpty
+{
+ return [o_outline_view selectedRow] == -1;
+}
+
- (void)updateRowSelection
{
int i_row;
unsigned int j;
+ // FIXME: unsafe
playlist_t *p_playlist = pl_Yield( VLCIntf );
playlist_item_t *p_item, *p_temp_item;
NSMutableArray *o_array = [NSMutableArray array];
}
+ /* update our info-panel to reflect the new item */
+ [[[VLCMain sharedInstance] getInfo] updatePanelWithItem:p_item->p_input];
+
vlc_object_release( p_playlist );
- /* update our info-panel to reflect the new item */
- [[[VLCMain sharedInstance] getInfo] updatePanel];
}
/* Check if p_item is a child of p_node recursively. We need to check the item
p_item = NULL;
}
}
- playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, true, p_node, p_item );
+ playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, false, p_node, p_item );
}
vlc_object_release( p_playlist );
}
int i_item;
playlist_t * p_playlist = pl_Yield( VLCIntf );
+ PL_LOCK;
for( i_item = 0; i_item < (int)[o_array count]; i_item++ )
{
input_item_t *p_input;
/* Add the item */
/* FIXME: playlist_AddInput() can fail */
+
playlist_AddInput( p_playlist, p_input, PLAYLIST_INSERT,
i_position == -1 ? PLAYLIST_END : i_position + i_item, true,
- false );
+ true );
if( i_item == 0 && !b_enqueue )
{
p_item = playlist_ItemGetByInput( p_playlist, p_input, true );
playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, true, NULL, p_item );
}
- else
- {
- playlist_item_t *p_item;
- p_item = playlist_ItemGetByInput( p_playlist, p_input, true );
- playlist_Control( p_playlist, PLAYLIST_SKIP, true, p_item );
- }
vlc_gc_decref( p_input );
}
+ PL_UNLOCK;
+
[self playlistUpdated];
vlc_object_release( p_playlist );
}
p_item = playlist_ItemGetByInput( p_playlist, p_input, true );
playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, true, NULL, p_item );
}
- else
- {
- playlist_item_t *p_item;
- p_item = playlist_ItemGetByInput( p_playlist, p_input, true );
- playlist_Control( p_playlist, PLAYLIST_SKIP, true, p_item );
- }
vlc_gc_decref( p_input );
}
[self playlistUpdated];
pt = [o_outline_view convertPoint: [o_event locationInWindow]
fromView: nil];
- b_item_sel = ( [o_outline_view rowAtPoint: pt] != -1 &&
- [o_outline_view selectedRow] != -1 );
+ NSInteger row = [o_outline_view rowAtPoint:pt];
+ if( row != -1 )
+ [o_outline_view selectRowIndexes:[NSIndexSet indexSetWithIndex:row] byExtendingSelection:NO];
+
+ b_item_sel = ( row != -1 && [o_outline_view selectedRow] != -1 );
b_rows = [o_outline_view numberOfRows] != 0;
[o_mi_play setEnabled: b_item_sel];
i_type = ORDER_NORMAL;
}
- vlc_mutex_lock( &p_playlist->object_lock );
+ vlc_object_lock( p_playlist );
playlist_RecursiveNodeSort( p_playlist, p_playlist->p_root_category, i_mode, i_type );
- vlc_mutex_unlock( &p_playlist->object_lock );
+ vlc_object_unlock( p_playlist );
vlc_object_release( p_playlist );
[self playlistUpdated];
[item pointerValue] checkItemExistence: YES]
|| [o_playing_item isEqual: item] )
{
- [cell setFont: [NSFont boldSystemFontOfSize: 0]];
+ [cell setFont: [[NSFontManager sharedFontManager] convertFont:[cell font] toHaveTrait:NSBoldFontMask]];
}
else
{
- [cell setFont: [NSFont systemFontOfSize: 0]];
+ [cell setFont: [[NSFontManager sharedFontManager] convertFont:[cell font] toNotHaveTrait:NSBoldFontMask]];
}
vlc_object_release( p_playlist );
}
if( playlist_CurrentSize( p_playlist ) >= 2 )
{
[o_status_field setStringValue: [NSString stringWithFormat:
- _NS("%i items in the playlist"),
+ _NS("%i items"),
playlist_CurrentSize( p_playlist )]];
}
else
}
else
{
- [o_status_field setStringValue: _NS("1 item in the playlist")];
+ [o_status_field setStringValue: _NS("1 item")];
}
}
vlc_object_release( p_playlist );
[o_outline_dict setObject:o_value forKey:[NSString stringWithFormat:@"%p",
[o_value pointerValue]]];
-#ifndef NDEBUG
- msg_Dbg( VLCIntf, "adding item %p", [o_value pointerValue] );
-#endif
return o_value;
}