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 \
......
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="10117" systemVersion="16G29" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14269.12" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<development version="7000" identifier="xcode"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="10117"/>
<capability name="Aspect ratio constraints" minToolsVersion="5.1"/>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14269.12"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="VLCFSPanelController">
......@@ -26,11 +26,11 @@
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<window title="Fullscreen Controls" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" restorable="NO" hasShadow="NO" hidesOnDeactivate="YES" oneShot="NO" showsToolbarButton="NO" visibleAtLaunch="NO" frameAutosaveName="" animationBehavior="default" id="a2r-mH-Iqe">
<window title="Fullscreen Controls" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" restorable="NO" hasShadow="NO" hidesOnDeactivate="YES" visibleAtLaunch="NO" frameAutosaveName="" animationBehavior="default" id="a2r-mH-Iqe">
<windowCollectionBehavior key="collectionBehavior" fullScreenAuxiliary="YES" fullScreenDisallowsTiling="YES"/>
<windowPositionMask key="initialPositionMask" bottomStrut="YES"/>
<rect key="contentRect" x="376" y="105" width="480" height="80"/>
<rect key="screenRect" x="0.0" y="0.0" width="1280" height="778"/>
<rect key="screenRect" x="0.0" y="0.0" width="1920" height="1178"/>
<value key="minSize" type="size" width="480" height="60"/>
<value key="maxSize" type="size" width="4068" height="150"/>
<view key="contentView" id="Npt-C5-K77" customClass="VLCFSPanelDraggableView">
......@@ -46,7 +46,7 @@
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="10" id="Ccf-qh-Z4p"/>
<constraint firstAttribute="width" secondItem="iYd-wn-Bnl" secondAttribute="height" multiplier="25:14" id="hNf-AC-5xt"/>
</constraints>
<buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="VLCVolumeOnTemplate" imagePosition="only" alignment="center" alternateImage="VLCVolumeOffTemplate" imageScaling="proportionallyUpOrDown" inset="2" id="KZQ-HO-iWj" customClass="VLCTintedImageButtonCell">
<buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="VLCVolumeOnTemplate" imagePosition="only" alignment="center" alternateImage="VLCVolumeOffTemplate" imageScaling="proportionallyUpOrDown" inset="2" id="KZQ-HO-iWj">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
......@@ -69,7 +69,7 @@
<constraints>
<constraint firstAttribute="width" secondItem="TVM-DT-2yo" secondAttribute="height" multiplier="19:16" id="oKb-iw-6S1"/>
</constraints>
<buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="VLCPreviousTemplate" imagePosition="only" alignment="center" imageScaling="proportionallyUpOrDown" inset="2" id="ykW-vZ-DAm" customClass="VLCTintedImageButtonCell">
<buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="VLCPreviousTemplate" imagePosition="only" alignment="center" imageScaling="proportionallyUpOrDown" inset="2" id="ykW-vZ-DAm">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
......@@ -82,7 +82,7 @@
<constraints>
<constraint firstAttribute="width" secondItem="7QH-jb-QdM" secondAttribute="height" multiplier="19:16" id="isk-o2-kZY"/>
</constraints>
<buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="VLCBackwardTemplate" imagePosition="only" alignment="center" continuous="YES" imageScaling="proportionallyUpOrDown" inset="2" id="kH8-lS-ZyV" customClass="VLCTintedImageButtonCell">
<buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="VLCBackwardTemplate" imagePosition="only" alignment="center" continuous="YES" imageScaling="proportionallyUpOrDown" inset="2" id="kH8-lS-ZyV">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
......@@ -95,7 +95,7 @@
<constraints>
<constraint firstAttribute="width" secondItem="YSL-bH-k6U" secondAttribute="height" multiplier="1:1" constant="6" id="2if-S8-t0u"/>
</constraints>
<buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="VLCPlayTemplate" imagePosition="overlaps" alignment="center" alternateImage="VLCPauseTemplate" imageScaling="proportionallyUpOrDown" inset="2" id="IvT-4x-6Go" customClass="VLCTintedImageButtonCell">
<buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="VLCPlayTemplate" imagePosition="overlaps" alignment="center" alternateImage="VLCPauseTemplate" imageScaling="proportionallyUpOrDown" inset="2" id="IvT-4x-6Go">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
......@@ -111,7 +111,7 @@
<constraints>
<constraint firstAttribute="width" secondItem="jSN-hV-r5D" secondAttribute="height" multiplier="19:16" id="m1w-9i-bkp"/>
</constraints>
<buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="VLCForwardTemplate" imagePosition="only" alignment="center" continuous="YES" imageScaling="proportionallyUpOrDown" inset="2" id="i5R-0v-MD5" customClass="VLCTintedImageButtonCell">
<buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="VLCForwardTemplate" imagePosition="only" alignment="center" continuous="YES" imageScaling="proportionallyUpOrDown" inset="2" id="i5R-0v-MD5">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
......@@ -124,7 +124,7 @@
<constraints>
<constraint firstAttribute="width" secondItem="2ai-dB-Wpq" secondAttribute="height" multiplier="19:16" id="Itj-7f-YDa"/>
</constraints>
<buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="VLCNextTemplate" imagePosition="only" alignment="center" imageScaling="proportionallyUpOrDown" inset="2" id="gqA-yG-zOb" customClass="VLCTintedImageButtonCell">
<buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="VLCNextTemplate" imagePosition="only" alignment="center" imageScaling="proportionallyUpOrDown" inset="2" id="gqA-yG-zOb">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
......@@ -157,7 +157,7 @@
<constraints>
<constraint firstAttribute="width" secondItem="C5K-aX-3aJ" secondAttribute="height" multiplier="1:1" id="VWl-0x-p1I"/>
</constraints>
<buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="VLCFullscreenOnTemplate" imagePosition="only" alignment="center" imageScaling="proportionallyUpOrDown" inset="2" id="0tH-cP-VqB" customClass="VLCTintedImageButtonCell">
<buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="VLCFullscreenOnTemplate" imagePosition="only" alignment="center" imageScaling="proportionallyUpOrDown" inset="2" id="0tH-cP-VqB">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
......
......@@ -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