/* 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 */
@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
{
- (void)drawRect:(NSRect)dirtyRect
{
-
- if (b_activeDragAndDrop) {
+ if ([self drawBorder] && b_activeDragAndDrop) {
NSRect frameRect = [self bounds];
[[NSColor selectedControlColor] set];
- (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];
- (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];
- (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];
// 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;
{
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;
@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
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;
}
}
-
@end
@implementation NSView (EnableSubviews)
* 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.;