2
2
* misc.m: code not specific to vlc
3
3
*****************************************************************************
4
4
* Copyright (C) 2003-2011 VLC authors and VideoLAN
5
* $Id: 5bca42c45a291b1437f6ee7bd3e00738e9f4c260 $
5
* $Id: 34fa00efc3bd2f2020447f0a1c354accf43dab14 $
7
7
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
8
8
* Felix Paul Kühne <fkuehne at videolan dot org>
418
425
NSArray *o_values = [[o_paste propertyListForType: NSFilenamesPboardType] sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
419
426
NSUInteger count = [o_values count];
428
input_thread_t * p_input = pl_CurrentInput( VLCIntf );
429
BOOL b_returned = NO;
431
if (count == 1 && p_input)
433
b_returned = input_AddSubtitle( p_input, make_URI([[o_values objectAtIndex:0] UTF8String], NULL), true );
434
vlc_object_release( p_input );
439
vlc_object_release( p_input );
421
441
for( NSUInteger i = 0; i < count; i++)
423
443
NSDictionary *o_dic;
505
525
NSArray *o_values = [[o_paste propertyListForType: NSFilenamesPboardType] sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
506
526
NSUInteger count = [o_values count];
528
input_thread_t * p_input = pl_CurrentInput( VLCIntf );
529
BOOL b_returned = NO;
531
if (count == 1 && p_input)
533
b_returned = input_AddSubtitle( p_input, make_URI([[o_values objectAtIndex:0] UTF8String], NULL), true );
534
vlc_object_release( p_input );
539
vlc_object_release( p_input );
508
541
for( NSUInteger i = 0; i < count; i++)
510
543
NSDictionary *o_dic;
721
754
o_string_color = [NSColor colorWithCalibratedRed:0.64 green:0.64 blue:0.64 alpha:100.0];
756
textAlignment = NSCenterTextAlignment;
723
757
o_string_attributes_dict = [[NSDictionary dictionaryWithObjectsAndKeys: o_string_color, NSForegroundColorAttributeName, [NSFont titleBarFontOfSize:10.0], NSFontAttributeName, nil] retain];
760
- (void)setAlignment:(NSTextAlignment)alignment
762
textAlignment = alignment;
763
[self setStringValue:[self stringValue]];
728
768
[o_string_shadow release];
743
783
NSUInteger i_stringLength = [string length];
745
785
[o_attributed_string addAttribute: NSShadowAttributeName value: o_string_shadow range: NSMakeRange(0, i_stringLength)];
746
[o_attributed_string setAlignment: NSRightTextAlignment range: NSMakeRange(0, i_stringLength)];
786
[o_attributed_string setAlignment: textAlignment range: NSMakeRange(0, i_stringLength)];
747
787
[self setAttributedStringValue: o_attributed_string];
748
788
[o_attributed_string release];
882
@implementation VLCThreePartDropView
884
- (BOOL)mouseDownCanMoveWindow
891
[self unregisterDraggedTypes];
897
[self registerForDraggedTypes:[NSArray arrayWithObjects:NSTIFFPboardType,
898
NSFilenamesPboardType, nil]];
901
- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
903
if ((NSDragOperationGeneric & [sender draggingSourceOperationMask])
904
== NSDragOperationGeneric)
906
return NSDragOperationGeneric;
910
return NSDragOperationNone;
914
- (BOOL)prepareForDragOperation:(id <NSDraggingInfo>)sender
919
- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
921
NSPasteboard *o_paste = [sender draggingPasteboard];
922
NSArray *o_types = [NSArray arrayWithObjects: NSFilenamesPboardType, nil];
923
NSString *o_desired_type = [o_paste availableTypeFromArray:o_types];
924
NSData *o_carried_data = [o_paste dataForType:o_desired_type];
925
BOOL b_autoplay = config_GetInt( VLCIntf, "macosx-autoplay" );
929
if ([o_desired_type isEqualToString:NSFilenamesPboardType])
931
NSArray *o_array = [NSArray array];
932
NSArray *o_values = [[o_paste propertyListForType: NSFilenamesPboardType] sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
933
NSUInteger count = [o_values count];
935
input_thread_t * p_input = pl_CurrentInput( VLCIntf );
936
BOOL b_returned = NO;
938
if (count == 1 && p_input)
940
b_returned = input_AddSubtitle( p_input, make_URI([[o_values objectAtIndex:0] UTF8String], NULL), true );
941
vlc_object_release( p_input );
946
vlc_object_release( p_input );
948
for( NSUInteger i = 0; i < count; i++)
951
char *psz_uri = make_URI([[o_values objectAtIndex:i] UTF8String], NULL);
955
o_dic = [NSDictionary dictionaryWithObject:[NSString stringWithCString:psz_uri encoding:NSUTF8StringEncoding] forKey:@"ITEM_URL"];
958
o_array = [o_array arrayByAddingObject: o_dic];
961
[[[VLCMain sharedInstance] playlist] appendArray: o_array atPos: -1 enqueue:NO];
963
[[[VLCMain sharedInstance] playlist] appendArray: o_array atPos: -1 enqueue:YES];
967
[self setNeedsDisplay:YES];
971
- (void)concludeDragOperation:(id <NSDraggingInfo>)sender
973
[self setNeedsDisplay:YES];