]> git.sesse.net Git - vlc/blobdiff - modules/gui/macosx/misc.m
macosx: fix wrong size of playlist when using podcast and minimal view
[vlc] / modules / gui / macosx / misc.m
index 06b2a5fe266585c21e907f8ab7d3a878e5255177..7e9794f49d97587864a35f3dae5e91158f014b81 100644 (file)
@@ -173,7 +173,7 @@ static bool b_old_spaces_style = YES;
     /* init our fake object attribute */
     blackoutWindows = [[NSMutableArray alloc] initWithCapacity:1];
 
-    if (OSX_MAVERICKS) {
+    if (OSX_MAVERICKS || OSX_YOSEMITE) {
         NSUserDefaults *userDefaults = [[NSUserDefaults alloc] init];
         [userDefaults addSuiteNamed:@"com.apple.spaces"];
         /* this is system settings -> mission control -> monitors using different spaces */
@@ -320,6 +320,18 @@ static bool b_old_spaces_style = YES;
 @implementation VLCDragDropView
 
 @synthesize dropHandler=_dropHandler;
+@synthesize drawBorder;
+
+- (id)initWithFrame:(NSRect)frame
+{
+    self = [super initWithFrame:frame];
+    if (self) {
+        // default value
+        [self setDrawBorder:YES];
+    }
+
+    return self;
+}
 
 - (void)enablePlaylistItems
 {
@@ -391,8 +403,7 @@ static bool b_old_spaces_style = YES;
 
 - (void)drawRect:(NSRect)dirtyRect
 {
-
-    if (b_activeDragAndDrop) {
+    if ([self drawBorder] && b_activeDragAndDrop) {
         NSRect frameRect = [self bounds];
 
         [[NSColor selectedControlColor] set];
@@ -477,7 +488,6 @@ void _drawFrameInRect(NSRect frameRect)
 
 - (void)scrollWheel:(NSEvent *)o_event
 {
-    intf_thread_t * p_intf = VLCIntf;
     BOOL b_forward = NO;
     CGFloat f_deltaY = [o_event deltaY];
     CGFloat f_deltaX = [o_event deltaX];
@@ -523,10 +533,10 @@ void _drawFrameInRect(NSRect frameRect)
 - (void)awakeFromNib
 {
     if (config_GetInt( VLCIntf, "macosx-interfacestyle" )) {
-        o_knob_img = [NSImage imageNamed:@"progression-knob_dark"];
+        o_knob_img = imageFromRes(@"progression-knob_dark");
         b_dark = YES;
     } else {
-        o_knob_img = [NSImage imageNamed:@"progression-knob"];
+        o_knob_img = imageFromRes(@"progression-knob");
         b_dark = NO;
     }
     img_rect.size = [o_knob_img size];
@@ -582,7 +592,6 @@ void _drawFrameInRect(NSRect frameRect)
 
 - (void)scrollWheel:(NSEvent *)o_event
 {
-    intf_thread_t * p_intf = VLCIntf;
     BOOL b_up = NO;
     CGFloat f_deltaY = [o_event deltaY];
     CGFloat f_deltaX = [o_event deltaX];
@@ -595,7 +604,6 @@ void _drawFrameInRect(NSRect frameRect)
     // positive for left / down, negative otherwise
     CGFloat f_delta = f_deltaX + f_deltaY;
     CGFloat f_abs;
-    int i_vlckey;
 
     if (f_delta > 0.0f)
         f_abs = f_delta;
@@ -678,9 +686,9 @@ void _drawFrameInRect(NSRect frameRect)
 {
     BOOL b_dark = config_GetInt( VLCIntf, "macosx-interfacestyle" );
     if (b_dark)
-        img = [NSImage imageNamed:@"volume-slider-knob_dark"];
+        img = imageFromRes(@"volume-slider-knob_dark");
     else
-        img = [NSImage imageNamed:@"volume-slider-knob"];
+        img = imageFromRes(@"volume-slider-knob");
 
     image_rect.size = [img size];
     image_rect.origin.x = 0;
@@ -866,52 +874,6 @@ void _drawFrameInRect(NSRect frameRect)
 
 @end
 
-@implementation VLCThreePartDropView
-
-- (BOOL)mouseDownCanMoveWindow
-{
-    return YES;
-}
-
-- (void)dealloc
-{
-    [self unregisterDraggedTypes];
-    [super dealloc];
-}
-
-- (void)awakeFromNib
-{
-    [self registerForDraggedTypes:[NSArray arrayWithObject:NSFilenamesPboardType]];
-}
-
-- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
-{
-    if ((NSDragOperationGeneric & [sender draggingSourceOperationMask]) == NSDragOperationGeneric)
-        return NSDragOperationGeneric;
-
-    return NSDragOperationNone;
-}
-
-- (BOOL)prepareForDragOperation:(id <NSDraggingInfo>)sender
-{
-    return YES;
-}
-
-- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
-{
-    BOOL b_returned;
-    b_returned = [[VLCCoreInteraction sharedInstance] performDragOperation: sender];
-
-    [self setNeedsDisplay:YES];
-    return YES;
-}
-
-- (void)concludeDragOperation:(id <NSDraggingInfo>)sender
-{
-    [self setNeedsDisplay:YES];
-}
-
-@end
 
 @implementation PositionFormatter
 
@@ -948,7 +910,7 @@ void _drawFrameInRect(NSRect frameRect)
     return YES;
 }
 
-- (bool)isPartialStringValid:(NSString*)partialString newEditingString:(NSString**)newString errorDescription:(NSString**)error
+- (BOOL)isPartialStringValid:(NSString*)partialString newEditingString:(NSString**)newString errorDescription:(NSString**)error
 {
     if ([partialString rangeOfCharacterFromSet:o_forbidden_characters options:NSLiteralSearch].location != NSNotFound) {
         return NO;
@@ -957,7 +919,6 @@ void _drawFrameInRect(NSRect frameRect)
     }
 }
 
-
 @end
 
 @implementation NSView (EnableSubviews)
@@ -989,19 +950,15 @@ void _drawFrameInRect(NSRect frameRect)
  * VLCByteCountFormatter addition
  *****************************************************************************/
 
-#ifndef MAC_OS_X_VERSION_10_8
-@interface NSByteCountFormatter (IntroducedInMountainLion)
-+ (NSString *)stringFromByteCount:(long long)byteCount countStyle:(NSByteCountFormatterCountStyle)countStyle;
-@end
-#endif
-
-
 @implementation VLCByteCountFormatter
 
 + (NSString *)stringFromByteCount:(long long)byteCount countStyle:(NSByteCountFormatterCountStyle)countStyle
 {
-    if (OSX_MAVERICKS || OSX_MOUNTAIN_LION)
-        return [NSByteCountFormatter stringFromByteCount:byteCount countStyle:NSByteCountFormatterCountStyleFile];
+    // Use native implementation on >= mountain lion
+    Class byteFormatterClass = NSClassFromString(@"NSByteCountFormatter");
+    if (byteFormatterClass && [byteFormatterClass respondsToSelector:@selector(stringFromByteCount:countStyle:)]) {
+        return [byteFormatterClass stringFromByteCount:byteCount countStyle:NSByteCountFormatterCountStyleFile];
+    }
 
     float devider = 0.;
     float returnValue = 0.;