Commit 2570019d authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: basic UI to have something as a start

minor functional changes only
parent dfa953d4
...@@ -182,18 +182,18 @@ ...@@ -182,18 +182,18 @@
/* three little ugly helpers */ /* three little ugly helpers */
- (void)repeatOne - (void)repeatOne
{ {
[o_btn_repeat setImage: [NSImage imageNamed:@"repeat_single_embedded_graphite"]]; [o_btn_repeat setImage: [NSImage imageNamed:@"repeat-one"]];
[o_btn_repeat setAlternateImage: [NSImage imageNamed:@"repeat_embedded_graphite"]]; [o_btn_repeat setAlternateImage: [NSImage imageNamed:@"repeat-one-pressed"]];
} }
- (void)repeatAll - (void)repeatAll
{ {
[o_btn_repeat setImage: [NSImage imageNamed:@"repeat_embedded_graphite"]]; [o_btn_repeat setImage: [NSImage imageNamed:@"repeat-all"]];
[o_btn_repeat setAlternateImage: [NSImage imageNamed:@"repeat_embedded"]]; [o_btn_repeat setAlternateImage: [NSImage imageNamed:@"repeat-all-pressed"]];
} }
- (void)repeatOff - (void)repeatOff
{ {
[o_btn_repeat setImage: [NSImage imageNamed:@"repeat_embedded"]]; [o_btn_repeat setImage: [NSImage imageNamed:@"repeat"]];
[o_btn_repeat setAlternateImage: [NSImage imageNamed:@"repeat_embedded_graphite"]]; [o_btn_repeat setAlternateImage: [NSImage imageNamed:@"repeat-pressed"]];
} }
- (void)shuffle - (void)shuffle
{ {
...@@ -201,10 +201,16 @@ ...@@ -201,10 +201,16 @@
playlist_t *p_playlist = pl_Get( VLCIntf ); playlist_t *p_playlist = pl_Get( VLCIntf );
var_Get( p_playlist, "random", &val ); var_Get( p_playlist, "random", &val );
[o_btn_shuffle setState: val.b_bool]; [o_btn_shuffle setState: val.b_bool];
if(val.b_bool) if(val.b_bool) {
[o_btn_shuffle_embed setImage: [NSImage imageNamed:@"shuffle_embedded_graphite"]]; [o_btn_shuffle_embed setImage: [NSImage imageNamed:@"shuffle-on"]];
else [o_btn_shuffle_embed setAlternativeImage: [NSImage imageNamed:@"shuffle-blue-pressed"]];
[o_btn_shuffle_embed setImage: [NSImage imageNamed:@"shuffle_embedded"]]; }
else
{
[o_btn_shuffle_embed setImage: [NSImage imageNamed:@"shuffle"]];
[o_btn_shuffle_embed setImage: [NSImage imageNamed:@"shuffle-pressed"]];
}
} }
- (IBAction)repeatButtonAction:(id)sender - (IBAction)repeatButtonAction:(id)sender
......
...@@ -136,8 +136,6 @@ struct intf_sys_t ...@@ -136,8 +136,6 @@ struct intf_sys_t
float f_slider_old; /* old slider val */ float f_slider_old; /* old slider val */
IBOutlet NSSlider * o_volumeslider; /* volume slider */ IBOutlet NSSlider * o_volumeslider; /* volume slider */
IBOutlet NSView * toolbarMediaControl; /* view with the controls */
IBOutlet NSProgressIndicator * o_main_pgbar; /* playlist window progress bar */ IBOutlet NSProgressIndicator * o_main_pgbar; /* playlist window progress bar */
IBOutlet NSButton * o_btn_prev; /* btn previous */ IBOutlet NSButton * o_btn_prev; /* btn previous */
IBOutlet NSButton * o_btn_rewind; /* btn rewind */ IBOutlet NSButton * o_btn_rewind; /* btn rewind */
...@@ -320,15 +318,8 @@ struct intf_sys_t ...@@ -320,15 +318,8 @@ struct intf_sys_t
IBOutlet NSMenuItem * o_vmi_fullscreen; IBOutlet NSMenuItem * o_vmi_fullscreen;
IBOutlet NSMenuItem * o_vmi_snapshot; IBOutlet NSMenuItem * o_vmi_snapshot;
bool b_small_window;
bool b_restore_size;
NSRect o_restore_rect;
mtime_t i_end_scroll; mtime_t i_end_scroll;
NSSize o_size_with_playlist;
int i_lastShownVolume; int i_lastShownVolume;
input_state_e cachedInputState; input_state_e cachedInputState;
......
This diff is collapsed.
...@@ -138,17 +138,7 @@ ...@@ -138,17 +138,7 @@
{ {
} }
@end - (void)drawRect:(NSRect)rect;
- (void)drawKnobInRect:(NSRect)knobRect;
/*****************************************************************************
* ITSliderCell
*****************************************************************************/
@interface ITSliderCell : NSSliderCell
{
NSImage *_knobOff;
NSImage *_knobOn;
BOOL b_mouse_down;
}
@end @end
...@@ -136,7 +136,7 @@ static NSMutableArray *blackoutWindows = NULL; ...@@ -136,7 +136,7 @@ static NSMutableArray *blackoutWindows = NULL;
+ (NSScreen *)screenWithDisplayID: (CGDirectDisplayID)displayID + (NSScreen *)screenWithDisplayID: (CGDirectDisplayID)displayID
{ {
int i; int i;
for( i = 0; i < [[NSScreen screens] count]; i++ ) for( i = 0; i < [[NSScreen screens] count]; i++ )
{ {
NSScreen *screen = [[NSScreen screens] objectAtIndex: i]; NSScreen *screen = [[NSScreen screens] objectAtIndex: i];
...@@ -174,7 +174,7 @@ static NSMutableArray *blackoutWindows = NULL; ...@@ -174,7 +174,7 @@ static NSMutableArray *blackoutWindows = NULL;
NSScreen *screen = [[NSScreen screens] objectAtIndex: i]; NSScreen *screen = [[NSScreen screens] objectAtIndex: i];
VLCWindow *blackoutWindow; VLCWindow *blackoutWindow;
NSRect screen_rect; NSRect screen_rect;
if([self isScreen: screen]) if([self isScreen: screen])
continue; continue;
...@@ -189,13 +189,13 @@ static NSMutableArray *blackoutWindows = NULL; ...@@ -189,13 +189,13 @@ static NSMutableArray *blackoutWindows = NULL;
backing: NSBackingStoreBuffered defer: NO screen: screen]; backing: NSBackingStoreBuffered defer: NO screen: screen];
[blackoutWindow setBackgroundColor:[NSColor blackColor]]; [blackoutWindow setBackgroundColor:[NSColor blackColor]];
[blackoutWindow setLevel: NSFloatingWindowLevel]; /* Disappear when Expose is triggered */ [blackoutWindow setLevel: NSFloatingWindowLevel]; /* Disappear when Expose is triggered */
[blackoutWindow displayIfNeeded]; [blackoutWindow displayIfNeeded];
[blackoutWindow orderFront: self animate: YES]; [blackoutWindow orderFront: self animate: YES];
[blackoutWindows addObject: blackoutWindow]; [blackoutWindows addObject: blackoutWindow];
[blackoutWindow release]; [blackoutWindow release];
if( [screen isMainScreen ] ) if( [screen isMainScreen ] )
SetSystemUIMode( kUIModeAllHidden, kUIOptionAutoShowMenuBar); SetSystemUIMode( kUIModeAllHidden, kUIOptionAutoShowMenuBar);
} }
...@@ -210,7 +210,7 @@ static NSMutableArray *blackoutWindows = NULL; ...@@ -210,7 +210,7 @@ static NSMutableArray *blackoutWindows = NULL;
VLCWindow *blackoutWindow = [blackoutWindows objectAtIndex: i]; VLCWindow *blackoutWindow = [blackoutWindows objectAtIndex: i];
[blackoutWindow closeAndAnimate: YES]; [blackoutWindow closeAndAnimate: YES];
} }
SetSystemUIMode( kUIModeNormal, 0); SetSystemUIMode( kUIModeNormal, 0);
} }
...@@ -253,7 +253,7 @@ static NSMutableArray *blackoutWindows = NULL; ...@@ -253,7 +253,7 @@ static NSMutableArray *blackoutWindows = NULL;
- (void)closeAndAnimate: (BOOL)animate - (void)closeAndAnimate: (BOOL)animate
{ {
NSInvocation *invoc; NSInvocation *invoc;
if (!animate) if (!animate)
{ {
[super close]; [super close];
...@@ -334,7 +334,7 @@ static NSMutableArray *blackoutWindows = NULL; ...@@ -334,7 +334,7 @@ static NSMutableArray *blackoutWindows = NULL;
NSViewAnimation *anim; NSViewAnimation *anim;
NSViewAnimation *current_anim; NSViewAnimation *current_anim;
NSMutableDictionary *dict; NSMutableDictionary *dict;
if (!animate) if (!animate)
{ {
[super orderFront: sender]; [super orderFront: sender];
...@@ -356,11 +356,11 @@ static NSMutableArray *blackoutWindows = NULL; ...@@ -356,11 +356,11 @@ static NSMutableArray *blackoutWindows = NULL;
dict = [[NSMutableDictionary alloc] initWithCapacity:2]; dict = [[NSMutableDictionary alloc] initWithCapacity:2];
[dict setObject:self forKey:NSViewAnimationTargetKey]; [dict setObject:self forKey:NSViewAnimationTargetKey];
[dict setObject:NSViewAnimationFadeInEffect forKey:NSViewAnimationEffectKey]; [dict setObject:NSViewAnimationFadeInEffect forKey:NSViewAnimationEffectKey];
anim = [[NSViewAnimation alloc] initWithViewAnimations:[NSArray arrayWithObjects:dict, nil]]; anim = [[NSViewAnimation alloc] initWithViewAnimations:[NSArray arrayWithObjects:dict, nil]];
[dict release]; [dict release];
[anim setAnimationBlockingMode:NSAnimationNonblocking]; [anim setAnimationBlockingMode:NSAnimationNonblocking];
[anim setDuration:0.5]; [anim setDuration:0.5];
[anim setFrameRate:30]; [anim setFrameRate:30];
...@@ -634,7 +634,7 @@ void _drawKnobInRect(NSRect knobRect) ...@@ -634,7 +634,7 @@ void _drawKnobInRect(NSRect knobRect)
// Center knob in given rect // Center knob in given rect
knobRect.origin.x += (int)((float)(knobRect.size.width - 7)/2.0); knobRect.origin.x += (int)((float)(knobRect.size.width - 7)/2.0);
knobRect.origin.y += (int)((float)(knobRect.size.height - 7)/2.0); knobRect.origin.y += (int)((float)(knobRect.size.height - 7)/2.0);
// Draw diamond // Draw diamond
NSRectFillUsingOperation(NSMakeRect(knobRect.origin.x + 3, knobRect.origin.y + 6, 1, 1), NSCompositeSourceOver); NSRectFillUsingOperation(NSMakeRect(knobRect.origin.x + 3, knobRect.origin.y + 6, 1, 1), NSCompositeSourceOver);
NSRectFillUsingOperation(NSMakeRect(knobRect.origin.x + 2, knobRect.origin.y + 5, 3, 1), NSCompositeSourceOver); NSRectFillUsingOperation(NSMakeRect(knobRect.origin.x + 2, knobRect.origin.y + 5, 3, 1), NSCompositeSourceOver);
...@@ -661,7 +661,7 @@ void _drawFrameInRect(NSRect frameRect) ...@@ -661,7 +661,7 @@ void _drawFrameInRect(NSRect frameRect)
NSRectClip(NSZeroRect); NSRectClip(NSZeroRect);
[super drawRect:rect]; [super drawRect:rect];
[[NSGraphicsContext currentContext] restoreGraphicsState]; [[NSGraphicsContext currentContext] restoreGraphicsState];
// Full size // Full size
rect = [self bounds]; rect = [self bounds];
int diff = (int)(([[self cell] knobThickness] - 7.0)/2.0) - 1; int diff = (int)(([[self cell] knobThickness] - 7.0)/2.0) - 1;
...@@ -669,13 +669,13 @@ void _drawFrameInRect(NSRect frameRect) ...@@ -669,13 +669,13 @@ void _drawFrameInRect(NSRect frameRect)
rect.origin.y += diff; rect.origin.y += diff;
rect.size.width -= 2*diff-2; rect.size.width -= 2*diff-2;
rect.size.height -= 2*diff; rect.size.height -= 2*diff;
// Draw dark // Draw dark
NSRect knobRect = [[self cell] knobRectFlipped:NO]; NSRect knobRect = [[self cell] knobRectFlipped:NO];
[[[NSColor blackColor] colorWithAlphaComponent:0.6] set]; [[[NSColor blackColor] colorWithAlphaComponent:0.6] set];
_drawFrameInRect(rect); _drawFrameInRect(rect);
_drawKnobInRect(knobRect); _drawKnobInRect(knobRect);
// Draw shadow // Draw shadow
[[[NSColor blackColor] colorWithAlphaComponent:0.1] set]; [[[NSColor blackColor] colorWithAlphaComponent:0.1] set];
rect.origin.x++; rect.origin.x++;
...@@ -695,90 +695,31 @@ void _drawFrameInRect(NSRect frameRect) ...@@ -695,90 +695,31 @@ void _drawFrameInRect(NSRect frameRect)
@implementation ITSlider @implementation ITSlider
- (void)awakeFromNib - (void)drawKnobInRect:(NSRect)knobRect
{
if ([[self cell] class] != [ITSliderCell class]) {
// replace cell
NSSliderCell *oldCell = [self cell];
NSSliderCell *newCell = [[[ITSliderCell alloc] init] autorelease];
[newCell setTag:[oldCell tag]];
[newCell setTarget:[oldCell target]];
[newCell setAction:[oldCell action]];
[newCell setControlSize:[oldCell controlSize]];
[newCell setType:[oldCell type]];
[newCell setState:[oldCell state]];
[newCell setAllowsTickMarkValuesOnly:[oldCell allowsTickMarkValuesOnly]];
[newCell setAltIncrementValue:[oldCell altIncrementValue]];
[newCell setControlTint:[oldCell controlTint]];
[newCell setKnobThickness:[oldCell knobThickness]];
[newCell setMaxValue:[oldCell maxValue]];
[newCell setMinValue:[oldCell minValue]];
[newCell setDoubleValue:[oldCell doubleValue]];
[newCell setNumberOfTickMarks:[oldCell numberOfTickMarks]];
[newCell setEditable:[oldCell isEditable]];
[newCell setEnabled:[oldCell isEnabled]];
[newCell setFormatter:[oldCell formatter]];
[newCell setHighlighted:[oldCell isHighlighted]];
[newCell setTickMarkPosition:[oldCell tickMarkPosition]];
[self setCell:newCell];
}
}
@end
/*************************************************************************** **
* ITSliderCell
*****************************************************************************/
@implementation ITSliderCell
- (id)init
{ {
self = [super init]; NSRect image_rect;
_knobOff = [NSImage imageNamed:@"volumeslider_normal"]; NSImage *img = [NSImage imageNamed:@"volume-slider-knob"];
_knobOn = [NSImage imageNamed:@"volumeslider_graphite"]; image_rect.size = [img size];
b_mouse_down = FALSE; image_rect.origin.x = 0;
return self; image_rect.origin.y = 0;
} knobRect.origin.x += (knobRect.size.width - image_rect.size.width) / 2;
knobRect.size.width = image_rect.size.width;
knobRect.size.height = image_rect.size.height;
[img drawInRect:knobRect fromRect:image_rect operation:NSCompositeSourceOver fraction:1];
- (void)dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver: self];
[_knobOff release];
[_knobOn release];
[super dealloc];
}
- (void)drawKnob:(NSRect)knob_rect
{
NSImage *knob;
if( b_mouse_down )
knob = _knobOn;
else
knob = _knobOff;
[[self controlView] lockFocus];
[knob compositeToPoint:NSMakePoint( knob_rect.origin.x + 1,
knob_rect.origin.y + knob_rect.size.height -2 )
operation:NSCompositeSourceOver];
[[self controlView] unlockFocus];
} }
- (void)stopTracking:(NSPoint)lastPoint at:(NSPoint)stopPoint inView: - (void)drawRect:(NSRect)rect
(NSView *)controlView mouseIsUp:(BOOL)flag
{ {
b_mouse_down = NO; /* Draw default to make sure the slider behaves correctly */
[self drawKnob]; [[NSGraphicsContext currentContext] saveGraphicsState];
[super stopTracking:lastPoint at:stopPoint inView:controlView mouseIsUp:flag]; NSRectClip(NSZeroRect);
} [super drawRect:rect];
[[NSGraphicsContext currentContext] restoreGraphicsState];
- (BOOL)startTrackingAt:(NSPoint)startPoint inView:(NSView *)controlView NSRect knobRect = [[self cell] knobRectFlipped:NO];
{ knobRect.origin.y+=2;
b_mouse_down = YES; // [[[NSColor blackColor] colorWithAlphaComponent:0.6] set];
[self drawKnob]; [self drawKnobInRect: knobRect];
return [super startTrackingAt:startPoint inView:controlView];
} }
@end @end
......
...@@ -77,8 +77,6 @@ ...@@ -77,8 +77,6 @@
IBOutlet id o_btn_playlist; IBOutlet id o_btn_playlist;
IBOutlet id o_playlist_view; IBOutlet id o_playlist_view;
IBOutlet id o_sidebar; IBOutlet id o_sidebar;
IBOutlet id o_status_field;
IBOutlet id o_status_field_embed;
IBOutlet id o_search_field; IBOutlet id o_search_field;
IBOutlet id o_search_field_other; IBOutlet id o_search_field_other;
IBOutlet id o_mi_save_playlist; IBOutlet id o_mi_save_playlist;
...@@ -118,10 +116,6 @@ ...@@ -118,10 +116,6 @@
BOOL b_selected_item_met; BOOL b_selected_item_met;
BOOL b_isSortDescending; BOOL b_isSortDescending;
id o_tc_sortColumn; id o_tc_sortColumn;
/* "add node" button and menu entry */
IBOutlet id o_mi_addNode;
IBOutlet id o_btn_addNode;
} }
- (void)searchfieldChanged:(NSNotification *)o_notification; - (void)searchfieldChanged:(NSNotification *)o_notification;
...@@ -148,8 +142,6 @@ ...@@ -148,8 +142,6 @@
- (IBAction)sortNodeByAuthor:(id)sender; - (IBAction)sortNodeByAuthor:(id)sender;
- (IBAction)recursiveExpandNode:(id)sender; - (IBAction)recursiveExpandNode:(id)sender;
- (IBAction)addNode:(id)sender;
- (void)playSidebarItem:(id)item; - (void)playSidebarItem:(id)item;
- (id)playingItem; - (id)playingItem;
......
...@@ -222,7 +222,7 @@ ...@@ -222,7 +222,7 @@
if( o_value == nil ) if( o_value == nil )
{ {
/* FIXME: Why is there a warning if that happens all the time and seems /* FIXME: Why is there a warning if that happens all the time and seems
* to be normal? Add an assert and fix it. * to be normal? Add an assert and fix it.
* msg_Warn( VLCIntf, "playlist item misses pointer value, adding one" ); */ * msg_Warn( VLCIntf, "playlist item misses pointer value, adding one" ); */
o_value = [[NSValue valueWithPointer: p_return] retain]; o_value = [[NSValue valueWithPointer: p_return] retain];
} }
...@@ -275,7 +275,7 @@ ...@@ -275,7 +275,7 @@
} }
return @"error" ; return @"error" ;
} }
p_item = (playlist_item_t *)[item pointerValue]; p_item = (playlist_item_t *)[item pointerValue];
if( !p_item || !p_item->p_input ) if( !p_item || !p_item->p_input )
{ {
...@@ -288,7 +288,7 @@ ...@@ -288,7 +288,7 @@
} }
return @"error"; return @"error";
} }
attempted_reload = NO; attempted_reload = NO;
if( [[o_tc identifier] isEqualToString:@"name"] ) if( [[o_tc identifier] isEqualToString:@"name"] )
...@@ -418,7 +418,7 @@ ...@@ -418,7 +418,7 @@
char ** ppsz_services = vlc_sd_GetNames( VLCIntf, &ppsz_name, NULL ); char ** ppsz_services = vlc_sd_GetNames( VLCIntf, &ppsz_name, NULL );
if( !ppsz_services ) if( !ppsz_services )
return; return;
for( i = 0; ppsz_services[i]; i++ ) for( i = 0; ppsz_services[i]; i++ )
{ {
bool b_enabled; bool b_enabled;
...@@ -477,12 +477,9 @@ ...@@ -477,12 +477,9 @@
[o_mi_sort_author setTitle: _NS("Sort Node by Author")]; [o_mi_sort_author setTitle: _NS("Sort Node by Author")];
[o_mi_services setTitle: _NS("Services discovery")]; [o_mi_services setTitle: _NS("Services discovery")];
[o_mm_mi_services setTitle: _NS("Services discovery")]; [o_mm_mi_services setTitle: _NS("Services discovery")];
[o_status_field setStringValue: _NS("No items in the playlist")];
[o_status_field_embed setStringValue: _NS("No items in the playlist")];
[o_search_field setToolTip: _NS("Search in Playlist")]; [o_search_field setToolTip: _NS("Search in Playlist")];
[o_search_field_other setToolTip: _NS("Search in Playlist")]; [o_search_field_other setToolTip: _NS("Search in Playlist")];
[o_mi_addNode setTitle: _NS("Add Folder to Playlist")];
[o_save_accessory_text setStringValue: _NS("File Format:")]; [o_save_accessory_text setStringValue: _NS("File Format:")];
[[o_save_accessory_popup itemAtIndex:0] setTitle: _NS("Extended M3U")]; [[o_save_accessory_popup itemAtIndex:0] setTitle: _NS("Extended M3U")];
...@@ -520,33 +517,6 @@ ...@@ -520,33 +517,6 @@
[[[[VLCMain sharedInstance] wizard] playlistWizard] reloadOutlineView]; [[[[VLCMain sharedInstance] wizard] playlistWizard] reloadOutlineView];
[[[[VLCMain sharedInstance] bookmarks] dataTable] reloadData]; [[[[VLCMain sharedInstance] bookmarks] dataTable] reloadData];
playlist_t *p_playlist = pl_Get( VLCIntf );
PL_LOCK;
if( playlist_CurrentSize( p_playlist ) >= 2 )
{
[o_status_field setStringValue: [NSString stringWithFormat:
_NS("%i items"),
playlist_CurrentSize( p_playlist )]];
[o_status_field_embed setStringValue: [NSString stringWithFormat:
_NS("%i items"),
playlist_CurrentSize( p_playlist )]];
}
else
{
if( playlist_IsEmpty( p_playlist ) )
{
[o_status_field setStringValue: _NS("No items in the playlist")];
[o_status_field_embed setStringValue: _NS("No items in the playlist")];
}
else
{
[o_status_field setStringValue: _NS("1 item")];
[o_status_field_embed setStringValue: _NS("1 item")];
}
}
PL_UNLOCK;
[self outlineViewSelectionDidChange: nil]; [self outlineViewSelectionDidChange: nil];
} }
...@@ -854,18 +824,18 @@ ...@@ -854,18 +824,18 @@
{ {
intf_thread_t * p_intf = VLCIntf; intf_thread_t * p_intf = VLCIntf;
playlist_t * p_playlist = pl_Get( p_intf ); playlist_t * p_playlist = pl_Get( p_intf );
playlist_item_t *p_item; playlist_item_t *p_item;
playlist_item_t *p_node = NULL; playlist_item_t *p_node = NULL;
p_item = [item pointerValue]; p_item = [item pointerValue];
if( p_item ) if( p_item )
{ {
if( p_item->i_children == -1 ) if( p_item->i_children == -1 )
{ {
p_node = p_item->p_parent; p_node = p_item->p_parent;
} }
else else
{ {
...@@ -890,7 +860,7 @@ ...@@ -890,7 +860,7 @@
if(! p_item || !p_item->p_input ) if(! p_item || !p_item->p_input )
return; return;
char *psz_uri = decode_URI( input_item_GetURI( p_item->p_input ) ); char *psz_uri = decode_URI( input_item_GetURI( p_item->p_input ) );
if( psz_uri ) if( psz_uri )
o_mrl = [NSMutableString stringWithUTF8String: psz_uri]; o_mrl = [NSMutableString stringWithUTF8String: psz_uri];
...@@ -899,10 +869,10 @@ ...@@ -899,10 +869,10 @@
NSRange prefix_range = [o_mrl rangeOfString: @"file:"]; NSRange prefix_range = [o_mrl rangeOfString: @"file:"];
if( prefix_range.location != NSNotFound ) if( prefix_range.location != NSNotFound )
[o_mrl deleteCharactersInRange: prefix_range]; [o_mrl deleteCharactersInRange: prefix_range];
if( [o_mrl characterAtIndex:0] == '/' ) if( [o_mrl characterAtIndex:0] == '/' )
[[NSWorkspace sharedWorkspace] selectFile: o_mrl inFileViewerRootedAtPath: o_mrl]; [[NSWorkspace sharedWorkspace] selectFile: o_mrl inFileViewerRootedAtPath: o_mrl];
} }
/* When called retrieves the selected outlineview row and plays that node or item */ /* When called retrieves the selected outlineview row and plays that node or item */
- (IBAction)preparseItem:(id)sender - (IBAction)preparseItem:(id)sender
...@@ -911,7 +881,7 @@ ...@@ -911,7 +881,7 @@
NSMutableArray *o_to_preparse; NSMutableArray *o_to_preparse;
intf_thread_t * p_intf = VLCIntf; intf_thread_t * p_intf = VLCIntf;
playlist_t * p_playlist = pl_Get( p_intf ); playlist_t * p_playlist = pl_Get( p_intf );
o_to_preparse = [NSMutableArray arrayWithArray:[[o_outline_view selectedRowEnumerator] allObjects]]; o_to_preparse = [NSMutableArray arrayWithArray:[[o_outline_view selectedRowEnumerator] allObjects]];
i_count = [o_to_preparse count]; i_count = [o_to_preparse count];
...@@ -1018,7 +988,7 @@ ...@@ -1018,7 +988,7 @@
PL_LOCK; PL_LOCK;
playlist_item_t *p_item = [o_item pointerValue]; playlist_item_t *p_item = [o_item pointerValue];
#ifndef NDEBUG #ifndef NDEBUG
msg_Dbg( p_intf, "deleting item %i (of %i) with id \"%i\", pointerValue \"%p\" and %i children", i+1, i_count, msg_Dbg( p_intf, "deleting item %i (of %i) with id \"%i\", pointerValue \"%p\" and %i children", i+1, i_count,
p_item->p_input->i_id, [o_item pointerValue], p_item->i_children +1 ); p_item->p_input->i_id, [o_item pointerValue], p_item->i_children +1 );
#endif #endif
[o_to_delete removeObject: o_number]; [o_to_delete removeObject: o_number];
...@@ -1032,7 +1002,7 @@ ...@@ -1032,7 +1002,7 @@
checkItemExistence: NO locked:YES] == YES ) checkItemExistence: NO locked:YES] == YES )
// if current item is in selected node and is playing then stop playlist // if current item is in selected node and is playing then stop playlist
playlist_Control(p_playlist, PLAYLIST_STOP, pl_Locked ); playlist_Control(p_playlist, PLAYLIST_STOP, pl_Locked );
playlist_NodeDelete( p_playlist, p_item, true, false ); playlist_NodeDelete( p_playlist, p_item, true, false );
} }
else else
...@@ -1191,7 +1161,7 @@ ...@@ -1191,7 +1161,7 @@
/* Add the item */ /* Add the item */
/* FIXME: playlist_AddInput() can fail */ /* FIXME: playlist_AddInput() can fail */
playlist_AddInput( p_playlist, p_input, PLAYLIST_INSERT, playlist_AddInput( p_playlist, p_input, PLAYLIST_INSERT,
i_position == -1 ? PLAYLIST_END : i_position + i_item, true, i_position == -1 ? PLAYLIST_END : i_position + i_item, true,
pl_Locked ); pl_Locked );
...@@ -1506,7 +1476,7 @@ ...@@ -1506,7 +1476,7 @@
- (id)playingItem - (id)playingItem
{ {
playlist_t *p_playlist = pl_Get( VLCIntf ); playlist_t *p_playlist = pl_Get( VLCIntf );
id o_playing_item; id o_playing_item;
PL_LOCK; PL_LOCK;
...@@ -1516,18 +1486,6 @@ ...@@ -1516,18 +1486,6 @@
return o_playing_item; return o_playing_item;
} }
- (IBAction)addNode:(id)sender
{
playlist_t * p_playlist = pl_Get( VLCIntf );
PL_LOCK;
playlist_NodeCreate( p_playlist, _("Empty Folder"),
p_playlist->p_local_category, PLAYLIST_END, 0, NULL );
PL_UNLOCK;
[self playlistUpdated];
}
@end @end
@implementation VLCPlaylist (NSOutlineViewDataSource) @implementation VLCPlaylist (NSOutlineViewDataSource)
...@@ -1535,32 +1493,6 @@ ...@@ -1535,32 +1493,6 @@
- (id)outlineView:(NSOutlineView *)outlineView child:(NSInteger)index ofItem:(id)item - (id)outlineView:(NSOutlineView *)outlineView child:(NSInteger)index ofItem:(id)item
{ {
id o_value = [super outlineView: outlineView child: index ofItem: item]; id o_value = [super outlineView: outlineView child: index ofItem: item];
playlist_t *p_playlist = pl_Get( VLCIntf );
PL_LOCK;
if( playlist_CurrentSize( p_playlist ) >= 2 )
{
[o_status_field setStringValue: [NSString stringWithFormat:
_NS("%i items"),
playlist_CurrentSize( p_playlist )]];
[o_status_field_embed setStringValue: [NSString stringWithFormat:
_NS("%i items"),
playlist_CurrentSize( p_playlist )]];
}
else
{
if( playlist_IsEmpty( p_playlist ) )
{
[o_status_field setStringValue: _NS("No items in the playlist")];
[o_status_field_embed setStringValue: _NS("No items in the playlist")];
}
else
{
[o_status_field setStringValue: _NS("1 item")];
[o_status_field_embed setStringValue: _NS("1 item")];
}
}
PL_UNLOCK;
[o_outline_dict setObject:o_value forKey:[NSString stringWithFormat:@"%p", [o_outline_dict setObject:o_value forKey:[NSString stringWithFormat:@"%p",
[o_value pointerValue]]]; [o_value pointerValue]]];
...@@ -1640,7 +1572,7 @@ ...@@ -1640,7 +1572,7 @@
/* We refuse to drop an item in anything else than a child of the General /* We refuse to drop an item in anything else than a child of the General
Node. We still accept items that would be root nodes of the outlineview Node. We still accept items that would be root nodes of the outlineview
however, to allow drop in an empty playlist. */ however, to allow drop in an empty playlist. */
if( !( ([self isItem: [item pointerValue] inNode: p_playlist->p_local_category checkItemExistence: NO] || if( !( ([self isItem: [item pointerValue] inNode: p_playlist->p_local_category checkItemExistence: NO] ||
( var_CreateGetBool( p_playlist, "media-library" ) && [self isItem: [item pointerValue] inNode: p_playlist->p_ml_category checkItemExistence: NO] ) ) || item == nil ) ) ( var_CreateGetBool( p_playlist, "media-library" ) && [self isItem: [item pointerValue] inNode: p_playlist->p_ml_category checkItemExistence: NO] ) ) || item == nil ) )
{ {
return NSDragOperationNone; return NSDragOperationNone;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment