Commit c38dd543 authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: remove legacy code for pre-Yosemite macOS versions

parent 6fd7cb84
......@@ -26,7 +26,6 @@
#pragma mark -
#pragma OS detection code
#define OSX_YOSEMITE_AND_HIGHER (NSAppKitVersionNumber >= 1334)
#define OSX_EL_CAPITAN_AND_HIGHER (NSAppKitVersionNumber >= 1404)
#define OSX_SIERRA_AND_HIGHER (NSAppKitVersionNumber >= 1485)
#define OSX_SIERRA_DOT_TWO_AND_HIGHER (NSAppKitVersionNumber >= 1504.76) // this is needed to check for MPRemoteCommandCenter
......
......@@ -91,7 +91,6 @@ libmacosx_plugin_la_SOURCES = \
gui/macosx/VLCDefaultValueSlider.h gui/macosx/VLCDefaultValueSlider.m \
gui/macosx/VLCDefaultValueSliderCell.h gui/macosx/VLCDefaultValueSliderCell.m \
gui/macosx/VLCImageButton.h gui/macosx/VLCImageButton.m \
gui/macosx/VLCTintedImageButtonCell.h gui/macosx/VLCTintedImageButtonCell.m \
gui/macosx/VLCTimeField.h gui/macosx/VLCTimeField.m \
gui/macosx/VLCHexNumberFormatter.h gui/macosx/VLCHexNumberFormatter.m \
gui/macosx/VLCSlider.h gui/macosx/VLCSlider.m \
......
......@@ -141,7 +141,7 @@
"\"https://www.videolan.org/contribute/\"><span style=\" text-decoration: "
"underline; color:#0057ae;\">Help and join us!</span></a>"));
NSString *fontfamily = (OSX_YOSEMITE_AND_HIGHER) ? @"Helvetica Neue" : @"Lucida Grande";
NSString *fontfamily = @"Helvetica Neue";
NSString *joinUsWithStyle = [NSString stringWithFormat:@"<div style=\"text-align:left;font-family: -apple-system, %@;\">%@</div>",
fontfamily, joinus];
NSAttributedString *joinus_readytorender = [[NSAttributedString alloc] initWithHTML:[joinUsWithStyle dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:YES] options:[NSDictionary dictionaryWithObject:[NSNumber numberWithInt:NSUTF8StringEncoding] forKey:NSCharacterEncodingDocumentOption] documentAttributes:NULL];
......
......@@ -182,10 +182,8 @@
tickFrame.origin.x = mid;
} else {
tickFrame.origin.x = mid - tickThickness;
if (OSX_YOSEMITE_AND_HIGHER) {
tickFrame.size.height = cellFrame.size.height - 1;
tickFrame.origin.y = cellFrame.origin.y - 1;
}
tickFrame.size.height = cellFrame.size.height - 1;
tickFrame.origin.y = cellFrame.origin.y - 1;
}
tickFrame.size.width = tickThickness;
}
......
......@@ -59,8 +59,8 @@
- (IBAction)helpGoHome:(id)sender
{
NSString *htmlWithStyle = [NSString
stringWithFormat:@"<style>body { font-family: -apple-system, %@; }</style>%@",
((OSX_YOSEMITE_AND_HIGHER) ? @"Helvetica Neue" : @"Lucida Grande"), _NS(I_LONGHELP)];
stringWithFormat:@"<style>body { font-family: -apple-system, Helvetica Neue; }</style>%@",
_NS(I_LONGHELP)];
[[helpWebView mainFrame] loadHTMLString:htmlWithStyle
baseURL:[NSURL URLWithString:@"http://videolan.org"]];
......
/*****************************************************************************
* VLCTintedImageButtonCell.h
*****************************************************************************
* Copyright (C) 2017 VLC authors and VideoLAN
* $Id$
*
* Authors: Marvin Scholz <epirat07 at gmail dot com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#import <Cocoa/Cocoa.h>
@interface VLCTintedImageButtonCell : NSButtonCell
@property (nonatomic) IBInspectable NSColor *imageTintColor;
@end
/*****************************************************************************
* VLCTintedImageButtonCell.m
*****************************************************************************
* Copyright (C) 2017 VLC authors and VideoLAN
* $Id$
*
* Authors: Marvin Scholz <epirat07 at gmail dot com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#import "VLCTintedImageButtonCell.h"
#import "CompatibilityFixes.h"
@interface VLCTintedImageButtonCell () {
NSMutableDictionary *_imageCache;
}
@end
@implementation VLCTintedImageButtonCell
+ (void)load
{
/* On 10.10+ we do not want custom drawing, therefore we swap out the implementation
* of the selectors below with their original implementations.
* Just calling super is not enough here, as the button would still draw in a different
* way, non vibrant with weird highlighting behaviour.
*/
if (OSX_YOSEMITE_AND_HIGHER) {
swapoutOverride([VLCTintedImageButtonCell class], @selector(initWithCoder:));
swapoutOverride([VLCTintedImageButtonCell class], @selector(drawImage:withFrame:inView:));
}
}
- (instancetype)initWithCoder:(NSCoder *)coder
{
self = [super initWithCoder:coder];
if (self) {
_imageCache = [NSMutableDictionary dictionary];
_imageTintColor = [NSColor whiteColor];
}
return self;
}
- (NSImage *)image:(NSImage*)image tintedWithColor:(NSColor *)tint
{
image = [image copy];
[image setTemplate:NO];
if (tint) {
[image lockFocus];
NSRect imageRect = {NSZeroPoint, [image size]};
[tint setFill];
NSRectFillUsingOperation(imageRect, NSCompositeSourceAtop);
[image unlockFocus];
}
return image;
}
- (NSImage*)tintedImage:(NSImage*)image
{
NSNumber *key = @((NSInteger)image);
if (![_imageCache objectForKey:key]) {
NSImage *tintedImg = [self image:image tintedWithColor:_imageTintColor];
[_imageCache setObject:tintedImg forKey:key];
}
return [_imageCache objectForKey:key];
}
- (void)drawImage:(NSImage *)image withFrame:(NSRect)frame inView:(NSView *)controlView
{
image = [self tintedImage:image];
[super drawImage:image withFrame:frame inView:controlView];
}
@end
......@@ -775,14 +775,7 @@
- (void)addProfile:(id)sender
{
/* show panel */
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wpartial-availability"
#ifdef MAC_OS_X_VERSION_10_10
if (OSX_YOSEMITE_AND_HIGHER) {
[[_textfieldPanel window] setAppearance:[NSAppearance appearanceNamed:NSAppearanceNameVibrantDark]];
}
#endif
#pragma clang diagnostic pop
[[_textfieldPanel window] setAppearance:[NSAppearance appearanceNamed:NSAppearanceNameVibrantDark]];
[_textfieldPanel setTitleString:_NS("Duplicate current profile for a new profile")];
[_textfieldPanel setSubTitleString:_NS("Enter a name for the new profile:")];
[_textfieldPanel setCancelButtonString:_NS("Cancel")];
......@@ -840,14 +833,7 @@
- (void)removeProfile:(id)sender
{
/* show panel */
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wpartial-availability"
#ifdef MAC_OS_X_VERSION_10_10
if (OSX_YOSEMITE_AND_HIGHER) {
[[_popupPanel window] setAppearance:[NSAppearance appearanceNamed:NSAppearanceNameVibrantDark]];
}
#endif
#pragma clang diagnostic pop
[[_popupPanel window] setAppearance:[NSAppearance appearanceNamed:NSAppearanceNameVibrantDark]];
[_popupPanel setTitleString:_NS("Remove a preset")];
[_popupPanel setSubTitleString:_NS("Select the preset you would like to remove:")];
[_popupPanel setOkButtonString:_NS("Remove")];
......
......@@ -544,8 +544,6 @@ modules/gui/macosx/VLCTimeField.h
modules/gui/macosx/VLCTimeField.m
modules/gui/macosx/VLCTimeSelectionPanelController.h
modules/gui/macosx/VLCTimeSelectionPanelController.m
modules/gui/macosx/VLCTintedImageButtonCell.h
modules/gui/macosx/VLCTintedImageButtonCell.m
modules/gui/macosx/VLCTrackSynchronizationWindowController.h
modules/gui/macosx/VLCTrackSynchronizationWindowController.m
modules/gui/macosx/VLCUIWidgets.h
......
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