diff --git a/.travis.yml b/.travis.yml index 927fa9fa8..1df945ce3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: objective-c -osx_image: xcode7.1 +osx_image: xcode11 ios_env: SDK:iphonesimulator diff --git a/CorePlot-latest.podspec b/CorePlot-latest.podspec index 6f7f9dfd7..3b958f7e4 100644 --- a/CorePlot-latest.podspec +++ b/CorePlot-latest.podspec @@ -2,7 +2,7 @@ Pod::Spec.new do |s| s.name = 'CorePlot' s.version = '99.99.99' s.license = 'BSD' - s.summary = 'Cocoa plotting framework for Mac OS X, iOS, and tvOS.' + s.summary = 'Cocoa plotting framework for macOS, iOS, and tvOS.' s.homepage = 'https://github.com/core-plot' s.social_media_url = 'https://twitter.com/CorePlot' s.documentation_url = 'http://core-plot.github.io' @@ -14,11 +14,11 @@ Pod::Spec.new do |s| s.source = { :git => 'https://github.com/core-plot/core-plot.git' } - s.description = 'Core Plot is a plotting framework for OS X, iOS, and tvOS. It provides 2D visualization ' \ + s.description = 'Core Plot is a plotting framework for macOS, iOS, and tvOS. It provides 2D visualization ' \ 'of data, and is tightly integrated with Apple technologies like Core Animation, ' \ 'Core Data, and Cocoa Bindings.' - s.ios.deployment_target = '6.0' + s.ios.deployment_target = '8.0' s.osx.deployment_target = '10.8' s.tvos.deployment_target = '9.0' @@ -26,20 +26,19 @@ Pod::Spec.new do |s| s.osx.header_dir = 'osx' s.tvos.header_dir = 'tvos' - s.source_files = 'framework/Source/*.{h,m}', 'framework/CocoaPods/*.h', 'framework/TestResources/CorePlotProbes.d' + s.source_files = 'framework/Source/*.{h,m}', 'framework/CocoaPods/*.h' s.exclude_files = '**/*{TestCase,Tests}.{h,m}', '**/mainpage.h' s.ios.source_files = 'framework/CorePlot-CocoaTouch.h', 'framework/iPhoneOnly/*.{h,m}' s.tvos.source_files = 'framework/iPhoneOnly/*.{h,m}' s.osx.source_files = 'framework/MacOnly/*.{h,m}' - s.private_header_files = '**/_*.h', '**/CorePlotProbes.h' + s.private_header_files = '**/_*.h' s.requires_arc = true - s.xcconfig = { 'ALWAYS_SEARCH_USER_PATHS' => 'YES' } s.ios.xcconfig = { 'HEADER_SEARCH_PATHS' => '"${PODS_ROOT}/Headers/Private/CorePlot/ios"' } s.osx.xcconfig = { 'HEADER_SEARCH_PATHS' => '"${PODS_ROOT}/Headers/Private/CorePlot/osx"' } s.tvos.xcconfig = { 'HEADER_SEARCH_PATHS' => '"${PODS_ROOT}/Headers/Private/CorePlot/tvos"' } - s.frameworks = 'QuartzCore', 'Accelerate' + s.frameworks = 'QuartzCore' s.ios.frameworks = 'UIKit', 'Foundation' s.tvos.frameworks = 'UIKit', 'Foundation' s.osx.frameworks = 'Cocoa' diff --git a/CorePlot.podspec b/CorePlot.podspec index 084705347..d6906a089 100644 --- a/CorePlot.podspec +++ b/CorePlot.podspec @@ -1,8 +1,8 @@ Pod::Spec.new do |s| s.name = 'CorePlot' - s.version = '2.1' + s.version = '2.3' s.license = 'BSD' - s.summary = 'Cocoa plotting framework for Mac OS X, iOS, and tvOS.' + s.summary = 'Cocoa plotting framework for macOS, iOS, and tvOS.' s.homepage = 'https://github.com/core-plot' s.social_media_url = 'https://twitter.com/CorePlot' s.documentation_url = 'http://core-plot.github.io' @@ -12,13 +12,13 @@ Pod::Spec.new do |s| 'Eric Skroch' => 'eskroch@mac.com', 'Barry Wark' => 'barrywark@gmail.com' } - s.source = { :git => 'https://github.com/core-plot/core-plot.git', :tag => 'release_2.1'} + s.source = { :git => 'https://github.com/core-plot/core-plot.git', :tag => 'release_2.3'} - s.description = 'Core Plot is a plotting framework for OS X, iOS, and tvOS. It provides 2D visualization ' \ + s.description = 'Core Plot is a plotting framework for macOS, iOS, and tvOS. It provides 2D visualization ' \ 'of data, and is tightly integrated with Apple technologies like Core Animation, ' \ 'Core Data, and Cocoa Bindings.' - s.ios.deployment_target = '6.0' + s.ios.deployment_target = '8.0' s.osx.deployment_target = '10.8' s.tvos.deployment_target = '9.0' @@ -26,20 +26,19 @@ Pod::Spec.new do |s| s.osx.header_dir = 'osx' s.tvos.header_dir = 'tvos' - s.source_files = 'framework/Source/*.{h,m}', 'framework/CocoaPods/*.h', 'framework/TestResources/CorePlotProbes.d' + s.source_files = 'framework/Source/*.{h,m}', 'framework/CocoaPods/*.h' s.exclude_files = '**/*{TestCase,Tests}.{h,m}', '**/mainpage.h' s.ios.source_files = 'framework/CorePlot-CocoaTouch.h', 'framework/iPhoneOnly/*.{h,m}' s.tvos.source_files = 'framework/iPhoneOnly/*.{h,m}' s.osx.source_files = 'framework/MacOnly/*.{h,m}' - s.private_header_files = '**/_*.h', '**/CorePlotProbes.h' + s.private_header_files = '**/_*.h' s.requires_arc = true - s.xcconfig = { 'ALWAYS_SEARCH_USER_PATHS' => 'YES' } s.ios.xcconfig = { 'HEADER_SEARCH_PATHS' => '"${PODS_ROOT}/Headers/Private/CorePlot/ios"' } s.osx.xcconfig = { 'HEADER_SEARCH_PATHS' => '"${PODS_ROOT}/Headers/Private/CorePlot/osx"' } s.tvos.xcconfig = { 'HEADER_SEARCH_PATHS' => '"${PODS_ROOT}/Headers/Private/CorePlot/tvos"' } - s.frameworks = 'QuartzCore', 'Accelerate' + s.frameworks = 'QuartzCore' s.ios.frameworks = 'UIKit', 'Foundation' s.tvos.frameworks = 'UIKit', 'Foundation' s.osx.frameworks = 'Cocoa' diff --git a/License.txt b/License.txt index e9bf9f52d..fbd7853fe 100644 --- a/License.txt +++ b/License.txt @@ -1,9 +1,13 @@ -Copyright (c) 2015, Drew McCormack, Brad Larson, Eric Skroch, Barry Wark, Dirkjan Krijnders, Rick Maddy, Vijay Kalusani, Caleb Cannon, Jeff Buck, Thomas Elstner, Jeroen Leenarts, Craig Hockenberry, Hartwig Wiesmann, Koen van der Drift, Nino Ag, Mike Lischke, Trevor Harmon, Travis Fischer, Graham Mueller, Rafał Wójcik, Mike Rossetti, Michael Merickel, Lane Roathe, Ingmar Stein, Sean Holbert, Victor Martin Garcia, Jérôme Morissard, Demitri Muna, and Tim Monzures. +Copyright (c) 2020, Drew McCormack, Brad Larson, Eric Skroch, Barry Wark, Dirkjan Krijnders, Rick Maddy, Vijay Kalusani, Caleb Cannon, Jeff Buck, Thomas Elstner, Jeroen Leenarts, Craig Hockenberry, Hartwig Wiesmann, Koen van der Drift, Nino Ag, Mike Lischke, Trevor Harmon, Travis Fischer, Graham Mueller, Rafał Wójcik, Mike Rossetti, Michael Merickel, Lane Roathe, Ingmar Stein, Sean Holbert, Victor Martin Garcia, Jérôme Morissard, Demitri Muna, Tim Monzures, Kirill Yakimovich, Tom Izaks, Pascal Freiburghaus, Fred Potter, and Aurélien Hugelé. + All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + Neither the name of the Core Plot Project nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/QCPlugin/Info.plist b/QCPlugin/Base.lproj/Info.plist similarity index 100% rename from QCPlugin/Info.plist rename to QCPlugin/Base.lproj/Info.plist diff --git a/QCPlugin/English.lproj/Settings.xib b/QCPlugin/Base.lproj/Settings.xib similarity index 100% rename from QCPlugin/English.lproj/Settings.xib rename to QCPlugin/Base.lproj/Settings.xib diff --git a/QCPlugin/CPTBarPlotPlugin.h b/QCPlugin/CPTBarPlotPlugin.h index e8ecf371d..e5fbb2bce 100644 --- a/QCPlugin/CPTBarPlotPlugin.h +++ b/QCPlugin/CPTBarPlotPlugin.h @@ -1,4 +1,4 @@ -#import "CorePlotQCPlugIn.h" +#import "CorePlotQCPlugin.h" #import @interface CPTBarPlotPlugIn : CorePlotQCPlugIn diff --git a/QCPlugin/CPTBarPlotPlugin.m b/QCPlugin/CPTBarPlotPlugin.m index 98757ff2e..77d6fc9fc 100644 --- a/QCPlugin/CPTBarPlotPlugin.m +++ b/QCPlugin/CPTBarPlotPlugin.m @@ -1,4 +1,4 @@ -#import "CPTBarPlotPlugIn.h" +#import "CPTBarPlotPlugin.h" @implementation CPTBarPlotPlugIn @@ -30,69 +30,69 @@ @implementation CPTBarPlotPlugIn +(nonnull NSDictionary *)attributes { return @{ - QCPlugInAttributeNameKey: @"Core Plot Bar Chart", - QCPlugInAttributeDescriptionKey: @"Bar chart" + QCPlugInAttributeNameKey: @"Core Plot Bar Chart", + QCPlugInAttributeDescriptionKey: @"Bar chart" }; } -+(nonnull CPTDictionary *)attributesForPropertyPortWithKey:(nonnull NSString *)key ++(nullable CPTDictionary *)attributesForPropertyPortWithKey:(nullable NSString *)key { // A few additional ports for the bar plot chart type ... if ( [key isEqualToString:@"inputBarWidth"] ) { return @{ - QCPortAttributeNameKey: @"Bar Width", - QCPortAttributeDefaultValueKey: @1.0, - QCPortAttributeMinimumValueKey: @0.0 + QCPortAttributeNameKey: @"Bar Width", + QCPortAttributeDefaultValueKey: @1.0, + QCPortAttributeMinimumValueKey: @0.0 }; } if ( [key isEqualToString:@"inputBarOffset"] ) { return @{ - QCPortAttributeNameKey: @"Bar Offset", - QCPortAttributeDefaultValueKey: @0.5 + QCPortAttributeNameKey: @"Bar Offset", + QCPortAttributeDefaultValueKey: @0.5 }; } if ( [key isEqualToString:@"inputBaseValue"] ) { return @{ - QCPortAttributeNameKey: @"Base Value", - QCPortAttributeDefaultValueKey: @0.0 + QCPortAttributeNameKey: @"Base Value", + QCPortAttributeDefaultValueKey: @0.0 }; } if ( [key isEqualToString:@"inputHorizontalBars"] ) { return @{ - QCPortAttributeNameKey: @"Horizontal Bars", - QCPortAttributeDefaultValueKey: @NO + QCPortAttributeNameKey: @"Horizontal Bars", + QCPortAttributeDefaultValueKey: @NO }; } if ( [key isEqualToString:@"inputXMin"] ) { return @{ - QCPortAttributeNameKey: @"X Range Min", - QCPortAttributeDefaultValueKey: @0.0 + QCPortAttributeNameKey: @"X Range Min", + QCPortAttributeDefaultValueKey: @0.0 }; } if ( [key isEqualToString:@"inputXMax"] ) { return @{ - QCPortAttributeNameKey: @"X Range Max", - QCPortAttributeDefaultValueKey: @5.0 + QCPortAttributeNameKey: @"X Range Max", + QCPortAttributeDefaultValueKey: @5.0 }; } if ( [key isEqualToString:@"inputYMin"] ) { return @{ - QCPortAttributeNameKey: @"Y Range Min", - QCPortAttributeDefaultValueKey: @0.0 + QCPortAttributeNameKey: @"Y Range Min", + QCPortAttributeDefaultValueKey: @0.0 }; } if ( [key isEqualToString:@"inputYMax"] ) { return @{ - QCPortAttributeNameKey: @"Y Range Max", - QCPortAttributeDefaultValueKey: @5.0 + QCPortAttributeNameKey: @"Y Range Max", + QCPortAttributeDefaultValueKey: @5.0 }; } @@ -114,7 +114,7 @@ -(void)addPlotWithIndex:(NSUInteger)index forKey:[NSString stringWithFormat:@"plotDataLineColor%lu", (unsigned long)index] withAttributes:@{ QCPortAttributeNameKey: [NSString stringWithFormat:@"Plot Line Color %lu", (unsigned long)(index + 1)], QCPortAttributeTypeKey: QCPortTypeColor, - QCPortAttributeDefaultValueKey: CFBridgingRelease(lineColor) } + QCPortAttributeDefaultValueKey: (id)CFBridgingRelease(lineColor) } ]; CGColorRef fillColor = [self newDefaultColorForPlot:index alpha:0.25]; @@ -122,7 +122,7 @@ -(void)addPlotWithIndex:(NSUInteger)index forKey:[NSString stringWithFormat:@"plotFillColor%lu", (unsigned long)index] withAttributes:@{ QCPortAttributeNameKey: [NSString stringWithFormat:@"Plot Fill Color %lu", (unsigned long)(index + 1)], QCPortAttributeTypeKey: QCPortTypeColor, - QCPortAttributeDefaultValueKey: CFBridgingRelease(fillColor) } + QCPortAttributeDefaultValueKey: (id)CFBridgingRelease(fillColor) } ]; [self addInputPortWithType:QCPortTypeNumber @@ -177,7 +177,10 @@ -(BOOL)configurePlots plot.barWidth = @(barWidth); plot.barOffset = @(self.inputBarOffset); plot.barsAreHorizontal = self.inputHorizontalBars; - plot.fill = [CPTFill fillWithColor:[CPTColor colorWithCGColor:[self areaFillColor:index]]]; + CGColorRef fillColor = [self areaFillColor:index]; + if ( fillColor ) { + plot.fill = [CPTFill fillWithColor:[CPTColor colorWithCGColor:fillColor]]; + } [plot reloadData]; } @@ -196,7 +199,7 @@ -(NSUInteger)numberOfRecordsForPlot:(nonnull CPTPlot *)plot return [[self valueForInputKey:key] count]; } --(nullable NSArray *)numbersForPlot:(nonnull CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndexRange:(NSRange)indexRange +-(nullable NSArray *)numbersForPlot:(nonnull CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndexRange:(NSRange __unused)indexRange { NSUInteger plotIndex = [[self.graph allPlots] indexOfObject:plot]; NSString *key = [NSString stringWithFormat:@"plotNumbers%lu", (unsigned long)plotIndex]; diff --git a/QCPlugin/CPTPieChartPlugin.h b/QCPlugin/CPTPieChartPlugin.h index 4700d9951..844715ba9 100644 --- a/QCPlugin/CPTPieChartPlugin.h +++ b/QCPlugin/CPTPieChartPlugin.h @@ -1,4 +1,4 @@ -#import "CorePlotQCPlugIn.h" +#import "CorePlotQCPlugin.h" #import @interface CPTPieChartPlugIn : CorePlotQCPlugIn diff --git a/QCPlugin/CPTPieChartPlugin.m b/QCPlugin/CPTPieChartPlugin.m index d2a6628d5..99aeb2ede 100644 --- a/QCPlugin/CPTPieChartPlugin.m +++ b/QCPlugin/CPTPieChartPlugin.m @@ -28,8 +28,8 @@ @implementation CPTPieChartPlugIn +(nonnull NSDictionary *)attributes { return @{ - QCPlugInAttributeNameKey: @"Core Plot Pie Chart", - QCPlugInAttributeDescriptionKey: @"Pie chart" + QCPlugInAttributeNameKey: @"Core Plot Pie Chart", + QCPlugInAttributeDescriptionKey: @"Pie chart" }; } @@ -67,56 +67,56 @@ +(nonnull CPTStringArray *)sortedPropertyPortKeys return [[super sortedPropertyPortKeys] arrayByAddingObjectsFromArray:pieChartPropertyPortKeys]; } -+(nonnull CPTDictionary *)attributesForPropertyPortWithKey:(nonnull NSString *)key ++(nullable CPTDictionary *)attributesForPropertyPortWithKey:(nullable NSString *)key { // A few additional ports for the pie chart type ... if ( [key isEqualToString:@"inputPieRadius"] ) { return @{ - QCPortAttributeNameKey: @"Pie Radius", - QCPortAttributeMinimumValueKey: @0.0, - QCPortAttributeDefaultValueKey: @0.75 + QCPortAttributeNameKey: @"Pie Radius", + QCPortAttributeMinimumValueKey: @0.0, + QCPortAttributeDefaultValueKey: @0.75 }; } else if ( [key isEqualToString:@"inputSliceLabelOffset"] ) { return @{ - QCPortAttributeNameKey: @"Label Offset", - QCPortAttributeDefaultValueKey: @20.0 + QCPortAttributeNameKey: @"Label Offset", + QCPortAttributeDefaultValueKey: @20.0 }; } else if ( [key isEqualToString:@"inputStartAngle"] ) { return @{ - QCPortAttributeNameKey: @"Start Angle", - QCPortAttributeDefaultValueKey: @0.0 + QCPortAttributeNameKey: @"Start Angle", + QCPortAttributeDefaultValueKey: @0.0 }; } else if ( [key isEqualToString:@"inputSliceDirection"] ) { return @{ - QCPortAttributeNameKey: @"Slice Direction", - QCPortAttributeMaximumValueKey: @1, - QCPortAttributeMenuItemsKey: @[@"Clockwise", @"Counter-Clockwise"], - QCPortAttributeDefaultValueKey: @0 + QCPortAttributeNameKey: @"Slice Direction", + QCPortAttributeMaximumValueKey: @1, + QCPortAttributeMenuItemsKey: @[@"Clockwise", @"Counter-Clockwise"], + QCPortAttributeDefaultValueKey: @0 }; } else if ( [key isEqualToString:@"inputBorderWidth"] ) { return @{ - QCPortAttributeNameKey: @"Border Width", - QCPortAttributeMinimumValueKey: @0.0, - QCPortAttributeDefaultValueKey: @1.0 + QCPortAttributeNameKey: @"Border Width", + QCPortAttributeMinimumValueKey: @0.0, + QCPortAttributeDefaultValueKey: @1.0 }; } else if ( [key isEqualToString:@"inputBorderColor"] ) { CGColorRef grayColor = CGColorCreateGenericGray(0.0, 1.0); CPTDictionary *result = @{ - QCPortAttributeNameKey: @"Border Color", - QCPortAttributeDefaultValueKey: CFBridgingRelease(grayColor) + QCPortAttributeNameKey: @"Border Color", + QCPortAttributeDefaultValueKey: (id)CFBridgingRelease(grayColor) }; return result; } else if ( [key isEqualToString:@"inputLabelColor"] ) { CGColorRef grayColor = CGColorCreateGenericGray(1.0, 1.0); CPTDictionary *result = @{ - QCPortAttributeNameKey: @"Label Color", - QCPortAttributeDefaultValueKey: CFBridgingRelease(grayColor) + QCPortAttributeNameKey: @"Label Color", + QCPortAttributeDefaultValueKey: (id)CFBridgingRelease(grayColor) }; return result; } @@ -147,7 +147,7 @@ -(void)addPlotWithIndex:(NSUInteger)index forKey:[NSString stringWithFormat:@"plotFillColor%lu", (unsigned long)index] withAttributes:@{ QCPortAttributeNameKey: [NSString stringWithFormat:@"Primary Fill Color %lu", (unsigned long)(index + 1)], QCPortAttributeTypeKey: QCPortTypeColor, - QCPortAttributeDefaultValueKey: CFBridgingRelease(grayColor) } + QCPortAttributeDefaultValueKey: (id)CFBridgingRelease(grayColor) } ]; // Add the new plot to the graph @@ -224,7 +224,7 @@ -(NSUInteger)numberOfRecordsForPlot:(nonnull CPTPlot *)plot return [[self valueForInputKey:key] count]; } --(nullable id)numberForPlot:(nonnull CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index +-(nullable id)numberForPlot:(nonnull CPTPlot *)plot field:(NSUInteger __unused)fieldEnum recordIndex:(NSUInteger)index { NSUInteger plotIndex = [[self.graph allPlots] indexOfObject:plot]; NSString *key = [NSString stringWithFormat:@"plotNumbers%lu", (unsigned long)plotIndex]; @@ -239,7 +239,7 @@ -(nullable id)numberForPlot:(nonnull CPTPlot *)plot field:(NSUInteger)fieldEnum } } --(nullable CPTFill *)sliceFillForPieChart:(nonnull CPTPieChart *)pieChart recordIndex:(NSUInteger)index +-(nullable CPTFill *)sliceFillForPieChart:(nonnull CPTPieChart *__unused)pieChart recordIndex:(NSUInteger)index { CGColorRef plotFillColor = [CPTPieChart defaultPieSliceColorForIndex:index].cgColor; CGColorRef inputFillColor = (CGColorRef)[self areaFillColor:0]; diff --git a/QCPlugin/CPTScatterPlotPlugin.h b/QCPlugin/CPTScatterPlotPlugin.h index 0ea178c1d..aaad42138 100644 --- a/QCPlugin/CPTScatterPlotPlugin.h +++ b/QCPlugin/CPTScatterPlotPlugin.h @@ -1,4 +1,4 @@ -#import "CorePlotQCPlugIn.h" +#import "CorePlotQCPlugin.h" #import @interface CPTScatterPlotPlugIn : CorePlotQCPlugIn diff --git a/QCPlugin/CPTScatterPlotPlugin.m b/QCPlugin/CPTScatterPlotPlugin.m index dbe784b14..023a890db 100644 --- a/QCPlugin/CPTScatterPlotPlugin.m +++ b/QCPlugin/CPTScatterPlotPlugin.m @@ -1,4 +1,4 @@ -#import "CPTScatterPlotPlugIn.h" +#import "CPTScatterPlotPlugin.h" @implementation CPTScatterPlotPlugIn @@ -25,8 +25,8 @@ @implementation CPTScatterPlotPlugIn +(nonnull NSDictionary *)attributes { return @{ - QCPlugInAttributeNameKey: @"Core Plot Scatter Plot", - QCPlugInAttributeDescriptionKey: @"Scatter plot" + QCPlugInAttributeNameKey: @"Core Plot Scatter Plot", + QCPlugInAttributeDescriptionKey: @"Scatter plot" }; } @@ -51,7 +51,7 @@ -(void)addPlotWithIndex:(NSUInteger)index forKey:[NSString stringWithFormat:@"plotDataLineColor%lu", (unsigned long)index] withAttributes:@{ QCPortAttributeNameKey: [NSString stringWithFormat:@"Plot Line Color %lu", (unsigned long)(index + 1)], QCPortAttributeTypeKey: QCPortTypeColor, - QCPortAttributeDefaultValueKey: CFBridgingRelease(lineColor) } + QCPortAttributeDefaultValueKey: (id)CFBridgingRelease(lineColor) } ]; CGColorRef fillColor = [self newDefaultColorForPlot:index alpha:0.25]; @@ -59,7 +59,7 @@ -(void)addPlotWithIndex:(NSUInteger)index forKey:[NSString stringWithFormat:@"plotFillColor%lu", (unsigned long)index] withAttributes:@{ QCPortAttributeNameKey: [NSString stringWithFormat:@"Plot Fill Color %lu", (unsigned long)(index + 1)], QCPortAttributeTypeKey: QCPortTypeColor, - QCPortAttributeDefaultValueKey: CFBridgingRelease(fillColor) } + QCPortAttributeDefaultValueKey: (id)CFBridgingRelease(fillColor) } ]; [self addInputPortWithType:QCPortTypeNumber @@ -85,7 +85,7 @@ -(void)addPlotWithIndex:(NSUInteger)index forKey:[NSString stringWithFormat:@"plotDataSymbolColor%lu", (unsigned long)index] withAttributes:@{ QCPortAttributeNameKey: [NSString stringWithFormat:@"Data Symbol Color %lu", (unsigned long)(index + 1)], QCPortAttributeTypeKey: QCPortTypeColor, - QCPortAttributeDefaultValueKey: CFBridgingRelease(symbolColor) } + QCPortAttributeDefaultValueKey: (id)CFBridgingRelease(symbolColor) } ]; // Add the new plot to the graph @@ -193,8 +193,11 @@ -(BOOL)configurePlots plot.plotSymbol.lineStyle = lineStyle; plot.plotSymbol.fill = [CPTFill fillWithColor:[CPTColor colorWithCGColor:[self dataSymbolColor:index]]]; plot.plotSymbol.size = CGSizeMake(10.0, 10.0); - plot.areaFill = [CPTFill fillWithColor:[CPTColor colorWithCGColor:[self areaFillColor:index]]]; - plot.areaBaseValue = @( MAX( self.inputYMin, MIN(self.inputYMax, 0.0) ) ); + CGColorRef fillColor = [self areaFillColor:index]; + if ( fillColor ) { + plot.areaFill = [CPTFill fillWithColor:[CPTColor colorWithCGColor:fillColor]]; + } + plot.areaBaseValue = @(MAX(self.inputYMin, MIN(self.inputYMax, 0.0))); [plot reloadData]; } diff --git a/QCPlugin/CorePlotQCPlugin.h b/QCPlugin/CorePlotQCPlugin.h index 1a24245b4..99354c2d5 100644 --- a/QCPlugin/CorePlotQCPlugin.h +++ b/QCPlugin/CorePlotQCPlugin.h @@ -5,7 +5,7 @@ @property (readwrite, strong, nullable) CPTGraph *graph; -@property (readwrite, assign, nonnull) id outputImage; +@property (readwrite, strong, nonnull) id outputImage; @property (readwrite, assign) NSUInteger numberOfPlots; @@ -48,7 +48,7 @@ -(nonnull CGColorRef)dataLineColor:(NSUInteger)index; -(CGFloat)dataLineWidth:(NSUInteger)index; --(nonnull CGColorRef)areaFillColor:(NSUInteger)index; --(nonnull CGImageRef)newAreaFillImage:(NSUInteger)index; +-(nullable CGColorRef)areaFillColor:(NSUInteger)index; +-(nullable CGImageRef)newAreaFillImage:(NSUInteger)index; @end diff --git a/QCPlugin/CorePlotQCPlugin.m b/QCPlugin/CorePlotQCPlugin.m index b814402bf..3aa3ef332 100644 --- a/QCPlugin/CorePlotQCPlugin.m +++ b/QCPlugin/CorePlotQCPlugin.m @@ -1,4 +1,4 @@ -#import "CorePlotQCPlugIn.h" +#import "CorePlotQCPlugin.h" #import #define kQCPlugIn_Name @"CorePlotQCPlugIn" @@ -10,7 +10,7 @@ @interface CorePlotQCPlugIn() @property (nonatomic, readwrite, strong, nullable) NSMutableData *imageData; @property (nonatomic, readwrite, assign, nullable) CGContextRef bitmapContext; -@property (nonatomic, readwrite, strong, nonnull) id imageProvider; +@property (nonatomic, readwrite, strong, nullable) id imageProvider; void drawErrorText(CGContextRef __nonnull context, CGRect rect); @@ -90,8 +90,8 @@ @implementation CorePlotQCPlugIn */ return @{ - QCPlugInAttributeNameKey: kQCPlugIn_Name, - QCPlugInAttributeDescriptionKey: kQCPlugIn_Description + QCPlugInAttributeNameKey: kQCPlugIn_Name, + QCPlugInAttributeDescriptionKey: kQCPlugIn_Description }; } @@ -115,7 +115,7 @@ +(QCPlugInTimeMode)timeMode -(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { /* * Allocate any permanent resource required by the plug-in. */ @@ -186,7 +186,7 @@ +(nonnull CPTStringArray *)sortedPropertyPortKeys @"inputAxisMinorTickWidth"]; } -+(nonnull CPTDictionary *)attributesForPropertyPortWithKey:(nonnull NSString *)key ++(nullable CPTDictionary *)attributesForPropertyPortWithKey:(nullable NSString *)key { /* * Specify the optional attributes for property based ports (QCPortAttributeNameKey, QCPortAttributeDefaultValueKey...). @@ -194,157 +194,157 @@ +(nonnull CPTDictionary *)attributesForPropertyPortWithKey:(nonnull NSString *)k if ( [key isEqualToString:@"inputXMin"] ) { return @{ - QCPortAttributeNameKey: @"X Range Min", - QCPortAttributeDefaultValueKey: @(-1.0) + QCPortAttributeNameKey: @"X Range Min", + QCPortAttributeDefaultValueKey: @(-1.0) }; } if ( [key isEqualToString:@"inputXMax"] ) { return @{ - QCPortAttributeNameKey: @"X Range Max", - QCPortAttributeDefaultValueKey: @1.0 + QCPortAttributeNameKey: @"X Range Max", + QCPortAttributeDefaultValueKey: @1.0 }; } if ( [key isEqualToString:@"inputYMin"] ) { return @{ - QCPortAttributeNameKey: @"Y Range Min", - QCPortAttributeDefaultValueKey: @(-1.0) + QCPortAttributeNameKey: @"Y Range Min", + QCPortAttributeDefaultValueKey: @(-1.0) }; } if ( [key isEqualToString:@"inputYMax"] ) { return @{ - QCPortAttributeNameKey: @"Y Range Max", - QCPortAttributeDefaultValueKey: @1.0 + QCPortAttributeNameKey: @"Y Range Max", + QCPortAttributeDefaultValueKey: @1.0 }; } if ( [key isEqualToString:@"inputXMajorIntervals"] ) { return @{ - QCPortAttributeNameKey: @"X Major Intervals", - QCPortAttributeDefaultValueKey: @4.0, - QCPortAttributeMinimumValueKey: @0.0 + QCPortAttributeNameKey: @"X Major Intervals", + QCPortAttributeDefaultValueKey: @4.0, + QCPortAttributeMinimumValueKey: @0.0 }; } if ( [key isEqualToString:@"inputYMajorIntervals"] ) { return @{ - QCPortAttributeNameKey: @"Y Major Intervals", - QCPortAttributeDefaultValueKey: @4.0, - QCPortAttributeMinimumValueKey: @0.0 + QCPortAttributeNameKey: @"Y Major Intervals", + QCPortAttributeDefaultValueKey: @4.0, + QCPortAttributeMinimumValueKey: @0.0 }; } if ( [key isEqualToString:@"inputXMinorIntervals"] ) { return @{ - QCPortAttributeNameKey: @"X Minor Intervals", - QCPortAttributeDefaultValueKey: @1, - QCPortAttributeMinimumValueKey: @0 + QCPortAttributeNameKey: @"X Minor Intervals", + QCPortAttributeDefaultValueKey: @1, + QCPortAttributeMinimumValueKey: @0 }; } if ( [key isEqualToString:@"inputYMinorIntervals"] ) { return @{ - QCPortAttributeNameKey: @"Y Minor Intervals", - QCPortAttributeDefaultValueKey: @1, - QCPortAttributeMinimumValueKey: @0 + QCPortAttributeNameKey: @"Y Minor Intervals", + QCPortAttributeDefaultValueKey: @1, + QCPortAttributeMinimumValueKey: @0 }; } if ( [key isEqualToString:@"inputAxisColor"] ) { CGColorRef axisColor = CGColorCreateGenericRGB(1.0, 1.0, 1.0, 1.0); CPTDictionary *result = @{ - QCPortAttributeNameKey: @"Axis Color", - QCPortAttributeDefaultValueKey: CFBridgingRelease(axisColor) + QCPortAttributeNameKey: @"Axis Color", + QCPortAttributeDefaultValueKey: (id)CFBridgingRelease(axisColor) }; return result; } if ( [key isEqualToString:@"inputAxisLineWidth"] ) { return @{ - QCPortAttributeNameKey: @"Axis Line Width", - QCPortAttributeMinimumValueKey: @0.0, - QCPortAttributeDefaultValueKey: @1.0 + QCPortAttributeNameKey: @"Axis Line Width", + QCPortAttributeMinimumValueKey: @0.0, + QCPortAttributeDefaultValueKey: @1.0 }; } if ( [key isEqualToString:@"inputAxisMajorTickWidth"] ) { return @{ - QCPortAttributeNameKey: @"Major Tick Width", - QCPortAttributeMinimumValueKey: @0.0, - QCPortAttributeDefaultValueKey: @2.0 + QCPortAttributeNameKey: @"Major Tick Width", + QCPortAttributeMinimumValueKey: @0.0, + QCPortAttributeDefaultValueKey: @2.0 }; } if ( [key isEqualToString:@"inputAxisMinorTickWidth"] ) { return @{ - QCPortAttributeNameKey: @"Minor Tick Width", - QCPortAttributeMinimumValueKey: @0.0, - QCPortAttributeDefaultValueKey: @1.0 + QCPortAttributeNameKey: @"Minor Tick Width", + QCPortAttributeMinimumValueKey: @0.0, + QCPortAttributeDefaultValueKey: @1.0 }; } if ( [key isEqualToString:@"inputAxisMajorTickLength"] ) { return @{ - QCPortAttributeNameKey: @"Major Tick Length", - QCPortAttributeMinimumValueKey: @0.0, - QCPortAttributeDefaultValueKey: @10.0 + QCPortAttributeNameKey: @"Major Tick Length", + QCPortAttributeMinimumValueKey: @0.0, + QCPortAttributeDefaultValueKey: @10.0 }; } if ( [key isEqualToString:@"inputAxisMinorTickLength"] ) { return @{ - QCPortAttributeNameKey: @"Minor Tick Length", - QCPortAttributeMinimumValueKey: @0.0, - QCPortAttributeDefaultValueKey: @3.0 + QCPortAttributeNameKey: @"Minor Tick Length", + QCPortAttributeMinimumValueKey: @0.0, + QCPortAttributeDefaultValueKey: @3.0 }; } if ( [key isEqualToString:@"inputMajorGridLineWidth"] ) { return @{ - QCPortAttributeNameKey: @"Major Grid Line Width", - QCPortAttributeMinimumValueKey: @0.0, - QCPortAttributeDefaultValueKey: @1.0 + QCPortAttributeNameKey: @"Major Grid Line Width", + QCPortAttributeMinimumValueKey: @0.0, + QCPortAttributeDefaultValueKey: @1.0 }; } if ( [key isEqualToString:@"inputMinorGridLineWidth"] ) { return @{ - QCPortAttributeNameKey: @"Minor Grid Line Width", - QCPortAttributeMinimumValueKey: @0.0, - QCPortAttributeDefaultValueKey: @0.0 + QCPortAttributeNameKey: @"Minor Grid Line Width", + QCPortAttributeMinimumValueKey: @0.0, + QCPortAttributeDefaultValueKey: @0.0 }; } if ( [key isEqualToString:@"inputPlotAreaColor"] ) { CGColorRef plotAreaColor = CGColorCreateGenericRGB(0.0, 0.0, 0.0, 0.4); CPTDictionary *result = @{ - QCPortAttributeNameKey: @"Plot Area Color", - QCPortAttributeDefaultValueKey: CFBridgingRelease(plotAreaColor) + QCPortAttributeNameKey: @"Plot Area Color", + QCPortAttributeDefaultValueKey: (id)CFBridgingRelease(plotAreaColor) }; return result; } if ( [key isEqualToString:@"inputPixelsWide"] ) { return @{ - QCPortAttributeNameKey: @"Pixels Wide", - QCPortAttributeMinimumValueKey: @1, - QCPortAttributeDefaultValueKey: @512 + QCPortAttributeNameKey: @"Pixels Wide", + QCPortAttributeMinimumValueKey: @1, + QCPortAttributeDefaultValueKey: @512 }; } if ( [key isEqualToString:@"inputPixelsHigh"] ) { return @{ - QCPortAttributeNameKey: @"Pixels High", - QCPortAttributeMinimumValueKey: @1, - QCPortAttributeDefaultValueKey: @512 + QCPortAttributeNameKey: @"Pixels High", + QCPortAttributeMinimumValueKey: @1, + QCPortAttributeDefaultValueKey: @512 }; } if ( [key isEqualToString:@"outputImage"] ) { return @{ - QCPortAttributeNameKey: @"Image" + QCPortAttributeNameKey: @"Image" }; } @@ -451,11 +451,11 @@ -(BOOL)configureAxis set.xAxis.labelTextStyle = textStyle; double xrange = self.inputXMax - self.inputXMin; - set.xAxis.majorIntervalLength = @( xrange / (self.inputXMajorIntervals) ); + set.xAxis.majorIntervalLength = @(xrange / (self.inputXMajorIntervals)); set.xAxis.minorTicksPerInterval = self.inputXMinorIntervals; double yrange = self.inputYMax - self.inputYMin; - set.yAxis.majorIntervalLength = @( yrange / (self.inputYMajorIntervals) ); + set.yAxis.majorIntervalLength = @(yrange / (self.inputYMajorIntervals)); set.yAxis.minorTicksPerInterval = self.inputYMinorIntervals; set.xAxis.minorTickLength = self.inputAxisMinorTickLength; @@ -513,18 +513,19 @@ -(CGFloat)dataLineWidth:(NSUInteger)index return inputValue.doubleValue; } --(nonnull CGColorRef)areaFillColor:(NSUInteger)index +-(nullable CGColorRef)areaFillColor:(NSUInteger)index { NSString *key = [NSString stringWithFormat:@"plotFillColor%lu", (unsigned long)index]; return (__bridge CGColorRef)([self valueForInputKey:key]); } --(nonnull CGImageRef)newAreaFillImage:(NSUInteger)index +-(nullable CGImageRef)newAreaFillImage:(NSUInteger)index { NSString *key = [NSString stringWithFormat:@"plotFillImage%lu", (unsigned long)index]; id img = [self valueForInputKey:key]; + if ( !img ) { return nil; } @@ -546,6 +547,9 @@ -(nonnull CGImageRef)newAreaFillImage:(NSUInteger)index NSUInteger bytesPerRow = [img bufferBytesPerRow]; CGColorSpaceRef colorSpace = [img bufferColorSpace]; +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wincompatible-pointer-types-discards-qualifiers" + CGContextRef imgContext = CGBitmapContextCreate(baseAddress, pixelsWide, pixelsHigh, @@ -554,6 +558,8 @@ -(nonnull CGImageRef)newAreaFillImage:(NSUInteger)index colorSpace, (CGBitmapInfo)kCGImageAlphaNoneSkipLast); +#pragma clang diagnostic pop + CGImageRef imageRef = CGBitmapContextCreateImage(imgContext); [img unlockBufferRepresentation]; @@ -563,7 +569,7 @@ -(nonnull CGImageRef)newAreaFillImage:(NSUInteger)index return imageRef; } -static void _BufferReleaseCallback(const void *__nonnull address, void *__nonnull context) +static void _BufferReleaseCallback(const void *__nonnull __unused address, void *__nonnull __unused context) { // Don't do anything. We release the buffer manually when it's recreated or during dealloc } @@ -576,7 +582,7 @@ -(void)createImageResourcesWithContext:(nonnull id)context size_t rowBytes = (size_t)boundsSize.width * 4; if ( rowBytes % 16 ) { - rowBytes = ( (rowBytes / 16) + 1 ) * 16; + rowBytes = ((rowBytes / 16) + 1) * 16; } if ( !self.imageData ) { @@ -609,7 +615,7 @@ -(void)createImageResourcesWithContext:(nonnull id)context CGContextRelease(newContext); if ( rowBytes % 16 ) { - rowBytes = ( (rowBytes / 16) + 1 ) * 16; + rowBytes = ((rowBytes / 16) + 1) * 16; } // Note: I don't have a PPC to test on so this may or may not cause some color issues @@ -639,12 +645,12 @@ -(void)createImageResourcesWithContext:(nonnull id)context #pragma mark - #pragma mark Data source methods --(NSUInteger)numberOfRecordsForPlot:(nonnull CPTPlot *)plot +-(NSUInteger)numberOfRecordsForPlot:(nonnull CPTPlot *__unused)plot { return 0; } --(nullable id)numberForPlot:(nonnull CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index +-(nullable id)numberForPlot:(nonnull CPTPlot *__unused)plot field:(NSUInteger __unused)fieldEnum recordIndex:(NSUInteger __unused)index { return @0; } @@ -720,14 +726,14 @@ -(void)setBitmapContext:(nullable CGContextRef)newContext #pragma mark - #pragma mark Subclass methods --(void)addPlotWithIndex:(NSUInteger)index +-(void)addPlotWithIndex:(NSUInteger __unused)index { /* * Subclasses should override this method to create their own ports, plots, and add the plots to the graph */ } --(void)removePlots:(NSUInteger)count +-(void)removePlots:(NSUInteger __unused)count { /* * Subclasses should override this method to remove plots and their ports @@ -750,7 +756,7 @@ -(BOOL)configureGraph */ // Configure the graph area - CGRect frame = CPTRectMake( 0.0, 0.0, MAX(1, self.inputPixelsWide), MAX(1, self.inputPixelsHigh) ); + CGRect frame = CPTRectMake(0.0, 0.0, MAX(1, self.inputPixelsWide), MAX(1, self.inputPixelsHigh)); self.graph.bounds = frame; @@ -760,7 +766,7 @@ -(BOOL)configureGraph self.graph.paddingBottom = 0.0; // Perform some sanity checks. If there is a configuration error set the error flag so that a message is displayed - if ( (self.inputXMax <= self.inputXMin) || (self.inputYMax <= self.inputYMin) ) { + if ((self.inputXMax <= self.inputXMin) || (self.inputYMax <= self.inputYMin)) { return NO; } @@ -795,7 +801,7 @@ -(BOOL)configureGraph @implementation CorePlotQCPlugIn(Execution) --(BOOL)execute:(nonnull id)context atTime:(NSTimeInterval)time withArguments:(nullable CPTDictionary *)arguments +-(BOOL)execute:(nonnull id)context atTime:(NSTimeInterval __unused)time withArguments:(nullable CPTDictionary *__unused)arguments { // Configure the plot for drawing BOOL configurationCheck = [self configureGraph]; @@ -811,9 +817,9 @@ -(BOOL)execute:(nonnull id)context atTime:(NSTimeInterval)time // Draw the plot ... CGSize boundsSize = self.graph.bounds.size; CGContextRef bmContext = self.bitmapContext; - CGContextClearRect( bmContext, CPTRectMake(0.0, 0.0, boundsSize.width, boundsSize.height) ); + CGContextClearRect(bmContext, CPTRectMake(0.0, 0.0, boundsSize.width, boundsSize.height)); CGContextSetRGBFillColor(bmContext, 0.0, 0.0, 0.0, 0.0); - CGContextFillRect( bmContext, CPTRectMake(0, 0, boundsSize.width, boundsSize.height) ); + CGContextFillRect(bmContext, CPTRectMake(0, 0, boundsSize.width, boundsSize.height)); CGContextSetAllowsAntialiasing(bmContext, true); if ( configurationCheck ) { @@ -821,16 +827,21 @@ -(BOOL)execute:(nonnull id)context atTime:(NSTimeInterval)time [self.graph recursivelyRenderInContext:bmContext]; } else { - drawErrorText( bmContext, CPTRectMake(0, 0, self.inputPixelsWide, self.inputPixelsHigh) ); + drawErrorText(bmContext, CPTRectMake(0, 0, self.inputPixelsWide, self.inputPixelsHigh)); } // CGContextSetAllowsAntialiasing(bitmapContext, false); CGContextFlush(bmContext); // ... and put it on the output port - self.outputImage = self.imageProvider; - - return YES; + id provider = self.imageProvider; + if ( provider ) { + self.outputImage = provider; + return YES; + } + else { + return NO; + } } @end diff --git a/QCPlugin/CorePlotQCPlugin.xcodeproj/project.pbxproj b/QCPlugin/CorePlotQCPlugin.xcodeproj/project.pbxproj index 4f7d5cf2e..e07788d06 100644 --- a/QCPlugin/CorePlotQCPlugin.xcodeproj/project.pbxproj +++ b/QCPlugin/CorePlotQCPlugin.xcodeproj/project.pbxproj @@ -62,6 +62,20 @@ remoteGlobalIDString = 8DC2EF4F0486A6940098B216; remoteInfo = CorePlot; }; + C31D02421D10F531008C1EF2 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = A89BAB3B1027EFBD004B2FE1 /* CorePlot.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = C37EA6921BC83F2A0091C8F7; + remoteInfo = "CorePlot tvOS"; + }; + C31D02441D10F531008C1EF2 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = A89BAB3B1027EFBD004B2FE1 /* CorePlot.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = C37EA6B71BC83F2D0091C8F7; + remoteInfo = "UnitTests tvOS"; + }; C3B925EA1ADF1CBE00C67086 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = A89BAB3B1027EFBD004B2FE1 /* CorePlot.xcodeproj */; @@ -111,9 +125,7 @@ 16BA95400A7EB2EB001E4983 /* CorePlotQCPlugin.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CorePlotQCPlugin.h; sourceTree = ""; }; 16BA95410A7EB2EB001E4983 /* CorePlotQCPlugin.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = CorePlotQCPlugin.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; 16BA96300A7EB9AC001E4983 /* Quartz.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Quartz.framework; path = /System/Library/Frameworks/Quartz.framework; sourceTree = ""; }; - 7238D5510DB6988600E9A42D /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/Settings.xib; sourceTree = ""; }; 8D5B49B6048680CD000E48DA /* CorePlotQCPlugin.plugin */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CorePlotQCPlugin.plugin; sourceTree = BUILT_PRODUCTS_DIR; }; - 8D5B49B7048680CD000E48DA /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; A819AA0311FD3F23006D1C2D /* CPTPieChartPlugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTPieChartPlugin.h; sourceTree = ""; }; A819AA0411FD3F23006D1C2D /* CPTPieChartPlugin.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CPTPieChartPlugin.m; sourceTree = ""; }; A89BAB3B1027EFBD004B2FE1 /* CorePlot.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = CorePlot.xcodeproj; path = ../framework/CorePlot.xcodeproj; sourceTree = SOURCE_ROOT; }; @@ -121,7 +133,9 @@ A8FC1815102CBADE00CF2266 /* CPTScatterPlotPlugin.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CPTScatterPlotPlugin.m; sourceTree = ""; }; A8FC1817102CBAEA00CF2266 /* CPTBarPlotPlugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTBarPlotPlugin.h; sourceTree = ""; }; A8FC1818102CBAEA00CF2266 /* CPTBarPlotPlugin.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CPTBarPlotPlugin.m; sourceTree = ""; }; + C37A410E20E0326C00C4FF48 /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Base; path = Base.lproj/Info.plist; sourceTree = ""; }; C3C8CFF619E9504C007E0BCB /* CorePlotWarnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = CorePlotWarnings.xcconfig; path = ../framework/xcconfig/CorePlotWarnings.xcconfig; sourceTree = ""; }; + C3DA083820E00C7700F73704 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/Settings.xib; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -167,7 +181,7 @@ isa = PBXGroup; children = ( 7238D5500DB6988600E9A42D /* Settings.xib */, - 8D5B49B7048680CD000E48DA /* Info.plist */, + C37A410F20E0326C00C4FF48 /* Info.plist */, ); name = Resources; sourceTree = ""; @@ -213,6 +227,8 @@ C3B925ED1ADF1CBE00C67086 /* UnitTests iOS.xctest */, C3B925EF1ADF1CBE00C67086 /* libCorePlot-CocoaTouch.a */, C3B925F11ADF1CBE00C67086 /* CorePlot-CocoaTouchTests.xctest */, + C31D02431D10F531008C1EF2 /* CorePlot.framework */, + C31D02451D10F531008C1EF2 /* UnitTests tvOS.xctest */, ); name = Products; sourceTree = ""; @@ -246,17 +262,18 @@ 089C1669FE841209C02AAC07 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0700; + LastUpgradeCheck = 0930; }; buildConfigurationList = 1DEB913E08733D840010E9CD /* Build configuration list for PBXProject "CorePlotQCPlugin" */; compatibilityVersion = "Xcode 6.3"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 1; knownRegions = ( - English, - Japanese, - French, - German, + Base, + en, + ja, + fr, + de, ); mainGroup = 089C166AFE841209C02AAC07 /* Quartz Composer Plug In */; projectDirPath = ""; @@ -289,6 +306,20 @@ remoteRef = BC21A97E1035BEAF00FED2A4 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; + C31D02431D10F531008C1EF2 /* CorePlot.framework */ = { + isa = PBXReferenceProxy; + fileType = wrapper.framework; + path = CorePlot.framework; + remoteRef = C31D02421D10F531008C1EF2 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + C31D02451D10F531008C1EF2 /* UnitTests tvOS.xctest */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = "UnitTests tvOS.xctest"; + remoteRef = C31D02441D10F531008C1EF2 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; C3B925EB1ADF1CBE00C67086 /* CorePlot.framework */ = { isa = PBXReferenceProxy; fileType = wrapper.framework; @@ -377,11 +408,19 @@ 7238D5500DB6988600E9A42D /* Settings.xib */ = { isa = PBXVariantGroup; children = ( - 7238D5510DB6988600E9A42D /* English */, + C3DA083820E00C7700F73704 /* Base */, ); name = Settings.xib; sourceTree = ""; }; + C37A410F20E0326C00C4FF48 /* Info.plist */ = { + isa = PBXVariantGroup; + children = ( + C37A410E20E0326C00C4FF48 /* Base */, + ); + name = Info.plist; + sourceTree = ""; + }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ @@ -395,10 +434,9 @@ COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = CorePlotQCPlugin_Prefix.pch; - INFOPLIST_FILE = Info.plist; + INFOPLIST_FILE = "$(SRCROOT)/Base.lproj/Info.plist"; INSTALL_PATH = "$(HOME)/Library/Graphics/Quartz Composer Plug-Ins"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @loader_path/../Frameworks"; OTHER_LDFLAGS = ""; @@ -421,7 +459,7 @@ GCC_MODEL_TUNING = G5; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = CorePlotQCPlugin_Prefix.pch; - INFOPLIST_FILE = Info.plist; + INFOPLIST_FILE = "$(SRCROOT)/Base.lproj/Info.plist"; INSTALL_PATH = "$(HOME)/Library/Graphics/Quartz Composer Plug-Ins"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @loader_path/../Frameworks"; OTHER_LDFLAGS = ""; @@ -435,10 +473,15 @@ }; 1DEB913F08733D840010E9CD /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = C3C8CFF619E9504C007E0BCB /* CorePlotWarnings.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = c99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_WARN_ABOUT_RETURN_TYPE = YES; MACOSX_DEPLOYMENT_TARGET = 10.8; ONLY_ACTIVE_ARCH = YES; SYMROOT = "$(PROJECT_DIR)/../build"; @@ -447,9 +490,14 @@ }; 1DEB914008733D840010E9CD /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = C3C8CFF619E9504C007E0BCB /* CorePlotWarnings.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; GCC_C_LANGUAGE_STANDARD = c99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = s; + GCC_WARN_ABOUT_RETURN_TYPE = YES; MACOSX_DEPLOYMENT_TARGET = 10.8; OTHER_LDFLAGS = ""; SYMROOT = "$(PROJECT_DIR)/../build"; @@ -459,6 +507,7 @@ 233E2D8A0A83C7AC005A62DF /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; COMBINE_HIDPI_IMAGES = YES; PRODUCT_NAME = "Build & Install"; }; @@ -467,6 +516,7 @@ 233E2D8B0A83C7AC005A62DF /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; COMBINE_HIDPI_IMAGES = YES; PRODUCT_NAME = "Build & Install"; }; diff --git a/QCPlugin/CorePlotQCPlugin.xcodeproj/xcshareddata/xcschemes/Build & Copy.xcscheme b/QCPlugin/CorePlotQCPlugin.xcodeproj/xcshareddata/xcschemes/Build & Copy.xcscheme index 4b733b333..7afa5ea4a 100644 --- a/QCPlugin/CorePlotQCPlugin.xcodeproj/xcshareddata/xcschemes/Build & Copy.xcscheme +++ b/QCPlugin/CorePlotQCPlugin.xcodeproj/xcshareddata/xcschemes/Build & Copy.xcscheme @@ -1,6 +1,6 @@ + buildForAnalyzing = "YES"> - - - - - - - - + # Core Plot -*Cocoa plotting framework for Mac OS X and iOS.* +*Cocoa plotting framework for macOS, iOS, and tvOS.* -[![Build Status](https://secure.travis-ci.org/core-plot/core-plot.svg)](http://travis-ci.org/core-plot/core-plot) [![Version Status](https://img.shields.io/cocoapods/v/CorePlot.svg)](https://cocoapods.org/pods/CorePlot) [![license MIT](https://img.shields.io/cocoapods/l/CorePlot.svg)](http://opensource.org/licenses/BSD-3-Clause) [![Platform](https://img.shields.io/cocoapods/p/CorePlot.svg)](http://core-plot.github.io) +[![Cocoapods platforms](https://img.shields.io/cocoapods/p/CorePlot?color=bright-green)](https://core-plot.github.io) [![core-plot CI](https://github.com/core-plot/core-plot/actions/workflows/ci.yml/badge.svg)](https://github.com/core-plot/core-plot/actions/workflows/ci.yml) +[![Cocoapods](https://img.shields.io/cocoapods/v/CorePlot?color=bright-green)](https://cocoapods.org/pods/CorePlot) [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-brightgreen?style=flat)](https://github.com/Carthage/Carthage) [![Swift Package Manager compatible](https://img.shields.io/badge/SPM-compatible-brightgreen)](https://github.com/apple/swift-package-manager) +[![GitHub license](https://img.shields.io/github/license/core-plot/core-plot?color=bright-green)](https://opensource.org/licenses/BSD-3-Clause) # Introduction -Core Plot is a 2D plotting framework for Mac OS X, iOS, and tvOS. It is highly customizable and capable of drawing many types of plots. See the [Example Graphs](https://github.com/core-plot/core-plot/wiki/Example-Graphs) wiki page and the [example applications](https://github.com/core-plot/core-plot/tree/master/examples) for examples of some of its capabilities. +Core Plot is a 2D plotting framework for macOS, iOS, and tvOS. It is highly customizable and capable of drawing many types of plots. See the [Example Graphs](https://github.com/core-plot/core-plot/wiki/Example-Graphs) wiki page and the [example applications](https://github.com/core-plot/core-plot/tree/master/examples) for examples of some of its capabilities. # Getting Started @@ -17,9 +21,9 @@ See the [High Level Design Overview](https://github.com/core-plot/core-plot/wiki Documentation of the Core Plot API and high-level architecture can be found in the following places: * [Change log](https://github.com/core-plot/core-plot/blob/master/documentation/changelog.markdown) - * [API documentation](http://core-plot.github.io/MacOS/index.html) for Mac - * [API documentation](http://core-plot.github.io/iOS/index.html) for iOS and tvOS - * API documentation built with [Doxygen](http://www.doxygen.org/) and installed locally in Xcode (see the [instructions](https://github.com/core-plot/core-plot/blob/master/READMEs/README%20for%20Docs%20Install.md) in the **READMEs** folder for details) + * [API documentation](https://core-plot.github.io/MacOS/index.html) for Mac + * [API documentation](https://core-plot.github.io/iOS/index.html) for iOS and tvOS + * API documentation built with [Doxygen](https://www.doxygen.nl/) and installed locally in Xcode (see the [instructions](https://github.com/core-plot/core-plot/blob/master/READMEs/README%20for%20Docs%20Install.md) in the **READMEs** folder for details) * [Project Wiki](https://github.com/core-plot/core-plot/wiki) on GitHub * [Documentation](https://github.com/core-plot/core-plot/tree/master/documentation) folder in the code repository @@ -27,13 +31,12 @@ Documentation of the Core Plot API and high-level architecture can be found in t ## Q&A Sites - * [Core Plot](http://groups.google.com/group/coreplot-discuss) Google Group - * Stackoverflow.com [core-plot tag](http://stackoverflow.com/questions/tagged/core-plot) + * [Core Plot](https://groups.google.com/group/coreplot-discuss) Google Group + * Stackoverflow.com [core-plot tag](https://stackoverflow.com/questions/tagged/core-plot) ## Social Networks * [Twitter](https://twitter.com/CorePlot) - * [App.net](https://alpha.app.net/coreplot); Subscribe to the [Announcements](https://app.net/c/2rw2) broadcast. # Contributing to Core Plot @@ -41,16 +44,12 @@ Core Plot is an open source project hosted on [GitHub](https://github.com/core-p * [core-plot](https://github.com/core-plot/core-plot): This is main code repository with the framework and all examples. This is where you will find the release packages, wiki pages, and issue tracker. - * [core-plot.github.io](https://github.com/core-plot/core-plot.github.io): This is the HTML API documentation. You can view the pages online at [http://core-plot.github.io](http://core-plot.github.io). + * [core-plot.github.io](https://github.com/core-plot/core-plot.github.io): This is the HTML API documentation. You can view the pages online at [https://core-plot.github.io](https://core-plot.github.io). ## Coding Standards Everyone has a their own preferred coding style, and no one way can be considered right. Nonetheless, in a project like Core Plot, with many developers contributing, it is worthwhile defining a set of basic coding standards to prevent a mishmash of different styles which can become frustrating when navigating the code base. See the file [CONTRIBUTING.md](https://github.com/core-plot/core-plot/blob/master/.github/CONTRIBUTING.md) found in the [.github](https://github.com/core-plot/core-plot/tree/master/.github) directory of the project source for specific guidelines. -Core Plot includes a [script](https://github.com/core-plot/core-plot/blob/master/scripts/format_core_plot.sh) to run [Uncrustify](http://uncrustify.sourceforge.net) on the source code to standardize the formatting. All source code will be formatted with this tool before being committed to the Core Plot repository. +Core Plot includes a [script](https://github.com/core-plot/core-plot/blob/master/scripts/format_core_plot.sh) to run [Uncrustify](https://github.com/uncrustify/uncrustify) on the source code to standardize the formatting. All source code will be formatted with this tool before being committed to the Core Plot repository. ## Testing -Because Core Plot is intended to be used in scientific, financial, and other domains where correctness is paramount, unit testing is integrated into the framework. Good test coverage protects developers from introducing accidental regressions and frees them to experiment and refactor without fear of breaking things. See the [unit testing](https://github.com/core-plot/core-plot/wiki/Unit-Testing) wiki page for instructions on how to build unit tests for any new code you add to the project. - -# Support Core Plot - -Flattr this +Core Plot is intended to be applied in scientific, financial, and other domains where correctness is paramount. In order to assure the quality of the framework, unit testing is integrated. Good test coverage protects developers from introducing accidental regressions, and helps them to experiment and refactor without breaking existing code. See the [unit testing](https://github.com/core-plot/core-plot/wiki/Unit-Testing) wiki page for instructions on how to build unit tests for any new code you add to the project. diff --git a/documentation/changelog.markdown b/documentation/changelog.markdown index 77eeae54a..ed231ffeb 100644 --- a/documentation/changelog.markdown +++ b/documentation/changelog.markdown @@ -1,3 +1,43 @@ +# Release 2.3 (January 10, 2020) + +## Release Notes + +This release updates Core Plot to be compatible with Xcode 11 and Swift 5. It adds support for platform-native fonts and colors, including dynamic system colors. + +The Mac deployment target remains OS X 10.8. The iOS deployment target remains iOS 8.0 for both the framework and the static library. The tvOS deployment target remains tvOS 9.0. + +## Details +- **New**: Added support for platform native fonts (`NSFont` and `UIFont`). +- **New**: Added support for platform native colors (`NSColor` and `UIColor`), including dynamic system colors. +- **New**: Added support for variable bar widths in bar, range, and trading range plots. +- **Changed**: Updated the Core Plot project to prefer the new Xcode build system introduced with Xcode 9. +- **Changed**: Updated all framework and example code to be compatible with Xcode 11 and the latest SDKs on all platforms. +- **Changed**: Updated all Swift example apps to Swift 5. +- **Changed**: Added arm64e as a valid build architecture on iOS. +- **Changed**: Miscellaneous bug fixes and cleanup. +- **Removed**: Removed DTrace probing to support Xcode's New Build System. +- **Removed**: Removed docset generation. Docsets are no longer supported under Xcode 9.3. +- **Removed**: Removed the AAPLot and StockPlot example apps because the Yahoo finance API that both relied for data is no longer available. + + + +# Release 2.2 (September 18, 2016) + +## Release Notes + +This release updates Core Plot to be compatible with Xcode 8 and Swift 3. + +The Mac deployment target remains OS X 10.8. The iOS deployment target has changed to iOS 8.0 for both the framework and the static library. The tvOS deployment target remains tvOS 9.0. Core Plot no longer requires the Accelerate framework. + +## Details +- **New**: Increased the iOS deployment target to iOS 8. +- **Changed**: Added Swift name mappings for all string constants. +- **Changed**: Updated all Swift example apps to Swift 3. +- **Changed**: Miscellaneous bug fixes and cleanup. +- **Removed**: Removed the dependency on the Accelerate framework. + + + # Release 2.1 (April 16, 2016) ## Release Notes diff --git a/documentation/doxygen/doxygen touch.config b/documentation/doxygen/doxygen touch.config index 437d31484..01d4c0b2d 100644 --- a/documentation/doxygen/doxygen touch.config +++ b/documentation/doxygen/doxygen touch.config @@ -1,4 +1,4 @@ -# Doxyfile 1.8.11 +# Doxyfile 1.8.14 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project. @@ -20,8 +20,8 @@ # This tag specifies the encoding used for all characters in the config file # that follow. The default is UTF-8 which is also the encoding used for all text # before the first occurrence of this tag. Doxygen uses libiconv (or the iconv -# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv -# for the list of possible encodings. +# built into libc) for the transcoding. See +# https://www.gnu.org/software/libiconv/ for the list of possible encodings. # The default value is: UTF-8. DOXYFILE_ENCODING = UTF-8 @@ -32,7 +32,7 @@ DOXYFILE_ENCODING = UTF-8 # title of most generated pages and in a few other places. # The default value is: My Project. -PROJECT_NAME = "Core Plot (iOS)" +PROJECT_NAME = "Core Plot (iOS and tvOS)" # The PROJECT_NUMBER tag can be used to enter a project or revision number. This # could be handy for archiving the generated documentation or if some version @@ -44,7 +44,7 @@ PROJECT_NUMBER = # for a project that appears at the top of each page and should give viewer a # quick idea about the purpose of the project. Keep the description short. -PROJECT_BRIEF = "Cocoa plotting framework for Mac OS X and iOS" +PROJECT_BRIEF = "Cocoa plotting framework for macOS, iOS, and tvOS" # With the PROJECT_LOGO tag one can specify a logo or an icon that is included # in the documentation. The maximum height of the logo should not exceed 55 @@ -226,7 +226,8 @@ TAB_SIZE = 4 # will allow you to put the command \sideeffect (or @sideeffect) in the # documentation, which will result in a user-defined paragraph with heading # "Side Effects:". You can put \n's in the value part of an alias to insert -# newlines. +# newlines (in the resulting output). You can put ^^ in the value part of an +# alias to insert a newline as if a physical newline was in the original file. ALIASES = "YES=@ref YES" \ "NO=@ref NO" \ @@ -312,6 +313,15 @@ EXTENSION_MAPPING = MARKDOWN_SUPPORT = NO +# When the TOC_INCLUDE_HEADINGS tag is set to a non-zero value, all headings up +# to that level are automatically included in the table of contents, even if +# they do not have an id attribute. +# Note: This feature currently applies only to Markdown headings. +# Minimum value: 0, maximum value: 99, default value: 0. +# This tag requires that the tag MARKDOWN_SUPPORT is set to YES. + +TOC_INCLUDE_HEADINGS = 0 + # When enabled doxygen tries to link words that correspond to documented # classes, or namespaces to their corresponding documentation. Such a link can # be prevented in individual cases by putting a % sign in front of the word or @@ -337,7 +347,7 @@ BUILTIN_STL_SUPPORT = NO CPP_CLI_SUPPORT = NO # Set the SIP_SUPPORT tag to YES if your project consists of sip (see: -# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen +# https://www.riverbankcomputing.com/software/sip/intro) sources only. Doxygen # will parse them like normal C++ but will assume all classes use public instead # of private inheritance when no explicit protection keyword is present. # The default value is: NO. @@ -708,7 +718,7 @@ LAYOUT_FILE = "$(SOURCE_ROOT)/../documentation/doxygen/DoxygenLayout. # The CITE_BIB_FILES tag can be used to specify one or more bib files containing # the reference definitions. This must be a list of .bib files. The .bib # extension is automatically appended if omitted. This requires the bibtex tool -# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info. +# to be installed. See also https://en.wikipedia.org/wiki/BibTeX for more info. # For LaTeX the style of the bibliography can be controlled using # LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the # search path. See also \cite for info how to create references. @@ -797,7 +807,7 @@ INPUT = "$(SOURCE_ROOT)/CorePlot-CocoaTouch.h" \ # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses # libiconv (or the iconv built into libc) for the transcoding. See the libiconv -# documentation (see: http://www.gnu.org/software/libiconv) for the list of +# documentation (see: https://www.gnu.org/software/libiconv/) for the list of # possible encodings. # The default value is: UTF-8. @@ -814,8 +824,8 @@ INPUT_ENCODING = UTF-8 # If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp, # *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, # *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, -# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f, *.for, *.tcl, -# *.vhd, *.vhdl, *.ucf, *.qsf, *.as and *.js. +# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, +# *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf and *.qsf. FILE_PATTERNS = @@ -1006,7 +1016,7 @@ SOURCE_TOOLTIPS = YES # If the USE_HTAGS tag is set to YES then the references to source code will # point to the HTML generated by the htags(1) tool instead of doxygen built-in # source browser. The htags tool is part of GNU's global source tagging system -# (see http://www.gnu.org/software/global/global.html). You will need version +# (see https://www.gnu.org/software/global/global.html). You will need version # 4.8.6 or higher. # # To use it do the following: @@ -1052,6 +1062,17 @@ CLANG_ASSISTED_PARSING = NO CLANG_OPTIONS = +# If clang assisted parsing is enabled you can provide the clang parser with the +# path to the compilation database (see: +# http://clang.llvm.org/docs/HowToSetupToolingForLLVM.html) used when the files +# were built. This is equivalent to specifying the "-p" option to a clang tool, +# such as clang-check. These options will then be passed to the parser. +# Note: The availability of this option depends on whether or not doxygen was +# generated with the -Duse-libclang=ON option for CMake. +# The default value is: 0. + +CLANG_COMPILATION_DATABASE_PATH = 0 + #--------------------------------------------------------------------------- # Configuration options related to the alphabetical class index #--------------------------------------------------------------------------- @@ -1171,7 +1192,7 @@ HTML_EXTRA_FILES = # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen # will adjust the colors in the style sheet and background images according to # this color. Hue is specified as an angle on a colorwheel, see -# http://en.wikipedia.org/wiki/Hue for more information. For instance the value +# https://en.wikipedia.org/wiki/Hue for more information. For instance the value # 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 # purple, and 360 is red again. # Minimum value: 0, maximum value: 359, default value: 220. @@ -1207,6 +1228,17 @@ HTML_COLORSTYLE_GAMMA = 80 HTML_TIMESTAMP = NO +# If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML +# documentation will contain a main index with vertical navigation menus that +# are dynamically created via Javascript. If disabled, the navigation index will +# consists of multiple levels of tabs that are statically embedded in every HTML +# page. Disable this option to support browsers that do not have Javascript, +# like the Qt help browser. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_DYNAMIC_MENUS = YES + # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # documentation will contain sections that can be hidden and shown after the # page has loaded. @@ -1230,12 +1262,12 @@ HTML_INDEX_NUM_ENTRIES = 100 # If the GENERATE_DOCSET tag is set to YES, additional index files will be # generated that can be used as input for Apple's Xcode 3 integrated development -# environment (see: http://developer.apple.com/tools/xcode/), introduced with +# environment (see: https://developer.apple.com/tools/xcode/), introduced with # OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a # Makefile in the HTML output directory. Running make will produce the docset in # that directory and running make install will install the docset in # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at -# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html +# startup. See https://developer.apple.com/tools/creatingdocsetswithdoxygen.html # for more information. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. @@ -1351,7 +1383,7 @@ QCH_FILE = # The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help # Project output. For more information please see Qt Help Project / Namespace -# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace). +# (see: http://doc.qt.io/qt-4.8/qthelpproject.html#namespace). # The default value is: org.doxygen.Project. # This tag requires that the tag GENERATE_QHP is set to YES. @@ -1359,8 +1391,7 @@ QHP_NAMESPACE = # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt # Help Project output. For more information please see Qt Help Project / Virtual -# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual- -# folders). +# Folders (see: http://doc.qt.io/qt-4.8/qthelpproject.html#virtual-folders). # The default value is: doc. # This tag requires that the tag GENERATE_QHP is set to YES. @@ -1368,23 +1399,21 @@ QHP_VIRTUAL_FOLDER = doc # If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom # filter to add. For more information please see Qt Help Project / Custom -# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- -# filters). +# Filters (see: http://doc.qt.io/qt-4.8/qthelpproject.html#custom-filters). # This tag requires that the tag GENERATE_QHP is set to YES. QHP_CUST_FILTER_NAME = # The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the # custom filter to add. For more information please see Qt Help Project / Custom -# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- -# filters). +# Filters (see: http://doc.qt.io/qt-4.8/qthelpproject.html#custom-filters). # This tag requires that the tag GENERATE_QHP is set to YES. QHP_CUST_FILTER_ATTRS = # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this # project's filter section matches. Qt Help Project / Filter Attributes (see: -# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes). +# http://doc.qt.io/qt-4.8/qthelpproject.html#filter-attributes). # This tag requires that the tag GENERATE_QHP is set to YES. QHP_SECT_FILTER_ATTRS = @@ -1477,7 +1506,7 @@ EXT_LINKS_IN_WINDOW = NO FORMULA_FONTSIZE = 10 -# Use the FORMULA_TRANPARENT tag to determine whether or not the images +# Use the FORMULA_TRANSPARENT tag to determine whether or not the images # generated for formulas are transparent PNGs. Transparent PNGs are not # supported properly for IE 6.0, but are supported on all modern browsers. # @@ -1489,7 +1518,7 @@ FORMULA_FONTSIZE = 10 FORMULA_TRANSPARENT = YES # Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see -# http://www.mathjax.org) which uses client side Javascript for the rendering +# https://www.mathjax.org) which uses client side Javascript for the rendering # instead of using pre-rendered bitmaps. Use this if you do not have LaTeX # installed or if you want to formulas look prettier in the HTML output. When # enabled you may also need to install MathJax separately and configure the path @@ -1516,8 +1545,8 @@ MATHJAX_FORMAT = HTML-CSS # MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax # Content Delivery Network so you can quickly see the result without installing # MathJax. However, it is strongly recommended to install a local copy of -# MathJax from http://www.mathjax.org before deployment. -# The default value is: http://cdn.mathjax.org/mathjax/latest. +# MathJax from https://www.mathjax.org before deployment. +# The default value is: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/. # This tag requires that the tag USE_MATHJAX is set to YES. MATHJAX_RELPATH = http://www.mathjax.org/mathjax @@ -1578,7 +1607,7 @@ SERVER_BASED_SEARCH = NO # # Doxygen ships with an example indexer (doxyindexer) and search engine # (doxysearch.cgi) which are based on the open source search engine library -# Xapian (see: http://xapian.org/). +# Xapian (see: https://xapian.org/). # # See the section "External Indexing and Searching" for details. # The default value is: NO. @@ -1591,7 +1620,7 @@ EXTERNAL_SEARCH = NO # # Doxygen ships with an example indexer (doxyindexer) and search engine # (doxysearch.cgi) which are based on the open source search engine library -# Xapian (see: http://xapian.org/). See the section "External Indexing and +# Xapian (see: https://xapian.org/). See the section "External Indexing and # Searching" for details. # This tag requires that the tag SEARCHENGINE is set to YES. @@ -1778,7 +1807,7 @@ LATEX_SOURCE_CODE = NO # The LATEX_BIB_STYLE tag can be used to specify the style to use for the # bibliography, e.g. plainnat, or ieeetr. See -# http://en.wikipedia.org/wiki/BibTeX and \cite for more info. +# https://en.wikipedia.org/wiki/BibTeX and \cite for more info. # The default value is: plain. # This tag requires that the tag GENERATE_LATEX is set to YES. @@ -1961,9 +1990,9 @@ DOCBOOK_PROGRAMLISTING = NO #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES, doxygen will generate an -# AutoGen Definitions (see http://autogen.sf.net) file that captures the -# structure of the code including all documentation. Note that this feature is -# still experimental and incomplete at the moment. +# AutoGen Definitions (see http://autogen.sourceforge.net/) file that captures +# the structure of the code including all documentation. Note that this feature +# is still experimental and incomplete at the moment. # The default value is: NO. GENERATE_AUTOGEN_DEF = NO @@ -2066,10 +2095,15 @@ INCLUDE_FILE_PATTERNS = PREDEFINED = TARGET_OS_IPHONE, \ TARGET_OS_TV, \ TARGET_OS_SIMULATOR, \ - "NS_DESIGNATED_INITIALIZER:='' ," \ - "NS_RETURNS_INNER_POINTER:='' ," \ - "NS_ENUM(_type,_name):=enum _name : _type _name; enum _name : _type ," \ - "NS_OPTIONS(_type,_name):=enum _name : _type _name; enum _name : _type" + "NS_DESIGNATED_INITIALIZER:= " \ + "NS_RETURNS_INNER_POINTER:= " \ + "NS_ENUM(_type,_name):=enum _name : _type _name; enum _name : _type " \ + "NS_CLOSED_ENUM(_type,_name):=enum _name : _type _name; enum _name : _type " \ + "NS_OPTIONS(_type,_name):=enum _name : _type _name; enum _name : _type " \ + "NS_SWIFT_NAME(_name):= " \ + "cpt_deprecated:= " \ + "cpt_swift_enum:= " \ + "cpt_swift_struct:= " # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this # tag can be used to specify a list of macro names that should be expanded. The @@ -2391,6 +2425,11 @@ DIAFILE_DIRS = PLANTUML_JAR_PATH = +# When using plantuml, the PLANTUML_CFG_FILE tag can be used to specify a +# configuration file for plantuml. + +PLANTUML_CFG_FILE = + # When using plantuml, the specified paths are searched for files specified by # the !include statement in a plantuml block. diff --git a/documentation/doxygen/doxygen-cocoa-tags.xml b/documentation/doxygen/doxygen-cocoa-tags.xml index e004861d2..1578dd526 100644 --- a/documentation/doxygen/doxygen-cocoa-tags.xml +++ b/documentation/doxygen/doxygen-cocoa-tags.xml @@ -758,6 +758,21 @@ + + CAAnimationDelegate + https://developer.apple.com/library/mac/#documentation/GraphicsImaging/Reference/CAAnimationDelegate_protocol/Introduction/Introduction.html/ + NSObject-p + + void + animationDidStart: + //apple_ref/occ/intfcm/CAAnimationDelegate/animationDidStart + + + void + animationDidStop:finished: + //apple_ref/occ/intfcm/CAAnimationDelegate/animationDidStopfinished + + CALayer https://developer.apple.com/library/mac/#documentation/GraphicsImaging/Reference/CALayer_class/Introduction/Introduction.html @@ -860,6 +875,36 @@ //apple_ref/occ/instm/CALayer/setNeedsLayout + + CALayerDelegate + https://developer.apple.com/library/mac/#documentation/GraphicsImaging/Reference/CALayerDelegate_protocol/Introduction/Introduction.html/ + NSObject-p + + id + actionForLayer:forKey: + //apple_ref/occ/intfcm/CALayerDelegate/actionForLayerforKey + + + void + displayLayer: + //apple_ref/occ/intfcm/CALayerDelegate/displayLayer + + + void + drawLayer:inContext: + //apple_ref/occ/intfcm/CALayerDelegate/drawLayerinContext + + + void + layerWillDraw: + //apple_ref/occ/intfcm/CALayerDelegate/layerWillDraw + + + void + layoutSublayersOfLayer: + //apple_ref/occ/intfcm/CALayerDelegate/layoutSublayersOfLayer + + CAMediaTiming https://developer.apple.com/library/mac/#documentation/GraphicsImaging/Reference/CAMediaTiming_protocol/Introduction/Introduction.html diff --git a/documentation/doxygen/doxygen-cocoa-touch-tags.xml b/documentation/doxygen/doxygen-cocoa-touch-tags.xml index 92439a53f..1de3c13d3 100644 --- a/documentation/doxygen/doxygen-cocoa-touch-tags.xml +++ b/documentation/doxygen/doxygen-cocoa-touch-tags.xml @@ -687,6 +687,21 @@ + + CAAnimationDelegate + https://developer.apple.com/library/ios/documentation/Foundation/Reference/CAAnimationDelegate_Protocol_Ref/ + NSObject-p + + void + animationDidStart: + //apple_ref/occ/intfcm/CAAnimationDelegate/animationDidStart + + + void + animationDidStop:finished: + //apple_ref/occ/intfcm/CAAnimationDelegate/animationDidStopfinished + + CALayer https://developer.apple.com/library/ios/#documentation/GraphicsImaging/Reference/CALayer_class/Introduction/Introduction.html @@ -788,6 +803,36 @@ //apple_ref/occ/instm/CALayer/setNeedsLayout + + CALayerDelegate + https://developer.apple.com/library/ios/documentation/Foundation/Reference/CALayerDelegate_Protocol_Ref/ + NSObject-p + + id + actionForLayer:forKey: + //apple_ref/occ/intfcm/CALayerDelegate/actionForLayerforKey + + + void + displayLayer: + //apple_ref/occ/intfcm/CALayerDelegate/displayLayer + + + void + drawLayer:inContext: + //apple_ref/occ/intfcm/CALayerDelegate/drawLayerinContext + + + void + layerWillDraw: + //apple_ref/occ/intfcm/CALayerDelegate/layerWillDraw + + + void + layoutSublayersOfLayer: + //apple_ref/occ/intfcm/CALayerDelegate/layoutSublayersOfLayer + + CAMediaTiming https://developer.apple.com/library/ios/#documentation/GraphicsImaging/Reference/CAMediaTiming_protocol/Introduction/Introduction.html @@ -954,4 +999,4 @@ //apple_ref/c/tdef/NSZone - \ No newline at end of file + diff --git a/documentation/doxygen/doxygen.config b/documentation/doxygen/doxygen.config index c96d56493..46ed09de4 100644 --- a/documentation/doxygen/doxygen.config +++ b/documentation/doxygen/doxygen.config @@ -1,4 +1,4 @@ -# Doxyfile 1.8.11 +# Doxyfile 1.8.14 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project. @@ -20,8 +20,8 @@ # This tag specifies the encoding used for all characters in the config file # that follow. The default is UTF-8 which is also the encoding used for all text # before the first occurrence of this tag. Doxygen uses libiconv (or the iconv -# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv -# for the list of possible encodings. +# built into libc) for the transcoding. See +# https://www.gnu.org/software/libiconv/ for the list of possible encodings. # The default value is: UTF-8. DOXYFILE_ENCODING = UTF-8 @@ -32,7 +32,7 @@ DOXYFILE_ENCODING = UTF-8 # title of most generated pages and in a few other places. # The default value is: My Project. -PROJECT_NAME = "Core Plot (Mac OS)" +PROJECT_NAME = "Core Plot (macOS)" # The PROJECT_NUMBER tag can be used to enter a project or revision number. This # could be handy for archiving the generated documentation or if some version @@ -44,7 +44,7 @@ PROJECT_NUMBER = # for a project that appears at the top of each page and should give viewer a # quick idea about the purpose of the project. Keep the description short. -PROJECT_BRIEF = "Cocoa plotting framework for Mac OS X and iOS" +PROJECT_BRIEF = "Cocoa plotting framework for macOS, iOS, and tvOS" # With the PROJECT_LOGO tag one can specify a logo or an icon that is included # in the documentation. The maximum height of the logo should not exceed 55 @@ -226,7 +226,8 @@ TAB_SIZE = 4 # will allow you to put the command \sideeffect (or @sideeffect) in the # documentation, which will result in a user-defined paragraph with heading # "Side Effects:". You can put \n's in the value part of an alias to insert -# newlines. +# newlines (in the resulting output). You can put ^^ in the value part of an +# alias to insert a newline as if a physical newline was in the original file. ALIASES = "YES=@ref YES" \ "NO=@ref NO" \ @@ -312,6 +313,15 @@ EXTENSION_MAPPING = MARKDOWN_SUPPORT = NO +# When the TOC_INCLUDE_HEADINGS tag is set to a non-zero value, all headings up +# to that level are automatically included in the table of contents, even if +# they do not have an id attribute. +# Note: This feature currently applies only to Markdown headings. +# Minimum value: 0, maximum value: 99, default value: 0. +# This tag requires that the tag MARKDOWN_SUPPORT is set to YES. + +TOC_INCLUDE_HEADINGS = 0 + # When enabled doxygen tries to link words that correspond to documented # classes, or namespaces to their corresponding documentation. Such a link can # be prevented in individual cases by putting a % sign in front of the word or @@ -337,7 +347,7 @@ BUILTIN_STL_SUPPORT = NO CPP_CLI_SUPPORT = NO # Set the SIP_SUPPORT tag to YES if your project consists of sip (see: -# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen +# https://www.riverbankcomputing.com/software/sip/intro) sources only. Doxygen # will parse them like normal C++ but will assume all classes use public instead # of private inheritance when no explicit protection keyword is present. # The default value is: NO. @@ -708,7 +718,7 @@ LAYOUT_FILE = "$(SOURCE_ROOT)/../documentation/doxygen/DoxygenLayout. # The CITE_BIB_FILES tag can be used to specify one or more bib files containing # the reference definitions. This must be a list of .bib files. The .bib # extension is automatically appended if omitted. This requires the bibtex tool -# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info. +# to be installed. See also https://en.wikipedia.org/wiki/BibTeX for more info. # For LaTeX the style of the bibliography can be controlled using # LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the # search path. See also \cite for info how to create references. @@ -797,7 +807,7 @@ INPUT = "$(SOURCE_ROOT)/CorePlot.h" \ # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses # libiconv (or the iconv built into libc) for the transcoding. See the libiconv -# documentation (see: http://www.gnu.org/software/libiconv) for the list of +# documentation (see: https://www.gnu.org/software/libiconv/) for the list of # possible encodings. # The default value is: UTF-8. @@ -814,8 +824,8 @@ INPUT_ENCODING = UTF-8 # If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp, # *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, # *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, -# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f, *.for, *.tcl, -# *.vhd, *.vhdl, *.ucf, *.qsf, *.as and *.js. +# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, +# *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf and *.qsf. FILE_PATTERNS = @@ -1006,7 +1016,7 @@ SOURCE_TOOLTIPS = YES # If the USE_HTAGS tag is set to YES then the references to source code will # point to the HTML generated by the htags(1) tool instead of doxygen built-in # source browser. The htags tool is part of GNU's global source tagging system -# (see http://www.gnu.org/software/global/global.html). You will need version +# (see https://www.gnu.org/software/global/global.html). You will need version # 4.8.6 or higher. # # To use it do the following: @@ -1052,6 +1062,17 @@ CLANG_ASSISTED_PARSING = NO CLANG_OPTIONS = +# If clang assisted parsing is enabled you can provide the clang parser with the +# path to the compilation database (see: +# http://clang.llvm.org/docs/HowToSetupToolingForLLVM.html) used when the files +# were built. This is equivalent to specifying the "-p" option to a clang tool, +# such as clang-check. These options will then be passed to the parser. +# Note: The availability of this option depends on whether or not doxygen was +# generated with the -Duse-libclang=ON option for CMake. +# The default value is: 0. + +CLANG_COMPILATION_DATABASE_PATH = 0 + #--------------------------------------------------------------------------- # Configuration options related to the alphabetical class index #--------------------------------------------------------------------------- @@ -1171,7 +1192,7 @@ HTML_EXTRA_FILES = # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen # will adjust the colors in the style sheet and background images according to # this color. Hue is specified as an angle on a colorwheel, see -# http://en.wikipedia.org/wiki/Hue for more information. For instance the value +# https://en.wikipedia.org/wiki/Hue for more information. For instance the value # 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 # purple, and 360 is red again. # Minimum value: 0, maximum value: 359, default value: 220. @@ -1207,6 +1228,17 @@ HTML_COLORSTYLE_GAMMA = 80 HTML_TIMESTAMP = NO +# If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML +# documentation will contain a main index with vertical navigation menus that +# are dynamically created via Javascript. If disabled, the navigation index will +# consists of multiple levels of tabs that are statically embedded in every HTML +# page. Disable this option to support browsers that do not have Javascript, +# like the Qt help browser. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_DYNAMIC_MENUS = YES + # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # documentation will contain sections that can be hidden and shown after the # page has loaded. @@ -1230,12 +1262,12 @@ HTML_INDEX_NUM_ENTRIES = 100 # If the GENERATE_DOCSET tag is set to YES, additional index files will be # generated that can be used as input for Apple's Xcode 3 integrated development -# environment (see: http://developer.apple.com/tools/xcode/), introduced with +# environment (see: https://developer.apple.com/tools/xcode/), introduced with # OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a # Makefile in the HTML output directory. Running make will produce the docset in # that directory and running make install will install the docset in # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at -# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html +# startup. See https://developer.apple.com/tools/creatingdocsetswithdoxygen.html # for more information. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. @@ -1351,7 +1383,7 @@ QCH_FILE = # The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help # Project output. For more information please see Qt Help Project / Namespace -# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace). +# (see: http://doc.qt.io/qt-4.8/qthelpproject.html#namespace). # The default value is: org.doxygen.Project. # This tag requires that the tag GENERATE_QHP is set to YES. @@ -1359,8 +1391,7 @@ QHP_NAMESPACE = # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt # Help Project output. For more information please see Qt Help Project / Virtual -# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual- -# folders). +# Folders (see: http://doc.qt.io/qt-4.8/qthelpproject.html#virtual-folders). # The default value is: doc. # This tag requires that the tag GENERATE_QHP is set to YES. @@ -1368,23 +1399,21 @@ QHP_VIRTUAL_FOLDER = doc # If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom # filter to add. For more information please see Qt Help Project / Custom -# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- -# filters). +# Filters (see: http://doc.qt.io/qt-4.8/qthelpproject.html#custom-filters). # This tag requires that the tag GENERATE_QHP is set to YES. QHP_CUST_FILTER_NAME = # The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the # custom filter to add. For more information please see Qt Help Project / Custom -# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- -# filters). +# Filters (see: http://doc.qt.io/qt-4.8/qthelpproject.html#custom-filters). # This tag requires that the tag GENERATE_QHP is set to YES. QHP_CUST_FILTER_ATTRS = # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this # project's filter section matches. Qt Help Project / Filter Attributes (see: -# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes). +# http://doc.qt.io/qt-4.8/qthelpproject.html#filter-attributes). # This tag requires that the tag GENERATE_QHP is set to YES. QHP_SECT_FILTER_ATTRS = @@ -1477,7 +1506,7 @@ EXT_LINKS_IN_WINDOW = NO FORMULA_FONTSIZE = 10 -# Use the FORMULA_TRANPARENT tag to determine whether or not the images +# Use the FORMULA_TRANSPARENT tag to determine whether or not the images # generated for formulas are transparent PNGs. Transparent PNGs are not # supported properly for IE 6.0, but are supported on all modern browsers. # @@ -1489,7 +1518,7 @@ FORMULA_FONTSIZE = 10 FORMULA_TRANSPARENT = YES # Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see -# http://www.mathjax.org) which uses client side Javascript for the rendering +# https://www.mathjax.org) which uses client side Javascript for the rendering # instead of using pre-rendered bitmaps. Use this if you do not have LaTeX # installed or if you want to formulas look prettier in the HTML output. When # enabled you may also need to install MathJax separately and configure the path @@ -1516,8 +1545,8 @@ MATHJAX_FORMAT = HTML-CSS # MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax # Content Delivery Network so you can quickly see the result without installing # MathJax. However, it is strongly recommended to install a local copy of -# MathJax from http://www.mathjax.org before deployment. -# The default value is: http://cdn.mathjax.org/mathjax/latest. +# MathJax from https://www.mathjax.org before deployment. +# The default value is: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/. # This tag requires that the tag USE_MATHJAX is set to YES. MATHJAX_RELPATH = http://www.mathjax.org/mathjax @@ -1578,7 +1607,7 @@ SERVER_BASED_SEARCH = NO # # Doxygen ships with an example indexer (doxyindexer) and search engine # (doxysearch.cgi) which are based on the open source search engine library -# Xapian (see: http://xapian.org/). +# Xapian (see: https://xapian.org/). # # See the section "External Indexing and Searching" for details. # The default value is: NO. @@ -1591,7 +1620,7 @@ EXTERNAL_SEARCH = NO # # Doxygen ships with an example indexer (doxyindexer) and search engine # (doxysearch.cgi) which are based on the open source search engine library -# Xapian (see: http://xapian.org/). See the section "External Indexing and +# Xapian (see: https://xapian.org/). See the section "External Indexing and # Searching" for details. # This tag requires that the tag SEARCHENGINE is set to YES. @@ -1778,7 +1807,7 @@ LATEX_SOURCE_CODE = NO # The LATEX_BIB_STYLE tag can be used to specify the style to use for the # bibliography, e.g. plainnat, or ieeetr. See -# http://en.wikipedia.org/wiki/BibTeX and \cite for more info. +# https://en.wikipedia.org/wiki/BibTeX and \cite for more info. # The default value is: plain. # This tag requires that the tag GENERATE_LATEX is set to YES. @@ -1961,9 +1990,9 @@ DOCBOOK_PROGRAMLISTING = NO #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES, doxygen will generate an -# AutoGen Definitions (see http://autogen.sf.net) file that captures the -# structure of the code including all documentation. Note that this feature is -# still experimental and incomplete at the moment. +# AutoGen Definitions (see http://autogen.sourceforge.net/) file that captures +# the structure of the code including all documentation. Note that this feature +# is still experimental and incomplete at the moment. # The default value is: NO. GENERATE_AUTOGEN_DEF = NO @@ -2063,10 +2092,15 @@ INCLUDE_FILE_PATTERNS = # recursively expanded use the := operator instead of the = operator. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. -PREDEFINED = "NS_DESIGNATED_INITIALIZER:='' ," \ - "NS_RETURNS_INNER_POINTER:='' ," \ - "NS_ENUM(_type,_name):=enum _name : _type _name; enum _name : _type ," \ - "NS_OPTIONS(_type,_name):=enum _name : _type _name; enum _name : _type" +PREDEFINED = "NS_DESIGNATED_INITIALIZER:= " \ + "NS_RETURNS_INNER_POINTER:= " \ + "NS_ENUM(_type,_name):=enum _name : _type _name; enum _name : _type " \ + "NS_CLOSED_ENUM(_type,_name):=enum _name : _type _name; enum _name : _type " \ + "NS_OPTIONS(_type,_name):=enum _name : _type _name; enum _name : _type " \ + "NS_SWIFT_NAME(_name):= " \ + "cpt_deprecated:= " \ + "cpt_swift_enum:= " \ + "cpt_swift_struct:= " # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this # tag can be used to specify a list of macro names that should be expanded. The @@ -2388,6 +2422,11 @@ DIAFILE_DIRS = PLANTUML_JAR_PATH = +# When using plantuml, the PLANTUML_CFG_FILE tag can be used to specify a +# configuration file for plantuml. + +PLANTUML_CFG_FILE = + # When using plantuml, the specified paths are searched for files specified by # the !include statement in a plantuml block. diff --git a/examples/AAPLot/AAPL.plist b/examples/AAPLot/AAPL.plist deleted file mode 100644 index 482c91dc4..000000000 --- a/examples/AAPLot/AAPL.plist +++ /dev/null @@ -1,963 +0,0 @@ - - - - - endDate - 2009-06-19T02:55:22Z - financialData - - - adjClose - 144.67 - close - 144.67 - date - 2009-06-05T04:00:00Z - high - 146.4 - low - 143.21 - open - 145.31 - volume - 22585700 - - - adjClose - 143.74 - close - 143.74 - date - 2009-06-04T04:00:00Z - high - 144.18 - low - 140.04 - open - 140.13 - volume - 19537200 - - - adjClose - 140.95 - close - 140.95 - date - 2009-06-03T04:00:00Z - high - 141.11 - low - 139.07 - open - 140 - volume - 20171800 - - - adjClose - 139.49 - close - 139.49 - date - 2009-06-02T04:00:00Z - high - 141.34 - low - 138.35 - open - 138.99 - volume - 16199500 - - - adjClose - 139.35 - close - 139.35 - date - 2009-06-01T04:00:00Z - high - 139.99 - low - 136 - open - 136.47 - volume - 16160700 - - - adjClose - 135.81 - close - 135.81 - date - 2009-05-29T04:00:00Z - high - 135.9 - low - 133.85 - open - 135.39 - volume - 16304800 - - - adjClose - 135.07 - close - 135.07 - date - 2009-05-28T04:00:00Z - high - 135.39 - low - 132.03 - open - 133.45 - volume - 17397200 - - - adjClose - 133.05 - close - 133.05 - date - 2009-05-27T04:00:00Z - high - 134.98 - low - 130.91 - open - 131.78 - volume - 23086500 - - - adjClose - 130.78 - close - 130.78 - date - 2009-05-26T04:00:00Z - high - 130.83 - low - 124.55 - open - 124.76 - volume - 22692300 - - - adjClose - 122.5 - close - 122.5 - date - 2009-05-22T04:00:00Z - high - 124.18 - low - 121.75 - open - 124.05 - volume - 10642800 - - - adjClose - 124.18 - close - 124.18 - date - 2009-05-21T04:00:00Z - high - 126.78 - low - 122.89 - open - 125.15 - volume - 14569500 - - - adjClose - 125.87 - close - 125.87 - date - 2009-05-20T04:00:00Z - high - 129.21 - low - 125.3 - open - 127.63 - volume - 13878000 - - - adjClose - 127.45 - close - 127.45 - date - 2009-05-19T04:00:00Z - high - 129.31 - low - 125.74 - open - 126.82 - volume - 13300800 - - - adjClose - 126.65 - close - 126.65 - date - 2009-05-18T04:00:00Z - high - 126.7 - low - 121.57 - open - 123.73 - volume - 16387200 - - - adjClose - 122.42 - close - 122.42 - date - 2009-05-15T04:00:00Z - high - 124.62 - low - 121.61 - open - 122.32 - volume - 13127400 - - - adjClose - 122.95 - close - 122.95 - date - 2009-05-14T04:00:00Z - high - 123.53 - low - 119.7 - open - 119.78 - volume - 15993800 - - - adjClose - 119.49 - close - 119.49 - date - 2009-05-13T04:00:00Z - high - 124.02 - low - 119.38 - open - 123.21 - volume - 21284700 - - - adjClose - 124.42 - close - 124.42 - date - 2009-05-12T04:00:00Z - high - 129.71 - low - 123.25 - open - 129.56 - volume - 21767200 - - - adjClose - 129.57 - close - 129.57 - date - 2009-05-11T04:00:00Z - high - 130.96 - low - 127.12 - open - 127.37 - volume - 14452100 - - - adjClose - 129.19 - close - 129.19 - date - 2009-05-08T04:00:00Z - high - 131.23 - low - 126.26 - open - 129.04 - volume - 16713000 - - - adjClose - 129.06 - close - 129.06 - date - 2009-05-07T04:00:00Z - high - 132.39 - low - 127.9 - open - 132.33 - volume - 18992000 - - - adjClose - 132.5 - close - 132.5 - date - 2009-05-06T04:00:00Z - high - 133.5 - low - 130.22 - open - 133.33 - volume - 16912100 - - - adjClose - 132.71 - close - 132.71 - date - 2009-05-05T04:00:00Z - high - 132.86 - low - 131.12 - open - 131.75 - volume - 14223400 - - - adjClose - 132.07 - close - 132.07 - date - 2009-05-04T04:00:00Z - high - 132.25 - low - 127.68 - open - 128.24 - volume - 21762800 - - - adjClose - 127.24 - close - 127.24 - date - 2009-05-01T04:00:00Z - high - 127.95 - low - 125.8 - open - 125.8 - volume - 14197000 - - - adjClose - 125.83 - close - 125.83 - date - 2009-04-30T04:00:00Z - high - 127 - low - 124.92 - open - 126.22 - volume - 17803200 - - - adjClose - 125.14 - close - 125.14 - date - 2009-04-29T04:00:00Z - high - 126.85 - low - 123.83 - open - 124.85 - volume - 16361100 - - - adjClose - 123.9 - close - 123.9 - date - 2009-04-28T04:00:00Z - high - 126.21 - low - 123.26 - open - 123.35 - volume - 16280600 - - - adjClose - 124.73 - close - 124.73 - date - 2009-04-27T04:00:00Z - high - 125 - low - 122.66 - open - 122.9 - volume - 17167500 - - - adjClose - 123.9 - close - 123.9 - date - 2009-04-24T04:00:00Z - high - 125.14 - low - 122.97 - open - 124.64 - volume - 19313000 - - - adjClose - 125.4 - close - 125.4 - date - 2009-04-23T04:00:00Z - high - 127.2 - low - 123.51 - open - 126.62 - volume - 33755600 - - - adjClose - 121.51 - close - 121.51 - date - 2009-04-22T04:00:00Z - high - 125.35 - low - 121.2 - open - 122.63 - volume - 33527400 - - - adjClose - 121.76 - close - 121.76 - date - 2009-04-21T04:00:00Z - high - 122.14 - low - 118.6 - open - 118.89 - volume - 16810200 - - - adjClose - 120.5 - close - 120.5 - date - 2009-04-20T04:00:00Z - high - 122.99 - low - 119.16 - open - 121.73 - volume - 16659500 - - - adjClose - 123.42 - close - 123.42 - date - 2009-04-17T04:00:00Z - high - 124.25 - low - 120.25 - open - 121.18 - volume - 17767700 - - - adjClose - 121.45 - close - 121.45 - date - 2009-04-16T04:00:00Z - high - 123.15 - low - 118.79 - open - 119.19 - volume - 21194500 - - - adjClose - 117.64 - close - 117.64 - date - 2009-04-15T04:00:00Z - high - 118.25 - low - 115.76 - open - 117.2 - volume - 14745800 - - - adjClose - 118.31 - close - 118.31 - date - 2009-04-14T04:00:00Z - high - 120.17 - low - 117.25 - open - 119.57 - volume - 16236500 - - - adjClose - 120.22 - close - 120.22 - date - 2009-04-13T04:00:00Z - high - 120.98 - low - 119 - open - 120.01 - volume - 13901300 - - - adjClose - 119.57 - close - 119.57 - date - 2009-04-09T04:00:00Z - high - 120 - low - 117.96 - open - 118.42 - volume - 18955600 - - - adjClose - 116.32 - close - 116.32 - date - 2009-04-08T04:00:00Z - high - 116.79 - low - 114.58 - open - 115.43 - volume - 16272500 - - - adjClose - 115 - close - 115 - date - 2009-04-07T04:00:00Z - high - 116.67 - low - 114.19 - open - 116.53 - volume - 19163600 - - - adjClose - 118.45 - close - 118.45 - date - 2009-04-06T04:00:00Z - high - 118.75 - low - 113.28 - open - 114.94 - volume - 23502300 - - - adjClose - 115.99 - close - 115.99 - date - 2009-04-03T04:00:00Z - high - 116.13 - low - 113.52 - open - 114.19 - volume - 22722900 - - - adjClose - 112.71 - close - 112.71 - date - 2009-04-02T04:00:00Z - high - 114.75 - low - 109.78 - open - 110.14 - volume - 29013100 - - - adjClose - 108.69 - close - 108.69 - date - 2009-04-01T04:00:00Z - high - 109 - low - 103.89 - open - 104.09 - volume - 21049000 - - - adjClose - 105.12 - close - 105.12 - date - 2009-03-31T04:00:00Z - high - 107.45 - low - 105 - open - 105.45 - volume - 20338500 - - - adjClose - 104.49 - close - 104.49 - date - 2009-03-30T04:00:00Z - high - 105.01 - low - 102.61 - open - 104.51 - volume - 17957000 - - - adjClose - 106.85 - close - 106.85 - date - 2009-03-27T04:00:00Z - high - 108.53 - low - 106.4 - open - 108.23 - volume - 17602600 - - - adjClose - 109.87 - close - 109.87 - date - 2009-03-26T04:00:00Z - high - 109.98 - low - 107.58 - open - 107.83 - volume - 22009000 - - - adjClose - 106.49 - close - 106.49 - date - 2009-03-25T04:00:00Z - high - 108.36 - low - 103.86 - open - 107.58 - volume - 23093500 - - - adjClose - 106.5 - close - 106.5 - date - 2009-03-24T04:00:00Z - high - 109.44 - low - 105.39 - open - 106.36 - volume - 22879000 - - - adjClose - 107.66 - close - 107.66 - date - 2009-03-23T04:00:00Z - high - 108.16 - low - 101.75 - open - 102.71 - volume - 23799900 - - - adjClose - 101.59 - close - 101.59 - date - 2009-03-20T04:00:00Z - high - 103.11 - low - 100.57 - open - 102.09 - volume - 24842400 - - - adjClose - 101.62 - close - 101.62 - date - 2009-03-19T04:00:00Z - high - 103.2 - low - 100.25 - open - 101.85 - volume - 17863600 - - - adjClose - 101.52 - close - 101.52 - date - 2009-03-18T04:00:00Z - high - 103.48 - low - 99.72 - open - 99.91 - volume - 28429900 - - - adjClose - 99.66 - close - 99.66 - date - 2009-03-17T04:00:00Z - high - 99.69 - low - 95.07000000000001 - open - 95.23999999999999 - volume - 28094500 - - - adjClose - 95.42 - close - 95.42 - date - 2009-03-16T04:00:00Z - high - 97.39 - low - 94.17999999999999 - open - 96.53 - volume - 28473000 - - - adjClose - 95.92999999999999 - close - 95.92999999999999 - date - 2009-03-13T04:00:00Z - high - 97.2 - low - 95.01000000000001 - open - 96.3 - volume - 21470300 - - - overallHigh - 146.4 - overallLow - 94.17999999999999 - startDate - 2009-03-27T02:55:22Z - symbol - AAPL - - diff --git a/examples/AAPLot/AAPLot.png b/examples/AAPLot/AAPLot.png deleted file mode 100644 index c218d2598..000000000 Binary files a/examples/AAPLot/AAPLot.png and /dev/null differ diff --git a/examples/AAPLot/AAPLot.xcodeproj/project.pbxproj b/examples/AAPLot/AAPLot.xcodeproj/project.pbxproj deleted file mode 100644 index c1936d1b5..000000000 --- a/examples/AAPLot/AAPLot.xcodeproj/project.pbxproj +++ /dev/null @@ -1,497 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 47; - objects = { - -/* Begin PBXBuildFile section */ - 073703570FE5193C006D46AD /* APFinancialData.m in Sources */ = {isa = PBXBuildFile; fileRef = 073703560FE5193C006D46AD /* APFinancialData.m */; }; - 073703B10FE51E6C006D46AD /* NSDateFormatterExtensions.m in Sources */ = {isa = PBXBuildFile; fileRef = 073703B00FE51E6C006D46AD /* NSDateFormatterExtensions.m */; }; - 1D3623260D0F684500981E51 /* AAPLotAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D3623250D0F684500981E51 /* AAPLotAppDelegate.m */; }; - 1D60589B0D05DD56006BFB54 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; }; - 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; }; - 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; }; - 280E754D0DD40C5E005A515E /* FlipsideView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 280E754A0DD40C5E005A515E /* FlipsideView.xib */; }; - 280E754E0DD40C5E005A515E /* MainView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 280E754B0DD40C5E005A515E /* MainView.xib */; }; - 280E754F0DD40C5E005A515E /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 280E754C0DD40C5E005A515E /* MainWindow.xib */; }; - 288765590DF743DE002DB57D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765580DF743DE002DB57D /* CoreGraphics.framework */; }; - 289233A60DB2D0840083E9F9 /* FlipsideView.m in Sources */ = {isa = PBXBuildFile; fileRef = 289233A30DB2D0840083E9F9 /* FlipsideView.m */; }; - 289233AE0DB2D0DB0083E9F9 /* MainViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 289233A90DB2D0DB0083E9F9 /* MainViewController.m */; }; - 289233AF0DB2D0DB0083E9F9 /* RootViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 289233AB0DB2D0DB0083E9F9 /* RootViewController.m */; }; - 289233B00DB2D0DB0083E9F9 /* FlipsideViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 289233AD0DB2D0DB0083E9F9 /* FlipsideViewController.m */; }; - AB8989470FE0309E00FDC37F /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB8989460FE0309E00FDC37F /* QuartzCore.framework */; }; - AB8F94580FDEFA1500E61485 /* APYahooDataPuller.m in Sources */ = {isa = PBXBuildFile; fileRef = AB8F94570FDEFA1500E61485 /* APYahooDataPuller.m */; }; - ABA5345E0FEB40CE0046A8DA /* AAPL.plist in Resources */ = {isa = PBXBuildFile; fileRef = ABA5345D0FEB40CE0046A8DA /* AAPL.plist */; }; - C3CD283017DE9B9C008EED1E /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3CD282F17DE9B9C008EED1E /* Accelerate.framework */; }; - C3D3936C19FD6B1D00148319 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C3D3936B19FD6B1D00148319 /* Images.xcassets */; }; - C3D414941A7D838200B6F5D6 /* libCorePlot-CocoaTouch.a in Frameworks */ = {isa = PBXBuildFile; fileRef = C3D414911A7D836300B6F5D6 /* libCorePlot-CocoaTouch.a */; }; - C3F0BA3919EC9F6300F7CB47 /* Launch Screen.xib in Resources */ = {isa = PBXBuildFile; fileRef = C3F0BA3819EC9F6300F7CB47 /* Launch Screen.xib */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - C3D414881A7D836300B6F5D6 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = C3D4147C1A7D836300B6F5D6 /* CorePlot.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 8DC2EF5B0486A6940098B216; - remoteInfo = CorePlot; - }; - C3D4148A1A7D836300B6F5D6 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = C3D4147C1A7D836300B6F5D6 /* CorePlot.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 0730F600109492D800E95162; - remoteInfo = UnitTests; - }; - C3D4148C1A7D836300B6F5D6 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = C3D4147C1A7D836300B6F5D6 /* CorePlot.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = C38A09781A46185200D45436; - remoteInfo = CorePlot_iOS; - }; - C3D4148E1A7D836300B6F5D6 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = C3D4147C1A7D836300B6F5D6 /* CorePlot.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = C38A09821A46185300D45436; - remoteInfo = CorePlot_iOSTests; - }; - C3D414901A7D836300B6F5D6 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = C3D4147C1A7D836300B6F5D6 /* CorePlot.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = C38A09BA1A4619A900D45436; - remoteInfo = "CorePlot-CocoaTouch"; - }; - C3D414921A7D836300B6F5D6 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = C3D4147C1A7D836300B6F5D6 /* CorePlot.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = C38A09C41A4619A900D45436; - remoteInfo = "CorePlot-CocoaTouchTests"; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXFileReference section */ - 073703550FE5193C006D46AD /* APFinancialData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APFinancialData.h; sourceTree = ""; }; - 073703560FE5193C006D46AD /* APFinancialData.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = APFinancialData.m; sourceTree = ""; }; - 073703AF0FE51E6C006D46AD /* NSDateFormatterExtensions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSDateFormatterExtensions.h; sourceTree = ""; }; - 073703B00FE51E6C006D46AD /* NSDateFormatterExtensions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSDateFormatterExtensions.m; sourceTree = ""; }; - 1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; - 1D3623240D0F684500981E51 /* AAPLotAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AAPLotAppDelegate.h; sourceTree = ""; }; - 1D3623250D0F684500981E51 /* AAPLotAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AAPLotAppDelegate.m; sourceTree = ""; }; - 1D6058910D05DD3D006BFB54 /* AAPLot.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = AAPLot.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; - 280E754A0DD40C5E005A515E /* FlipsideView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = FlipsideView.xib; sourceTree = ""; }; - 280E754B0DD40C5E005A515E /* MainView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MainView.xib; sourceTree = ""; }; - 280E754C0DD40C5E005A515E /* MainWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = MainWindow.xib; path = ../MainWindow.xib; sourceTree = ""; }; - 288765580DF743DE002DB57D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; - 289233A20DB2D0840083E9F9 /* FlipsideView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FlipsideView.h; path = Classes/FlipsideView.h; sourceTree = ""; }; - 289233A30DB2D0840083E9F9 /* FlipsideView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FlipsideView.m; path = Classes/FlipsideView.m; sourceTree = ""; }; - 289233A80DB2D0DB0083E9F9 /* MainViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; name = MainViewController.h; path = Classes/MainViewController.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - 289233A90DB2D0DB0083E9F9 /* MainViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; name = MainViewController.m; path = Classes/MainViewController.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; - 289233AA0DB2D0DB0083E9F9 /* RootViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RootViewController.h; sourceTree = ""; }; - 289233AB0DB2D0DB0083E9F9 /* RootViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RootViewController.m; sourceTree = ""; }; - 289233AC0DB2D0DB0083E9F9 /* FlipsideViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FlipsideViewController.h; path = Classes/FlipsideViewController.h; sourceTree = ""; }; - 289233AD0DB2D0DB0083E9F9 /* FlipsideViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FlipsideViewController.m; path = Classes/FlipsideViewController.m; sourceTree = ""; }; - 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; - 32CA4F630368D1EE00C91783 /* AAPLot_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AAPLot_Prefix.pch; sourceTree = ""; }; - 8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - AB8989460FE0309E00FDC37F /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; - AB8F94560FDEFA1500E61485 /* APYahooDataPuller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = APYahooDataPuller.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - AB8F94570FDEFA1500E61485 /* APYahooDataPuller.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = APYahooDataPuller.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; - ABA5345D0FEB40CE0046A8DA /* AAPL.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = AAPL.plist; sourceTree = ""; }; - C3CA9B5819E1F79B008DF7A3 /* CorePlotWarnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = CorePlotWarnings.xcconfig; path = ../../framework/xcconfig/CorePlotWarnings.xcconfig; sourceTree = ""; }; - C3CD282F17DE9B9C008EED1E /* Accelerate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Accelerate.framework; path = System/Library/Frameworks/Accelerate.framework; sourceTree = SDKROOT; }; - C3D3936B19FD6B1D00148319 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = AAPLot/Images.xcassets; sourceTree = ""; }; - C3D4147C1A7D836300B6F5D6 /* CorePlot.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = CorePlot.xcodeproj; path = ../../framework/CorePlot.xcodeproj; sourceTree = ""; }; - C3F0BA3819EC9F6300F7CB47 /* Launch Screen.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = "Launch Screen.xib"; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 1D60588F0D05DD3D006BFB54 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */, - 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */, - 288765590DF743DE002DB57D /* CoreGraphics.framework in Frameworks */, - AB8989470FE0309E00FDC37F /* QuartzCore.framework in Frameworks */, - C3CD283017DE9B9C008EED1E /* Accelerate.framework in Frameworks */, - C3D414941A7D838200B6F5D6 /* libCorePlot-CocoaTouch.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 0737034D0FE518E7006D46AD /* Data Acquisition */ = { - isa = PBXGroup; - children = ( - AB8F94560FDEFA1500E61485 /* APYahooDataPuller.h */, - AB8F94570FDEFA1500E61485 /* APYahooDataPuller.m */, - 073703550FE5193C006D46AD /* APFinancialData.h */, - 073703560FE5193C006D46AD /* APFinancialData.m */, - 073703AF0FE51E6C006D46AD /* NSDateFormatterExtensions.h */, - 073703B00FE51E6C006D46AD /* NSDateFormatterExtensions.m */, - ); - name = "Data Acquisition"; - sourceTree = ""; - }; - 080E96DDFE201D6D7F000001 /* Application Controllers */ = { - isa = PBXGroup; - children = ( - 280E754C0DD40C5E005A515E /* MainWindow.xib */, - 1D3623240D0F684500981E51 /* AAPLotAppDelegate.h */, - 1D3623250D0F684500981E51 /* AAPLotAppDelegate.m */, - 289233AA0DB2D0DB0083E9F9 /* RootViewController.h */, - 289233AB0DB2D0DB0083E9F9 /* RootViewController.m */, - ); - name = "Application Controllers"; - path = Classes; - sourceTree = ""; - }; - 19C28FACFE9D520D11CA2CBB /* Products */ = { - isa = PBXGroup; - children = ( - 1D6058910D05DD3D006BFB54 /* AAPLot.app */, - ); - name = Products; - sourceTree = ""; - }; - 281C6CD70DB2D82200F60ACC /* Flipside View */ = { - isa = PBXGroup; - children = ( - 280E754A0DD40C5E005A515E /* FlipsideView.xib */, - 289233A20DB2D0840083E9F9 /* FlipsideView.h */, - 289233A30DB2D0840083E9F9 /* FlipsideView.m */, - 289233AC0DB2D0DB0083E9F9 /* FlipsideViewController.h */, - 289233AD0DB2D0DB0083E9F9 /* FlipsideViewController.m */, - ); - name = "Flipside View"; - sourceTree = ""; - }; - 289233A00DB2D0730083E9F9 /* Main View */ = { - isa = PBXGroup; - children = ( - 280E754B0DD40C5E005A515E /* MainView.xib */, - 289233A80DB2D0DB0083E9F9 /* MainViewController.h */, - 289233A90DB2D0DB0083E9F9 /* MainViewController.m */, - C3F0BA3819EC9F6300F7CB47 /* Launch Screen.xib */, - ); - name = "Main View"; - sourceTree = ""; - }; - 29B97314FDCFA39411CA2CEA /* CustomTemplate */ = { - isa = PBXGroup; - children = ( - C3D4147C1A7D836300B6F5D6 /* CorePlot.xcodeproj */, - 289233A00DB2D0730083E9F9 /* Main View */, - 0737034D0FE518E7006D46AD /* Data Acquisition */, - 281C6CD70DB2D82200F60ACC /* Flipside View */, - 080E96DDFE201D6D7F000001 /* Application Controllers */, - 29B97315FDCFA39411CA2CEA /* Other Sources */, - 29B97317FDCFA39411CA2CEA /* Resources */, - 29B97323FDCFA39411CA2CEA /* Frameworks */, - 19C28FACFE9D520D11CA2CBB /* Products */, - ); - indentWidth = 4; - name = CustomTemplate; - sourceTree = ""; - tabWidth = 4; - usesTabs = 0; - }; - 29B97315FDCFA39411CA2CEA /* Other Sources */ = { - isa = PBXGroup; - children = ( - 32CA4F630368D1EE00C91783 /* AAPLot_Prefix.pch */, - 29B97316FDCFA39411CA2CEA /* main.m */, - C3CA9B5819E1F79B008DF7A3 /* CorePlotWarnings.xcconfig */, - ); - name = "Other Sources"; - sourceTree = ""; - }; - 29B97317FDCFA39411CA2CEA /* Resources */ = { - isa = PBXGroup; - children = ( - C3D3936B19FD6B1D00148319 /* Images.xcassets */, - ABA5345D0FEB40CE0046A8DA /* AAPL.plist */, - 8D1107310486CEB800E47090 /* Info.plist */, - ); - name = Resources; - sourceTree = ""; - }; - 29B97323FDCFA39411CA2CEA /* Frameworks */ = { - isa = PBXGroup; - children = ( - AB8989460FE0309E00FDC37F /* QuartzCore.framework */, - 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */, - 1D30AB110D05D00D00671497 /* Foundation.framework */, - 288765580DF743DE002DB57D /* CoreGraphics.framework */, - C3CD282F17DE9B9C008EED1E /* Accelerate.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; - C3D4147D1A7D836300B6F5D6 /* Products */ = { - isa = PBXGroup; - children = ( - C3D414891A7D836300B6F5D6 /* CorePlot.framework */, - C3D4148B1A7D836300B6F5D6 /* UnitTests.xctest */, - C3D4148D1A7D836300B6F5D6 /* CorePlot.framework */, - C3D4148F1A7D836300B6F5D6 /* UnitTests iOS.xctest */, - C3D414911A7D836300B6F5D6 /* libCorePlot-CocoaTouch.a */, - C3D414931A7D836300B6F5D6 /* CorePlot-CocoaTouchTests.xctest */, - ); - name = Products; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 1D6058900D05DD3D006BFB54 /* AAPLot */ = { - isa = PBXNativeTarget; - buildConfigurationList = 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "AAPLot" */; - buildPhases = ( - 1D60588D0D05DD3D006BFB54 /* Resources */, - 1D60588E0D05DD3D006BFB54 /* Sources */, - 1D60588F0D05DD3D006BFB54 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = AAPLot; - productName = AAPLot; - productReference = 1D6058910D05DD3D006BFB54 /* AAPLot.app */; - productType = "com.apple.product-type.application"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 29B97313FDCFA39411CA2CEA /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0700; - TargetAttributes = { - 1D6058900D05DD3D006BFB54 = { - DevelopmentTeam = 28ZA45DE7D; - }; - }; - }; - buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "AAPLot" */; - compatibilityVersion = "Xcode 6.3"; - developmentRegion = English; - hasScannedForEncodings = 1; - knownRegions = ( - English, - Japanese, - French, - German, - en, - ); - mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */; - projectDirPath = ""; - projectReferences = ( - { - ProductGroup = C3D4147D1A7D836300B6F5D6 /* Products */; - ProjectRef = C3D4147C1A7D836300B6F5D6 /* CorePlot.xcodeproj */; - }, - ); - projectRoot = ""; - targets = ( - 1D6058900D05DD3D006BFB54 /* AAPLot */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXReferenceProxy section */ - C3D414891A7D836300B6F5D6 /* CorePlot.framework */ = { - isa = PBXReferenceProxy; - fileType = wrapper.framework; - path = CorePlot.framework; - remoteRef = C3D414881A7D836300B6F5D6 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - C3D4148B1A7D836300B6F5D6 /* UnitTests.xctest */ = { - isa = PBXReferenceProxy; - fileType = wrapper.cfbundle; - path = UnitTests.xctest; - remoteRef = C3D4148A1A7D836300B6F5D6 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - C3D4148D1A7D836300B6F5D6 /* CorePlot.framework */ = { - isa = PBXReferenceProxy; - fileType = wrapper.framework; - path = CorePlot.framework; - remoteRef = C3D4148C1A7D836300B6F5D6 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - C3D4148F1A7D836300B6F5D6 /* UnitTests iOS.xctest */ = { - isa = PBXReferenceProxy; - fileType = wrapper.cfbundle; - path = "UnitTests iOS.xctest"; - remoteRef = C3D4148E1A7D836300B6F5D6 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - C3D414911A7D836300B6F5D6 /* libCorePlot-CocoaTouch.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libCorePlot-CocoaTouch.a"; - remoteRef = C3D414901A7D836300B6F5D6 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - C3D414931A7D836300B6F5D6 /* CorePlot-CocoaTouchTests.xctest */ = { - isa = PBXReferenceProxy; - fileType = wrapper.cfbundle; - path = "CorePlot-CocoaTouchTests.xctest"; - remoteRef = C3D414921A7D836300B6F5D6 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; -/* End PBXReferenceProxy section */ - -/* Begin PBXResourcesBuildPhase section */ - 1D60588D0D05DD3D006BFB54 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 280E754D0DD40C5E005A515E /* FlipsideView.xib in Resources */, - 280E754E0DD40C5E005A515E /* MainView.xib in Resources */, - C3D3936C19FD6B1D00148319 /* Images.xcassets in Resources */, - 280E754F0DD40C5E005A515E /* MainWindow.xib in Resources */, - ABA5345E0FEB40CE0046A8DA /* AAPL.plist in Resources */, - C3F0BA3919EC9F6300F7CB47 /* Launch Screen.xib in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 1D60588E0D05DD3D006BFB54 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 1D60589B0D05DD56006BFB54 /* main.m in Sources */, - 1D3623260D0F684500981E51 /* AAPLotAppDelegate.m in Sources */, - 289233A60DB2D0840083E9F9 /* FlipsideView.m in Sources */, - 289233AE0DB2D0DB0083E9F9 /* MainViewController.m in Sources */, - 289233AF0DB2D0DB0083E9F9 /* RootViewController.m in Sources */, - 289233B00DB2D0DB0083E9F9 /* FlipsideViewController.m in Sources */, - AB8F94580FDEFA1500E61485 /* APYahooDataPuller.m in Sources */, - 073703570FE5193C006D46AD /* APFinancialData.m in Sources */, - 073703B10FE51E6C006D46AD /* NSDateFormatterExtensions.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 1D6058940D05DD3E006BFB54 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = C3CA9B5819E1F79B008DF7A3 /* CorePlotWarnings.xcconfig */; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; - CLANG_ENABLE_OBJC_ARC = YES; - CODE_SIGN_IDENTITY = "iPhone Developer"; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - GCC_DYNAMIC_NO_PIC = NO; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = AAPLot_Prefix.pch; - HEADER_SEARCH_PATHS = ""; - INFOPLIST_FILE = Info.plist; - OTHER_LDFLAGS = ( - "-ObjC", - "-all_load", - ); - PRODUCT_BUNDLE_IDENTIFIER = "org.CorePlot.${PRODUCT_NAME:identifier}"; - PRODUCT_NAME = AAPLot; - }; - name = Debug; - }; - 1D6058950D05DD3E006BFB54 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = C3CA9B5819E1F79B008DF7A3 /* CorePlotWarnings.xcconfig */; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; - CLANG_ENABLE_OBJC_ARC = YES; - CODE_SIGN_IDENTITY = "iPhone Distribution"; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution"; - COPY_PHASE_STRIP = YES; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = AAPLot_Prefix.pch; - HEADER_SEARCH_PATHS = ""; - INFOPLIST_FILE = Info.plist; - OTHER_LDFLAGS = ( - "-ObjC", - "-all_load", - ); - PRODUCT_BUNDLE_IDENTIFIER = "org.CorePlot.${PRODUCT_NAME:identifier}"; - PRODUCT_NAME = AAPLot; - }; - name = Release; - }; - C01FCF4F08A954540054247B /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = c99; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - HEADER_SEARCH_PATHS = ""; - IPHONEOS_DEPLOYMENT_TARGET = 6.0; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - SYMROOT = "$(SRCROOT)/../../build"; - USER_HEADER_SEARCH_PATHS = "\"${PROJECT_DIR}/../../framework\"/**"; - }; - name = Debug; - }; - C01FCF5008A954540054247B /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - GCC_C_LANGUAGE_STANDARD = c99; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - HEADER_SEARCH_PATHS = ""; - IPHONEOS_DEPLOYMENT_TARGET = 6.0; - SDKROOT = iphoneos; - USER_HEADER_SEARCH_PATHS = "\"${PROJECT_DIR}/../../framework\"/**"; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "AAPLot" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 1D6058940D05DD3E006BFB54 /* Debug */, - 1D6058950D05DD3E006BFB54 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - C01FCF4E08A954540054247B /* Build configuration list for PBXProject "AAPLot" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - C01FCF4F08A954540054247B /* Debug */, - C01FCF5008A954540054247B /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 29B97313FDCFA39411CA2CEA /* Project object */; -} diff --git a/examples/AAPLot/AAPLot.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/examples/AAPLot/AAPLot.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 0044da799..000000000 --- a/examples/AAPLot/AAPLot.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/examples/AAPLot/AAPLot/Images.xcassets/AppIcon.appiconset/Contents.json b/examples/AAPLot/AAPLot/Images.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index 219a768e8..000000000 --- a/examples/AAPLot/AAPLot/Images.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "images" : [ - { - "size" : "29x29", - "idiom" : "iphone", - "filename" : "Icon-Small.png", - "scale" : "1x" - }, - { - "size" : "29x29", - "idiom" : "iphone", - "filename" : "Icon-Small@2x.png", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "29x29", - "scale" : "3x" - }, - { - "size" : "40x40", - "idiom" : "iphone", - "filename" : "Icon-Spotlight-40@2x.png", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "40x40", - "scale" : "3x" - }, - { - "size" : "57x57", - "idiom" : "iphone", - "filename" : "Icon.png", - "scale" : "1x" - }, - { - "size" : "57x57", - "idiom" : "iphone", - "filename" : "Icon@2x.png", - "scale" : "2x" - }, - { - "size" : "60x60", - "idiom" : "iphone", - "filename" : "Icon-60@2x.png", - "scale" : "2x" - }, - { - "size" : "60x60", - "idiom" : "iphone", - "filename" : "Icon-60@3x.png", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/examples/AAPLot/AAPLot/Images.xcassets/AppIcon.appiconset/Icon-60@2x.png b/examples/AAPLot/AAPLot/Images.xcassets/AppIcon.appiconset/Icon-60@2x.png deleted file mode 100644 index 489d32b6c..000000000 Binary files a/examples/AAPLot/AAPLot/Images.xcassets/AppIcon.appiconset/Icon-60@2x.png and /dev/null differ diff --git a/examples/AAPLot/AAPLot/Images.xcassets/AppIcon.appiconset/Icon-60@3x.png b/examples/AAPLot/AAPLot/Images.xcassets/AppIcon.appiconset/Icon-60@3x.png deleted file mode 100644 index e732a791c..000000000 Binary files a/examples/AAPLot/AAPLot/Images.xcassets/AppIcon.appiconset/Icon-60@3x.png and /dev/null differ diff --git a/examples/AAPLot/AAPLot/Images.xcassets/AppIcon.appiconset/Icon-Small.png b/examples/AAPLot/AAPLot/Images.xcassets/AppIcon.appiconset/Icon-Small.png deleted file mode 100644 index 0310c42a8..000000000 Binary files a/examples/AAPLot/AAPLot/Images.xcassets/AppIcon.appiconset/Icon-Small.png and /dev/null differ diff --git a/examples/AAPLot/AAPLot/Images.xcassets/AppIcon.appiconset/Icon-Small@2x.png b/examples/AAPLot/AAPLot/Images.xcassets/AppIcon.appiconset/Icon-Small@2x.png deleted file mode 100644 index 8170f07ca..000000000 Binary files a/examples/AAPLot/AAPLot/Images.xcassets/AppIcon.appiconset/Icon-Small@2x.png and /dev/null differ diff --git a/examples/AAPLot/AAPLot/Images.xcassets/AppIcon.appiconset/Icon-Spotlight-40@2x.png b/examples/AAPLot/AAPLot/Images.xcassets/AppIcon.appiconset/Icon-Spotlight-40@2x.png deleted file mode 100644 index c7fba2304..000000000 Binary files a/examples/AAPLot/AAPLot/Images.xcassets/AppIcon.appiconset/Icon-Spotlight-40@2x.png and /dev/null differ diff --git a/examples/AAPLot/AAPLot/Images.xcassets/AppIcon.appiconset/Icon.png b/examples/AAPLot/AAPLot/Images.xcassets/AppIcon.appiconset/Icon.png deleted file mode 100644 index ca3d9f35b..000000000 Binary files a/examples/AAPLot/AAPLot/Images.xcassets/AppIcon.appiconset/Icon.png and /dev/null differ diff --git a/examples/AAPLot/AAPLot/Images.xcassets/AppIcon.appiconset/Icon@2x.png b/examples/AAPLot/AAPLot/Images.xcassets/AppIcon.appiconset/Icon@2x.png deleted file mode 100644 index d67508c07..000000000 Binary files a/examples/AAPLot/AAPLot/Images.xcassets/AppIcon.appiconset/Icon@2x.png and /dev/null differ diff --git a/examples/AAPLot/AAPLot_Prefix.pch b/examples/AAPLot/AAPLot_Prefix.pch deleted file mode 100644 index dc5f28052..000000000 --- a/examples/AAPLot/AAPLot_Prefix.pch +++ /dev/null @@ -1,10 +0,0 @@ -// -// Prefix header for all source files of the 'AAPLot' target in the 'AAPLot' project -// - -#define DEBUG (1) - -#ifdef __OBJC__ - #import - #import -#endif diff --git a/examples/AAPLot/APFinancialData.h b/examples/AAPLot/APFinancialData.h deleted file mode 100644 index 33e36b158..000000000 --- a/examples/AAPLot/APFinancialData.h +++ /dev/null @@ -1,7 +0,0 @@ -#import "CorePlot-CocoaTouch.h" - -@interface NSDictionary(APFinancialData) - -+(nonnull CPTDictionary *)dictionaryWithCSVLine:(nonnull NSString *)csvLine; - -@end diff --git a/examples/AAPLot/APFinancialData.m b/examples/AAPLot/APFinancialData.m deleted file mode 100644 index a5b443092..000000000 --- a/examples/AAPLot/APFinancialData.m +++ /dev/null @@ -1,34 +0,0 @@ -#import "APFinancialData.h" -#import "NSDateFormatterExtensions.h" - -@implementation NSDictionary(APFinancialData) - -+(nonnull CPTDictionary *)dictionaryWithCSVLine:(nonnull NSString *)csvLine -{ - CPTStringArray *csvChunks = [csvLine componentsSeparatedByString:@","]; - - CPTMutableDictionary *csvDict = [NSMutableDictionary dictionaryWithCapacity:7]; - - // Date,Open,High,Low,Close,Volume,Adj Close - // 2009-06-08,143.82,144.23,139.43,143.85,33255400,143.85 - NSDate *theDate = [[NSDateFormatter csvDateFormatter] dateFromString:csvChunks[0]]; - - csvDict[@"date"] = theDate; - NSDecimalNumber *theOpen = [NSDecimalNumber decimalNumberWithString:csvChunks[1]]; - csvDict[@"open"] = theOpen; - NSDecimalNumber *theHigh = [NSDecimalNumber decimalNumberWithString:csvChunks[2]]; - csvDict[@"high"] = theHigh; - NSDecimalNumber *theLow = [NSDecimalNumber decimalNumberWithString:csvChunks[3]]; - csvDict[@"low"] = theLow; - NSDecimalNumber *theClose = [NSDecimalNumber decimalNumberWithString:csvChunks[4]]; - csvDict[@"close"] = theClose; - NSDecimalNumber *theVolume = [NSDecimalNumber decimalNumberWithString:csvChunks[5]]; - csvDict[@"volume"] = theVolume; - NSDecimalNumber *theAdjClose = [NSDecimalNumber decimalNumberWithString:csvChunks[6]]; - csvDict[@"adjClose"] = theAdjClose; - - // non-mutable autoreleased dict - return [NSDictionary dictionaryWithDictionary:csvDict]; -} - -@end diff --git a/examples/AAPLot/APYahooDataPuller.h b/examples/AAPLot/APYahooDataPuller.h deleted file mode 100644 index 77f7bc2d7..000000000 --- a/examples/AAPLot/APYahooDataPuller.h +++ /dev/null @@ -1,35 +0,0 @@ -#import "APFinancialData.h" - -@class APYahooDataPuller; - -typedef NSArray CPTFinancialDataArray; - -@protocol APYahooDataPullerDelegate - -@optional - --(void)dataPullerDidFinishFetch:(nonnull APYahooDataPuller *)dp; - -@end - -#pragma mark - - -@interface APYahooDataPuller : NSObject - -@property (nonatomic, readwrite, weak, nullable) id delegate; -@property (nonatomic, readwrite, copy, nonnull) NSString *symbol; -@property (nonatomic, readwrite, strong, nonnull) NSDate *startDate; -@property (nonatomic, readwrite, strong, nonnull) NSDate *endDate; -@property (nonatomic, readwrite, copy, nonnull) NSString *targetSymbol; -@property (nonatomic, readwrite, strong, nonnull) NSDate *targetStartDate; -@property (nonatomic, readwrite, strong, nonnull) NSDate *targetEndDate; -@property (nonatomic, readonly, strong, nonnull) CPTFinancialDataArray *financialData; -@property (nonatomic, readonly, strong, nonnull) NSDecimalNumber *overallHigh; -@property (nonatomic, readonly, strong, nonnull) NSDecimalNumber *overallLow; -@property (nonatomic, readonly, strong, nonnull) NSDecimalNumber *overallVolumeHigh; -@property (nonatomic, readonly, strong, nonnull) NSDecimalNumber *overallVolumeLow; -@property (nonatomic, readonly, assign) BOOL loadingData; - --(nonnull instancetype)initWithTargetSymbol:(nonnull NSString *)aSymbol targetStartDate:(nonnull NSDate *)aStartDate targetEndDate:(nonnull NSDate *)anEndDate; - -@end diff --git a/examples/AAPLot/APYahooDataPuller.m b/examples/AAPLot/APYahooDataPuller.m deleted file mode 100644 index 89c1dfdaf..000000000 --- a/examples/AAPLot/APYahooDataPuller.m +++ /dev/null @@ -1,421 +0,0 @@ -#import "APFinancialData.h" -#import "APYahooDataPuller.h" - -@interface APYahooDataPuller() - -@property (nonatomic, readwrite, copy, nonnull) NSString *csvString; - -@property (nonatomic, readwrite, strong, nonnull) NSDecimalNumber *overallHigh; -@property (nonatomic, readwrite, strong, nonnull) NSDecimalNumber *overallLow; -@property (nonatomic, readwrite, strong, nonnull) NSDecimalNumber *overallVolumeHigh; -@property (nonatomic, readwrite, strong, nonnull) NSDecimalNumber *overallVolumeLow; -@property (nonatomic, readwrite, strong, nonnull) CPTFinancialDataArray *financialData; - -@property (nonatomic, readwrite, assign) BOOL loadingData; -@property (nonatomic, readwrite, strong, nullable) NSMutableData *receivedData; -@property (nonatomic, readwrite, strong, nullable) NSURLConnection *connection; - --(nonnull instancetype)initWithDictionary:(nonnull CPTDictionary *)aDict targetSymbol:(nonnull NSString *)aSymbol targetStartDate:(nonnull NSDate *)aStartDate targetEndDate:(nonnull NSDate *)anEndDate; - --(nonnull CPTDictionary *)plistRep; --(BOOL)writeToFile:(nonnull NSString *)path atomically:(BOOL)flag; --(void)fetch; --(BOOL)shouldDownload; --(nonnull NSString *)pathForSymbol:(nonnull NSString *)aSymbol; --(nonnull NSString *)faultTolerantPathForSymbol:(nonnull NSString *)aSymbol; --(nonnull CPTDictionary *)dictionaryForSymbol:(nonnull NSString *)aSymbol; --(nonnull NSString *)URL; --(void)notifyPulledData; --(void)parseCSVAndPopulate; - -NSTimeInterval timeIntervalForNumberOfWeeks(double numberOfWeeks); - -@end - -#pragma mark - - -NSTimeInterval timeIntervalForNumberOfWeeks(double numberOfWeeks) -{ - NSTimeInterval seconds = fabs(60.0 * 60.0 * 24.0 * 7.0 * numberOfWeeks); - - return seconds; -} - -@implementation APYahooDataPuller - -@synthesize symbol; -@synthesize startDate; -@synthesize endDate; -@synthesize targetStartDate; -@synthesize targetEndDate; -@synthesize targetSymbol; -@synthesize overallLow; -@synthesize overallHigh; -@synthesize overallVolumeHigh; -@synthesize overallVolumeLow; -@synthesize csvString; -@synthesize financialData; - -@synthesize receivedData; -@synthesize connection; -@synthesize loadingData; - -@synthesize delegate; - --(void)setDelegate:(id)aDelegate -{ - if ( delegate != aDelegate ) { - delegate = aDelegate; - if ( self.financialData.count > 0 ) { - [self notifyPulledData]; // loads cached data onto UI - } - } -} - --(nonnull CPTDictionary *)plistRep -{ - CPTMutableDictionary *rep = [NSMutableDictionary dictionaryWithCapacity:7]; - - rep[@"symbol"] = self.symbol; - rep[@"startDate"] = self.startDate; - rep[@"endDate"] = self.endDate; - rep[@"overallHigh"] = self.overallHigh; - rep[@"overallLow"] = self.overallLow; - rep[@"overallVolumeHigh"] = self.overallVolumeHigh; - rep[@"overallVolumeLow"] = self.overallVolumeLow; - rep[@"financialData"] = self.financialData; - - return [NSDictionary dictionaryWithDictionary:rep]; -} - --(BOOL)writeToFile:(nonnull NSString *)path atomically:(BOOL)flag -{ - NSLog(@"writeToFile:%@", path); - BOOL success = [[self plistRep] writeToFile:path atomically:flag]; - return success; -} - --(nonnull instancetype)initWithDictionary:(nonnull CPTDictionary *)aDict targetSymbol:(nonnull NSString *)aSymbol targetStartDate:(nonnull NSDate *)aStartDate targetEndDate:(nonnull NSDate *)anEndDate -{ - self = [super init]; - if ( self != nil ) { - NSString *theSymbol = aDict[@"symbol"]; - self.symbol = theSymbol ? theSymbol : @""; - NSDate *theStartDate = aDict[@"startDate"]; - self.startDate = theStartDate ? theStartDate : [NSDate date]; - NSDate *theEndDate = aDict[@"endDate"]; - self.endDate = theEndDate ? theEndDate : [NSDate date]; - NSNumber *low = aDict[@"overallLow"]; - self.overallLow = low ? [NSDecimalNumber decimalNumberWithDecimal:low.decimalValue] : [NSDecimalNumber notANumber]; - NSNumber *high = aDict[@"overallHigh"]; - self.overallHigh = high ? [NSDecimalNumber decimalNumberWithDecimal:high.decimalValue] : [NSDecimalNumber notANumber]; - NSNumber *volumeLow = aDict[@"overallVolumeLow"]; - self.overallVolumeLow = low ? [NSDecimalNumber decimalNumberWithDecimal:volumeLow.decimalValue] : [NSDecimalNumber notANumber]; - NSNumber *volumeHigh = aDict[@"overallVolumeHigh"]; - self.overallVolumeHigh = high ? [NSDecimalNumber decimalNumberWithDecimal:volumeHigh.decimalValue] : [NSDecimalNumber notANumber]; - CPTFinancialDataArray *dataArray = aDict[@"financialData"]; - self.financialData = dataArray ? dataArray : [[NSArray alloc] init]; - - self.targetSymbol = aSymbol; - self.targetStartDate = aStartDate; - self.targetEndDate = anEndDate; - self.csvString = @""; - - [self performSelector:@selector(fetch) withObject:nil afterDelay:0.01]; - } - return self; -} - --(nonnull NSString *)pathForSymbol:(nonnull NSString *)aSymbol -{ - CPTStringArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); - NSString *documentsDirectory = paths[0]; - NSString *docPath = [documentsDirectory stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.plist", aSymbol]]; - - return docPath; -} - --(nonnull NSString *)faultTolerantPathForSymbol:(nonnull NSString *)aSymbol -{ - NSString *docPath = [self pathForSymbol:aSymbol]; - - if ( ![[NSFileManager defaultManager] fileExistsAtPath:docPath] ) { - // if there isn't one in the user's documents directory, see if we ship with this data - docPath = [[NSBundle mainBundle].resourcePath stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.plist", aSymbol]]; - } - return docPath; -} - -// Always returns *something* --(nonnull CPTDictionary *)dictionaryForSymbol:(nonnull NSString *)aSymbol -{ - NSString *path = [self faultTolerantPathForSymbol:aSymbol]; - - CPTMutableDictionary *localPlistDict = [NSMutableDictionary dictionaryWithContentsOfFile:path]; - - return localPlistDict; -} - --(nonnull instancetype)initWithTargetSymbol:(nonnull NSString *)aSymbol targetStartDate:(nonnull NSDate *)aStartDate targetEndDate:(nonnull NSDate *)anEndDate -{ - CPTDictionary *cachedDictionary = [self dictionaryForSymbol:aSymbol]; - - if ( nil != cachedDictionary ) { - return [self initWithDictionary:cachedDictionary targetSymbol:aSymbol targetStartDate:aStartDate targetEndDate:anEndDate]; - } - - CPTMutableDictionary *rep = [NSMutableDictionary dictionaryWithCapacity:7]; - rep[@"symbol"] = aSymbol; - rep[@"startDate"] = aStartDate; - rep[@"endDate"] = anEndDate; - rep[@"overallHigh"] = [NSDecimalNumber notANumber]; - rep[@"overallLow"] = [NSDecimalNumber notANumber]; - rep[@"overallVolumeHigh"] = [NSDecimalNumber notANumber]; - rep[@"overallVolumeLow"] = [NSDecimalNumber notANumber]; - rep[@"financialData"] = @[]; - - return [self initWithDictionary:rep targetSymbol:aSymbol targetStartDate:aStartDate targetEndDate:anEndDate]; -} - --(nonnull instancetype)init -{ - NSTimeInterval secondsAgo = -timeIntervalForNumberOfWeeks(14.0); // 12 weeks ago - NSDate *start = [NSDate dateWithTimeIntervalSinceNow:secondsAgo]; - - NSDate *end = [NSDate date]; - - return [self initWithTargetSymbol:@"GOOG" targetStartDate:start targetEndDate:end]; -} - --(void)dealloc -{ - delegate = nil; -} - -// http://www.goldb.org/ystockquote.html --(nonnull NSString *)URL -{ - NSUInteger unitFlags = NSCalendarUnitMonth | NSCalendarUnitDay | NSCalendarUnitYear; - - NSCalendar *gregorian = [[NSCalendar alloc] - initWithCalendarIdentifier:NSCalendarIdentifierGregorian]; - - NSString *url = [NSString stringWithFormat:@"https://ichart.yahoo.com/table.csv?s=%@&", self.targetSymbol]; - - NSDate *tStartDate = self.targetStartDate; - - if ( tStartDate ) { - NSDateComponents *compsStart = [gregorian components:unitFlags fromDate:tStartDate]; - - url = [url stringByAppendingFormat:@"a=%ld&", (long)compsStart.month - 1]; - url = [url stringByAppendingFormat:@"b=%ld&", (long)compsStart.day]; - url = [url stringByAppendingFormat:@"c=%ld&", (long)compsStart.year]; - } - - NSDate *tEndDate = self.targetEndDate; - if ( tEndDate ) { - NSDateComponents *compsEnd = [gregorian components:unitFlags fromDate:tEndDate]; - - url = [url stringByAppendingFormat:@"d=%ld&", (long)compsEnd.month - 1]; - url = [url stringByAppendingFormat:@"e=%ld&", (long)compsEnd.day]; - url = [url stringByAppendingFormat:@"f=%ld&", (long)compsEnd.year]; - } - - url = [url stringByAppendingString:@"g=d&"]; - - url = [url stringByAppendingString:@"ignore=.csv"]; - url = [url stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; - - return url; -} - --(void)notifyPulledData -{ - id theDelegate = self.delegate; - - if ( [theDelegate respondsToSelector:@selector(dataPullerDidFinishFetch:)] ) { - [theDelegate performSelector:@selector(dataPullerDidFinishFetch:) withObject:self]; - } -} - -#pragma mark - -#pragma mark Downloading of data - --(BOOL)shouldDownload -{ - BOOL shouldDownload = YES; - - return shouldDownload; -} - --(void)fetch -{ - if ( self.loadingData ) { - return; - } - - if ( [self shouldDownload] ) { - self.loadingData = YES; - NSString *urlString = [self URL]; - NSLog(@"URL = %@", urlString); - NSURL *url = [NSURL URLWithString:urlString]; - NSURLRequest *theRequest = [NSURLRequest requestWithURL:url - cachePolicy:NSURLRequestUseProtocolCachePolicy - timeoutInterval:60.0]; - - // create the connection with the request - // and start loading the data - self.connection = [NSURLConnection connectionWithRequest:theRequest delegate:self]; - if ( self.connection ) { - self.receivedData = [NSMutableData data]; - } - else { - // TODO: Inform the user that the download could not be started - self.loadingData = NO; - } - } -} - --(void)connection:(nonnull NSURLConnection *)connection didReceiveData:(nonnull NSData *)data -{ - // append the new data to the receivedData - [self.receivedData appendData:data]; -} - --(void)connection:(nonnull NSURLConnection *)connection didReceiveResponse:(nonnull NSURLResponse *)response -{ - // this method is called when the server has determined that it - // has enough information to create the NSURLResponse - // it can be called multiple times, for example in the case of a - // redirect, so each time we reset the data. - self.receivedData.length = 0; -} - --(void)cancelDownload -{ - if ( self.loadingData ) { - [self.connection cancel]; - self.loadingData = NO; - - self.receivedData = nil; - self.connection = nil; - } -} - --(void)connection:(nonnull NSURLConnection *)connection didFailWithError:(nonnull NSError *)error -{ - self.loadingData = NO; - self.receivedData = nil; - self.connection = nil; - NSLog(@"err = %@", error.localizedDescription); - // TODO:report err -} - --(void)connectionDidFinishLoading:(nonnull NSURLConnection *)connection -{ - self.loadingData = NO; - self.connection = nil; - - NSMutableData *data = self.receivedData; - if ( data ) { - NSString *csv = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; - self.csvString = csv; - } - else { - self.csvString = @""; - } - - self.receivedData = nil; - [self parseCSVAndPopulate]; - - // see if we need to write to file - CPTDictionary *dictionaryForSymbol = [self dictionaryForSymbol:self.symbol]; - - BOOL sameSymbol = NO; - NSString *dictSymbol = dictionaryForSymbol[@"symbol"]; - if ( dictSymbol ) { - sameSymbol = [self.symbol isEqualToString:dictSymbol]; - } - - BOOL sameStart = NO; - NSDate *dictStart = dictionaryForSymbol[@"startDate"]; - if ( dictStart ) { - sameStart = ([self.startDate compare:dictStart] != NSOrderedSame); - } - - BOOL sameEnd = NO; - NSDate *dictEnd = dictionaryForSymbol[@"endDate"]; - if ( dictEnd ) { - sameEnd = ([self.startDate compare:dictEnd] != NSOrderedSame); - } - - if ( !sameSymbol || !sameStart || !sameEnd ) { - [self writeToFile:[self pathForSymbol:self.symbol] atomically:YES]; - } - else { - NSLog(@"Not writing to file -- No Need, its data is fresh."); - } -} - --(void)parseCSVAndPopulate -{ - CPTStringArray *csvLines = [self.csvString componentsSeparatedByCharactersInSet:[NSCharacterSet newlineCharacterSet]]; - - NSMutableArray *newFinancials = [NSMutableArray arrayWithCapacity:csvLines.count]; - CPTDictionary *currentFinancial = nil; - NSString *line = nil; - - self.overallHigh = [NSDecimalNumber notANumber]; - self.overallLow = [NSDecimalNumber notANumber]; - self.overallVolumeHigh = [NSDecimalNumber notANumber]; - self.overallVolumeLow = [NSDecimalNumber notANumber]; - - for ( NSUInteger i = 1; i < csvLines.count - 1; i++ ) { - line = csvLines[i]; - currentFinancial = [NSDictionary dictionaryWithCSVLine:line]; - [newFinancials addObject:currentFinancial]; - - NSDecimalNumber *high = currentFinancial[@"high"]; - NSDecimalNumber *low = currentFinancial[@"low"]; - NSDecimalNumber *volume = currentFinancial[@"volume"]; - - if ( [self.overallHigh isEqual:[NSDecimalNumber notANumber]] ) { - self.overallHigh = high; - } - - if ( [self.overallLow isEqual:[NSDecimalNumber notANumber]] ) { - self.overallLow = low; - } - - if ( [low compare:self.overallLow] == NSOrderedAscending ) { - self.overallLow = low; - } - if ( [high compare:self.overallHigh] == NSOrderedDescending ) { - self.overallHigh = high; - } - - if ( [self.overallVolumeHigh isEqual:[NSDecimalNumber notANumber]] ) { - self.overallVolumeHigh = volume; - } - - if ( [self.overallVolumeLow isEqual:[NSDecimalNumber notANumber]] ) { - self.overallVolumeLow = volume; - } - - if ( [volume compare:self.overallVolumeLow] == NSOrderedAscending ) { - self.overallVolumeLow = volume; - } - - if ( [volume compare:self.overallVolumeHigh] == NSOrderedDescending ) { - self.overallVolumeHigh = volume; - } - } - self.startDate = self.targetStartDate; - self.endDate = self.targetEndDate; - self.symbol = self.targetSymbol; - - self.financialData = [NSArray arrayWithArray:newFinancials]; - [self notifyPulledData]; -} - -@end diff --git a/examples/AAPLot/Classes/AAPLotAppDelegate.h b/examples/AAPLot/Classes/AAPLotAppDelegate.h deleted file mode 100644 index 13e1ab5d5..000000000 --- a/examples/AAPLot/Classes/AAPLotAppDelegate.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// AAPLotAppDelegate.h -// AAPLot -// -// Created by Jonathan Saggau on 6/9/09. -// Copyright Sounds Broken inc. 2009. All rights reserved. -// - -#import - -@class RootViewController; - -@interface AAPLotAppDelegate : NSObject - -@property (nonatomic, strong, nullable) IBOutlet UIWindow *window; -@property (nonatomic, strong, nullable) IBOutlet RootViewController *rootViewController; - -@end diff --git a/examples/AAPLot/Classes/AAPLotAppDelegate.m b/examples/AAPLot/Classes/AAPLotAppDelegate.m deleted file mode 100644 index 0ab940279..000000000 --- a/examples/AAPLot/Classes/AAPLotAppDelegate.m +++ /dev/null @@ -1,23 +0,0 @@ -// -// AAPLotAppDelegate.m -// AAPLot -// -// Created by Jonathan Saggau on 6/9/09. -// Copyright Sounds Broken inc. 2009. All rights reserved. -// - -#import "AAPLotAppDelegate.h" -#import "RootViewController.h" - -@implementation AAPLotAppDelegate - -@synthesize window; -@synthesize rootViewController; - --(void)applicationDidFinishLaunching:(nonnull UIApplication *)application -{ - self.window.rootViewController = self.rootViewController; - [self.window makeKeyAndVisible]; -} - -@end diff --git a/examples/AAPLot/Classes/FlipsideView.h b/examples/AAPLot/Classes/FlipsideView.h deleted file mode 100644 index 26746ed6f..000000000 --- a/examples/AAPLot/Classes/FlipsideView.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// FlipsideView.h -// AAPLot -// -// Created by Jonathan Saggau on 6/9/09. -// Copyright Sounds Broken inc. 2009. All rights reserved. -// - -#import - -@interface FlipsideView : UIView { -} - -@end diff --git a/examples/AAPLot/Classes/FlipsideView.m b/examples/AAPLot/Classes/FlipsideView.m deleted file mode 100644 index 179b28f9d..000000000 --- a/examples/AAPLot/Classes/FlipsideView.m +++ /dev/null @@ -1,26 +0,0 @@ -// -// FlipsideView.m -// AAPLot -// -// Created by Jonathan Saggau on 6/9/09. -// Copyright Sounds Broken inc. 2009. All rights reserved. -// - -#import "FlipsideView.h" - -@implementation FlipsideView - --(nonnull instancetype)initWithFrame:(CGRect)frame -{ - if ( (self = [super initWithFrame:frame]) ) { - // Initialization code - } - return self; -} - --(void)drawRect:(CGRect)rect -{ - // Drawing code -} - -@end diff --git a/examples/AAPLot/Classes/FlipsideViewController.h b/examples/AAPLot/Classes/FlipsideViewController.h deleted file mode 100644 index ae62c708e..000000000 --- a/examples/AAPLot/Classes/FlipsideViewController.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// FlipsideViewController.h -// AAPLot -// -// Created by Jonathan Saggau on 6/9/09. -// Copyright Sounds Broken inc. 2009. All rights reserved. -// - -#import - -@interface FlipsideViewController : UIViewController { -} - -@end diff --git a/examples/AAPLot/Classes/FlipsideViewController.m b/examples/AAPLot/Classes/FlipsideViewController.m deleted file mode 100644 index 3758a24b3..000000000 --- a/examples/AAPLot/Classes/FlipsideViewController.m +++ /dev/null @@ -1,39 +0,0 @@ -// -// FlipsideViewController.m -// AAPLot -// -// Created by Jonathan Saggau on 6/9/09. -// Copyright Sounds Broken inc. 2009. All rights reserved. -// - -#import "FlipsideViewController.h" - -@implementation FlipsideViewController - --(void)viewDidLoad -{ - [super viewDidLoad]; - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - if ( [UIColor respondsToSelector:@selector(viewFlipsideBackgroundColor)] ) { - self.view.backgroundColor = [UIColor viewFlipsideBackgroundColor]; - } -#pragma clang diagnostic pop -} - -/* - * // Override to allow orientations other than the default portrait orientation. - * - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { - * // Return YES for supported orientations - * return (interfaceOrientation == UIInterfaceOrientationPortrait); - * } - */ - --(void)didReceiveMemoryWarning -{ - [super didReceiveMemoryWarning]; // Releases the view if it doesn't have a superview - // Release anything that's not essential, such as cached data -} - -@end diff --git a/examples/AAPLot/Classes/MainViewController.h b/examples/AAPLot/Classes/MainViewController.h deleted file mode 100644 index ef107f67a..000000000 --- a/examples/AAPLot/Classes/MainViewController.h +++ /dev/null @@ -1,13 +0,0 @@ -#import "APYahooDataPuller.h" -#import "CorePlot-CocoaTouch.h" -#import - -@class CPTGraphHostingView; -@class APYahooDataPuller; -@class CPTXYGraph; - -@interface MainViewController : UIViewController - -@property (nonatomic, readwrite, strong, nullable) IBOutlet CPTGraphHostingView *graphHost; - -@end diff --git a/examples/AAPLot/Classes/MainViewController.m b/examples/AAPLot/Classes/MainViewController.m deleted file mode 100644 index 4f4424ff9..000000000 --- a/examples/AAPLot/Classes/MainViewController.m +++ /dev/null @@ -1,674 +0,0 @@ -#import "APFinancialData.h" -#import "APYahooDataPuller.h" -#import "MainViewController.h" - -#define ROWS_FIRST_DATA_ORDER 1 - -@interface MainViewController() - -@property (nonatomic, readwrite, strong, nullable) CPTXYGraph *graph; -@property (nonatomic, readwrite, strong, nonnull) APYahooDataPuller *datapuller; - -@end - -@implementation MainViewController - -@synthesize graph; -@synthesize datapuller; -@synthesize graphHost; - --(void)setView:(UIView *)aView -{ - super.view = aView; - if ( nil == aView ) { - self.graph = nil; - self.graphHost = nil; - } -} - --(void)viewDidLoad -{ - CPTXYGraph *newGraph = [[CPTXYGraph alloc] initWithFrame:self.view.bounds]; - CPTTheme *theme = [CPTTheme themeNamed:kCPTStocksTheme]; - - [newGraph applyTheme:theme]; - self.graph = newGraph; - - newGraph.paddingRight = 50.0; - newGraph.paddingLeft = 50.0; - newGraph.plotAreaFrame.masksToBorder = NO; - newGraph.plotAreaFrame.cornerRadius = 0.0; - - CPTMutableLineStyle *borderLineStyle = [CPTMutableLineStyle lineStyle]; - borderLineStyle.lineColor = [CPTColor whiteColor]; - borderLineStyle.lineWidth = 2.0; - newGraph.plotAreaFrame.borderLineStyle = borderLineStyle; - self.graphHost.hostedGraph = newGraph; - - // Axes - CPTXYAxisSet *xyAxisSet = (CPTXYAxisSet *)newGraph.axisSet; - CPTXYAxis *xAxis = xyAxisSet.xAxis; - CPTMutableLineStyle *lineStyle = [xAxis.axisLineStyle mutableCopy]; - lineStyle.lineCap = kCGLineCapButt; - xAxis.axisLineStyle = lineStyle; - xAxis.labelingPolicy = CPTAxisLabelingPolicyNone; - - CPTXYAxis *yAxis = xyAxisSet.yAxis; - yAxis.axisLineStyle = nil; - - // Line plot with gradient fill - CPTScatterPlot *dataSourceLinePlot = [[CPTScatterPlot alloc] initWithFrame:newGraph.bounds]; - dataSourceLinePlot.identifier = @"Data Source Plot"; - dataSourceLinePlot.dataLineStyle = nil; - dataSourceLinePlot.dataSource = self; - dataSourceLinePlot.cachePrecision = CPTPlotCachePrecisionDouble; - [newGraph addPlot:dataSourceLinePlot]; - - CPTColor *areaColor = [CPTColor colorWithComponentRed:CPTFloat(1.0) green:CPTFloat(1.0) blue:CPTFloat(1.0) alpha:CPTFloat(0.6)]; - CPTGradient *areaGradient = [CPTGradient gradientWithBeginningColor:areaColor endingColor:[CPTColor clearColor]]; - areaGradient.angle = -90.0; - CPTFill *areaGradientFill = [CPTFill fillWithGradient:areaGradient]; - dataSourceLinePlot.areaFill = areaGradientFill; - dataSourceLinePlot.areaBaseValue = @200.0; - - areaColor = [CPTColor colorWithComponentRed:CPTFloat(0.0) green:CPTFloat(1.0) blue:CPTFloat(0.0) alpha:CPTFloat(0.6)]; - areaGradient = [CPTGradient gradientWithBeginningColor:[CPTColor clearColor] endingColor:areaColor]; - areaGradient.angle = -90.0; - areaGradientFill = [CPTFill fillWithGradient:areaGradient]; - dataSourceLinePlot.areaFill2 = areaGradientFill; - dataSourceLinePlot.areaBaseValue2 = @400.0; - - // OHLC plot - CPTMutableLineStyle *whiteLineStyle = [CPTMutableLineStyle lineStyle]; - whiteLineStyle.lineColor = [CPTColor whiteColor]; - whiteLineStyle.lineWidth = 1.0; - CPTTradingRangePlot *ohlcPlot = [[CPTTradingRangePlot alloc] initWithFrame:newGraph.bounds]; - ohlcPlot.identifier = @"OHLC"; - ohlcPlot.lineStyle = whiteLineStyle; - CPTMutableTextStyle *whiteTextStyle = [CPTMutableTextStyle textStyle]; - whiteTextStyle.color = [CPTColor whiteColor]; - whiteTextStyle.fontSize = 8.0; - ohlcPlot.labelTextStyle = whiteTextStyle; - ohlcPlot.labelOffset = 5.0; - ohlcPlot.stickLength = 2.0; - ohlcPlot.dataSource = self; - ohlcPlot.plotStyle = CPTTradingRangePlotStyleOHLC; - ohlcPlot.cachePrecision = CPTPlotCachePrecisionDecimal; - [newGraph addPlot:ohlcPlot]; - - // Add plot space for bar chart - CPTXYPlotSpace *volumePlotSpace = [[CPTXYPlotSpace alloc] init]; - volumePlotSpace.identifier = @"Volume Plot Space"; - [newGraph addPlotSpace:volumePlotSpace]; - - // Volume plot - CPTBarPlot *volumePlot = [CPTBarPlot tubularBarPlotWithColor:[CPTColor blackColor] horizontalBars:NO]; - volumePlot.dataSource = self; - - lineStyle = [volumePlot.lineStyle mutableCopy]; - lineStyle.lineColor = [CPTColor whiteColor]; - volumePlot.lineStyle = lineStyle; - - volumePlot.fill = nil; - volumePlot.barWidth = @1.0; - volumePlot.identifier = @"Volume Plot"; - volumePlot.cachePrecision = CPTPlotCachePrecisionDouble; - [newGraph addPlot:volumePlot toPlotSpace:volumePlotSpace]; - - // Data puller - NSDate *start = [NSDate dateWithTimeIntervalSinceNow:-60.0 * 60.0 * 24.0 * 7.0 * 12.0]; // 12 weeks ago - NSDate *end = [NSDate date]; - APYahooDataPuller *dp = [[APYahooDataPuller alloc] initWithTargetSymbol:@"AAPL" targetStartDate:start targetEndDate:end]; - self.datapuller = dp; - dp.delegate = self; - - [super viewDidLoad]; -} - --(nonnull instancetype)initWithNibName:(nullable NSString *)nibNameOrNil bundle:(nullable NSBundle *)nibBundleOrNil -{ - if ( (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) ) { - } - return self; -} - -#pragma mark - -#pragma mark Plot Data Source Methods - --(NSUInteger)numberOfRecordsForPlot:(nonnull CPTPlot *)plot -{ - return self.datapuller.financialData.count; -} - -#if ROWS_FIRST_DATA_ORDER - --(nullable CPTNumericData *)dataForPlot:(nonnull CPTPlot *)plot recordIndexRange:(NSRange)indexRange -{ - CPTFinancialDataArray *financialData = self.datapuller.financialData; - const NSUInteger financialDataCount = financialData.count; - - const BOOL useDoubles = plot.doublePrecisionCache; - - NSUInteger numFields = plot.numberOfFields; - - if ( [plot.identifier isEqual:@"Volume Plot"] ) { - numFields = 2; - } - - NSMutableData *data = [[NSMutableData alloc] initWithLength:indexRange.length * numFields * ( useDoubles ? sizeof(double) : sizeof(NSDecimal) )]; - - const NSUInteger maxIndex = NSMaxRange(indexRange); - - if ( [plot.identifier isEqual:@"Data Source Plot"] ) { - if ( useDoubles ) { - double *nextValue = data.mutableBytes; - - for ( NSUInteger i = indexRange.location; i < maxIndex; i++ ) { - CPTDictionary *fData = financialData[financialDataCount - i - 1]; - NSNumber *value; - - for ( NSUInteger fieldEnum = 0; fieldEnum < numFields; fieldEnum++ ) { - switch ( fieldEnum ) { - case CPTScatterPlotFieldX: - *nextValue++ = (double)(i + 1); - break; - - case CPTScatterPlotFieldY: - value = fData[@"close"]; - NSAssert(value, @"Close value was nil"); - *nextValue++ = value.doubleValue; - break; - - default: - break; - } - } - } - } - else { - NSDecimal *nextValue = data.mutableBytes; - - for ( NSUInteger i = indexRange.location; i < maxIndex; i++ ) { - CPTDictionary *fData = financialData[financialDataCount - i - 1]; - NSNumber *value; - - for ( NSUInteger fieldEnum = 0; fieldEnum < numFields; fieldEnum++ ) { - switch ( fieldEnum ) { - case CPTScatterPlotFieldX: - *nextValue++ = CPTDecimalFromUnsignedInteger(i + 1); - break; - - case CPTScatterPlotFieldY: - value = fData[@"close"]; - NSAssert(value, @"Close value was nil"); - *nextValue++ = value.decimalValue; - break; - - default: - break; - } - } - } - } - } - else if ( [plot.identifier isEqual:@"Volume Plot"] ) { - if ( useDoubles ) { - double *nextValue = data.mutableBytes; - - for ( NSUInteger i = indexRange.location; i < maxIndex; i++ ) { - CPTDictionary *fData = financialData[financialDataCount - i - 1]; - NSNumber *value; - - for ( NSUInteger fieldEnum = 0; fieldEnum < numFields; fieldEnum++ ) { - switch ( fieldEnum ) { - case CPTBarPlotFieldBarLocation: - *nextValue++ = (double)(i + 1); - break; - - case CPTBarPlotFieldBarTip: - value = fData[@"volume"]; - NSAssert(value, @"Volume value was nil"); - *nextValue++ = value.doubleValue; - break; - - default: - break; - } - } - } - } - else { - NSDecimal *nextValue = data.mutableBytes; - - for ( NSUInteger i = indexRange.location; i < maxIndex; i++ ) { - CPTDictionary *fData = financialData[financialDataCount - i - 1]; - NSNumber *value; - - for ( NSUInteger fieldEnum = 0; fieldEnum < numFields; fieldEnum++ ) { - switch ( fieldEnum ) { - case CPTBarPlotFieldBarLocation: - *nextValue++ = CPTDecimalFromUnsignedInteger(i + 1); - break; - - case CPTBarPlotFieldBarTip: - value = fData[@"volume"]; - NSAssert(value, @"Volume value was nil"); - *nextValue++ = value.decimalValue; - break; - - default: - break; - } - } - } - } - } - else { - if ( useDoubles ) { - double *nextValue = data.mutableBytes; - - for ( NSUInteger i = indexRange.location; i < maxIndex; i++ ) { - CPTDictionary *fData = financialData[financialDataCount - i - 1]; - NSNumber *value; - - for ( NSUInteger fieldEnum = 0; fieldEnum < numFields; fieldEnum++ ) { - switch ( fieldEnum ) { - case CPTTradingRangePlotFieldX: - *nextValue++ = (double)(i + 1); - break; - - case CPTTradingRangePlotFieldOpen: - value = fData[@"open"]; - NSAssert(value, @"Open value was nil"); - *nextValue++ = value.doubleValue; - break; - - case CPTTradingRangePlotFieldHigh: - value = fData[@"high"]; - NSAssert(value, @"High value was nil"); - *nextValue++ = value.doubleValue; - break; - - case CPTTradingRangePlotFieldLow: - value = fData[@"low"]; - NSAssert(value, @"Low value was nil"); - *nextValue++ = value.doubleValue; - break; - - case CPTTradingRangePlotFieldClose: - value = fData[@"close"]; - NSAssert(value, @"Close value was nil"); - *nextValue++ = value.doubleValue; - break; - - default: - break; - } - } - } - } - else { - NSDecimal *nextValue = data.mutableBytes; - - for ( NSUInteger i = indexRange.location; i < maxIndex; i++ ) { - CPTDictionary *fData = financialData[financialDataCount - i - 1]; - NSNumber *value; - - for ( NSUInteger fieldEnum = 0; fieldEnum < numFields; fieldEnum++ ) { - switch ( fieldEnum ) { - case CPTTradingRangePlotFieldX: - *nextValue++ = CPTDecimalFromUnsignedInteger(i + 1); - break; - - case CPTTradingRangePlotFieldOpen: - value = fData[@"open"]; - NSAssert(value, @"Open value was nil"); - *nextValue++ = value.decimalValue; - break; - - case CPTTradingRangePlotFieldHigh: - value = fData[@"high"]; - NSAssert(value, @"High value was nil"); - *nextValue++ = value.decimalValue; - break; - - case CPTTradingRangePlotFieldLow: - value = fData[@"low"]; - NSAssert(value, @"Low value was nil"); - *nextValue++ = value.decimalValue; - break; - - case CPTTradingRangePlotFieldClose: - value = fData[@"close"]; - NSAssert(value, @"Close value was nil"); - *nextValue++ = value.decimalValue; - break; - - default: - break; - } - } - } - } - } - - CPTMutableNumericData *numericData = [CPTMutableNumericData numericDataWithData:data - dataType:(useDoubles ? plot.doubleDataType : plot.decimalDataType) - shape:@[@(indexRange.length), - @(numFields)] - dataOrder:CPTDataOrderRowsFirst]; - - return numericData; -} - -#else - --(nullable CPTNumericData *)dataForPlot:(nonnull CPTPlot *)plot recordIndexRange:(NSRange)indexRange -{ - CPTFinancialDataArray *financialData = self.datapuller.financialData; - const NSUInteger financialDataCount = financialData.count; - - const BOOL useDoubles = plot.doublePrecisionCache; - - NSUInteger numFields = plot.numberOfFields; - - if ( [plot.identifier isEqual:@"Volume Plot"] ) { - numFields = 2; - } - - NSMutableData *data = [[NSMutableData alloc] initWithLength:indexRange.length * numFields * ( useDoubles ? sizeof(double) : sizeof(NSDecimal) )]; - - const NSUInteger maxIndex = NSMaxRange(indexRange); - - if ( [plot.identifier isEqual:@"Data Source Plot"] ) { - if ( useDoubles ) { - double *nextValue = data.mutableBytes; - - for ( int fieldEnum = 0; fieldEnum < numFields; fieldEnum++ ) { - for ( NSUInteger i = indexRange.location; i < maxIndex; i++ ) { - CPTDictionary *fData = (CPTDictionary *)[financialData objectAtIndex:financialDataCount - i - 1]; - NSNumber *value; - - switch ( fieldEnum ) { - case CPTScatterPlotFieldX: - *nextValue++ = (double)(i + 1); - break; - - case CPTScatterPlotFieldY: - value = [fData objectForKey:@"close"]; - NSAssert(value, @"Close value was nil"); - *nextValue++ = [value doubleValue]; - break; - - default: - break; - } - } - } - } - else { - NSDecimal *nextValue = data.mutableBytes; - - for ( int fieldEnum = 0; fieldEnum < numFields; fieldEnum++ ) { - for ( NSUInteger i = indexRange.location; i < maxIndex; i++ ) { - CPTDictionary *fData = (CPTDictionary *)[financialData objectAtIndex:financialDataCount - i - 1]; - NSNumber *value; - - switch ( fieldEnum ) { - case CPTScatterPlotFieldX: - *nextValue++ = CPTDecimalFromUnsignedInteger(i + 1); - break; - - case CPTScatterPlotFieldY: - value = [fData objectForKey:@"close"]; - NSAssert(value, @"Close value was nil"); - *nextValue++ = [value decimalValue]; - break; - - default: - break; - } - } - } - } - } - else if ( [plot.identifier isEqual:@"Volume Plot"] ) { - if ( useDoubles ) { - double *nextValue = data.mutableBytes; - - for ( int fieldEnum = 0; fieldEnum < numFields; fieldEnum++ ) { - for ( NSUInteger i = indexRange.location; i < maxIndex; i++ ) { - CPTDictionary *fData = (CPTDictionary *)[financialData objectAtIndex:financialDataCount - i - 1]; - NSNumber *value; - - switch ( fieldEnum ) { - case CPTBarPlotFieldBarLocation: - *nextValue++ = (double)(i + 1); - break; - - case CPTBarPlotFieldBarTip: - value = [fData objectForKey:@"volume"]; - NSAssert(value, @"Volume value was nil"); - *nextValue++ = [value doubleValue]; - break; - - default: - break; - } - } - } - } - else { - NSDecimal *nextValue = data.mutableBytes; - - for ( int fieldEnum = 0; fieldEnum < numFields; fieldEnum++ ) { - for ( NSUInteger i = indexRange.location; i < maxIndex; i++ ) { - CPTDictionary *fData = (CPTDictionary *)[financialData objectAtIndex:financialDataCount - i - 1]; - NSNumber *value; - - switch ( fieldEnum ) { - case CPTBarPlotFieldBarLocation: - *nextValue++ = CPTDecimalFromUnsignedInteger(i + 1); - break; - - case CPTBarPlotFieldBarTip: - value = [fData objectForKey:@"volume"]; - NSAssert(value, @"Volume value was nil"); - *nextValue++ = [value decimalValue]; - break; - - default: - break; - } - } - } - } - } - else { - if ( useDoubles ) { - double *nextValue = data.mutableBytes; - - for ( int fieldEnum = 0; fieldEnum < numFields; fieldEnum++ ) { - for ( NSUInteger i = indexRange.location; i < maxIndex; i++ ) { - CPTDictionary *fData = (CPTDictionary *)[financialData objectAtIndex:financialDataCount - i - 1]; - NSNumber *value; - - switch ( fieldEnum ) { - case CPTTradingRangePlotFieldX: - *nextValue++ = (double)(i + 1); - break; - - case CPTTradingRangePlotFieldOpen: - value = [fData objectForKey:@"open"]; - NSAssert(value, @"Open value was nil"); - *nextValue++ = [value doubleValue]; - break; - - case CPTTradingRangePlotFieldHigh: - value = [fData objectForKey:@"high"]; - NSAssert(value, @"High value was nil"); - *nextValue++ = [value doubleValue]; - break; - - case CPTTradingRangePlotFieldLow: - value = [fData objectForKey:@"low"]; - NSAssert(value, @"Low value was nil"); - *nextValue++ = [value doubleValue]; - break; - - case CPTTradingRangePlotFieldClose: - value = [fData objectForKey:@"close"]; - NSAssert(value, @"Close value was nil"); - *nextValue++ = [value doubleValue]; - break; - - default: - break; - } - } - } - } - else { - NSDecimal *nextValue = data.mutableBytes; - - for ( int fieldEnum = 0; fieldEnum < numFields; fieldEnum++ ) { - for ( NSUInteger i = indexRange.location; i < maxIndex; i++ ) { - CPTDictionary *fData = (CPTDictionary *)[financialData objectAtIndex:financialDataCount - i - 1]; - NSNumber *value; - - switch ( fieldEnum ) { - case CPTTradingRangePlotFieldX: - *nextValue++ = CPTDecimalFromUnsignedInteger(i + 1); - break; - - case CPTTradingRangePlotFieldOpen: - value = [fData objectForKey:@"open"]; - NSAssert(value, @"Open value was nil"); - *nextValue++ = [value decimalValue]; - break; - - case CPTTradingRangePlotFieldHigh: - value = [fData objectForKey:@"high"]; - NSAssert(value, @"High value was nil"); - *nextValue++ = [value decimalValue]; - break; - - case CPTTradingRangePlotFieldLow: - value = [fData objectForKey:@"low"]; - NSAssert(value, @"Low value was nil"); - *nextValue++ = [value decimalValue]; - break; - - case CPTTradingRangePlotFieldClose: - value = [fData objectForKey:@"close"]; - NSAssert(value, @"Close value was nil"); - *nextValue++ = [value decimalValue]; - break; - - default: - break; - } - } - } - } - } - - CPTMutableNumericData *numericData = [CPTMutableNumericData numericDataWithData:data - dataType:(useDoubles ? plot.doubleDataType : plot.decimalDataType) - shape:@[@(indexRange.length), @(numFields)] - dataOrder:CPTDataOrderColumnsFirst]; - [data release]; - - return numericData; -} -#endif - --(nullable CPTLayer *)dataLabelForPlot:(nonnull CPTPlot *)plot recordIndex:(NSUInteger)index -{ - if ( ![(NSString *) plot.identifier isEqualToString:@"OHLC"] ) { - return (id)[NSNull null]; // Don't show any label - } - else if ( index % 5 ) { - return (id)[NSNull null]; - } - else { - return nil; // Use default label style - } -} - --(void)dataPullerDidFinishFetch:(nonnull APYahooDataPuller *)dp -{ - static CPTAnimationOperation *animationOperation = nil; - - CPTXYPlotSpace *plotSpace = (CPTXYPlotSpace *)self.graph.defaultPlotSpace; - CPTXYPlotSpace *volumePlotSpace = (CPTXYPlotSpace *)[self.graph plotSpaceWithIdentifier:@"Volume Plot Space"]; - - APYahooDataPuller *thePuller = self.datapuller; - - NSDecimalNumber *high = thePuller.overallHigh; - NSDecimalNumber *low = thePuller.overallLow; - NSDecimalNumber *length = [high decimalNumberBySubtracting:low]; - - NSLog(@"high = %@, low = %@, length = %@", high, low, length); - NSDecimalNumber *pricePlotSpaceDisplacementPercent = [NSDecimalNumber decimalNumberWithMantissa:33 - exponent:-2 - isNegative:NO]; - - NSDecimalNumber *lengthDisplacementValue = [length decimalNumberByMultiplyingBy:pricePlotSpaceDisplacementPercent]; - NSDecimalNumber *lowDisplayLocation = [low decimalNumberBySubtracting:lengthDisplacementValue]; - NSDecimalNumber *lengthDisplayLocation = [length decimalNumberByAdding:lengthDisplacementValue]; - - plotSpace.xRange = [CPTPlotRange plotRangeWithLocation:@0.0 length:@(thePuller.financialData.count + 1)]; - plotSpace.yRange = [CPTPlotRange plotRangeWithLocation:lowDisplayLocation length:lengthDisplayLocation]; - - CPTScatterPlot *linePlot = (CPTScatterPlot *)[self.graph plotWithIdentifier:@"Data Source Plot"]; - linePlot.areaBaseValue = high; - linePlot.areaBaseValue2 = low; - - // Axes - CPTXYAxisSet *axisSet = (CPTXYAxisSet *)self.graph.axisSet; - - NSDecimalNumber *overallVolumeHigh = thePuller.overallVolumeHigh; - NSDecimalNumber *overallVolumeLow = thePuller.overallVolumeLow; - NSDecimalNumber *volumeLength = [overallVolumeHigh decimalNumberBySubtracting:overallVolumeLow]; - - // make the length aka height for y 3 times more so that we get a 1/3 area covered by volume - NSDecimalNumber *volumePlotSpaceDisplacementPercent = [NSDecimalNumber decimalNumberWithMantissa:3 - exponent:0 - isNegative:NO]; - - NSDecimalNumber *volumeLengthDisplacementValue = [volumeLength decimalNumberByMultiplyingBy:volumePlotSpaceDisplacementPercent]; - NSDecimalNumber *volumeLowDisplayLocation = overallVolumeLow; - NSDecimalNumber *volumeLengthDisplayLocation = [volumeLength decimalNumberByAdding:volumeLengthDisplacementValue]; - - volumePlotSpace.xRange = [CPTPlotRange plotRangeWithLocation:@0.0 length:@(thePuller.financialData.count + 1)]; - - if ( animationOperation ) { - [[CPTAnimation sharedInstance] removeAnimationOperation:animationOperation]; - } - - if ( volumeLowDisplayLocation && volumeLengthDisplayLocation ) { - animationOperation = [CPTAnimation animate:volumePlotSpace - property:@"yRange" - fromPlotRange:[CPTPlotRange plotRangeWithLocationDecimal:volumeLowDisplayLocation.decimalValue - lengthDecimal:CPTDecimalMultiply( volumeLengthDisplayLocation.decimalValue, CPTDecimalFromInteger(10) )] - toPlotRange:[CPTPlotRange plotRangeWithLocation:volumeLowDisplayLocation - length:volumeLengthDisplayLocation] - duration:2.5]; - } - else { - volumePlotSpace.yRange = [CPTPlotRange plotRangeWithLocation:volumeLowDisplayLocation length:volumeLengthDisplayLocation]; - } - - axisSet.xAxis.orthogonalPosition = low; - axisSet.yAxis.majorIntervalLength = @50.0; - axisSet.yAxis.minorTicksPerInterval = 4; - axisSet.yAxis.orthogonalPosition = @1.0; - CPTPlotRangeArray *exclusionRanges = @[[CPTPlotRange plotRangeWithLocation:@0.0 length:low]]; - - axisSet.yAxis.labelExclusionRanges = exclusionRanges; - - [self.graph reloadData]; -} - -@end diff --git a/examples/AAPLot/Classes/RootViewController.h b/examples/AAPLot/Classes/RootViewController.h deleted file mode 100644 index 0c2f2d472..000000000 --- a/examples/AAPLot/Classes/RootViewController.h +++ /dev/null @@ -1,23 +0,0 @@ -// -// RootViewController.h -// AAPLot -// -// Created by Jonathan Saggau on 6/9/09. -// Copyright Sounds Broken inc. 2009. All rights reserved. -// - -#import - -@class MainViewController; -@class FlipsideViewController; - -@interface RootViewController : UIViewController - -@property (nonatomic, strong, nullable) IBOutlet UIButton *infoButton; -@property (nonatomic, strong, nonnull) MainViewController *mainViewController; -@property (nonatomic, strong, nonnull) UINavigationBar *flipsideNavigationBar; -@property (nonatomic, strong, nonnull) FlipsideViewController *flipsideViewController; - --(IBAction)toggleView; - -@end diff --git a/examples/AAPLot/Classes/RootViewController.m b/examples/AAPLot/Classes/RootViewController.m deleted file mode 100644 index 9f53bd403..000000000 --- a/examples/AAPLot/Classes/RootViewController.m +++ /dev/null @@ -1,112 +0,0 @@ -// -// RootViewController.m -// AAPLot -// -// Created by Jonathan Saggau on 6/9/09. -// Copyright Sounds Broken inc. 2009. All rights reserved. -// - -#import "FlipsideViewController.h" -#import "MainViewController.h" -#import "RootViewController.h" - -@implementation RootViewController - -@synthesize infoButton; -@synthesize flipsideNavigationBar; -@synthesize mainViewController; -@synthesize flipsideViewController; - --(void)viewDidLoad -{ - [super viewDidLoad]; - MainViewController *viewController = [[MainViewController alloc] initWithNibName:@"MainView" bundle:nil]; - self.mainViewController = viewController; - - UIButton *button = self.infoButton; - if ( button ) { - [self.view insertSubview:viewController.view belowSubview:button]; - } - self.mainViewController.view.frame = self.view.bounds; -} - --(void)loadFlipsideViewController -{ - FlipsideViewController *viewController = [[FlipsideViewController alloc] initWithNibName:@"FlipsideView" bundle:nil]; - - self.flipsideViewController = viewController; - - self.flipsideViewController.view.frame = self.view.bounds; - - // Set up the navigation bar - UINavigationBar *aNavigationBar = [[UINavigationBar alloc] initWithFrame:CGRectMake(0.0, 0.0, 320.0, 44.0)]; - aNavigationBar.barStyle = UIBarStyleBlackOpaque; - self.flipsideNavigationBar = aNavigationBar; - - UIBarButtonItem *buttonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone - target:self - action:@selector(toggleView)]; - UINavigationItem *navigationItem = [[UINavigationItem alloc] initWithTitle:@"AAPLot"]; - navigationItem.rightBarButtonItem = buttonItem; - [self.flipsideNavigationBar pushNavigationItem:navigationItem animated:NO]; -} - --(IBAction)toggleView -{ - /* - * This method is called when the info or Done button is pressed. - * It flips the displayed view from the main view to the flipside view and vice-versa. - */ - if ( self.flipsideViewController == nil ) { - [self loadFlipsideViewController]; - } - - UIView *mainView = self.mainViewController.view; - UIView *flipsideView = self.flipsideViewController.view; - - [UIView beginAnimations:nil context:NULL]; - [UIView setAnimationDuration:1]; - UIViewAnimationTransition transition = (mainView.superview ? UIViewAnimationTransitionFlipFromRight : UIViewAnimationTransitionFlipFromLeft); - [UIView setAnimationTransition:transition forView:self.view cache:YES]; - - if ( mainView.superview != nil ) { - [self.flipsideViewController viewWillAppear:YES]; - [self.mainViewController viewWillDisappear:YES]; - [mainView removeFromSuperview]; - [self.infoButton removeFromSuperview]; - [self.view addSubview:flipsideView]; - [self.view insertSubview:self.flipsideNavigationBar aboveSubview:flipsideView]; - [self.mainViewController viewDidDisappear:YES]; - [self.flipsideViewController viewDidAppear:YES]; - } - else { - [self.mainViewController viewWillAppear:YES]; - [self.flipsideViewController viewWillDisappear:YES]; - [flipsideView removeFromSuperview]; - [self.flipsideNavigationBar removeFromSuperview]; - [self.view addSubview:mainView]; - UIButton *button = self.infoButton; - if ( button ) { - [self.view insertSubview:button aboveSubview:self.mainViewController.view]; - } - [self.flipsideViewController viewDidDisappear:YES]; - [self.mainViewController viewDidAppear:YES]; - } - [UIView commitAnimations]; -} - -/* - * // Override to allow orientations other than the default portrait orientation. - * - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { - * // Return YES for supported orientations - * return (interfaceOrientation == UIInterfaceOrientationPortrait); - * } - */ - --(void)didReceiveMemoryWarning -{ - [super didReceiveMemoryWarning]; // Releases the view if it doesn't have a superview - // Release anything that's not essential, such as cached data -} - -@end diff --git a/examples/AAPLot/FlipsideView.xib b/examples/AAPLot/FlipsideView.xib deleted file mode 100644 index 165ced2e7..000000000 --- a/examples/AAPLot/FlipsideView.xib +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/AAPLot/Info.plist b/examples/AAPLot/Info.plist deleted file mode 100644 index 63610f927..000000000 --- a/examples/AAPLot/Info.plist +++ /dev/null @@ -1,49 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleDisplayName - ${PRODUCT_NAME} - CFBundleExecutable - ${EXECUTABLE_NAME} - CFBundleIcons~ipad - - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - ${PRODUCT_NAME} - CFBundlePackageType - APPL - CFBundleSignature - ???? - CFBundleVersion - 1.0 - LSRequiresIPhoneOS - - NSAppTransportSecurity - - NSExceptionDomains - - ichart.yahoo.com - - NSExceptionAllowsInsecureHTTPLoads - - NSExceptionRequiresForwardSecrecy - - - - - NSMainNibFile - MainWindow - UILaunchStoryboardName - Launch Screen - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - - - diff --git a/examples/AAPLot/Launch Screen.xib b/examples/AAPLot/Launch Screen.xib deleted file mode 100644 index f8672842a..000000000 --- a/examples/AAPLot/Launch Screen.xib +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/AAPLot/MainView.xib b/examples/AAPLot/MainView.xib deleted file mode 100644 index e968aa1ef..000000000 --- a/examples/AAPLot/MainView.xib +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/AAPLot/MainWindow.xib b/examples/AAPLot/MainWindow.xib deleted file mode 100644 index 182fe85d1..000000000 --- a/examples/AAPLot/MainWindow.xib +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/AAPLot/NSDateFormatterExtensions.h b/examples/AAPLot/NSDateFormatterExtensions.h deleted file mode 100644 index 380cd36e4..000000000 --- a/examples/AAPLot/NSDateFormatterExtensions.h +++ /dev/null @@ -1,7 +0,0 @@ -#import - -@interface NSDateFormatter(APExtensions) - -+(nonnull NSDateFormatter *)csvDateFormatter; - -@end diff --git a/examples/AAPLot/NSDateFormatterExtensions.m b/examples/AAPLot/NSDateFormatterExtensions.m deleted file mode 100644 index 53e754d36..000000000 --- a/examples/AAPLot/NSDateFormatterExtensions.m +++ /dev/null @@ -1,18 +0,0 @@ -#import "NSDateFormatterExtensions.h" - -@implementation NSDateFormatter(APExtensions) - -+(nonnull NSDateFormatter *)csvDateFormatter -{ - static NSDateFormatter *df = nil; - static dispatch_once_t onceToken = 0; - - dispatch_once(&onceToken, ^{ - df = [[NSDateFormatter alloc] init]; - df.dateFormat = @"yyyy-MM-dd"; - }); - - return df; -} - -@end diff --git a/examples/AAPLot/main.m b/examples/AAPLot/main.m deleted file mode 100644 index 9098265c6..000000000 --- a/examples/AAPLot/main.m +++ /dev/null @@ -1,10 +0,0 @@ -#import - -int main(int argc, char *argv[]) -{ - @autoreleasepool { - int retVal = UIApplicationMain(argc, argv, nil, nil); - - return retVal; - } -} diff --git a/examples/CPTTestApp-iPad/CPTTestApp_iPad-Info.plist b/examples/CPTTestApp-iPad/Base.lproj/CPTTestApp_iPad-Info.plist similarity index 95% rename from examples/CPTTestApp-iPad/CPTTestApp_iPad-Info.plist rename to examples/CPTTestApp-iPad/Base.lproj/CPTTestApp_iPad-Info.plist index f0cf9adbd..65b56f8c5 100644 --- a/examples/CPTTestApp-iPad/CPTTestApp_iPad-Info.plist +++ b/examples/CPTTestApp-iPad/Base.lproj/CPTTestApp_iPad-Info.plist @@ -18,6 +18,8 @@ ${PRODUCT_NAME} CFBundlePackageType APPL + CFBundleShortVersionString + 1.0 CFBundleSignature ???? CFBundleVersion diff --git a/examples/CPTTestApp-iPad/CPTTestApp_iPadViewController.xib b/examples/CPTTestApp-iPad/Base.lproj/CPTTestApp_iPadViewController.xib similarity index 100% rename from examples/CPTTestApp-iPad/CPTTestApp_iPadViewController.xib rename to examples/CPTTestApp-iPad/Base.lproj/CPTTestApp_iPadViewController.xib diff --git a/examples/CPTTestApp-iPad/Launch Screen.xib b/examples/CPTTestApp-iPad/Base.lproj/Launch Screen.xib similarity index 66% rename from examples/CPTTestApp-iPad/Launch Screen.xib rename to examples/CPTTestApp-iPad/Base.lproj/Launch Screen.xib index 31b1b876d..84090add7 100644 --- a/examples/CPTTestApp-iPad/Launch Screen.xib +++ b/examples/CPTTestApp-iPad/Base.lproj/Launch Screen.xib @@ -1,8 +1,12 @@ - - + + + + + - - + + + @@ -11,14 +15,14 @@ - - + diff --git a/examples/CPTTestApp-iPad/MainWindow.xib b/examples/CPTTestApp-iPad/Base.lproj/MainWindow.xib similarity index 100% rename from examples/CPTTestApp-iPad/MainWindow.xib rename to examples/CPTTestApp-iPad/Base.lproj/MainWindow.xib diff --git a/examples/CPTTestApp-iPad/CPTTestApp-iPad.xcodeproj/project.pbxproj b/examples/CPTTestApp-iPad/CPTTestApp-iPad.xcodeproj/project.pbxproj index c9104df7c..afd032e09 100644 --- a/examples/CPTTestApp-iPad/CPTTestApp-iPad.xcodeproj/project.pbxproj +++ b/examples/CPTTestApp-iPad/CPTTestApp-iPad.xcodeproj/project.pbxproj @@ -12,12 +12,11 @@ 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; }; 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; }; 288765A50DF7441C002DB57D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765A40DF7441C002DB57D /* CoreGraphics.framework */; }; - 2899E5220DE3E06400AC0155 /* CPTTestApp_iPadViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2899E5210DE3E06400AC0155 /* CPTTestApp_iPadViewController.xib */; }; - 28AD733F0D9D9553002E5188 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 28AD733E0D9D9553002E5188 /* MainWindow.xib */; }; 28D7ACF80DDB3853001CB0EB /* CPTTestApp_iPadViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 28D7ACF70DDB3853001CB0EB /* CPTTestApp_iPadViewController.m */; }; BC65758F116549890008F594 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BC65758E116549890008F594 /* QuartzCore.framework */; }; - C34677AE19F3341700429A85 /* Launch Screen.xib in Resources */ = {isa = PBXBuildFile; fileRef = C34677AD19F3341700429A85 /* Launch Screen.xib */; }; - C3CD283917DE9C59008EED1E /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3CD283817DE9C59008EED1E /* Accelerate.framework */; }; + C3D0A1F520E019BF00BA2921 /* CPTTestApp_iPadViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = C3D0A1F720E019BF00BA2921 /* CPTTestApp_iPadViewController.xib */; }; + C3D0A20620E019CD00BA2921 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = C3D0A20820E019CD00BA2921 /* MainWindow.xib */; }; + C3D0A20920E019D400BA2921 /* Launch Screen.xib in Resources */ = {isa = PBXBuildFile; fileRef = C3D0A20B20E019D400BA2921 /* Launch Screen.xib */; }; C3D3936019FD670400148319 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C3D3935F19FD670400148319 /* Images.xcassets */; }; C3D414AD1A7D844400B6F5D6 /* libCorePlot-CocoaTouch.a in Frameworks */ = {isa = PBXBuildFile; fileRef = C3D414AA1A7D843800B6F5D6 /* libCorePlot-CocoaTouch.a */; }; C3F47B6E17BF99DE0075181F /* CorePlotIcon.png in Resources */ = {isa = PBXBuildFile; fileRef = C3F47B6C17BF99DE0075181F /* CorePlotIcon.png */; }; @@ -25,6 +24,20 @@ /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ + C31D01E01D10F4FF008C1EF2 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = C3D414951A7D843800B6F5D6 /* CorePlot.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = C37EA6921BC83F2A0091C8F7; + remoteInfo = "CorePlot tvOS"; + }; + C31D01E21D10F4FF008C1EF2 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = C3D414951A7D843800B6F5D6 /* CorePlot.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = C37EA6B71BC83F2D0091C8F7; + remoteInfo = "UnitTests tvOS"; + }; C3D414A11A7D843800B6F5D6 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = C3D414951A7D843800B6F5D6 /* CorePlot.xcodeproj */; @@ -76,17 +89,17 @@ 1D6058910D05DD3D006BFB54 /* CPTTestApp-iPad.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "CPTTestApp-iPad.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 288765A40DF7441C002DB57D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; - 2899E5210DE3E06400AC0155 /* CPTTestApp_iPadViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = CPTTestApp_iPadViewController.xib; sourceTree = ""; }; - 28AD733E0D9D9553002E5188 /* MainWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MainWindow.xib; sourceTree = ""; }; 28D7ACF60DDB3853001CB0EB /* CPTTestApp_iPadViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = CPTTestApp_iPadViewController.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; 28D7ACF70DDB3853001CB0EB /* CPTTestApp_iPadViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = CPTTestApp_iPadViewController.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 32CA4F630368D1EE00C91783 /* CPTTestApp_iPad_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTTestApp_iPad_Prefix.pch; sourceTree = ""; }; - 8D1107310486CEB800E47090 /* CPTTestApp_iPad-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "CPTTestApp_iPad-Info.plist"; plistStructureDefinitionIdentifier = "com.apple.xcode.plist.structure-definition.iphone.info-plist"; sourceTree = ""; }; BC65758E116549890008F594 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; - C34677AD19F3341700429A85 /* Launch Screen.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = "Launch Screen.xib"; sourceTree = ""; }; C36E7CC519DE1C1F00EDEACB /* CorePlotWarnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = CorePlotWarnings.xcconfig; path = ../../framework/xcconfig/CorePlotWarnings.xcconfig; sourceTree = ""; }; + C37A40E120E0320500C4FF48 /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Base; path = "Base.lproj/CPTTestApp_iPad-Info.plist"; sourceTree = ""; }; C3CD283817DE9C59008EED1E /* Accelerate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Accelerate.framework; path = System/Library/Frameworks/Accelerate.framework; sourceTree = SDKROOT; }; + C3D0A20520E019C900BA2921 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/CPTTestApp_iPadViewController.xib; sourceTree = ""; }; + C3D0A20720E019CD00BA2921 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainWindow.xib; sourceTree = ""; }; + C3D0A20A20E019D400BA2921 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = "Base.lproj/Launch Screen.xib"; sourceTree = ""; }; C3D3935F19FD670400148319 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = "CPTTestApp-iPad/Images.xcassets"; sourceTree = ""; }; C3D414951A7D843800B6F5D6 /* CorePlot.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = CorePlot.xcodeproj; path = ../../framework/CorePlot.xcodeproj; sourceTree = ""; }; C3F47B6C17BF99DE0075181F /* CorePlotIcon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = CorePlotIcon.png; sourceTree = ""; }; @@ -102,7 +115,6 @@ 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */, 288765A50DF7441C002DB57D /* CoreGraphics.framework in Frameworks */, BC65758F116549890008F594 /* QuartzCore.framework in Frameworks */, - C3CD283917DE9C59008EED1E /* Accelerate.framework in Frameworks */, C3D414AD1A7D844400B6F5D6 /* libCorePlot-CocoaTouch.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -159,12 +171,12 @@ isa = PBXGroup; children = ( C3D3935F19FD670400148319 /* Images.xcassets */, - 2899E5210DE3E06400AC0155 /* CPTTestApp_iPadViewController.xib */, - 28AD733E0D9D9553002E5188 /* MainWindow.xib */, - C34677AD19F3341700429A85 /* Launch Screen.xib */, + C3D0A1F720E019BF00BA2921 /* CPTTestApp_iPadViewController.xib */, + C3D0A20820E019CD00BA2921 /* MainWindow.xib */, + C3D0A20B20E019D400BA2921 /* Launch Screen.xib */, C3F47B6C17BF99DE0075181F /* CorePlotIcon.png */, C3F47B6D17BF99DE0075181F /* CorePlotIcon@2x.png */, - 8D1107310486CEB800E47090 /* CPTTestApp_iPad-Info.plist */, + C37A40E220E0320500C4FF48 /* CPTTestApp_iPad-Info.plist */, ); name = Resources; sourceTree = ""; @@ -190,6 +202,8 @@ C3D414A81A7D843800B6F5D6 /* UnitTests iOS.xctest */, C3D414AA1A7D843800B6F5D6 /* libCorePlot-CocoaTouch.a */, C3D414AC1A7D843800B6F5D6 /* CorePlot-CocoaTouchTests.xctest */, + C31D01E11D10F4FF008C1EF2 /* CorePlot.framework */, + C31D01E31D10F4FF008C1EF2 /* UnitTests tvOS.xctest */, ); name = Products; sourceTree = ""; @@ -220,17 +234,23 @@ 29B97313FDCFA39411CA2CEA /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0700; + LastUpgradeCheck = 0900; + TargetAttributes = { + 1D6058900D05DD3D006BFB54 = { + DevelopmentTeam = 28ZA45DE7D; + }; + }; }; buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "CPTTestApp-iPad" */; compatibilityVersion = "Xcode 6.3"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 1; knownRegions = ( - English, - Japanese, - French, - German, + Base, + ja, + en, + de, + fr, ); mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */; projectDirPath = ""; @@ -248,6 +268,20 @@ /* End PBXProject section */ /* Begin PBXReferenceProxy section */ + C31D01E11D10F4FF008C1EF2 /* CorePlot.framework */ = { + isa = PBXReferenceProxy; + fileType = wrapper.framework; + path = CorePlot.framework; + remoteRef = C31D01E01D10F4FF008C1EF2 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + C31D01E31D10F4FF008C1EF2 /* UnitTests tvOS.xctest */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = "UnitTests tvOS.xctest"; + remoteRef = C31D01E21D10F4FF008C1EF2 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; C3D414A21A7D843800B6F5D6 /* CorePlot.framework */ = { isa = PBXReferenceProxy; fileType = wrapper.framework; @@ -297,12 +331,12 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 28AD733F0D9D9553002E5188 /* MainWindow.xib in Resources */, - 2899E5220DE3E06400AC0155 /* CPTTestApp_iPadViewController.xib in Resources */, + C3D0A20620E019CD00BA2921 /* MainWindow.xib in Resources */, + C3D0A1F520E019BF00BA2921 /* CPTTestApp_iPadViewController.xib in Resources */, C3F47B6E17BF99DE0075181F /* CorePlotIcon.png in Resources */, C3D3936019FD670400148319 /* Images.xcassets in Resources */, C3F47B6F17BF99DE0075181F /* CorePlotIcon@2x.png in Resources */, - C34677AE19F3341700429A85 /* Launch Screen.xib in Resources */, + C3D0A20920E019D400BA2921 /* Launch Screen.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -321,6 +355,41 @@ }; /* End PBXSourcesBuildPhase section */ +/* Begin PBXVariantGroup section */ + C37A40E220E0320500C4FF48 /* CPTTestApp_iPad-Info.plist */ = { + isa = PBXVariantGroup; + children = ( + C37A40E120E0320500C4FF48 /* Base */, + ); + name = "CPTTestApp_iPad-Info.plist"; + sourceTree = ""; + }; + C3D0A1F720E019BF00BA2921 /* CPTTestApp_iPadViewController.xib */ = { + isa = PBXVariantGroup; + children = ( + C3D0A20520E019C900BA2921 /* Base */, + ); + name = CPTTestApp_iPadViewController.xib; + sourceTree = ""; + }; + C3D0A20820E019CD00BA2921 /* MainWindow.xib */ = { + isa = PBXVariantGroup; + children = ( + C3D0A20720E019CD00BA2921 /* Base */, + ); + name = MainWindow.xib; + sourceTree = ""; + }; + C3D0A20B20E019D400BA2921 /* Launch Screen.xib */ = { + isa = PBXVariantGroup; + children = ( + C3D0A20A20E019D400BA2921 /* Base */, + ); + name = "Launch Screen.xib"; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + /* Begin XCBuildConfiguration section */ 1D6058940D05DD3E006BFB54 /* Debug */ = { isa = XCBuildConfiguration; @@ -333,12 +402,12 @@ CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; + DEVELOPMENT_TEAM = 28ZA45DE7D; GCC_DYNAMIC_NO_PIC = NO; - GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = CPTTestApp_iPad_Prefix.pch; HEADER_SEARCH_PATHS = ""; - INFOPLIST_FILE = "CPTTestApp_iPad-Info.plist"; + INFOPLIST_FILE = "$(SRCROOT)/Base.lproj/CPTTestApp_iPad-Info.plist"; PRODUCT_BUNDLE_IDENTIFIER = org.CorePlot.CPTTestAppiPad; PRODUCT_NAME = "CPTTestApp-iPad"; }; @@ -355,10 +424,11 @@ CODE_SIGN_IDENTITY = "iPhone Distribution"; "CODE_SIGN_IDENTITY[sdk=*]" = "iPhone Distribution"; COPY_PHASE_STRIP = YES; + DEVELOPMENT_TEAM = 28ZA45DE7D; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = CPTTestApp_iPad_Prefix.pch; HEADER_SEARCH_PATHS = ""; - INFOPLIST_FILE = "CPTTestApp_iPad-Info.plist"; + INFOPLIST_FILE = "$(SRCROOT)/Base.lproj/CPTTestApp_iPad-Info.plist"; PRODUCT_BUNDLE_IDENTIFIER = org.CorePlot.CPTTestAppiPad; PRODUCT_NAME = "CPTTestApp-iPad"; VALIDATE_PRODUCT = YES; @@ -367,14 +437,16 @@ }; C01FCF4F08A954540054247B /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = C36E7CC519DE1C1F00EDEACB /* CorePlotWarnings.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = c99; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; HEADER_SEARCH_PATHS = ""; - IPHONEOS_DEPLOYMENT_TARGET = 6.0; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; ONLY_ACTIVE_ARCH = YES; OTHER_LDFLAGS = ( "-ObjC", @@ -383,19 +455,21 @@ SDKROOT = iphoneos; SYMROOT = "$(SRCROOT)/../../build"; TARGETED_DEVICE_FAMILY = 2; - USER_HEADER_SEARCH_PATHS = "\"${PROJECT_DIR}/../../framework\"/**"; + USER_HEADER_SEARCH_PATHS = "\"${PROJECT_DIR}/../../framework\" \"${PROJECT_DIR}/../../framework/Source\" \"${PROJECT_DIR}/../../framework/iPhoneOnly\""; }; name = Debug; }; C01FCF5008A954540054247B /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = C36E7CC519DE1C1F00EDEACB /* CorePlotWarnings.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; GCC_C_LANGUAGE_STANDARD = c99; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = s; HEADER_SEARCH_PATHS = ""; - IPHONEOS_DEPLOYMENT_TARGET = 6.0; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; OTHER_LDFLAGS = ( "-ObjC", @@ -404,7 +478,7 @@ SDKROOT = iphoneos; SYMROOT = "$(SRCROOT)/../../build"; TARGETED_DEVICE_FAMILY = 2; - USER_HEADER_SEARCH_PATHS = "\"${PROJECT_DIR}/../../framework\"/**"; + USER_HEADER_SEARCH_PATHS = "\"${PROJECT_DIR}/../../framework\" \"${PROJECT_DIR}/../../framework/Source\" \"${PROJECT_DIR}/../../framework/iPhoneOnly\""; }; name = Release; }; diff --git a/examples/CPTTestApp-iPad/CPTTestApp-iPad.xcodeproj/xcshareddata/xcschemes/CPTTestApp-iPad.xcscheme b/examples/CPTTestApp-iPad/CPTTestApp-iPad.xcodeproj/xcshareddata/xcschemes/CPTTestApp-iPad.xcscheme index 49bcd378a..8ee44490d 100644 --- a/examples/CPTTestApp-iPad/CPTTestApp-iPad.xcodeproj/xcshareddata/xcschemes/CPTTestApp-iPad.xcscheme +++ b/examples/CPTTestApp-iPad/CPTTestApp-iPad.xcodeproj/xcshareddata/xcschemes/CPTTestApp-iPad.xcscheme @@ -1,6 +1,6 @@ - - - - + + - - -@interface CPTTestApp_iPadViewController : UIViewController +@interface CPTTestApp_iPadViewController : UIViewController @property (nonatomic, readwrite, strong, nonnull) CPTNumberArray *dataForChart; @property (nonatomic, readwrite, strong, nonnull) NSArray *dataForPlot; diff --git a/examples/CPTTestApp-iPad/Classes/CPTTestApp_iPadViewController.m b/examples/CPTTestApp-iPad/Classes/CPTTestApp_iPadViewController.m index d68f56137..4312843d4 100644 --- a/examples/CPTTestApp-iPad/Classes/CPTTestApp_iPadViewController.m +++ b/examples/CPTTestApp-iPad/Classes/CPTTestApp_iPadViewController.m @@ -70,7 +70,7 @@ -(void)viewDidAppear:(BOOL)animated self.piePlotIsRotating = YES; } --(void)animationDidStop:(CAAnimation *)theAnimation finished:(BOOL)flag +-(void)animationDidStop:(CAAnimation *__unused)theAnimation finished:(BOOL __unused)flag { self.piePlotIsRotating = NO; [self.piePlot performSelector:@selector(reloadData) withObject:nil afterDelay:0.4]; @@ -195,7 +195,7 @@ -(void)constructScatterPlot -(void)constructBarChart { - // Create barChart from theme +// Create barChart from theme CPTXYGraph *newGraph = [[CPTXYGraph alloc] initWithFrame:CGRectZero]; CPTTheme *theme = [CPTTheme themeNamed:kCPTDarkGradientTheme]; @@ -211,7 +211,7 @@ -(void)constructBarChart newGraph.paddingRight = 20.0; newGraph.paddingBottom = 80.0; - // Add plot space for horizontal bar charts +// Add plot space for horizontal bar charts CPTXYPlotSpace *plotSpace = (CPTXYPlotSpace *)newGraph.defaultPlotSpace; plotSpace.yRange = [CPTPlotRange plotRangeWithLocation:@0.0 length:@300.0]; plotSpace.xRange = [CPTPlotRange plotRangeWithLocation:@0.0 length:@16.0]; @@ -227,7 +227,7 @@ -(void)constructBarChart x.titleLocation = @7.5; x.titleOffset = 55.0; - // Define some custom labels for the data elements +// Define some custom labels for the data elements x.labelRotation = CPTFloat(M_PI_4); x.labelingPolicy = CPTAxisLabelingPolicyNone; CPTNumberArray *customTickLocations = @[@1, @5, @10, @15]; @@ -254,7 +254,7 @@ -(void)constructBarChart y.titleOffset = 45.0; y.titleLocation = @150.0; - // First bar plot +// First bar plot CPTBarPlot *barPlot = [CPTBarPlot tubularBarPlotWithColor:[CPTColor darkGrayColor] horizontalBars:NO]; barPlot.baseValue = @0.0; barPlot.dataSource = self; @@ -262,7 +262,7 @@ -(void)constructBarChart barPlot.identifier = @"Bar Plot 1"; [newGraph addPlot:barPlot toPlotSpace:plotSpace]; - // Second bar plot +// Second bar plot barPlot = [CPTBarPlot tubularBarPlotWithColor:[CPTColor blueColor] horizontalBars:NO]; barPlot.dataSource = self; barPlot.baseValue = @0.0; @@ -275,7 +275,7 @@ -(void)constructBarChart -(void)constructPieChart { - // Create pieChart from theme +// Create pieChart from theme CPTXYGraph *newGraph = [[CPTXYGraph alloc] initWithFrame:CGRectZero]; CPTTheme *theme = [CPTTheme themeNamed:kCPTDarkGradientTheme]; @@ -293,14 +293,14 @@ -(void)constructPieChart newGraph.axisSet = nil; - // Prepare a radial overlay gradient for shading/gloss +// Prepare a radial overlay gradient for shading/gloss CPTGradient *overlayGradient = [[CPTGradient alloc] init]; overlayGradient.gradientType = CPTGradientTypeRadial; overlayGradient = [overlayGradient addColorStop:[[CPTColor blackColor] colorWithAlphaComponent:CPTFloat(0.0)] atPosition:CPTFloat(0.0)]; overlayGradient = [overlayGradient addColorStop:[[CPTColor blackColor] colorWithAlphaComponent:CPTFloat(0.3)] atPosition:CPTFloat(0.9)]; overlayGradient = [overlayGradient addColorStop:[[CPTColor blackColor] colorWithAlphaComponent:CPTFloat(0.7)] atPosition:CPTFloat(1.0)]; - // Add pie chart +// Add pie chart CPTPieChart *newPlot = [[CPTPieChart alloc] init]; newPlot.dataSource = self; newPlot.pieRadius = 130.0; @@ -313,14 +313,14 @@ -(void)constructPieChart [newGraph addPlot:newPlot]; self.piePlot = newPlot; - // Add some initial data +// Add some initial data self.dataForChart = @[@20.0, @30.0, @(NAN), @60.0]; } #pragma mark - #pragma mark CPTBarPlot delegate method --(void)barPlot:(nonnull CPTBarPlot *)plot barWasSelectedAtRecordIndex:(NSUInteger)index +-(void)barPlot:(nonnull CPTBarPlot *__unused)plot barWasSelectedAtRecordIndex:(NSUInteger)index { NSLog(@"barWasSelectedAtRecordIndex %lu", (unsigned long)index); } @@ -373,7 +373,7 @@ -(nullable id)numberForPlot:(nonnull CPTPlot *)plot field:(NSUInteger)fieldEnum num = @(NAN); } else { - num = @( (index + 1) * (index + 1) ); + num = @((index + 1) * (index + 1)); if ( [plot.identifier isEqual:@"Bar Plot 2"] ) { num = @(num.integerValue - 10); } @@ -385,7 +385,7 @@ -(nullable id)numberForPlot:(nonnull CPTPlot *)plot field:(NSUInteger)fieldEnum if ( index % 8 ) { NSString *key = (fieldEnum == CPTScatterPlotFieldX ? @"x" : @"y"); num = self.dataForPlot[index][key]; - // Green plot gets shifted above the blue +// Green plot gets shifted above the blue if ( [(NSString *) plot.identifier isEqualToString:@"Green Plot"] ) { if ( fieldEnum == CPTScatterPlotFieldY ) { num = @(num.doubleValue + 1.0); @@ -410,7 +410,7 @@ -(nullable CPTLayer *)dataLabelForPlot:(nonnull CPTPlot *)plot recordIndex:(NSUI static dispatch_once_t onceToken = 0; dispatch_once(&onceToken, ^{ - whiteText = [[CPTMutableTextStyle alloc] init]; + whiteText = [[CPTMutableTextStyle alloc] init]; whiteText.color = [CPTColor whiteColor]; }); diff --git a/examples/CPTTestApp-iPhone/BarChart.xib b/examples/CPTTestApp-iPhone/BarChart.xib deleted file mode 100644 index 08a16b67e..000000000 --- a/examples/CPTTestApp-iPhone/BarChart.xib +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/CPTTestApp-iPhone/Base.lproj/BarChart.xib b/examples/CPTTestApp-iPhone/Base.lproj/BarChart.xib new file mode 100644 index 000000000..646ef95c3 --- /dev/null +++ b/examples/CPTTestApp-iPhone/Base.lproj/BarChart.xib @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/CPTTestApp-iPhone/Info.plist b/examples/CPTTestApp-iPhone/Base.lproj/Info.plist similarity index 95% rename from examples/CPTTestApp-iPhone/Info.plist rename to examples/CPTTestApp-iPhone/Base.lproj/Info.plist index 5e25306a4..3f5c82874 100644 --- a/examples/CPTTestApp-iPhone/Info.plist +++ b/examples/CPTTestApp-iPhone/Base.lproj/Info.plist @@ -18,6 +18,8 @@ ${PRODUCT_NAME} CFBundlePackageType APPL + CFBundleShortVersionString + 1.0 CFBundleSignature ???? CFBundleVersion diff --git a/examples/CPTTestApp-iPhone/Launch Screen.xib b/examples/CPTTestApp-iPhone/Base.lproj/Launch Screen.xib similarity index 66% rename from examples/CPTTestApp-iPhone/Launch Screen.xib rename to examples/CPTTestApp-iPhone/Base.lproj/Launch Screen.xib index 4529d82e3..b51d6d522 100644 --- a/examples/CPTTestApp-iPhone/Launch Screen.xib +++ b/examples/CPTTestApp-iPhone/Base.lproj/Launch Screen.xib @@ -1,8 +1,12 @@ - - + + + + + - - + + + @@ -11,14 +15,14 @@ - - + diff --git a/examples/CPTTestApp-iPhone/MainWindow.xib b/examples/CPTTestApp-iPhone/Base.lproj/MainWindow.xib similarity index 77% rename from examples/CPTTestApp-iPhone/MainWindow.xib rename to examples/CPTTestApp-iPhone/Base.lproj/MainWindow.xib index eb90ba470..19255ec6e 100644 --- a/examples/CPTTestApp-iPhone/MainWindow.xib +++ b/examples/CPTTestApp-iPhone/Base.lproj/MainWindow.xib @@ -1,7 +1,10 @@ - - + + + - + + + @@ -16,19 +19,18 @@ - - + + - - + + - - + @@ -45,6 +47,7 @@ + @@ -52,9 +55,4 @@ - - - - - diff --git a/examples/CPTTestApp-iPhone/Base.lproj/PieChart.xib b/examples/CPTTestApp-iPhone/Base.lproj/PieChart.xib new file mode 100644 index 000000000..840e4935a --- /dev/null +++ b/examples/CPTTestApp-iPhone/Base.lproj/PieChart.xib @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/CPTTestApp-iPhone/ScatterPlot.xib b/examples/CPTTestApp-iPhone/Base.lproj/ScatterPlot.xib similarity index 50% rename from examples/CPTTestApp-iPhone/ScatterPlot.xib rename to examples/CPTTestApp-iPhone/Base.lproj/ScatterPlot.xib index 7e1ed2991..b1747d817 100644 --- a/examples/CPTTestApp-iPhone/ScatterPlot.xib +++ b/examples/CPTTestApp-iPhone/Base.lproj/ScatterPlot.xib @@ -1,7 +1,10 @@ - - + + + - + + + @@ -11,15 +14,10 @@ - + - - + + - - - - - diff --git a/examples/CPTTestApp-iPhone/CPTTestApp-iPhone.xcodeproj/project.pbxproj b/examples/CPTTestApp-iPhone/CPTTestApp-iPhone.xcodeproj/project.pbxproj index cb532b83c..672347980 100644 --- a/examples/CPTTestApp-iPhone/CPTTestApp-iPhone.xcodeproj/project.pbxproj +++ b/examples/CPTTestApp-iPhone/CPTTestApp-iPhone.xcodeproj/project.pbxproj @@ -9,27 +9,40 @@ /* Begin PBXBuildFile section */ 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; }; 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; }; - 282CCBFE0DB6C98000C4EA27 /* BarChart.xib in Resources */ = {isa = PBXBuildFile; fileRef = 282CCBFD0DB6C98000C4EA27 /* BarChart.xib */; }; 288765080DF74369002DB57D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765070DF74369002DB57D /* CoreGraphics.framework */; }; - 28AD73880D9D96C1002E5188 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 28AD73870D9D96C1002E5188 /* MainWindow.xib */; }; - BC74A34110FC418D00E7E90D /* PieChart.xib in Resources */ = {isa = PBXBuildFile; fileRef = BC74A34010FC418D00E7E90D /* PieChart.xib */; }; BC8166CE1100DD00006D898E /* 16-line-chart.png in Resources */ = {isa = PBXBuildFile; fileRef = BC8166CC1100DD00006D898E /* 16-line-chart.png */; }; BC8166CF1100DD00006D898E /* 17-bar-chart.png in Resources */ = {isa = PBXBuildFile; fileRef = BC8166CD1100DD00006D898E /* 17-bar-chart.png */; }; BC8166D21100DD6F006D898E /* 62-contrast.png in Resources */ = {isa = PBXBuildFile; fileRef = BC8166D11100DD6F006D898E /* 62-contrast.png */; }; BC9B81DA0FB893F70035D8DA /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BC9B81D90FB893F70035D8DA /* QuartzCore.framework */; }; - BC9B84360FB8B7110035D8DA /* ScatterPlot.xib in Resources */ = {isa = PBXBuildFile; fileRef = BC9B84350FB8B7110035D8DA /* ScatterPlot.xib */; }; - C34677B219F3345500429A85 /* Launch Screen.xib in Resources */ = {isa = PBXBuildFile; fileRef = C34677B119F3345500429A85 /* Launch Screen.xib */; }; C359603719CE34FC005CDFB9 /* BarChartController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C359603319CE34FB005CDFB9 /* BarChartController.swift */; }; C359603819CE34FC005CDFB9 /* iPhoneAppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C359603419CE34FB005CDFB9 /* iPhoneAppDelegate.swift */; }; C359603919CE34FC005CDFB9 /* PieChartController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C359603519CE34FB005CDFB9 /* PieChartController.swift */; }; C359603A19CE34FC005CDFB9 /* ScatterPlotController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C359603619CE34FB005CDFB9 /* ScatterPlotController.swift */; }; C3B9F9D417503CDD001CCC50 /* BlueTexture.png in Resources */ = {isa = PBXBuildFile; fileRef = C3B9F9D317503CDD001CCC50 /* BlueTexture.png */; }; - C3CD283E17DE9C95008EED1E /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3CD283D17DE9C95008EED1E /* Accelerate.framework */; }; + C3D0A20C20E019EB00BA2921 /* PieChart.xib in Resources */ = {isa = PBXBuildFile; fileRef = C3D0A20E20E019EB00BA2921 /* PieChart.xib */; }; + C3D0A21C20E019F000BA2921 /* BarChart.xib in Resources */ = {isa = PBXBuildFile; fileRef = C3D0A21E20E019F000BA2921 /* BarChart.xib */; }; + C3D0A21F20E019F300BA2921 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = C3D0A22120E019F300BA2921 /* MainWindow.xib */; }; + C3D0A22220E019F800BA2921 /* ScatterPlot.xib in Resources */ = {isa = PBXBuildFile; fileRef = C3D0A22420E019F800BA2921 /* ScatterPlot.xib */; }; + C3D0A22520E019FF00BA2921 /* Launch Screen.xib in Resources */ = {isa = PBXBuildFile; fileRef = C3D0A22720E019FF00BA2921 /* Launch Screen.xib */; }; C3D3936419FD671100148319 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C3D3936319FD671100148319 /* Images.xcassets */; }; C3D414C61A7D847C00B6F5D6 /* libCorePlot-CocoaTouch.a in Frameworks */ = {isa = PBXBuildFile; fileRef = C3D414C31A7D846500B6F5D6 /* libCorePlot-CocoaTouch.a */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ + C31D01F11D10F506008C1EF2 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = C3D414AE1A7D846500B6F5D6 /* CorePlot.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = C37EA6921BC83F2A0091C8F7; + remoteInfo = "CorePlot tvOS"; + }; + C31D01F31D10F506008C1EF2 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = C3D414AE1A7D846500B6F5D6 /* CorePlot.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = C37EA6B71BC83F2D0091C8F7; + remoteInfo = "UnitTests tvOS"; + }; C3D414BA1A7D846500B6F5D6 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = C3D414AE1A7D846500B6F5D6 /* CorePlot.xcodeproj */; @@ -78,25 +91,25 @@ 1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 1D6058910D05DD3D006BFB54 /* CPTTestApp-iPhone.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "CPTTestApp-iPhone.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; - 282CCBFD0DB6C98000C4EA27 /* BarChart.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = BarChart.xib; sourceTree = ""; }; 288765070DF74369002DB57D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; - 28AD73870D9D96C1002E5188 /* MainWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MainWindow.xib; sourceTree = ""; }; - 8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - BC74A34010FC418D00E7E90D /* PieChart.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = PieChart.xib; sourceTree = ""; }; BC8166CC1100DD00006D898E /* 16-line-chart.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "16-line-chart.png"; path = "GlyphishIcons/16-line-chart.png"; sourceTree = ""; }; BC8166CD1100DD00006D898E /* 17-bar-chart.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "17-bar-chart.png"; path = "GlyphishIcons/17-bar-chart.png"; sourceTree = ""; }; BC8166D11100DD6F006D898E /* 62-contrast.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "62-contrast.png"; path = "GlyphishIcons/62-contrast.png"; sourceTree = ""; }; BC9B81D90FB893F70035D8DA /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; - BC9B84350FB8B7110035D8DA /* ScatterPlot.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ScatterPlot.xib; sourceTree = ""; }; - C34677B119F3345500429A85 /* Launch Screen.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = "Launch Screen.xib"; sourceTree = ""; }; C359603319CE34FB005CDFB9 /* BarChartController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BarChartController.swift; sourceTree = ""; }; C359603419CE34FB005CDFB9 /* iPhoneAppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = iPhoneAppDelegate.swift; sourceTree = ""; }; C359603519CE34FB005CDFB9 /* PieChartController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PieChartController.swift; sourceTree = ""; }; C359603619CE34FB005CDFB9 /* ScatterPlotController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ScatterPlotController.swift; sourceTree = ""; }; C359603B19CE352A005CDFB9 /* CPTTestApp-iPhone-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = "CPTTestApp-iPhone-Bridging-Header.h"; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; + C37A40F020E0322D00C4FF48 /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Base; path = Base.lproj/Info.plist; sourceTree = ""; }; C3B9F9D317503CDD001CCC50 /* BlueTexture.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = BlueTexture.png; sourceTree = ""; }; C3C3CBDE19EA125D00A0296A /* CorePlotWarnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = CorePlotWarnings.xcconfig; path = ../../framework/xcconfig/CorePlotWarnings.xcconfig; sourceTree = ""; }; C3CD283D17DE9C95008EED1E /* Accelerate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Accelerate.framework; path = System/Library/Frameworks/Accelerate.framework; sourceTree = SDKROOT; }; + C3D0A22820E01A0600BA2921 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/PieChart.xib; sourceTree = ""; }; + C3D0A22920E01A0600BA2921 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/BarChart.xib; sourceTree = ""; }; + C3D0A22A20E01A0600BA2921 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainWindow.xib; sourceTree = ""; }; + C3D0A22B20E01A0600BA2921 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/ScatterPlot.xib; sourceTree = ""; }; + C3D0A22C20E01A0600BA2921 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = "Base.lproj/Launch Screen.xib"; sourceTree = ""; }; C3D3936319FD671100148319 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = "CPTTestApp-iPhone/Images.xcassets"; sourceTree = ""; }; C3D414AE1A7D846500B6F5D6 /* CorePlot.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = CorePlot.xcodeproj; path = ../../framework/CorePlot.xcodeproj; sourceTree = ""; }; /* End PBXFileReference section */ @@ -110,7 +123,6 @@ 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */, 288765080DF74369002DB57D /* CoreGraphics.framework in Frameworks */, BC9B81DA0FB893F70035D8DA /* QuartzCore.framework in Frameworks */, - C3CD283E17DE9C95008EED1E /* Accelerate.framework in Frameworks */, C3D414C61A7D847C00B6F5D6 /* libCorePlot-CocoaTouch.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -170,12 +182,12 @@ BC8166CC1100DD00006D898E /* 16-line-chart.png */, BC8166CD1100DD00006D898E /* 17-bar-chart.png */, C3B9F9D317503CDD001CCC50 /* BlueTexture.png */, - BC74A34010FC418D00E7E90D /* PieChart.xib */, - 282CCBFD0DB6C98000C4EA27 /* BarChart.xib */, - 28AD73870D9D96C1002E5188 /* MainWindow.xib */, - 8D1107310486CEB800E47090 /* Info.plist */, - BC9B84350FB8B7110035D8DA /* ScatterPlot.xib */, - C34677B119F3345500429A85 /* Launch Screen.xib */, + C3D0A22720E019FF00BA2921 /* Launch Screen.xib */, + C3D0A22120E019F300BA2921 /* MainWindow.xib */, + C3D0A22420E019F800BA2921 /* ScatterPlot.xib */, + C3D0A21E20E019F000BA2921 /* BarChart.xib */, + C3D0A20E20E019EB00BA2921 /* PieChart.xib */, + C37A40F120E0322D00C4FF48 /* Info.plist */, ); name = Resources; sourceTree = ""; @@ -201,6 +213,8 @@ C3D414C11A7D846500B6F5D6 /* UnitTests iOS.xctest */, C3D414C31A7D846500B6F5D6 /* libCorePlot-CocoaTouch.a */, C3D414C51A7D846500B6F5D6 /* CorePlot-CocoaTouchTests.xctest */, + C31D01F21D10F506008C1EF2 /* CorePlot.framework */, + C31D01F41D10F506008C1EF2 /* UnitTests tvOS.xctest */, ); name = Products; sourceTree = ""; @@ -232,17 +246,24 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0700; - LastUpgradeCheck = 0700; + LastUpgradeCheck = 0930; + TargetAttributes = { + 1D6058900D05DD3D006BFB54 = { + DevelopmentTeam = 28ZA45DE7D; + LastSwiftMigration = 1020; + }; + }; }; buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "CPTTestApp-iPhone" */; compatibilityVersion = "Xcode 6.3"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 1; knownRegions = ( - English, - Japanese, - French, - German, + Base, + fr, + de, + ja, + en, ); mainGroup = 29B97314FDCFA39411CA2CEA /* CPTTestApp-iPhone */; projectDirPath = ""; @@ -260,6 +281,20 @@ /* End PBXProject section */ /* Begin PBXReferenceProxy section */ + C31D01F21D10F506008C1EF2 /* CorePlot.framework */ = { + isa = PBXReferenceProxy; + fileType = wrapper.framework; + path = CorePlot.framework; + remoteRef = C31D01F11D10F506008C1EF2 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + C31D01F41D10F506008C1EF2 /* UnitTests tvOS.xctest */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = "UnitTests tvOS.xctest"; + remoteRef = C31D01F31D10F506008C1EF2 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; C3D414BB1A7D846500B6F5D6 /* CorePlot.framework */ = { isa = PBXReferenceProxy; fileType = wrapper.framework; @@ -309,12 +344,12 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 28AD73880D9D96C1002E5188 /* MainWindow.xib in Resources */, - 282CCBFE0DB6C98000C4EA27 /* BarChart.xib in Resources */, - BC9B84360FB8B7110035D8DA /* ScatterPlot.xib in Resources */, + C3D0A21F20E019F300BA2921 /* MainWindow.xib in Resources */, + C3D0A21C20E019F000BA2921 /* BarChart.xib in Resources */, + C3D0A22220E019F800BA2921 /* ScatterPlot.xib in Resources */, C3D3936419FD671100148319 /* Images.xcassets in Resources */, - BC74A34110FC418D00E7E90D /* PieChart.xib in Resources */, - C34677B219F3345500429A85 /* Launch Screen.xib in Resources */, + C3D0A20C20E019EB00BA2921 /* PieChart.xib in Resources */, + C3D0A22520E019FF00BA2921 /* Launch Screen.xib in Resources */, BC8166CE1100DD00006D898E /* 16-line-chart.png in Resources */, BC8166CF1100DD00006D898E /* 17-bar-chart.png in Resources */, BC8166D21100DD6F006D898E /* 62-contrast.png in Resources */, @@ -338,6 +373,57 @@ }; /* End PBXSourcesBuildPhase section */ +/* Begin PBXVariantGroup section */ + C37A40F120E0322D00C4FF48 /* Info.plist */ = { + isa = PBXVariantGroup; + children = ( + C37A40F020E0322D00C4FF48 /* Base */, + ); + name = Info.plist; + sourceTree = ""; + }; + C3D0A20E20E019EB00BA2921 /* PieChart.xib */ = { + isa = PBXVariantGroup; + children = ( + C3D0A22820E01A0600BA2921 /* Base */, + ); + name = PieChart.xib; + sourceTree = ""; + }; + C3D0A21E20E019F000BA2921 /* BarChart.xib */ = { + isa = PBXVariantGroup; + children = ( + C3D0A22920E01A0600BA2921 /* Base */, + ); + name = BarChart.xib; + sourceTree = ""; + }; + C3D0A22120E019F300BA2921 /* MainWindow.xib */ = { + isa = PBXVariantGroup; + children = ( + C3D0A22A20E01A0600BA2921 /* Base */, + ); + name = MainWindow.xib; + sourceTree = ""; + }; + C3D0A22420E019F800BA2921 /* ScatterPlot.xib */ = { + isa = PBXVariantGroup; + children = ( + C3D0A22B20E01A0600BA2921 /* Base */, + ); + name = ScatterPlot.xib; + sourceTree = ""; + }; + C3D0A22720E019FF00BA2921 /* Launch Screen.xib */ = { + isa = PBXVariantGroup; + children = ( + C3D0A22C20E01A0600BA2921 /* Base */, + ); + name = "Launch Screen.xib"; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + /* Begin XCBuildConfiguration section */ 1D6058940D05DD3E006BFB54 /* Debug */ = { isa = XCBuildConfiguration; @@ -345,16 +431,15 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; CLANG_ENABLE_OBJC_ARC = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; + DEVELOPMENT_TEAM = 28ZA45DE7D; GCC_DYNAMIC_NO_PIC = NO; - GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = CPTTestApp_iPhone_Prefix.pch; HEADER_SEARCH_PATHS = ""; - INFOPLIST_FILE = Info.plist; + INFOPLIST_FILE = "$(SRCROOT)/Base.lproj/Info.plist"; LIBRARY_SEARCH_PATHS = ""; OTHER_LDFLAGS = ( "-all_load", @@ -364,7 +449,7 @@ PRODUCT_NAME = "CPTTestApp-iPhone"; "PROVISIONING_PROFILE[sdk=iphoneos*]" = ""; SWIFT_OBJC_BRIDGING_HEADER = "CPTTestApp-iPhone-Bridging-Header.h"; - USER_HEADER_SEARCH_PATHS = "\"${PROJECT_DIR}/../../framework\"/**"; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -374,14 +459,14 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; CLANG_ENABLE_OBJC_ARC = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution"; COPY_PHASE_STRIP = YES; + DEVELOPMENT_TEAM = 28ZA45DE7D; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = CPTTestApp_iPhone_Prefix.pch; HEADER_SEARCH_PATHS = ""; - INFOPLIST_FILE = Info.plist; + INFOPLIST_FILE = "$(SRCROOT)/Base.lproj/Info.plist"; LIBRARY_SEARCH_PATHS = ""; OTHER_LDFLAGS = ( "-all_load", @@ -391,22 +476,24 @@ PRODUCT_NAME = "CPTTestApp-iPhone"; "PROVISIONING_PROFILE[sdk=iphoneos*]" = ""; SWIFT_OBJC_BRIDGING_HEADER = "CPTTestApp-iPhone-Bridging-Header.h"; - USER_HEADER_SEARCH_PATHS = "\"${PROJECT_DIR}/../../framework\"/**"; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 5.0; }; name = Release; }; C01FCF4F08A954540054247B /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = C3C3CBDE19EA125D00A0296A /* CorePlotWarnings.xcconfig */; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - EMBEDDED_CONTENT_CONTAINS_SWIFT = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = c99; - GCC_TREAT_WARNINGS_AS_ERRORS = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; HEADER_SEARCH_PATHS = ""; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @loader_path/Frameworks"; @@ -417,21 +504,22 @@ SDKROOT = iphoneos; SYMROOT = "$(SRCROOT)/../../build"; TARGETED_DEVICE_FAMILY = 1; - USER_HEADER_SEARCH_PATHS = "\"${PROJECT_DIR}/../../framework\"/**"; + USER_HEADER_SEARCH_PATHS = "\"${PROJECT_DIR}/../../framework\" \"${PROJECT_DIR}/../../framework/Source\" \"${PROJECT_DIR}/../../framework/iPhoneOnly\""; }; name = Debug; }; C01FCF5008A954540054247B /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = C3C3CBDE19EA125D00A0296A /* CorePlotWarnings.xcconfig */; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CODE_SIGN_IDENTITY = "iPhone Distribution"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution"; - EMBEDDED_CONTENT_CONTAINS_SWIFT = YES; GCC_C_LANGUAGE_STANDARD = c99; - GCC_TREAT_WARNINGS_AS_ERRORS = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = s; HEADER_SEARCH_PATHS = ""; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @loader_path/Frameworks"; @@ -442,7 +530,7 @@ SDKROOT = iphoneos; SYMROOT = "$(SRCROOT)/../../build"; TARGETED_DEVICE_FAMILY = 1; - USER_HEADER_SEARCH_PATHS = "\"${PROJECT_DIR}/../../framework\"/**"; + USER_HEADER_SEARCH_PATHS = "\"${PROJECT_DIR}/../../framework\" \"${PROJECT_DIR}/../../framework/Source\" \"${PROJECT_DIR}/../../framework/iPhoneOnly\""; }; name = Release; }; diff --git a/examples/CPTTestApp-iPhone/CPTTestApp-iPhone.xcodeproj/xcshareddata/xcschemes/CPTTestApp-iPhone.xcscheme b/examples/CPTTestApp-iPhone/CPTTestApp-iPhone.xcodeproj/xcshareddata/xcschemes/CPTTestApp-iPhone.xcscheme index 515531f0b..0977a0925 100644 --- a/examples/CPTTestApp-iPhone/CPTTestApp-iPhone.xcodeproj/xcshareddata/xcschemes/CPTTestApp-iPhone.xcscheme +++ b/examples/CPTTestApp-iPhone/CPTTestApp-iPhone.xcodeproj/xcshareddata/xcschemes/CPTTestApp-iPhone.xcscheme @@ -1,6 +1,6 @@ - - - - + + - - UInt + func numberOfRecords(for plot: CPTPlot) -> UInt { return 16 } - func numberForPlot(plot: CPTPlot, field: UInt, recordIndex: UInt) -> AnyObject? + func number(for plot: CPTPlot, field: UInt, record: UInt) -> Any? { switch CPTBarPlotField(rawValue: Int(field))! { - case .BarLocation: - return recordIndex as NSNumber + case .barLocation: + return record as NSNumber - case .BarTip: + case .barTip: let plotID = plot.identifier as! String - return (plotID == "Bar Plot 2" ? recordIndex : ((recordIndex + 1) * (recordIndex + 1)) ) as NSNumber + return (plotID == "Bar Plot 2" ? record : ((record + 1) * (record + 1)) ) as NSNumber default: return nil diff --git a/examples/CPTTestApp-iPhone/Classes/PieChartController.swift b/examples/CPTTestApp-iPhone/Classes/PieChartController.swift index ea01894e6..3b99ed916 100644 --- a/examples/CPTTestApp-iPhone/Classes/PieChartController.swift +++ b/examples/CPTTestApp-iPhone/Classes/PieChartController.swift @@ -1,19 +1,19 @@ import UIKit -class PieChartController : UIViewController, CPTPieChartDataSource { +class PieChartController : UIViewController, CPTPieChartDataSource, CPTPieChartDelegate { private var pieGraph : CPTXYGraph? = nil let dataForChart = [20.0, 30.0, 60.0] - // MARK: Initialization + // MARK: - Initialization - override func viewDidAppear(animated : Bool) + override func viewDidAppear(_ animated : Bool) { super.viewDidAppear(animated) // Create graph from theme - let newGraph = CPTXYGraph(frame: CGRectZero) - newGraph.applyTheme(CPTTheme(named: kCPTDarkGradientTheme)) + let newGraph = CPTXYGraph(frame: .zero) + newGraph.apply(CPTTheme(named: .darkGradientTheme)) let hostingView = self.view as! CPTGraphHostingView hostingView.hostedGraph = newGraph @@ -27,55 +27,55 @@ class PieChartController : UIViewController, CPTPieChartDataSource { newGraph.axisSet = nil let whiteText = CPTMutableTextStyle() - whiteText.color = CPTColor.whiteColor() + whiteText.color = .white() newGraph.titleTextStyle = whiteText newGraph.title = "Graph Title" // Add pie chart - let piePlot = CPTPieChart(frame: CGRectZero) + let piePlot = CPTPieChart(frame: .zero) piePlot.dataSource = self piePlot.pieRadius = 131.0 - piePlot.identifier = "Pie Chart 1" - piePlot.startAngle = CGFloat(M_PI_4) - piePlot.sliceDirection = .CounterClockwise + piePlot.identifier = "Pie Chart 1" as NSString + piePlot.startAngle = CGFloat(.pi / 4.0) + piePlot.sliceDirection = .counterClockwise piePlot.centerAnchor = CGPoint(x: 0.5, y: 0.38) piePlot.borderLineStyle = CPTLineStyle() piePlot.delegate = self - newGraph.addPlot(piePlot) + newGraph.add(piePlot) self.pieGraph = newGraph } // MARK: - Plot Data Source Methods - func numberOfRecordsForPlot(plot: CPTPlot) -> UInt + func numberOfRecords(for plot: CPTPlot) -> UInt { return UInt(self.dataForChart.count) } - func numberForPlot(plot: CPTPlot, field: UInt, recordIndex: UInt) -> AnyObject? + func number(for plot: CPTPlot, field: UInt, record: UInt) -> Any? { - if Int(recordIndex) > self.dataForChart.count { + if Int(record) > self.dataForChart.count { return nil } else { switch CPTPieChartField(rawValue: Int(field))! { - case .SliceWidth: - return (self.dataForChart)[Int(recordIndex)] as NSNumber + case .sliceWidth: + return (self.dataForChart)[Int(record)] as NSNumber default: - return recordIndex as NSNumber + return record as NSNumber } } } - func dataLabelForPlot(plot: CPTPlot, recordIndex: UInt) -> CPTLayer? + func dataLabel(for plot: CPTPlot, record: UInt) -> CPTLayer? { - let label = CPTTextLayer(text:"\(recordIndex)") + let label = CPTTextLayer(text:"\(record)") if let textStyle = label.textStyle?.mutableCopy() as? CPTMutableTextStyle { - textStyle.color = CPTColor.lightGrayColor() + textStyle.color = .lightGray() label.textStyle = textStyle } @@ -83,7 +83,7 @@ class PieChartController : UIViewController, CPTPieChartDataSource { return label } - func radialOffsetForPieChart(piePlot: CPTPieChart, recordIndex: UInt) -> CGFloat + func radialOffset(for piePlot: CPTPieChart, record recordIndex: UInt) -> CGFloat { var offset: CGFloat = 0.0 @@ -95,9 +95,8 @@ class PieChartController : UIViewController, CPTPieChartDataSource { } // MARK: - Delegate Methods - - func pieChart(plot: CPTPlot, sliceWasSelectedAtRecordIndex recordIndex: UInt) - { - self.pieGraph?.title = "Selected index: \(recordIndex)" + + func pieChart(_ plot: CPTPieChart, sliceWasSelectedAtRecord idx: UInt) { + self.pieGraph?.title = "Selected index: \(idx)" } } diff --git a/examples/CPTTestApp-iPhone/Classes/ScatterPlotController.swift b/examples/CPTTestApp-iPhone/Classes/ScatterPlotController.swift index 2f1681dd3..76b3191ee 100644 --- a/examples/CPTTestApp-iPhone/Classes/ScatterPlotController.swift +++ b/examples/CPTTestApp-iPhone/Classes/ScatterPlotController.swift @@ -1,20 +1,20 @@ import UIKit -class ScatterPlotController : UIViewController, CPTScatterPlotDataSource { +class ScatterPlotController : UIViewController, CPTScatterPlotDataSource, CPTAxisDelegate { private var scatterGraph : CPTXYGraph? = nil typealias plotDataType = [CPTScatterPlotField : Double] private var dataForPlot = [plotDataType]() - // MARK: Initialization + // MARK: - Initialization - override func viewDidAppear(animated : Bool) + override func viewDidAppear(_ animated : Bool) { super.viewDidAppear(animated) // Create graph from theme - let newGraph = CPTXYGraph(frame: CGRectZero) - newGraph.applyTheme(CPTTheme(named: kCPTDarkGradientTheme)) + let newGraph = CPTXYGraph(frame: .zero) + newGraph.apply(CPTTheme(named: .darkGradientTheme)) let hostingView = self.view as! CPTGraphHostingView hostingView.hostedGraph = newGraph @@ -45,7 +45,7 @@ class ScatterPlotController : UIViewController, CPTScatterPlotDataSource { ] } - if let y = axisSet.xAxis { + if let y = axisSet.yAxis { y.majorIntervalLength = 0.5 y.minorTicksPerInterval = 5 y.orthogonalPosition = 2.0 @@ -58,43 +58,43 @@ class ScatterPlotController : UIViewController, CPTScatterPlotDataSource { } // Create a blue plot area - let boundLinePlot = CPTScatterPlot(frame: CGRectZero) + let boundLinePlot = CPTScatterPlot(frame: .zero) let blueLineStyle = CPTMutableLineStyle() blueLineStyle.miterLimit = 1.0 blueLineStyle.lineWidth = 3.0 - blueLineStyle.lineColor = CPTColor.blueColor() + blueLineStyle.lineColor = .blue() boundLinePlot.dataLineStyle = blueLineStyle - boundLinePlot.identifier = "Blue Plot" + boundLinePlot.identifier = "Blue Plot" as NSString boundLinePlot.dataSource = self - newGraph.addPlot(boundLinePlot) + newGraph.add(boundLinePlot) let fillImage = CPTImage(named:"BlueTexture") - fillImage.tiled = true + fillImage.isTiled = true boundLinePlot.areaFill = CPTFill(image: fillImage) boundLinePlot.areaBaseValue = 0.0 // Add plot symbols let symbolLineStyle = CPTMutableLineStyle() - symbolLineStyle.lineColor = CPTColor.blackColor() - let plotSymbol = CPTPlotSymbol.ellipsePlotSymbol() - plotSymbol.fill = CPTFill(color: CPTColor.blueColor()) + symbolLineStyle.lineColor = .black() + let plotSymbol = CPTPlotSymbol.ellipse() + plotSymbol.fill = CPTFill(color: .blue()) plotSymbol.lineStyle = symbolLineStyle plotSymbol.size = CGSize(width: 10.0, height: 10.0) boundLinePlot.plotSymbol = plotSymbol // Create a green plot area - let dataSourceLinePlot = CPTScatterPlot(frame: CGRectZero) + let dataSourceLinePlot = CPTScatterPlot(frame: .zero) let greenLineStyle = CPTMutableLineStyle() greenLineStyle.lineWidth = 3.0 - greenLineStyle.lineColor = CPTColor.greenColor() + greenLineStyle.lineColor = .green() greenLineStyle.dashPattern = [5.0, 5.0] dataSourceLinePlot.dataLineStyle = greenLineStyle - dataSourceLinePlot.identifier = "Green Plot" + dataSourceLinePlot.identifier = "Green Plot" as NSString dataSourceLinePlot.dataSource = self // Put an area gradient under the plot above let areaColor = CPTColor(componentRed: 0.3, green: 1.0, blue: 0.3, alpha: 0.8) - let areaGradient = CPTGradient(beginningColor: areaColor, endingColor: CPTColor.clearColor()) + let areaGradient = CPTGradient(beginning: areaColor, ending: .clear()) areaGradient.angle = -90.0 let areaGradientFill = CPTFill(gradient: areaGradient) dataSourceLinePlot.areaFill = areaGradientFill @@ -102,14 +102,14 @@ class ScatterPlotController : UIViewController, CPTScatterPlotDataSource { // Animate in the new plot, as an example dataSourceLinePlot.opacity = 0.0 - newGraph.addPlot(dataSourceLinePlot) + newGraph.add(dataSourceLinePlot) let fadeInAnimation = CABasicAnimation(keyPath: "opacity") fadeInAnimation.duration = 1.0 - fadeInAnimation.removedOnCompletion = false - fadeInAnimation.fillMode = kCAFillModeForwards + fadeInAnimation.isRemovedOnCompletion = false + fadeInAnimation.fillMode = .forwards fadeInAnimation.toValue = 1.0 - dataSourceLinePlot.addAnimation(fadeInAnimation, forKey: "animateOpacity") + dataSourceLinePlot.add(fadeInAnimation, forKey: "animateOpacity") // Add some initial data var contentArray = [plotDataType]() @@ -126,16 +126,16 @@ class ScatterPlotController : UIViewController, CPTScatterPlotDataSource { // MARK: - Plot Data Source Methods - func numberOfRecordsForPlot(plot: CPTPlot) -> UInt + func numberOfRecords(for plot: CPTPlot) -> UInt { return UInt(self.dataForPlot.count) } - func numberForPlot(plot: CPTPlot, field: UInt, recordIndex: UInt) -> AnyObject? + func number(for plot: CPTPlot, field: UInt, record: UInt) -> Any? { let plotField = CPTScatterPlotField(rawValue: Int(field)) - if let num = self.dataForPlot[Int(recordIndex)][plotField!] { + if let num = self.dataForPlot[Int(record)][plotField!] { let plotID = plot.identifier as! String if (plotField! == .Y) && (plotID == "Green Plot") { return (num + 1.0) as NSNumber @@ -151,7 +151,7 @@ class ScatterPlotController : UIViewController, CPTScatterPlotDataSource { // MARK: - Axis Delegate Methods - func axis(axis: CPTAxis, shouldUpdateAxisLabelsAtLocations locations: NSSet!) -> Bool + func axis(_ axis: CPTAxis, shouldUpdateAxisLabelsAtLocations locations: Set) -> Bool { if let formatter = axis.labelFormatter { let labelOffset = axis.labelOffset @@ -160,21 +160,20 @@ class ScatterPlotController : UIViewController, CPTScatterPlotDataSource { for tickLocation in locations { if let labelTextStyle = axis.labelTextStyle?.mutableCopy() as? CPTMutableTextStyle { - if tickLocation.doubleValue >= 0.0 { - labelTextStyle.color = CPTColor.greenColor() + labelTextStyle.color = .green() } else { - labelTextStyle.color = CPTColor.redColor() + labelTextStyle.color = .red() } - let labelString = formatter.stringForObjectValue(tickLocation) + let labelString = formatter.string(for:tickLocation) let newLabelLayer = CPTTextLayer(text: labelString, style: labelTextStyle) let newLabel = CPTAxisLabel(contentLayer: newLabelLayer) - newLabel.tickLocation = tickLocation as! NSNumber + newLabel.tickLocation = tickLocation newLabel.offset = labelOffset - + newLabels.insert(newLabel) } diff --git a/examples/CPTTestApp-iPhone/Classes/iPhoneAppDelegate.swift b/examples/CPTTestApp-iPhone/Classes/iPhoneAppDelegate.swift index e19b8b21d..42189f9ec 100644 --- a/examples/CPTTestApp-iPhone/Classes/iPhoneAppDelegate.swift +++ b/examples/CPTTestApp-iPhone/Classes/iPhoneAppDelegate.swift @@ -11,7 +11,7 @@ class iPhoneAppDelegate : NSObject, UIApplicationDelegate, UITabBarControllerDel @IBOutlet var window: UIWindow? = nil @IBOutlet var tabBarController: UITabBarController? = nil - func applicationDidFinishLaunching(application: UIApplication) { + func applicationDidFinishLaunching(_ application: UIApplication) { if let myWindow = self.window { myWindow.rootViewController = self.tabBarController myWindow.makeKeyAndVisible() diff --git a/examples/CPTTestApp-iPhone/PieChart.xib b/examples/CPTTestApp-iPhone/PieChart.xib deleted file mode 100644 index 2489ea51a..000000000 --- a/examples/CPTTestApp-iPhone/PieChart.xib +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/CPTTestApp/Info.plist b/examples/CPTTestApp/Base.lproj/Info.plist similarity index 100% rename from examples/CPTTestApp/Info.plist rename to examples/CPTTestApp/Base.lproj/Info.plist diff --git a/examples/CPTTestApp/CPTTestApp.xcodeproj/project.pbxproj b/examples/CPTTestApp/CPTTestApp.xcodeproj/project.pbxproj index bddc20f40..a844a7791 100644 --- a/examples/CPTTestApp/CPTTestApp.xcodeproj/project.pbxproj +++ b/examples/CPTTestApp/CPTTestApp.xcodeproj/project.pbxproj @@ -8,21 +8,20 @@ /* Begin PBXBuildFile section */ 077382B10F3DC1FB002F10E2 /* Controller.m in Sources */ = {isa = PBXBuildFile; fileRef = 077382B00F3DC1FB002F10E2 /* Controller.m */; }; - 07C13BBB0FF9322A00BEE616 /* BlueTexture.png in Resources */ = {isa = PBXBuildFile; fileRef = 07C13BBA0FF9322A00BEE616 /* BlueTexture.png */; }; 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; }; 8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; }; 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; - 90AF4F440F36CF1800753D26 /* CPTTestApp.xib in Resources */ = {isa = PBXBuildFile; fileRef = 90AF4F430F36CF1800753D26 /* CPTTestApp.xib */; }; BC8E74240FC0B96000DF8511 /* RotationView.m in Sources */ = {isa = PBXBuildFile; fileRef = BC8E74230FC0B96000DF8511 /* RotationView.m */; }; - C317AB4F1093CC1E00B25011 /* PlotSymbolDemo.xib in Resources */ = {isa = PBXBuildFile; fileRef = C317AB4E1093CC1E00B25011 /* PlotSymbolDemo.xib */; }; - C317AB711093E09D00B25011 /* AxisDemo.xib in Resources */ = {isa = PBXBuildFile; fileRef = C317AB701093E09D00B25011 /* AxisDemo.xib */; }; C317AB751093E17500B25011 /* AxisDemoController.m in Sources */ = {isa = PBXBuildFile; fileRef = C317AB731093E17500B25011 /* AxisDemoController.m */; }; C34D4F8E0F8ED78400969C24 /* CPTPlotSymbolTestController.m in Sources */ = {isa = PBXBuildFile; fileRef = C34D4F8C0F8ED78400969C24 /* CPTPlotSymbolTestController.m */; }; C36912D21C0B48DF000A1D61 /* CorePlot.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 07032B6A11ABB9E000463D20 /* CorePlot.framework */; }; C36912D31C0B48DF000A1D61 /* CorePlot.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 07032B6A11ABB9E000463D20 /* CorePlot.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - C38017DD124132020052B00D /* SelectionDemo.xib in Resources */ = {isa = PBXBuildFile; fileRef = C38017DC124132020052B00D /* SelectionDemo.xib */; }; C38017E1124132610052B00D /* SelectionDemoController.m in Sources */ = {isa = PBXBuildFile; fileRef = C38017E0124132610052B00D /* SelectionDemoController.m */; }; C39BB9A4181C154500D95E01 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BC8E737C0FC0B3CF00DF8511 /* QuartzCore.framework */; }; + C3D0A18B20E017C500BA2921 /* AxisDemo.xib in Resources */ = {isa = PBXBuildFile; fileRef = C3D0A18D20E017C500BA2921 /* AxisDemo.xib */; }; + C3D0A19A20E017CC00BA2921 /* CPTTestApp.xib in Resources */ = {isa = PBXBuildFile; fileRef = C3D0A19C20E017CC00BA2921 /* CPTTestApp.xib */; }; + C3D0A19D20E017D100BA2921 /* PlotSymbolDemo.xib in Resources */ = {isa = PBXBuildFile; fileRef = C3D0A19F20E017D100BA2921 /* PlotSymbolDemo.xib */; }; + C3D0A1A020E017D600BA2921 /* SelectionDemo.xib in Resources */ = {isa = PBXBuildFile; fileRef = C3D0A1A220E017D600BA2921 /* SelectionDemo.xib */; }; C3D3935C19FD653300148319 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C3D3935B19FD653300148319 /* Images.xcassets */; }; /* End PBXBuildFile section */ @@ -118,30 +117,29 @@ 0761854B0F3CB3CB00A89A76 /* CorePlot.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = CorePlot.framework; path = ../../../../framework/build/Debug/CorePlot.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 077382AF0F3DC1FB002F10E2 /* Controller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Controller.h; path = Source/Controller.h; sourceTree = ""; }; 077382B00F3DC1FB002F10E2 /* Controller.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Controller.m; path = Source/Controller.m; sourceTree = ""; }; - 07C13BBA0FF9322A00BEE616 /* BlueTexture.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = BlueTexture.png; path = Resources/BlueTexture.png; sourceTree = ""; }; - 089C165DFE840E0CC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; 13E42FB307B3F0F600E4EEF1 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = ""; }; 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = Source/main.m; sourceTree = ""; }; 29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; 29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; 32CA4F630368D1EE00C91783 /* CPTTestApp_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTTestApp_Prefix.pch; sourceTree = ""; }; - 8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 8D1107320486CEB800E47090 /* CPTTestApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CPTTestApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 90AF4F430F36CF1800753D26 /* CPTTestApp.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = CPTTestApp.xib; path = Resources/CPTTestApp.xib; sourceTree = ""; }; BC8E737C0FC0B3CF00DF8511 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; BC8E74220FC0B96000DF8511 /* RotationView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RotationView.h; path = Source/RotationView.h; sourceTree = ""; }; BC8E74230FC0B96000DF8511 /* RotationView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RotationView.m; path = Source/RotationView.m; sourceTree = ""; }; - C317AB4E1093CC1E00B25011 /* PlotSymbolDemo.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = PlotSymbolDemo.xib; path = Resources/PlotSymbolDemo.xib; sourceTree = ""; }; - C317AB701093E09D00B25011 /* AxisDemo.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = AxisDemo.xib; path = Resources/AxisDemo.xib; sourceTree = ""; }; C317AB731093E17500B25011 /* AxisDemoController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AxisDemoController.m; path = Source/AxisDemoController.m; sourceTree = ""; }; C317AB741093E17500B25011 /* AxisDemoController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AxisDemoController.h; path = Source/AxisDemoController.h; sourceTree = ""; }; C34D4F8C0F8ED78400969C24 /* CPTPlotSymbolTestController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CPTPlotSymbolTestController.m; path = Source/CPTPlotSymbolTestController.m; sourceTree = ""; }; C34D4F8D0F8ED78400969C24 /* CPTPlotSymbolTestController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPTPlotSymbolTestController.h; path = Source/CPTPlotSymbolTestController.h; sourceTree = ""; }; - C38017DC124132020052B00D /* SelectionDemo.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = SelectionDemo.xib; path = Resources/SelectionDemo.xib; sourceTree = ""; }; + C3564D2522A2D11D000A54C9 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; + C37A40A620E030C000C4FF48 /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Base; path = Base.lproj/Info.plist; sourceTree = ""; }; C38017DF124132610052B00D /* SelectionDemoController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SelectionDemoController.h; path = Source/SelectionDemoController.h; sourceTree = ""; }; C38017E0124132610052B00D /* SelectionDemoController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SelectionDemoController.m; path = Source/SelectionDemoController.m; sourceTree = ""; }; C3880C3919DCD6A000ED0618 /* CorePlotWarnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = CorePlotWarnings.xcconfig; path = ../../framework/xcconfig/CorePlotWarnings.xcconfig; sourceTree = ""; }; + C3D0A1A320E017E400BA2921 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/AxisDemo.xib; sourceTree = ""; }; + C3D0A1A420E017E400BA2921 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/CPTTestApp.xib; sourceTree = ""; }; + C3D0A1A520E017E400BA2921 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/PlotSymbolDemo.xib; sourceTree = ""; }; + C3D0A1A620E017E400BA2921 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/SelectionDemo.xib; sourceTree = ""; }; C3D3935B19FD653300148319 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = CPTTestApp/Images.xcassets; sourceTree = ""; }; /* End PBXFileReference section */ @@ -249,13 +247,12 @@ isa = PBXGroup; children = ( C3D3935B19FD653300148319 /* Images.xcassets */, - 8D1107310486CEB800E47090 /* Info.plist */, - 07C13BBA0FF9322A00BEE616 /* BlueTexture.png */, + C37A40A720E030C000C4FF48 /* Info.plist */, 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */, - C317AB701093E09D00B25011 /* AxisDemo.xib */, - 90AF4F430F36CF1800753D26 /* CPTTestApp.xib */, - C317AB4E1093CC1E00B25011 /* PlotSymbolDemo.xib */, - C38017DC124132020052B00D /* SelectionDemo.xib */, + C3D0A18D20E017C500BA2921 /* AxisDemo.xib */, + C3D0A19C20E017CC00BA2921 /* CPTTestApp.xib */, + C3D0A19F20E017D100BA2921 /* PlotSymbolDemo.xib */, + C3D0A1A220E017D600BA2921 /* SelectionDemo.xib */, ); name = Resources; sourceTree = ""; @@ -300,18 +297,18 @@ isa = PBXProject; attributes = { BuildIndependentTargetsInParallel = NO; - LastUpgradeCheck = 0710; - LastUpgradeCheck = 0730; + LastUpgradeCheck = 1100; }; buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "CPTTestApp" */; compatibilityVersion = "Xcode 6.3"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 1; knownRegions = ( - English, - Japanese, - French, - German, + Base, + ja, + de, + en, + fr, ); mainGroup = 29B97314FDCFA39411CA2CEA /* CPTTestApp */; projectDirPath = ""; @@ -394,11 +391,10 @@ files = ( 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */, C3D3935C19FD653300148319 /* Images.xcassets in Resources */, - 90AF4F440F36CF1800753D26 /* CPTTestApp.xib in Resources */, - 07C13BBB0FF9322A00BEE616 /* BlueTexture.png in Resources */, - C317AB4F1093CC1E00B25011 /* PlotSymbolDemo.xib in Resources */, - C317AB711093E09D00B25011 /* AxisDemo.xib in Resources */, - C38017DD124132020052B00D /* SelectionDemo.xib in Resources */, + C3D0A19A20E017CC00BA2921 /* CPTTestApp.xib in Resources */, + C3D0A19D20E017D100BA2921 /* PlotSymbolDemo.xib in Resources */, + C3D0A18B20E017C500BA2921 /* AxisDemo.xib in Resources */, + C3D0A1A020E017D600BA2921 /* SelectionDemo.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -437,11 +433,55 @@ 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */ = { isa = PBXVariantGroup; children = ( - 089C165DFE840E0CC02AAC07 /* English */, + C3564D2522A2D11D000A54C9 /* en */, ); name = InfoPlist.strings; sourceTree = ""; }; + C37A40A720E030C000C4FF48 /* Info.plist */ = { + isa = PBXVariantGroup; + children = ( + C37A40A620E030C000C4FF48 /* Base */, + ); + name = Info.plist; + sourceTree = ""; + }; + C3D0A18D20E017C500BA2921 /* AxisDemo.xib */ = { + isa = PBXVariantGroup; + children = ( + C3D0A1A320E017E400BA2921 /* Base */, + ); + name = AxisDemo.xib; + path = Resources; + sourceTree = ""; + }; + C3D0A19C20E017CC00BA2921 /* CPTTestApp.xib */ = { + isa = PBXVariantGroup; + children = ( + C3D0A1A420E017E400BA2921 /* Base */, + ); + name = CPTTestApp.xib; + path = Resources; + sourceTree = ""; + }; + C3D0A19F20E017D100BA2921 /* PlotSymbolDemo.xib */ = { + isa = PBXVariantGroup; + children = ( + C3D0A1A520E017E400BA2921 /* Base */, + ); + name = PlotSymbolDemo.xib; + path = Resources; + sourceTree = ""; + }; + C3D0A1A220E017D600BA2921 /* SelectionDemo.xib */ = { + isa = PBXVariantGroup; + children = ( + C3D0A1A620E017E400BA2921 /* Base */, + ); + name = SelectionDemo.xib; + path = Resources; + sourceTree = ""; + }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ @@ -452,16 +492,16 @@ ALWAYS_SEARCH_USER_PATHS = NO; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_OBJC_ARC = YES; + CODE_SIGN_IDENTITY = "-"; COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = CPTTestApp_Prefix.pch; GCC_PREPROCESSOR_DEFINITIONS = ""; GCC_TREAT_WARNINGS_AS_ERRORS = YES; - INFOPLIST_FILE = Info.plist; + INFOPLIST_FILE = "$(SRCROOT)/Base.lproj/Info.plist"; INSTALL_PATH = "$(HOME)/Applications"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @loader_path/../Frameworks @executable_path/../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "org.CorePlot.${PRODUCT_NAME:identifier}"; @@ -476,13 +516,14 @@ ALWAYS_SEARCH_USER_PATHS = NO; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_OBJC_ARC = YES; + CODE_SIGN_IDENTITY = "-"; COMBINE_HIDPI_IMAGES = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; GCC_MODEL_TUNING = G5; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = CPTTestApp_Prefix.pch; GCC_PREPROCESSOR_DEFINITIONS = ""; - INFOPLIST_FILE = Info.plist; + INFOPLIST_FILE = "$(SRCROOT)/Base.lproj/Info.plist"; INSTALL_PATH = "$(HOME)/Applications"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @loader_path/../Frameworks @executable_path/../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "org.CorePlot.${PRODUCT_NAME:identifier}"; @@ -492,14 +533,15 @@ }; C01FCF4F08A954540054247B /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = C3880C3919DCD6A000ED0618 /* CorePlotWarnings.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = c99; + GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ""; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; MACOSX_DEPLOYMENT_TARGET = 10.8; ONLY_ACTIVE_ARCH = YES; SDKROOT = macosx; @@ -509,12 +551,14 @@ }; C01FCF5008A954540054247B /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = C3880C3919DCD6A000ED0618 /* CorePlotWarnings.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; GCC_C_LANGUAGE_STANDARD = c99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = s; GCC_PREPROCESSOR_DEFINITIONS = ""; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; MACOSX_DEPLOYMENT_TARGET = 10.8; SDKROOT = macosx; SYMROOT = "$(PROJECT_DIR)/../../build"; diff --git a/examples/CPTTestApp/CPTTestApp.xcodeproj/xcshareddata/xcschemes/CPTTestApp.xcscheme b/examples/CPTTestApp/CPTTestApp.xcodeproj/xcshareddata/xcschemes/CPTTestApp.xcscheme index b4c5662a2..a741352d0 100644 --- a/examples/CPTTestApp/CPTTestApp.xcodeproj/xcshareddata/xcschemes/CPTTestApp.xcscheme +++ b/examples/CPTTestApp/CPTTestApp.xcodeproj/xcshareddata/xcschemes/CPTTestApp.xcscheme @@ -1,6 +1,6 @@ - - - - + + - - - + + - + + + - - + + - + + diff --git a/examples/CPTTestApp/Resources/CPTTestApp.xib b/examples/CPTTestApp/Resources/Base.lproj/CPTTestApp.xib similarity index 95% rename from examples/CPTTestApp/Resources/CPTTestApp.xib rename to examples/CPTTestApp/Resources/Base.lproj/CPTTestApp.xib index 8bec09504..4b7d3ae17 100644 --- a/examples/CPTTestApp/Resources/CPTTestApp.xib +++ b/examples/CPTTestApp/Resources/Base.lproj/CPTTestApp.xib @@ -1,13 +1,14 @@ - - + + - + + - + @@ -558,18 +559,19 @@ + - + - + - - - + - + - - + + - + @@ -657,13 +659,12 @@ - - - + - - - - - - @@ -688,7 +683,7 @@ - + @@ -696,7 +691,7 @@ - + @@ -704,15 +699,15 @@ - + - + - - + @@ -745,7 +741,7 @@ y - + diff --git a/examples/CPTTestApp/Resources/PlotSymbolDemo.xib b/examples/CPTTestApp/Resources/Base.lproj/PlotSymbolDemo.xib similarity index 67% rename from examples/CPTTestApp/Resources/PlotSymbolDemo.xib rename to examples/CPTTestApp/Resources/Base.lproj/PlotSymbolDemo.xib index bffdf5c16..ce94cac6a 100644 --- a/examples/CPTTestApp/Resources/PlotSymbolDemo.xib +++ b/examples/CPTTestApp/Resources/Base.lproj/PlotSymbolDemo.xib @@ -1,26 +1,29 @@ - - + + - + + + - - + + - + + diff --git a/examples/CPTTestApp/Resources/SelectionDemo.xib b/examples/CPTTestApp/Resources/Base.lproj/SelectionDemo.xib similarity index 68% rename from examples/CPTTestApp/Resources/SelectionDemo.xib rename to examples/CPTTestApp/Resources/Base.lproj/SelectionDemo.xib index 9dee883b9..c79ae2d56 100644 --- a/examples/CPTTestApp/Resources/SelectionDemo.xib +++ b/examples/CPTTestApp/Resources/Base.lproj/SelectionDemo.xib @@ -1,26 +1,29 @@ - - + + - + + + - - + + - + + diff --git a/examples/CPTTestApp/Resources/BlueTexture.png b/examples/CPTTestApp/Resources/BlueTexture.png deleted file mode 100644 index ea004c70d..000000000 Binary files a/examples/CPTTestApp/Resources/BlueTexture.png and /dev/null differ diff --git a/examples/CPTTestApp/Source/CPTPlotSymbolTestController.m b/examples/CPTTestApp/Source/CPTPlotSymbolTestController.m index 9cb1fa30c..8cf7d0aee 100644 --- a/examples/CPTTestApp/Source/CPTPlotSymbolTestController.m +++ b/examples/CPTTestApp/Source/CPTPlotSymbolTestController.m @@ -50,7 +50,7 @@ -(void)awakeFromNib // Create a series of plots that uses the data source method for ( NSUInteger i = CPTPlotSymbolTypeNone; i <= CPTPlotSymbolTypeCustom; i++ ) { CPTScatterPlot *dataSourceLinePlot = [[CPTScatterPlot alloc] initWithFrame:newGraph.bounds]; - dataSourceLinePlot.identifier = [NSString stringWithFormat:@"%lu", (unsigned long)i]; + dataSourceLinePlot.identifier = @(i); dataSourceLinePlot.shadow = lineShadow; CPTMutableLineStyle *lineStyle = [dataSourceLinePlot.dataLineStyle mutableCopy]; @@ -67,7 +67,7 @@ -(void)awakeFromNib #pragma mark - #pragma mark Plot Data Source Methods --(NSUInteger)numberOfRecordsForPlot:(nonnull CPTPlot *)plot +-(NSUInteger)numberOfRecordsForPlot:(nonnull CPTPlot *__unused)plot { return 10; } @@ -82,7 +82,7 @@ -(nullable id)numberForPlot:(nonnull CPTPlot *)plot field:(NSUInteger)fieldEnum break; case CPTScatterPlotFieldY: - num = @( ( (NSString *)plot.identifier ).integerValue ); + num = (NSNumber *)plot.identifier; break; default: @@ -103,7 +103,7 @@ -(nullable CPTPlotSymbol *)symbolForScatterPlot:(nonnull CPTScatterPlot *)plot r symbolShadow.shadowColor = [CPTColor blackColor]; CPTPlotSymbol *symbol = [[CPTPlotSymbol alloc] init]; - symbol.symbolType = (CPTPlotSymbolType)( (NSString *)plot.identifier ).intValue; + symbol.symbolType = (CPTPlotSymbolType)((NSString *)plot.identifier).intValue; symbol.fill = [CPTFill fillWithGradient:gradientFill]; symbol.shadow = symbolShadow; @@ -116,9 +116,9 @@ -(nullable CPTPlotSymbol *)symbolForScatterPlot:(nonnull CPTScatterPlot *)plot r CGMutablePathRef path = CGPathCreateMutable(); CGPathMoveToPoint(path, NULL, 0., 0.); - CGPathAddEllipseInRect( path, NULL, CGRectMake(0., 0., 10., 10.) ); - CGPathAddEllipseInRect( path, NULL, CGRectMake(1.5, 4., 3., 3.) ); - CGPathAddEllipseInRect( path, NULL, CGRectMake(5.5, 4., 3., 3.) ); + CGPathAddEllipseInRect(path, NULL, CGRectMake(0., 0., 10., 10.)); + CGPathAddEllipseInRect(path, NULL, CGRectMake(1.5, 4., 3., 3.)); + CGPathAddEllipseInRect(path, NULL, CGRectMake(5.5, 4., 3., 3.)); CGPathMoveToPoint(path, NULL, 5., 2.); CGPathAddArc(path, NULL, 5., 3.3, 2.8, 0., M_PI, TRUE); CGPathCloseSubpath(path); diff --git a/examples/CPTTestApp/Source/Controller.m b/examples/CPTTestApp/Source/Controller.m index c47d8c3b9..9f1d5439a 100644 --- a/examples/CPTTestApp/Source/Controller.m +++ b/examples/CPTTestApp/Source/Controller.m @@ -1,5 +1,9 @@ #import "Controller.h" +#import "AxisDemoController.h" +#import "CPTPlotSymbolTestController.h" +#import "SelectionDemoController.h" + static const CGFloat kZDistanceBetweenLayers = 20.0; static NSString *const bindingsPlot = @"Bindings Plot"; @@ -9,10 +13,20 @@ @interface Controller() +-(void)plotSymbolWindowClosed; +-(void)axisDemoWindowClosed; +-(void)selectionDemoWindowClosed; + @property (nonatomic, readwrite, strong, nullable) IBOutlet CPTGraphHostingView *hostView; -@property (nonatomic, readwrite, weak, nullable) IBOutlet NSWindow *plotSymbolWindow; -@property (nonatomic, readwrite, weak, nullable) IBOutlet NSWindow *axisDemoWindow; -@property (nonatomic, readwrite, weak, nullable) IBOutlet NSWindow *selectionDemoWindow; + +@property (nonatomic, readwrite, strong, nullable) IBOutlet NSWindow *plotSymbolWindow; +@property (nonatomic, readwrite, strong, nullable) IBOutlet CPTPlotSymbolTestController *plotSymbolTestController; + +@property (nonatomic, readwrite, strong, nullable) IBOutlet NSWindow *axisDemoWindow; +@property (nonatomic, readwrite, strong, nullable) IBOutlet AxisDemoController *axisDemoController; + +@property (nonatomic, readwrite, strong, nullable) IBOutlet NSWindow *selectionDemoWindow; +@property (nonatomic, readwrite, strong, nullable) IBOutlet SelectionDemoController *selectionDemoController; @property (nonatomic, readwrite, strong, nonnull) CPTXYGraph *graph; @property (nonatomic, readwrite, strong, nullable) RotationView *overlayRotationView; @@ -32,8 +46,11 @@ @implementation Controller @synthesize hostView; @synthesize plotSymbolWindow; +@synthesize plotSymbolTestController; @synthesize axisDemoWindow; +@synthesize axisDemoController; @synthesize selectionDemoWindow; +@synthesize selectionDemoController; @synthesize graph; @synthesize overlayRotationView; @@ -64,12 +81,12 @@ -(void)awakeFromNib -(id)newObject { - NSNumber *x1 = @(1.0 + ( (NSMutableArray *)self.content ).count * 0.05); + NSNumber *x1 = @(1.0 + ((NSMutableArray *)self.content).count * 0.05); NSNumber *y1 = @(1.2 * arc4random() / (double)UINT32_MAX + 1.2); return @{ - @"x": x1, - @"y": y1 + @"x": x1, + @"y": y1 }; } @@ -80,9 +97,7 @@ -(void)setupGraph { // Create graph and apply a dark theme CPTXYGraph *newGraph = [[CPTXYGraph alloc] initWithFrame:NSRectToCGRect(self.hostView.bounds)]; - CPTTheme *theme = [CPTTheme themeNamed:kCPTDarkGradientTheme]; - [newGraph applyTheme:theme]; self.hostView.hostedGraph = newGraph; self.graph = newGraph; @@ -91,8 +106,8 @@ -(void)setupGraph NSString *lineTwo = @"This is the Second Line of the Title"; NSMutableAttributedString *graphTitle = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@\n%@", lineOne, lineTwo]]; - [graphTitle addAttribute:NSForegroundColorAttributeName value:[NSColor grayColor] range:NSMakeRange(0, lineOne.length)]; - [graphTitle addAttribute:NSForegroundColorAttributeName value:[NSColor darkGrayColor] range:NSMakeRange(lineOne.length + 1, lineTwo.length)]; + [graphTitle addAttribute:NSForegroundColorAttributeName value:[NSColor labelColor] range:NSMakeRange(0, lineOne.length)]; + [graphTitle addAttribute:NSForegroundColorAttributeName value:[NSColor secondaryLabelColor] range:NSMakeRange(lineOne.length + 1, lineTwo.length)]; NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init]; paragraphStyle.alignment = CPTTextAlignmentCenter; [graphTitle addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, graphTitle.length)]; @@ -105,11 +120,14 @@ -(void)setupGraph newGraph.titleDisplacement = CGPointMake(0.0, 50.0); newGraph.titlePlotAreaFrameAnchor = CPTRectAnchorTop; + // newGraph.fill = [CPTFill fillWithColor:[CPTColor colorWithNSColor:[NSColor windowBackgroundColor]]]; + newGraph.plotAreaFrame.fill = [CPTFill fillWithColor:[CPTColor colorWithNSColor:[NSColor controlBackgroundColor]]]; + // Graph padding - newGraph.paddingLeft = 60.0; + newGraph.paddingLeft = 10.0; newGraph.paddingTop = 60.0; - newGraph.paddingRight = 60.0; - newGraph.paddingBottom = 60.0; + newGraph.paddingRight = 10.0; + newGraph.paddingBottom = 10.0; // Plot area delegate newGraph.plotAreaFrame.plotArea.delegate = self; @@ -126,20 +144,25 @@ -(void)setupAxes // Grid line styles CPTMutableLineStyle *majorGridLineStyle = [CPTMutableLineStyle lineStyle]; majorGridLineStyle.lineWidth = 0.75; - majorGridLineStyle.lineColor = [[CPTColor colorWithGenericGray:0.2] colorWithAlphaComponent:0.75]; + majorGridLineStyle.lineColor = [[CPTColor colorWithNSColor:[NSColor gridColor]] colorWithAlphaComponent:0.75]; CPTMutableLineStyle *minorGridLineStyle = [CPTMutableLineStyle lineStyle]; minorGridLineStyle.lineWidth = 0.25; - minorGridLineStyle.lineColor = [[CPTColor whiteColor] colorWithAlphaComponent:0.1]; + minorGridLineStyle.lineColor = [[CPTColor colorWithNSColor:[NSColor gridColor]] colorWithAlphaComponent:0.1]; CPTMutableLineStyle *redLineStyle = [CPTMutableLineStyle lineStyle]; redLineStyle.lineWidth = 10.0; - redLineStyle.lineColor = [[CPTColor redColor] colorWithAlphaComponent:0.5]; + redLineStyle.lineColor = [[CPTColor colorWithNSColor:[NSColor systemRedColor]] colorWithAlphaComponent:0.5]; // Axes // Label x axis with a fixed interval policy CPTXYAxisSet *axisSet = (CPTXYAxisSet *)self.graph.axisSet; CPTXYAxis *x = axisSet.xAxis; + + CPTMutableTextStyle *textStyle = [x.titleTextStyle mutableCopy]; + textStyle.color = [CPTColor colorWithNSColor:[NSColor secondaryLabelColor]]; + + x.labelTextStyle = textStyle; x.majorIntervalLength = @0.5; x.orthogonalPosition = @2.0; x.minorTicksPerInterval = 2; @@ -151,8 +174,8 @@ -(void)setupAxes x.labelExclusionRanges = exclusionRanges; NSMutableAttributedString *xTitle = [[NSMutableAttributedString alloc] initWithString:@"X Axis\nLine 2"]; - [xTitle addAttribute:NSForegroundColorAttributeName value:[NSColor whiteColor] range:NSMakeRange(0, 6)]; - [xTitle addAttribute:NSForegroundColorAttributeName value:[NSColor grayColor] range:NSMakeRange(7, 6)]; + [xTitle addAttribute:NSForegroundColorAttributeName value:[NSColor secondaryLabelColor] range:NSMakeRange(0, 6)]; + [xTitle addAttribute:NSForegroundColorAttributeName value:[NSColor tertiaryLabelColor] range:NSMakeRange(7, 6)]; NSMutableParagraphStyle *xParagraphStyle = [[NSMutableParagraphStyle alloc] init]; xParagraphStyle.alignment = CPTTextAlignmentCenter; [xTitle addAttribute:NSParagraphStyleAttributeName value:xParagraphStyle range:NSMakeRange(0, xTitle.length)]; @@ -164,6 +187,7 @@ -(void)setupAxes // Label y with an automatic label policy. CPTXYAxis *y = axisSet.yAxis; y.labelingPolicy = CPTAxisLabelingPolicyAutomatic; + y.labelTextStyle = textStyle; y.orthogonalPosition = @2.0; y.minorTicksPerInterval = 2; y.preferredNumberOfMajorTicks = 8; @@ -176,8 +200,8 @@ -(void)setupAxes y.labelExclusionRanges = exclusionRanges; NSMutableAttributedString *yTitle = [[NSMutableAttributedString alloc] initWithString:@"Y Axis\nLine 2"]; - [yTitle addAttribute:NSForegroundColorAttributeName value:[NSColor whiteColor] range:NSMakeRange(0, 6)]; - [yTitle addAttribute:NSForegroundColorAttributeName value:[NSColor grayColor] range:NSMakeRange(7, 6)]; + [yTitle addAttribute:NSForegroundColorAttributeName value:[NSColor secondaryLabelColor] range:NSMakeRange(0, 6)]; + [yTitle addAttribute:NSForegroundColorAttributeName value:[NSColor tertiaryLabelColor] range:NSMakeRange(7, 6)]; NSMutableParagraphStyle *yParagraphStyle = [[NSMutableParagraphStyle alloc] init]; yParagraphStyle.alignment = CPTTextAlignmentCenter; [yTitle addAttribute:NSParagraphStyleAttributeName value:yParagraphStyle range:NSMakeRange(0, yTitle.length)]; @@ -192,6 +216,7 @@ -(void)setupAxes // Add an extra y axis (red) // We add constraints to this axis below CPTXYAxis *y2 = [[CPTXYAxis alloc] initWithFrame:CGRectZero]; + y2.labelingPolicy = CPTAxisLabelingPolicyAutomatic; y2.orthogonalPosition = @3.0; y2.minorTicksPerInterval = 0; @@ -206,8 +231,10 @@ -(void)setupAxes y2.minorTickLineStyle = nil; y2.labelTextStyle = nil; y2.visibleRange = [CPTPlotRange plotRangeWithLocation:@2.0 length:@3.0]; + y2.titleTextStyle = textStyle; y2.title = @"Y2 title"; y2.titleLocation = @3.0; + // Set axes self.graph.axisSet.axes = @[x, y, y2]; } @@ -232,17 +259,19 @@ -(void)setupScatterPlots [boundLinePlot bind:CPTScatterPlotBindingYValues toObject:self withKeyPath:@"arrangedObjects.y" options:nil]; // Put an area gradient under the plot above - CPTImage *fillImage = [CPTImage imageNamed:@"BlueTexture"]; - fillImage.tiled = YES; - CPTFill *areaImageFill = [CPTFill fillWithImage:fillImage]; - boundLinePlot.areaFill = areaImageFill; + CPTColor *areaColor = [CPTColor colorWithComponentRed:0.3 green:0.3 blue:1.0 alpha:0.8]; + CPTGradient *areaGradient = [CPTGradient gradientWithBeginningColor:areaColor endingColor:[CPTColor clearColor]]; + areaGradient.angle = -90.0; + CPTFill *areaGradientFill = [CPTFill fillWithGradient:areaGradient]; + + boundLinePlot.areaFill = areaGradientFill; boundLinePlot.areaBaseValue = @1.0; // Add plot symbols CPTMutableLineStyle *symbolLineStyle = [CPTMutableLineStyle lineStyle]; symbolLineStyle.lineColor = [CPTColor blackColor]; CPTPlotSymbol *plotSymbol = [CPTPlotSymbol ellipsePlotSymbol]; - plotSymbol.fill = [CPTFill fillWithColor:[CPTColor blueColor]]; + plotSymbol.fill = [CPTFill fillWithColor:[CPTColor colorWithNSColor:[NSColor systemBlueColor]]]; plotSymbol.lineStyle = symbolLineStyle; plotSymbol.size = CGSizeMake(10.0, 10.0); boundLinePlot.plotSymbol = plotSymbol; @@ -259,14 +288,14 @@ -(void)setupScatterPlots lineStyle = [dataSourceLinePlot.dataLineStyle mutableCopy]; lineStyle.lineWidth = 1.0; - lineStyle.lineColor = [CPTColor greenColor]; + lineStyle.lineColor = [CPTColor colorWithNSColor:[NSColor systemGreenColor]]; dataSourceLinePlot.dataLineStyle = lineStyle; dataSourceLinePlot.dataSource = self; - CPTMutableTextStyle *whiteTextStyle = [CPTMutableTextStyle textStyle]; - whiteTextStyle.color = [CPTColor whiteColor]; - dataSourceLinePlot.labelTextStyle = whiteTextStyle; + CPTMutableTextStyle *textStyle = [CPTMutableTextStyle textStyle]; + textStyle.color = [CPTColor colorWithNSColor:[NSColor secondaryLabelColor]]; + dataSourceLinePlot.labelTextStyle = textStyle; dataSourceLinePlot.labelOffset = 5.0; dataSourceLinePlot.labelRotation = M_PI_4; @@ -276,10 +305,11 @@ -(void)setupScatterPlots dataSourceLinePlot.interpolation = CPTScatterPlotInterpolationStepped; // Put an area gradient under the plot above - CPTColor *areaColor = [CPTColor colorWithComponentRed:0.3 green:1.0 blue:0.3 alpha:0.8]; - CPTGradient *areaGradient = [CPTGradient gradientWithBeginningColor:areaColor endingColor:[CPTColor clearColor]]; + areaColor = [CPTColor colorWithComponentRed:0.3 green:1.0 blue:0.3 alpha:0.8]; + areaGradient = [CPTGradient gradientWithBeginningColor:areaColor endingColor:[CPTColor clearColor]]; areaGradient.angle = -90.0; - CPTFill *areaGradientFill = [CPTFill fillWithGradient:areaGradient]; + areaGradientFill = [CPTFill fillWithGradient:areaGradient]; + dataSourceLinePlot.areaFill = areaGradientFill; dataSourceLinePlot.areaBaseValue = @1.75; @@ -338,15 +368,16 @@ -(void)setupBarPlots [self.graph addPlotSpace:barPlotSpace]; // First bar plot - CPTMutableTextStyle *whiteTextStyle = [CPTMutableTextStyle textStyle]; - whiteTextStyle.color = [CPTColor whiteColor]; + CPTMutableTextStyle *textStyle = [CPTMutableTextStyle textStyle]; + textStyle.color = [CPTColor colorWithNSColor:[NSColor secondaryLabelColor]]; + CPTBarPlot *barPlot = [CPTBarPlot tubularBarPlotWithColor:[CPTColor darkGrayColor] horizontalBars:YES]; barPlot.baseValue = @20.0; barPlot.dataSource = self; barPlot.barOffset = @(-0.25); barPlot.identifier = barPlot1; barPlot.plotRange = [CPTPlotRange plotRangeWithLocation:@0.0 length:@7.0]; - barPlot.labelTextStyle = whiteTextStyle; + barPlot.labelTextStyle = textStyle; [self.graph addPlot:barPlot toPlotSpace:barPlotSpace]; // Second bar plot @@ -364,14 +395,14 @@ -(void)setupBarPlots #pragma mark - #pragma mark Actions --(IBAction)reloadDataSourcePlot:(nullable id)sender +-(IBAction)reloadDataSourcePlot:(nullable id __unused)sender { CPTPlot *plot = [self.graph plotWithIdentifier:dataSourcePlot]; [plot reloadData]; } --(IBAction)removeData:(nullable id)sender +-(IBAction)removeData:(nullable id __unused)sender { NSUInteger index = self.selectionIndex; @@ -383,7 +414,7 @@ -(IBAction)removeData:(nullable id)sender } } --(IBAction)insertData:(nullable id)sender +-(IBAction)insertData:(nullable id __unused)sender { NSUInteger index = self.selectionIndex; @@ -414,7 +445,7 @@ -(nullable id)numberForPlot:(nonnull CPTPlot *)plot field:(NSUInteger)fieldEnum NSNumber *num; if ( [plot isKindOfClass:[CPTBarPlot class]] ) { - num = @( (index + 1) * (index + 1) ); + num = @((index + 1) * (index + 1)); if ( [plot.identifier isEqual:barPlot2] ) { num = @(num.integerValue - 10); } @@ -434,7 +465,7 @@ -(nullable CPTLayer *)dataLabelForPlot:(nonnull CPTPlot *)plot recordIndex:(NSUI if ( [(NSString *) plot.identifier isEqualToString:barPlot2] ) { return (id)[NSNull null]; // Don't show any label } - else if ( [(NSString *) plot.identifier isEqualToString:barPlot1] && (index < 4) ) { + else if ( [(NSString *) plot.identifier isEqualToString:barPlot1] && (index < 4)) { return (id)[NSNull null]; } else if ( index % 4 ) { @@ -448,7 +479,7 @@ -(nullable CPTLayer *)dataLabelForPlot:(nonnull CPTPlot *)plot recordIndex:(NSUI #pragma mark - #pragma mark CPTScatterPlot delegate method --(void)scatterPlot:(nonnull CPTScatterPlot *)plot plotSymbolWasSelectedAtRecordIndex:(NSUInteger)index +-(void)scatterPlot:(nonnull CPTScatterPlot *__unused)plot plotSymbolWasSelectedAtRecordIndex:(NSUInteger)index { CPTPlotSpaceAnnotation *annotation = self.symbolTextAnnotation; @@ -459,7 +490,7 @@ -(void)scatterPlot:(nonnull CPTScatterPlot *)plot plotSymbolWasSelectedAtRecordI // Setup a style for the annotation CPTMutableTextStyle *hitAnnotationTextStyle = [CPTMutableTextStyle textStyle]; - hitAnnotationTextStyle.color = [CPTColor whiteColor]; + hitAnnotationTextStyle.color = [CPTColor colorWithNSColor:[NSColor labelColor]]; hitAnnotationTextStyle.fontSize = CPTFloat(16.0); hitAnnotationTextStyle.fontName = @"Helvetica-Bold"; @@ -504,14 +535,15 @@ -(void)barPlot:(nonnull CPTBarPlot *)plot barWasSelectedAtRecordIndex:(NSUIntege // Setup a style for the annotation CPTMutableTextStyle *hitAnnotationTextStyle = [CPTMutableTextStyle textStyle]; - hitAnnotationTextStyle.color = [CPTColor redColor]; + hitAnnotationTextStyle.color = [CPTColor colorWithNSColor:[NSColor labelColor]]; hitAnnotationTextStyle.fontSize = 16.0; hitAnnotationTextStyle.fontName = @"Helvetica-Bold"; // Determine point of symbol in plot coordinates - NSNumber *x = @0; - NSNumber *y = [self numberForPlot:plot field:0 recordIndex:index]; + NSNumber *x = @0; + NSNumber *y = [self numberForPlot:plot field:CPTBarPlotFieldBarLocation recordIndex:index]; + CPTNumberArray *anchorPoint = @[x, @(index)]; // Add annotation @@ -521,10 +553,10 @@ -(void)barPlot:(nonnull CPTBarPlot *)plot barWasSelectedAtRecordIndex:(NSUIntege NSString *yString = [formatter stringFromNumber:y]; // Now add the annotation to the plot area - CPTPlotSpace *defaultSpace = self.graph.defaultPlotSpace; - if ( defaultSpace ) { + CPTPlotSpace *plotSpace = plot.plotSpace; + if ( plotSpace ) { CPTTextLayer *textLayer = [[CPTTextLayer alloc] initWithText:yString style:hitAnnotationTextStyle]; - annotation = [[CPTPlotSpaceAnnotation alloc] initWithPlotSpace:defaultSpace anchorPlotPoint:anchorPoint]; + annotation = [[CPTPlotSpaceAnnotation alloc] initWithPlotSpace:plotSpace anchorPlotPoint:anchorPoint]; annotation.contentLayer = textLayer; annotation.displacement = CGPointMake(0.0, 0.0); [self.graph.plotAreaFrame.plotArea addAnnotation:annotation]; @@ -558,7 +590,7 @@ -(void)barPlot:(nonnull CPTBarPlot *)plot barWasSelectedAtRecordIndex:(NSUIntege #pragma mark - #pragma mark Plot area delegate method --(void)plotAreaWasSelected:(nonnull CPTPlotArea *)plotArea +-(void)plotAreaWasSelected:(nonnull CPTPlotArea *__unused)plotArea { // Remove the annotation CPTPlotSpaceAnnotation *annotation = self.symbolTextAnnotation; @@ -572,7 +604,7 @@ -(void)plotAreaWasSelected:(nonnull CPTPlotArea *)plotArea #pragma mark - #pragma mark PDF / image export --(IBAction)exportToPDF:(nullable id)sender +-(IBAction)exportToPDF:(nullable id __unused)sender { NSSavePanel *pdfSavingDialog = [NSSavePanel savePanel]; @@ -588,7 +620,7 @@ -(IBAction)exportToPDF:(nullable id)sender } } --(IBAction)exportToPNG:(nullable id)sender +-(IBAction)exportToPNG:(nullable id __unused)sender { NSSavePanel *pngSavingDialog = [NSSavePanel savePanel]; @@ -610,7 +642,7 @@ -(IBAction)exportToPNG:(nullable id)sender #pragma mark - #pragma mark Printing --(IBAction)printDocument:(nullable id)sender +-(IBAction)printDocument:(nullable id __unused)sender { NSPrintInfo *printInfo = [NSPrintInfo sharedPrintInfo]; @@ -632,15 +664,15 @@ -(IBAction)printDocument:(nullable id)sender } } --(void)printOperationDidRun:(nonnull NSPrintOperation *)printOperation success:(BOOL)success contextInfo:(nullable void *)contextInfo +-(void)printOperationDidRun:(nonnull NSPrintOperation *__unused)printOperation success:(BOOL __unused)success contextInfo:(nullable void *__unused)contextInfo { - // print delegate +// print delegate } #pragma mark - #pragma mark Layer exploding for illustration --(IBAction)explodeLayers:(nullable id)sender +-(IBAction)explodeLayers:(nullable id __unused)sender { CATransform3D perspectiveRotation = CATransform3DMakeRotation(-40.0 * M_PI / 180.0, 0.0, 1.0, 0.0); @@ -679,7 +711,7 @@ +(void)recursivelySplitSublayersInZForLayer:(nonnull CALayer *)layer depthLevel: } } --(IBAction)reassembleLayers:(nullable id)sender +-(IBAction)reassembleLayers:(nullable id __unused)sender { [CATransaction begin]; [CATransaction setValue:@1.0f forKey:kCATransactionAnimationDuration]; @@ -716,6 +748,11 @@ -(IBAction)plotSymbolDemo:(nullable id)sender NSWindow *window = self.plotSymbolWindow; [window makeKeyAndOrderFront:sender]; + + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(plotSymbolWindowClosed) + name:NSWindowWillCloseNotification + object:window]; } -(IBAction)axisDemo:(nullable id)sender @@ -728,6 +765,11 @@ -(IBAction)axisDemo:(nullable id)sender NSWindow *window = self.axisDemoWindow; [window makeKeyAndOrderFront:sender]; + + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(axisDemoWindowClosed) + name:NSWindowWillCloseNotification + object:window]; } -(IBAction)selectionDemo:(nullable id)sender @@ -740,6 +782,29 @@ -(IBAction)selectionDemo:(nullable id)sender NSWindow *window = self.selectionDemoWindow; [window makeKeyAndOrderFront:sender]; + + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(selectionDemoWindowClosed) + name:NSWindowWillCloseNotification + object:window]; +} + +-(void)plotSymbolWindowClosed +{ + self.plotSymbolWindow = nil; + self.plotSymbolTestController = nil; +} + +-(void)axisDemoWindowClosed +{ + self.axisDemoWindow = nil; + self.axisDemoController = nil; +} + +-(void)selectionDemoWindowClosed +{ + self.selectionDemoWindow = nil; + self.selectionDemoController = nil; } #pragma mark - @@ -780,7 +845,7 @@ -(void)setLabelRotation:(CGFloat)newRotation { labelRotation = newRotation; - ( (CPTXYAxisSet *)self.graph.axisSet ).yAxis.labelRotation = newRotation; + ((CPTXYAxisSet *)self.graph.axisSet).yAxis.labelRotation = newRotation; [self.graph plotWithIdentifier:dataSourcePlot].labelRotation = newRotation; } diff --git a/examples/CPTTestApp/Source/RotationView.h b/examples/CPTTestApp/Source/RotationView.h index 80f9a40eb..0ec33c63c 100644 --- a/examples/CPTTestApp/Source/RotationView.h +++ b/examples/CPTTestApp/Source/RotationView.h @@ -17,4 +17,5 @@ @protocol CPTRotationDelegate -(void)rotateObjectUsingTransform:(CATransform3D)rotationTransform; + @end diff --git a/examples/CPTTestApp/Source/RotationView.m b/examples/CPTTestApp/Source/RotationView.m index f65a18c17..68b892fab 100644 --- a/examples/CPTTestApp/Source/RotationView.m +++ b/examples/CPTTestApp/Source/RotationView.m @@ -20,7 +20,7 @@ @implementation RotationView -(nonnull instancetype)initWithFrame:(NSRect)frame { - if ( (self = [super initWithFrame:frame]) ) { + if ((self = [super initWithFrame:frame])) { rotationTransform = CATransform3DIdentity; // Initialization code here. } @@ -30,7 +30,7 @@ -(nonnull instancetype)initWithFrame:(NSRect)frame #pragma mark - #pragma mark Mouse handling methods --(BOOL)acceptsFirstMouse:(nullable NSEvent *)theEvent +-(BOOL)acceptsFirstMouse:(nullable NSEvent *__unused)theEvent { return YES; } @@ -50,12 +50,13 @@ -(void)mouseDragged:(nonnull NSEvent *)theEvent CGFloat totalRotation = sqrt(displacementInX * displacementInX + displacementInY * displacementInY); CATransform3D oldTransform = self.rotationTransform; - CATransform3D newTransform = CATransform3DRotate( oldTransform, totalRotation * M_PI / 180.0, - ( (displacementInX / totalRotation) * oldTransform.m12 + (displacementInY / totalRotation) * oldTransform.m11 ), - ( (displacementInX / totalRotation) * oldTransform.m22 + (displacementInY / totalRotation) * oldTransform.m21 ), - ( (displacementInX / totalRotation) * oldTransform.m32 + (displacementInY / totalRotation) * oldTransform.m31 ) ); + CATransform3D newTransform = CATransform3DRotate(oldTransform, totalRotation * M_PI / 180.0, + ((displacementInX / totalRotation) * oldTransform.m12 + (displacementInY / totalRotation) * oldTransform.m11), + ((displacementInX / totalRotation) * oldTransform.m22 + (displacementInY / totalRotation) * oldTransform.m21), + ((displacementInX / totalRotation) * oldTransform.m32 + (displacementInY / totalRotation) * oldTransform.m31)); id theDelegate = self.rotationDelegate; + [theDelegate rotateObjectUsingTransform:newTransform]; self.rotationTransform = newTransform; diff --git a/examples/CPTTestApp/Source/SelectionDemoController.h b/examples/CPTTestApp/Source/SelectionDemoController.h index d4e3be7dc..a94d0e322 100644 --- a/examples/CPTTestApp/Source/SelectionDemoController.h +++ b/examples/CPTTestApp/Source/SelectionDemoController.h @@ -1,6 +1,8 @@ #import #import -@interface SelectionDemoController : NSObject +@interface SelectionDemoController : NSObject @end diff --git a/examples/CPTTestApp/Source/SelectionDemoController.m b/examples/CPTTestApp/Source/SelectionDemoController.m index 088ca6cd9..bcf2fdde1 100644 --- a/examples/CPTTestApp/Source/SelectionDemoController.m +++ b/examples/CPTTestApp/Source/SelectionDemoController.m @@ -266,7 +266,7 @@ -(nullable CPTPlotSymbol *)symbolForScatterPlot:(nonnull CPTScatterPlot *)plot r CPTPlotSymbol *symbol = (id)[NSNull null]; - if ( [(NSString *) plot.identifier isEqualToString:SELECTION_PLOT] && (index == 2) ) { + if ( [(NSString *) plot.identifier isEqualToString:SELECTION_PLOT] && (index == 2)) { if ( !redDot ) { redDot = [[CPTPlotSymbol alloc] init]; redDot.symbolType = CPTPlotSymbolTypeEllipse; @@ -282,7 +282,7 @@ -(nullable CPTPlotSymbol *)symbolForScatterPlot:(nonnull CPTScatterPlot *)plot r #pragma mark - #pragma mark CPTScatterPlot delegate methods --(void)scatterPlot:(nonnull CPTScatterPlot *)plot plotSymbolWasSelectedAtRecordIndex:(NSUInteger)index +-(void)scatterPlot:(nonnull CPTScatterPlot *__unused)plot plotSymbolWasSelectedAtRecordIndex:(NSUInteger)index { self.selectedIndex = index; } @@ -296,6 +296,7 @@ -(BOOL)plotSpace:(nonnull CPTPlotSpace *)space shouldHandlePointingDeviceDownEve self.selectedIndex = NSUIntegerMax; return YES; } + #endif #pragma mark - diff --git a/examples/CPTTestApp/English.lproj/InfoPlist.strings b/examples/CPTTestApp/en.lproj/InfoPlist.strings similarity index 100% rename from examples/CPTTestApp/English.lproj/InfoPlist.strings rename to examples/CPTTestApp/en.lproj/InfoPlist.strings diff --git a/examples/CorePlotExamples.xcworkspace/contents.xcworkspacedata b/examples/CorePlotExamples.xcworkspace/contents.xcworkspacedata index df38f3d5a..a9ec2bf00 100644 --- a/examples/CorePlotExamples.xcworkspace/contents.xcworkspacedata +++ b/examples/CorePlotExamples.xcworkspace/contents.xcworkspacedata @@ -30,18 +30,12 @@ - - - - + + + + IDEDidComputeMac32BitWarning + + + diff --git a/examples/CorePlotExamples.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/examples/CorePlotExamples.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 000000000..0c67376eb --- /dev/null +++ b/examples/CorePlotExamples.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,5 @@ + + + + + diff --git a/examples/CorePlotGallery/Plot_Gallery_Mac-Info.plist b/examples/CorePlotGallery/Base.lproj/Plot_Gallery_Mac-Info.plist similarity index 94% rename from examples/CorePlotGallery/Plot_Gallery_Mac-Info.plist rename to examples/CorePlotGallery/Base.lproj/Plot_Gallery_Mac-Info.plist index b0cb1bbde..0bd38f049 100644 --- a/examples/CorePlotGallery/Plot_Gallery_Mac-Info.plist +++ b/examples/CorePlotGallery/Base.lproj/Plot_Gallery_Mac-Info.plist @@ -20,6 +20,8 @@ ???? CFBundleVersion 1 + LSApplicationCategoryType + LSMinimumSystemVersion ${MACOSX_DEPLOYMENT_TARGET} NSMainNibFile diff --git a/examples/CorePlotGallery/Plot_Gallery_iOS-Info.plist b/examples/CorePlotGallery/Base.lproj/Plot_Gallery_iOS-Info.plist similarity index 100% rename from examples/CorePlotGallery/Plot_Gallery_iOS-Info.plist rename to examples/CorePlotGallery/Base.lproj/Plot_Gallery_iOS-Info.plist diff --git a/examples/CorePlotGallery/Plot_Gallery_tvOS-Info.plist b/examples/CorePlotGallery/Base.lproj/Plot_Gallery_tvOS-Info.plist similarity index 100% rename from examples/CorePlotGallery/Plot_Gallery_tvOS-Info.plist rename to examples/CorePlotGallery/Base.lproj/Plot_Gallery_tvOS-Info.plist diff --git a/examples/CorePlotGallery/Plot Gallery-Mac/PlotViewItem.xib b/examples/CorePlotGallery/Plot Gallery-Mac/PlotViewItem.xib new file mode 100644 index 000000000..047384075 --- /dev/null +++ b/examples/CorePlotGallery/Plot Gallery-Mac/PlotViewItem.xib @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/CorePlotGallery/Plot Gallery-iOS/Images.xcassets/AppIcon.appiconset/Contents.json b/examples/CorePlotGallery/Plot Gallery-iOS/Images.xcassets/AppIcon.appiconset/Contents.json index 853a3c734..b3e167fda 100644 --- a/examples/CorePlotGallery/Plot Gallery-iOS/Images.xcassets/AppIcon.appiconset/Contents.json +++ b/examples/CorePlotGallery/Plot Gallery-iOS/Images.xcassets/AppIcon.appiconset/Contents.json @@ -1,5 +1,15 @@ { "images" : [ + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "3x" + }, { "size" : "29x29", "idiom" : "iphone", @@ -54,6 +64,16 @@ "filename" : "Icon-60@3x.png", "scale" : "3x" }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "2x" + }, { "idiom" : "ipad", "size" : "29x29", @@ -116,6 +136,12 @@ "idiom" : "ipad", "filename" : "Icon-iPadPro@2x.png", "scale" : "2x" + }, + { + "size" : "1024x1024", + "idiom" : "ios-marketing", + "filename" : "iTunesArtwork.png", + "scale" : "1x" } ], "info" : { diff --git a/examples/CorePlotGallery/Plot Gallery-iOS/Images.xcassets/AppIcon.appiconset/iTunesArtwork.png b/examples/CorePlotGallery/Plot Gallery-iOS/Images.xcassets/AppIcon.appiconset/iTunesArtwork.png new file mode 100644 index 000000000..228e5b861 Binary files /dev/null and b/examples/CorePlotGallery/Plot Gallery-iOS/Images.xcassets/AppIcon.appiconset/iTunesArtwork.png differ diff --git a/examples/CorePlotGallery/Plot Gallery-iOS/Images.xcassets/Contents.json b/examples/CorePlotGallery/Plot Gallery-iOS/Images.xcassets/Contents.json new file mode 100644 index 000000000..da4a164c9 --- /dev/null +++ b/examples/CorePlotGallery/Plot Gallery-iOS/Images.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/examples/AAPLot/AAPLot/Images.xcassets/LaunchImage.launchimage/Contents.json b/examples/CorePlotGallery/Plot Gallery-iOS/Images.xcassets/LaunchImage.launchimage/Contents.json similarity index 88% rename from examples/AAPLot/AAPLot/Images.xcassets/LaunchImage.launchimage/Contents.json rename to examples/CorePlotGallery/Plot Gallery-iOS/Images.xcassets/LaunchImage.launchimage/Contents.json index 3dd8aa5b6..6d2d4295e 100644 --- a/examples/AAPLot/AAPLot/Images.xcassets/LaunchImage.launchimage/Contents.json +++ b/examples/CorePlotGallery/Plot Gallery-iOS/Images.xcassets/LaunchImage.launchimage/Contents.json @@ -1,5 +1,21 @@ { "images" : [ + { + "orientation" : "portrait", + "idiom" : "iphone", + "extent" : "full-screen", + "minimum-system-version" : "11.0", + "subtype" : "2436h", + "scale" : "3x" + }, + { + "orientation" : "landscape", + "idiom" : "iphone", + "extent" : "full-screen", + "minimum-system-version" : "11.0", + "subtype" : "2436h", + "scale" : "3x" + }, { "orientation" : "portrait", "idiom" : "iphone", diff --git a/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Back.imagestacklayer/Content.imageset/Contents.json b/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Back.imagestacklayer/Content.imageset/Contents.json index f0e3ac4e2..7aa641214 100644 --- a/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Back.imagestacklayer/Content.imageset/Contents.json +++ b/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Back.imagestacklayer/Content.imageset/Contents.json @@ -4,6 +4,10 @@ "idiom" : "tv", "filename" : "PlotGalleryLargeIconBack.png", "scale" : "1x" + }, + { + "idiom" : "tv", + "scale" : "2x" } ], "info" : { diff --git a/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Front.imagestacklayer/Content.imageset/Contents.json b/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Front.imagestacklayer/Content.imageset/Contents.json index f8bc2faa1..f9614e449 100644 --- a/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Front.imagestacklayer/Content.imageset/Contents.json +++ b/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Front.imagestacklayer/Content.imageset/Contents.json @@ -4,6 +4,10 @@ "idiom" : "tv", "filename" : "PlotGalleryLargeIconFront.png", "scale" : "1x" + }, + { + "idiom" : "tv", + "scale" : "2x" } ], "info" : { diff --git a/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Back.imagestacklayer/Content.imageset/Contents.json b/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Back.imagestacklayer/Content.imageset/Contents.json index c5936bfc4..2f7e2f531 100644 --- a/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Back.imagestacklayer/Content.imageset/Contents.json +++ b/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Back.imagestacklayer/Content.imageset/Contents.json @@ -4,6 +4,10 @@ "idiom" : "tv", "filename" : "PlotGallerySmallIconBack.png", "scale" : "1x" + }, + { + "idiom" : "tv", + "scale" : "2x" } ], "info" : { diff --git a/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Front.imagestacklayer/Content.imageset/Contents.json b/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Front.imagestacklayer/Content.imageset/Contents.json index 59bfa5a6d..387ff905b 100644 --- a/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Front.imagestacklayer/Content.imageset/Contents.json +++ b/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Front.imagestacklayer/Content.imageset/Contents.json @@ -4,6 +4,10 @@ "idiom" : "tv", "filename" : "PlotGallerySmallIconFront.png", "scale" : "1x" + }, + { + "idiom" : "tv", + "scale" : "2x" } ], "info" : { diff --git a/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Contents.json b/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Contents.json index 6a3dcfa52..dea6e49fd 100644 --- a/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Contents.json +++ b/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Contents.json @@ -12,6 +12,12 @@ "filename" : "App Icon - Small.imagestack", "role" : "primary-app-icon" }, + { + "size" : "2320x720", + "idiom" : "tv", + "filename" : "Top Shelf Image Wide.imageset", + "role" : "top-shelf-image-wide" + }, { "size" : "1920x720", "idiom" : "tv", @@ -23,4 +29,4 @@ "version" : 1, "author" : "xcode" } -} +} \ No newline at end of file diff --git a/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image Wide.imageset/Contents.json b/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image Wide.imageset/Contents.json new file mode 100644 index 000000000..16a370df0 --- /dev/null +++ b/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image Wide.imageset/Contents.json @@ -0,0 +1,16 @@ +{ + "images" : [ + { + "idiom" : "tv", + "scale" : "1x" + }, + { + "idiom" : "tv", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image.imageset/Contents.json b/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image.imageset/Contents.json index 9c2fa6a7e..167022b51 100644 --- a/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image.imageset/Contents.json +++ b/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image.imageset/Contents.json @@ -4,6 +4,10 @@ "idiom" : "tv", "filename" : "PlotGalleryTopShelf.png", "scale" : "1x" + }, + { + "idiom" : "tv", + "scale" : "2x" } ], "info" : { diff --git a/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/LaunchImage.launchimage/Contents.json b/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/LaunchImage.launchimage/Contents.json index 93e7c5fb0..f4a929b0d 100644 --- a/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/LaunchImage.launchimage/Contents.json +++ b/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/LaunchImage.launchimage/Contents.json @@ -1,5 +1,12 @@ { "images" : [ + { + "orientation" : "landscape", + "idiom" : "tv", + "extent" : "full-screen", + "minimum-system-version" : "11.0", + "scale" : "2x" + }, { "orientation" : "landscape", "idiom" : "tv", diff --git a/examples/CorePlotGallery/Plot_Gallery.xcodeproj/project.pbxproj b/examples/CorePlotGallery/Plot_Gallery.xcodeproj/project.pbxproj index 72ef8b50e..5fc2950c5 100644 --- a/examples/CorePlotGallery/Plot_Gallery.xcodeproj/project.pbxproj +++ b/examples/CorePlotGallery/Plot_Gallery.xcodeproj/project.pbxproj @@ -9,8 +9,6 @@ /* Begin PBXBuildFile section */ 4F22FF4912342978006BF615 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F22FF4712342978006BF615 /* main.m */; }; 4F22FF4C1234298E006BF615 /* Plot_Gallery_MacAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F22FF4B1234298E006BF615 /* Plot_Gallery_MacAppDelegate.m */; }; - 4F22FF5B12342A21006BF615 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 4F22FF5712342A21006BF615 /* InfoPlist.strings */; }; - 4F22FF5C12342A21006BF615 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4F22FF5912342A21006BF615 /* MainMenu.xib */; }; 4F22FFA412342D7C006BF615 /* CompositePlot.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F22FF9B12342D7C006BF615 /* CompositePlot.m */; }; 4F22FFA512342D7C006BF615 /* GradientScatterPlot.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F22FF9D12342D7C006BF615 /* GradientScatterPlot.m */; }; 4F22FFA612342D7C006BF615 /* SimplePieChart.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F22FF9F12342D7C006BF615 /* SimplePieChart.m */; }; @@ -19,7 +17,6 @@ 4F22FFAF12342DB1006BF615 /* PlotGallery.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F22FFAC12342DB1006BF615 /* PlotGallery.m */; }; 4F22FFB012342DB1006BF615 /* PlotItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F22FFAE12342DB1006BF615 /* PlotItem.m */; }; 4F22FFE8123431D2006BF615 /* Quartz.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F22FFE7123431D2006BF615 /* Quartz.framework */; }; - 4F35EBBD12360D89007C3389 /* Icon.icns in Resources */ = {isa = PBXBuildFile; fileRef = 4F35EBBC12360D89007C3389 /* Icon.icns */; }; 4F35EBF7123611E3007C3389 /* PlotGalleryController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F35EBF4123611E3007C3389 /* PlotGalleryController.m */; }; 4F35EBF8123611E3007C3389 /* PlotView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F35EBF6123611E3007C3389 /* PlotView.m */; }; 4F8E1C14129077C200D2035F /* DatePlot.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F8E1C13129077C200D2035F /* DatePlot.m */; }; @@ -28,6 +25,8 @@ 4FABDD421291110D003A2DB7 /* CorePlot.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F4892891290FFCD00EDB93F /* CorePlot.framework */; }; 4FABDD4612911127003A2DB7 /* CorePlot.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 4F4892891290FFCD00EDB93F /* CorePlot.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; + C309C23423B3E12500DEDE9D /* PlotViewItem.xib in Resources */ = {isa = PBXBuildFile; fileRef = C309C23323B3E12500DEDE9D /* PlotViewItem.xib */; }; + C309C23623B3E21500DEDE9D /* PlotViewItem.m in Sources */ = {isa = PBXBuildFile; fileRef = C309C23523B3E21500DEDE9D /* PlotViewItem.m */; }; C30B12431BCADD300084C567 /* CorePlot.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3D4146F1A7D824700B6F5D6 /* CorePlot.framework */; }; C30B12441BCADD300084C567 /* CorePlot.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = C3D4146F1A7D824700B6F5D6 /* CorePlot.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; C30B12481BCADE170084C567 /* PlotItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F22FFAE12342DB1006BF615 /* PlotItem.m */; }; @@ -36,7 +35,6 @@ C30D8AFA1BCAF99D0003BB70 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = C30D8AF91BCAF99D0003BB70 /* main.m */; }; C30D8AFD1BCAF99D0003BB70 /* AppDelegateTV.m in Sources */ = {isa = PBXBuildFile; fileRef = C30D8AFC1BCAF99D0003BB70 /* AppDelegateTV.m */; }; C30D8B081BCAF99D0003BB70 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C30D8B071BCAF99D0003BB70 /* Assets.xcassets */; }; - C30D8B201BCAFC140003BB70 /* CorePlot.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F4892891290FFCD00EDB93F /* CorePlot.framework */; }; C30D8B211BCAFD3E0003BB70 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C3D2FE6219FF1D03002CD4D6 /* Images.xcassets */; }; C30D8B221BCAFD3E0003BB70 /* PlotItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F22FFAE12342DB1006BF615 /* PlotItem.m */; }; C30D8B231BCAFD3E0003BB70 /* PlotGallery.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F22FFAC12342DB1006BF615 /* PlotGallery.m */; }; @@ -62,25 +60,23 @@ C30D8B371BCAFDE20003BB70 /* SimplePieChart.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F22FF9F12342D7C006BF615 /* SimplePieChart.m */; }; C30D8B381BCAFDE20003BB70 /* SimpleScatterPlot.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F22FFA112342D7C006BF615 /* SimpleScatterPlot.m */; }; C30D8B391BCAFDE20003BB70 /* VerticalBarChart.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F22FFA312342D7C006BF615 /* VerticalBarChart.m */; }; - C30D8B3B1BCAFFAE0003BB70 /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C30D8B3A1BCAFFAE0003BB70 /* Accelerate.framework */; }; C30D8B3D1BCAFFB50003BB70 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C30D8B3C1BCAFFB50003BB70 /* CoreGraphics.framework */; }; C30D8B3F1BCAFFBB0003BB70 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C30D8B3E1BCAFFBB0003BB70 /* QuartzCore.framework */; }; C30D8B411BCAFFC10003BB70 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C30D8B401BCAFFC10003BB70 /* Foundation.framework */; }; C30D8B431BCAFFCB0003BB70 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C30D8B421BCAFFCB0003BB70 /* UIKit.framework */; }; + C32D229E23B1086600043720 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = C32D229C23B1086600043720 /* MainMenu.xib */; }; C3457A4D17AD7C5D000880F3 /* PiNumberFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = C3457A4C17AD7C5D000880F3 /* PiNumberFormatter.m */; }; + C3490DD820E025760089F309 /* Icon.icns in Resources */ = {isa = PBXBuildFile; fileRef = C3490DDA20E025760089F309 /* Icon.icns */; }; C34CB5461BC9A83C009270A0 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C34CB5451BC9A83C009270A0 /* Images.xcassets */; }; C34CB5541BC9A889009270A0 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = C34CB5481BC9A889009270A0 /* AppDelegate.m */; }; C34CB5551BC9A889009270A0 /* DetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C34CB54A1BC9A889009270A0 /* DetailViewController.m */; }; - C34CB5561BC9A889009270A0 /* Launch Screen.xib in Resources */ = {isa = PBXBuildFile; fileRef = C34CB54B1BC9A889009270A0 /* Launch Screen.xib */; }; C34CB5571BC9A889009270A0 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = C34CB54C1BC9A889009270A0 /* main.m */; }; - C34CB5581BC9A889009270A0 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C34CB54D1BC9A889009270A0 /* Main.storyboard */; }; C34CB55A1BC9A889009270A0 /* RootViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C34CB5511BC9A889009270A0 /* RootViewController.m */; }; C34CB55B1BC9A889009270A0 /* ThemeTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C34CB5531BC9A889009270A0 /* ThemeTableViewController.m */; }; C34CB5601BC9AB7B009270A0 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C34CB55F1BC9AB7B009270A0 /* Foundation.framework */; }; C34CB5621BC9AB85009270A0 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C34CB5611BC9AB85009270A0 /* UIKit.framework */; }; C34CB5641BC9AB8C009270A0 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C34CB5631BC9AB8C009270A0 /* CoreGraphics.framework */; }; C34CB5661BC9AB93009270A0 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C34CB5651BC9AB93009270A0 /* QuartzCore.framework */; }; - C34CB5681BC9AB9E009270A0 /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C34CB5671BC9AB9E009270A0 /* Accelerate.framework */; }; C34CB57C1BC9B1C1009270A0 /* AxisDemo.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F8E1CC112908B0000D2035F /* AxisDemo.m */; }; C34CB57D1BC9B1C1009270A0 /* CandlestickPlot.m in Sources */ = {isa = PBXBuildFile; fileRef = C360E1DF13B18CAE007994B6 /* CandlestickPlot.m */; }; C34CB57E1BC9B1C1009270A0 /* ColoredBarChart.m in Sources */ = {isa = PBXBuildFile; fileRef = C3A31A5514DF782A00734AB7 /* ColoredBarChart.m */; }; @@ -104,6 +100,7 @@ C34CB5901BC9B1C1009270A0 /* VerticalBarChart.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F22FFA312342D7C006BF615 /* VerticalBarChart.m */; }; C354C0D713C7CDBE00DA8822 /* RealTimePlot.m in Sources */ = {isa = PBXBuildFile; fileRef = C354C0D613C7CDBE00DA8822 /* RealTimePlot.m */; }; C35597961437E07800B41DA7 /* ControlChart.m in Sources */ = {isa = PBXBuildFile; fileRef = C35597951437E07800B41DA7 /* ControlChart.m */; }; + C357EA9D1F708E870060CF48 /* CorePlot.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C30D8B181BCAF99D0003BB70 /* CorePlot.framework */; }; C360E1C613B18AAF007994B6 /* OHLCPlot.m in Sources */ = {isa = PBXBuildFile; fileRef = C360E1C513B18AAF007994B6 /* OHLCPlot.m */; }; C360E1E013B18CAF007994B6 /* CandlestickPlot.m in Sources */ = {isa = PBXBuildFile; fileRef = C360E1DF13B18CAE007994B6 /* CandlestickPlot.m */; }; C367249313E103910070F47A /* LineCapDemo.m in Sources */ = {isa = PBXBuildFile; fileRef = C367249213E103910070F47A /* LineCapDemo.m */; }; @@ -113,10 +110,12 @@ C3A14BEC13AEB7E700D103EA /* RangePlot.m in Sources */ = {isa = PBXBuildFile; fileRef = C3A14BEB13AEB7E700D103EA /* RangePlot.m */; }; C3A31A5614DF782A00734AB7 /* ColoredBarChart.m in Sources */ = {isa = PBXBuildFile; fileRef = C3A31A5514DF782A00734AB7 /* ColoredBarChart.m */; }; C3AC1410150EDE5C00631001 /* CurvedScatterPlot.m in Sources */ = {isa = PBXBuildFile; fileRef = C3F42A2714D3A75F0044B323 /* CurvedScatterPlot.m */; }; - C3B9C2551BCB186800BD560B /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C3B9C2541BCB186800BD560B /* Main.storyboard */; }; C3B9C26F1BCB237000BD560B /* DetailViewControllerTV.m in Sources */ = {isa = PBXBuildFile; fileRef = C3B9C26A1BCB237000BD560B /* DetailViewControllerTV.m */; }; C3B9C2701BCB237000BD560B /* RootViewControllerTV.m in Sources */ = {isa = PBXBuildFile; fileRef = C3B9C26C1BCB237000BD560B /* RootViewControllerTV.m */; }; C3B9C2711BCB237000BD560B /* ThemeTableViewControllerTV.m in Sources */ = {isa = PBXBuildFile; fileRef = C3B9C26E1BCB237000BD560B /* ThemeTableViewControllerTV.m */; }; + C3D0A1B720E0187600BA2921 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C3D0A1B920E0187600BA2921 /* Main.storyboard */; }; + C3D0A1C420E0188800BA2921 /* Launch Screen.xib in Resources */ = {isa = PBXBuildFile; fileRef = C3D0A1C620E0188800BA2921 /* Launch Screen.xib */; }; + C3D0A1C820E018DE00BA2921 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C3D0A1CA20E018DE00BA2921 /* Main.storyboard */; }; C3D2FE6319FF1D03002CD4D6 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C3D2FE6219FF1D03002CD4D6 /* Images.xcassets */; }; C3D70BA6175EB29E00F27173 /* ImageDemo.m in Sources */ = {isa = PBXBuildFile; fileRef = C3D70BA5175EB29E00F27173 /* ImageDemo.m */; }; C3EF42FD19FC75810060791A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C3EF42FC19FC75810060791A /* Images.xcassets */; }; @@ -246,10 +245,7 @@ 4F22FF4712342978006BF615 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = src/mac/main.m; sourceTree = ""; }; 4F22FF4A1234298E006BF615 /* Plot_Gallery_MacAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Plot_Gallery_MacAppDelegate.h; path = src/mac/Plot_Gallery_MacAppDelegate.h; sourceTree = ""; }; 4F22FF4B1234298E006BF615 /* Plot_Gallery_MacAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Plot_Gallery_MacAppDelegate.m; path = src/mac/Plot_Gallery_MacAppDelegate.m; sourceTree = ""; }; - 4F22FF5812342A21006BF615 /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = English; path = InfoPlist.strings; sourceTree = ""; }; - 4F22FF5A12342A21006BF615 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = MainMenu.xib; sourceTree = ""; }; 4F22FF7B12342B5A006BF615 /* Plot_Gallery_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Plot_Gallery_Prefix.pch; sourceTree = ""; }; - 4F22FF7C12342B6E006BF615 /* Plot_Gallery_Mac-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Plot_Gallery_Mac-Info.plist"; sourceTree = ""; }; 4F22FF9A12342D7C006BF615 /* CompositePlot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; name = CompositePlot.h; path = src/plots/CompositePlot.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; 4F22FF9B12342D7C006BF615 /* CompositePlot.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; name = CompositePlot.m; path = src/plots/CompositePlot.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; 4F22FF9C12342D7C006BF615 /* GradientScatterPlot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GradientScatterPlot.h; path = src/plots/GradientScatterPlot.h; sourceTree = ""; }; @@ -265,7 +261,6 @@ 4F22FFAD12342DB1006BF615 /* PlotItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; name = PlotItem.h; path = src/shared/PlotItem.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; 4F22FFAE12342DB1006BF615 /* PlotItem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PlotItem.m; path = src/shared/PlotItem.m; sourceTree = ""; }; 4F22FFE7123431D2006BF615 /* Quartz.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Quartz.framework; path = System/Library/Frameworks/Quartz.framework; sourceTree = SDKROOT; }; - 4F35EBBC12360D89007C3389 /* Icon.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = Icon.icns; path = src/mac/Icon.icns; sourceTree = ""; }; 4F35EBF3123611E3007C3389 /* PlotGalleryController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PlotGalleryController.h; path = src/mac/PlotGalleryController.h; sourceTree = ""; }; 4F35EBF4123611E3007C3389 /* PlotGalleryController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PlotGalleryController.m; path = src/mac/PlotGalleryController.m; sourceTree = ""; }; 4F35EBF5123611E3007C3389 /* PlotView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PlotView.h; path = src/mac/PlotView.h; sourceTree = ""; }; @@ -278,33 +273,37 @@ 4F8E1CC012908B0000D2035F /* AxisDemo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AxisDemo.h; path = src/plots/AxisDemo.h; sourceTree = ""; }; 4F8E1CC112908B0000D2035F /* AxisDemo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; name = AxisDemo.m; path = src/plots/AxisDemo.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; 8D1107320486CEB800E47090 /* Plot Gallery.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Plot Gallery.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + C309C23323B3E12500DEDE9D /* PlotViewItem.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = PlotViewItem.xib; path = "Plot Gallery-Mac/PlotViewItem.xib"; sourceTree = ""; }; + C309C23523B3E21500DEDE9D /* PlotViewItem.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = PlotViewItem.m; path = src/mac/PlotViewItem.m; sourceTree = ""; }; + C309C23723B3E29F00DEDE9D /* PlotViewItem.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = PlotViewItem.h; path = src/mac/PlotViewItem.h; sourceTree = ""; }; C30D8AF61BCAF99D0003BB70 /* Plot Gallery tvOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Plot Gallery tvOS.app"; sourceTree = BUILT_PRODUCTS_DIR; }; C30D8AF91BCAF99D0003BB70 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = main.m; path = src/tvOS/main.m; sourceTree = ""; }; C30D8AFB1BCAF99D0003BB70 /* AppDelegateTV.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = AppDelegateTV.h; path = src/tvOS/AppDelegateTV.h; sourceTree = ""; }; C30D8AFC1BCAF99D0003BB70 /* AppDelegateTV.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = AppDelegateTV.m; path = src/tvOS/AppDelegateTV.m; sourceTree = ""; }; C30D8B071BCAF99D0003BB70 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = "Plot Gallery-tvOS/Assets.xcassets"; sourceTree = ""; }; - C30D8B091BCAF99D0003BB70 /* Plot_Gallery_tvOS-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Plot_Gallery_tvOS-Info.plist"; sourceTree = ""; }; C30D8B3A1BCAFFAE0003BB70 /* Accelerate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Accelerate.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS9.0.sdk/System/Library/Frameworks/Accelerate.framework; sourceTree = DEVELOPER_DIR; }; C30D8B3C1BCAFFB50003BB70 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS9.0.sdk/System/Library/Frameworks/CoreGraphics.framework; sourceTree = DEVELOPER_DIR; }; C30D8B3E1BCAFFBB0003BB70 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS9.0.sdk/System/Library/Frameworks/QuartzCore.framework; sourceTree = DEVELOPER_DIR; }; C30D8B401BCAFFC10003BB70 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS9.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; }; C30D8B421BCAFFCB0003BB70 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS9.0.sdk/System/Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; }; + C32D229D23B1086600043720 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = src/mac/Base.lproj/MainMenu.xib; sourceTree = ""; }; C3457A4B17AD7C5D000880F3 /* PiNumberFormatter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PiNumberFormatter.h; path = src/shared/PiNumberFormatter.h; sourceTree = ""; }; C3457A4C17AD7C5D000880F3 /* PiNumberFormatter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PiNumberFormatter.m; path = src/shared/PiNumberFormatter.m; sourceTree = ""; }; + C3490DCC20E025660089F309 /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Base; path = "Base.lproj/Plot_Gallery_Mac-Info.plist"; sourceTree = ""; }; + C3490DD920E025760089F309 /* Base */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = Base; path = Base.lproj/Icon.icns; sourceTree = ""; }; + C3490DDB20E025B60089F309 /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Base; path = "Base.lproj/Plot_Gallery_iOS-Info.plist"; sourceTree = ""; }; + C3490DDF20E026410089F309 /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Base; path = "Base.lproj/Plot_Gallery_tvOS-Info.plist"; sourceTree = ""; }; C34CB52E1BC9A76A009270A0 /* Plot Gallery-iOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Plot Gallery-iOS.app"; sourceTree = BUILT_PRODUCTS_DIR; }; C34CB5451BC9A83C009270A0 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = "Plot Gallery-iOS/Images.xcassets"; sourceTree = ""; }; C34CB5471BC9A889009270A0 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = src/ios/AppDelegate.h; sourceTree = ""; }; C34CB5481BC9A889009270A0 /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = src/ios/AppDelegate.m; sourceTree = ""; }; C34CB5491BC9A889009270A0 /* DetailViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DetailViewController.h; path = src/ios/DetailViewController.h; sourceTree = ""; }; C34CB54A1BC9A889009270A0 /* DetailViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = DetailViewController.m; path = src/ios/DetailViewController.m; sourceTree = ""; }; - C34CB54B1BC9A889009270A0 /* Launch Screen.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = "Launch Screen.xib"; path = "src/ios/Launch Screen.xib"; sourceTree = ""; }; C34CB54C1BC9A889009270A0 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = src/ios/main.m; sourceTree = ""; }; - C34CB54D1BC9A889009270A0 /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = Main.storyboard; path = src/ios/Main.storyboard; sourceTree = ""; }; C34CB5501BC9A889009270A0 /* RootViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RootViewController.h; path = src/ios/RootViewController.h; sourceTree = ""; }; C34CB5511BC9A889009270A0 /* RootViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RootViewController.m; path = src/ios/RootViewController.m; sourceTree = ""; }; C34CB5521BC9A889009270A0 /* ThemeTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ThemeTableViewController.h; path = src/ios/ThemeTableViewController.h; sourceTree = ""; }; C34CB5531BC9A889009270A0 /* ThemeTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ThemeTableViewController.m; path = src/ios/ThemeTableViewController.m; sourceTree = ""; }; - C34CB55D1BC9A936009270A0 /* Plot_Gallery_iOS-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Plot_Gallery_iOS-Info.plist"; sourceTree = ""; }; C34CB55F1BC9AB7B009270A0 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; }; C34CB5611BC9AB85009270A0 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.0.sdk/System/Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; }; C34CB5631BC9AB8C009270A0 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.0.sdk/System/Library/Frameworks/CoreGraphics.framework; sourceTree = DEVELOPER_DIR; }; @@ -328,7 +327,6 @@ C3A14BEB13AEB7E700D103EA /* RangePlot.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RangePlot.m; path = src/plots/RangePlot.m; sourceTree = ""; }; C3A31A5414DF782A00734AB7 /* ColoredBarChart.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ColoredBarChart.h; path = src/plots/ColoredBarChart.h; sourceTree = ""; }; C3A31A5514DF782A00734AB7 /* ColoredBarChart.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; name = ColoredBarChart.m; path = src/plots/ColoredBarChart.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; - C3B9C2541BCB186800BD560B /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = Main.storyboard; path = src/tvOS/Main.storyboard; sourceTree = ""; }; C3B9C2691BCB237000BD560B /* DetailViewControllerTV.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DetailViewControllerTV.h; path = src/tvOS/DetailViewControllerTV.h; sourceTree = ""; }; C3B9C26A1BCB237000BD560B /* DetailViewControllerTV.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = DetailViewControllerTV.m; path = src/tvOS/DetailViewControllerTV.m; sourceTree = ""; }; C3B9C26B1BCB237000BD560B /* RootViewControllerTV.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RootViewControllerTV.h; path = src/tvOS/RootViewControllerTV.h; sourceTree = ""; }; @@ -336,6 +334,9 @@ C3B9C26D1BCB237000BD560B /* ThemeTableViewControllerTV.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ThemeTableViewControllerTV.h; path = src/tvOS/ThemeTableViewControllerTV.h; sourceTree = ""; }; C3B9C26E1BCB237000BD560B /* ThemeTableViewControllerTV.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ThemeTableViewControllerTV.m; path = src/tvOS/ThemeTableViewControllerTV.m; sourceTree = ""; }; C3C0DF2719D86B5E00631CAD /* CorePlotWarnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = CorePlotWarnings.xcconfig; path = ../../framework/xcconfig/CorePlotWarnings.xcconfig; sourceTree = ""; }; + C3D0A1B820E0187600BA2921 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + C3D0A1C520E0188800BA2921 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = "Base.lproj/Launch Screen.xib"; sourceTree = ""; }; + C3D0A1C920E018DE00BA2921 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; C3D2FE6219FF1D03002CD4D6 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = img/Images.xcassets; sourceTree = ""; }; C3D70BA4175EB29E00F27173 /* ImageDemo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ImageDemo.h; path = src/plots/ImageDemo.h; sourceTree = ""; }; C3D70BA5175EB29E00F27173 /* ImageDemo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; name = ImageDemo.m; path = src/plots/ImageDemo.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; @@ -365,12 +366,11 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - C30D8B3B1BCAFFAE0003BB70 /* Accelerate.framework in Frameworks */, C30D8B3D1BCAFFB50003BB70 /* CoreGraphics.framework in Frameworks */, - C30D8B201BCAFC140003BB70 /* CorePlot.framework in Frameworks */, C30D8B411BCAFFC10003BB70 /* Foundation.framework in Frameworks */, C30D8B3F1BCAFFBB0003BB70 /* QuartzCore.framework in Frameworks */, C30D8B431BCAFFCB0003BB70 /* UIKit.framework in Frameworks */, + C357EA9D1F708E870060CF48 /* CorePlot.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -379,7 +379,6 @@ buildActionMask = 2147483647; files = ( C30B12431BCADD300084C567 /* CorePlot.framework in Frameworks */, - C34CB5681BC9AB9E009270A0 /* Accelerate.framework in Frameworks */, C34CB5641BC9AB8C009270A0 /* CoreGraphics.framework in Frameworks */, C34CB5601BC9AB7B009270A0 /* Foundation.framework in Frameworks */, C34CB5661BC9AB93009270A0 /* QuartzCore.framework in Frameworks */, @@ -398,6 +397,8 @@ 4F35EBF4123611E3007C3389 /* PlotGalleryController.m */, 4F35EBF5123611E3007C3389 /* PlotView.h */, 4F35EBF6123611E3007C3389 /* PlotView.m */, + C309C23723B3E29F00DEDE9D /* PlotViewItem.h */, + C309C23523B3E21500DEDE9D /* PlotViewItem.m */, 4F22FF4712342978006BF615 /* main.m */, 4F22FF4A1234298E006BF615 /* Plot_Gallery_MacAppDelegate.h */, 4F22FF4B1234298E006BF615 /* Plot_Gallery_MacAppDelegate.m */, @@ -446,10 +447,10 @@ isa = PBXGroup; children = ( C3EF42FC19FC75810060791A /* Images.xcassets */, - 4F35EBBC12360D89007C3389 /* Icon.icns */, - 4F22FF7C12342B6E006BF615 /* Plot_Gallery_Mac-Info.plist */, - 4F22FF5912342A21006BF615 /* MainMenu.xib */, - 4F22FF5712342A21006BF615 /* InfoPlist.strings */, + C3490DDA20E025760089F309 /* Icon.icns */, + C32D229C23B1086600043720 /* MainMenu.xib */, + C309C23323B3E12500DEDE9D /* PlotViewItem.xib */, + C3490DCD20E025660089F309 /* Plot_Gallery_Mac-Info.plist */, ); name = Resources; sourceTree = ""; @@ -570,8 +571,8 @@ isa = PBXGroup; children = ( C30D8B071BCAF99D0003BB70 /* Assets.xcassets */, - C30D8B091BCAF99D0003BB70 /* Plot_Gallery_tvOS-Info.plist */, - C3B9C2541BCB186800BD560B /* Main.storyboard */, + C3490DE020E026410089F309 /* Plot_Gallery_tvOS-Info.plist */, + C3D0A1CA20E018DE00BA2921 /* Main.storyboard */, ); name = Resources; sourceTree = ""; @@ -597,9 +598,9 @@ isa = PBXGroup; children = ( C34CB5451BC9A83C009270A0 /* Images.xcassets */, - C34CB55D1BC9A936009270A0 /* Plot_Gallery_iOS-Info.plist */, - C34CB54D1BC9A889009270A0 /* Main.storyboard */, - C34CB54B1BC9A889009270A0 /* Launch Screen.xib */, + C3490DDC20E025B60089F309 /* Plot_Gallery_iOS-Info.plist */, + C3D0A1B920E0187600BA2921 /* Main.storyboard */, + C3D0A1C620E0188800BA2921 /* Launch Screen.xib */, ); name = Resources; sourceTree = ""; @@ -694,7 +695,7 @@ 29B97313FDCFA39411CA2CEA /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0700; + LastUpgradeCheck = 1100; TargetAttributes = { C30D8AF51BCAF99D0003BB70 = { CreatedOnToolsVersion = 7.1; @@ -708,14 +709,14 @@ }; buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "Plot_Gallery" */; compatibilityVersion = "Xcode 6.3"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 1; knownRegions = ( - English, - Japanese, - French, - German, Base, + en, + fr, + ja, + de, ); mainGroup = 29B97314FDCFA39411CA2CEA /* Plot Gallery-Mac */; projectDirPath = ""; @@ -799,10 +800,10 @@ buildActionMask = 2147483647; files = ( C3D2FE6319FF1D03002CD4D6 /* Images.xcassets in Resources */, - 4F22FF5B12342A21006BF615 /* InfoPlist.strings in Resources */, + C32D229E23B1086600043720 /* MainMenu.xib in Resources */, C3EF42FD19FC75810060791A /* Images.xcassets in Resources */, - 4F22FF5C12342A21006BF615 /* MainMenu.xib in Resources */, - 4F35EBBD12360D89007C3389 /* Icon.icns in Resources */, + C3490DD820E025760089F309 /* Icon.icns in Resources */, + C309C23423B3E12500DEDE9D /* PlotViewItem.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -812,7 +813,7 @@ files = ( C30D8B211BCAFD3E0003BB70 /* Images.xcassets in Resources */, C30D8B081BCAF99D0003BB70 /* Assets.xcassets in Resources */, - C3B9C2551BCB186800BD560B /* Main.storyboard in Resources */, + C3D0A1C820E018DE00BA2921 /* Main.storyboard in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -822,8 +823,8 @@ files = ( C34CB5461BC9A83C009270A0 /* Images.xcassets in Resources */, C367EEE21BCAEA9E00A21FE7 /* Images.xcassets in Resources */, - C34CB5581BC9A889009270A0 /* Main.storyboard in Resources */, - C34CB5561BC9A889009270A0 /* Launch Screen.xib in Resources */, + C3D0A1B720E0187600BA2921 /* Main.storyboard in Resources */, + C3D0A1C420E0188800BA2921 /* Launch Screen.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -834,6 +835,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + C309C23623B3E21500DEDE9D /* PlotViewItem.m in Sources */, 4F22FF4912342978006BF615 /* main.m in Sources */, 4F22FF4C1234298E006BF615 /* Plot_Gallery_MacAppDelegate.m in Sources */, 4F22FFA412342D7C006BF615 /* CompositePlot.m in Sources */, @@ -966,22 +968,72 @@ /* End PBXTargetDependency section */ /* Begin PBXVariantGroup section */ - 4F22FF5712342A21006BF615 /* InfoPlist.strings */ = { + C32D229C23B1086600043720 /* MainMenu.xib */ = { isa = PBXVariantGroup; children = ( - 4F22FF5812342A21006BF615 /* English */, + C32D229D23B1086600043720 /* Base */, ); - name = InfoPlist.strings; - path = src/mac/English.lproj; + name = MainMenu.xib; sourceTree = ""; }; - 4F22FF5912342A21006BF615 /* MainMenu.xib */ = { + C3490DCD20E025660089F309 /* Plot_Gallery_Mac-Info.plist */ = { isa = PBXVariantGroup; children = ( - 4F22FF5A12342A21006BF615 /* English */, + C3490DCC20E025660089F309 /* Base */, ); - name = MainMenu.xib; - path = src/mac/English.lproj; + name = "Plot_Gallery_Mac-Info.plist"; + sourceTree = ""; + }; + C3490DDA20E025760089F309 /* Icon.icns */ = { + isa = PBXVariantGroup; + children = ( + C3490DD920E025760089F309 /* Base */, + ); + name = Icon.icns; + path = src/mac; + sourceTree = ""; + }; + C3490DDC20E025B60089F309 /* Plot_Gallery_iOS-Info.plist */ = { + isa = PBXVariantGroup; + children = ( + C3490DDB20E025B60089F309 /* Base */, + ); + name = "Plot_Gallery_iOS-Info.plist"; + sourceTree = ""; + }; + C3490DE020E026410089F309 /* Plot_Gallery_tvOS-Info.plist */ = { + isa = PBXVariantGroup; + children = ( + C3490DDF20E026410089F309 /* Base */, + ); + name = "Plot_Gallery_tvOS-Info.plist"; + sourceTree = ""; + }; + C3D0A1B920E0187600BA2921 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + C3D0A1B820E0187600BA2921 /* Base */, + ); + name = Main.storyboard; + path = src/ios; + sourceTree = ""; + }; + C3D0A1C620E0188800BA2921 /* Launch Screen.xib */ = { + isa = PBXVariantGroup; + children = ( + C3D0A1C520E0188800BA2921 /* Base */, + ); + name = "Launch Screen.xib"; + path = src/ios; + sourceTree = ""; + }; + C3D0A1CA20E018DE00BA2921 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + C3D0A1C920E018DE00BA2921 /* Base */, + ); + name = Main.storyboard; + path = src/tvOS; sourceTree = ""; }; /* End PBXVariantGroup section */ @@ -991,18 +1043,17 @@ isa = XCBuildConfiguration; baseConfigurationReference = C3C0DF2719D86B5E00631CAD /* CorePlotWarnings.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_OBJC_ARC = YES; + CODE_SIGN_IDENTITY = "-"; COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; - INFOPLIST_FILE = "Plot_Gallery_Mac-Info.plist"; + INFOPLIST_FILE = "$(SRCROOT)/Base.lproj/Plot_Gallery_Mac-Info.plist"; INSTALL_PATH = "$(HOME)/Applications"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @loader_path/../Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 10.7; + MACOSX_DEPLOYMENT_TARGET = 10.11; OTHER_LDFLAGS = ( "-ObjC", "-all_load", @@ -1010,6 +1061,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "com.CorePlot.Plot-Gallery-Mac"; PRODUCT_NAME = "Plot Gallery"; RUN_CLANG_STATIC_ANALYZER = YES; + SDKROOT = macosx; VALID_ARCHS = "i386 x86_64"; }; name = Debug; @@ -1018,17 +1070,16 @@ isa = XCBuildConfiguration; baseConfigurationReference = C3C0DF2719D86B5E00631CAD /* CorePlotWarnings.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_OBJC_ARC = YES; + CODE_SIGN_IDENTITY = "-"; COMBINE_HIDPI_IMAGES = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = s; - INFOPLIST_FILE = "Plot_Gallery_Mac-Info.plist"; + INFOPLIST_FILE = "$(SRCROOT)/Base.lproj/Plot_Gallery_Mac-Info.plist"; INSTALL_PATH = "$(HOME)/Applications"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @loader_path/../Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 10.7; + MACOSX_DEPLOYMENT_TARGET = 10.11; OTHER_LDFLAGS = ( "-ObjC", "-all_load", @@ -1036,44 +1087,47 @@ PRODUCT_BUNDLE_IDENTIFIER = "com.CorePlot.Plot-Gallery-Mac"; PRODUCT_NAME = "Plot Gallery"; RUN_CLANG_STATIC_ANALYZER = YES; + SDKROOT = macosx; VALID_ARCHS = "i386 x86_64"; }; name = Release; }; C01FCF4F08A954540054247B /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = C3C0DF2719D86B5E00631CAD /* CorePlotWarnings.xcconfig */; buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = Plot_Gallery_Prefix.pch; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - HEADER_SEARCH_PATHS = ""; ONLY_ACTIVE_ARCH = YES; OTHER_LDFLAGS = ( "-ObjC", "-all_load", ); - SDKROOT = macosx; SYMROOT = "$(PROJECT_DIR)/../../build"; }; name = Debug; }; C01FCF5008A954540054247B /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = C3C0DF2719D86B5E00631CAD /* CorePlotWarnings.xcconfig */; buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = s; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = Plot_Gallery_Prefix.pch; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; OTHER_LDFLAGS = ( "-ObjC", "-all_load", ); - SDKROOT = macosx; SYMROOT = "$(PROJECT_DIR)/../../build"; }; name = Release; @@ -1082,36 +1136,20 @@ isa = XCBuildConfiguration; baseConfigurationReference = C3C0DF2719D86B5E00631CAD /* CorePlotWarnings.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; ASSETCATALOG_COMPILER_APPICON_NAME = "App Icon & Top Shelf Image"; ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - INFOPLIST_FILE = "Plot_Gallery_tvOS-Info.plist"; + INFOPLIST_FILE = "$(SRCROOT)/Base.lproj/Plot_Gallery_tvOS-Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; MTL_ENABLE_DEBUG_INFO = YES; PRODUCT_BUNDLE_IDENTIFIER = "com.CorePlot.Plot-Gallery-tvOS"; @@ -1126,32 +1164,16 @@ isa = XCBuildConfiguration; baseConfigurationReference = C3C0DF2719D86B5E00631CAD /* CorePlotWarnings.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; ASSETCATALOG_COMPILER_APPICON_NAME = "App Icon & Top Shelf Image"; ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - INFOPLIST_FILE = "Plot_Gallery_tvOS-Info.plist"; + INFOPLIST_FILE = "$(SRCROOT)/Base.lproj/Plot_Gallery_tvOS-Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; MTL_ENABLE_DEBUG_INFO = NO; PRODUCT_BUNDLE_IDENTIFIER = "com.CorePlot.Plot-Gallery-tvOS"; @@ -1167,36 +1189,20 @@ isa = XCBuildConfiguration; baseConfigurationReference = C3C0DF2719D86B5E00631CAD /* CorePlotWarnings.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - INFOPLIST_FILE = "Plot_Gallery_iOS-Info.plist"; + INFOPLIST_FILE = "$(SRCROOT)/Base.lproj/Plot_Gallery_iOS-Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; MTL_ENABLE_DEBUG_INFO = YES; @@ -1211,32 +1217,16 @@ isa = XCBuildConfiguration; baseConfigurationReference = C3C0DF2719D86B5E00631CAD /* CorePlotWarnings.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution"; COPY_PHASE_STRIP = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - INFOPLIST_FILE = "Plot_Gallery_iOS-Info.plist"; + INFOPLIST_FILE = "$(SRCROOT)/Base.lproj/Plot_Gallery_iOS-Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; MTL_ENABLE_DEBUG_INFO = NO; diff --git a/examples/CorePlotGallery/Plot_Gallery.xcodeproj/xcshareddata/xcschemes/Plot Gallery-Mac.xcscheme b/examples/CorePlotGallery/Plot_Gallery.xcodeproj/xcshareddata/xcschemes/Plot Gallery-Mac.xcscheme index fc7560139..d03877413 100644 --- a/examples/CorePlotGallery/Plot_Gallery.xcodeproj/xcshareddata/xcschemes/Plot Gallery-Mac.xcscheme +++ b/examples/CorePlotGallery/Plot_Gallery.xcodeproj/xcshareddata/xcschemes/Plot Gallery-Mac.xcscheme @@ -1,6 +1,6 @@ - - - - + + - - - - - - + + - - - - - - + + - - - #if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE + #if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE || TARGET_OS_TV #import #import #else diff --git a/examples/CorePlotGallery/src/ios/AppDelegate.m b/examples/CorePlotGallery/src/ios/AppDelegate.m index 2f60c0a90..e3bafe91b 100644 --- a/examples/CorePlotGallery/src/ios/AppDelegate.m +++ b/examples/CorePlotGallery/src/ios/AppDelegate.m @@ -18,7 +18,7 @@ @implementation AppDelegate @synthesize window; --(BOOL)application:(nonnull UIApplication *)application didFinishLaunchingWithOptions:(nullable CPTDictionary *)launchOptions +-(BOOL)application:(nonnull UIApplication *__unused)application didFinishLaunchingWithOptions:(nullable CPTDictionary *__unused)launchOptions { [[PlotGallery sharedPlotGallery] sortByTitle]; @@ -33,9 +33,9 @@ -(BOOL)application:(nonnull UIApplication *)application didFinishLaunchingWithOp #pragma mark - Split view --(BOOL)splitViewController:(UISplitViewController *)splitViewController collapseSecondaryViewController:(UIViewController *)secondaryViewController ontoPrimaryViewController:(UIViewController *)primaryViewController +-(BOOL)splitViewController:(UISplitViewController *__unused)splitViewController collapseSecondaryViewController:(UIViewController *)secondaryViewController ontoPrimaryViewController:(UIViewController *__unused)primaryViewController { - if ( [secondaryViewController isKindOfClass:[UINavigationController class]] && [( (UINavigationController *)secondaryViewController ).topViewController isKindOfClass:[DetailViewController class]] && ( ( (DetailViewController *)( (UINavigationController *)secondaryViewController ).topViewController ).detailItem == nil ) ) { + if ( [secondaryViewController isKindOfClass:[UINavigationController class]] && [((UINavigationController *)secondaryViewController).topViewController isKindOfClass:[DetailViewController class]] && (((DetailViewController *)((UINavigationController *)secondaryViewController).topViewController).detailItem == nil)) { // Return YES to indicate that we have handled the collapse by doing nothing; the secondary controller will be discarded. return YES; } diff --git a/examples/CorePlotGallery/src/ios/Launch Screen.xib b/examples/CorePlotGallery/src/ios/Base.lproj/Launch Screen.xib similarity index 59% rename from examples/CorePlotGallery/src/ios/Launch Screen.xib rename to examples/CorePlotGallery/src/ios/Base.lproj/Launch Screen.xib index a932c3b64..8a42da815 100644 --- a/examples/CorePlotGallery/src/ios/Launch Screen.xib +++ b/examples/CorePlotGallery/src/ios/Base.lproj/Launch Screen.xib @@ -1,27 +1,28 @@ - - + + + + + - - + + - + - - - + diff --git a/examples/CorePlotGallery/src/ios/Main.storyboard b/examples/CorePlotGallery/src/ios/Base.lproj/Main.storyboard similarity index 85% rename from examples/CorePlotGallery/src/ios/Main.storyboard rename to examples/CorePlotGallery/src/ios/Base.lproj/Main.storyboard index 99440a43b..949e2f780 100644 --- a/examples/CorePlotGallery/src/ios/Main.storyboard +++ b/examples/CorePlotGallery/src/ios/Base.lproj/Main.storyboard @@ -1,9 +1,12 @@ - - + + + + + - - + + @@ -11,8 +14,8 @@ + - @@ -31,17 +34,15 @@ - + - - - + + - - + @@ -66,37 +67,33 @@ - + - + - - + - + - + - - @@ -129,31 +126,27 @@ - + - - + - + - + - - - + @@ -176,8 +169,8 @@ + - diff --git a/examples/CorePlotGallery/src/ios/DetailViewController.m b/examples/CorePlotGallery/src/ios/DetailViewController.m index a50fe4923..9d787a9fa 100644 --- a/examples/CorePlotGallery/src/ios/DetailViewController.m +++ b/examples/CorePlotGallery/src/ios/DetailViewController.m @@ -44,12 +44,14 @@ -(void)setupView -(void)awakeFromNib { + [super awakeFromNib]; + [self setupView]; } -(nonnull instancetype)initWithNibName:(nullable NSString *)nibNameOrNil bundle:(nullable NSBundle *)nibBundleOrNil { - if ( (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) ) { + if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) { [self setupView]; } @@ -132,6 +134,7 @@ -(void)themeChanged:(nonnull NSNotification *)notification NSDictionary *themeInfo = notification.userInfo; NSString *themeName = themeInfo[PlotGalleryThemeNameKey]; + if ( themeName ) { [self themeSelectedWithName:themeName]; } diff --git a/examples/CorePlotGallery/src/ios/RootViewController.m b/examples/CorePlotGallery/src/ios/RootViewController.m index 0e61ad1f3..9d81892b5 100644 --- a/examples/CorePlotGallery/src/ios/RootViewController.m +++ b/examples/CorePlotGallery/src/ios/RootViewController.m @@ -47,10 +47,10 @@ -(void)dealloc #pragma mark - #pragma mark Segues --(void)prepareForSegue:(nonnull UIStoryboardSegue *)segue sender:(nullable id)sender +-(void)prepareForSegue:(nonnull UIStoryboardSegue *)segue sender:(nullable id __unused)sender { if ( [segue.identifier isEqualToString:@"showDetail"] ) { - DetailViewController *controller = (DetailViewController *)( (UINavigationController *)segue.destinationViewController ).topViewController; + DetailViewController *controller = (DetailViewController *)((UINavigationController *)segue.destinationViewController).topViewController; controller.navigationItem.leftBarButtonItem = self.splitViewController.displayModeButtonItem; controller.navigationItem.leftItemsSupplementBackButton = YES; @@ -74,6 +74,7 @@ -(void)themeChanged:(nonnull NSNotification *)notification NSDictionary *themeInfo = notification.userInfo; NSString *themeName = themeInfo[PlotGalleryThemeNameKey]; + if ( themeName ) { self.currentThemeName = themeName; } @@ -82,12 +83,12 @@ -(void)themeChanged:(nonnull NSNotification *)notification #pragma mark - #pragma mark Table view data source --(NSInteger)numberOfSectionsInTableView:(nonnull UITableView *)tv +-(NSInteger)numberOfSectionsInTableView:(nonnull UITableView *__unused)tv { return (NSInteger)[PlotGallery sharedPlotGallery].numberOfSections; } --(NSInteger)tableView:(nonnull UITableView *)tv numberOfRowsInSection:(NSInteger)section +-(NSInteger)tableView:(nonnull UITableView *__unused)tv numberOfRowsInSection:(NSInteger)section { return (NSInteger)[[PlotGallery sharedPlotGallery] numberOfRowsInSection:(NSUInteger)section]; } @@ -111,7 +112,7 @@ -(nonnull UITableViewCell *)tableView:(nonnull UITableView *)tv cellForRowAtInde return cell; } --(nullable NSString *)tableView:(nonnull UITableView *)tableView titleForHeaderInSection:(NSInteger)section +-(nullable NSString *)tableView:(nonnull UITableView *__unused)tableView titleForHeaderInSection:(NSInteger)section { return [PlotGallery sharedPlotGallery].sectionTitles[(NSUInteger)section]; } diff --git a/examples/CorePlotGallery/src/ios/ThemeTableViewController.m b/examples/CorePlotGallery/src/ios/ThemeTableViewController.m index a0901f3ae..a705f18cf 100644 --- a/examples/CorePlotGallery/src/ios/ThemeTableViewController.m +++ b/examples/CorePlotGallery/src/ios/ThemeTableViewController.m @@ -41,12 +41,14 @@ -(void)setupThemes -(void)awakeFromNib { + [super awakeFromNib]; + [self setupThemes]; } -(nonnull instancetype)initWithNibName:(nullable NSString *)nibNameOrNil bundle:(nullable NSBundle *)nibBundleOrNil { - if ( (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) ) { + if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) { [self setupThemes]; } @@ -56,12 +58,12 @@ -(nonnull instancetype)initWithNibName:(nullable NSString *)nibNameOrNil bundle: #pragma mark - #pragma mark Table view data source --(NSInteger)numberOfSectionsInTableView:(nonnull UITableView *)tableView +-(NSInteger)numberOfSectionsInTableView:(nonnull UITableView *__unused)tableView { return 1; } --(NSInteger)tableView:(nonnull UITableView *)tableView numberOfRowsInSection:(NSInteger)section +-(NSInteger)tableView:(nonnull UITableView *__unused)tableView numberOfRowsInSection:(NSInteger __unused)section { return (NSInteger)self.themes.count; } @@ -84,10 +86,10 @@ -(nonnull UITableViewCell *)tableView:(nonnull UITableView *)tableView cellForRo #pragma mark - #pragma mark Table view delegate --(void)tableView:(nonnull UITableView *)tableView didSelectRowAtIndexPath:(nonnull NSIndexPath *)indexPath +-(void)tableView:(nonnull UITableView *__unused)tableView didSelectRowAtIndexPath:(nonnull NSIndexPath *)indexPath { NSDictionary *themeInfo = @{ - PlotGalleryThemeNameKey: self.themes[(NSUInteger)indexPath.row] + PlotGalleryThemeNameKey: self.themes[(NSUInteger)indexPath.row] }; [[NSNotificationCenter defaultCenter] postNotificationName:PlotGalleryThemeDidChangeNotification diff --git a/examples/CorePlotGallery/src/ios/main.m b/examples/CorePlotGallery/src/ios/main.m index da456e0b4..7f96dbbda 100644 --- a/examples/CorePlotGallery/src/ios/main.m +++ b/examples/CorePlotGallery/src/ios/main.m @@ -8,6 +8,6 @@ int main(int argc, char *argv[]) { @autoreleasepool { - return UIApplicationMain( argc, argv, nil, NSStringFromClass([AppDelegate class]) ); + return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); } } diff --git a/examples/CorePlotGallery/src/mac/Icon.icns b/examples/CorePlotGallery/src/mac/Base.lproj/Icon.icns similarity index 100% rename from examples/CorePlotGallery/src/mac/Icon.icns rename to examples/CorePlotGallery/src/mac/Base.lproj/Icon.icns diff --git a/examples/CorePlotGallery/src/mac/English.lproj/MainMenu.xib b/examples/CorePlotGallery/src/mac/Base.lproj/MainMenu.xib similarity index 80% rename from examples/CorePlotGallery/src/mac/English.lproj/MainMenu.xib rename to examples/CorePlotGallery/src/mac/Base.lproj/MainMenu.xib index a0a26dbcb..349c7533b 100644 --- a/examples/CorePlotGallery/src/mac/English.lproj/MainMenu.xib +++ b/examples/CorePlotGallery/src/mac/Base.lproj/MainMenu.xib @@ -1,9 +1,9 @@ - - + + - - + + @@ -201,70 +201,65 @@ + - + - + - + - - + - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - - - + + + + + + @@ -277,7 +272,6 @@ - @@ -297,6 +291,7 @@ + @@ -307,11 +302,12 @@ - - + + + diff --git a/examples/CorePlotGallery/src/mac/PlotGalleryController.h b/examples/CorePlotGallery/src/mac/PlotGalleryController.h index 04bd17bcf..c8418c4a6 100644 --- a/examples/CorePlotGallery/src/mac/PlotGalleryController.h +++ b/examples/CorePlotGallery/src/mac/PlotGalleryController.h @@ -11,6 +11,8 @@ #import "PlotView.h" @interface PlotGalleryController : NSObject @property (nonatomic, strong, nullable) PlotItem *plotItem; diff --git a/examples/CorePlotGallery/src/mac/PlotGalleryController.m b/examples/CorePlotGallery/src/mac/PlotGalleryController.m index 64467f939..be4239e94 100644 --- a/examples/CorePlotGallery/src/mac/PlotGalleryController.m +++ b/examples/CorePlotGallery/src/mac/PlotGalleryController.m @@ -6,24 +6,29 @@ #import "PlotGalleryController.h" #import "dlfcn.h" -// #define EMBED_NU 1 +#import "PlotViewItem.h" static const CGFloat CPT_SPLIT_VIEW_MIN_LHS_WIDTH = 150.0; static NSString *const kThemeTableViewControllerNoTheme = @"None"; static NSString *const kThemeTableViewControllerDefaultTheme = @"Default"; +static NSString *const kCollectionHeader = @"CPTCollectionHeader"; +static NSString *const kCollectionItem = @"PlotViewItem"; + @interface PlotGalleryController() @property (nonatomic, readwrite, strong, nullable) IBOutlet NSSplitView *splitView; @property (nonatomic, readwrite, strong, nullable) IBOutlet NSScrollView *scrollView; -@property (nonatomic, readwrite, strong, nullable) IBOutlet IKImageBrowserView *imageBrowser; +@property (nonatomic, readwrite, strong, nullable) IBOutlet NSCollectionView *imageBrowser; @property (nonatomic, readwrite, strong, nullable) IBOutlet NSPopUpButton *themePopUpButton; @property (nonatomic, readwrite, strong, nullable) IBOutlet PlotView *hostingView; @end +#pragma mark - + @implementation PlotGalleryController @synthesize splitView; @@ -51,53 +56,36 @@ -(void)setupThemes -(void)awakeFromNib { + [super awakeFromNib]; + [[PlotGallery sharedPlotGallery] sortByTitle]; self.splitView.delegate = self; - [self.imageBrowser setDelegate:self]; - [self.imageBrowser setDataSource:self]; - [self.imageBrowser setCellsStyleMask:IKCellsStyleShadowed | IKCellsStyleTitled]; // | IKCellsStyleSubtitled]; + NSCollectionView *browser = self.imageBrowser; + + browser.delegate = self; + browser.dataSource = self; + + [browser registerClass:[NSTextField class] + forSupplementaryViewOfKind:NSCollectionElementKindSectionHeader + withIdentifier:kCollectionHeader]; - [self.imageBrowser reloadData]; + [browser reloadData]; self.hostingView.delegate = self; [self setupThemes]; - -#ifdef EMBED_NU - // Setup a Nu console without the help of the Nu include files or - // an explicit link of the Nu framework, which may not be installed - nuHandle = dlopen("/Library/Frameworks/Nu.framework/Nu", RTLD_LAZY); - - if ( nuHandle ) { - NSString *consoleStartup = - @"(progn \ - (load \"console\") \ - (set $console ((NuConsoleWindowController alloc) init)))"; - - Class nuClass = NSClassFromString(@"Nu"); - id parser = [nuClass performSelector:@selector(parser)]; - id code = [parser performSelector:@selector(parse:) withObject:consoleStartup]; - [parser performSelector:@selector(eval:) withObject:code]; - } -#endif } -(void)dealloc { [self setPlotItem:nil]; - [splitView setDelegate:nil]; - [imageBrowser setDataSource:nil]; - [imageBrowser setDelegate:nil]; - [hostingView setDelegate:nil]; - -#ifdef EMBED_NU - if ( nuHandle ) { - dlclose(nuHandle); - } -#endif + splitView.delegate = nil; + imageBrowser.dataSource = nil; + imageBrowser.delegate = nil; + hostingView.delegate = nil; } -(void)setFrameSize:(NSSize)newSize @@ -190,7 +178,7 @@ -(void)exportTVImageWithSize:(CGSize)size toURL:(NSURL *)url showPlots:(BOOL)sho NSGraphicsContext *bitmapContext = [NSGraphicsContext graphicsContextWithBitmapImageRep:layerImage]; CGContextRef context = (CGContextRef)bitmapContext.graphicsPort; - CGContextClearRect( context, CGRectMake(0.0, 0.0, boundsSize.width, boundsSize.height) ); + CGContextClearRect(context, CGRectMake(0.0, 0.0, boundsSize.width, boundsSize.height)); CGContextSetAllowsAntialiasing(context, true); CGContextSetShouldSmoothFonts(context, false); [imageView.layer renderInContext:context]; @@ -207,7 +195,7 @@ -(void)exportTVImageWithSize:(CGSize)size toURL:(NSURL *)url showPlots:(BOOL)sho } } --(IBAction)exportTVImagesToPNG:(id)sender +-(IBAction)exportTVImagesToPNG:(id __unused)sender { NSOpenPanel *pngSavingDialog = [NSOpenPanel openPanel]; @@ -215,16 +203,16 @@ -(IBAction)exportTVImagesToPNG:(id)sender pngSavingDialog.canChooseDirectories = YES; pngSavingDialog.allowsMultipleSelection = NO; - if ( [pngSavingDialog runModal] == NSOKButton ) { + if ( [pngSavingDialog runModal] == NSModalResponseOK ) { NSURL *url = pngSavingDialog.URL; if ( url ) { - // top image +// top image CGSize topShelfSize = CGSizeMake(1920.0, 720.0); NSURL *topURL = [NSURL URLWithString:@"PlotGalleryTopShelf.png" relativeToURL:url]; [self exportTVImageWithSize:topShelfSize toURL:topURL showPlots:YES showBackground:YES]; - // large icon image +// large icon image CGSize largeIconSize = CGSizeMake(1280.0, 768.0); NSURL *largeBackURL = [NSURL URLWithString:@"PlotGalleryLargeIconBack.png" relativeToURL:url]; @@ -233,7 +221,7 @@ -(IBAction)exportTVImagesToPNG:(id)sender NSURL *largeFrontURL = [NSURL URLWithString:@"PlotGalleryLargeIconFront.png" relativeToURL:url]; [self exportTVImageWithSize:largeIconSize toURL:largeFrontURL showPlots:YES showBackground:NO]; - // small icon image +// small icon image CGSize smallIconSize = CGSizeMake(400.0, 240.0); NSURL *smallBackURL = [NSURL URLWithString:@"PlotGallerySmallIconBack.png" relativeToURL:url]; @@ -263,71 +251,106 @@ -(void)setPlotItem:(nullable PlotItem *)item } #pragma mark - -#pragma mark IKImageBrowserViewDataSource methods +#pragma mark NSCollectionViewDataSource methods --(NSUInteger)numberOfItemsInImageBrowser:(nonnull IKImageBrowserView *)browser +-(NSInteger)numberOfSectionsInCollectionView:(nonnull NSCollectionView *__unused)collectionView { - return [PlotGallery sharedPlotGallery].count; + return (NSInteger)[PlotGallery sharedPlotGallery].numberOfSections; } --(nonnull id)imageBrowser:(nonnull IKImageBrowserView *)browser itemAtIndex:(NSUInteger)index +-(NSInteger)collectionView:(nonnull NSCollectionView *__unused)collectionView + numberOfItemsInSection:(NSInteger)section { - return [[PlotGallery sharedPlotGallery] objectInSection:0 atIndex:index]; + return (NSInteger)[[PlotGallery sharedPlotGallery] numberOfRowsInSection:(NSUInteger)section]; } --(NSUInteger)numberOfGroupsInImageBrowser:(nonnull IKImageBrowserView *)aBrowser +-(nonnull NSCollectionViewItem *)collectionView:(nonnull NSCollectionView *)collectionView + itemForRepresentedObjectAtIndexPath:(nonnull NSIndexPath *)indexPath { - return [PlotGallery sharedPlotGallery].numberOfSections; + PlotViewItem *item = [collectionView makeItemWithIdentifier:kCollectionItem + forIndexPath:indexPath]; + + PlotItem *thePlotItem = [[PlotGallery sharedPlotGallery] objectInSection:(NSUInteger)indexPath.section + atIndex:(NSUInteger)indexPath.item]; + + item.plotItemTitle.stringValue = thePlotItem.title; + item.plotItemImage.image = thePlotItem.image; + + return item; } --(nonnull CPTDictionary *)imageBrowser:(nonnull IKImageBrowserView *)aBrowser groupAtIndex:(NSUInteger)index +-(nonnull NSView *) collectionView:(nonnull NSCollectionView *)collectionView + viewForSupplementaryElementOfKind:(nonnull NSCollectionViewSupplementaryElementKind)kind + atIndexPath:(nonnull NSIndexPath *)indexPath { - NSString *groupTitle = [PlotGallery sharedPlotGallery].sectionTitles[index]; - - NSUInteger offset = 0; + NSString *identifier = nil; - for ( NSUInteger i = 0; i < index; i++ ) { - offset += [[PlotGallery sharedPlotGallery] numberOfRowsInSection:i]; + if ( [kind isEqual:NSCollectionElementKindSectionHeader] ) { + identifier = kCollectionHeader; + } + else { + identifier = @""; } - NSValue *groupRange = [NSValue valueWithRange:NSMakeRange(offset, [[PlotGallery sharedPlotGallery] numberOfRowsInSection:index])]; + NSString *content = [PlotGallery sharedPlotGallery].sectionTitles[(NSUInteger)indexPath.section]; - return @{ - IKImageBrowserGroupStyleKey: @(IKGroupDisclosureStyle), - IKImageBrowserGroupTitleKey: groupTitle, - IKImageBrowserGroupRangeKey: groupRange - }; + NSView *view = [collectionView makeSupplementaryViewOfKind:kind withIdentifier:identifier forIndexPath:indexPath]; + if ( content && [view isKindOfClass:[NSTextField class]] ) { + NSTextField *titleTextField = (NSTextField *)view; + + titleTextField.editable = NO; + titleTextField.selectable = NO; + titleTextField.backgroundColor = [NSColor controlAccentColor]; + titleTextField.textColor = [NSColor headerTextColor]; + titleTextField.font = [NSFont boldSystemFontOfSize:14.0]; + titleTextField.bordered = YES; + titleTextField.stringValue = content; + } + + return view; } #pragma mark - -#pragma mark IKImageBrowserViewDelegate methods +#pragma mark NSCollectionViewDelegate methods --(void)imageBrowserSelectionDidChange:(nonnull IKImageBrowserView *)browser +-(void) collectionView:(nonnull NSCollectionView *__unused)collectionView + didSelectItemsAtIndexPaths:(nonnull NSSet *)indexPaths { - NSUInteger index = [browser selectionIndexes].firstIndex; + NSUInteger section = NSNotFound; + NSUInteger index = NSNotFound; + NSIndexPath *path = indexPaths.allObjects.firstObject; + + if ( path ) { + section = (NSUInteger)path.section; + index = (NSUInteger)path.item; + } if ( index != NSNotFound ) { - PlotItem *item = [[PlotGallery sharedPlotGallery] objectInSection:0 atIndex:index]; - self.plotItem = item; + self.plotItem = [[PlotGallery sharedPlotGallery] objectInSection:section atIndex:index]; } } #pragma mark - #pragma mark NSSplitViewDelegate methods --(CGFloat)splitView:(nonnull NSSplitView *)sv constrainMinCoordinate:(CGFloat)coord ofSubviewAt:(NSInteger)index +-(CGFloat) splitView:(nonnull NSSplitView *__unused)sv + constrainMinCoordinate:(CGFloat)coord + ofSubviewAt:(NSInteger __unused)index { return coord + CPT_SPLIT_VIEW_MIN_LHS_WIDTH; } --(CGFloat)splitView:(nonnull NSSplitView *)sv constrainMaxCoordinate:(CGFloat)coord ofSubviewAt:(NSInteger)index +-(CGFloat) splitView:(nonnull NSSplitView *__unused)sv + constrainMaxCoordinate:(CGFloat)coord + ofSubviewAt:(NSInteger __unused)index { return coord - CPT_SPLIT_VIEW_MIN_LHS_WIDTH; } --(void)splitView:(nonnull NSSplitView *)sender resizeSubviewsWithOldSize:(NSSize)oldSize +-(void) splitView:(nonnull NSSplitView *)sender + resizeSubviewsWithOldSize:(NSSize __unused)oldSize { - // Lock the LHS width +// Lock the LHS width NSRect frame = sender.frame; NSView *lhs = sender.subviews[0]; NSRect lhsRect = lhs.frame; diff --git a/examples/CorePlotGallery/src/mac/PlotView.m b/examples/CorePlotGallery/src/mac/PlotView.m index 2df73ae70..b769c4a9e 100644 --- a/examples/CorePlotGallery/src/mac/PlotView.m +++ b/examples/CorePlotGallery/src/mac/PlotView.m @@ -11,13 +11,13 @@ @implementation PlotView -(nonnull instancetype)initWithFrame:(NSRect)frame { - if ( (self = [super initWithFrame:frame]) ) { + if ((self = [super initWithFrame:frame])) { } return self; } --(void)drawRect:(NSRect)dirtyRect +-(void)drawRect:(NSRect __unused)dirtyRect { } diff --git a/examples/CorePlotGallery/src/mac/PlotViewItem.h b/examples/CorePlotGallery/src/mac/PlotViewItem.h new file mode 100644 index 000000000..c908c2f82 --- /dev/null +++ b/examples/CorePlotGallery/src/mac/PlotViewItem.h @@ -0,0 +1,13 @@ +// +// PlotViewItem.h +// CorePlotGallery +// + +#import + +@interface PlotViewItem : NSCollectionViewItem + +@property (nonatomic, readwrite, strong) IBOutlet NSImageView *plotItemImage; +@property (nonatomic, readwrite, strong) IBOutlet NSTextField *plotItemTitle; + +@end diff --git a/examples/CorePlotGallery/src/mac/PlotViewItem.m b/examples/CorePlotGallery/src/mac/PlotViewItem.m new file mode 100644 index 000000000..300f5e158 --- /dev/null +++ b/examples/CorePlotGallery/src/mac/PlotViewItem.m @@ -0,0 +1,13 @@ +// +// PlotViewItem.m +// CorePlotGallery +// + +#import "PlotViewItem.h" + +@implementation PlotViewItem + +@synthesize plotItemImage; +@synthesize plotItemTitle; + +@end diff --git a/examples/CorePlotGallery/src/mac/Plot_Gallery_MacAppDelegate.m b/examples/CorePlotGallery/src/mac/Plot_Gallery_MacAppDelegate.m index 3a5f91189..b5c8479b6 100644 --- a/examples/CorePlotGallery/src/mac/Plot_Gallery_MacAppDelegate.m +++ b/examples/CorePlotGallery/src/mac/Plot_Gallery_MacAppDelegate.m @@ -9,11 +9,11 @@ @implementation Plot_Gallery_MacAppDelegate @synthesize window; --(void)applicationDidFinishLaunching:(nonnull NSNotification *)aNotification +-(void)applicationDidFinishLaunching:(nonnull NSNotification *__unused)aNotification { } --(BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender +-(BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *__unused)sender { return YES; } diff --git a/examples/CorePlotGallery/src/mac/English.lproj/InfoPlist.strings b/examples/CorePlotGallery/src/mac/en.lproj/InfoPlist.strings similarity index 100% rename from examples/CorePlotGallery/src/mac/English.lproj/InfoPlist.strings rename to examples/CorePlotGallery/src/mac/en.lproj/InfoPlist.strings diff --git a/examples/CorePlotGallery/src/mac/en.lproj/MainMenu.strings b/examples/CorePlotGallery/src/mac/en.lproj/MainMenu.strings new file mode 100644 index 000000000..e11842f48 --- /dev/null +++ b/examples/CorePlotGallery/src/mac/en.lproj/MainMenu.strings @@ -0,0 +1,129 @@ + +/* Class = "NSMenuItem"; title = "Bring All to Front"; ObjectID = "5"; */ +"5.title" = "Bring All to Front"; + +/* Class = "NSMenuItem"; title = "Window"; ObjectID = "19"; */ +"19.title" = "Window"; + +/* Class = "NSMenuItem"; title = "Minimize"; ObjectID = "23"; */ +"23.title" = "Minimize"; + +/* Class = "NSMenu"; title = "Window"; ObjectID = "24"; */ +"24.title" = "Window"; + +/* Class = "NSMenu"; title = "AMainMenu"; ObjectID = "29"; */ +"29.title" = "AMainMenu"; + +/* Class = "NSMenuItem"; title = "Plot Gallery"; ObjectID = "56"; */ +"56.title" = "Plot Gallery"; + +/* Class = "NSMenu"; title = "Plot Gallery"; ObjectID = "57"; */ +"57.title" = "Plot Gallery"; + +/* Class = "NSMenuItem"; title = "About Plot Gallery"; ObjectID = "58"; */ +"58.title" = "About Plot Gallery"; + +/* Class = "NSMenuItem"; title = "Close"; ObjectID = "73"; */ +"73.title" = "Close"; + +/* Class = "NSMenuItem"; title = "Page Setup..."; ObjectID = "77"; */ +"77.title" = "Page Setup..."; + +/* Class = "NSMenuItem"; title = "Print…"; ObjectID = "78"; */ +"78.title" = "Print…"; + +/* Class = "NSMenu"; title = "File"; ObjectID = "81"; */ +"81.title" = "File"; + +/* Class = "NSMenuItem"; title = "File"; ObjectID = "83"; */ +"83.title" = "File"; + +/* Class = "NSMenuItem"; title = "Preferences…"; ObjectID = "129"; */ +"129.title" = "Preferences…"; + +/* Class = "NSMenu"; title = "Services"; ObjectID = "130"; */ +"130.title" = "Services"; + +/* Class = "NSMenuItem"; title = "Services"; ObjectID = "131"; */ +"131.title" = "Services"; + +/* Class = "NSMenuItem"; title = "Hide Plot Gallery"; ObjectID = "134"; */ +"134.title" = "Hide Plot Gallery"; + +/* Class = "NSMenuItem"; title = "Quit Plot Gallery"; ObjectID = "136"; */ +"136.title" = "Quit Plot Gallery"; + +/* Class = "NSMenuItem"; title = "Hide Others"; ObjectID = "145"; */ +"145.title" = "Hide Others"; + +/* Class = "NSMenuItem"; title = "Show All"; ObjectID = "150"; */ +"150.title" = "Show All"; + +/* Class = "NSMenuItem"; title = "Copy"; ObjectID = "197"; */ +"197.title" = "Copy"; + +/* Class = "NSMenuItem"; title = "Select All"; ObjectID = "198"; */ +"198.title" = "Select All"; + +/* Class = "NSMenuItem"; title = "Cut"; ObjectID = "199"; */ +"199.title" = "Cut"; + +/* Class = "NSMenuItem"; title = "Delete"; ObjectID = "202"; */ +"202.title" = "Delete"; + +/* Class = "NSMenuItem"; title = "Paste"; ObjectID = "203"; */ +"203.title" = "Paste"; + +/* Class = "NSMenu"; title = "Edit"; ObjectID = "205"; */ +"205.title" = "Edit"; + +/* Class = "NSMenuItem"; title = "Undo"; ObjectID = "207"; */ +"207.title" = "Undo"; + +/* Class = "NSMenuItem"; title = "Redo"; ObjectID = "215"; */ +"215.title" = "Redo"; + +/* Class = "NSMenuItem"; title = "Edit"; ObjectID = "217"; */ +"217.title" = "Edit"; + +/* Class = "NSMenuItem"; title = "Zoom"; ObjectID = "239"; */ +"239.title" = "Zoom"; + +/* Class = "NSMenuItem"; title = "View"; ObjectID = "295"; */ +"295.title" = "View"; + +/* Class = "NSMenu"; title = "View"; ObjectID = "296"; */ +"296.title" = "View"; + +/* Class = "NSMenuItem"; title = "Show Toolbar"; ObjectID = "297"; */ +"297.title" = "Show Toolbar"; + +/* Class = "NSMenuItem"; title = "Customize Toolbar…"; ObjectID = "298"; */ +"298.title" = "Customize Toolbar…"; + +/* Class = "NSWindow"; title = "Plot Gallery-Mac"; ObjectID = "371"; */ +"371.title" = "Plot Gallery-Mac"; + +/* Class = "NSMenuItem"; title = "Paste and Match Style"; ObjectID = "485"; */ +"485.title" = "Paste and Match Style"; + +/* Class = "NSMenuItem"; title = "Help"; ObjectID = "490"; */ +"490.title" = "Help"; + +/* Class = "NSMenu"; title = "Help"; ObjectID = "491"; */ +"491.title" = "Help"; + +/* Class = "NSMenuItem"; title = "Plot Gallery Help"; ObjectID = "492"; */ +"492.title" = "Plot Gallery Help"; + +/* Class = "NSMenu"; title = "OtherViews"; ObjectID = "558"; */ +"558.title" = "OtherViews"; + +/* Class = "NSToolbarItem"; label = "Theme"; ObjectID = "562"; */ +"562.label" = "Theme"; + +/* Class = "NSToolbarItem"; paletteLabel = "Theme"; ObjectID = "562"; */ +"562.paletteLabel" = "Theme"; + +/* Class = "NSMenuItem"; title = "Save TV Images…"; ObjectID = "JRn-xt-TSn"; */ +"JRn-xt-TSn.title" = "Save TV Images…"; diff --git a/examples/CorePlotGallery/src/plots/AxisDemo.m b/examples/CorePlotGallery/src/plots/AxisDemo.m index 0cac6ac1a..07730cda7 100644 --- a/examples/CorePlotGallery/src/plots/AxisDemo.m +++ b/examples/CorePlotGallery/src/plots/AxisDemo.m @@ -14,7 +14,7 @@ +(void)load -(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { self.title = @"Axis Demo"; self.section = kDemoPlots; } @@ -22,7 +22,7 @@ -(nonnull instancetype)init return self; } --(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withTheme:(nullable CPTTheme *)theme animated:(BOOL)animated +-(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withTheme:(nullable CPTTheme *)theme animated:(BOOL __unused)animated { #if TARGET_OS_IPHONE CGRect bounds = hostingView.bounds; diff --git a/examples/CorePlotGallery/src/plots/CandlestickPlot.m b/examples/CorePlotGallery/src/plots/CandlestickPlot.m index ed592f22b..961ddc972 100644 --- a/examples/CorePlotGallery/src/plots/CandlestickPlot.m +++ b/examples/CorePlotGallery/src/plots/CandlestickPlot.m @@ -9,7 +9,7 @@ @interface CandlestickPlot() -@property (nonatomic, readwrite, strong, nonnull) CPTGraph *graph; +@property (nonatomic, readwrite, strong, nullable) CPTGraph *graph; @property (nonatomic, readwrite, strong, nonnull) NSArray *plotData; @end @@ -26,9 +26,9 @@ +(void)load -(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { graph = nil; - plotData = nil; + plotData = @[]; self.title = @"Candlestick Plot"; self.section = kFinancialPlots; @@ -39,15 +39,15 @@ -(nonnull instancetype)init -(void)generateData { - if ( !self.plotData ) { + if ( self.plotData.count == 0 ) { NSMutableArray *newData = [NSMutableArray array]; for ( NSUInteger i = 0; i < 8; i++ ) { NSTimeInterval x = oneDay * i; double rOpen = 3.0 * arc4random() / (double)UINT32_MAX + 1.0; double rClose = (arc4random() / (double)UINT32_MAX - 0.5) * 0.125 + rOpen; - double rHigh = MAX( rOpen, MAX(rClose, (arc4random() / (double)UINT32_MAX - 0.5) * 0.5 + rOpen) ); - double rLow = MIN( rOpen, MIN(rClose, (arc4random() / (double)UINT32_MAX - 0.5) * 0.5 + rOpen) ); + double rHigh = MAX(rOpen, MAX(rClose, (arc4random() / (double)UINT32_MAX - 0.5) * 0.5 + rOpen)); + double rLow = MIN(rOpen, MIN(rClose, (arc4random() / (double)UINT32_MAX - 0.5) * 0.5 + rOpen)); [newData addObject: @{ @(CPTTradingRangePlotFieldX): @(x), @@ -62,7 +62,7 @@ -(void)generateData } } --(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withTheme:(nullable CPTTheme *)theme animated:(BOOL)animated +-(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withTheme:(nullable CPTTheme *)theme animated:(BOOL __unused)animated { // If you make sure your dates are calculated at noon, you shouldn't have to // worry about daylight savings. If you use midnight, you will have to adjust @@ -105,7 +105,7 @@ -(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withT CPTLineCap *lineCap = [[CPTLineCap alloc] init]; lineCap.lineStyle = xAxis.axisLineStyle; lineCap.lineCapType = CPTLineCapTypeSweptArrow; - lineCap.size = CGSizeMake( self.titleSize * CPTFloat(0.5), self.titleSize * CPTFloat(0.625) ); + lineCap.size = CGSizeMake(self.titleSize * CPTFloat(0.5), self.titleSize * CPTFloat(0.625)); CPTColor *lineColor = xAxis.axisLineStyle.lineColor; if ( lineColor ) { @@ -175,7 +175,7 @@ -(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withT newGraph.legend.swatchLayout = CPTLegendSwatchLayoutRight; newGraph.legendAnchor = CPTRectAnchorBottom; - newGraph.legendDisplacement = CGPointMake( 0.0, self.titleSize * CPTFloat(3.0) ); + newGraph.legendDisplacement = CGPointMake(0.0, self.titleSize * CPTFloat(3.0)); // Set plot ranges CPTXYPlotSpace *plotSpace = (CPTXYPlotSpace *)newGraph.defaultPlotSpace; @@ -186,7 +186,7 @@ -(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withT #pragma mark - #pragma mark Plot Data Source Methods --(NSUInteger)numberOfRecordsForPlot:(nonnull CPTPlot *)plot +-(NSUInteger)numberOfRecordsForPlot:(nonnull CPTPlot *__unused)plot { return self.plotData.count; } @@ -215,6 +215,11 @@ -(nullable id)numberForPlot:(nonnull CPTPlot *)plot field:(NSUInteger)fieldEnum return num; } +-(nullable NSNumber *)barWidthForTradingRangePlot:(nonnull CPTTradingRangePlot *__unused)plot recordIndex:(NSUInteger __unused)idx +{ + return @(arc4random_uniform(85) + 15); +} + #pragma mark - #pragma mark Plot Delegate Methods diff --git a/examples/CorePlotGallery/src/plots/ColoredBarChart.m b/examples/CorePlotGallery/src/plots/ColoredBarChart.m index 1b7e4ea1d..e2a607c84 100644 --- a/examples/CorePlotGallery/src/plots/ColoredBarChart.m +++ b/examples/CorePlotGallery/src/plots/ColoredBarChart.m @@ -17,7 +17,7 @@ +(void)load -(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { self.title = @"Colored Bar Chart"; self.section = kBarPlots; } @@ -27,7 +27,7 @@ -(nonnull instancetype)init -(void)generateData { - if ( self.plotData == nil ) { + if ( self.plotData.count == 0 ) { CPTMutableNumberArray *contentArray = [NSMutableArray array]; for ( NSUInteger i = 0; i < 8; i++ ) { [contentArray addObject:@(10.0 * arc4random() / (double)UINT32_MAX + 5.0)]; @@ -36,7 +36,7 @@ -(void)generateData } } --(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withTheme:(nullable CPTTheme *)theme animated:(BOOL)animated +-(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withTheme:(nullable CPTTheme *)theme animated:(BOOL __unused)animated { #if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE CGRect bounds = hostingView.bounds; @@ -131,20 +131,21 @@ -(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withT theLegend.textStyle = whiteTextStyle; theLegend.numberOfRows = 1; - graph.legend = theLegend; - graph.legendAnchor = CPTRectAnchorTop; - graph.legendDisplacement = CGPointMake( 0.0, self.titleSize * CPTFloat(-2.625) ); + graph.legend = theLegend; + graph.legend.swatchLayout = CPTLegendSwatchLayoutTop; + graph.legendAnchor = CPTRectAnchorTop; + graph.legendDisplacement = CGPointMake(0.0, self.titleSize * CPTFloat(-2.625)); } #pragma mark - #pragma mark Plot Data Source Methods --(NSUInteger)numberOfRecordsForPlot:(nonnull CPTPlot *)plot +-(NSUInteger)numberOfRecordsForPlot:(nonnull CPTPlot *__unused)plot { return self.plotData.count; } --(nullable NSArray *)numbersForPlot:(nonnull CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndexRange:(NSRange)indexRange +-(nullable NSArray *)numbersForPlot:(nonnull CPTPlot *__unused)plot field:(NSUInteger)fieldEnum recordIndexRange:(NSRange)indexRange { CPTNumberArray *nums = nil; @@ -152,7 +153,7 @@ -(nullable NSArray *)numbersForPlot:(nonnull CPTPlot *)plot field:(NSUInteger)fi case CPTBarPlotFieldBarLocation: nums = [NSMutableArray arrayWithCapacity:indexRange.length]; for ( NSUInteger i = indexRange.location; i < NSMaxRange(indexRange); i++ ) { - [(NSMutableArray < NSNumber * > *) nums addObject:@(i)]; + [(NSMutableArray *) nums addObject:@(i)]; } break; @@ -167,7 +168,7 @@ -(nullable NSArray *)numbersForPlot:(nonnull CPTPlot *)plot field:(NSUInteger)fi return nums; } --(nullable CPTFill *)barFillForBarPlot:(nonnull CPTBarPlot *)barPlot recordIndex:(NSUInteger)index +-(nullable CPTFill *)barFillForBarPlot:(nonnull CPTBarPlot *__unused)barPlot recordIndex:(NSUInteger)index { CPTColor *color = nil; @@ -214,7 +215,12 @@ -(nullable CPTFill *)barFillForBarPlot:(nonnull CPTBarPlot *)barPlot recordIndex return [CPTFill fillWithGradient:fillGradient]; } --(nullable NSString *)legendTitleForBarPlot:(nonnull CPTBarPlot *)barPlot recordIndex:(NSUInteger)index +-(nullable NSNumber *)barWidthForBarPlot:(nonnull CPTBarPlot *__unused)barPlot recordIndex:(NSUInteger __unused)idx +{ + return @((double)(arc4random_uniform(50) + 25) / 100.0); +} + +-(nullable NSString *)legendTitleForBarPlot:(nonnull CPTBarPlot *__unused)barPlot recordIndex:(NSUInteger)index { return [NSString stringWithFormat:@"Bar %lu", (unsigned long)(index + 1)]; } diff --git a/examples/CorePlotGallery/src/plots/CompositePlot.m b/examples/CorePlotGallery/src/plots/CompositePlot.m index 2195d0c6e..9a3c140b8 100644 --- a/examples/CorePlotGallery/src/plots/CompositePlot.m +++ b/examples/CorePlotGallery/src/plots/CompositePlot.m @@ -40,7 +40,7 @@ +(void)load -(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { selectedIndex = NSNotFound; self.title = @"Composite Plot"; @@ -58,28 +58,29 @@ -(nonnull instancetype)init -(void)setFrameSize:(NSSize)newSize { - self.scatterPlotView.frame = NSMakeRect( 0.0, - 0.0, - newSize.width, - newSize.height * CPTFloat(0.5) ); + self.scatterPlotView.frame = NSMakeRect(0.0, + 0.0, + newSize.width, + newSize.height * CPTFloat(0.5)); - self.barChartView.frame = NSMakeRect( 0.0, - newSize.height * CPTFloat(0.5), - newSize.width * CPTFloat(0.5), - newSize.height * CPTFloat(0.5) ); + self.barChartView.frame = NSMakeRect(0.0, + newSize.height * CPTFloat(0.5), + newSize.width * CPTFloat(0.5), + newSize.height * CPTFloat(0.5)); - self.pieChartView.frame = NSMakeRect( newSize.width * CPTFloat(0.5), - newSize.height * CPTFloat(0.5), - newSize.width * CPTFloat(0.5), - newSize.height * CPTFloat(0.5) ); + self.pieChartView.frame = NSMakeRect(newSize.width * CPTFloat(0.5), + newSize.height * CPTFloat(0.5), + newSize.width * CPTFloat(0.5), + newSize.height * CPTFloat(0.5)); [self.scatterPlotView setNeedsDisplay:YES]; [self.barChartView setNeedsDisplay:YES]; [self.pieChartView setNeedsDisplay:YES]; } + #endif --(void)renderInView:(nonnull PlotGalleryNativeView *)hostingView withTheme:(nullable CPTTheme *)theme animated:(BOOL)animated +-(void)renderInView:(nonnull PlotGalleryNativeView *)hostingView withTheme:(nullable CPTTheme *)theme animated:(BOOL __unused)animated { [self killGraph]; @@ -166,24 +167,23 @@ -(void)renderInView:(nonnull PlotGalleryNativeView *)hostingView withTheme:(null attribute:NSLayoutAttributeTop multiplier:1.0 constant:0.0]]; - #else NSRect viewRect = hostingView.bounds; - scatterView.frame = NSMakeRect( 0.0, - 0.0, - viewRect.size.width, - viewRect.size.height * CPTFloat(0.5) ); + scatterView.frame = NSMakeRect(0.0, + 0.0, + viewRect.size.width, + viewRect.size.height * CPTFloat(0.5)); - barView.frame = NSMakeRect( 0.0, - viewRect.size.height * CPTFloat(0.5), - viewRect.size.width * CPTFloat(0.5), - viewRect.size.height * CPTFloat(0.5) ); + barView.frame = NSMakeRect(0.0, + viewRect.size.height * CPTFloat(0.5), + viewRect.size.width * CPTFloat(0.5), + viewRect.size.height * CPTFloat(0.5)); - pieView.frame = NSMakeRect( viewRect.size.width * CPTFloat(0.5), - viewRect.size.height * CPTFloat(0.5), - viewRect.size.width * CPTFloat(0.5), - viewRect.size.height * CPTFloat(0.5) ); + pieView.frame = NSMakeRect(viewRect.size.width * CPTFloat(0.5), + viewRect.size.height * CPTFloat(0.5), + viewRect.size.width * CPTFloat(0.5), + viewRect.size.height * CPTFloat(0.5)); for ( NSView *view in @[scatterView, barView, pieView] ) { [view setAutoresizesSubviews:YES]; @@ -422,8 +422,8 @@ -(void)renderPieChartInHostingView:(nonnull CPTGraphHostingView *)hostingView wi // Add pie chart CPTPieChart *piePlot = [[CPTPieChart alloc] init]; piePlot.dataSource = self; - piePlot.pieRadius = MIN( CPTFloat(0.7) * (hostingView.frame.size.height - CPTFloat(2.0) * self.pieChart.paddingLeft) / CPTFloat(2.0), - CPTFloat(0.7) * (hostingView.frame.size.width - CPTFloat(2.0) * self.pieChart.paddingTop) / CPTFloat(2.0) ); + piePlot.pieRadius = MIN(CPTFloat(0.7) * (hostingView.frame.size.height - CPTFloat(2.0) * self.pieChart.paddingLeft) / CPTFloat(2.0), + CPTFloat(0.7) * (hostingView.frame.size.width - CPTFloat(2.0) * self.pieChart.paddingTop) / CPTFloat(2.0)); piePlot.identifier = @"Pie Chart 1"; piePlot.startAngle = CPTFloat(M_PI_4); piePlot.sliceDirection = CPTPieDirectionCounterClockwise; @@ -437,7 +437,7 @@ -(void)renderPieChartInHostingView:(nonnull CPTGraphHostingView *)hostingView wi #pragma mark - #pragma mark CPTBarPlot delegate --(void)barPlot:(nonnull CPTBarPlot *)plot barWasSelectedAtRecordIndex:(NSUInteger)index +-(void)barPlot:(nonnull CPTBarPlot *__unused)plot barWasSelectedAtRecordIndex:(NSUInteger)index { NSLog(@"barWasSelectedAtRecordIndex %d", (int)index); } @@ -503,7 +503,7 @@ -(nullable id)numberForPlot:(nonnull CPTPlot *)plot field:(NSUInteger)fieldEnum break; case CPTBarPlotFieldBarTip: - num = @( (index + 1) * (index + 1) ); + num = @((index + 1) * (index + 1)); if ( [plot.identifier isEqual:@"Bar Plot 2"] ) { num = @(num.integerValue - 10); } @@ -534,8 +534,8 @@ -(nullable CPTLayer *)dataLabelForPlot:(nonnull CPTPlot *)plot recordIndex:(NSUI static dispatch_once_t whiteOnceToken = 0; dispatch_once(&whiteOnceToken, ^{ - whiteText = [[CPTMutableTextStyle alloc] init]; - whiteText.color = [CPTColor whiteColor]; + whiteText = [[CPTMutableTextStyle alloc] init]; + whiteText.color = [CPTColor whiteColor]; whiteText.fontSize = self.titleSize * CPTFloat(0.5); }); @@ -543,8 +543,8 @@ -(nullable CPTLayer *)dataLabelForPlot:(nonnull CPTPlot *)plot recordIndex:(NSUI static dispatch_once_t blackOnceToken = 0; dispatch_once(&blackOnceToken, ^{ - redText = [[CPTMutableTextStyle alloc] init]; - redText.color = [CPTColor redColor]; + redText = [[CPTMutableTextStyle alloc] init]; + redText.color = [CPTColor redColor]; redText.fontSize = self.titleSize * CPTFloat(0.5); }); @@ -575,13 +575,13 @@ -(nullable CPTPlotSymbol *)symbolForScatterPlot:(nonnull CPTScatterPlot *)plot r CPTPlotSymbol *symbol = nil; // Use the default symbol - if ( [(NSString *) plot.identifier isEqualToString:@"Blue Plot"] && ( (NSInteger)index == self.selectedIndex ) ) { + if ( [(NSString *) plot.identifier isEqualToString:@"Blue Plot"] && ((NSInteger)index == self.selectedIndex)) { dispatch_once(&onceToken, ^{ - redDot = [[CPTPlotSymbol alloc] init]; + redDot = [[CPTPlotSymbol alloc] init]; redDot.symbolType = CPTPlotSymbolTypeEllipse; - redDot.size = CGSizeMake(10.0, 10.0); - redDot.fill = [CPTFill fillWithColor:[CPTColor redColor]]; - redDot.lineStyle = [CPTLineStyle lineStyle]; + redDot.size = CGSizeMake(10.0, 10.0); + redDot.fill = [CPTFill fillWithColor:[CPTColor redColor]]; + redDot.lineStyle = [CPTLineStyle lineStyle]; }); symbol = redDot; @@ -602,10 +602,10 @@ -(void)setSelectedIndex:(NSInteger)newIndex CPTScatterPlot *thePlot = (CPTScatterPlot *)[self.scatterPlot plotWithIdentifier:@"Blue Plot"]; if ( oldIndex != NSNotFound ) { - [thePlot reloadPlotSymbolsInIndexRange:NSMakeRange( (NSUInteger)oldIndex, 1 )]; + [thePlot reloadPlotSymbolsInIndexRange:NSMakeRange((NSUInteger)oldIndex, 1)]; } if ( newIndex != NSNotFound ) { - [thePlot reloadPlotSymbolsInIndexRange:NSMakeRange( (NSUInteger)newIndex, 1 )]; + [thePlot reloadPlotSymbolsInIndexRange:NSMakeRange((NSUInteger)newIndex, 1)]; } } } diff --git a/examples/CorePlotGallery/src/plots/ControlChart.m b/examples/CorePlotGallery/src/plots/ControlChart.m index 9b8ae15c9..cc8682410 100644 --- a/examples/CorePlotGallery/src/plots/ControlChart.m +++ b/examples/CorePlotGallery/src/plots/ControlChart.m @@ -28,7 +28,7 @@ +(void)load -(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { self.title = @"Control Chart"; self.section = kLinePlots; } @@ -38,7 +38,7 @@ -(nonnull instancetype)init -(void)generateData { - if ( self.plotData == nil ) { + if ( self.plotData.count == 0 ) { CPTMutableNumberArray *contentArray = [NSMutableArray array]; double sum = 0.0; @@ -58,12 +58,12 @@ -(void)generateData double error = value.doubleValue - self.meanValue; sum += error * error; } - double stdDev = sqrt( ( 1.0 / (numberOfPoints - 1) ) * sum ); + double stdDev = sqrt((1.0 / (numberOfPoints - 1)) * sum); self.standardError = stdDev / sqrt(numberOfPoints); } } --(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withTheme:(nullable CPTTheme *)theme animated:(BOOL)animated +-(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withTheme:(nullable CPTTheme *)theme animated:(BOOL __unused)animated { #if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE CGRect bounds = hostingView.bounds; @@ -207,7 +207,7 @@ -(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withT graph.legend.cornerRadius = 5.0; graph.legend.numberOfRows = 1; graph.legendAnchor = CPTRectAnchorBottom; - graph.legendDisplacement = CGPointMake( 0.0, self.titleSize * CPTFloat(4.0) ); + graph.legendDisplacement = CGPointMake(0.0, self.titleSize * CPTFloat(4.0)); } #pragma mark - diff --git a/examples/CorePlotGallery/src/plots/CurvedInterpolationDemo.m b/examples/CorePlotGallery/src/plots/CurvedInterpolationDemo.m index d68848b84..d5e6f20e9 100644 --- a/examples/CorePlotGallery/src/plots/CurvedInterpolationDemo.m +++ b/examples/CorePlotGallery/src/plots/CurvedInterpolationDemo.m @@ -37,7 +37,7 @@ +(void)load -(instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { self.title = @"Curved Interpolation Options Demo"; self.section = kLinePlots; } @@ -47,7 +47,7 @@ -(instancetype)init -(void)generateData { - if ( self.plotData == nil ) { + if ( self.plotData.count == 0 ) { NSArray *const xValues = @[@0, @0.1, @0.2, @0.5, @0.6, @0.7, @1]; NSArray *const yValues = @[@(0.5), @0.5, @(-1), @1, @1, @0, @0.1]; @@ -62,14 +62,14 @@ -(void)generateData [generatedData addObject:@{ @"x": x, @"y": y - }]; + }]; } } self.plotData = generatedData; } } --(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CPTTheme *)theme animated:(BOOL)animated +-(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CPTTheme *)theme animated:(BOOL __unused)animated { #if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE CGRect bounds = hostingView.bounds; @@ -87,12 +87,12 @@ -(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CP graph.plotAreaFrame.paddingBottom += self.titleSize; graph.plotAreaFrame.masksToBorder = NO; - // Setup scatter plot space +// Setup scatter plot space CPTXYPlotSpace *plotSpace = (CPTXYPlotSpace *)graph.defaultPlotSpace; plotSpace.allowsUserInteraction = YES; plotSpace.delegate = self; - // Grid line styles +// Grid line styles CPTMutableLineStyle *majorGridLineStyle = [CPTMutableLineStyle lineStyle]; majorGridLineStyle.lineWidth = 0.75; majorGridLineStyle.lineColor = [[CPTColor colorWithGenericGray:CPTFloat(0.2)] colorWithAlphaComponent:CPTFloat(0.75)]; @@ -106,10 +106,10 @@ -(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CP redLineStyle.lineColor = [[CPTColor redColor] colorWithAlphaComponent:0.5]; CPTLineCap *lineCap = [CPTLineCap sweptArrowPlotLineCap]; - lineCap.size = CGSizeMake( self.titleSize * CPTFloat(0.625), self.titleSize * CPTFloat(0.625) ); + lineCap.size = CGSizeMake(self.titleSize * CPTFloat(0.625), self.titleSize * CPTFloat(0.625)); - // Axes - // Label x axis with a fixed interval policy +// Axes +// Label x axis with a fixed interval policy CPTXYAxisSet *axisSet = (CPTXYAxisSet *)graph.axisSet; CPTXYAxis *x = axisSet.xAxis; x.majorIntervalLength = @0.1; @@ -128,7 +128,7 @@ -(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CP x.title = @"X Axis"; x.titleOffset = self.titleSize * CPTFloat(1.25); - // Label y with an automatic label policy. +// Label y with an automatic label policy. CPTXYAxis *y = axisSet.yAxis; y.labelingPolicy = CPTAxisLabelingPolicyAutomatic; y.minorTicksPerInterval = 4; @@ -149,25 +149,25 @@ -(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CP y.title = @"Y Axis"; y.titleOffset = self.titleSize * CPTFloat(1.25); - // Set axes +// Set axes graph.axisSet.axes = @[x, y]; - // Create the plots - // Bezier +// Create the plots +// Bezier CPTScatterPlot *bezierPlot = [[CPTScatterPlot alloc] initWithFrame:CGRectZero]; bezierPlot.identifier = bezierCurveIdentifier; - // Catmull-Rom +// Catmull-Rom CPTScatterPlot *cmUniformPlot = [[CPTScatterPlot alloc] initWithFrame:CGRectZero]; cmUniformPlot.identifier = catmullRomUniformIdentifier; CPTScatterPlot *cmCentripetalPlot = [[CPTScatterPlot alloc] initWithFrame:CGRectZero]; cmCentripetalPlot.identifier = catmullRomCentripetalIdentifier; CPTScatterPlot *cmChordalPlot = [[CPTScatterPlot alloc] initWithFrame:CGRectZero]; cmChordalPlot.identifier = catmullRomChordalIdentifier; - // Hermite Cubic +// Hermite Cubic CPTScatterPlot *hermitePlot = [[CPTScatterPlot alloc] initWithFrame:CGRectZero]; hermitePlot.identifier = hermiteCubicIdentifier; - // set interpolation types +// set interpolation types bezierPlot.interpolation = cmUniformPlot.interpolation = cmCentripetalPlot.interpolation = cmChordalPlot.interpolation = hermitePlot.interpolation = CPTScatterPlotInterpolationCurved; bezierPlot.curvedInterpolationOption = CPTScatterPlotCurvedInterpolationNormal; @@ -176,7 +176,7 @@ -(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CP cmCentripetalPlot.curvedInterpolationOption = CPTScatterPlotCurvedInterpolationCatmullRomCentripetal; hermitePlot.curvedInterpolationOption = CPTScatterPlotCurvedInterpolationHermiteCubic; - // style plots +// style plots CPTMutableLineStyle *lineStyle = [bezierPlot.dataLineStyle mutableCopy]; lineStyle.lineWidth = 2.0; lineStyle.lineColor = [CPTColor greenColor]; @@ -195,7 +195,7 @@ -(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CP lineStyle.lineColor = [CPTColor cyanColor]; hermitePlot.dataLineStyle = lineStyle; - // set data source and add plots +// set data source and add plots bezierPlot.dataSource = cmUniformPlot.dataSource = cmCentripetalPlot.dataSource = cmChordalPlot.dataSource = hermitePlot.dataSource = self; [graph addPlot:bezierPlot]; @@ -204,12 +204,12 @@ -(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CP [graph addPlot:cmChordalPlot]; [graph addPlot:hermitePlot]; - // Auto scale the plot space to fit the plot data +// Auto scale the plot space to fit the plot data [plotSpace scaleToFitPlots:[graph allPlots]]; CPTMutablePlotRange *xRange = [plotSpace.xRange mutableCopy]; CPTMutablePlotRange *yRange = [plotSpace.yRange mutableCopy]; - // Expand the ranges to put some space around the plot +// Expand the ranges to put some space around the plot [xRange expandRangeByFactor:@1.2]; [yRange expandRangeByFactor:@1.2]; plotSpace.xRange = xRange; @@ -226,7 +226,7 @@ -(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CP plotSpace.globalXRange = xRange; plotSpace.globalYRange = yRange; - // Add plot symbols +// Add plot symbols CPTMutableLineStyle *symbolLineStyle = [CPTMutableLineStyle lineStyle]; symbolLineStyle.lineColor = [[CPTColor blackColor] colorWithAlphaComponent:0.5]; CPTPlotSymbol *plotSymbol = [CPTPlotSymbol ellipsePlotSymbol]; @@ -235,7 +235,7 @@ -(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CP plotSymbol.size = CGSizeMake(5.0, 5.0); bezierPlot.plotSymbol = cmUniformPlot.plotSymbol = cmCentripetalPlot.plotSymbol = cmChordalPlot.plotSymbol = hermitePlot.plotSymbol = plotSymbol; - // Add legend +// Add legend graph.legend = [CPTLegend legendWithGraph:graph]; graph.legend.numberOfRows = 2; graph.legend.textStyle = x.titleTextStyle; @@ -243,13 +243,13 @@ -(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CP graph.legend.borderLineStyle = x.axisLineStyle; graph.legend.cornerRadius = 5.0; graph.legendAnchor = CPTRectAnchorBottom; - graph.legendDisplacement = CGPointMake( 0.0, self.titleSize * CPTFloat(2.0) ); + graph.legendDisplacement = CGPointMake(0.0, self.titleSize * CPTFloat(2.0)); } #pragma mark - #pragma mark Plot Data Source Methods --(NSUInteger)numberOfRecordsForPlot:(CPTPlot *)plot +-(NSUInteger)numberOfRecordsForPlot:(CPTPlot *__unused)plot { return self.plotData.count; } diff --git a/examples/CorePlotGallery/src/plots/CurvedScatterPlot.m b/examples/CorePlotGallery/src/plots/CurvedScatterPlot.m index 9445c7589..27e300d0f 100644 --- a/examples/CorePlotGallery/src/plots/CurvedScatterPlot.m +++ b/examples/CorePlotGallery/src/plots/CurvedScatterPlot.m @@ -34,7 +34,7 @@ +(void)load -(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { self.title = @"Curved Scatter Plot"; self.section = kLinePlots; } @@ -59,7 +59,7 @@ -(void)killGraph -(void)generateData { - if ( self.plotData == nil ) { + if ( self.plotData.count == 0 ) { NSMutableArray *> *contentArray = [NSMutableArray array]; for ( NSUInteger i = 0; i < 11; i++ ) { @@ -94,7 +94,7 @@ -(void)generateData [contentArray addObject: @{ @"x": @(xLoc), - @"y": @( (dy / dx) / 20.0 ) } + @"y": @((dy / dx) / 20.0) } ]; } @@ -121,7 +121,7 @@ -(void)generateData [contentArray addObject: @{ @"x": @(xLoc), - @"y": @( (dy / dx) / 20.0 ) } + @"y": @((dy / dx) / 20.0) } ]; } @@ -129,7 +129,7 @@ -(void)generateData } } --(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withTheme:(nullable CPTTheme *)theme animated:(BOOL)animated +-(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withTheme:(nullable CPTTheme *)theme animated:(BOOL __unused)animated { #if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE CGRect bounds = hostingView.bounds; @@ -169,7 +169,7 @@ -(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withT redLineStyle.lineColor = [[CPTColor redColor] colorWithAlphaComponent:0.5]; CPTLineCap *lineCap = [CPTLineCap sweptArrowPlotLineCap]; - lineCap.size = CGSizeMake( self.titleSize * CPTFloat(0.625), self.titleSize * CPTFloat(0.625) ); + lineCap.size = CGSizeMake(self.titleSize * CPTFloat(0.625), self.titleSize * CPTFloat(0.625)); // Axes // Label x axis with a fixed interval policy @@ -291,7 +291,7 @@ -(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withT graph.legend.borderLineStyle = x.axisLineStyle; graph.legend.cornerRadius = 5.0; graph.legendAnchor = CPTRectAnchorBottom; - graph.legendDisplacement = CGPointMake( 0.0, self.titleSize * CPTFloat(2.0) ); + graph.legendDisplacement = CGPointMake(0.0, self.titleSize * CPTFloat(2.0)); } #pragma mark - @@ -365,7 +365,7 @@ -(nullable CPTPlotRange *)plotSpace:(nonnull CPTPlotSpace *)space willChangePlot #pragma mark - #pragma mark CPTScatterPlot delegate methods --(void)scatterPlot:(nonnull CPTScatterPlot *)plot plotSymbolWasSelectedAtRecordIndex:(NSUInteger)index +-(void)scatterPlot:(nonnull CPTScatterPlot *__unused)plot plotSymbolWasSelectedAtRecordIndex:(NSUInteger)index { CPTXYGraph *graph = (self.graphs)[0]; @@ -412,6 +412,8 @@ -(void)scatterPlot:(nonnull CPTScatterPlot *)plot plotSymbolWasSelectedAtRecordI annotation.contentAnchorPoint = CGPointMake(0.5, 0.0); annotation.displacement = CGPointMake(0.0, 10.0); [graph.plotAreaFrame.plotArea addAnnotation:annotation]; + + self.symbolTextAnnotation = annotation; } } @@ -433,7 +435,7 @@ -(void)scatterPlotDataLineTouchUp:(nonnull CPTScatterPlot *)plot #pragma mark - #pragma mark Plot area delegate method --(void)plotAreaWasSelected:(nonnull CPTPlotArea *)plotArea +-(void)plotAreaWasSelected:(nonnull CPTPlotArea *__unused)plotArea { // Remove the annotation CPTPlotSpaceAnnotation *annotation = self.symbolTextAnnotation; diff --git a/examples/CorePlotGallery/src/plots/DatePlot.m b/examples/CorePlotGallery/src/plots/DatePlot.m index d11948f08..3bc85e487 100644 --- a/examples/CorePlotGallery/src/plots/DatePlot.m +++ b/examples/CorePlotGallery/src/plots/DatePlot.m @@ -34,7 +34,7 @@ +(void)load -(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { self.title = @"Date Plot"; self.section = kLinePlots; } @@ -44,7 +44,7 @@ -(nonnull instancetype)init -(void)generateData { - if ( !self.plotData ) { + if ( self.plotData.count == 0 ) { // Add some data CPTMutablePlotDataArray *newData = [NSMutableArray array]; @@ -63,7 +63,7 @@ -(void)generateData } } --(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withTheme:(nullable CPTTheme *)theme animated:(BOOL)animated +-(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withTheme:(nullable CPTTheme *)theme animated:(BOOL __unused)animated { // If you make sure your dates are calculated at noon, you shouldn't have to // worry about daylight savings. If you use midnight, you will have to adjust @@ -100,7 +100,7 @@ -(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withT CPTXYPlotSpace *plotSpace = (CPTXYPlotSpace *)graph.defaultPlotSpace; NSTimeInterval xLow = 0.0; - plotSpace.xRange = [CPTPlotRange plotRangeWithLocation:@(xLow) length:@( oneDay * (kNumPoints - 1) )]; + plotSpace.xRange = [CPTPlotRange plotRangeWithLocation:@(xLow) length:@(oneDay * (kNumPoints - 1))]; plotSpace.yRange = [CPTPlotRange plotRangeWithLocation:@1.0 length:@2.0]; plotSpace.allowsUserInteraction = YES; @@ -181,12 +181,12 @@ -(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withT #pragma mark - #pragma mark Plot Data Source Methods --(NSUInteger)numberOfRecordsForPlot:(nonnull CPTPlot *)plot +-(NSUInteger)numberOfRecordsForPlot:(nonnull CPTPlot *__unused)plot { return self.plotData.count; } --(nullable id)numberForPlot:(nonnull CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index +-(nullable id)numberForPlot:(nonnull CPTPlot *__unused)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index { return self.plotData[index][@(fieldEnum)]; } @@ -194,12 +194,12 @@ -(nullable id)numberForPlot:(nonnull CPTPlot *)plot field:(NSUInteger)fieldEnum #pragma mark - #pragma mark Plot Space Delegate Methods --(CGPoint)plotSpace:(CPTPlotSpace *)space willDisplaceBy:(CGPoint)displacement +-(CGPoint)plotSpace:(CPTPlotSpace *__unused)space willDisplaceBy:(CGPoint __unused)displacement { return CPTPointMake(0.0, 0.0); } --(CPTPlotRange *)plotSpace:(CPTPlotSpace *)space willChangePlotRangeTo:(CPTPlotRange *)newRange forCoordinate:(CPTCoordinate)coordinate +-(CPTPlotRange *)plotSpace:(CPTPlotSpace *)space willChangePlotRangeTo:(CPTPlotRange *__unused)newRange forCoordinate:(CPTCoordinate)coordinate { CPTPlotRange *updatedRange = nil; @@ -221,7 +221,7 @@ -(CPTPlotRange *)plotSpace:(CPTPlotSpace *)space willChangePlotRangeTo:(CPTPlotR return updatedRange; } --(BOOL)plotSpace:(CPTPlotSpace *)space shouldHandlePointingDeviceDownEvent:(CPTNativeEvent *)event atPoint:(CGPoint)point +-(BOOL)plotSpace:(CPTPlotSpace *)space shouldHandlePointingDeviceDownEvent:(CPTNativeEvent *)event atPoint:(CGPoint __unused)point { CPTXYPlotSpace *xySpace = (CPTXYPlotSpace *)space; @@ -269,7 +269,7 @@ -(BOOL)plotSpace:(CPTPlotSpace *)space shouldHandlePointingDeviceDraggedEvent:(C return [self plotSpace:space shouldHandlePointingDeviceDownEvent:event atPoint:point]; } --(BOOL)plotSpace:(CPTPlotSpace *)space shouldHandlePointingDeviceUpEvent:(CPTNativeEvent *)event atPoint:(CGPoint)point +-(BOOL)plotSpace:(CPTPlotSpace *__unused)space shouldHandlePointingDeviceUpEvent:(CPTNativeEvent *__unused)event atPoint:(CGPoint __unused)point { return NO; } diff --git a/examples/CorePlotGallery/src/plots/DonutChart.h b/examples/CorePlotGallery/src/plots/DonutChart.h index ad7f4823e..bab4de00a 100644 --- a/examples/CorePlotGallery/src/plots/DonutChart.h +++ b/examples/CorePlotGallery/src/plots/DonutChart.h @@ -2,6 +2,7 @@ @interface DonutChart : PlotItem @end diff --git a/examples/CorePlotGallery/src/plots/DonutChart.m b/examples/CorePlotGallery/src/plots/DonutChart.m index e7ca3a7c4..a56ec42fb 100644 --- a/examples/CorePlotGallery/src/plots/DonutChart.m +++ b/examples/CorePlotGallery/src/plots/DonutChart.m @@ -20,7 +20,7 @@ +(void)load -(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { self.title = @"Donut Chart"; self.section = kPieCharts; } @@ -30,7 +30,7 @@ -(nonnull instancetype)init -(void)generateData { - if ( self.plotData == nil ) { + if ( self.plotData.count == 0 ) { self.plotData = @[@20.0, @30.0, @60.0]; } } @@ -59,8 +59,8 @@ -(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withT whiteShadow.shadowColor = [[CPTColor whiteColor] colorWithAlphaComponent:0.25]; // Add pie chart - const CGFloat outerRadius = MIN( CPTFloat(0.7) * (hostingView.frame.size.height - CPTFloat(2.0) * graph.paddingLeft) / CPTFloat(2.0), - CPTFloat(0.7) * (hostingView.frame.size.width - CPTFloat(2.0) * graph.paddingTop) / CPTFloat(2.0) ); + const CGFloat outerRadius = MIN(CPTFloat(0.7) * (hostingView.frame.size.height - CPTFloat(2.0) * graph.paddingLeft) / CPTFloat(2.0), + CPTFloat(0.7) * (hostingView.frame.size.width - CPTFloat(2.0) * graph.paddingTop) / CPTFloat(2.0)); const CGFloat innerRadius = outerRadius / CPTFloat(2.0); CPTPieChart *piePlot = [[CPTPieChart alloc] init]; @@ -92,7 +92,7 @@ -(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withT // Add another pie chart piePlot = [[CPTPieChart alloc] init]; piePlot.dataSource = self; - piePlot.pieRadius = ( animated ? CPTFloat(0.0) : ( innerRadius - CPTFloat(5.0) ) ); + piePlot.pieRadius = (animated ? CPTFloat(0.0) : (innerRadius - CPTFloat(5.0))); piePlot.identifier = innerChartName; piePlot.borderLineStyle = whiteLineStyle; piePlot.startAngle = CPTFloat(M_PI_4); @@ -121,12 +121,12 @@ -(void)pieChart:(nonnull CPTPieChart *)plot sliceWasSelectedAtRecordIndex:(NSUIn #pragma mark - #pragma mark Plot Data Source Methods --(NSUInteger)numberOfRecordsForPlot:(nonnull CPTPlot *)plot +-(NSUInteger)numberOfRecordsForPlot:(nonnull CPTPlot *__unused)plot { return self.plotData.count; } --(nullable id)numberForPlot:(nonnull CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index +-(nullable id)numberForPlot:(nonnull CPTPlot *__unused)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index { NSNumber *num; @@ -149,8 +149,8 @@ -(nullable CPTLayer *)dataLabelForPlot:(nonnull CPTPlot *)plot recordIndex:(NSUI if ( [(NSString *) plot.identifier isEqualToString:outerChartName] ) { dispatch_once(&onceToken, ^{ - whiteText = [[CPTMutableTextStyle alloc] init]; - whiteText.color = [CPTColor whiteColor]; + whiteText = [[CPTMutableTextStyle alloc] init]; + whiteText.color = [CPTColor whiteColor]; whiteText.fontSize = self.titleSize * CPTFloat(0.5); }); @@ -195,12 +195,12 @@ -(void)animationCancelled:(nonnull CPTAnimationOperation *)operation NSLog(@"animationCancelled: %@", operation); } --(void)animationWillUpdate:(nonnull CPTAnimationOperation *)operation +-(void)animationWillUpdate:(nonnull CPTAnimationOperation *__unused)operation { NSLog(@"animationWillUpdate:"); } --(void)animationDidUpdate:(nonnull CPTAnimationOperation *)operation +-(void)animationDidUpdate:(nonnull CPTAnimationOperation *__unused)operation { NSLog(@"animationDidUpdate:"); } diff --git a/examples/CorePlotGallery/src/plots/FunctionPlot.m b/examples/CorePlotGallery/src/plots/FunctionPlot.m index 8455ce546..839ca3d52 100644 --- a/examples/CorePlotGallery/src/plots/FunctionPlot.m +++ b/examples/CorePlotGallery/src/plots/FunctionPlot.m @@ -6,13 +6,7 @@ @interface FunctionPlot() @property (nonatomic, readwrite, strong) NSMutableSet *dataSources; -#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE -typedef UIFont CPTFont; -#else -typedef NSFont CPTFont; -#endif - --(nullable CPTFont *)italicFontForFont:(nonnull CPTFont *)oldFont; +-(nullable CPTNativeFont *)italicFontForFont:(nonnull CPTNativeFont *)oldFont; @end @@ -33,7 +27,7 @@ +(void)load -(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { dataSources = [[NSMutableSet alloc] init]; self.title = @"Math Function Plot"; @@ -50,7 +44,7 @@ -(void)killGraph [super killGraph]; } --(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withTheme:(nullable CPTTheme *)theme animated:(BOOL)animated +-(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withTheme:(nullable CPTTheme *)theme animated:(BOOL __unused)animated { #if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE CGRect bounds = hostingView.bounds; @@ -118,13 +112,13 @@ -(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withT switch ( plotNum ) { case 0: - titleString = @"y = sin(x)"; + titleString = NSLocalizedString(@"y = sin(x)", @"y = sin(x)"); function = &sin; lineColor = [CPTColor redColor]; break; case 1: - titleString = @"y = cos(x)"; + titleString = NSLocalizedString(@"y = cos(x)", @"y = cos(x)"); block = ^(double xVal) { return cos(xVal); }; @@ -132,7 +126,7 @@ -(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withT break; case 2: - titleString = @"y = tan(x)"; + titleString = NSLocalizedString(@"y = tan(x)", @"y = tan(x)"); function = &tan; lineColor = [CPTColor blueColor]; break; @@ -146,9 +140,9 @@ -(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withT NSMutableAttributedString *title = [[NSMutableAttributedString alloc] initWithString:titleString attributes:textAttributes]; - CPTFont *fontAttribute = textAttributes[NSFontAttributeName]; + CPTNativeFont *fontAttribute = textAttributes[NSFontAttributeName]; if ( fontAttribute ) { - CPTFont *italicFont = [self italicFontForFont:fontAttribute]; + CPTNativeFont *italicFont = [self italicFontForFont:fontAttribute]; [title addAttribute:NSFontAttributeName value:italicFont @@ -158,7 +152,7 @@ -(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withT range:NSMakeRange(8, 1)]; } - CPTFont *labelFont = [CPTFont fontWithName:@"Helvetica" size:self.titleSize * CPTFloat(0.5)]; + CPTNativeFont *labelFont = [CPTNativeFont fontWithName:@"Helvetica" size:self.titleSize * CPTFloat(0.5)]; [title addAttribute:NSFontAttributeName value:labelFont range:NSMakeRange(0, title.length)]; @@ -201,7 +195,7 @@ -(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withT graph.legend.numberOfRows = 1; graph.legend.delegate = self; graph.legendAnchor = CPTRectAnchorBottom; - graph.legendDisplacement = CGPointMake( 0.0, self.titleSize * CPTFloat(1.25) ); + graph.legendDisplacement = CGPointMake(0.0, self.titleSize * CPTFloat(1.25)); } #if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE @@ -242,11 +236,12 @@ -(nullable NSFont *)italicFontForFont:(nonnull NSFont *)oldFont return [[NSFontManager sharedFontManager] convertFont:oldFont toHaveTrait:NSFontItalicTrait]; } + #endif #pragma mark - Legend delegate --(void)legend:(nonnull CPTLegend *)legend legendEntryForPlot:(nonnull CPTPlot *)plot wasSelectedAtIndex:(NSUInteger)idx +-(void)legend:(nonnull CPTLegend *__unused)legend legendEntryForPlot:(nonnull CPTPlot *)plot wasSelectedAtIndex:(NSUInteger __unused)idx { plot.hidden = !plot.hidden; } diff --git a/examples/CorePlotGallery/src/plots/GradientScatterPlot.m b/examples/CorePlotGallery/src/plots/GradientScatterPlot.m index 056456fdc..db1004011 100644 --- a/examples/CorePlotGallery/src/plots/GradientScatterPlot.m +++ b/examples/CorePlotGallery/src/plots/GradientScatterPlot.m @@ -24,7 +24,7 @@ +(void)load -(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { self.title = @"Gradient Scatter Plot"; self.section = kLinePlots; } @@ -49,7 +49,7 @@ -(void)killGraph -(void)generateData { - if ( self.plotData == nil ) { + if ( self.plotData.count == 0 ) { NSMutableArray *contentArray = [NSMutableArray arrayWithCapacity:100]; for ( NSUInteger i = 0; i < 10; i++ ) { NSNumber *x = @(1.0 + i * 0.05); @@ -61,7 +61,7 @@ -(void)generateData } } --(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withTheme:(nullable CPTTheme *)theme animated:(BOOL)animated +-(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withTheme:(nullable CPTTheme *)theme animated:(BOOL __unused)animated { #if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE CGRect bounds = hostingView.bounds; @@ -190,27 +190,23 @@ -(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withT #pragma mark - #pragma mark Plot Data Source Methods --(NSUInteger)numberOfRecordsForPlot:(nonnull CPTPlot *)plot +-(NSUInteger)numberOfRecordsForPlot:(nonnull CPTPlot *__unused)plot { return self.plotData.count; } --(nullable id)numberForPlot:(nonnull CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index +-(nullable id)numberForPlot:(nonnull CPTPlot *__unused)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index { NSString *key = (fieldEnum == CPTScatterPlotFieldX ? @"x" : @"y"); NSNumber *num = self.plotData[index][key]; - if ( fieldEnum == CPTScatterPlotFieldY ) { - num = @(num.doubleValue); - } - return num; } #pragma mark - #pragma mark Plot Space Delegate Methods --(nullable CPTPlotRange *)plotSpace:(nonnull CPTPlotSpace *)space willChangePlotRangeTo:(nonnull CPTPlotRange *)newRange forCoordinate:(CPTCoordinate)coordinate +-(nullable CPTPlotRange *)plotSpace:(nonnull CPTPlotSpace *__unused)space willChangePlotRangeTo:(nonnull CPTPlotRange *)newRange forCoordinate:(CPTCoordinate)coordinate { // Impose a limit on how far user can scroll in x if ( coordinate == CPTCoordinateX ) { @@ -226,7 +222,7 @@ -(nullable CPTPlotRange *)plotSpace:(nonnull CPTPlotSpace *)space willChangePlot #pragma mark - #pragma mark CPTScatterPlot delegate method --(void)scatterPlot:(nonnull CPTScatterPlot *)plot plotSymbolWasSelectedAtRecordIndex:(NSUInteger)index +-(void)scatterPlot:(nonnull CPTScatterPlot *__unused)plot plotSymbolWasSelectedAtRecordIndex:(NSUInteger)index { CPTGraph *graph = (self.graphs)[0]; @@ -272,7 +268,7 @@ -(void)scatterPlot:(nonnull CPTScatterPlot *)plot plotSymbolWasSelectedAtRecordI #pragma mark - #pragma mark Plot area delegate method --(void)plotAreaWasSelected:(nonnull CPTPlotArea *)plotArea +-(void)plotAreaWasSelected:(nonnull CPTPlotArea *__unused)plotArea { // Remove the annotation CPTPlotSpaceAnnotation *annotation = self.symbolTextAnnotation; diff --git a/examples/CorePlotGallery/src/plots/ImageDemo.m b/examples/CorePlotGallery/src/plots/ImageDemo.m index 5606d3120..df304a094 100644 --- a/examples/CorePlotGallery/src/plots/ImageDemo.m +++ b/examples/CorePlotGallery/src/plots/ImageDemo.m @@ -14,7 +14,7 @@ +(void)load -(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { self.title = @"Image Demo"; self.section = kDemoPlots; } @@ -22,7 +22,7 @@ -(nonnull instancetype)init return self; } --(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withTheme:(nullable CPTTheme *)theme animated:(BOOL)animated +-(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withTheme:(nullable CPTTheme *)theme animated:(BOOL __unused)animated { #if TARGET_OS_IPHONE CGRect bounds = hostingView.bounds; diff --git a/examples/CorePlotGallery/src/plots/LabelingPolicyDemo.m b/examples/CorePlotGallery/src/plots/LabelingPolicyDemo.m index b6c088c00..5be94fe80 100644 --- a/examples/CorePlotGallery/src/plots/LabelingPolicyDemo.m +++ b/examples/CorePlotGallery/src/plots/LabelingPolicyDemo.m @@ -14,7 +14,7 @@ +(void)load -(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { self.title = @"Axis Labeling Policies"; self.section = kDemoPlots; } @@ -22,7 +22,7 @@ -(nonnull instancetype)init return self; } --(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withTheme:(nullable CPTTheme *)theme animated:(BOOL)animated +-(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withTheme:(nullable CPTTheme *)theme animated:(BOOL __unused)animated { const CGFloat majorTickLength = 12.0; const CGFloat minorTickLength = 8.0; diff --git a/examples/CorePlotGallery/src/plots/LineCapDemo.m b/examples/CorePlotGallery/src/plots/LineCapDemo.m index c3f9d256a..c5b5eb68f 100644 --- a/examples/CorePlotGallery/src/plots/LineCapDemo.m +++ b/examples/CorePlotGallery/src/plots/LineCapDemo.m @@ -14,7 +14,7 @@ +(void)load -(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { self.title = @"Line Caps"; self.section = kDemoPlots; } @@ -22,7 +22,7 @@ -(nonnull instancetype)init return self; } --(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withTheme:(nullable CPTTheme *)theme animated:(BOOL)animated +-(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withTheme:(nullable CPTTheme *)theme animated:(BOOL __unused)animated { #if TARGET_OS_IPHONE CGRect bounds = hostingView.bounds; diff --git a/examples/CorePlotGallery/src/plots/OHLCPlot.m b/examples/CorePlotGallery/src/plots/OHLCPlot.m index 2032889fb..7761c4069 100644 --- a/examples/CorePlotGallery/src/plots/OHLCPlot.m +++ b/examples/CorePlotGallery/src/plots/OHLCPlot.m @@ -26,9 +26,9 @@ +(void)load -(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { graph = nil; - plotData = nil; + plotData = @[]; self.title = @"OHLC Plot"; self.section = kFinancialPlots; @@ -39,15 +39,15 @@ -(nonnull instancetype)init -(void)generateData { - if ( !self.plotData ) { + if ( self.plotData.count == 0 ) { NSMutableArray *newData = [NSMutableArray array]; for ( NSUInteger i = 0; i < 8; i++ ) { NSTimeInterval x = oneDay * i; double rOpen = 3.0 * arc4random() / (double)UINT32_MAX + 1.0; double rClose = (arc4random() / (double)UINT32_MAX - 0.5) * 0.125 + rOpen; - double rHigh = MAX( rOpen, MAX(rClose, (arc4random() / (double)UINT32_MAX - 0.5) * 0.5 + rOpen) ); - double rLow = MIN( rOpen, MIN(rClose, (arc4random() / (double)UINT32_MAX - 0.5) * 0.5 + rOpen) ); + double rHigh = MAX(rOpen, MAX(rClose, (arc4random() / (double)UINT32_MAX - 0.5) * 0.5 + rOpen)); + double rLow = MIN(rOpen, MIN(rClose, (arc4random() / (double)UINT32_MAX - 0.5) * 0.5 + rOpen)); [newData addObject: @{ @(CPTTradingRangePlotFieldX): @(x), @@ -62,7 +62,7 @@ -(void)generateData } } --(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withTheme:(nullable CPTTheme *)theme animated:(BOOL)animated +-(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withTheme:(nullable CPTTheme *)theme animated:(BOOL __unused)animated { // If you make sure your dates are calculated at noon, you shouldn't have to // worry about daylight savings. If you use midnight, you will have to adjust @@ -105,7 +105,7 @@ -(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withT CPTLineCap *lineCap = [[CPTLineCap alloc] init]; lineCap.lineStyle = xAxis.axisLineStyle; lineCap.lineCapType = CPTLineCapTypeOpenArrow; - lineCap.size = CGSizeMake( self.titleSize * CPTFloat(0.5), self.titleSize * CPTFloat(0.5) ); + lineCap.size = CGSizeMake(self.titleSize * CPTFloat(0.5), self.titleSize * CPTFloat(0.5)); xAxis.axisLineCapMax = lineCap; CPTXYAxis *yAxis = xyAxisSet.yAxis; @@ -170,7 +170,7 @@ -(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withT newGraph.legend.cornerRadius = 5.0; newGraph.legend.swatchCornerRadius = 5.0; newGraph.legendAnchor = CPTRectAnchorBottom; - newGraph.legendDisplacement = CGPointMake( 0.0, self.titleSize * CPTFloat(3.0) ); + newGraph.legendDisplacement = CGPointMake(0.0, self.titleSize * CPTFloat(3.0)); // Set plot ranges CPTXYPlotSpace *plotSpace = (CPTXYPlotSpace *)newGraph.defaultPlotSpace; @@ -181,7 +181,7 @@ -(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withT #pragma mark - #pragma mark Plot Data Source Methods --(NSUInteger)numberOfRecordsForPlot:(nonnull CPTPlot *)plot +-(NSUInteger)numberOfRecordsForPlot:(nonnull CPTPlot *__unused)plot { return self.plotData.count; } diff --git a/examples/CorePlotGallery/src/plots/PlotSpaceDemo.m b/examples/CorePlotGallery/src/plots/PlotSpaceDemo.m index 05a0c4482..c192afd12 100644 --- a/examples/CorePlotGallery/src/plots/PlotSpaceDemo.m +++ b/examples/CorePlotGallery/src/plots/PlotSpaceDemo.m @@ -14,7 +14,7 @@ +(void)load -(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { self.title = @"Plot Space Demo"; self.section = kDemoPlots; } @@ -22,7 +22,7 @@ -(nonnull instancetype)init return self; } --(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withTheme:(nullable CPTTheme *)theme animated:(BOOL)animated +-(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withTheme:(nullable CPTTheme *)theme animated:(BOOL __unused)animated { const CGFloat majorTickLength = 12.0; const CGFloat minorTickLength = 8.0; diff --git a/examples/CorePlotGallery/src/plots/RangePlot.m b/examples/CorePlotGallery/src/plots/RangePlot.m index d5c80ba63..779a94ee0 100644 --- a/examples/CorePlotGallery/src/plots/RangePlot.m +++ b/examples/CorePlotGallery/src/plots/RangePlot.m @@ -30,9 +30,9 @@ +(void)load -(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { graph = nil; - plotData = nil; + plotData = @[]; self.title = @"Range Plot"; self.section = kFinancialPlots; @@ -43,7 +43,7 @@ -(nonnull instancetype)init -(void)generateData { - if ( self.plotData == nil ) { + if ( self.plotData.count == 0 ) { NSMutableArray *newData = [NSMutableArray array]; for ( NSUInteger i = 0; i < 5; i++ ) { NSTimeInterval x = oneDay * (i + 1.0); @@ -68,7 +68,7 @@ -(void)generateData } } --(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withTheme:(nullable CPTTheme *)theme animated:(BOOL)animated +-(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withTheme:(nullable CPTTheme *)theme animated:(BOOL __unused)animated { // If you make sure your dates are calculated at noon, you shouldn't have to // worry about daylight savings. If you use midnight, you will have to adjust @@ -170,19 +170,20 @@ -(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withT newGraph.legend.borderLineStyle = x.axisLineStyle; newGraph.legend.cornerRadius = 5.0; newGraph.legend.swatchCornerRadius = 3.0; + newGraph.legend.swatchLayout = CPTLegendSwatchLayoutBottom; newGraph.legendAnchor = CPTRectAnchorTop; - newGraph.legendDisplacement = CGPointMake( 0.0, self.titleSize * CPTFloat(-2.0) - CPTFloat(12.0) ); + newGraph.legendDisplacement = CGPointMake(0.0, self.titleSize * CPTFloat(-2.0) - CPTFloat(12.0)); } #pragma mark - #pragma mark Plot Data Source Methods --(NSUInteger)numberOfRecordsForPlot:(nonnull CPTPlot *)plot +-(NSUInteger)numberOfRecordsForPlot:(nonnull CPTPlot *__unused)plot { return self.plotData.count; } --(nullable id)numberForPlot:(nonnull CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index +-(nullable id)numberForPlot:(nonnull CPTPlot *__unused)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index { return self.plotData[index][@(fieldEnum)]; } @@ -190,7 +191,7 @@ -(nullable id)numberForPlot:(nonnull CPTPlot *)plot field:(NSUInteger)fieldEnum #pragma mark - #pragma mark Plot Space Delegate Methods --(BOOL)plotSpace:(nonnull CPTPlotSpace *)space shouldHandlePointingDeviceUpEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)point +-(BOOL)plotSpace:(nonnull CPTPlotSpace *__unused)space shouldHandlePointingDeviceUpEvent:(nonnull CPTNativeEvent *__unused)event atPoint:(CGPoint __unused)point { CPTRangePlot *rangePlot = (CPTRangePlot *)[self.graph plotWithIdentifier:@"Range Plot"]; @@ -209,6 +210,11 @@ -(BOOL)plotSpace:(nonnull CPTPlotSpace *)space shouldHandlePointingDeviceUpEvent return NO; } +-(nullable NSNumber *)barWidthForRangePlot:(nonnull CPTRangePlot *__unused)plot recordIndex:(NSUInteger __unused)idx +{ + return @(arc4random_uniform(85) + 15); +} + #pragma mark - #pragma mark Plot Delegate Methods diff --git a/examples/CorePlotGallery/src/plots/RealTimePlot.m b/examples/CorePlotGallery/src/plots/RealTimePlot.m index 93f567e91..053fdda2b 100644 --- a/examples/CorePlotGallery/src/plots/RealTimePlot.m +++ b/examples/CorePlotGallery/src/plots/RealTimePlot.m @@ -32,7 +32,7 @@ +(void)load -(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { plotData = [[NSMutableArray alloc] initWithCapacity:kMaxDataPoints]; dataTimer = nil; @@ -158,7 +158,7 @@ -(void)dealloc #pragma mark - #pragma mark Timer callback --(void)newData:(nonnull NSTimer *)theTimer +-(void)newData:(nonnull NSTimer *__unused)theTimer { CPTGraph *theGraph = (self.graphs)[0]; CPTPlot *thePlot = [theGraph plotWithIdentifier:kPlotIdentifier]; @@ -172,7 +172,7 @@ -(void)newData:(nonnull NSTimer *)theTimer CPTXYPlotSpace *plotSpace = (CPTXYPlotSpace *)theGraph.defaultPlotSpace; NSUInteger location = (self.currentIndex >= kMaxDataPoints ? self.currentIndex - kMaxDataPoints + 2 : 0); - CPTPlotRange *oldRange = [CPTPlotRange plotRangeWithLocation:@( (location > 0) ? (location - 1) : 0 ) + CPTPlotRange *oldRange = [CPTPlotRange plotRangeWithLocation:@((location > 0) ? (location - 1) : 0) length:@(kMaxDataPoints - 2)]; CPTPlotRange *newRange = [CPTPlotRange plotRangeWithLocation:@(location) length:@(kMaxDataPoints - 2)]; @@ -184,7 +184,7 @@ -(void)newData:(nonnull NSTimer *)theTimer duration:CPTFloat(1.0 / kFrameRate)]; self.currentIndex++; - [self.plotData addObject:@( (1.0 - kAlpha) * self.plotData.lastObject.doubleValue + kAlpha * arc4random() / (double)UINT32_MAX )]; + [self.plotData addObject:@((1.0 - kAlpha) * self.plotData.lastObject.doubleValue + kAlpha * arc4random() / (double)UINT32_MAX)]; [thePlot insertDataAtIndex:self.plotData.count - 1 numberOfRecords:1]; } } @@ -192,12 +192,12 @@ -(void)newData:(nonnull NSTimer *)theTimer #pragma mark - #pragma mark Plot Data Source Methods --(NSUInteger)numberOfRecordsForPlot:(nonnull CPTPlot *)plot +-(NSUInteger)numberOfRecordsForPlot:(nonnull CPTPlot *__unused)plot { return self.plotData.count; } --(nullable id)numberForPlot:(nonnull CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index +-(nullable id)numberForPlot:(nonnull CPTPlot *__unused)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index { NSNumber *num = nil; diff --git a/examples/CorePlotGallery/src/plots/SimplePieChart.m b/examples/CorePlotGallery/src/plots/SimplePieChart.m index 95b855094..76e5c79ac 100644 --- a/examples/CorePlotGallery/src/plots/SimplePieChart.m +++ b/examples/CorePlotGallery/src/plots/SimplePieChart.m @@ -26,7 +26,7 @@ +(void)load -(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { self.title = @"Simple Pie Chart"; self.section = kPieCharts; @@ -38,12 +38,12 @@ -(nonnull instancetype)init -(void)generateData { - if ( self.plotData == nil ) { + if ( self.plotData.count == 0 ) { self.plotData = @[@20.0, @30.0, @60.0]; } } --(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withTheme:(nullable CPTTheme *)theme animated:(BOOL)animated +-(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withTheme:(nullable CPTTheme *)theme animated:(BOOL __unused)animated { #if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE CGRect bounds = hostingView.bounds; @@ -68,8 +68,8 @@ -(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withT // Add pie chart CPTPieChart *piePlot = [[CPTPieChart alloc] init]; piePlot.dataSource = self; - piePlot.pieRadius = MIN( CPTFloat(0.7) * (hostingView.frame.size.height - CPTFloat(2.0) * graph.paddingLeft) / CPTFloat(2.0), - CPTFloat(0.7) * (hostingView.frame.size.width - CPTFloat(2.0) * graph.paddingTop) / CPTFloat(2.0) ); + piePlot.pieRadius = MIN(CPTFloat(0.7) * (hostingView.frame.size.height - CPTFloat(2.0) * graph.paddingLeft) / CPTFloat(2.0), + CPTFloat(0.7) * (hostingView.frame.size.width - CPTFloat(2.0) * graph.paddingTop) / CPTFloat(2.0)); piePlot.identifier = self.title; piePlot.startAngle = CPTFloat(M_PI_4); piePlot.sliceDirection = CPTPieDirectionCounterClockwise; @@ -105,14 +105,14 @@ -(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withT graph.legendDisplacement = CGPointMake(-graph.paddingRight - CPTFloat(10.0), 0.0); } --(nullable CPTLayer *)dataLabelForPlot:(nonnull CPTPlot *)plot recordIndex:(NSUInteger)index +-(nullable CPTLayer *)dataLabelForPlot:(nonnull CPTPlot *__unused)plot recordIndex:(NSUInteger)index { static CPTMutableTextStyle *whiteText = nil; static dispatch_once_t onceToken = 0; dispatch_once(&onceToken, ^{ - whiteText = [[CPTMutableTextStyle alloc] init]; - whiteText.color = [CPTColor whiteColor]; + whiteText = [[CPTMutableTextStyle alloc] init]; + whiteText.color = [CPTColor whiteColor]; whiteText.fontSize = self.titleSize * CPTFloat(0.5); }); @@ -136,7 +136,7 @@ -(void)pieChart:(nonnull CPTPieChart *)plot sliceWasSelectedAtRecordIndex:(NSUIn self.offsetIndex = NSNotFound; CPTMutableNumberArray *newData = [[NSMutableArray alloc] init]; - NSUInteger dataCount = (NSUInteger)lrint( ceil(10.0 * arc4random() / (double)UINT32_MAX) ) + 1; + NSUInteger dataCount = (NSUInteger)lrint(ceil(10.0 * arc4random() / (double)UINT32_MAX)) + 1; for ( NSUInteger i = 1; i < dataCount; i++ ) { [newData addObject:@(100.0 * arc4random() / (double)UINT32_MAX)]; } @@ -150,14 +150,14 @@ -(void)pieChart:(nonnull CPTPieChart *)plot sliceWasSelectedAtRecordIndex:(NSUIn #pragma mark - #pragma mark CPTLegendDelegate Methods --(void)legend:(nonnull CPTLegend *)legend legendEntryForPlot:(nonnull CPTPlot *)plot wasSelectedAtIndex:(NSUInteger)idx +-(void)legend:(nonnull CPTLegend *__unused)legend legendEntryForPlot:(nonnull CPTPlot *)plot wasSelectedAtIndex:(NSUInteger)idx { NSLog(@"Legend entry for '%@' was selected at index %lu.", plot.identifier, (unsigned long)idx); [CPTAnimation animate:self property:@"sliceOffset" - from:( idx == self.offsetIndex ? CPTNAN : CPTFloat(0.0) ) - to:( idx == self.offsetIndex ? CPTFloat(0.0) : CPTFloat(35.0) ) + from:(idx == self.offsetIndex ? CPTNAN : CPTFloat(0.0)) + to:(idx == self.offsetIndex ? CPTFloat(0.0) : CPTFloat(35.0)) duration:0.5 animationCurve:CPTAnimationCurveCubicOut delegate:nil]; @@ -168,12 +168,12 @@ -(void)legend:(nonnull CPTLegend *)legend legendEntryForPlot:(nonnull CPTPlot *) #pragma mark - #pragma mark Plot Data Source Methods --(NSUInteger)numberOfRecordsForPlot:(nonnull CPTPlot *)plot +-(NSUInteger)numberOfRecordsForPlot:(nonnull CPTPlot *__unused)plot { return self.plotData.count; } --(nullable id)numberForPlot:(nonnull CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index +-(nullable id)numberForPlot:(nonnull CPTPlot *__unused)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index { NSNumber *num; @@ -187,17 +187,14 @@ -(nullable id)numberForPlot:(nonnull CPTPlot *)plot field:(NSUInteger)fieldEnum return num; } --(NSAttributedString *)attributedLegendTitleForPieChart:(nonnull CPTPieChart *)pieChart recordIndex:(NSUInteger)index +-(NSAttributedString *)attributedLegendTitleForPieChart:(nonnull CPTPieChart *__unused)pieChart recordIndex:(NSUInteger)index { -#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE - UIColor *sliceColor = [CPTPieChart defaultPieSliceColorForIndex:index].uiColor; - UIFont *labelFont = [UIFont fontWithName:@"Helvetica" size:self.titleSize * CPTFloat(0.5)]; -#else - NSColor *sliceColor = [CPTPieChart defaultPieSliceColorForIndex:index].nsColor; - NSFont *labelFont = [NSFont fontWithName:@"Helvetica" size:self.titleSize * CPTFloat(0.5)]; -#endif + CPTNativeColor *sliceColor = [CPTPieChart defaultPieSliceColorForIndex:index].nativeColor; + CPTNativeFont *labelFont = [CPTNativeFont fontWithName:@"Helvetica" + size:self.titleSize * CPTFloat(0.5)]; NSMutableAttributedString *title = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"Pie Slice %lu", (unsigned long)index]]; + [title addAttribute:NSForegroundColorAttributeName value:sliceColor range:NSMakeRange(4, 5)]; @@ -209,7 +206,7 @@ -(NSAttributedString *)attributedLegendTitleForPieChart:(nonnull CPTPieChart *)p return title; } --(CGFloat)radialOffsetForPieChart:(nonnull CPTPieChart *)pieChart recordIndex:(NSUInteger)index +-(CGFloat)radialOffsetForPieChart:(nonnull CPTPieChart *__unused)pieChart recordIndex:(NSUInteger)index { return index == self.offsetIndex ? self.sliceOffset : 0.0; } @@ -224,7 +221,7 @@ -(void)setSliceOffset:(CGFloat)newOffset [self.graphs[0] reloadData]; - if ( newOffset == CPTFloat(0.0) ) { + if ( newOffset == CPTFloat(0.0)) { self.offsetIndex = NSNotFound; } } diff --git a/examples/CorePlotGallery/src/plots/SimpleScatterPlot.m b/examples/CorePlotGallery/src/plots/SimpleScatterPlot.m index 7e9bbed4f..4a321efc4 100644 --- a/examples/CorePlotGallery/src/plots/SimpleScatterPlot.m +++ b/examples/CorePlotGallery/src/plots/SimpleScatterPlot.m @@ -26,7 +26,7 @@ +(void)load -(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { self.title = @"Simple Scatter Plot"; self.section = kLinePlots; @@ -53,7 +53,7 @@ -(void)killGraph -(void)generateData { - if ( self.plotData == nil ) { + if ( self.plotData.count == 0 ) { NSMutableArray *contentArray = [NSMutableArray array]; for ( NSUInteger i = 0; i < 10; i++ ) { NSNumber *x = @(1.0 + i * 0.05); @@ -65,7 +65,7 @@ -(void)generateData } } --(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withTheme:(nullable CPTTheme *)theme animated:(BOOL)animated +-(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withTheme:(nullable CPTTheme *)theme animated:(BOOL __unused)animated { #if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE CGRect bounds = hostingView.bounds; @@ -184,12 +184,12 @@ -(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withT #pragma mark - #pragma mark Plot Data Source Methods --(NSUInteger)numberOfRecordsForPlot:(nonnull CPTPlot *)plot +-(NSUInteger)numberOfRecordsForPlot:(nonnull CPTPlot *__unused)plot { return self.plotData.count; } --(nullable id)numberForPlot:(nonnull CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index +-(nullable id)numberForPlot:(nonnull CPTPlot *__unused)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index { NSString *key = (fieldEnum == CPTScatterPlotFieldX ? @"x" : @"y"); NSNumber *num = self.plotData[index][key]; @@ -200,7 +200,7 @@ -(nullable id)numberForPlot:(nonnull CPTPlot *)plot field:(NSUInteger)fieldEnum #pragma mark - #pragma mark Plot Space Delegate Methods --(nullable CPTPlotRange *)plotSpace:(nonnull CPTPlotSpace *)space willChangePlotRangeTo:(nonnull CPTPlotRange *)newRange forCoordinate:(CPTCoordinate)coordinate +-(nullable CPTPlotRange *)plotSpace:(nonnull CPTPlotSpace *__unused)space willChangePlotRangeTo:(nonnull CPTPlotRange *)newRange forCoordinate:(CPTCoordinate)coordinate { // Impose a limit on how far user can scroll in x if ( coordinate == CPTCoordinateX ) { @@ -217,7 +217,7 @@ -(nullable CPTPlotRange *)plotSpace:(nonnull CPTPlotSpace *)space willChangePlot #pragma mark - #pragma mark CPTScatterPlot delegate methods --(void)scatterPlot:(nonnull CPTScatterPlot *)plot plotSymbolWasSelectedAtRecordIndex:(NSUInteger)index +-(void)scatterPlot:(nonnull CPTScatterPlot *__unused)plot plotSymbolWasSelectedAtRecordIndex:(NSUInteger)index { CPTXYGraph *graph = (self.graphs)[0]; @@ -278,7 +278,7 @@ -(void)scatterPlotDataLineTouchUp:(nonnull CPTScatterPlot *)plot #pragma mark - #pragma mark Plot area delegate method --(void)plotAreaWasSelected:(nonnull CPTPlotArea *)plotArea +-(void)plotAreaWasSelected:(nonnull CPTPlotArea *__unused)plotArea { CPTXYGraph *graph = (self.graphs)[0]; @@ -293,8 +293,8 @@ -(void)plotAreaWasSelected:(nonnull CPTPlotArea *)plotArea else { CPTScatterPlotInterpolation interpolation = CPTScatterPlotInterpolationHistogram; - // Decrease the histogram display option, and if < 0 display linear graph - if ( --self.histogramOption < 0 ) { + // Decrease the histogram display option, and if < CPTScatterPlotHistogramNormal display linear graph + if ( --self.histogramOption < CPTScatterPlotHistogramNormal ) { interpolation = CPTScatterPlotInterpolationLinear; // Set the histogram option to the count, as that is guaranteed to be the last available option + 1 diff --git a/examples/CorePlotGallery/src/plots/SteppedScatterPlot.h b/examples/CorePlotGallery/src/plots/SteppedScatterPlot.h index 00d6bf568..4d8d78d2e 100644 --- a/examples/CorePlotGallery/src/plots/SteppedScatterPlot.h +++ b/examples/CorePlotGallery/src/plots/SteppedScatterPlot.h @@ -8,4 +8,5 @@ @interface SteppedScatterPlot : PlotItem + @end diff --git a/examples/CorePlotGallery/src/plots/SteppedScatterPlot.m b/examples/CorePlotGallery/src/plots/SteppedScatterPlot.m index cc48d7746..861e3a1b7 100644 --- a/examples/CorePlotGallery/src/plots/SteppedScatterPlot.m +++ b/examples/CorePlotGallery/src/plots/SteppedScatterPlot.m @@ -22,7 +22,7 @@ +(void)load -(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { self.title = @"Stepped Scatter Plot"; self.section = kLinePlots; } @@ -32,7 +32,7 @@ -(nonnull instancetype)init -(void)generateData { - if ( self.plotData == nil ) { + if ( self.plotData.count == 0 ) { NSMutableArray *contentArray = [NSMutableArray array]; for ( NSUInteger i = 0; i < 10; i++ ) { NSNumber *x = @(1.0 + i * 0.05); @@ -44,7 +44,7 @@ -(void)generateData } } --(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withTheme:(nullable CPTTheme *)theme animated:(BOOL)animated +-(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withTheme:(nullable CPTTheme *)theme animated:(BOOL __unused)animated { #if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE CGRect bounds = hostingView.bounds; @@ -110,12 +110,12 @@ -(void)Plot:(nonnull CPTPlot *)plot dataLabelWasSelectedAtRecordIndex:(NSUIntege #pragma mark - #pragma mark Plot Data Source Methods --(NSUInteger)numberOfRecordsForPlot:(nonnull CPTPlot *)plot +-(NSUInteger)numberOfRecordsForPlot:(nonnull CPTPlot *__unused)plot { return self.plotData.count; } --(nullable id)numberForPlot:(nonnull CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index +-(nullable id)numberForPlot:(nonnull CPTPlot *__unused)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index { NSString *key = (fieldEnum == CPTScatterPlotFieldX ? @"x" : @"y"); NSNumber *num = self.plotData[index][key]; diff --git a/examples/CorePlotGallery/src/plots/VerticalBarChart.m b/examples/CorePlotGallery/src/plots/VerticalBarChart.m index 175748319..2236f441f 100644 --- a/examples/CorePlotGallery/src/plots/VerticalBarChart.m +++ b/examples/CorePlotGallery/src/plots/VerticalBarChart.m @@ -10,6 +10,7 @@ @interface VerticalBarChart() @property (nonatomic, readwrite, strong, nullable) CPTPlotSpaceAnnotation *symbolTextAnnotation; + @end @implementation VerticalBarChart @@ -23,7 +24,7 @@ +(void)load -(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { self.title = @"Vertical Bar Chart"; self.section = kBarPlots; } @@ -50,7 +51,7 @@ -(void)generateData { } --(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withTheme:(nullable CPTTheme *)theme animated:(BOOL)animated +-(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withTheme:(nullable CPTTheme *)theme animated:(BOOL __unused)animated { #if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE CGRect bounds = hostingView.bounds; @@ -130,7 +131,7 @@ -(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withT { y.majorIntervalLength = (kUseHorizontalBars ? @1.0 : @10.0); y.minorTicksPerInterval = (kUseHorizontalBars ? 0 : 9); - y.orthogonalPosition = ( kUseHorizontalBars ? @0.0 : @(-0.5) ); + y.orthogonalPosition = (kUseHorizontalBars ? @0.0 : @(-0.5)); y.preferredNumberOfMajorTicks = 8; y.majorGridLineStyle = majorGridLineStyle; @@ -211,7 +212,7 @@ -(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withT theLegend.fill = [CPTFill fillWithColor:[CPTColor colorWithGenericGray:CPTFloat(0.15)]]; theLegend.borderLineStyle = barLineStyle; theLegend.cornerRadius = textSize * CPTFloat(0.25); - theLegend.swatchSize = CGSizeMake( textSize * CPTFloat(0.75), textSize * CPTFloat(0.75) ); + theLegend.swatchSize = CGSizeMake(textSize * CPTFloat(0.75), textSize * CPTFloat(0.75)); whiteTextStyle.fontSize = textSize * CPTFloat(0.5); theLegend.textStyle = whiteTextStyle; theLegend.rowMargin = textSize * CPTFloat(0.25); @@ -226,7 +227,7 @@ -(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withT CPTPlotSpaceAnnotation *legendAnnotation = [[CPTPlotSpaceAnnotation alloc] initWithPlotSpace:barPlotSpace anchorPlotPoint:plotPoint]; legendAnnotation.contentLayer = theLegend; - legendAnnotation.contentAnchorPoint = ( kUseHorizontalBars ? CGPointMake(1.0, 0.0) : CGPointMake(0.0, 1.0) ); + legendAnnotation.contentAnchorPoint = (kUseHorizontalBars ? CGPointMake(1.0, 0.0) : CGPointMake(0.0, 1.0)); [graph.plotAreaFrame.plotArea addAnnotation:legendAnnotation]; } @@ -287,7 +288,7 @@ -(void)barPlot:(nonnull CPTBarPlot *)plot barWasSelectedAtRecordIndex:(NSUIntege #pragma mark - #pragma mark Plot Data Source Methods --(NSUInteger)numberOfRecordsForPlot:(nonnull CPTPlot *)plot +-(NSUInteger)numberOfRecordsForPlot:(nonnull CPTPlot *__unused)plot { return 10; } @@ -306,7 +307,7 @@ -(nullable id)numberForPlot:(nonnull CPTPlot *)plot field:(NSUInteger)fieldEnum num = @(index); } else { - num = @( (index + 1) * (index + 1) ); + num = @((index + 1) * (index + 1)); } } else { diff --git a/examples/CorePlotGallery/src/shared/PiNumberFormatter.m b/examples/CorePlotGallery/src/shared/PiNumberFormatter.m index 44db81b2e..8b1f1fdfb 100644 --- a/examples/CorePlotGallery/src/shared/PiNumberFormatter.m +++ b/examples/CorePlotGallery/src/shared/PiNumberFormatter.m @@ -2,6 +2,8 @@ double gcd(double a, double b); +#pragma mark - + /** @brief A number formatter that converts numbers to multiples of π. **/ @implementation PiNumberFormatter @@ -17,12 +19,12 @@ @implementation PiNumberFormatter * @param coordinateValue The numeric value. * @return The formatted string. **/ --(nullable NSString *)stringForObjectValue:(nonnull id)coordinateValue +-(nullable NSString *)stringForObjectValue:(nullable id)coordinateValue { NSString *string = nil; if ( [coordinateValue respondsToSelector:@selector(doubleValue)] ) { - double value = ( (NSNumber *)coordinateValue ).doubleValue / M_PI; + double value = ((NSNumber *)coordinateValue).doubleValue / M_PI; double factor = round(self.multiplier.doubleValue); if ( factor == 0.0 ) { @@ -32,7 +34,7 @@ -(nullable NSString *)stringForObjectValue:(nonnull id)coordinateValue double numerator = round(value * factor); double denominator = factor; double fraction = numerator / denominator; - double divisor = ABS( gcd(numerator, denominator) ); + double divisor = ABS(gcd(numerator, denominator)); if ( fraction == 0.0 ) { string = @"0"; @@ -70,7 +72,7 @@ -(nullable NSString *)stringForObjectValue:(nonnull id)coordinateValue while ( a != 0.0 ) { c = a; - a = round( fmod(b, a) ); + a = round(fmod(b, a)); b = c; } diff --git a/examples/CorePlotGallery/src/shared/PlotGallery.m b/examples/CorePlotGallery/src/shared/PlotGallery.m index 2223b8ff4..fc40ffe5a 100644 --- a/examples/CorePlotGallery/src/shared/PlotGallery.m +++ b/examples/CorePlotGallery/src/shared/PlotGallery.m @@ -12,6 +12,8 @@ @interface PlotGallery() @end +#pragma mark - + @implementation PlotGallery @synthesize plotItems; @@ -21,8 +23,7 @@ @implementation PlotGallery +(nonnull PlotGallery *)sharedPlotGallery { - @synchronized(self) - { + @synchronized ( self ) { if ( sharedPlotGallery == nil ) { sharedPlotGallery = [[self alloc] init]; } @@ -32,8 +33,7 @@ +(nonnull PlotGallery *)sharedPlotGallery +(id)allocWithZone:(NSZone *)zone { - @synchronized(self) - { + @synchronized ( self ) { if ( sharedPlotGallery == nil ) { return [super allocWithZone:zone]; } @@ -45,10 +45,9 @@ -(nonnull instancetype)init { Class thisClass = [self class]; - @synchronized(thisClass) - { + @synchronized ( thisClass ) { if ( sharedPlotGallery == nil ) { - if ( (self = [super init]) ) { + if ((self = [super init])) { sharedPlotGallery = self; plotItems = [[NSMutableArray alloc] init]; plotSections = [[NSCountedSet alloc] init]; @@ -59,7 +58,7 @@ -(nonnull instancetype)init return sharedPlotGallery; } --(nonnull id)copyWithZone:(nullable NSZone *)zone +-(nonnull id)copyWithZone:(nullable NSZone *__unused)zone { return self; } diff --git a/examples/CorePlotGallery/src/shared/PlotItem.m b/examples/CorePlotGallery/src/shared/PlotItem.m index c1643e3a9..08bc060b7 100644 --- a/examples/CorePlotGallery/src/shared/PlotItem.m +++ b/examples/CorePlotGallery/src/shared/PlotItem.m @@ -9,7 +9,7 @@ #if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE #else -// For IKImageBrowser +// For NSCollectionView #import #endif @@ -53,12 +53,12 @@ +(void)registerPlotItem:(nonnull id)item -(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { defaultLayerHostingView = nil; graphs = [[NSMutableArray alloc] init]; - section = nil; - title = nil; + section = @""; + title = @""; } return self; @@ -124,7 +124,7 @@ -(CGFloat)titleSize #if TARGET_OS_TV size = 36.0; #elif TARGET_OS_SIMULATOR || TARGET_OS_IPHONE - switch ( UI_USER_INTERFACE_IDIOM() ) { + switch ( UI_USER_INTERFACE_IDIOM()) { case UIUserInterfaceIdiomPad: size = 24.0; break; @@ -150,7 +150,7 @@ -(void)setPaddingDefaultsForGraph:(nonnull CPTGraph *)graph graph.paddingLeft = boundsPadding; - if ( graph.titleDisplacement.y > CPTFloat(0.0) ) { + if ( graph.titleDisplacement.y > CPTFloat(0.0)) { graph.paddingTop = graph.titleTextStyle.fontSize * CPTFloat(2.0); } else { @@ -174,7 +174,7 @@ -(void)formatAllGraphs graph.title = (self.graphs.count == 1 ? self.title : nil); graph.titleTextStyle = textStyle; - graph.titleDisplacement = CPTPointMake( 0.0, textStyle.fontSize * CPTFloat(1.5) ); + graph.titleDisplacement = CPTPointMake(0.0, textStyle.fontSize * CPTFloat(1.5)); graph.titlePlotAreaFrameAnchor = CPTRectAnchorTop; // Padding @@ -228,7 +228,7 @@ -(void)formatAllGraphs textStyle.fontSize = labelSize; theLegend.textStyle = textStyle; - theLegend.swatchSize = CGSizeMake( labelSize * CPTFloat(1.5), labelSize * CPTFloat(1.5) ); + theLegend.swatchSize = CGSizeMake(labelSize * CPTFloat(1.5), labelSize * CPTFloat(1.5)); theLegend.rowMargin = labelSize * CPTFloat(0.75); theLegend.columnMargin = labelSize * CPTFloat(0.75); @@ -242,7 +242,7 @@ -(void)formatAllGraphs #if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE --(nonnull UIImage *)image +-(nonnull CPTNativeImage *)image { if ( self.cachedImage == nil ) { CGRect imageFrame = CGRectMake(0, 0, 400, 300); @@ -287,7 +287,7 @@ -(nonnull UIImage *)image #else // OSX --(nonnull NSImage *)image +-(nonnull CPTNativeImage *)image { if ( self.cachedImage == nil ) { CGRect imageFrame = CGRectMake(0, 0, 400, 300); @@ -299,26 +299,9 @@ -(nonnull NSImage *)image CGSize boundsSize = imageFrame.size; - NSBitmapImageRep *layerImage = [[NSBitmapImageRep alloc] - initWithBitmapDataPlanes:NULL - pixelsWide:(NSInteger)boundsSize.width - pixelsHigh:(NSInteger)boundsSize.height - bitsPerSample:8 - samplesPerPixel:4 - hasAlpha:YES - isPlanar:NO - colorSpaceName:NSCalibratedRGBColorSpace - bytesPerRow:(NSInteger)boundsSize.width * 4 - bitsPerPixel:32]; - - NSGraphicsContext *bitmapContext = [NSGraphicsContext graphicsContextWithBitmapImageRep:layerImage]; - CGContextRef context = (CGContextRef)bitmapContext.graphicsPort; - - CGContextClearRect( context, CGRectMake(0.0, 0.0, boundsSize.width, boundsSize.height) ); - CGContextSetAllowsAntialiasing(context, true); - CGContextSetShouldSmoothFonts(context, false); - [imageView.layer renderInContext:context]; - CGContextFlush(context); + NSBitmapImageRep *layerImage = [imageView bitmapImageRepForCachingDisplayInRect:imageFrame]; + layerImage.size = boundsSize; + [imageView cacheDisplayInRect:imageFrame toBitmapImageRep:layerImage]; self.cachedImage = [[NSImage alloc] initWithSize:NSSizeFromCGSize(boundsSize)]; [self.cachedImage addRepresentation:layerImage]; @@ -326,6 +309,7 @@ -(nonnull NSImage *)image return self.cachedImage; } + #endif -(void)applyTheme:(nullable CPTTheme *)theme toGraph:(nonnull CPTGraph *)graph withDefault:(nullable CPTTheme *)defaultTheme @@ -340,9 +324,10 @@ -(void)applyTheme:(nullable CPTTheme *)theme toGraph:(nonnull CPTGraph *)graph w #if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE #else --(void)setFrameSize:(NSSize)size +-(void)setFrameSize:(NSSize __unused)size { } + #endif -(void)renderInView:(nonnull PlotGalleryNativeView *)inView withTheme:(nullable CPTTheme *)theme animated:(BOOL)animated @@ -396,7 +381,7 @@ -(void)renderInView:(nonnull PlotGalleryNativeView *)inView withTheme:(nullable self.defaultLayerHostingView = hostingView; } --(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withTheme:(nullable CPTTheme *)theme animated:(BOOL)animated +-(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *__unused)hostingView withTheme:(nullable CPTTheme *__unused)theme animated:(BOOL __unused)animated { NSLog(@"PlotItem:renderInLayer: Override me"); } @@ -433,6 +418,7 @@ -(NSString *)imageTitle { return self.title; } + #endif @end diff --git a/examples/CorePlotGallery/src/tvOS/AppDelegateTV.m b/examples/CorePlotGallery/src/tvOS/AppDelegateTV.m index c793498f1..25c2be344 100644 --- a/examples/CorePlotGallery/src/tvOS/AppDelegateTV.m +++ b/examples/CorePlotGallery/src/tvOS/AppDelegateTV.m @@ -6,7 +6,7 @@ @implementation AppDelegateTV @synthesize window; --(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions +-(BOOL)application:(UIApplication *__unused)application didFinishLaunchingWithOptions:(NSDictionary *__unused)launchOptions { [[PlotGallery sharedPlotGallery] sortByTitle]; diff --git a/examples/CorePlotGallery/src/tvOS/Main.storyboard b/examples/CorePlotGallery/src/tvOS/Base.lproj/Main.storyboard similarity index 100% rename from examples/CorePlotGallery/src/tvOS/Main.storyboard rename to examples/CorePlotGallery/src/tvOS/Base.lproj/Main.storyboard diff --git a/examples/CorePlotGallery/src/tvOS/DetailViewControllerTV.m b/examples/CorePlotGallery/src/tvOS/DetailViewControllerTV.m index e98a8f379..7cc1f5d52 100644 --- a/examples/CorePlotGallery/src/tvOS/DetailViewControllerTV.m +++ b/examples/CorePlotGallery/src/tvOS/DetailViewControllerTV.m @@ -40,12 +40,14 @@ -(void)setupView -(void)awakeFromNib { + [super awakeFromNib]; + [self setupView]; } -(instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { - if ( (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) ) { + if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) { [self setupView]; } diff --git a/examples/CorePlotGallery/src/tvOS/RootViewControllerTV.m b/examples/CorePlotGallery/src/tvOS/RootViewControllerTV.m index fa737fcbc..0e114aef2 100644 --- a/examples/CorePlotGallery/src/tvOS/RootViewControllerTV.m +++ b/examples/CorePlotGallery/src/tvOS/RootViewControllerTV.m @@ -48,7 +48,7 @@ -(void)dealloc #pragma mark - #pragma mark Segues --(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender +-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id __unused)sender { if ( [segue.identifier isEqualToString:@"showDetail"] ) { DetailViewControllerTV *controller = (DetailViewControllerTV *)segue.destinationViewController; @@ -88,12 +88,12 @@ -(void)themeChanged:(NSNotification *)notification #pragma mark - #pragma mark Table view data source --(NSInteger)numberOfSectionsInTableView:(UITableView *)tv +-(NSInteger)numberOfSectionsInTableView:(UITableView *__unused)tv { return (NSInteger)[PlotGallery sharedPlotGallery].numberOfSections; } --(NSInteger)tableView:(UITableView *)tv numberOfRowsInSection:(NSInteger)section +-(NSInteger)tableView:(UITableView *__unused)tv numberOfRowsInSection:(NSInteger)section { return (NSInteger)[[PlotGallery sharedPlotGallery] numberOfRowsInSection:(NSUInteger)section]; } @@ -117,7 +117,7 @@ -(UITableViewCell *)tableView:(UITableView *)tv cellForRowAtIndexPath:(NSIndexPa return cell; } --(NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section +-(NSString *)tableView:(UITableView *__unused)tableView titleForHeaderInSection:(NSInteger)section { return [PlotGallery sharedPlotGallery].sectionTitles[(NSUInteger)section]; } diff --git a/examples/CorePlotGallery/src/tvOS/ThemeTableViewControllerTV.m b/examples/CorePlotGallery/src/tvOS/ThemeTableViewControllerTV.m index d8f3ce37b..fb6aac50e 100644 --- a/examples/CorePlotGallery/src/tvOS/ThemeTableViewControllerTV.m +++ b/examples/CorePlotGallery/src/tvOS/ThemeTableViewControllerTV.m @@ -41,12 +41,14 @@ -(void)setupThemes -(void)awakeFromNib { + [super awakeFromNib]; + [self setupThemes]; } -(instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { - if ( (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) ) { + if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) { [self setupThemes]; } @@ -56,12 +58,12 @@ -(instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBu #pragma mark - #pragma mark Table view data source --(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView +-(NSInteger)numberOfSectionsInTableView:(UITableView *__unused)tableView { return 1; } --(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section +-(NSInteger)tableView:(UITableView *__unused)tableView numberOfRowsInSection:(NSInteger __unused)section { return (NSInteger)self.themes.count; } @@ -84,10 +86,10 @@ -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NS #pragma mark - #pragma mark Table view delegate --(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath +-(void)tableView:(UITableView *__unused)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { NSDictionary *themeInfo = @{ - PlotGalleryThemeNameKey: self.themes[(NSUInteger)indexPath.row] + PlotGalleryThemeNameKey: self.themes[(NSUInteger)indexPath.row] }; [[NSNotificationCenter defaultCenter] postNotificationName:PlotGalleryThemeDidChangeNotification diff --git a/examples/CorePlotGallery/src/tvOS/main.m b/examples/CorePlotGallery/src/tvOS/main.m index cee796cdf..3bc32fa82 100644 --- a/examples/CorePlotGallery/src/tvOS/main.m +++ b/examples/CorePlotGallery/src/tvOS/main.m @@ -4,6 +4,6 @@ int main(int argc, char *argv[]) { @autoreleasepool { - return UIApplicationMain( argc, argv, nil, NSStringFromClass([AppDelegateTV class]) ); + return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegateTV class])); } } diff --git a/examples/DatePlot/DatePlot.xib b/examples/DatePlot/Base.lproj/DatePlot.xib similarity index 100% rename from examples/DatePlot/DatePlot.xib rename to examples/DatePlot/Base.lproj/DatePlot.xib diff --git a/examples/DatePlot/Info.plist b/examples/DatePlot/Base.lproj/Info.plist similarity index 100% rename from examples/DatePlot/Info.plist rename to examples/DatePlot/Base.lproj/Info.plist diff --git a/examples/DatePlot/DatePlot-Bridging-Header.h b/examples/DatePlot/DatePlot-Bridging-Header.h deleted file mode 100644 index cde174e4f..000000000 --- a/examples/DatePlot/DatePlot-Bridging-Header.h +++ /dev/null @@ -1 +0,0 @@ -#import diff --git a/examples/DatePlot/DatePlot.xcodeproj/project.pbxproj b/examples/DatePlot/DatePlot.xcodeproj/project.pbxproj index 0304c144d..21d005158 100644 --- a/examples/DatePlot/DatePlot.xcodeproj/project.pbxproj +++ b/examples/DatePlot/DatePlot.xcodeproj/project.pbxproj @@ -11,10 +11,10 @@ 0761850B0F3CB1E800A89A76 /* CorePlot.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 076184C10F3CAD5900A89A76 /* CorePlot.framework */; }; 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; }; 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; - 90AF4F440F36CF1800753D26 /* DatePlot.xib in Resources */ = {isa = PBXBuildFile; fileRef = 90AF4F430F36CF1800753D26 /* DatePlot.xib */; }; BC8E737D0FC0B3CF00DF8511 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BC8E737C0FC0B3CF00DF8511 /* QuartzCore.framework */; }; - C33E19A8198330CA00182AF2 /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = C33E19A7198330CA00182AF2 /* main.swift */; }; + C33E19A8198330CA00182AF2 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C33E19A7198330CA00182AF2 /* AppDelegate.swift */; }; C3A14440197DE35F0048F1FF /* DateController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3A1443F197DE35F0048F1FF /* DateController.swift */; }; + C3D0A1A720E0183A00BA2921 /* DatePlot.xib in Resources */ = {isa = PBXBuildFile; fileRef = C3D0A1A920E0183A00BA2921 /* DatePlot.xib */; }; C3D3937419FD6E3500148319 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C3D3937319FD6E3500148319 /* Images.xcassets */; }; /* End PBXBuildFile section */ @@ -102,19 +102,18 @@ 071BCBD61079EBE00045E43D /* CorePlot.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = CorePlot.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 076184BC0F3CAD5900A89A76 /* CorePlot.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = CorePlot.xcodeproj; path = ../../framework/CorePlot.xcodeproj; sourceTree = SOURCE_ROOT; }; 0761854B0F3CB3CB00A89A76 /* CorePlot.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = CorePlot.framework; path = ../../../../framework/build/Debug/CorePlot.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 089C165DFE840E0CC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; 13E42FB307B3F0F600E4EEF1 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = ""; }; 29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; 29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; - 8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 8D1107320486CEB800E47090 /* DatePlot.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DatePlot.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 90AF4F430F36CF1800753D26 /* DatePlot.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = DatePlot.xib; sourceTree = ""; }; BC8E737C0FC0B3CF00DF8511 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; - C33E19A7198330CA00182AF2 /* main.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = main.swift; path = Source/main.swift; sourceTree = ""; }; - C3A1443E197DE35F0048F1FF /* DatePlot-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "DatePlot-Bridging-Header.h"; sourceTree = ""; }; + C33E19A7198330CA00182AF2 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = AppDelegate.swift; path = Source/AppDelegate.swift; sourceTree = ""; }; + C37A409820E030B500C4FF48 /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Base; path = Base.lproj/Info.plist; sourceTree = ""; }; + C385066522A9CC740086BAD5 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; C3A1443F197DE35F0048F1FF /* DateController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = DateController.swift; path = Source/DateController.swift; sourceTree = ""; }; C3C3CBBF19EA07F600A0296A /* CorePlotWarnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = CorePlotWarnings.xcconfig; path = ../../framework/xcconfig/CorePlotWarnings.xcconfig; sourceTree = ""; }; + C3D0A1B620E0184100BA2921 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/DatePlot.xib; sourceTree = ""; }; C3D3937319FD6E3500148319 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = DatePlot/Images.xcassets; sourceTree = ""; }; /* End PBXFileReference section */ @@ -150,7 +149,7 @@ 080E96DDFE201D6D7F000001 /* Classes */ = { isa = PBXGroup; children = ( - C3A1443E197DE35F0048F1FF /* DatePlot-Bridging-Header.h */, + C33E19A7198330CA00182AF2 /* AppDelegate.swift */, C3A1443F197DE35F0048F1FF /* DateController.swift */, ); name = Classes; @@ -205,8 +204,8 @@ isa = PBXGroup; children = ( C3D3937319FD6E3500148319 /* Images.xcassets */, - 90AF4F430F36CF1800753D26 /* DatePlot.xib */, - 8D1107310486CEB800E47090 /* Info.plist */, + C3D0A1A920E0183A00BA2921 /* DatePlot.xib */, + C37A409920E030B500C4FF48 /* Info.plist */, 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */, ); name = Resources; @@ -224,7 +223,6 @@ C33E19A219832EEA00182AF2 /* Other Sources */ = { isa = PBXGroup; children = ( - C33E19A7198330CA00182AF2 /* main.swift */, C3C3CBBF19EA07F600A0296A /* CorePlotWarnings.xcconfig */, ); name = "Other Sources"; @@ -261,17 +259,23 @@ attributes = { BuildIndependentTargetsInParallel = NO; LastSwiftUpdateCheck = 0700; - LastUpgradeCheck = 0700; + LastUpgradeCheck = 1100; + TargetAttributes = { + 8D1107260486CEB800E47090 = { + LastSwiftMigration = 1020; + }; + }; }; buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "DatePlot" */; compatibilityVersion = "Xcode 6.3"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 1; knownRegions = ( - English, - Japanese, - French, - German, + Base, + de, + ja, + en, + fr, ); mainGroup = 29B97314FDCFA39411CA2CEA /* CPTTestApp */; projectDirPath = ""; @@ -354,7 +358,7 @@ files = ( 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */, C3D3937419FD6E3500148319 /* Images.xcassets in Resources */, - 90AF4F440F36CF1800753D26 /* DatePlot.xib in Resources */, + C3D0A1A720E0183A00BA2921 /* DatePlot.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -365,7 +369,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - C33E19A8198330CA00182AF2 /* main.swift in Sources */, + C33E19A8198330CA00182AF2 /* AppDelegate.swift in Sources */, C3A14440197DE35F0048F1FF /* DateController.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -384,11 +388,27 @@ 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */ = { isa = PBXVariantGroup; children = ( - 089C165DFE840E0CC02AAC07 /* English */, + C385066522A9CC740086BAD5 /* en */, ); name = InfoPlist.strings; sourceTree = ""; }; + C37A409920E030B500C4FF48 /* Info.plist */ = { + isa = PBXVariantGroup; + children = ( + C37A409820E030B500C4FF48 /* Base */, + ); + name = Info.plist; + sourceTree = ""; + }; + C3D0A1A920E0183A00BA2921 /* DatePlot.xib */ = { + isa = PBXVariantGroup; + children = ( + C3D0A1B620E0184100BA2921 /* Base */, + ); + name = DatePlot.xib; + sourceTree = ""; + }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ @@ -400,22 +420,21 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CODE_SIGN_IDENTITY = "-"; COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = DatePlot_Prefix.pch; GCC_PREPROCESSOR_DEFINITIONS = ""; - GCC_TREAT_WARNINGS_AS_ERRORS = YES; - INFOPLIST_FILE = Info.plist; + INFOPLIST_FILE = "$(SRCROOT)/Base.lproj/Info.plist"; INSTALL_PATH = "$(HOME)/Applications"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @loader_path/../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "org.CorePlot.${PRODUCT_NAME:identifier}"; PRODUCT_NAME = DatePlot; - SWIFT_OBJC_BRIDGING_HEADER = "DatePlot-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -427,31 +446,34 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CODE_SIGN_IDENTITY = "-"; COMBINE_HIDPI_IMAGES = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; GCC_MODEL_TUNING = G5; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = DatePlot_Prefix.pch; GCC_PREPROCESSOR_DEFINITIONS = ""; - INFOPLIST_FILE = Info.plist; + INFOPLIST_FILE = "$(SRCROOT)/Base.lproj/Info.plist"; INSTALL_PATH = "$(HOME)/Applications"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @loader_path/../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "org.CorePlot.${PRODUCT_NAME:identifier}"; PRODUCT_NAME = DatePlot; - SWIFT_OBJC_BRIDGING_HEADER = "DatePlot-Bridging-Header.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 5.0; }; name = Release; }; C01FCF4F08A954540054247B /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = C3C3CBBF19EA07F600A0296A /* CorePlotWarnings.xcconfig */; buildSettings = { + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; ENABLE_TESTABILITY = YES; FRAMEWORK_SEARCH_PATHS = ""; GCC_C_LANGUAGE_STANDARD = c99; + GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ""; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; MACOSX_DEPLOYMENT_TARGET = 10.9; ONLY_ACTIVE_ARCH = YES; SDKROOT = macosx; @@ -461,11 +483,13 @@ }; C01FCF5008A954540054247B /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = C3C3CBBF19EA07F600A0296A /* CorePlotWarnings.xcconfig */; buildSettings = { + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; GCC_C_LANGUAGE_STANDARD = c99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = s; GCC_PREPROCESSOR_DEFINITIONS = ""; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; MACOSX_DEPLOYMENT_TARGET = 10.9; SDKROOT = macosx; SYMROOT = "$(SRCROOT)/../../build"; diff --git a/examples/DatePlot/DatePlot.xcodeproj/xcshareddata/xcschemes/DatePlot.xcscheme b/examples/DatePlot/DatePlot.xcodeproj/xcshareddata/xcschemes/DatePlot.xcscheme index 8a7fc2ae5..40f98e3d8 100644 --- a/examples/DatePlot/DatePlot.xcodeproj/xcshareddata/xcschemes/DatePlot.xcscheme +++ b/examples/DatePlot/DatePlot.xcodeproj/xcshareddata/xcschemes/DatePlot.xcscheme @@ -1,6 +1,6 @@ - - - - + + - - UInt + func numberOfRecords(for plot: CPTPlot) -> UInt { return UInt(self.plotData.count) } - func numberForPlot(plot: CPTPlot, field: UInt, recordIndex: UInt) -> AnyObject? + func number(for plot: CPTPlot, field: UInt, record: UInt) -> Any? { switch CPTScatterPlotField(rawValue: Int(field))! { case .X: - return (oneDay * Double(recordIndex)) as NSNumber + return (oneDay * Double(record)) as NSNumber case .Y: - return self.plotData[Int(recordIndex)] as NSNumber + return self.plotData[Int(record)] as NSNumber + + @unknown default: + return nil } } } diff --git a/examples/DatePlot/Source/main.swift b/examples/DatePlot/Source/main.swift deleted file mode 100644 index f43c39451..000000000 --- a/examples/DatePlot/Source/main.swift +++ /dev/null @@ -1,3 +0,0 @@ -import Cocoa - -NSApplicationMain(Process.argc, Process.unsafeArgv) diff --git a/examples/DatePlot/English.lproj/InfoPlist.strings b/examples/DatePlot/en.lproj/InfoPlist.strings similarity index 100% rename from examples/DatePlot/English.lproj/InfoPlist.strings rename to examples/DatePlot/en.lproj/InfoPlist.strings diff --git a/examples/DropPlot/English.lproj/CPTPlotDocument.xib b/examples/DropPlot/Base.lproj/CPTPlotDocument.xib similarity index 100% rename from examples/DropPlot/English.lproj/CPTPlotDocument.xib rename to examples/DropPlot/Base.lproj/CPTPlotDocument.xib diff --git a/examples/DropPlot/Info.plist b/examples/DropPlot/Base.lproj/Info.plist similarity index 100% rename from examples/DropPlot/Info.plist rename to examples/DropPlot/Base.lproj/Info.plist diff --git a/examples/DropPlot/English.lproj/MainMenu.xib b/examples/DropPlot/Base.lproj/MainMenu.xib similarity index 100% rename from examples/DropPlot/English.lproj/MainMenu.xib rename to examples/DropPlot/Base.lproj/MainMenu.xib diff --git a/examples/DropPlot/CPTPlotDocument.m b/examples/DropPlot/CPTPlotDocument.m index 22bcfec78..537a8bdcb 100644 --- a/examples/DropPlot/CPTPlotDocument.m +++ b/examples/DropPlot/CPTPlotDocument.m @@ -59,7 +59,7 @@ -(nullable NSString *)windowNibName return @"CPTPlotDocument"; } --(void)windowControllerDidLoadNib:(nonnull NSWindowController *)windowController +-(void)windowControllerDidLoadNib:(nonnull NSWindowController *__unused)windowController { // Create graph from theme CPTXYGraph *newGraph = [[CPTXYGraph alloc] initWithFrame:CGRectZero]; @@ -90,9 +90,9 @@ -(void)windowControllerDidLoadNib:(nonnull NSWindowController *)windowController // Setup plot space CPTXYPlotSpace *plotSpace = (CPTXYPlotSpace *)newGraph.defaultPlotSpace; plotSpace.xRange = [CPTPlotRange plotRangeWithLocation:@(self.minimumValueForXAxis) - length:@(ceil( (self.maximumValueForXAxis - self.minimumValueForXAxis) / self.majorIntervalLengthForX ) * self.majorIntervalLengthForX)]; + length:@(ceil((self.maximumValueForXAxis - self.minimumValueForXAxis) / self.majorIntervalLengthForX) * self.majorIntervalLengthForX)]; plotSpace.yRange = [CPTPlotRange plotRangeWithLocation:@(self.minimumValueForYAxis) - length:@(ceil( (self.maximumValueForYAxis - self.minimumValueForYAxis) / self.majorIntervalLengthForY ) * self.majorIntervalLengthForY)]; + length:@(ceil((self.maximumValueForYAxis - self.minimumValueForYAxis) / self.majorIntervalLengthForY) * self.majorIntervalLengthForY)]; // this allows the plot to respond to mouse events plotSpace.delegate = self; @@ -128,7 +128,7 @@ -(void)windowControllerDidLoadNib:(nonnull NSWindowController *)windowController #pragma mark - #pragma mark Data loading methods --(nullable NSData *)dataOfType:(nonnull NSString *)typeName error:(NSError *__autoreleasing __nullable *)outError +-(nullable NSData *)dataOfType:(nonnull NSString *__unused)typeName error:(NSError *__autoreleasing __nullable *)outError { // Insert code here to write your document to data of the specified type. If the given outError != NULL, ensure that you set *outError when returning nil. @@ -201,13 +201,13 @@ -(BOOL)readFromData:(nonnull NSData *)data ofType:(NSString *)typeName error:(NS double intervalX = (maxX - minX) / 5.0; if ( intervalX > 0.0 ) { - intervalX = pow( 10.0, ceil( log10(intervalX) ) ); + intervalX = pow(10.0, ceil(log10(intervalX))); } self.majorIntervalLengthForX = intervalX; double intervalY = (maxY - minY) / 10.0; if ( intervalY > 0.0 ) { - intervalY = pow( 10.0, ceil( log10(intervalY) ) ); + intervalY = pow(10.0, ceil(log10(intervalY))); } self.majorIntervalLengthForY = intervalY; @@ -297,9 +297,9 @@ -(IBAction)zoomOut CPTXYPlotSpace *plotSpace = (CPTXYPlotSpace *)self.graph.defaultPlotSpace; plotSpace.xRange = [CPTPlotRange plotRangeWithLocation:@(minX) - length:@(ceil( (maxX - minX) / intervalX ) * intervalX)]; + length:@(ceil((maxX - minX) / intervalX) * intervalX)]; plotSpace.yRange = [CPTPlotRange plotRangeWithLocation:@(minY) - length:@(ceil( (maxY - minY) / intervalY ) * intervalY)]; + length:@(ceil((maxY - minY) / intervalY) * intervalY)]; CPTXYAxisSet *axisSet = (CPTXYAxisSet *)self.graph.axisSet; axisSet.xAxis.labelingPolicy = CPTAxisLabelingPolicyFixedInterval; axisSet.yAxis.labelingPolicy = CPTAxisLabelingPolicyFixedInterval; @@ -308,7 +308,7 @@ -(IBAction)zoomOut #pragma mark - #pragma mark PDF / image export --(IBAction)exportToPDF:(nullable id)sender +-(IBAction)exportToPDF:(nullable id __unused)sender { NSSavePanel *pdfSavingDialog = [NSSavePanel savePanel]; @@ -324,7 +324,7 @@ -(IBAction)exportToPDF:(nullable id)sender } } --(IBAction)exportToPNG:(nullable id)sender +-(IBAction)exportToPNG:(nullable id __unused)sender { NSSavePanel *pngSavingDialog = [NSSavePanel savePanel]; @@ -346,12 +346,12 @@ -(IBAction)exportToPNG:(nullable id)sender #pragma mark - #pragma mark Plot Data Source Methods --(NSUInteger)numberOfRecordsForPlot:(nonnull CPTPlot *)plot +-(NSUInteger)numberOfRecordsForPlot:(nonnull CPTPlot *__unused)plot { return self.dataPoints.count; } --(nullable id)numberForPlot:(nonnull CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index +-(nullable id)numberForPlot:(nonnull CPTPlot *__unused)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index { NSString *key = (fieldEnum == CPTScatterPlotFieldX ? @"x" : @"y"); @@ -361,7 +361,7 @@ -(nullable id)numberForPlot:(nonnull CPTPlot *)plot field:(NSUInteger)fieldEnum #pragma mark - #pragma mark Plot Space Delegate Methods --(BOOL)plotSpace:(nonnull CPTPlotSpace *)space shouldHandlePointingDeviceDraggedEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint +-(BOOL)plotSpace:(nonnull CPTPlotSpace *__unused)space shouldHandlePointingDeviceDraggedEvent:(nonnull CPTNativeEvent *__unused)event atPoint:(CGPoint)interactionPoint { CPTPlotSpaceAnnotation *annotation = self.zoomAnnotation; @@ -369,16 +369,16 @@ -(BOOL)plotSpace:(nonnull CPTPlotSpace *)space shouldHandlePointingDeviceDragged CPTPlotArea *plotArea = self.graph.plotAreaFrame.plotArea; CGRect plotBounds = plotArea.bounds; - // convert the dragStart and dragEnd values to plot coordinates +// convert the dragStart and dragEnd values to plot coordinates CGPoint dragStartInPlotArea = [self.graph convertPoint:self.dragStart toLayer:plotArea]; CGPoint dragEndInPlotArea = [self.graph convertPoint:interactionPoint toLayer:plotArea]; - // create the dragrect from dragStart to the current location - CGFloat endX = MAX( MIN( dragEndInPlotArea.x, CGRectGetMaxX(plotBounds) ), CGRectGetMinX(plotBounds) ); - CGFloat endY = MAX( MIN( dragEndInPlotArea.y, CGRectGetMaxY(plotBounds) ), CGRectGetMinY(plotBounds) ); - CGRect borderRect = CGRectMake( dragStartInPlotArea.x, dragStartInPlotArea.y, - (endX - dragStartInPlotArea.x), - (endY - dragStartInPlotArea.y) ); +// create the dragrect from dragStart to the current location + CGFloat endX = MAX(MIN(dragEndInPlotArea.x, CGRectGetMaxX(plotBounds)), CGRectGetMinX(plotBounds)); + CGFloat endY = MAX(MIN(dragEndInPlotArea.y, CGRectGetMaxY(plotBounds)), CGRectGetMinY(plotBounds)); + CGRect borderRect = CGRectMake(dragStartInPlotArea.x, dragStartInPlotArea.y, + (endX - dragStartInPlotArea.x), + (endY - dragStartInPlotArea.y)); annotation.contentAnchorPoint = CGPointMake(dragEndInPlotArea.x >= dragStartInPlotArea.x ? 0.0 : 1.0, dragEndInPlotArea.y >= dragStartInPlotArea.y ? 0.0 : 1.0); @@ -388,7 +388,7 @@ -(BOOL)plotSpace:(nonnull CPTPlotSpace *)space shouldHandlePointingDeviceDragged return NO; } --(BOOL)plotSpace:(nonnull CPTPlotSpace *)space shouldHandlePointingDeviceDownEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint +-(BOOL)plotSpace:(nonnull CPTPlotSpace *__unused)space shouldHandlePointingDeviceDownEvent:(nonnull CPTNativeEvent *__unused)event atPoint:(CGPoint)interactionPoint { if ( !self.zoomAnnotation ) { self.dragStart = interactionPoint; @@ -396,9 +396,9 @@ -(BOOL)plotSpace:(nonnull CPTPlotSpace *)space shouldHandlePointingDeviceDownEve CPTPlotArea *plotArea = self.graph.plotAreaFrame.plotArea; CGPoint dragStartInPlotArea = [self.graph convertPoint:self.dragStart toLayer:plotArea]; - if ( CGRectContainsPoint(plotArea.bounds, dragStartInPlotArea) ) { - // create the zoom rectangle - // first a bordered layer to draw the zoomrect + if ( CGRectContainsPoint(plotArea.bounds, dragStartInPlotArea)) { +// create the zoom rectangle +// first a bordered layer to draw the zoomrect CPTBorderedLayer *zoomRectangleLayer = [[CPTBorderedLayer alloc] initWithFrame:CGRectNull]; CPTMutableLineStyle *lineStyle = [CPTMutableLineStyle lineStyle]; @@ -414,7 +414,7 @@ -(BOOL)plotSpace:(nonnull CPTPlotSpace *)space shouldHandlePointingDeviceDownEve CPTNumberArray *anchorPoint = @[@(start[CPTCoordinateX]), @(start[CPTCoordinateY])]; - // now create the annotation +// now create the annotation CPTPlotSpace *defaultSpace = self.graph.defaultPlotSpace; if ( defaultSpace ) { CPTPlotSpaceAnnotation *annotation = [[CPTPlotSpaceAnnotation alloc] initWithPlotSpace:defaultSpace anchorPlotPoint:anchorPoint]; @@ -429,28 +429,28 @@ -(BOOL)plotSpace:(nonnull CPTPlotSpace *)space shouldHandlePointingDeviceDownEve return NO; } --(BOOL)plotSpace:(nonnull CPTPlotSpace *)space shouldHandlePointingDeviceUpEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint +-(BOOL)plotSpace:(nonnull CPTPlotSpace *__unused)space shouldHandlePointingDeviceUpEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint { CPTPlotSpaceAnnotation *annotation = self.zoomAnnotation; if ( annotation ) { self.dragEnd = interactionPoint; - // double-click to completely zoom out - if ( event.clickCount == 2 ) { +// double-click to completely zoom out + if ((event.type != NSEventTypeScrollWheel) && (event.clickCount == 2)) { CPTPlotArea *plotArea = self.graph.plotAreaFrame.plotArea; CGPoint dragEndInPlotArea = [self.graph convertPoint:interactionPoint toLayer:plotArea]; - if ( CGRectContainsPoint(plotArea.bounds, dragEndInPlotArea) ) { + if ( CGRectContainsPoint(plotArea.bounds, dragEndInPlotArea)) { [self zoomOut]; } } - else if ( !CGPointEqualToPoint(self.dragStart, self.dragEnd) ) { - // no accidental drag, so zoom in + else if ( !CGPointEqualToPoint(self.dragStart, self.dragEnd)) { +// no accidental drag, so zoom in [self zoomIn]; } - // and we're done with the drag +// and we're done with the drag [self.graph.plotAreaFrame.plotArea removeAnnotation:annotation]; self.zoomAnnotation = nil; @@ -461,7 +461,7 @@ -(BOOL)plotSpace:(nonnull CPTPlotSpace *)space shouldHandlePointingDeviceUpEvent return NO; } --(BOOL)plotSpace:(nonnull CPTPlotSpace *)space shouldHandlePointingDeviceCancelledEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint +-(BOOL)plotSpace:(nonnull CPTPlotSpace *__unused)space shouldHandlePointingDeviceCancelledEvent:(nonnull CPTNativeEvent *__unused)event atPoint:(CGPoint __unused)interactionPoint { CPTPlotSpaceAnnotation *annotation = self.zoomAnnotation; diff --git a/examples/DropPlot/DropPlot.xcodeproj/project.pbxproj b/examples/DropPlot/DropPlot.xcodeproj/project.pbxproj index 727f095dd..43c984131 100644 --- a/examples/DropPlot/DropPlot.xcodeproj/project.pbxproj +++ b/examples/DropPlot/DropPlot.xcodeproj/project.pbxproj @@ -102,26 +102,26 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ - 089C1660FE840EACC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; 1058C7A7FEA54F5311CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; 13E42FBA07B3F13500E4EEF1 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = ""; }; - 1DDD58290DA1D0D100B32029 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/CPTPlotDocument.xib; sourceTree = ""; }; - 1DDD582B0DA1D0D100B32029 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/MainMenu.xib; sourceTree = ""; }; 2A37F4ACFDCFA73011CA2CEA /* CPTPlotDocument.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = CPTPlotDocument.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; 2A37F4AEFDCFA73011CA2CEA /* CPTPlotDocument.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTPlotDocument.h; sourceTree = ""; }; 2A37F4B0FDCFA73011CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; - 2A37F4BAFDCFA73011CA2CEA /* English */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = English; path = English.lproj/Credits.rtf; sourceTree = ""; }; 2A37F4C4FDCFA73011CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; 2A37F4C5FDCFA73011CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; 32DBCF750370BD2300C91783 /* DropPlot_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DropPlot_Prefix.pch; sourceTree = ""; }; - 8D15AC360486D014006FF6A4 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 8D15AC370486D014006FF6A4 /* DropPlot.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DropPlot.app; sourceTree = BUILT_PRODUCTS_DIR; }; BC00E6470FE1BF0A00DE81E0 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; BC93AA7C0FDEFEAC00606226 /* CorePlot.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = CorePlot.xcodeproj; path = ../../framework/CorePlot.xcodeproj; sourceTree = SOURCE_ROOT; }; BC93AAF40FDF3F0200606226 /* NSString+ParseCSV.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+ParseCSV.h"; sourceTree = ""; }; BC93AAF50FDF3F0200606226 /* NSString+ParseCSV.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+ParseCSV.m"; sourceTree = ""; }; + C3564D1722A2D115000A54C9 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = en; path = en.lproj/Credits.rtf; sourceTree = ""; }; + C3564D1822A2D115000A54C9 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; + C37A40A820E0314800C4FF48 /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Base; path = Base.lproj/Info.plist; sourceTree = ""; }; C3D3937719FD705000148319 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = DropPlot/Images.xcassets; sourceTree = ""; }; C3D6210E19DF72E000652CE7 /* CorePlotWarnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = CorePlotWarnings.xcconfig; path = ../../framework/xcconfig/CorePlotWarnings.xcconfig; sourceTree = ""; }; + C3DA082A20E00C3C00F73704 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/CPTPlotDocument.xib; sourceTree = ""; }; + C3DA082B20E00C3C00F73704 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -207,7 +207,7 @@ children = ( C3D3937719FD705000148319 /* Images.xcassets */, 2A37F4B9FDCFA73011CA2CEA /* Credits.rtf */, - 8D15AC360486D014006FF6A4 /* Info.plist */, + C37A40A920E0314800C4FF48 /* Info.plist */, 089C165FFE840EACC02AAC07 /* InfoPlist.strings */, 1DDD58280DA1D0D100B32029 /* CPTPlotDocument.xib */, 1DDD582A0DA1D0D100B32029 /* MainMenu.xib */, @@ -268,17 +268,18 @@ 2A37F4A9FDCFA73011CA2CEA /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0700; + LastUpgradeCheck = 1100; }; buildConfigurationList = C05733CB08A9546B00998B17 /* Build configuration list for PBXProject "DropPlot" */; compatibilityVersion = "Xcode 6.3"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 1; knownRegions = ( - English, - Japanese, - French, - German, + Base, + de, + ja, + fr, + en, ); mainGroup = 2A37F4AAFDCFA73011CA2CEA /* DropPlot */; projectDirPath = ""; @@ -394,7 +395,7 @@ 089C165FFE840EACC02AAC07 /* InfoPlist.strings */ = { isa = PBXVariantGroup; children = ( - 089C1660FE840EACC02AAC07 /* English */, + C3564D1822A2D115000A54C9 /* en */, ); name = InfoPlist.strings; sourceTree = ""; @@ -402,7 +403,7 @@ 1DDD58280DA1D0D100B32029 /* CPTPlotDocument.xib */ = { isa = PBXVariantGroup; children = ( - 1DDD58290DA1D0D100B32029 /* English */, + C3DA082A20E00C3C00F73704 /* Base */, ); name = CPTPlotDocument.xib; sourceTree = ""; @@ -410,7 +411,7 @@ 1DDD582A0DA1D0D100B32029 /* MainMenu.xib */ = { isa = PBXVariantGroup; children = ( - 1DDD582B0DA1D0D100B32029 /* English */, + C3DA082B20E00C3C00F73704 /* Base */, ); name = MainMenu.xib; sourceTree = ""; @@ -418,11 +419,19 @@ 2A37F4B9FDCFA73011CA2CEA /* Credits.rtf */ = { isa = PBXVariantGroup; children = ( - 2A37F4BAFDCFA73011CA2CEA /* English */, + C3564D1722A2D115000A54C9 /* en */, ); name = Credits.rtf; sourceTree = ""; }; + C37A40A920E0314800C4FF48 /* Info.plist */ = { + isa = PBXVariantGroup; + children = ( + C37A40A820E0314800C4FF48 /* Base */, + ); + name = Info.plist; + sourceTree = ""; + }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ @@ -433,14 +442,14 @@ ALWAYS_SEARCH_USER_PATHS = NO; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_OBJC_ARC = YES; + CODE_SIGN_IDENTITY = "-"; COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = DropPlot_Prefix.pch; - INFOPLIST_FILE = Info.plist; + INFOPLIST_FILE = "$(SRCROOT)/Base.lproj/Info.plist"; INSTALL_PATH = "$(HOME)/Applications"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @loader_path/../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "org.CorePlot.${PRODUCT_NAME:identifier}"; @@ -455,13 +464,14 @@ ALWAYS_SEARCH_USER_PATHS = NO; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_OBJC_ARC = YES; + CODE_SIGN_IDENTITY = "-"; COMBINE_HIDPI_IMAGES = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; GCC_MODEL_TUNING = G5; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = DropPlot_Prefix.pch; HEADER_SEARCH_PATHS = ""; - INFOPLIST_FILE = Info.plist; + INFOPLIST_FILE = "$(SRCROOT)/Base.lproj/Info.plist"; INSTALL_PATH = "$(HOME)/Applications"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @loader_path/../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "org.CorePlot.${PRODUCT_NAME:identifier}"; @@ -471,14 +481,14 @@ }; C05733CC08A9546B00998B17 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = C3D6210E19DF72E000652CE7 /* CorePlotWarnings.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = c99; + GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; - GCC_TREAT_WARNINGS_AS_ERRORS = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; MACOSX_DEPLOYMENT_TARGET = 10.8; ONLY_ACTIVE_ARCH = YES; SDKROOT = macosx; @@ -488,10 +498,12 @@ }; C05733CD08A9546B00998B17 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = C3D6210E19DF72E000652CE7 /* CorePlotWarnings.xcconfig */; buildSettings = { + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; GCC_C_LANGUAGE_STANDARD = c99; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = s; MACOSX_DEPLOYMENT_TARGET = 10.8; SDKROOT = macosx; SYMROOT = "$(SRCROOT)/../../build"; diff --git a/examples/DropPlot/DropPlot.xcodeproj/xcshareddata/xcschemes/DropPlot.xcscheme b/examples/DropPlot/DropPlot.xcodeproj/xcshareddata/xcschemes/DropPlot.xcscheme index 2532e3cc2..e0844ecb4 100644 --- a/examples/DropPlot/DropPlot.xcodeproj/xcshareddata/xcschemes/DropPlot.xcscheme +++ b/examples/DropPlot/DropPlot.xcodeproj/xcshareddata/xcschemes/DropPlot.xcscheme @@ -1,6 +1,6 @@ - - - - + + - - - - - - + + - - - - - - + + - - - - - - endDate - 2009-06-19T06:53:47Z - financialData - - - adjClose - 135.88 - close - 135.88 - date - 2009-06-18T04:00:00Z - high - 138 - low - 135.59 - open - 136.11 - volume - 15237600 - - - adjClose - 135.58 - close - 135.58 - date - 2009-06-17T04:00:00Z - high - 137.45 - low - 134.53 - open - 136.67 - volume - 20377100 - - - adjClose - 136.35 - close - 136.35 - date - 2009-06-16T04:00:00Z - high - 138.47 - low - 136.1 - open - 136.66 - volume - 18255100 - - - adjClose - 136.09 - close - 136.09 - date - 2009-06-15T04:00:00Z - high - 136.93 - low - 134.89 - open - 136.01 - volume - 19276800 - - - adjClose - 136.97 - close - 136.97 - date - 2009-06-12T04:00:00Z - high - 139.1 - low - 136.04 - open - 138.81 - volume - 20098500 - - - adjClose - 139.95 - close - 139.95 - date - 2009-06-11T04:00:00Z - high - 141.56 - low - 138.55 - open - 139.55 - volume - 18719300 - - - adjClose - 140.25 - close - 140.25 - date - 2009-06-10T04:00:00Z - high - 142.35 - low - 138.3 - open - 142.28 - volume - 24593700 - - - adjClose - 142.72 - close - 142.72 - date - 2009-06-09T04:00:00Z - high - 144.56 - low - 140.55 - open - 143.81 - volume - 24152500 - - - adjClose - 143.85 - close - 143.85 - date - 2009-06-08T04:00:00Z - high - 144.23 - low - 139.43 - open - 143.82 - volume - 33255400 - - - adjClose - 144.67 - close - 144.67 - date - 2009-06-05T04:00:00Z - high - 146.4 - low - 143.21 - open - 145.31 - volume - 22585700 - - - adjClose - 143.74 - close - 143.74 - date - 2009-06-04T04:00:00Z - high - 144.18 - low - 140.04 - open - 140.13 - volume - 19537200 - - - adjClose - 140.95 - close - 140.95 - date - 2009-06-03T04:00:00Z - high - 141.11 - low - 139.07 - open - 140 - volume - 20171800 - - - adjClose - 139.49 - close - 139.49 - date - 2009-06-02T04:00:00Z - high - 141.34 - low - 138.35 - open - 138.99 - volume - 16199500 - - - adjClose - 139.35 - close - 139.35 - date - 2009-06-01T04:00:00Z - high - 139.99 - low - 136 - open - 136.47 - volume - 16160700 - - - adjClose - 135.81 - close - 135.81 - date - 2009-05-29T04:00:00Z - high - 135.9 - low - 133.85 - open - 135.39 - volume - 16304800 - - - adjClose - 135.07 - close - 135.07 - date - 2009-05-28T04:00:00Z - high - 135.39 - low - 132.03 - open - 133.45 - volume - 17397200 - - - adjClose - 133.05 - close - 133.05 - date - 2009-05-27T04:00:00Z - high - 134.98 - low - 130.91 - open - 131.78 - volume - 23086500 - - - adjClose - 130.78 - close - 130.78 - date - 2009-05-26T04:00:00Z - high - 130.83 - low - 124.55 - open - 124.76 - volume - 22692300 - - - adjClose - 122.5 - close - 122.5 - date - 2009-05-22T04:00:00Z - high - 124.18 - low - 121.75 - open - 124.05 - volume - 10642800 - - - adjClose - 124.18 - close - 124.18 - date - 2009-05-21T04:00:00Z - high - 126.78 - low - 122.89 - open - 125.15 - volume - 14569500 - - - adjClose - 125.87 - close - 125.87 - date - 2009-05-20T04:00:00Z - high - 129.21 - low - 125.3 - open - 127.63 - volume - 13878000 - - - adjClose - 127.45 - close - 127.45 - date - 2009-05-19T04:00:00Z - high - 129.31 - low - 125.74 - open - 126.82 - volume - 13300800 - - - adjClose - 126.65 - close - 126.65 - date - 2009-05-18T04:00:00Z - high - 126.7 - low - 121.57 - open - 123.73 - volume - 16387200 - - - adjClose - 122.42 - close - 122.42 - date - 2009-05-15T04:00:00Z - high - 124.62 - low - 121.61 - open - 122.32 - volume - 13127400 - - - adjClose - 122.95 - close - 122.95 - date - 2009-05-14T04:00:00Z - high - 123.53 - low - 119.7 - open - 119.78 - volume - 15993800 - - - adjClose - 119.49 - close - 119.49 - date - 2009-05-13T04:00:00Z - high - 124.02 - low - 119.38 - open - 123.21 - volume - 21284700 - - - adjClose - 124.42 - close - 124.42 - date - 2009-05-12T04:00:00Z - high - 129.71 - low - 123.25 - open - 129.56 - volume - 21767200 - - - adjClose - 129.57 - close - 129.57 - date - 2009-05-11T04:00:00Z - high - 130.96 - low - 127.12 - open - 127.37 - volume - 14452100 - - - adjClose - 129.19 - close - 129.19 - date - 2009-05-08T04:00:00Z - high - 131.23 - low - 126.26 - open - 129.04 - volume - 16713000 - - - adjClose - 129.06 - close - 129.06 - date - 2009-05-07T04:00:00Z - high - 132.39 - low - 127.9 - open - 132.33 - volume - 18992000 - - - adjClose - 132.5 - close - 132.5 - date - 2009-05-06T04:00:00Z - high - 133.5 - low - 130.22 - open - 133.33 - volume - 16912100 - - - adjClose - 132.71 - close - 132.71 - date - 2009-05-05T04:00:00Z - high - 132.86 - low - 131.12 - open - 131.75 - volume - 14223400 - - - adjClose - 132.07 - close - 132.07 - date - 2009-05-04T04:00:00Z - high - 132.25 - low - 127.68 - open - 128.24 - volume - 21762800 - - - adjClose - 127.24 - close - 127.24 - date - 2009-05-01T04:00:00Z - high - 127.95 - low - 125.8 - open - 125.8 - volume - 14197000 - - - adjClose - 125.83 - close - 125.83 - date - 2009-04-30T04:00:00Z - high - 127 - low - 124.92 - open - 126.22 - volume - 17803200 - - - adjClose - 125.14 - close - 125.14 - date - 2009-04-29T04:00:00Z - high - 126.85 - low - 123.83 - open - 124.85 - volume - 16361100 - - - adjClose - 123.9 - close - 123.9 - date - 2009-04-28T04:00:00Z - high - 126.21 - low - 123.26 - open - 123.35 - volume - 16280600 - - - adjClose - 124.73 - close - 124.73 - date - 2009-04-27T04:00:00Z - high - 125 - low - 122.66 - open - 122.9 - volume - 17167500 - - - adjClose - 123.9 - close - 123.9 - date - 2009-04-24T04:00:00Z - high - 125.14 - low - 122.97 - open - 124.64 - volume - 19313000 - - - adjClose - 125.4 - close - 125.4 - date - 2009-04-23T04:00:00Z - high - 127.2 - low - 123.51 - open - 126.62 - volume - 33755600 - - - adjClose - 121.51 - close - 121.51 - date - 2009-04-22T04:00:00Z - high - 125.35 - low - 121.2 - open - 122.63 - volume - 33527400 - - - adjClose - 121.76 - close - 121.76 - date - 2009-04-21T04:00:00Z - high - 122.14 - low - 118.6 - open - 118.89 - volume - 16810200 - - - adjClose - 120.5 - close - 120.5 - date - 2009-04-20T04:00:00Z - high - 122.99 - low - 119.16 - open - 121.73 - volume - 16659500 - - - adjClose - 123.42 - close - 123.42 - date - 2009-04-17T04:00:00Z - high - 124.25 - low - 120.25 - open - 121.18 - volume - 17767700 - - - adjClose - 121.45 - close - 121.45 - date - 2009-04-16T04:00:00Z - high - 123.15 - low - 118.79 - open - 119.19 - volume - 21194500 - - - adjClose - 117.64 - close - 117.64 - date - 2009-04-15T04:00:00Z - high - 118.25 - low - 115.76 - open - 117.2 - volume - 14745800 - - - adjClose - 118.31 - close - 118.31 - date - 2009-04-14T04:00:00Z - high - 120.17 - low - 117.25 - open - 119.57 - volume - 16236500 - - - adjClose - 120.22 - close - 120.22 - date - 2009-04-13T04:00:00Z - high - 120.98 - low - 119 - open - 120.01 - volume - 13901300 - - - adjClose - 119.57 - close - 119.57 - date - 2009-04-09T04:00:00Z - high - 120 - low - 117.96 - open - 118.42 - volume - 18955600 - - - adjClose - 116.32 - close - 116.32 - date - 2009-04-08T04:00:00Z - high - 116.79 - low - 114.58 - open - 115.43 - volume - 16272500 - - - adjClose - 115 - close - 115 - date - 2009-04-07T04:00:00Z - high - 116.67 - low - 114.19 - open - 116.53 - volume - 19163600 - - - adjClose - 118.45 - close - 118.45 - date - 2009-04-06T04:00:00Z - high - 118.75 - low - 113.28 - open - 114.94 - volume - 23502300 - - - adjClose - 115.99 - close - 115.99 - date - 2009-04-03T04:00:00Z - high - 116.13 - low - 113.52 - open - 114.19 - volume - 22722900 - - - adjClose - 112.71 - close - 112.71 - date - 2009-04-02T04:00:00Z - high - 114.75 - low - 109.78 - open - 110.14 - volume - 29013100 - - - adjClose - 108.69 - close - 108.69 - date - 2009-04-01T04:00:00Z - high - 109 - low - 103.89 - open - 104.09 - volume - 21049000 - - - adjClose - 105.12 - close - 105.12 - date - 2009-03-31T04:00:00Z - high - 107.45 - low - 105 - open - 105.45 - volume - 20338500 - - - adjClose - 104.49 - close - 104.49 - date - 2009-03-30T04:00:00Z - high - 105.01 - low - 102.61 - open - 104.51 - volume - 17957000 - - - adjClose - 106.85 - close - 106.85 - date - 2009-03-27T04:00:00Z - high - 108.53 - low - 106.4 - open - 108.23 - volume - 17602600 - - - adjClose - 109.87 - close - 109.87 - date - 2009-03-26T04:00:00Z - high - 109.98 - low - 107.58 - open - 107.83 - volume - 22009000 - - - adjClose - 106.49 - close - 106.49 - date - 2009-03-25T04:00:00Z - high - 108.36 - low - 103.86 - open - 107.58 - volume - 23093500 - - - adjClose - 106.5 - close - 106.5 - date - 2009-03-24T04:00:00Z - high - 109.44 - low - 105.39 - open - 106.36 - volume - 22879000 - - - adjClose - 107.66 - close - 107.66 - date - 2009-03-23T04:00:00Z - high - 108.16 - low - 101.75 - open - 102.71 - volume - 23799900 - - - adjClose - 101.59 - close - 101.59 - date - 2009-03-20T04:00:00Z - high - 103.11 - low - 100.57 - open - 102.09 - volume - 24842400 - - - adjClose - 101.62 - close - 101.62 - date - 2009-03-19T04:00:00Z - high - 103.2 - low - 100.25 - open - 101.85 - volume - 17863600 - - - adjClose - 101.52 - close - 101.52 - date - 2009-03-18T04:00:00Z - high - 103.48 - low - 99.72 - open - 99.91 - volume - 28429900 - - - adjClose - 99.66 - close - 99.66 - date - 2009-03-17T04:00:00Z - high - 99.69 - low - 95.07000000000001 - open - 95.23999999999999 - volume - 28094500 - - - adjClose - 95.42 - close - 95.42 - date - 2009-03-16T04:00:00Z - high - 97.39 - low - 94.17999999999999 - open - 96.53 - volume - 28473000 - - - adjClose - 95.92999999999999 - close - 95.92999999999999 - date - 2009-03-13T04:00:00Z - high - 97.2 - low - 95.01000000000001 - open - 96.3 - volume - 21470300 - - - overallHigh - 146.4 - overallLow - 94.17999999999999 - startDate - 2009-03-13T06:53:47Z - symbol - AAPL - - diff --git a/examples/StockPlot/Classes/APYahooDataPuller.h b/examples/StockPlot/Classes/APYahooDataPuller.h deleted file mode 100644 index 5c1ed8268..000000000 --- a/examples/StockPlot/Classes/APYahooDataPuller.h +++ /dev/null @@ -1,37 +0,0 @@ -#import "NSDictionary+APFinancialData.h" - -@class APYahooDataPuller; - -typedef NSArray CPTFinancialDataArray; - -@protocol APYahooDataPullerDelegate - -@optional - --(void)dataPullerFinancialDataDidChange:(nonnull APYahooDataPuller *)dp; --(void)dataPuller:(nonnull APYahooDataPuller *)dp downloadDidFailWithError:(nonnull NSError *)error; - -@end - -#pragma mark - - -@interface APYahooDataPuller : NSObject - -@property (nonatomic, readwrite, weak, nullable) id delegate; -@property (nonatomic, readwrite, copy, nonnull) NSString *symbol; -@property (nonatomic, readwrite, strong, nonnull) NSDate *startDate; -@property (nonatomic, readwrite, strong, nonnull) NSDate *endDate; -@property (nonatomic, readwrite, copy, nonnull) NSString *targetSymbol; -@property (nonatomic, readwrite, strong, nonnull) NSDate *targetStartDate; -@property (nonatomic, readwrite, strong, nonnull) NSDate *targetEndDate; -@property (nonatomic, readonly, strong, nonnull) CPTFinancialDataArray *financialData; -@property (nonatomic, readonly, strong, nonnull) NSDecimalNumber *overallHigh; -@property (nonatomic, readonly, strong, nonnull) NSDecimalNumber *overallLow; -@property (nonatomic, readonly, assign) BOOL loadingData; -@property (nonatomic, readonly, assign) BOOL staleData; - --(nonnull instancetype)initWithTargetSymbol:(nonnull NSString *)aSymbol targetStartDate:(nonnull NSDate *)aStartDate targetEndDate:(nonnull NSDate *)anEndDate; --(void)fetchIfNeeded; --(void)cancelDownload; - -@end diff --git a/examples/StockPlot/Classes/APYahooDataPuller.m b/examples/StockPlot/Classes/APYahooDataPuller.m deleted file mode 100644 index ce857b1d5..000000000 --- a/examples/StockPlot/Classes/APYahooDataPuller.m +++ /dev/null @@ -1,395 +0,0 @@ -#import "APYahooDataPuller.h" -#import "NSDictionary+APFinancialData.h" - -@interface APYahooDataPuller() - -@property (nonatomic, readwrite, copy, nonnull) NSString *csvString; - -@property (nonatomic, readwrite, strong, nonnull) NSDecimalNumber *overallHigh; -@property (nonatomic, readwrite, strong, nonnull) NSDecimalNumber *overallLow; -@property (nonatomic, readwrite, strong, nonnull) CPTFinancialDataArray *financialData; - -@property (nonatomic, readwrite, assign) BOOL loadingData; -@property (nonatomic, readwrite, strong, nullable) NSMutableData *receivedData; -@property (nonatomic, readwrite, strong, nullable) NSURLConnection *connection; - -NSTimeInterval timeIntervalForNumberOfWeeks(double numberOfWeeks); - --(nonnull CPTDictionary *)sanitizedFinancialLine:(nonnull CPTDictionary *)theFinancialLine; - --(nonnull instancetype)initWithDictionary:(nonnull CPTDictionary *)aDict targetSymbol:(nonnull NSString *)aSymbol targetStartDate:(nonnull NSDate *)aStartDate targetEndDate:(nonnull NSDate *)anEndDate; - --(nonnull CPTDictionary *)plistRep; --(BOOL)writeToFile:(nonnull NSString *)path atomically:(BOOL)flag; --(nonnull NSString *)URL; --(nonnull NSString *)pathForSymbol:(nonnull NSString *)aSymbol; --(nonnull NSString *)faultTolerantPathForSymbol:(nonnull NSString *)aSymbol; --(nonnull CPTDictionary *)dictionaryForSymbol:(nonnull NSString *)aSymbol; - -@end - -#pragma mark - - -NSTimeInterval timeIntervalForNumberOfWeeks(double numberOfWeeks) -{ - NSTimeInterval seconds = fabs(60.0 * 60.0 * 24.0 * 7.0 * numberOfWeeks); - - return seconds; -} - -@implementation APYahooDataPuller - -@synthesize symbol; -@synthesize startDate; -@synthesize endDate; -@synthesize targetStartDate; -@synthesize targetEndDate; -@synthesize targetSymbol; -@synthesize overallLow; -@synthesize overallHigh; -@synthesize csvString; -@synthesize financialData; - -@synthesize receivedData; -@synthesize connection; -@synthesize loadingData; -@dynamic staleData; - -@synthesize delegate; - -// convert any NSNumber in financial line to NSDecimalNumber --(nonnull CPTDictionary *)sanitizedFinancialLine:(nonnull CPTDictionary *)theFinancialLine -{ - CPTMutableDictionary *aFinancialLine = [NSMutableDictionary dictionaryWithDictionary:theFinancialLine]; - - for ( id key in aFinancialLine.allKeys ) { - id something = aFinancialLine[key]; - if ( [something respondsToSelector:@selector(decimalValue)] ) { - something = [NSDecimalNumber decimalNumberWithDecimal:( (NSNumber *)something ).decimalValue]; - aFinancialLine[key] = something; - } - } - return [NSDictionary dictionaryWithDictionary:aFinancialLine]; -} - --(void)setFinancialData:(nonnull NSArray *)aFinancialData -{ - // NSLog(@"in -setFinancialData:, old value of financialData: %@, changed to: %@", financialData, aFinancialData); - - if ( financialData != aFinancialData ) { - NSMutableArray *mutableFinancialData = [aFinancialData mutableCopy]; - CPTDictionary *financialLine = nil; - - NSUInteger count = mutableFinancialData.count; - - for ( NSUInteger i = 0; i < count; i++ ) { - financialLine = (CPTDictionary *)mutableFinancialData[i]; - financialLine = [self sanitizedFinancialLine:financialLine]; - mutableFinancialData[i] = financialLine; - } - - financialData = [[NSArray alloc] initWithArray:mutableFinancialData]; - if ( 0 < financialData.count ) { - [self notifyFinancesChanged]; - } - } -} - --(nonnull CPTDictionary *)plistRep -{ - CPTMutableDictionary *rep = [NSMutableDictionary dictionaryWithCapacity:7]; - - rep[@"symbol"] = self.symbol; - rep[@"startDate"] = self.startDate; - rep[@"endDate"] = self.endDate; - rep[@"overallHigh"] = self.overallHigh; - rep[@"overallLow"] = self.overallLow; - rep[@"financialData"] = self.financialData; - - return [NSDictionary dictionaryWithDictionary:rep]; -} - --(BOOL)writeToFile:(nonnull NSString *)path atomically:(BOOL)flag -{ - NSLog(@"writeToFile:%@", path); - BOOL success = [[self plistRep] writeToFile:path atomically:flag]; - return success; -} - --(nonnull instancetype)initWithDictionary:(nonnull CPTDictionary *)aDict targetSymbol:(nonnull NSString *)aSymbol targetStartDate:(nonnull NSDate *)aStartDate targetEndDate:(nonnull NSDate *)anEndDate -{ - self = [super init]; - if ( self != nil ) { - NSString *theSymbol = aDict[@"symbol"]; - self.symbol = theSymbol ? theSymbol : @""; - NSDate *theStartDate = aDict[@"startDate"]; - self.startDate = theStartDate ? theStartDate : [NSDate date]; - NSDate *theEndDate = aDict[@"endDate"]; - self.endDate = theEndDate ? theEndDate : [NSDate date]; - NSNumber *low = aDict[@"overallLow"]; - self.overallLow = low ? [NSDecimalNumber decimalNumberWithDecimal:low.decimalValue] : [NSDecimalNumber notANumber]; - NSNumber *high = aDict[@"overallHigh"]; - self.overallHigh = high ? [NSDecimalNumber decimalNumberWithDecimal:high.decimalValue] : [NSDecimalNumber notANumber]; - CPTFinancialDataArray *dataArray = aDict[@"financialData"]; - self.financialData = dataArray ? dataArray : [[NSArray alloc] init]; - - self.targetSymbol = aSymbol; - self.targetStartDate = aStartDate; - self.targetEndDate = anEndDate; - - self.csvString = @""; - } - return self; -} - --(nonnull NSString *)pathForSymbol:(nonnull NSString *)aSymbol -{ - CPTStringArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); - NSString *documentsDirectory = paths[0]; - NSString *docPath = [documentsDirectory stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.plist", aSymbol]]; - - return docPath; -} - --(nonnull NSString *)faultTolerantPathForSymbol:(nonnull NSString *)aSymbol -{ - NSString *docPath = [self pathForSymbol:aSymbol]; - - if ( ![[NSFileManager defaultManager] fileExistsAtPath:docPath] ) { - // if there isn't one in the user's documents directory, see if we ship with this data - docPath = [[NSBundle mainBundle].resourcePath stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.plist", aSymbol]]; - } - return docPath; -} - -// Always returns *something* --(nonnull CPTDictionary *)dictionaryForSymbol:(nonnull NSString *)aSymbol -{ - NSString *path = [self faultTolerantPathForSymbol:aSymbol]; - - CPTMutableDictionary *localPlistDict = [NSMutableDictionary dictionaryWithContentsOfFile:path]; - - return localPlistDict; -} - --(nonnull instancetype)initWithTargetSymbol:(nonnull NSString *)aSymbol targetStartDate:(nonnull NSDate *)aStartDate targetEndDate:(nonnull NSDate *)anEndDate -{ - CPTDictionary *cachedDictionary = [self dictionaryForSymbol:aSymbol]; - - if ( nil != cachedDictionary ) { - return [self initWithDictionary:cachedDictionary targetSymbol:aSymbol targetStartDate:aStartDate targetEndDate:anEndDate]; - } - - CPTMutableDictionary *rep = [NSMutableDictionary dictionaryWithCapacity:7]; - rep[@"symbol"] = aSymbol; - rep[@"startDate"] = aStartDate; - rep[@"endDate"] = anEndDate; - rep[@"overallHigh"] = [NSDecimalNumber notANumber]; - rep[@"overallLow"] = [NSDecimalNumber notANumber]; - rep[@"financialData"] = @[]; - - return [self initWithDictionary:rep targetSymbol:aSymbol targetStartDate:aStartDate targetEndDate:anEndDate]; -} - --(nonnull instancetype)init -{ - NSTimeInterval secondsAgo = -timeIntervalForNumberOfWeeks(14.0); // 12 weeks ago - NSDate *start = [NSDate dateWithTimeIntervalSinceNow:secondsAgo]; - - NSDate *end = [NSDate date]; - - return [self initWithTargetSymbol:@"AAPL" targetStartDate:start targetEndDate:end]; -} - --(void)dealloc -{ - delegate = nil; -} - -// http://www.goldb.org/ystockquote.html --(nonnull NSString *)URL -{ - NSUInteger unitFlags = NSCalendarUnitMonth | NSCalendarUnitDay | NSCalendarUnitYear; - - NSCalendar *gregorian = [[NSCalendar alloc] - initWithCalendarIdentifier:NSCalendarIdentifierGregorian]; - - NSString *url = [NSString stringWithFormat:@"https://ichart.yahoo.com/table.csv?s=%@&", self.targetSymbol]; - - NSDate *tStartDate = self.targetStartDate; - - if ( tStartDate ) { - NSDateComponents *compsStart = [gregorian components:unitFlags fromDate:tStartDate]; - - url = [url stringByAppendingFormat:@"a=%ld&", (long)compsStart.month - 1]; - url = [url stringByAppendingFormat:@"b=%ld&", (long)compsStart.day]; - url = [url stringByAppendingFormat:@"c=%ld&", (long)compsStart.year]; - } - - NSDate *tEndDate = self.targetEndDate; - if ( tEndDate ) { - NSDateComponents *compsEnd = [gregorian components:unitFlags fromDate:tEndDate]; - - url = [url stringByAppendingFormat:@"d=%ld&", (long)compsEnd.month - 1]; - url = [url stringByAppendingFormat:@"e=%ld&", (long)compsEnd.day]; - url = [url stringByAppendingFormat:@"f=%ld&", (long)compsEnd.year]; - } - - url = [url stringByAppendingString:@"g=d&"]; - - url = [url stringByAppendingString:@"ignore=.csv"]; - url = [url stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; - - return url; -} - --(void)notifyFinancesChanged -{ - id theDelegate = self.delegate; - - if ( [theDelegate respondsToSelector:@selector(dataPullerFinancialDataDidChange:)] ) { - [theDelegate performSelector:@selector(dataPullerFinancialDataDidChange:) withObject:self]; - } -} - -#pragma mark - -#pragma mark Downloading of data - --(BOOL)staleData -{ - NSTimeInterval twelveHours = 60.0 * 60.0 * 12.0; - - return 0 >= self.financialData.count || - ![self.targetSymbol isEqualToString:self.symbol] || - [self.targetStartDate timeIntervalSinceDate:self.startDate] > twelveHours || - [self.targetEndDate timeIntervalSinceDate:self.endDate] > twelveHours; -} - --(void)fetchIfNeeded -{ - if ( self.loadingData ) { - return; - } - - // Check to see if cached data is stale - if ( self.staleData ) { - self.loadingData = YES; - NSString *urlString = [self URL]; - NSLog(@"Fetching URL %@", urlString); - NSURL *url = [NSURL URLWithString:urlString]; - NSURLRequest *theRequest = [NSURLRequest requestWithURL:url - cachePolicy:NSURLRequestUseProtocolCachePolicy - timeoutInterval:60.0]; - - // create the connection with the request - // and start loading the data - self.connection = [NSURLConnection connectionWithRequest:theRequest delegate:self]; - if ( self.connection ) { - self.receivedData = [NSMutableData data]; - } - else { - self.loadingData = NO; - } - } -} - --(void)connection:(nonnull NSURLConnection *)connection didReceiveData:(nonnull NSData *)data -{ - // append the new data to the receivedData - [self.receivedData appendData:data]; -} - --(void)connection:(nonnull NSURLConnection *)connection didReceiveResponse:(nonnull NSURLResponse *)response -{ - // this method is called when the server has determined that it - // has enough information to create the NSURLResponse - // it can be called multiple times, for example in the case of a - // redirect, so each time we reset the data. - self.receivedData.length = 0; -} - --(void)cancelDownload -{ - if ( self.loadingData ) { - [self.connection cancel]; - self.loadingData = NO; - - self.receivedData = nil; - self.connection = nil; - } -} - --(void)connection:(nonnull NSURLConnection *)connection didFailWithError:(nonnull NSError *)error -{ - self.loadingData = NO; - self.receivedData = nil; - self.connection = nil; - NSLog(@"err = %@", error.localizedDescription); - self.connection = nil; - - id theDelegate = self.delegate; - if ( [theDelegate respondsToSelector:@selector(dataPuller:downloadDidFailWithError:)] ) { - [theDelegate performSelector:@selector(dataPuller:downloadDidFailWithError:) withObject:self withObject:error]; - } -} - --(void)connectionDidFinishLoading:(nonnull NSURLConnection *)connection -{ - self.loadingData = NO; - self.connection = nil; - - NSMutableData *data = self.receivedData; - if ( data ) { - NSString *csv = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; - [self populateWithString:csv]; - } - else { - [self populateWithString:@""]; - } - - self.receivedData = nil; - [self writeToFile:[self pathForSymbol:self.symbol] atomically:YES]; -} - --(void)populateWithString:(NSString *)csv -{ - CPTStringArray *csvLines = [csv componentsSeparatedByCharactersInSet:[NSCharacterSet newlineCharacterSet]]; - - NSMutableArray *newFinancials = [NSMutableArray arrayWithCapacity:csvLines.count]; - NSDictionary *currentFinancial = nil; - NSString *line = nil; - - self.overallHigh = [NSDecimalNumber notANumber]; - self.overallLow = [NSDecimalNumber notANumber]; - - for ( NSUInteger i = 1; i < csvLines.count - 1; i++ ) { - line = (NSString *)csvLines[i]; - currentFinancial = [NSDictionary dictionaryWithCSVLine:line]; - [newFinancials addObject:currentFinancial]; - - NSDecimalNumber *high = currentFinancial[@"high"]; - NSDecimalNumber *low = currentFinancial[@"low"]; - - if ( [self.overallHigh isEqual:[NSDecimalNumber notANumber]] ) { - self.overallHigh = high; - } - - if ( [self.overallLow isEqual:[NSDecimalNumber notANumber]] ) { - self.overallLow = low; - } - - if ( [low compare:self.overallLow] == NSOrderedAscending ) { - self.overallLow = low; - } - if ( [high compare:self.overallHigh] == NSOrderedDescending ) { - self.overallHigh = high; - } - } - self.startDate = self.targetStartDate; - self.endDate = self.targetEndDate; - self.symbol = self.targetSymbol; - - self.financialData = [NSArray arrayWithArray:newFinancials]; -} - -@end diff --git a/examples/StockPlot/Classes/APYahooDataPullerGraph.h b/examples/StockPlot/Classes/APYahooDataPullerGraph.h deleted file mode 100644 index 7e4f72c24..000000000 --- a/examples/StockPlot/Classes/APYahooDataPullerGraph.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// APYahooDataPullerGraph.h -// StockPlot -// -// Created by Jonathan Saggau on 6/19/09. -// Copyright 2009 __MyCompanyName__. All rights reserved. -// - -#import "APYahooDataPuller.h" -#import "CorePlot-CocoaTouch.h" -#import - -@interface APYahooDataPullerGraph : UIViewController - -@property (nonatomic, strong, nullable) IBOutlet CPTGraphHostingView *graphHost; -@property (nonatomic, strong, nonnull) APYahooDataPuller *dataPuller; - -@end diff --git a/examples/StockPlot/Classes/APYahooDataPullerGraph.m b/examples/StockPlot/Classes/APYahooDataPullerGraph.m deleted file mode 100644 index 3b056904d..000000000 --- a/examples/StockPlot/Classes/APYahooDataPullerGraph.m +++ /dev/null @@ -1,170 +0,0 @@ -// -// APYahooDataPullerGraph.m -// StockPlot -// -// Created by Jonathan Saggau on 6/19/09. -// Copyright 2009 __MyCompanyName__. All rights reserved. -// - -#import "APYahooDataPullerGraph.h" - -@interface APYahooDataPullerGraph() - -@property (nonatomic, readwrite, strong) CPTXYGraph *graph; - -@end - -#pragma mark - - -@implementation APYahooDataPullerGraph - -@synthesize graphHost; -@synthesize dataPuller; -@synthesize graph; - --(void)reloadData -{ - if ( !self.graph ) { - CPTXYGraph *newGraph = [[CPTXYGraph alloc] initWithFrame:CGRectZero]; - CPTTheme *theme = [CPTTheme themeNamed:kCPTDarkGradientTheme]; - [newGraph applyTheme:theme]; - self.graph = newGraph; - - newGraph.paddingTop = 30.0; - newGraph.paddingBottom = 30.0; - newGraph.paddingLeft = 50.0; - newGraph.paddingRight = 50.0; - - CPTScatterPlot *dataSourceLinePlot = [[CPTScatterPlot alloc] initWithFrame:newGraph.bounds]; - dataSourceLinePlot.identifier = @"Data Source Plot"; - - CPTMutableLineStyle *lineStyle = [dataSourceLinePlot.dataLineStyle mutableCopy]; - lineStyle.lineWidth = 1.0; - lineStyle.lineColor = [CPTColor redColor]; - dataSourceLinePlot.dataLineStyle = lineStyle; - - dataSourceLinePlot.dataSource = self; - [newGraph addPlot:dataSourceLinePlot]; - } - - CPTXYGraph *theGraph = self.graph; - self.graphHost.hostedGraph = theGraph; - - CPTXYPlotSpace *plotSpace = (CPTXYPlotSpace *)theGraph.defaultPlotSpace; - - NSDecimalNumber *high = self.dataPuller.overallHigh; - NSDecimalNumber *low = self.dataPuller.overallLow; - NSDecimalNumber *length = [high decimalNumberBySubtracting:low]; - - // NSLog(@"high = %@, low = %@, length = %@", high, low, length); - plotSpace.xRange = [CPTPlotRange plotRangeWithLocation:@0.0 length:@(self.dataPuller.financialData.count)]; - plotSpace.yRange = [CPTPlotRange plotRangeWithLocation:low length:length]; - // Axes - CPTXYAxisSet *axisSet = (CPTXYAxisSet *)theGraph.axisSet; - - CPTXYAxis *x = axisSet.xAxis; - x.majorIntervalLength = @10.0; - x.orthogonalPosition = @0.0; - x.minorTicksPerInterval = 1; - - CPTXYAxis *y = axisSet.yAxis; - NSDecimal six = CPTDecimalFromInteger(6); - y.majorIntervalLength = [NSDecimalNumber decimalNumberWithDecimal:CPTDecimalDivide(length.decimalValue, six)]; - y.majorTickLineStyle = nil; - y.minorTicksPerInterval = 4; - y.minorTickLineStyle = nil; - y.orthogonalPosition = @0.0; - y.alternatingBandFills = @[[[CPTColor whiteColor] colorWithAlphaComponent:CPTFloat(0.1)], [NSNull null]]; - - [theGraph reloadData]; - - self.navigationItem.title = self.dataPuller.symbol; -} - --(void)viewWillAppear:(BOOL)animated -{ - [super viewWillAppear:animated]; -} - -// Implement viewDidLoad to do additional setup after loading the view, typically from a nib. --(void)viewDidLoad -{ - [super viewDidLoad]; - [self reloadData]; -} - --(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration -{ - // NSLog(@"willRotateToInterfaceOrientation"); -} - --(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation -{ - // NSLog(@"didRotateFromInterfaceOrientation"); -} - --(void)didReceiveMemoryWarning -{ - // Releases the view if it doesn't have a superview. - [super didReceiveMemoryWarning]; - - // Release any cached data, images, etc that aren't in use. -} - -#pragma mark - -#pragma mark Plot Data Source Methods - --(NSUInteger)numberOfRecords -{ - return self.dataPuller.financialData.count; -} - --(nullable id)numberForPlot:(nonnull CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index -{ - NSNumber *num = @0; - - if ( fieldEnum == CPTScatterPlotFieldX ) { - num = @(index + 1); - } - else if ( fieldEnum == CPTScatterPlotFieldY ) { - CPTFinancialDataArray *financialData = self.dataPuller.financialData; - - CPTDictionary *fData = financialData[financialData.count - index - 1]; - num = fData[@"close"]; - NSAssert([num isMemberOfClass:[NSDecimalNumber class]], @"grrr"); - } - - return num; -} - --(void)dataPullerFinancialDataDidChange:(nonnull APYahooDataPuller *)dp -{ - [self reloadData]; -} - -#pragma mark accessors - --(void)setDataPuller:(nonnull APYahooDataPuller *)aDataPuller -{ - // NSLog(@"in -setDataPuller:, old value of dataPuller: %@, changed to: %@", dataPuller, aDataPuller); - - if ( dataPuller != aDataPuller ) { - dataPuller = aDataPuller; - dataPuller.delegate = self; - [self reloadData]; - } -} - --(void)dealloc -{ - if ( dataPuller.delegate == self ) { - [dataPuller setDelegate:nil]; - } -} - --(NSUInteger)numberOfRecordsForPlot:(nonnull CPTPlot *)plot -{ - return [self numberOfRecords]; -} - -@end diff --git a/examples/StockPlot/Classes/APYahooDataPullerGraph.xib b/examples/StockPlot/Classes/APYahooDataPullerGraph.xib deleted file mode 100644 index 979259557..000000000 --- a/examples/StockPlot/Classes/APYahooDataPullerGraph.xib +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/StockPlot/Classes/NSDictionary+APFinancialData.h b/examples/StockPlot/Classes/NSDictionary+APFinancialData.h deleted file mode 100644 index 33e36b158..000000000 --- a/examples/StockPlot/Classes/NSDictionary+APFinancialData.h +++ /dev/null @@ -1,7 +0,0 @@ -#import "CorePlot-CocoaTouch.h" - -@interface NSDictionary(APFinancialData) - -+(nonnull CPTDictionary *)dictionaryWithCSVLine:(nonnull NSString *)csvLine; - -@end diff --git a/examples/StockPlot/Classes/NSDictionary+APFinancialData.m b/examples/StockPlot/Classes/NSDictionary+APFinancialData.m deleted file mode 100644 index 9e30fe133..000000000 --- a/examples/StockPlot/Classes/NSDictionary+APFinancialData.m +++ /dev/null @@ -1,60 +0,0 @@ -#import "NSDictionary+APFinancialData.h" - -@interface NSDateFormatter(yahooCSVDateFormatter) - -+(nonnull NSDateFormatter *)yahooCSVDateFormatter; - -@end - -#pragma mark - - -@implementation NSDateFormatter(yahooCSVDateFormatter) - -+(nonnull NSDateFormatter *)yahooCSVDateFormatter -{ - static NSDateFormatter *df = nil; - static dispatch_once_t onceToken = 0; - - dispatch_once(&onceToken, ^{ - df = [[NSDateFormatter alloc] init]; - df.dateFormat = @"yyyy-MM-dd"; - }); - - return df; -} - -@end - -#pragma mark - - -@implementation NSDictionary(APFinancialData) - -+(nonnull CPTDictionary *)dictionaryWithCSVLine:(nonnull NSString *)csvLine -{ - CPTStringArray *csvChunks = [csvLine componentsSeparatedByString:@","]; - - CPTMutableDictionary *csvDict = [NSMutableDictionary dictionaryWithCapacity:7]; - - // Date,Open,High,Low,Close,Volume,Adj Close - // 2009-06-08,143.82,144.23,139.43,143.85,33255400,143.85 - NSDate *theDate = [[NSDateFormatter yahooCSVDateFormatter] dateFromString:csvChunks[0]]; - - csvDict[@"date"] = theDate; - NSDecimalNumber *theOpen = [NSDecimalNumber decimalNumberWithString:csvChunks[1]]; - csvDict[@"open"] = theOpen; - NSDecimalNumber *theHigh = [NSDecimalNumber decimalNumberWithString:csvChunks[2]]; - csvDict[@"high"] = theHigh; - NSDecimalNumber *theLow = [NSDecimalNumber decimalNumberWithString:csvChunks[3]]; - csvDict[@"low"] = theLow; - NSDecimalNumber *theClose = [NSDecimalNumber decimalNumberWithString:csvChunks[4]]; - csvDict[@"close"] = theClose; - NSDecimalNumber *theVolume = [NSDecimalNumber decimalNumberWithString:csvChunks[5]]; - csvDict[@"volume"] = theVolume; - NSDecimalNumber *theAdjClose = [NSDecimalNumber decimalNumberWithString:csvChunks[6]]; - csvDict[@"adjClose"] = theAdjClose; - - // non-mutable autoreleased dict - return [NSDictionary dictionaryWithDictionary:csvDict]; -} - -@end diff --git a/examples/StockPlot/Classes/RootViewController.h b/examples/StockPlot/Classes/RootViewController.h deleted file mode 100644 index 13ad4bf90..000000000 --- a/examples/StockPlot/Classes/RootViewController.h +++ /dev/null @@ -1,19 +0,0 @@ -// -// RootViewController.h -// StockPlot -// -// Created by Jonathan Saggau on 6/19/09. -// Copyright __MyCompanyName__ 2009. All rights reserved. -// -#import - -#import "APYahooDataPuller.h" -#import "APYahooDataPullerGraph.h" - -@interface RootViewController : UITableViewController - -@property (nonatomic, readonly, strong, nonnull) CPTStringArray *symbols; - --(void)addSymbol:(nonnull NSString *)aSymbol; - -@end diff --git a/examples/StockPlot/Classes/RootViewController.m b/examples/StockPlot/Classes/RootViewController.m deleted file mode 100644 index f543b6e9f..000000000 --- a/examples/StockPlot/Classes/RootViewController.m +++ /dev/null @@ -1,319 +0,0 @@ -// -// RootViewController.m -// StockPlot -// -// Created by Jonathan Saggau on 6/19/09. -// Copyright __MyCompanyName__ 2009. All rights reserved. -// - -#import "APYahooDataPuller.h" -#import "RootViewController.h" - -@interface RootViewController() - -@property (nonatomic, readwrite, strong, nonnull) APYahooDataPullerGraph *graph; -@property (nonatomic, readwrite, strong, nonnull) NSMutableArray *stocks; - -@end - -@implementation RootViewController - -@synthesize graph; -@synthesize stocks; -@dynamic symbols; - --(void)viewDidLoad -{ - [super viewDidLoad]; - self.stocks = [[NSMutableArray alloc] initWithCapacity:4]; - [self addSymbol:@"AAPL"]; - [self addSymbol:@"GOOG"]; - [self addSymbol:@"YHOO"]; - [self addSymbol:@"MSFT"]; - - // Uncomment the following line to display an Edit button in the navigation bar for this view controller. - // self.navigationItem.rightBarButtonItem = self.editButtonItem; -} - --(void)didReceiveMemoryWarning -{ - // Releases the view if it doesn't have a superview. - [super didReceiveMemoryWarning]; - - // Release any cached data, images, etc that aren't in use. -} - --(void)viewWillAppear:(BOOL)animated -{ - [super viewWillAppear:animated]; - self.navigationItem.title = @"Stocks"; - // the graph will set itself as delegate of the dataPuller when we push it, so we need to reset this. - for ( APYahooDataPuller *dp in self.stocks ) { - dp.delegate = self; - } -} - -#pragma mark Table view methods - --(void)inspectStock:(nonnull APYahooDataPuller *)aStock -{ - NSDecimalNumber *high = aStock.overallHigh; - NSDecimalNumber *low = aStock.overallLow; - - if ( [high isEqualToNumber:[NSDecimalNumber notANumber]] || [low isEqualToNumber:[NSDecimalNumber notANumber]] || (aStock.financialData.count <= 0) ) { - NSString *message = [NSString stringWithFormat:@"No information available for %@", aStock.symbol]; - UIAlertView *av = [[UIAlertView alloc] initWithTitle:@"Alert" message:message delegate:nil cancelButtonTitle:@"Okay" otherButtonTitles:nil]; - [av show]; - } - else { - if ( nil == self.graph ) { - APYahooDataPullerGraph *aGraph = [[APYahooDataPullerGraph alloc] initWithNibName:@"APYahooDataPullerGraph" bundle:nil]; - self.graph = aGraph; - } - - self.graph.dataPuller = aStock; - [self.navigationController pushViewController:self.graph animated:YES]; - self.graph.view.frame = self.view.bounds; - } -} - -// Override to support row selection in the table view. --(void)tableView:(nonnull UITableView *)tableView didSelectRowAtIndexPath:(nonnull NSIndexPath *)indexPath -{ - APYahooDataPuller *dp = self.stocks[(NSUInteger)indexPath.row]; - - [self inspectStock:dp]; - [self.tableView deselectRowAtIndexPath:indexPath animated:YES]; -} - --(NSInteger)numberOfSectionsInTableView:(nonnull UITableView *)tableView -{ - return 1; -} - -// Customize the number of rows in the table view. --(NSInteger)tableView:(nonnull UITableView *)tableView numberOfRowsInSection:(NSInteger)section -{ - return (NSInteger)self.stocks.count; -} - --(void)setupCell:(nonnull UITableViewCell *)cell forStockAtIndex:(NSUInteger)row -{ - APYahooDataPuller *dp = self.stocks[row]; - - cell.textLabel.text = dp.symbol; - - NSDateFormatter *df = [[NSDateFormatter alloc] init]; - df.dateStyle = NSDateFormatterShortStyle; - NSString *startString = @"(NA)"; - if ( dp.startDate ) { - startString = [df stringFromDate:dp.startDate]; - } - - NSString *endString = @"(NA)"; - if ( dp.endDate ) { - endString = [df stringFromDate:dp.endDate]; - } - - NSNumberFormatter *nf = [[NSNumberFormatter alloc] init]; - nf.roundingMode = NSNumberFormatterRoundHalfUp; - nf.decimalSeparator = @"."; - nf.groupingSeparator = @","; - nf.positiveFormat = @"\u00A4###,##0.00"; - nf.negativeFormat = @"(\u00A4###,##0.00)"; - - NSString *overallLow = @"(NA)"; - if ( ![[NSDecimalNumber notANumber] isEqual:dp.overallLow] ) { - overallLow = [nf stringFromNumber:dp.overallLow]; - } - NSString *overallHigh = @"(NA)"; - if ( ![[NSDecimalNumber notANumber] isEqual:dp.overallHigh] ) { - overallHigh = [nf stringFromNumber:dp.overallHigh]; - } - - cell.detailTextLabel.text = [NSString stringWithFormat:@"%@ - %@; Low:%@ High:%@", startString, endString, overallLow, overallHigh]; - - UIView *accessory = cell.accessoryView; - if ( dp.loadingData ) { - if ( ![accessory isMemberOfClass:[UIActivityIndicatorView class]] ) { - accessory = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray]; - [(UIActivityIndicatorView *) accessory setHidesWhenStopped:NO]; - cell.accessoryView = accessory; - } - [(UIActivityIndicatorView *) accessory startAnimating]; - } - else { - if ( [accessory isMemberOfClass:[UIActivityIndicatorView class]] ) { - [(UIActivityIndicatorView *) accessory stopAnimating]; - } - if ( dp.staleData ) { - if ( ![accessory isMemberOfClass:[UIImageView class]] ) { - UIImage *caution = [UIImage imageNamed:@"caution.png"]; - accessory = [[UIImageView alloc] initWithImage:caution]; - cell.accessoryView = accessory; -// CGRect frame = accessory.frame; -// #pragma unused (frame) - } - } - else { - [cell setAccessoryView:nil]; - } - } -} - -// Customize the appearance of table view cells. --(UITableViewCell *)tableView:(nonnull UITableView *)tableView cellForRowAtIndexPath:(nonnull NSIndexPath *)indexPath -{ - static NSString *CellIdentifier = @"UITableViewCellStyleSubtitle"; - - UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; - - if ( cell == nil ) { - cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier]; - } - - NSUInteger row = (NSUInteger)indexPath.row; - - [self setupCell:cell forStockAtIndex:row]; - - return cell; -} - --(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation -{ - self.graph.view.frame = self.view.bounds; -} - -#pragma mark - -#pragma mark accessors - --(nonnull CPTStringArray *)symbols -{ - // NSLog(@"in -symbols, returned symbols = %@", symbols); - CPTMutableStringArray *symbols = [NSMutableArray arrayWithCapacity:self.stocks.count]; - - for ( APYahooDataPuller *dp in self.stocks ) { - [symbols addObject:dp.symbol]; - } - return [NSArray arrayWithArray:symbols]; -} - --(void)dataPuller:(nonnull APYahooDataPuller *)dp downloadDidFailWithError:(nonnull NSError *)error -{ - NSLog(@"dataPuller:%@ downloadDidFailWithError:%@", dp, error); - NSUInteger idx = [self.stocks indexOfObject:dp]; - NSInteger section = 0; - NSIndexPath *path = [NSIndexPath indexPathForRow:(NSInteger)idx inSection:section]; - UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:path]; - [self setupCell:cell forStockAtIndex:idx]; -} - --(void)dataPullerFinancialDataDidChange:(nonnull APYahooDataPuller *)dp -{ - NSLog(@"dataPullerFinancialDataDidChange:%@", dp); - NSUInteger idx = [self.stocks indexOfObject:dp]; - NSInteger section = 0; - NSIndexPath *path = [NSIndexPath indexPathForRow:(NSInteger)idx inSection:section]; - UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:path]; - [self setupCell:cell forStockAtIndex:idx]; -} - --(void)addSymbol:(nonnull NSString *)aSymbol -{ - NSTimeInterval secondsAgo = -fabs(60.0 * 60.0 * 24.0 * 7.0 * 12.0); // 12 weeks ago - NSDate *start = [NSDate dateWithTimeIntervalSinceNow:secondsAgo]; - NSDate *end = [NSDate date]; - - APYahooDataPuller *dp = [[APYahooDataPuller alloc] initWithTargetSymbol:aSymbol targetStartDate:start targetEndDate:end]; - - [self.stocks addObject:dp]; - [dp fetchIfNeeded]; - dp.delegate = self; - [self.tableView reloadData]; // TODO: should reload whole thing -} - --(void)dealloc -{ - for ( APYahooDataPuller *dp in stocks ) { - if ( dp.delegate == self ) { - dp.delegate = nil; - } - } - stocks = nil; -} - -/* - * - (void)viewDidLoad { - * [super viewDidLoad]; - * - * // Uncomment the following line to display an Edit button in the navigation bar for this view controller. - * // self.navigationItem.rightBarButtonItem = self.editButtonItem; - * } - */ - -/* - * - (void)viewDidAppear:(BOOL)animated { - * [super viewDidAppear:animated]; - * } - */ - -/* - * - (void)viewWillDisappear:(BOOL)animated { - * [super viewWillDisappear:animated]; - * } - */ - -/* - * - (void)viewDidDisappear:(BOOL)animated { - * [super viewDidDisappear:animated]; - * } - */ - -/* - * // Override to support row selection in the table view. - * - (void)tableView:(nonnull UITableView *)tableView didSelectRowAtIndexPath:(nonnull NSIndexPath *)indexPath { - * - * // Navigation logic may go here -- for example, create and push another view controller. - * // AnotherViewController *anotherViewController = [[AnotherViewController alloc] initWithNibName:@"AnotherView" bundle:nil]; - * // [self.navigationController pushViewController:anotherViewController animated:YES]; - * // [anotherViewController release]; - * } - */ - -/* - * // Override to support conditional editing of the table view. - * - (BOOL)tableView:(nonnull UITableView *)tableView canEditRowAtIndexPath:(nonnull NSIndexPath *)indexPath { - * // Return NO if you do not want the specified item to be editable. - * return YES; - * } - */ - -/* - * // Override to support editing the table view. - * - (void)tableView:(nonnull UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(nonnull NSIndexPath *)indexPath { - * - * if (editingStyle == UITableViewCellEditingStyleDelete) { - * // Delete the row from the data source. - * [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade]; - * } - * else if (editingStyle == UITableViewCellEditingStyleInsert) { - * // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view. - * } - * } - */ - -/* - * // Override to support rearranging the table view. - * - (void)tableView:(nonnull UITableView *)tableView moveRowAtIndexPath:(nonnull NSIndexPath *)fromIndexPath toIndexPath:(nonnull NSIndexPath *)toIndexPath { - * } - */ - -/* - * // Override to support conditional rearranging of the table view. - * - (BOOL)tableView:(nonnull UITableView *)tableView canMoveRowAtIndexPath:(nonnull NSIndexPath *)indexPath { - * // Return NO if you do not want the item to be re-orderable. - * return YES; - * } - */ - -@end diff --git a/examples/StockPlot/Classes/StockPlotAppDelegate.h b/examples/StockPlot/Classes/StockPlotAppDelegate.h deleted file mode 100644 index 8ef6cdd9d..000000000 --- a/examples/StockPlot/Classes/StockPlotAppDelegate.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// StockPlotAppDelegate.h -// StockPlot -// -// Created by Jonathan Saggau on 6/19/09. -// Copyright __MyCompanyName__ 2009. All rights reserved. -// - -@interface StockPlotAppDelegate : NSObject - -@property (nonatomic, strong, nullable) IBOutlet UIWindow *window; -@property (nonatomic, strong, nullable) IBOutlet UINavigationController *navigationController; - -@end diff --git a/examples/StockPlot/Classes/StockPlotAppDelegate.m b/examples/StockPlot/Classes/StockPlotAppDelegate.m deleted file mode 100644 index 73a586315..000000000 --- a/examples/StockPlot/Classes/StockPlotAppDelegate.m +++ /dev/null @@ -1,36 +0,0 @@ -// -// StockPlotAppDelegate.m -// StockPlot -// -// Created by Jonathan Saggau on 6/19/09. -// Copyright __MyCompanyName__ 2009. All rights reserved. -// - -#import "RootViewController.h" -#import "StockPlotAppDelegate.h" - -@implementation StockPlotAppDelegate - -@synthesize window; -@synthesize navigationController; - -#pragma mark - -#pragma mark Application lifecycle - --(void)applicationDidFinishLaunching:(nonnull UIApplication *)application -{ - self.navigationController.navigationBar.tintColor = [UIColor blackColor]; - - self.window.rootViewController = self.navigationController; - [self.window makeKeyAndVisible]; -} - --(void)applicationWillTerminate:(nonnull UIApplication *)application -{ - // Save data if appropriate -} - -#pragma mark - -#pragma mark Memory management - -@end diff --git a/examples/StockPlot/GOOG.plist b/examples/StockPlot/GOOG.plist deleted file mode 100644 index 489ad37be..000000000 --- a/examples/StockPlot/GOOG.plist +++ /dev/null @@ -1,1107 +0,0 @@ - - - - - endDate - 2009-06-19T06:53:47Z - financialData - - - adjClose - 414.0600000000001 - close - 414.0600000000001 - date - 2009-06-18T04:00:00Z - high - 418.6899999999999 - low - 413 - open - 415.68 - volume - 3085200 - - - adjClose - 415.16 - close - 415.16 - date - 2009-06-17T04:00:00Z - high - 419.72 - low - 411.5600000000001 - open - 416.1899999999999 - volume - 3490100 - - - adjClose - 416 - close - 416 - date - 2009-06-16T04:00:00Z - high - 421.09 - low - 415.42 - open - 419.3100000000001 - volume - 3049700 - - - adjClose - 416.77 - close - 416.77 - date - 2009-06-15T04:00:00Z - high - 421.5 - low - 414 - open - 421.5 - volume - 3736900 - - - adjClose - 424.84 - close - 424.84 - date - 2009-06-12T04:00:00Z - high - 427.7 - low - 421.21 - open - 426.86 - volume - 2918400 - - - adjClose - 429 - close - 429 - date - 2009-06-11T04:00:00Z - high - 433.73 - low - 428.37 - open - 431.77 - volume - 2865200 - - - adjClose - 432.6 - close - 432.6 - date - 2009-06-10T04:00:00Z - high - 437.89 - low - 426.67 - open - 436.23 - volume - 3358900 - - - adjClose - 435.62 - close - 435.62 - date - 2009-06-09T04:00:00Z - high - 440.5 - low - 431.76 - open - 438.58 - volume - 3254900 - - - adjClose - 438.77 - close - 438.77 - date - 2009-06-08T04:00:00Z - high - 440.92 - low - 434.12 - open - 439.5 - volume - 3098700 - - - adjClose - 444.32 - close - 444.32 - date - 2009-06-05T04:00:00Z - high - 447.34 - low - 439.46 - open - 445.07 - volume - 3680800 - - - adjClose - 440.28 - close - 440.28 - date - 2009-06-04T04:00:00Z - high - 441.24 - low - 434.5 - open - 435.3 - volume - 3638100 - - - adjClose - 431.65 - close - 431.65 - date - 2009-06-03T04:00:00Z - high - 432.46 - low - 424 - open - 426 - volume - 3532800 - - - adjClose - 428.4 - close - 428.4 - date - 2009-06-02T04:00:00Z - high - 429.96 - low - 423.4 - open - 426.25 - volume - 2623600 - - - adjClose - 426.5600000000001 - close - 426.5600000000001 - date - 2009-06-01T04:00:00Z - high - 429.6 - low - 418.53 - open - 418.73 - volume - 3322400 - - - adjClose - 417.23 - close - 417.23 - date - 2009-05-29T04:00:00Z - high - 417.23 - low - 410.7 - open - 412.11 - volume - 2648200 - - - adjClose - 410.4 - close - 410.4 - date - 2009-05-28T04:00:00Z - high - 411.62 - low - 404.61 - open - 408.68 - volume - 2668800 - - - adjClose - 405.56 - close - 405.56 - date - 2009-05-27T04:00:00Z - high - 411.86 - low - 404.81 - open - 405.64 - volume - 3034300 - - - adjClose - 404.36 - close - 404.36 - date - 2009-05-26T04:00:00Z - high - 405 - low - 390 - open - 391.95 - volume - 3104500 - - - adjClose - 393.5 - close - 393.5 - date - 2009-05-22T04:00:00Z - high - 398.65 - low - 392 - open - 396.66 - volume - 1718600 - - - adjClose - 396.5 - close - 396.5 - date - 2009-05-21T04:00:00Z - high - 402.84 - low - 393.84 - open - 396.3 - volume - 2719800 - - - adjClose - 397.18 - close - 397.18 - date - 2009-05-20T04:00:00Z - high - 405.67 - low - 395 - open - 402.09 - volume - 2284000 - - - adjClose - 398.88 - close - 398.88 - date - 2009-05-19T04:00:00Z - high - 401.64 - low - 393 - open - 396.1 - volume - 2837500 - - - adjClose - 396.84 - close - 396.84 - date - 2009-05-18T04:00:00Z - high - 397.31 - low - 385.4 - open - 394.73 - volume - 3351700 - - - adjClose - 390 - close - 390 - date - 2009-05-15T04:00:00Z - high - 394.11 - low - 389.09 - open - 391.1 - volume - 3008700 - - - adjClose - 387.5 - close - 387.5 - date - 2009-05-14T04:00:00Z - high - 392.21 - low - 384.69 - open - 388.8 - volume - 2937000 - - - adjClose - 389.54 - close - 389.54 - date - 2009-05-13T04:00:00Z - high - 396.39 - low - 388.35 - open - 394.09 - volume - 2842800 - - - adjClose - 399.01 - close - 399.01 - date - 2009-05-12T04:00:00Z - high - 410.99 - low - 395.11 - open - 410.01 - volume - 3790800 - - - adjClose - 407.98 - close - 407.98 - date - 2009-05-11T04:00:00Z - high - 412 - low - 401.2 - open - 402.8 - volume - 2559300 - - - adjClose - 407.33 - close - 407.33 - date - 2009-05-08T04:00:00Z - high - 410.13 - low - 395 - open - 402.85 - volume - 3865100 - - - adjClose - 396.61 - close - 396.61 - date - 2009-05-07T04:00:00Z - high - 404.99 - low - 392.5 - open - 404.1 - volume - 2999800 - - - adjClose - 403.47 - close - 403.47 - date - 2009-05-06T04:00:00Z - high - 408.28 - low - 401 - open - 406.79 - volume - 2632900 - - - adjClose - 402.99 - close - 402.99 - date - 2009-05-05T04:00:00Z - high - 405 - low - 397.25 - open - 399.98 - volume - 2400800 - - - adjClose - 401.98 - close - 401.98 - date - 2009-05-04T04:00:00Z - high - 402.4 - low - 394.79 - open - 398.17 - volume - 3203000 - - - adjClose - 393.69 - close - 393.69 - date - 2009-05-01T04:00:00Z - high - 397.59 - low - 391.55 - open - 395.03 - volume - 2427700 - - - adjClose - 395.97 - close - 395.97 - date - 2009-04-30T04:00:00Z - high - 403.75 - low - 394.8 - open - 395.76 - volume - 4355700 - - - adjClose - 391.47 - close - 391.47 - date - 2009-04-29T04:00:00Z - high - 394.97 - low - 385.83 - open - 385.97 - volume - 3610000 - - - adjClose - 383.71 - close - 383.71 - date - 2009-04-28T04:00:00Z - high - 389.05 - low - 381.54 - open - 383.75 - volume - 2943600 - - - adjClose - 385.95 - close - 385.95 - date - 2009-04-27T04:00:00Z - high - 389.49 - low - 382.75 - open - 384.34 - volume - 2290600 - - - adjClose - 389.49 - close - 389.49 - date - 2009-04-24T04:00:00Z - high - 393.18 - low - 380.5 - open - 386.05 - volume - 3385400 - - - adjClose - 384.69 - close - 384.69 - date - 2009-04-23T04:00:00Z - high - 389.75 - low - 381.11 - open - 387.51 - volume - 2609000 - - - adjClose - 383.86 - close - 383.86 - date - 2009-04-22T04:00:00Z - high - 390 - low - 379.01 - open - 381.75 - volume - 3501800 - - - adjClose - 381.47 - close - 381.47 - date - 2009-04-21T04:00:00Z - high - 384.3 - low - 376.1 - open - 376.17 - volume - 3695400 - - - adjClose - 379.3 - close - 379.3 - date - 2009-04-20T04:00:00Z - high - 390.65 - low - 375.89 - open - 386.15 - volume - 4428900 - - - adjClose - 392.24 - close - 392.24 - date - 2009-04-17T04:00:00Z - high - 399.82 - low - 384.81 - open - 386.02 - volume - 10730800 - - - adjClose - 388.74 - close - 388.74 - date - 2009-04-16T04:00:00Z - high - 392.9 - low - 381.02 - open - 381.5 - volume - 10185100 - - - adjClose - 379.5 - close - 379.5 - date - 2009-04-15T04:00:00Z - high - 381.06 - low - 364.16 - open - 367.1 - volume - 4930700 - - - adjClose - 368.91 - close - 368.91 - date - 2009-04-14T04:00:00Z - high - 376.99 - low - 365.6 - open - 376.94 - volume - 3428600 - - - adjClose - 378.11 - close - 378.11 - date - 2009-04-13T04:00:00Z - high - 379.1 - low - 370.3 - open - 371.33 - volume - 3050100 - - - adjClose - 372.5 - close - 372.5 - date - 2009-04-09T04:00:00Z - high - 374.35 - low - 366.25 - open - 369.5 - volume - 3382600 - - - adjClose - 362 - close - 362 - date - 2009-04-08T04:00:00Z - high - 365 - low - 356.21 - open - 363.5 - volume - 2765200 - - - adjClose - 358.65 - close - 358.65 - date - 2009-04-07T04:00:00Z - high - 363.75 - low - 355.31 - open - 362.6 - volume - 3680100 - - - adjClose - 368.24 - close - 368.24 - date - 2009-04-06T04:00:00Z - high - 369.82 - low - 361.4 - open - 367 - volume - 3280300 - - - adjClose - 369.78 - close - 369.78 - date - 2009-04-03T04:00:00Z - high - 371.72 - low - 358 - open - 364.5 - volume - 3789800 - - - adjClose - 362.5 - close - 362.5 - date - 2009-04-02T04:00:00Z - high - 369.76 - low - 360.32 - open - 363.31 - volume - 4488000 - - - adjClose - 354.09 - close - 354.09 - date - 2009-04-01T04:00:00Z - high - 355.24 - low - 340.61 - open - 343.78 - volume - 3301200 - - - adjClose - 348.06 - close - 348.06 - date - 2009-03-31T04:00:00Z - high - 353.51 - low - 346.18 - open - 348.93 - volume - 3655300 - - - adjClose - 342.69 - close - 342.69 - date - 2009-03-30T04:00:00Z - high - 343.81 - low - 336.05 - open - 342.55 - volume - 3094100 - - - adjClose - 347.7 - close - 347.7 - date - 2009-03-27T04:00:00Z - high - 352 - low - 345.47 - open - 350 - volume - 3322800 - - - adjClose - 353.29 - close - 353.29 - date - 2009-03-26T04:00:00Z - high - 359.16 - low - 348.5 - open - 353.13 - volume - 6003300 - - - adjClose - 344.07 - close - 344.07 - date - 2009-03-25T04:00:00Z - high - 351.34 - low - 336.25 - open - 350.4 - volume - 4336300 - - - adjClose - 347.17 - close - 347.17 - date - 2009-03-24T04:00:00Z - high - 353.84 - low - 344 - open - 346.5 - volume - 3820000 - - - adjClose - 348.6 - close - 348.6 - date - 2009-03-23T04:00:00Z - high - 349.45 - low - 333.03 - open - 333.56 - volume - 4271500 - - - adjClose - 330.16 - close - 330.16 - date - 2009-03-20T04:00:00Z - high - 332.99 - low - 326.34 - open - 330.3 - volume - 4737900 - - - adjClose - 329.94 - close - 329.94 - date - 2009-03-19T04:00:00Z - high - 336 - low - 327.38 - open - 331.68 - volume - 4111200 - - - adjClose - 333.1 - close - 333.1 - date - 2009-03-18T04:00:00Z - high - 340 - low - 328.05 - open - 334.81 - volume - 5012200 - - - adjClose - 335.34 - close - 335.34 - date - 2009-03-17T04:00:00Z - high - 335.34 - low - 319.09 - open - 320.18 - volume - 4712500 - - - adjClose - 319.69 - close - 319.69 - date - 2009-03-16T04:00:00Z - high - 329.73 - low - 318.59 - open - 325.99 - volume - 4946800 - - - adjClose - 324.42 - close - 324.42 - date - 2009-03-13T04:00:00Z - high - 327.46 - low - 319.03 - open - 326.1 - volume - 3906400 - - - overallHigh - 447.34 - overallLow - 318.59 - startDate - 2009-03-13T06:53:47Z - symbol - GOOG - - diff --git a/examples/StockPlot/Launch Screen.xib b/examples/StockPlot/Launch Screen.xib deleted file mode 100644 index a4454db08..000000000 --- a/examples/StockPlot/Launch Screen.xib +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/StockPlot/MSFT.plist b/examples/StockPlot/MSFT.plist deleted file mode 100644 index 5564f546f..000000000 --- a/examples/StockPlot/MSFT.plist +++ /dev/null @@ -1,1107 +0,0 @@ - - - - - endDate - 2009-06-19T06:53:47Z - financialData - - - adjClose - 23.5 - close - 23.5 - date - 2009-06-18T04:00:00Z - high - 23.69 - low - 23.3 - open - 23.62 - volume - 58825800 - - - adjClose - 23.68 - close - 23.68 - date - 2009-06-17T04:00:00Z - high - 23.82 - low - 23.17 - open - 23.5 - volume - 86463700 - - - adjClose - 23.45 - close - 23.45 - date - 2009-06-16T04:00:00Z - high - 24.11 - low - 23.44 - open - 23.47 - volume - 105284900 - - - adjClose - 23.42 - close - 23.42 - date - 2009-06-15T04:00:00Z - high - 23.54 - low - 23.02 - open - 23.23 - volume - 69074500 - - - adjClose - 23.33 - close - 23.33 - date - 2009-06-12T04:00:00Z - high - 23.38 - low - 22.74 - open - 22.9 - volume - 50951800 - - - adjClose - 22.83 - close - 22.83 - date - 2009-06-11T04:00:00Z - high - 23.26 - low - 22.57 - open - 22.59 - volume - 65124600 - - - adjClose - 22.55 - close - 22.55 - date - 2009-06-10T04:00:00Z - high - 22.62 - low - 22.12 - open - 22.17 - volume - 61202600 - - - adjClose - 22.08 - close - 22.08 - date - 2009-06-09T04:00:00Z - high - 22.32 - low - 21.88 - open - 22.06 - volume - 50852100 - - - adjClose - 22.05 - close - 22.05 - date - 2009-06-08T04:00:00Z - high - 22.32 - low - 21.63 - open - 21.98 - volume - 49000600 - - - adjClose - 22.14 - close - 22.14 - date - 2009-06-05T04:00:00Z - high - 22.31 - low - 21.81 - open - 21.96 - volume - 59579200 - - - adjClose - 21.83 - close - 21.83 - date - 2009-06-04T04:00:00Z - high - 21.9 - low - 21.58 - open - 21.77 - volume - 42330000 - - - adjClose - 21.73 - close - 21.73 - date - 2009-06-03T04:00:00Z - high - 21.76 - low - 21.29 - open - 21.31 - volume - 56039600 - - - adjClose - 21.4 - close - 21.4 - date - 2009-06-02T04:00:00Z - high - 21.98 - low - 21.2 - open - 21.36 - volume - 48935700 - - - adjClose - 21.4 - close - 21.4 - date - 2009-06-01T04:00:00Z - high - 21.5 - low - 20.86 - open - 21 - volume - 57317100 - - - adjClose - 20.89 - close - 20.89 - date - 2009-05-29T04:00:00Z - high - 20.94 - low - 20.3 - open - 20.56 - volume - 46134900 - - - adjClose - 20.45 - close - 20.45 - date - 2009-05-28T04:00:00Z - high - 20.63 - low - 20.05 - open - 20.32 - volume - 45480800 - - - adjClose - 20.13 - close - 20.13 - date - 2009-05-27T04:00:00Z - high - 20.6 - low - 20.07 - open - 20.25 - volume - 42892900 - - - adjClose - 20.34 - close - 20.34 - date - 2009-05-26T04:00:00Z - high - 20.45 - low - 19.45 - open - 19.54 - volume - 44991700 - - - adjClose - 19.75 - close - 19.75 - date - 2009-05-22T04:00:00Z - high - 20.17 - low - 19.47 - open - 19.93 - volume - 37318700 - - - adjClose - 19.82 - close - 19.82 - date - 2009-05-21T04:00:00Z - high - 20.23 - low - 19.51 - open - 20.14 - volume - 58232800 - - - adjClose - 20.38 - close - 20.38 - date - 2009-05-20T04:00:00Z - high - 20.69 - low - 20.22 - open - 20.41 - volume - 47450700 - - - adjClose - 20.31 - close - 20.31 - date - 2009-05-19T04:00:00Z - high - 20.74 - low - 20.25 - open - 20.51 - volume - 51368300 - - - adjClose - 20.47 - close - 20.6 - date - 2009-05-18T04:00:00Z - high - 20.6 - low - 20.24 - open - 20.36 - volume - 46073800 - - - adjClose - 20.09 - close - 20.22 - date - 2009-05-15T04:00:00Z - high - 20.5 - low - 19.98 - open - 20.13 - volume - 61289900 - - - adjClose - 19.93 - close - 20.06 - date - 2009-05-14T04:00:00Z - high - 20.23 - low - 19.8 - open - 19.83 - volume - 54539500 - - - adjClose - 19.63 - close - 19.75 - date - 2009-05-13T04:00:00Z - high - 20 - low - 19.67 - open - 19.92 - volume - 49281700 - - - adjClose - 19.76 - close - 19.89 - date - 2009-05-12T04:00:00Z - high - 20.06 - low - 19.47 - open - 19.51 - volume - 71966800 - - - adjClose - 19.2 - close - 19.32 - date - 2009-05-11T04:00:00Z - high - 19.73 - low - 19.01 - open - 19.2 - volume - 63762600 - - - adjClose - 19.3 - close - 19.42 - date - 2009-05-08T04:00:00Z - high - 19.64 - low - 19.14 - open - 19.46 - volume - 67597600 - - - adjClose - 19.2 - close - 19.32 - date - 2009-05-07T04:00:00Z - high - 19.99 - low - 19.14 - open - 19.96 - volume - 68727200 - - - adjClose - 19.67 - close - 19.79 - date - 2009-05-06T04:00:00Z - high - 20.07 - low - 19.61 - open - 20.06 - volume - 59639100 - - - adjClose - 19.67 - close - 19.79 - date - 2009-05-05T04:00:00Z - high - 20.24 - low - 19.64 - open - 20.14 - volume - 66835500 - - - adjClose - 20.06 - close - 20.19 - date - 2009-05-04T04:00:00Z - high - 20.4 - low - 19.98 - open - 20.37 - volume - 54313400 - - - adjClose - 20.11 - close - 20.24 - date - 2009-05-01T04:00:00Z - high - 20.35 - low - 19.86 - open - 20.19 - volume - 63224500 - - - adjClose - 20.13 - close - 20.26 - date - 2009-04-30T04:00:00Z - high - 21.1 - low - 20.01 - open - 20.6 - volume - 87439900 - - - adjClose - 20.12 - close - 20.25 - date - 2009-04-29T04:00:00Z - high - 20.89 - low - 20.06 - open - 20.11 - volume - 79301600 - - - adjClose - 19.8 - close - 19.93 - date - 2009-04-28T04:00:00Z - high - 20.27 - low - 19.79 - open - 20.25 - volume - 76685200 - - - adjClose - 20.27 - close - 20.4 - date - 2009-04-27T04:00:00Z - high - 20.82 - low - 20.28 - open - 20.55 - volume - 68219600 - - - adjClose - 20.78 - close - 20.91 - date - 2009-04-24T04:00:00Z - high - 21.2 - low - 19.5 - open - 19.82 - volume - 168478500 - - - adjClose - 18.8 - close - 18.92 - date - 2009-04-23T04:00:00Z - high - 18.94 - low - 18.47 - open - 18.92 - volume - 86116300 - - - adjClose - 18.66 - close - 18.78 - date - 2009-04-22T04:00:00Z - high - 19.19 - low - 18.7 - open - 18.76 - volume - 59401000 - - - adjClose - 18.85 - close - 18.97 - date - 2009-04-21T04:00:00Z - high - 19.08 - low - 18.57 - open - 18.59 - volume - 60928300 - - - adjClose - 18.49 - close - 18.61 - date - 2009-04-20T04:00:00Z - high - 18.95 - low - 18.57 - open - 18.89 - volume - 62937200 - - - adjClose - 19.08 - close - 19.2 - date - 2009-04-17T04:00:00Z - high - 19.69 - low - 19 - open - 19.69 - volume - 61398500 - - - adjClose - 19.64 - close - 19.76 - date - 2009-04-16T04:00:00Z - high - 19.78 - low - 18.99 - open - 19.16 - volume - 67688700 - - - adjClose - 18.71 - close - 18.83 - date - 2009-04-15T04:00:00Z - high - 19.25 - low - 18.51 - open - 19.21 - volume - 72725500 - - - adjClose - 19.23 - close - 19.35 - date - 2009-04-14T04:00:00Z - high - 19.55 - low - 19 - open - 19.44 - volume - 63796300 - - - adjClose - 19.47 - close - 19.59 - date - 2009-04-13T04:00:00Z - high - 19.85 - low - 19.37 - open - 19.69 - volume - 44444700 - - - adjClose - 19.55 - close - 19.67 - date - 2009-04-09T04:00:00Z - high - 19.7 - low - 19.22 - open - 19.45 - volume - 55759600 - - - adjClose - 19.07 - close - 19.19 - date - 2009-04-08T04:00:00Z - high - 19.62 - low - 18.96 - open - 18.97 - volume - 56408900 - - - adjClose - 18.64 - close - 18.76 - date - 2009-04-07T04:00:00Z - high - 19.14 - low - 18.63 - open - 18.76 - volume - 65815200 - - - adjClose - 18.64 - close - 18.76 - date - 2009-04-06T04:00:00Z - high - 18.76 - low - 18.27 - open - 18.54 - volume - 47476100 - - - adjClose - 18.63 - close - 18.75 - date - 2009-04-03T04:00:00Z - high - 19.15 - low - 18.43 - open - 19.13 - volume - 81858400 - - - adjClose - 19.17 - close - 19.29 - date - 2009-04-02T04:00:00Z - high - 19.89 - low - 19 - open - 19.5 - volume - 99082300 - - - adjClose - 19.19 - close - 19.31 - date - 2009-04-01T04:00:00Z - high - 19.36 - low - 18.18 - open - 18.23 - volume - 96438900 - - - adjClose - 18.25 - close - 18.37 - date - 2009-03-31T04:00:00Z - high - 18.79 - low - 17.78 - open - 17.83 - volume - 92095500 - - - adjClose - 17.37 - close - 17.48 - date - 2009-03-30T04:00:00Z - high - 17.76 - low - 17.27 - open - 17.74 - volume - 49633000 - - - adjClose - 18.02 - close - 18.13 - date - 2009-03-27T04:00:00Z - high - 18.62 - low - 18.05 - open - 18.54 - volume - 47670400 - - - adjClose - 18.71 - close - 18.83 - date - 2009-03-26T04:00:00Z - high - 18.88 - low - 18.12 - open - 18.17 - volume - 63775100 - - - adjClose - 17.77 - close - 17.88 - date - 2009-03-25T04:00:00Z - high - 18.31 - low - 17.52 - open - 17.98 - volume - 73927100 - - - adjClose - 17.82 - close - 17.93 - date - 2009-03-24T04:00:00Z - high - 18.21 - low - 17.84 - open - 18.04 - volume - 50044100 - - - adjClose - 18.21 - close - 18.33 - date - 2009-03-23T04:00:00Z - high - 18.59 - low - 17.31 - open - 17.37 - volume - 71600000 - - - adjClose - 16.95 - close - 17.06 - date - 2009-03-20T04:00:00Z - high - 17.65 - low - 16.88 - open - 17.32 - volume - 81725500 - - - adjClose - 17.03 - close - 17.14 - date - 2009-03-19T04:00:00Z - high - 17.45 - low - 16.92 - open - 17.37 - volume - 58994600 - - - adjClose - 16.85 - close - 16.96 - date - 2009-03-18T04:00:00Z - high - 17.22 - low - 16.6 - open - 17.03 - volume - 70710700 - - - adjClose - 16.79 - close - 16.9 - date - 2009-03-17T04:00:00Z - high - 16.9 - low - 16.26 - open - 16.32 - volume - 62481000 - - - adjClose - 16.15 - close - 16.25 - date - 2009-03-16T04:00:00Z - high - 16.96 - low - 16.24 - open - 16.82 - volume - 67028900 - - - adjClose - 16.54 - close - 16.65 - date - 2009-03-13T04:00:00Z - high - 17.05 - low - 16.18 - open - 16.98 - volume - 82965800 - - - overallHigh - 24.11 - overallLow - 16.18 - startDate - 2009-03-13T06:53:47Z - symbol - MSFT - - diff --git a/examples/StockPlot/MainWindow.xib b/examples/StockPlot/MainWindow.xib deleted file mode 100644 index ddc52b78a..000000000 --- a/examples/StockPlot/MainWindow.xib +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/StockPlot/RootViewController.xib b/examples/StockPlot/RootViewController.xib deleted file mode 100644 index 046950821..000000000 --- a/examples/StockPlot/RootViewController.xib +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/StockPlot/StockPlot-Info.plist b/examples/StockPlot/StockPlot-Info.plist deleted file mode 100644 index eea88268d..000000000 --- a/examples/StockPlot/StockPlot-Info.plist +++ /dev/null @@ -1,54 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleDisplayName - ${PRODUCT_NAME} - CFBundleExecutable - ${EXECUTABLE_NAME} - CFBundleIcons~ipad - - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - ${PRODUCT_NAME} - CFBundlePackageType - APPL - CFBundleSignature - ???? - CFBundleVersion - 1.0 - LSRequiresIPhoneOS - - NSAppTransportSecurity - - NSExceptionDomains - - ichart.yahoo.com - - NSExceptionAllowsInsecureHTTPLoads - - NSExceptionRequiresForwardSecrecy - - - - - NSMainNibFile - MainWindow - UILaunchStoryboardName - Launch Screen - UIStatusBarStyle - UIStatusBarStyleDefault - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - UIInterfaceOrientationPortraitUpsideDown - - - diff --git a/examples/StockPlot/StockPlot.png b/examples/StockPlot/StockPlot.png deleted file mode 100644 index 8c1c5ca30..000000000 Binary files a/examples/StockPlot/StockPlot.png and /dev/null differ diff --git a/examples/StockPlot/StockPlot.xcodeproj/project.pbxproj b/examples/StockPlot/StockPlot.xcodeproj/project.pbxproj deleted file mode 100644 index 759fa8d7b..000000000 --- a/examples/StockPlot/StockPlot.xcodeproj/project.pbxproj +++ /dev/null @@ -1,470 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 47; - objects = { - -/* Begin PBXBuildFile section */ - 1D3623260D0F684500981E51 /* StockPlotAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D3623250D0F684500981E51 /* StockPlotAppDelegate.m */; }; - 1D60589B0D05DD56006BFB54 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; }; - 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; }; - 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; }; - 2892E4100DC94CBA00A64D0F /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2892E40F0DC94CBA00A64D0F /* CoreGraphics.framework */; }; - 2899E5600DE3E45000AC0155 /* RootViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2899E55F0DE3E45000AC0155 /* RootViewController.xib */; }; - 28AD73600D9D9599002E5188 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 28AD735F0D9D9599002E5188 /* MainWindow.xib */; }; - 28C286E10D94DF7D0034E888 /* RootViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 28C286E00D94DF7D0034E888 /* RootViewController.m */; }; - AB0363AA0FEF3681007B09A9 /* YHOO.plist in Resources */ = {isa = PBXBuildFile; fileRef = AB6FA6090FEB6DAA008DB04A /* YHOO.plist */; }; - AB0363AB0FEF3684007B09A9 /* MSFT.plist in Resources */ = {isa = PBXBuildFile; fileRef = AB6FA60A0FEB6DAA008DB04A /* MSFT.plist */; }; - AB0363AC0FEF3687007B09A9 /* GOOG.plist in Resources */ = {isa = PBXBuildFile; fileRef = AB6FA60B0FEB6DAA008DB04A /* GOOG.plist */; }; - AB0363AD0FEF368A007B09A9 /* AAPL.plist in Resources */ = {isa = PBXBuildFile; fileRef = AB6FA60C0FEB6DAA008DB04A /* AAPL.plist */; }; - AB0364770FEF4603007B09A9 /* caution.png in Resources */ = {isa = PBXBuildFile; fileRef = AB0364760FEF4603007B09A9 /* caution.png */; }; - AB4913C80FECC2B8008A08AB /* APYahooDataPuller.m in Sources */ = {isa = PBXBuildFile; fileRef = AB4913C60FECC2B8008A08AB /* APYahooDataPuller.m */; }; - AB4913C90FECC2B8008A08AB /* NSDictionary+APFinancialData.m in Sources */ = {isa = PBXBuildFile; fileRef = AB4913C70FECC2B8008A08AB /* NSDictionary+APFinancialData.m */; }; - AB6FA4A40FEB579B008DB04A /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB6FA4A30FEB579B008DB04A /* QuartzCore.framework */; }; - AB6FA5590FEB6235008DB04A /* APYahooDataPullerGraph.m in Sources */ = {isa = PBXBuildFile; fileRef = AB6FA5570FEB6235008DB04A /* APYahooDataPullerGraph.m */; }; - AB6FA55A0FEB6235008DB04A /* APYahooDataPullerGraph.xib in Resources */ = {isa = PBXBuildFile; fileRef = AB6FA5580FEB6235008DB04A /* APYahooDataPullerGraph.xib */; }; - C36157E919D79AAC0036ACDA /* Launch Screen.xib in Resources */ = {isa = PBXBuildFile; fileRef = C36157E819D79AAC0036ACDA /* Launch Screen.xib */; }; - C3CD284817DE9D1F008EED1E /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3CD284717DE9D1F008EED1E /* Accelerate.framework */; }; - C3D3937019FD6CBF00148319 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C3D3936F19FD6CBF00148319 /* Images.xcassets */; }; - C3D414DF1A7D84CC00B6F5D6 /* libCorePlot-CocoaTouch.a in Frameworks */ = {isa = PBXBuildFile; fileRef = C3D414DC1A7D84BF00B6F5D6 /* libCorePlot-CocoaTouch.a */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - C3D414D31A7D84BF00B6F5D6 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = C3D414C71A7D84BF00B6F5D6 /* CorePlot.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 8DC2EF5B0486A6940098B216; - remoteInfo = CorePlot; - }; - C3D414D51A7D84BF00B6F5D6 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = C3D414C71A7D84BF00B6F5D6 /* CorePlot.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 0730F600109492D800E95162; - remoteInfo = UnitTests; - }; - C3D414D71A7D84BF00B6F5D6 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = C3D414C71A7D84BF00B6F5D6 /* CorePlot.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = C38A09781A46185200D45436; - remoteInfo = CorePlot_iOS; - }; - C3D414D91A7D84BF00B6F5D6 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = C3D414C71A7D84BF00B6F5D6 /* CorePlot.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = C38A09821A46185300D45436; - remoteInfo = CorePlot_iOSTests; - }; - C3D414DB1A7D84BF00B6F5D6 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = C3D414C71A7D84BF00B6F5D6 /* CorePlot.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = C38A09BA1A4619A900D45436; - remoteInfo = "CorePlot-CocoaTouch"; - }; - C3D414DD1A7D84BF00B6F5D6 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = C3D414C71A7D84BF00B6F5D6 /* CorePlot.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = C38A09C41A4619A900D45436; - remoteInfo = "CorePlot-CocoaTouchTests"; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXFileReference section */ - 1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; - 1D3623240D0F684500981E51 /* StockPlotAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StockPlotAppDelegate.h; sourceTree = ""; }; - 1D3623250D0F684500981E51 /* StockPlotAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = StockPlotAppDelegate.m; sourceTree = ""; }; - 1D6058910D05DD3D006BFB54 /* StockPlot.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = StockPlot.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; - 2892E40F0DC94CBA00A64D0F /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; - 2899E55F0DE3E45000AC0155 /* RootViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = RootViewController.xib; sourceTree = ""; }; - 28A0AAE50D9B0CCF005BE974 /* StockPlot_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StockPlot_Prefix.pch; sourceTree = ""; }; - 28AD735F0D9D9599002E5188 /* MainWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MainWindow.xib; sourceTree = ""; }; - 28C286DF0D94DF7D0034E888 /* RootViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RootViewController.h; sourceTree = ""; }; - 28C286E00D94DF7D0034E888 /* RootViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RootViewController.m; sourceTree = ""; }; - 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; - 8D1107310486CEB800E47090 /* StockPlot-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "StockPlot-Info.plist"; plistStructureDefinitionIdentifier = "com.apple.xcode.plist.structure-definition.iphone.info-plist"; sourceTree = ""; }; - AB0364760FEF4603007B09A9 /* caution.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = caution.png; sourceTree = SOURCE_ROOT; }; - AB4913C50FECC2B8008A08AB /* APYahooDataPuller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = APYahooDataPuller.h; path = Classes/APYahooDataPuller.h; sourceTree = SOURCE_ROOT; }; - AB4913C60FECC2B8008A08AB /* APYahooDataPuller.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = APYahooDataPuller.m; path = Classes/APYahooDataPuller.m; sourceTree = SOURCE_ROOT; }; - AB4913C70FECC2B8008A08AB /* NSDictionary+APFinancialData.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSDictionary+APFinancialData.m"; path = "Classes/NSDictionary+APFinancialData.m"; sourceTree = SOURCE_ROOT; }; - AB6FA4A30FEB579B008DB04A /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; - AB6FA4DE0FEB59DB008DB04A /* NSDictionary+APFinancialData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSDictionary+APFinancialData.h"; sourceTree = ""; }; - AB6FA5560FEB6235008DB04A /* APYahooDataPullerGraph.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = APYahooDataPullerGraph.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - AB6FA5570FEB6235008DB04A /* APYahooDataPullerGraph.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = APYahooDataPullerGraph.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; - AB6FA5580FEB6235008DB04A /* APYahooDataPullerGraph.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = APYahooDataPullerGraph.xib; path = Classes/APYahooDataPullerGraph.xib; sourceTree = ""; }; - AB6FA6090FEB6DAA008DB04A /* YHOO.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = YHOO.plist; sourceTree = SOURCE_ROOT; }; - AB6FA60A0FEB6DAA008DB04A /* MSFT.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = MSFT.plist; sourceTree = SOURCE_ROOT; }; - AB6FA60B0FEB6DAA008DB04A /* GOOG.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = GOOG.plist; sourceTree = SOURCE_ROOT; }; - AB6FA60C0FEB6DAA008DB04A /* AAPL.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = AAPL.plist; sourceTree = SOURCE_ROOT; }; - C36157E819D79AAC0036ACDA /* Launch Screen.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = "Launch Screen.xib"; sourceTree = ""; }; - C3CA9B5B19E203B2008DF7A3 /* CorePlotWarnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = CorePlotWarnings.xcconfig; path = ../../framework/xcconfig/CorePlotWarnings.xcconfig; sourceTree = ""; }; - C3CD284717DE9D1F008EED1E /* Accelerate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Accelerate.framework; path = System/Library/Frameworks/Accelerate.framework; sourceTree = SDKROOT; }; - C3D3936F19FD6CBF00148319 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = StockPlot/Images.xcassets; sourceTree = ""; }; - C3D414C71A7D84BF00B6F5D6 /* CorePlot.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = CorePlot.xcodeproj; path = ../../framework/CorePlot.xcodeproj; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 1D60588F0D05DD3D006BFB54 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */, - 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */, - 2892E4100DC94CBA00A64D0F /* CoreGraphics.framework in Frameworks */, - AB6FA4A40FEB579B008DB04A /* QuartzCore.framework in Frameworks */, - C3CD284817DE9D1F008EED1E /* Accelerate.framework in Frameworks */, - C3D414DF1A7D84CC00B6F5D6 /* libCorePlot-CocoaTouch.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 080E96DDFE201D6D7F000001 /* Classes */ = { - isa = PBXGroup; - children = ( - AB4913C50FECC2B8008A08AB /* APYahooDataPuller.h */, - AB4913C60FECC2B8008A08AB /* APYahooDataPuller.m */, - AB6FA4DE0FEB59DB008DB04A /* NSDictionary+APFinancialData.h */, - AB4913C70FECC2B8008A08AB /* NSDictionary+APFinancialData.m */, - 28C286DF0D94DF7D0034E888 /* RootViewController.h */, - 28C286E00D94DF7D0034E888 /* RootViewController.m */, - 1D3623240D0F684500981E51 /* StockPlotAppDelegate.h */, - 1D3623250D0F684500981E51 /* StockPlotAppDelegate.m */, - AB6FA5560FEB6235008DB04A /* APYahooDataPullerGraph.h */, - AB6FA5570FEB6235008DB04A /* APYahooDataPullerGraph.m */, - ); - path = Classes; - sourceTree = ""; - }; - 19C28FACFE9D520D11CA2CBB /* Products */ = { - isa = PBXGroup; - children = ( - 1D6058910D05DD3D006BFB54 /* StockPlot.app */, - ); - name = Products; - sourceTree = ""; - }; - 29B97314FDCFA39411CA2CEA /* CustomTemplate */ = { - isa = PBXGroup; - children = ( - C3D414C71A7D84BF00B6F5D6 /* CorePlot.xcodeproj */, - 080E96DDFE201D6D7F000001 /* Classes */, - 29B97315FDCFA39411CA2CEA /* Other Sources */, - 29B97317FDCFA39411CA2CEA /* Resources */, - 29B97323FDCFA39411CA2CEA /* Frameworks */, - 19C28FACFE9D520D11CA2CBB /* Products */, - ); - indentWidth = 4; - name = CustomTemplate; - sourceTree = ""; - tabWidth = 4; - usesTabs = 0; - }; - 29B97315FDCFA39411CA2CEA /* Other Sources */ = { - isa = PBXGroup; - children = ( - 28A0AAE50D9B0CCF005BE974 /* StockPlot_Prefix.pch */, - 29B97316FDCFA39411CA2CEA /* main.m */, - C3CA9B5B19E203B2008DF7A3 /* CorePlotWarnings.xcconfig */, - ); - name = "Other Sources"; - sourceTree = ""; - }; - 29B97317FDCFA39411CA2CEA /* Resources */ = { - isa = PBXGroup; - children = ( - C3D3936F19FD6CBF00148319 /* Images.xcassets */, - AB0364760FEF4603007B09A9 /* caution.png */, - AB6FA6090FEB6DAA008DB04A /* YHOO.plist */, - AB6FA60A0FEB6DAA008DB04A /* MSFT.plist */, - AB6FA60B0FEB6DAA008DB04A /* GOOG.plist */, - AB6FA60C0FEB6DAA008DB04A /* AAPL.plist */, - AB6FA5580FEB6235008DB04A /* APYahooDataPullerGraph.xib */, - 2899E55F0DE3E45000AC0155 /* RootViewController.xib */, - 28AD735F0D9D9599002E5188 /* MainWindow.xib */, - 8D1107310486CEB800E47090 /* StockPlot-Info.plist */, - C36157E819D79AAC0036ACDA /* Launch Screen.xib */, - ); - name = Resources; - sourceTree = ""; - }; - 29B97323FDCFA39411CA2CEA /* Frameworks */ = { - isa = PBXGroup; - children = ( - 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */, - 1D30AB110D05D00D00671497 /* Foundation.framework */, - 2892E40F0DC94CBA00A64D0F /* CoreGraphics.framework */, - AB6FA4A30FEB579B008DB04A /* QuartzCore.framework */, - C3CD284717DE9D1F008EED1E /* Accelerate.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; - C3D414C81A7D84BF00B6F5D6 /* Products */ = { - isa = PBXGroup; - children = ( - C3D414D41A7D84BF00B6F5D6 /* CorePlot.framework */, - C3D414D61A7D84BF00B6F5D6 /* UnitTests.xctest */, - C3D414D81A7D84BF00B6F5D6 /* CorePlot.framework */, - C3D414DA1A7D84BF00B6F5D6 /* UnitTests iOS.xctest */, - C3D414DC1A7D84BF00B6F5D6 /* libCorePlot-CocoaTouch.a */, - C3D414DE1A7D84BF00B6F5D6 /* CorePlot-CocoaTouchTests.xctest */, - ); - name = Products; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 1D6058900D05DD3D006BFB54 /* StockPlot */ = { - isa = PBXNativeTarget; - buildConfigurationList = 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "StockPlot" */; - buildPhases = ( - 1D60588D0D05DD3D006BFB54 /* Resources */, - 1D60588E0D05DD3D006BFB54 /* Sources */, - 1D60588F0D05DD3D006BFB54 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = StockPlot; - productName = StockPlot; - productReference = 1D6058910D05DD3D006BFB54 /* StockPlot.app */; - productType = "com.apple.product-type.application"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 29B97313FDCFA39411CA2CEA /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0700; - TargetAttributes = { - 1D6058900D05DD3D006BFB54 = { - DevelopmentTeam = 28ZA45DE7D; - }; - }; - }; - buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "StockPlot" */; - compatibilityVersion = "Xcode 6.3"; - developmentRegion = English; - hasScannedForEncodings = 1; - knownRegions = ( - English, - Japanese, - French, - German, - en, - ); - mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */; - projectDirPath = ""; - projectReferences = ( - { - ProductGroup = C3D414C81A7D84BF00B6F5D6 /* Products */; - ProjectRef = C3D414C71A7D84BF00B6F5D6 /* CorePlot.xcodeproj */; - }, - ); - projectRoot = ""; - targets = ( - 1D6058900D05DD3D006BFB54 /* StockPlot */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXReferenceProxy section */ - C3D414D41A7D84BF00B6F5D6 /* CorePlot.framework */ = { - isa = PBXReferenceProxy; - fileType = wrapper.framework; - path = CorePlot.framework; - remoteRef = C3D414D31A7D84BF00B6F5D6 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - C3D414D61A7D84BF00B6F5D6 /* UnitTests.xctest */ = { - isa = PBXReferenceProxy; - fileType = wrapper.cfbundle; - path = UnitTests.xctest; - remoteRef = C3D414D51A7D84BF00B6F5D6 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - C3D414D81A7D84BF00B6F5D6 /* CorePlot.framework */ = { - isa = PBXReferenceProxy; - fileType = wrapper.framework; - path = CorePlot.framework; - remoteRef = C3D414D71A7D84BF00B6F5D6 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - C3D414DA1A7D84BF00B6F5D6 /* UnitTests iOS.xctest */ = { - isa = PBXReferenceProxy; - fileType = wrapper.cfbundle; - path = "UnitTests iOS.xctest"; - remoteRef = C3D414D91A7D84BF00B6F5D6 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - C3D414DC1A7D84BF00B6F5D6 /* libCorePlot-CocoaTouch.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libCorePlot-CocoaTouch.a"; - remoteRef = C3D414DB1A7D84BF00B6F5D6 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - C3D414DE1A7D84BF00B6F5D6 /* CorePlot-CocoaTouchTests.xctest */ = { - isa = PBXReferenceProxy; - fileType = wrapper.cfbundle; - path = "CorePlot-CocoaTouchTests.xctest"; - remoteRef = C3D414DD1A7D84BF00B6F5D6 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; -/* End PBXReferenceProxy section */ - -/* Begin PBXResourcesBuildPhase section */ - 1D60588D0D05DD3D006BFB54 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 28AD73600D9D9599002E5188 /* MainWindow.xib in Resources */, - 2899E5600DE3E45000AC0155 /* RootViewController.xib in Resources */, - AB6FA55A0FEB6235008DB04A /* APYahooDataPullerGraph.xib in Resources */, - AB0363AA0FEF3681007B09A9 /* YHOO.plist in Resources */, - C3D3937019FD6CBF00148319 /* Images.xcassets in Resources */, - AB0363AB0FEF3684007B09A9 /* MSFT.plist in Resources */, - AB0363AC0FEF3687007B09A9 /* GOOG.plist in Resources */, - AB0363AD0FEF368A007B09A9 /* AAPL.plist in Resources */, - AB0364770FEF4603007B09A9 /* caution.png in Resources */, - C36157E919D79AAC0036ACDA /* Launch Screen.xib in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 1D60588E0D05DD3D006BFB54 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 1D60589B0D05DD56006BFB54 /* main.m in Sources */, - 1D3623260D0F684500981E51 /* StockPlotAppDelegate.m in Sources */, - 28C286E10D94DF7D0034E888 /* RootViewController.m in Sources */, - AB6FA5590FEB6235008DB04A /* APYahooDataPullerGraph.m in Sources */, - AB4913C80FECC2B8008A08AB /* APYahooDataPuller.m in Sources */, - AB4913C90FECC2B8008A08AB /* NSDictionary+APFinancialData.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 1D6058940D05DD3E006BFB54 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = C3CA9B5B19E203B2008DF7A3 /* CorePlotWarnings.xcconfig */; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; - CLANG_ENABLE_OBJC_ARC = YES; - CODE_SIGN_IDENTITY = "iPhone Developer"; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - GCC_DYNAMIC_NO_PIC = NO; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = StockPlot_Prefix.pch; - HEADER_SEARCH_PATHS = ""; - INFOPLIST_FILE = "StockPlot-Info.plist"; - PRODUCT_BUNDLE_IDENTIFIER = "org.CorePlot.${PRODUCT_NAME:identifier}"; - PRODUCT_NAME = StockPlot; - }; - name = Debug; - }; - 1D6058950D05DD3E006BFB54 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = C3CA9B5B19E203B2008DF7A3 /* CorePlotWarnings.xcconfig */; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; - CLANG_ENABLE_OBJC_ARC = YES; - CODE_SIGN_IDENTITY = "iPhone Distribution"; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution"; - COPY_PHASE_STRIP = NO; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = StockPlot_Prefix.pch; - HEADER_SEARCH_PATHS = ""; - INFOPLIST_FILE = "StockPlot-Info.plist"; - PRODUCT_BUNDLE_IDENTIFIER = "org.CorePlot.${PRODUCT_NAME:identifier}"; - PRODUCT_NAME = StockPlot; - }; - name = Release; - }; - C01FCF4F08A954540054247B /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = c99; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - HEADER_SEARCH_PATHS = ""; - IPHONEOS_DEPLOYMENT_TARGET = 6.0; - ONLY_ACTIVE_ARCH = YES; - OTHER_LDFLAGS = ( - "-all_load", - "-ObjC", - ); - SDKROOT = iphoneos; - SYMROOT = "$(SRCROOT)/../../build"; - USER_HEADER_SEARCH_PATHS = "\"${PROJECT_DIR}/../../framework\"/**"; - }; - name = Debug; - }; - C01FCF5008A954540054247B /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - GCC_C_LANGUAGE_STANDARD = c99; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - HEADER_SEARCH_PATHS = ""; - IPHONEOS_DEPLOYMENT_TARGET = 6.0; - OTHER_LDFLAGS = ( - "-all_load", - "-ObjC", - ); - SDKROOT = iphoneos; - USER_HEADER_SEARCH_PATHS = "\"${PROJECT_DIR}/../../framework\"/**"; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "StockPlot" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 1D6058940D05DD3E006BFB54 /* Debug */, - 1D6058950D05DD3E006BFB54 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - C01FCF4E08A954540054247B /* Build configuration list for PBXProject "StockPlot" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - C01FCF4F08A954540054247B /* Debug */, - C01FCF5008A954540054247B /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 29B97313FDCFA39411CA2CEA /* Project object */; -} diff --git a/examples/StockPlot/StockPlot.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/examples/StockPlot/StockPlot.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 3318309c7..000000000 --- a/examples/StockPlot/StockPlot.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/examples/StockPlot/StockPlot.xcodeproj/xcshareddata/xcschemes/StockPlot.xcscheme b/examples/StockPlot/StockPlot.xcodeproj/xcshareddata/xcschemes/StockPlot.xcscheme deleted file mode 100644 index bfea02102..000000000 --- a/examples/StockPlot/StockPlot.xcodeproj/xcshareddata/xcschemes/StockPlot.xcscheme +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/StockPlot/StockPlot/Images.xcassets/AppIcon.appiconset/Contents.json b/examples/StockPlot/StockPlot/Images.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index 340f2376e..000000000 --- a/examples/StockPlot/StockPlot/Images.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "images" : [ - { - "size" : "29x29", - "idiom" : "iphone", - "filename" : "Icon-Small.png", - "scale" : "1x" - }, - { - "size" : "29x29", - "idiom" : "iphone", - "filename" : "Icon-Small@2x.png", - "scale" : "2x" - }, - { - "size" : "40x40", - "idiom" : "iphone", - "filename" : "Icon-Spotlight-40@2x.png", - "scale" : "2x" - }, - { - "size" : "57x57", - "idiom" : "iphone", - "filename" : "Icon.png", - "scale" : "1x" - }, - { - "size" : "57x57", - "idiom" : "iphone", - "filename" : "Icon@2x.png", - "scale" : "2x" - }, - { - "size" : "60x60", - "idiom" : "iphone", - "filename" : "Icon-60@2x.png", - "scale" : "2x" - }, - { - "size" : "60x60", - "idiom" : "iphone", - "filename" : "Icon-60@3x.png", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/examples/StockPlot/StockPlot/Images.xcassets/AppIcon.appiconset/Icon-60@2x.png b/examples/StockPlot/StockPlot/Images.xcassets/AppIcon.appiconset/Icon-60@2x.png deleted file mode 100644 index 5ce9f6593..000000000 Binary files a/examples/StockPlot/StockPlot/Images.xcassets/AppIcon.appiconset/Icon-60@2x.png and /dev/null differ diff --git a/examples/StockPlot/StockPlot/Images.xcassets/AppIcon.appiconset/Icon-60@3x.png b/examples/StockPlot/StockPlot/Images.xcassets/AppIcon.appiconset/Icon-60@3x.png deleted file mode 100644 index 0786734de..000000000 Binary files a/examples/StockPlot/StockPlot/Images.xcassets/AppIcon.appiconset/Icon-60@3x.png and /dev/null differ diff --git a/examples/StockPlot/StockPlot/Images.xcassets/AppIcon.appiconset/Icon-Small.png b/examples/StockPlot/StockPlot/Images.xcassets/AppIcon.appiconset/Icon-Small.png deleted file mode 100644 index a40598c34..000000000 Binary files a/examples/StockPlot/StockPlot/Images.xcassets/AppIcon.appiconset/Icon-Small.png and /dev/null differ diff --git a/examples/StockPlot/StockPlot/Images.xcassets/AppIcon.appiconset/Icon-Small@2x.png b/examples/StockPlot/StockPlot/Images.xcassets/AppIcon.appiconset/Icon-Small@2x.png deleted file mode 100644 index e4b5c2785..000000000 Binary files a/examples/StockPlot/StockPlot/Images.xcassets/AppIcon.appiconset/Icon-Small@2x.png and /dev/null differ diff --git a/examples/StockPlot/StockPlot/Images.xcassets/AppIcon.appiconset/Icon-Spotlight-40@2x.png b/examples/StockPlot/StockPlot/Images.xcassets/AppIcon.appiconset/Icon-Spotlight-40@2x.png deleted file mode 100644 index 390cd034f..000000000 Binary files a/examples/StockPlot/StockPlot/Images.xcassets/AppIcon.appiconset/Icon-Spotlight-40@2x.png and /dev/null differ diff --git a/examples/StockPlot/StockPlot/Images.xcassets/AppIcon.appiconset/Icon.png b/examples/StockPlot/StockPlot/Images.xcassets/AppIcon.appiconset/Icon.png deleted file mode 100644 index ac669215a..000000000 Binary files a/examples/StockPlot/StockPlot/Images.xcassets/AppIcon.appiconset/Icon.png and /dev/null differ diff --git a/examples/StockPlot/StockPlot/Images.xcassets/AppIcon.appiconset/Icon@2x.png b/examples/StockPlot/StockPlot/Images.xcassets/AppIcon.appiconset/Icon@2x.png deleted file mode 100644 index dd7353607..000000000 Binary files a/examples/StockPlot/StockPlot/Images.xcassets/AppIcon.appiconset/Icon@2x.png and /dev/null differ diff --git a/examples/StockPlot/StockPlot/Images.xcassets/LaunchImage.launchimage/Contents.json b/examples/StockPlot/StockPlot/Images.xcassets/LaunchImage.launchimage/Contents.json deleted file mode 100644 index e6c8ec6a6..000000000 --- a/examples/StockPlot/StockPlot/Images.xcassets/LaunchImage.launchimage/Contents.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "images" : [ - { - "orientation" : "portrait", - "idiom" : "iphone", - "extent" : "full-screen", - "minimum-system-version" : "8.0", - "subtype" : "736h", - "scale" : "3x" - }, - { - "orientation" : "landscape", - "idiom" : "iphone", - "extent" : "full-screen", - "minimum-system-version" : "8.0", - "subtype" : "736h", - "scale" : "3x" - }, - { - "orientation" : "portrait", - "idiom" : "iphone", - "extent" : "full-screen", - "minimum-system-version" : "8.0", - "subtype" : "667h", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "iphone", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "iphone", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "subtype" : "retina4", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "iphone", - "extent" : "full-screen", - "scale" : "1x" - }, - { - "orientation" : "portrait", - "idiom" : "iphone", - "extent" : "full-screen", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "iphone", - "extent" : "full-screen", - "subtype" : "retina4", - "scale" : "2x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/examples/StockPlot/StockPlot_Prefix.pch b/examples/StockPlot/StockPlot_Prefix.pch deleted file mode 100644 index d6179e313..000000000 --- a/examples/StockPlot/StockPlot_Prefix.pch +++ /dev/null @@ -1,14 +0,0 @@ -// -// Prefix header for all source files of the 'StockPlot' target in the 'StockPlot' project -// -#import - -#ifndef __IPHONE_3_0 -#warning "This project uses features only available in iPhone SDK 3.0 and later." -#endif - - -#ifdef __OBJC__ - #import - #import -#endif diff --git a/examples/StockPlot/YHOO.plist b/examples/StockPlot/YHOO.plist deleted file mode 100644 index 08a118eac..000000000 --- a/examples/StockPlot/YHOO.plist +++ /dev/null @@ -1,1107 +0,0 @@ - - - - - endDate - 2009-06-19T06:53:47Z - financialData - - - adjClose - 15.34 - close - 15.34 - date - 2009-06-18T04:00:00Z - high - 15.64 - low - 15.23 - open - 15.62 - volume - 16185400 - - - adjClose - 15.6 - close - 15.6 - date - 2009-06-17T04:00:00Z - high - 16.03 - low - 15.46 - open - 15.91 - volume - 16159600 - - - adjClose - 15.96 - close - 15.96 - date - 2009-06-16T04:00:00Z - high - 16.38 - low - 15.9 - open - 16.33 - volume - 15116000 - - - adjClose - 16.4 - close - 16.4 - date - 2009-06-15T04:00:00Z - high - 16.68 - low - 16.13 - open - 16.56 - volume - 23251700 - - - adjClose - 16.4 - close - 16.4 - date - 2009-06-12T04:00:00Z - high - 16.47 - low - 16.1 - open - 16.17 - volume - 16962900 - - - adjClose - 16.19 - close - 16.19 - date - 2009-06-11T04:00:00Z - high - 16.46 - low - 16.15 - open - 16.26 - volume - 14787400 - - - adjClose - 16.32 - close - 16.32 - date - 2009-06-10T04:00:00Z - high - 16.72 - low - 16.1 - open - 16.7 - volume - 15761000 - - - adjClose - 16.4 - close - 16.4 - date - 2009-06-09T04:00:00Z - high - 16.5 - low - 16.18 - open - 16.23 - volume - 13083200 - - - adjClose - 16.19 - close - 16.19 - date - 2009-06-08T04:00:00Z - high - 16.49 - low - 16.04 - open - 16.47 - volume - 13680700 - - - adjClose - 16.64 - close - 16.64 - date - 2009-06-05T04:00:00Z - high - 16.99 - low - 16.3 - open - 16.77 - volume - 17311400 - - - adjClose - 16.65 - close - 16.65 - date - 2009-06-04T04:00:00Z - high - 16.71 - low - 16.04 - open - 16.4 - volume - 19001400 - - - adjClose - 16.3 - close - 16.3 - date - 2009-06-03T04:00:00Z - high - 16.5 - low - 15.67 - open - 16.5 - volume - 26358100 - - - adjClose - 16.62 - close - 16.62 - date - 2009-06-02T04:00:00Z - high - 16.75 - low - 16.25 - open - 16.6 - volume - 15286700 - - - adjClose - 16.58 - close - 16.58 - date - 2009-06-01T04:00:00Z - high - 16.65 - low - 16.13 - open - 16.17 - volume - 27926100 - - - adjClose - 15.84 - close - 15.84 - date - 2009-05-29T04:00:00Z - high - 15.84 - low - 15.11 - open - 15.19 - volume - 29557500 - - - adjClose - 15.09 - close - 15.09 - date - 2009-05-28T04:00:00Z - high - 15.24 - low - 14.69 - open - 15.09 - volume - 19131600 - - - adjClose - 14.94 - close - 14.94 - date - 2009-05-27T04:00:00Z - high - 15.53 - low - 14.88 - open - 15.27 - volume - 18977400 - - - adjClose - 15.28 - close - 15.28 - date - 2009-05-26T04:00:00Z - high - 15.44 - low - 14.67 - open - 14.68 - volume - 19953000 - - - adjClose - 14.98 - close - 14.98 - date - 2009-05-22T04:00:00Z - high - 15.17 - low - 14.75 - open - 14.89 - volume - 19150500 - - - adjClose - 14.87 - close - 14.87 - date - 2009-05-21T04:00:00Z - high - 15.12 - low - 14.62 - open - 14.92 - volume - 15186800 - - - adjClose - 14.96 - close - 14.96 - date - 2009-05-20T04:00:00Z - high - 15.31 - low - 14.8 - open - 15.08 - volume - 15781600 - - - adjClose - 15.18 - close - 15.18 - date - 2009-05-19T04:00:00Z - high - 15.34 - low - 15.02 - open - 15.06 - volume - 13676000 - - - adjClose - 15.17 - close - 15.17 - date - 2009-05-18T04:00:00Z - high - 15.18 - low - 14.74 - open - 15.1 - volume - 18629500 - - - adjClose - 14.91 - close - 14.91 - date - 2009-05-15T04:00:00Z - high - 15.1 - low - 14.86 - open - 15 - volume - 22525900 - - - adjClose - 14.76 - close - 14.76 - date - 2009-05-14T04:00:00Z - high - 14.86 - low - 14.4 - open - 14.5 - volume - 20841800 - - - adjClose - 14.52 - close - 14.52 - date - 2009-05-13T04:00:00Z - high - 14.95 - low - 14.5 - open - 14.92 - volume - 23585400 - - - adjClose - 15.1 - close - 15.1 - date - 2009-05-12T04:00:00Z - high - 15.5 - low - 14.9 - open - 15.5 - volume - 31403300 - - - adjClose - 15.54 - close - 15.54 - date - 2009-05-11T04:00:00Z - high - 15.83 - low - 14.81 - open - 14.9 - volume - 39492400 - - - adjClose - 15.15 - close - 15.15 - date - 2009-05-08T04:00:00Z - high - 15.3 - low - 14.7 - open - 14.88 - volume - 22461200 - - - adjClose - 14.8 - close - 14.8 - date - 2009-05-07T04:00:00Z - high - 15.1 - low - 14.38 - open - 15.03 - volume - 24328500 - - - adjClose - 14.85 - close - 14.85 - date - 2009-05-06T04:00:00Z - high - 15 - low - 14.52 - open - 14.8 - volume - 19105800 - - - adjClose - 14.74 - close - 14.74 - date - 2009-05-05T04:00:00Z - high - 14.99 - low - 14.18 - open - 14.55 - volume - 35233200 - - - adjClose - 14.18 - close - 14.18 - date - 2009-05-04T04:00:00Z - high - 14.25 - low - 13.96 - open - 14.2 - volume - 25094600 - - - adjClose - 14.14 - close - 14.14 - date - 2009-05-01T04:00:00Z - high - 14.5 - low - 13.91 - open - 14.5 - volume - 23721700 - - - adjClose - 14.29 - close - 14.29 - date - 2009-04-30T04:00:00Z - high - 14.6 - low - 14.12 - open - 14.12 - volume - 25883300 - - - adjClose - 14.02 - close - 14.02 - date - 2009-04-29T04:00:00Z - high - 14.35 - low - 13.7 - open - 13.7 - volume - 16570900 - - - adjClose - 13.64 - close - 13.64 - date - 2009-04-28T04:00:00Z - high - 14.05 - low - 13.6 - open - 13.74 - volume - 18856500 - - - adjClose - 13.89 - close - 13.89 - date - 2009-04-27T04:00:00Z - high - 14.55 - low - 13.88 - open - 14.48 - volume - 22640600 - - - adjClose - 14.73 - close - 14.73 - date - 2009-04-24T04:00:00Z - high - 14.94 - low - 14.36 - open - 14.79 - volume - 25803000 - - - adjClose - 14.55 - close - 14.55 - date - 2009-04-23T04:00:00Z - high - 14.74 - low - 14.11 - open - 14.56 - volume - 32943200 - - - adjClose - 14.48 - close - 14.48 - date - 2009-04-22T04:00:00Z - high - 15.39 - low - 14.41 - open - 14.62 - volume - 65407800 - - - adjClose - 14.38 - close - 14.38 - date - 2009-04-21T04:00:00Z - high - 14.59 - low - 13.71 - open - 13.94 - volume - 54237700 - - - adjClose - 13.66 - close - 13.66 - date - 2009-04-20T04:00:00Z - high - 14.25 - low - 13.6 - open - 14.16 - volume - 13470500 - - - adjClose - 14.39 - close - 14.39 - date - 2009-04-17T04:00:00Z - high - 14.52 - low - 14.03 - open - 14.43 - volume - 19800400 - - - adjClose - 14.43 - close - 14.43 - date - 2009-04-16T04:00:00Z - high - 14.53 - low - 14.05 - open - 14.15 - volume - 19156500 - - - adjClose - 14.02 - close - 14.02 - date - 2009-04-15T04:00:00Z - high - 14.09 - low - 13.77 - open - 13.93 - volume - 12383200 - - - adjClose - 14.07 - close - 14.07 - date - 2009-04-14T04:00:00Z - high - 14.42 - low - 14 - open - 14.4 - volume - 15151700 - - - adjClose - 14.42 - close - 14.42 - date - 2009-04-13T04:00:00Z - high - 14.54 - low - 13.86 - open - 14.02 - volume - 35067600 - - - adjClose - 13.47 - close - 13.47 - date - 2009-04-09T04:00:00Z - high - 13.59 - low - 13.07 - open - 13.14 - volume - 17285800 - - - adjClose - 12.92 - close - 12.92 - date - 2009-04-08T04:00:00Z - high - 13.01 - low - 12.75 - open - 12.9 - volume - 11241000 - - - adjClose - 12.81 - close - 12.81 - date - 2009-04-07T04:00:00Z - high - 13.1 - low - 12.68 - open - 13 - volume - 12306400 - - - adjClose - 13.23 - close - 13.23 - date - 2009-04-06T04:00:00Z - high - 13.24 - low - 12.99 - open - 13.08 - volume - 11935700 - - - adjClose - 13.34 - close - 13.34 - date - 2009-04-03T04:00:00Z - high - 13.39 - low - 12.78 - open - 12.95 - volume - 18534900 - - - adjClose - 12.95 - close - 12.95 - date - 2009-04-02T04:00:00Z - high - 13.14 - low - 12.8 - open - 13.04 - volume - 28823100 - - - adjClose - 12.75 - close - 12.75 - date - 2009-04-01T04:00:00Z - high - 13.12 - low - 12.6 - open - 12.7 - volume - 14540400 - - - adjClose - 12.81 - close - 12.81 - date - 2009-03-31T04:00:00Z - high - 13.1 - low - 12.67 - open - 12.76 - volume - 11882100 - - - adjClose - 12.7 - close - 12.7 - date - 2009-03-30T04:00:00Z - high - 13.14 - low - 12.51 - open - 12.93 - volume - 16558800 - - - adjClose - 13.18 - close - 13.18 - date - 2009-03-27T04:00:00Z - high - 13.61 - low - 13.12 - open - 13.17 - volume - 22426200 - - - adjClose - 13.35 - close - 13.35 - date - 2009-03-26T04:00:00Z - high - 13.61 - low - 13 - open - 13.55 - volume - 24223400 - - - adjClose - 13.55 - close - 13.55 - date - 2009-03-25T04:00:00Z - high - 13.88 - low - 13.35 - open - 13.69 - volume - 16746400 - - - adjClose - 13.63 - close - 13.63 - date - 2009-03-24T04:00:00Z - high - 14.02 - low - 13.56 - open - 13.98 - volume - 17293600 - - - adjClose - 14.09 - close - 14.09 - date - 2009-03-23T04:00:00Z - high - 14.12 - low - 13.62 - open - 13.79 - volume - 18200000 - - - adjClose - 13.6 - close - 13.6 - date - 2009-03-20T04:00:00Z - high - 13.87 - low - 13.51 - open - 13.63 - volume - 22079300 - - - adjClose - 13.74 - close - 13.74 - date - 2009-03-19T04:00:00Z - high - 14.14 - low - 13.61 - open - 13.68 - volume - 25954300 - - - adjClose - 13.42 - close - 13.42 - date - 2009-03-18T04:00:00Z - high - 13.95 - low - 13.23 - open - 13.81 - volume - 26324300 - - - adjClose - 13.99 - close - 13.99 - date - 2009-03-17T04:00:00Z - high - 14.04 - low - 13.22 - open - 13.35 - volume - 16719400 - - - adjClose - 13.22 - close - 13.22 - date - 2009-03-16T04:00:00Z - high - 13.66 - low - 13.2 - open - 13.66 - volume - 19448800 - - - adjClose - 13.51 - close - 13.51 - date - 2009-03-13T04:00:00Z - high - 13.64 - low - 13.27 - open - 13.58 - volume - 12522600 - - - overallHigh - 16.99 - overallLow - 12.51 - startDate - 2009-03-13T06:53:47Z - symbol - YHOO - - diff --git a/examples/StockPlot/caution.png b/examples/StockPlot/caution.png deleted file mode 100644 index ec4b70669..000000000 Binary files a/examples/StockPlot/caution.png and /dev/null differ diff --git a/examples/StockPlot/main.m b/examples/StockPlot/main.m deleted file mode 100644 index 3105528ad..000000000 --- a/examples/StockPlot/main.m +++ /dev/null @@ -1,18 +0,0 @@ -// -// main.m -// StockPlot -// -// Created by Jonathan Saggau on 6/19/09. -// Copyright __MyCompanyName__ 2009. All rights reserved. -// - -#import - -int main(int argc, char *argv[]) -{ - @autoreleasepool { - int retVal = UIApplicationMain(argc, argv, nil, nil); - - return retVal; - } -} diff --git a/framework/CocoaPods/CorePlot.h b/framework/CocoaPods/CorePlot.h index dafae2ff7..c3660a97e 100644 --- a/framework/CocoaPods/CorePlot.h +++ b/framework/CocoaPods/CorePlot.h @@ -38,19 +38,19 @@ #import "CPTLineCap.h" #import "CPTLineStyle.h" #import "CPTMutableLineStyle.h" -#import "CPTMutableNumericData.h" #import "CPTMutableNumericData+TypeConversion.h" +#import "CPTMutableNumericData.h" #import "CPTMutablePlotRange.h" #import "CPTMutableShadow.h" #import "CPTMutableTextStyle.h" -#import "CPTNumericData.h" #import "CPTNumericData+TypeConversion.h" +#import "CPTNumericData.h" #import "CPTNumericDataType.h" +#import "CPTPathExtensions.h" #import "CPTPieChart.h" +#import "CPTPlatformSpecificCategories.h" #import "CPTPlatformSpecificDefines.h" #import "CPTPlatformSpecificFunctions.h" -#import "CPTPlatformSpecificCategories.h" -#import "CPTPathExtensions.h" #import "CPTPlot.h" #import "CPTPlotArea.h" #import "CPTPlotAreaFrame.h" diff --git a/framework/CorePlot-CocoaTouch.h b/framework/CorePlot-CocoaTouch.h index 9be2b42d5..5b8bd9349 100644 --- a/framework/CorePlot-CocoaTouch.h +++ b/framework/CorePlot-CocoaTouch.h @@ -32,19 +32,19 @@ #import "CPTLineCap.h" #import "CPTLineStyle.h" #import "CPTMutableLineStyle.h" -#import "CPTMutableNumericData.h" #import "CPTMutableNumericData+TypeConversion.h" +#import "CPTMutableNumericData.h" #import "CPTMutablePlotRange.h" #import "CPTMutableShadow.h" #import "CPTMutableTextStyle.h" -#import "CPTNumericData.h" #import "CPTNumericData+TypeConversion.h" +#import "CPTNumericData.h" #import "CPTNumericDataType.h" +#import "CPTPathExtensions.h" #import "CPTPieChart.h" +#import "CPTPlatformSpecificCategories.h" #import "CPTPlatformSpecificDefines.h" #import "CPTPlatformSpecificFunctions.h" -#import "CPTPlatformSpecificCategories.h" -#import "CPTPathExtensions.h" #import "CPTPlot.h" #import "CPTPlotArea.h" #import "CPTPlotAreaFrame.h" diff --git a/framework/CorePlot.xcodeproj/project.pbxproj b/framework/CorePlot.xcodeproj/project.pbxproj index 114400ad1..f6971f390 100644 --- a/framework/CorePlot.xcodeproj/project.pbxproj +++ b/framework/CorePlot.xcodeproj/project.pbxproj @@ -188,7 +188,6 @@ BC74A33110FC402600E7E90D /* CPTPieChart.m in Sources */ = {isa = PBXBuildFile; fileRef = BC74A32F10FC402600E7E90D /* CPTPieChart.m */; }; BC79F1360FD1CD6600510976 /* CPTGraphHostingView.h in Headers */ = {isa = PBXBuildFile; fileRef = BC79F1340FD1CD6600510976 /* CPTGraphHostingView.h */; settings = {ATTRIBUTES = (Public, ); }; }; BC79F1370FD1CD6600510976 /* CPTGraphHostingView.m in Sources */ = {isa = PBXBuildFile; fileRef = BC79F1350FD1CD6600510976 /* CPTGraphHostingView.m */; }; - BC89A64110239D1D009D5261 /* CorePlotProbes.d in Sources */ = {isa = PBXBuildFile; fileRef = BC89A64010239D1D009D5261 /* CorePlotProbes.d */; }; BCFC7C3710921FDB00DAECAA /* CPTAxisTitle.h in Headers */ = {isa = PBXBuildFile; fileRef = BCFC7C3510921FDB00DAECAA /* CPTAxisTitle.h */; settings = {ATTRIBUTES = (Public, ); }; }; BCFC7C3810921FDB00DAECAA /* CPTAxisTitle.m in Sources */ = {isa = PBXBuildFile; fileRef = BCFC7C3610921FDB00DAECAA /* CPTAxisTitle.m */; }; C30550ED1399BE5400E0151F /* CPTLegendEntry.h in Headers */ = {isa = PBXBuildFile; fileRef = C30550EB1399BE5400E0151F /* CPTLegendEntry.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -197,10 +196,8 @@ C318F4AE11EA188700595FF9 /* CPTLimitBand.m in Sources */ = {isa = PBXBuildFile; fileRef = C318F4AC11EA188700595FF9 /* CPTLimitBand.m */; }; C3226A521A69F6DA00F77249 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3226A511A69F6DA00F77249 /* QuartzCore.framework */; }; C3226A541A69F6DF00F77249 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3226A531A69F6DF00F77249 /* UIKit.framework */; }; - C3226A561A69F6F000F77249 /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3226A551A69F6F000F77249 /* Accelerate.framework */; }; C3226A581A69F6FA00F77249 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3226A571A69F6FA00F77249 /* CoreGraphics.framework */; }; C3226A5C1A69F72900F77249 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3226A531A69F6DF00F77249 /* UIKit.framework */; }; - C3226A5D1A69F72F00F77249 /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3226A551A69F6F000F77249 /* Accelerate.framework */; }; C3226A5E1A69F73800F77249 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3226A511A69F6DA00F77249 /* QuartzCore.framework */; }; C3226A5F1A69F75400F77249 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3226A571A69F6FA00F77249 /* CoreGraphics.framework */; }; C3286C0015D8740100A436A8 /* _CPTMaskLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = C3286BFE15D8740100A436A8 /* _CPTMaskLayer.h */; settings = {ATTRIBUTES = (); }; }; @@ -264,7 +261,6 @@ C37EA5DF1BC83F2A0091C8F7 /* _CPTDarkGradientTheme.m in Sources */ = {isa = PBXBuildFile; fileRef = 0772C92E0FE2F89000EC4C16 /* _CPTDarkGradientTheme.m */; }; C37EA5E01BC83F2A0091C8F7 /* _CPTPlainBlackTheme.m in Sources */ = {isa = PBXBuildFile; fileRef = BC55022D10059F22005DF982 /* _CPTPlainBlackTheme.m */; }; C37EA5E11BC83F2A0091C8F7 /* CPTNumericData.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C97EEFB104D80C400B554F9 /* CPTNumericData.m */; }; - C37EA5E21BC83F2A0091C8F7 /* CorePlotProbes.d in Sources */ = {isa = PBXBuildFile; fileRef = BC89A64010239D1D009D5261 /* CorePlotProbes.d */; }; C37EA5E31BC83F2A0091C8F7 /* CPTXYAxisSet.m in Sources */ = {isa = PBXBuildFile; fileRef = 07975C420F3B816600DE45DC /* CPTXYAxisSet.m */; }; C37EA5E41BC83F2A0091C8F7 /* CPTLimitBand.m in Sources */ = {isa = PBXBuildFile; fileRef = C318F4AC11EA188700595FF9 /* CPTLimitBand.m */; }; C37EA5E51BC83F2A0091C8F7 /* CPTGridLines.m in Sources */ = {isa = PBXBuildFile; fileRef = C32B391710AA4C78000470D4 /* CPTGridLines.m */; }; @@ -335,7 +331,6 @@ C37EA6261BC83F2A0091C8F7 /* _CPTConstraintsFixed.m in Sources */ = {isa = PBXBuildFile; fileRef = C3CCA03A13E8D85800CE6DB1 /* _CPTConstraintsFixed.m */; }; C37EA6271BC83F2A0091C8F7 /* CPTAxis.m in Sources */ = {isa = PBXBuildFile; fileRef = 07975C480F3B818800DE45DC /* CPTAxis.m */; }; C37EA6281BC83F2A0091C8F7 /* CPTMutableTextStyle.m in Sources */ = {isa = PBXBuildFile; fileRef = 07C4679A0FE1A24C00299939 /* CPTMutableTextStyle.m */; }; - C37EA62A1BC83F2A0091C8F7 /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3226A551A69F6F000F77249 /* Accelerate.framework */; }; C37EA62B1BC83F2A0091C8F7 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3226A571A69F6FA00F77249 /* CoreGraphics.framework */; }; C37EA62C1BC83F2A0091C8F7 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3226A511A69F6DA00F77249 /* QuartzCore.framework */; }; C37EA62D1BC83F2A0091C8F7 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3226A531A69F6DF00F77249 /* UIKit.framework */; }; @@ -465,8 +460,6 @@ C38A09D21A461C1300D45436 /* CPTTestCase.m in Sources */ = {isa = PBXBuildFile; fileRef = 0730F64D109494D100E95162 /* CPTTestCase.m */; }; C38A09D31A461C1800D45436 /* CPTDataSourceTestCase.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C9A745E0FB24C7200918464 /* CPTDataSourceTestCase.m */; }; C38A09D41A461C1900D45436 /* CPTDataSourceTestCase.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C9A745E0FB24C7200918464 /* CPTDataSourceTestCase.m */; }; - C38A09D51A461C1E00D45436 /* CorePlotProbes.d in Sources */ = {isa = PBXBuildFile; fileRef = BC89A64010239D1D009D5261 /* CorePlotProbes.d */; }; - C38A09D61A461C2B00D45436 /* CorePlotProbes.d in Sources */ = {isa = PBXBuildFile; fileRef = BC89A64010239D1D009D5261 /* CorePlotProbes.d */; }; C38A09D81A461C5800D45436 /* CPTNumericDataType.h in Headers */ = {isa = PBXBuildFile; fileRef = 4C97EEFC104D80C400B554F9 /* CPTNumericDataType.h */; settings = {ATTRIBUTES = (Public, ); }; }; C38A09D91A461C6B00D45436 /* CPTNumericDataType.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C97EEFD104D80C400B554F9 /* CPTNumericDataType.m */; }; C38A09DA1A461C6C00D45436 /* CPTNumericDataType.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C97EEFD104D80C400B554F9 /* CPTNumericDataType.m */; }; @@ -849,12 +842,10 @@ C3D979BB13D2347400145DFF /* CPTFillTests.m in Sources */ = {isa = PBXBuildFile; fileRef = C3D979BA13D2347300145DFF /* CPTFillTests.m */; }; C3DA34CC107AD7710051DA02 /* _CPTXYTheme.m in Sources */ = {isa = PBXBuildFile; fileRef = C3DA34CA107AD7710051DA02 /* _CPTXYTheme.m */; }; C3DA34CD107AD7710051DA02 /* _CPTXYTheme.h in Headers */ = {isa = PBXBuildFile; fileRef = C3DA34CB107AD7710051DA02 /* _CPTXYTheme.h */; settings = {ATTRIBUTES = (Private, ); }; }; - C3EE4E681A6C13260098F4E6 /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3226A551A69F6F000F77249 /* Accelerate.framework */; }; C3EE4E691A6C133D0098F4E6 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3226A511A69F6DA00F77249 /* QuartzCore.framework */; }; C3EE4E6A1A6C134B0098F4E6 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3226A571A69F6FA00F77249 /* CoreGraphics.framework */; }; C3EE4E6B1A6C13560098F4E6 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3226A531A69F6DF00F77249 /* UIKit.framework */; }; C3EE4E6E1A6C15890098F4E6 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 07BF0D630F2B70B8002FCEA7 /* QuartzCore.framework */; }; - C3EE4E6F1A6C15920098F4E6 /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3BB7D1416322F7E00BC9515 /* Accelerate.framework */; }; C3EE4E981A6C1E890098F4E6 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3EE4E971A6C1E890098F4E6 /* Cocoa.framework */; }; C3EE4E9A1A6C1F770098F4E6 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 07BF0D630F2B70B8002FCEA7 /* QuartzCore.framework */; }; C3EE4E9B1A6C1F8A0098F4E6 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3EE4E971A6C1E890098F4E6 /* Cocoa.framework */; }; @@ -998,7 +989,6 @@ 07FCF2C5115B54AE00E46606 /* _CPTSlateTheme.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = _CPTSlateTheme.m; sourceTree = ""; }; 07FEBD60110B7E8B00E44D37 /* CPTScatterPlotTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTScatterPlotTests.h; sourceTree = ""; }; 07FEBD61110B7E8B00E44D37 /* CPTScatterPlotTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CPTScatterPlotTests.m; sourceTree = ""; }; - 089C1667FE841158C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; 32484B3F0F530E8B002151AD /* CPTPlotRange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = CPTPlotRange.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; 32484B400F530E8B002151AD /* CPTPlotRange.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = CPTPlotRange.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; 32DBCF5E0370ADEE00C91783 /* CorePlot_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CorePlot_Prefix.pch; sourceTree = ""; }; @@ -1024,12 +1014,11 @@ 4CD7E7E50F4B4F8200F9BCBB /* CPTTextLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = CPTTextLayer.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; 4CD7E7E60F4B4F8200F9BCBB /* CPTTextLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = CPTTextLayer.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; 4CD7E7EA0F4B4F9600F9BCBB /* CPTLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = CPTLayer.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - 4CD7E7EB0F4B4F9600F9BCBB /* CPTLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = CPTLayer.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; + 4CD7E7EB0F4B4F9600F9BCBB /* CPTLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = CPTLayer.m; sourceTree = ""; }; 4CD7E7EE0F4B4FA700F9BCBB /* NSDecimalNumberExtensions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSDecimalNumberExtensions.h; sourceTree = ""; }; 4CD7E7EF0F4B4FA700F9BCBB /* NSDecimalNumberExtensions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSDecimalNumberExtensions.m; sourceTree = ""; }; 4CD7E9620F4B625900F9BCBB /* CPTUtilitiesTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTUtilitiesTests.h; sourceTree = ""; }; 4CD7E9630F4B625900F9BCBB /* CPTUtilitiesTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CPTUtilitiesTests.m; sourceTree = ""; }; - 8DC2EF5A0486A6940098B216 /* CorePlot-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "CorePlot-Info.plist"; path = "Info/CorePlot-Info.plist"; sourceTree = ""; }; 8DC2EF5B0486A6940098B216 /* CorePlot.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = CorePlot.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 9021E5690FC69B2900443472 /* doxygen.config */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; lineEnding = 0; name = doxygen.config; path = ../documentation/doxygen/doxygen.config; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = ""; }; 906156BC0F375598001B75FC /* CPTLineStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = CPTLineStyle.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; @@ -1055,7 +1044,6 @@ BC74A32F10FC402600E7E90D /* CPTPieChart.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = CPTPieChart.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; BC79F1340FD1CD6600510976 /* CPTGraphHostingView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTGraphHostingView.h; sourceTree = ""; }; BC79F1350FD1CD6600510976 /* CPTGraphHostingView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = CPTGraphHostingView.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; - BC89A64010239D1D009D5261 /* CorePlotProbes.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; name = CorePlotProbes.d; path = TestResources/CorePlotProbes.d; sourceTree = SOURCE_ROOT; }; BCFC7C3510921FDB00DAECAA /* CPTAxisTitle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTAxisTitle.h; sourceTree = ""; }; BCFC7C3610921FDB00DAECAA /* CPTAxisTitle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = CPTAxisTitle.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; C30550EB1399BE5400E0151F /* CPTLegendEntry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = CPTLegendEntry.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; @@ -1067,11 +1055,6 @@ C3226A451A69ED0900F77249 /* doxygen touch.config */ = {isa = PBXFileReference; lastKnownFileType = text; lineEnding = 0; name = "doxygen touch.config"; path = "../documentation/doxygen/doxygen touch.config"; sourceTree = ""; xcLanguageSpecificationIdentifier = ""; }; C3226A461A69ED1F00F77249 /* doxygen-cocoa-touch-tags.xml */ = {isa = PBXFileReference; lastKnownFileType = text.xml; name = "doxygen-cocoa-touch-tags.xml"; path = "../documentation/doxygen/doxygen-cocoa-touch-tags.xml"; sourceTree = ""; }; C3226A471A69EE9200F77249 /* CorePlot-CocoaTouch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "CorePlot-CocoaTouch.h"; sourceTree = ""; }; - C3226A4C1A69F07600F77249 /* CorePlotTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = "CorePlotTests-Info.plist"; path = "Info/CorePlotTests-Info.plist"; sourceTree = SOURCE_ROOT; }; - C3226A4D1A69F09A00F77249 /* CorePlot-iOSTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = "CorePlot-iOSTests-Info.plist"; path = "Info/CorePlot-iOSTests-Info.plist"; sourceTree = SOURCE_ROOT; }; - C3226A4E1A69F0AA00F77249 /* CorePlot-CocoaTouchTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = "CorePlot-CocoaTouchTests-Info.plist"; path = "Info/CorePlot-CocoaTouchTests-Info.plist"; sourceTree = SOURCE_ROOT; }; - C3226A4F1A69F18C00F77249 /* CorePlot-CocoaTouch-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = "CorePlot-CocoaTouch-Info.plist"; path = "Info/CorePlot-CocoaTouch-Info.plist"; sourceTree = ""; }; - C3226A501A69F1A700F77249 /* CorePlot-iOS-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = "CorePlot-iOS-Info.plist"; path = "Info/CorePlot-iOS-Info.plist"; sourceTree = ""; }; C3226A511A69F6DA00F77249 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk/System/Library/Frameworks/QuartzCore.framework; sourceTree = DEVELOPER_DIR; }; C3226A531A69F6DF00F77249 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk/System/Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; }; C3226A551A69F6F000F77249 /* Accelerate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Accelerate.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk/System/Library/Frameworks/Accelerate.framework; sourceTree = DEVELOPER_DIR; }; @@ -1095,6 +1078,10 @@ C342601D0FAE096C00072842 /* _CPTFillImage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = _CPTFillImage.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; C342601E0FAE096C00072842 /* _CPTFillGradient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = _CPTFillGradient.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; C342601F0FAE096C00072842 /* CPTFill.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = CPTFill.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; + C3490DF120E028CF0089F309 /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Base; path = "Base.lproj/CorePlot-Info.plist"; sourceTree = ""; }; + C3490DF320E028D30089F309 /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Base; path = "Base.lproj/CorePlot-CocoaTouch-Info.plist"; sourceTree = ""; }; + C3490DF520E028D80089F309 /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Base; path = "Base.lproj/CorePlot-iOS-Info.plist"; sourceTree = ""; }; + C3490DF720E028DC0089F309 /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Base; path = "Base.lproj/CorePlot-tvOS-Info.plist"; sourceTree = ""; }; C349DCB2151AAFBF00BFD6A7 /* CPTCalendarFormatter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = CPTCalendarFormatter.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; C349DCB3151AAFBF00BFD6A7 /* CPTCalendarFormatter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = CPTCalendarFormatter.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; C34AFE6911021D010041675A /* CPTPlotSymbol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = CPTPlotSymbol.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; @@ -1102,6 +1089,7 @@ C34BF5BA10A67633007F0894 /* CPTPlotArea.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTPlotArea.h; sourceTree = ""; }; C34BF5BB10A67633007F0894 /* CPTPlotArea.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = CPTPlotArea.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; C34F570D19D8CE5500446248 /* CorePlotWarnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = CorePlotWarnings.xcconfig; path = xcconfig/CorePlotWarnings.xcconfig; sourceTree = ""; }; + C3564CBD22A2D0E1000A54C9 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; C36468A80FE5533F0064B186 /* CPTTextStyleTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTTextStyleTests.h; sourceTree = ""; }; C36468A90FE5533F0064B186 /* CPTTextStyleTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CPTTextStyleTests.m; sourceTree = ""; }; C36E89B811EE7F97003DE309 /* CPTPlotRangeTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTPlotRangeTests.h; sourceTree = ""; }; @@ -1109,10 +1097,12 @@ C377B3B91C122AA600891DF8 /* CPTCalendarFormatterTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTCalendarFormatterTests.h; sourceTree = ""; }; C377B3BA1C122AA600891DF8 /* CPTCalendarFormatterTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CPTCalendarFormatterTests.m; sourceTree = ""; }; C3791D07191D4C4C001EC514 /* CPTImagePlatformSpecific.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; name = CPTImagePlatformSpecific.m; path = MacOnly/CPTImagePlatformSpecific.m; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; + C37A406320E02B9D00C4FF48 /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Base; path = "Base.lproj/CorePlot-tvOSTests-Info.plist"; sourceTree = ""; }; + C37A406520E02BA100C4FF48 /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Base; path = "Base.lproj/CorePlot-CocoaTouchTests-Info.plist"; sourceTree = ""; }; + C37A406720E02BA500C4FF48 /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Base; path = "Base.lproj/CorePlot-iOSTests-Info.plist"; sourceTree = ""; }; + C37A406920E02BE900C4FF48 /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Base; path = "Base.lproj/CorePlotTests-Info.plist"; sourceTree = ""; }; C37EA6921BC83F2A0091C8F7 /* CorePlot.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = CorePlot.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - C37EA6931BC83F2A0091C8F7 /* CorePlot-tvOS-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = "CorePlot-tvOS-Info.plist"; path = "/Users/eskroch/Projects/Core Plot/framework/Info/CorePlot-tvOS-Info.plist"; sourceTree = ""; }; C37EA6B71BC83F2D0091C8F7 /* UnitTests tvOS.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "UnitTests tvOS.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; - C37EA6B81BC83F2E0091C8F7 /* CorePlot-tvOSTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = "CorePlot-tvOSTests-Info.plist"; path = "/Users/eskroch/Projects/Core Plot/framework/Info/CorePlot-tvOSTests-Info.plist"; sourceTree = ""; }; C38A09781A46185200D45436 /* CorePlot.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = CorePlot.framework; sourceTree = BUILT_PRODUCTS_DIR; }; C38A09821A46185300D45436 /* UnitTests iOS.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "UnitTests iOS.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; C38A09BA1A4619A900D45436 /* libCorePlot-CocoaTouch.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libCorePlot-CocoaTouch.a"; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -1223,7 +1213,6 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - C3EE4E6F1A6C15920098F4E6 /* Accelerate.framework in Frameworks */, C3EE4E981A6C1E890098F4E6 /* Cocoa.framework in Frameworks */, C3EE4E6E1A6C15890098F4E6 /* QuartzCore.framework in Frameworks */, ); @@ -1233,7 +1222,6 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - C37EA62A1BC83F2A0091C8F7 /* Accelerate.framework in Frameworks */, C37EA62B1BC83F2A0091C8F7 /* CoreGraphics.framework in Frameworks */, C37EA62C1BC83F2A0091C8F7 /* QuartzCore.framework in Frameworks */, C37EA62D1BC83F2A0091C8F7 /* UIKit.framework in Frameworks */, @@ -1253,7 +1241,6 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - C3226A5D1A69F72F00F77249 /* Accelerate.framework in Frameworks */, C3226A5F1A69F75400F77249 /* CoreGraphics.framework in Frameworks */, C3226A5E1A69F73800F77249 /* QuartzCore.framework in Frameworks */, C3226A5C1A69F72900F77249 /* UIKit.framework in Frameworks */, @@ -1273,7 +1260,6 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - C3226A561A69F6F000F77249 /* Accelerate.framework in Frameworks */, C3226A581A69F6FA00F77249 /* CoreGraphics.framework in Frameworks */, C3226A521A69F6DA00F77249 /* QuartzCore.framework in Frameworks */, C3226A541A69F6DF00F77249 /* UIKit.framework in Frameworks */, @@ -1284,7 +1270,6 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - C3EE4E681A6C13260098F4E6 /* Accelerate.framework in Frameworks */, C3EE4E6A1A6C134B0098F4E6 /* CoreGraphics.framework in Frameworks */, C3EE4E691A6C133D0098F4E6 /* QuartzCore.framework in Frameworks */, C3EE4E6B1A6C13560098F4E6 /* UIKit.framework in Frameworks */, @@ -1633,10 +1618,10 @@ isa = PBXGroup; children = ( 071F3CB810FBAB5900D0A7B6 /* License.txt */, - 8DC2EF5A0486A6940098B216 /* CorePlot-Info.plist */, - C3226A4F1A69F18C00F77249 /* CorePlot-CocoaTouch-Info.plist */, - C3226A501A69F1A700F77249 /* CorePlot-iOS-Info.plist */, - C37EA6931BC83F2A0091C8F7 /* CorePlot-tvOS-Info.plist */, + C3490DF220E028CF0089F309 /* CorePlot-Info.plist */, + C3490DF420E028D30089F309 /* CorePlot-CocoaTouch-Info.plist */, + C3490DF620E028D80089F309 /* CorePlot-iOS-Info.plist */, + C3490DF820E028DC0089F309 /* CorePlot-tvOS-Info.plist */, 089C1666FE841158C02AAC07 /* InfoPlist.strings */, ); name = Resources; @@ -1720,7 +1705,6 @@ 0730F64D109494D100E95162 /* CPTTestCase.m */, 4C9A745D0FB24C7200918464 /* CPTDataSourceTestCase.h */, 4C9A745E0FB24C7200918464 /* CPTDataSourceTestCase.m */, - BC89A64010239D1D009D5261 /* CorePlotProbes.d */, ); name = Testing; path = Source; @@ -1782,10 +1766,10 @@ C3226A4B1A69F02900F77249 /* Resources */ = { isa = PBXGroup; children = ( - C3226A4C1A69F07600F77249 /* CorePlotTests-Info.plist */, - C3226A4D1A69F09A00F77249 /* CorePlot-iOSTests-Info.plist */, - C3226A4E1A69F0AA00F77249 /* CorePlot-CocoaTouchTests-Info.plist */, - C37EA6B81BC83F2E0091C8F7 /* CorePlot-tvOSTests-Info.plist */, + C37A406A20E02BE900C4FF48 /* CorePlotTests-Info.plist */, + C37A406820E02BA500C4FF48 /* CorePlot-iOSTests-Info.plist */, + C37A406620E02BA100C4FF48 /* CorePlot-CocoaTouchTests-Info.plist */, + C37A406420E02B9D00C4FF48 /* CorePlot-tvOSTests-Info.plist */, ); name = Resources; sourceTree = ""; @@ -2471,7 +2455,7 @@ isa = PBXProject; attributes = { BuildIndependentTargetsInParallel = YES; - LastUpgradeCheck = 0710; + LastUpgradeCheck = 1100; TargetAttributes = { 8DC2EF4F0486A6940098B216 = { DevelopmentTeam = 28ZA45DE7D; @@ -2492,13 +2476,14 @@ }; buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "CorePlot" */; compatibilityVersion = "Xcode 6.3"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 1; knownRegions = ( - English, - Japanese, - French, - German, + Base, + en, + de, + ja, + fr, ); mainGroup = 0867D691FE84028FC02AAC07 /* CorePlot */; productRefGroup = 034768DFFF38A50411DB9C8B /* Products */; @@ -2588,7 +2573,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "# Build the doxygen documentation for the project and load the docset into Xcode.\n\n# Use the following to adjust the value of the $DOXYGEN_PATH User-Defined Setting:\n# Binary install location: /Applications/Doxygen.app/Contents/Resources/doxygen\n# Source build install location: /usr/local/bin/doxygen\n\n# Graphical class diagrams require Graphviz.\n# Graphviz.app is available free online\n# http://www.graphviz.org/Download_macos.php\n\n# If the config file doesn't exist, run 'doxygen -g \"${SOURCE_ROOT}/../documentation/doxygen/doxygen.config\"' to \n# a get default file.\n\nDOXYGEN_FOLDER=\"${SOURCE_ROOT}/../documentation/doxygen\"\n\nif ! [ -f \"${DOXYGEN_FOLDER}/doxygen.config\" ] \nthen \n echo doxygen config file does not exist\n ${DOXYGEN_PATH} -g \"${DOXYGEN_FOLDER}/doxygen.config\"\nfi\n\n# Run doxygen on the updated config file.\n# Note: doxygen creates a Makefile that does most of the heavy lifting.\n${DOXYGEN_PATH} \"${DOXYGEN_FOLDER}/doxygen.config\"\n\n# make a copy of the html docs\nDOCS_FOLDER=\"${SOURCE_ROOT}/../documentation/html/MacOS\"\nmkdir -p \"${DOCS_FOLDER}\"\ncp -R \"${SOURCE_ROOT}/CorePlotDocs.docset/html/\" \"${DOCS_FOLDER}\"\nrm -f \"${DOCS_FOLDER}/Info.plist\"\nrm -f \"${DOCS_FOLDER}/Makefile\"\nrm -f \"${DOCS_FOLDER}/Nodes.xml\"\nrm -f \"${DOCS_FOLDER}/Tokens.xml\"\n\n# fix nodes.xml so the docset gets the correct index page\nsed -i 's|index.html|index.html' \"${SOURCE_ROOT}/CorePlotDocs.docset/html/nodes.xml\"\n\n# make will invoke docsetutil. Take a look at the Makefile to see how this is done.\nmake -C \"${SOURCE_ROOT}/CorePlotDocs.docset/html\" install\n\n# add publisher info to the docset\nDOCSET_FOLDER=\"/Users/${USER}/Library/Developer/Shared/Documentation/DocSets/com.CorePlot.Framework.docset\"\n\nfind \"${DOCSET_FOLDER}/Contents/\" -type f -name Info.plist | xargs perl -pi -e 's/\\<\\/dict\\>/\\t\\DocSetPublisherIdentifier\\<\\/key\\>\\n\\t\\com.CorePlot.documentation\\<\\/string\\>\\n\\t\\DocSetPublisherName\\<\\/key\\>\\n\\t\\Core Plot\\<\\/string\\>\\n\\t\\NSHumanReadableCopyright\\<\\/key\\>\\n\\t\\Copyright © 2013 Core Plot. All rights reserved.\\<\\/string\\>\\n\\t\\isJavaScriptEnabled\\<\\/key\\>\\n\\t\\\\n\\<\\/dict\\>\\n/g'\n\n# add docset icon\ncp \"${DOXYGEN_FOLDER}/icon.png\" \"${DOCSET_FOLDER}\"\n\n# make a copy of the docset\nrm -Rf \"${SOURCE_ROOT}/CorePlotDocs.docset\"\ncp -R \"${DOCSET_FOLDER}\" \"${SOURCE_ROOT}\"\n\n# Construct a temporary applescript file to tell Xcode to load a docset.\nrm -f \"${TEMP_DIR}/loadDocSet.scpt\"\n\necho \"tell application \\\"Xcode\\\"\" >> \"${TEMP_DIR}/loadDocSet.scpt\"\necho \"load documentation set with path \\\"/Users/${USER}/Library/Developer/Shared/Documentation/DocSets/\\\"\" >> \"${TEMP_DIR}/loadDocSet.scpt\"\necho \"end tell\" >> \"${TEMP_DIR}/loadDocSet.scpt\"\n\n# Run the load-docset applescript command.\nosascript \"${TEMP_DIR}/loadDocSet.scpt\"\n\nexit 0"; + shellScript = "# Build the doxygen documentation for the project and load the docset into Xcode.\n\n# Use the following to adjust the value of the $DOXYGEN_PATH User-Defined Setting:\n# Binary install location: /Applications/Doxygen.app/Contents/Resources/doxygen\n# Source build install location: /usr/local/bin/doxygen\n\n# Graphical class diagrams require Graphviz.\n# Graphviz.app is available free online\n# http://www.graphviz.org/Download_macos.php\n\n# If the config file doesn't exist, run 'doxygen -g \"${SOURCE_ROOT}/../documentation/doxygen/doxygen.config\"' to \n# a get default file.\n\nDOXYGEN_FOLDER=\"${SOURCE_ROOT}/../documentation/doxygen\"\n\nif ! [ -f \"${DOXYGEN_FOLDER}/doxygen.config\" ] \nthen \n echo doxygen config file does not exist\n ${DOXYGEN_PATH} -g \"${DOXYGEN_FOLDER}/doxygen.config\"\nfi\n\n# Run doxygen on the updated config file.\n# Note: doxygen creates a Makefile that does most of the heavy lifting.\n${DOXYGEN_PATH} \"${DOXYGEN_FOLDER}/doxygen.config\"\n\n# make a copy of the html docs\nDOCS_FOLDER=\"${SOURCE_ROOT}/../documentation/html/MacOS\"\nmkdir -p \"${DOCS_FOLDER}\"\ncp -R \"${SOURCE_ROOT}/CorePlotDocs.docset/html/\" \"${DOCS_FOLDER}\"\nrm -Rf \"${SOURCE_ROOT}/CorePlotDocs.docset\"\nrm -f \"${DOCS_FOLDER}/Info.plist\"\nrm -f \"${DOCS_FOLDER}/Makefile\"\nrm -f \"${DOCS_FOLDER}/Nodes.xml\"\nrm -f \"${DOCS_FOLDER}/Tokens.xml\"\n\nexit 0"; }; C37EA5C51BC83E900091C8F7 /* ShellScript */ = { isa = PBXShellScriptBuildPhase; @@ -2601,7 +2586,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\nUFW_TARGET=\"CorePlot tvOS\"\nUFW_BUILD_DIR=\"${BUILD_DIR}\"\n\nif [ -z ${SDK_NAME} ]; then\n# Use the latest tvOS SDK available\nUFW_GREP_RESULT=$(xcodebuild -showsdks | grep -o \"appletvos.*$\")\nwhile read -r line; do\nUFW_SDK_VERSION=\"${line}\"\ndone <<< \"${UFW_GREP_RESULT}\"\nelse\n# Use the SDK specified by XCode\nUFW_SDK_VERSION=\"${SDK_NAME}\"\nfi\n\nFRAMEWORK_NAME=\"${PROJECT_NAME}\"\nUFW_SDK_VERSION=$(echo \"${UFW_SDK_VERSION}\" | grep -o \"[0-9].*$\")\nUFW_IPHONE_PATH=\"${UFW_BUILD_DIR}/Release-appletvos/${FRAMEWORK_NAME}.framework\"\nUFW_SIMULATOR_PATH=\"${UFW_BUILD_DIR}/Release-appletvsimulator/${FRAMEWORK_NAME}.framework\"\nUFW_UNIVERSAL_DIR=\"${UFW_BUILD_DIR}/Release-appletvuniversal\"\nUFW_FRAMEWORK=\"${UFW_UNIVERSAL_DIR}/${FRAMEWORK_NAME}.framework\"\n\n# Build Framework\n\nrm -rf \"${UFW_UNIVERSAL_DIR}\"\n\nxcodebuild -target \"${UFW_TARGET}\" -project CorePlot.xcodeproj -configuration Release -sdk appletvos${UFW_SDK_VERSION} clean build\nif [ \"$?\" != \"0\" ]; then echo >&2 \"Error: xcodebuild failed\"; exit 1; fi\nxcodebuild -target \"${UFW_TARGET}\" -project CorePlot.xcodeproj -configuration Release -sdk appletvsimulator${UFW_SDK_VERSION} clean build\nif [ \"$?\" != \"0\" ]; then echo >&2 \"Error: xcodebuild failed\"; exit 1; fi\n\nmkdir -p \"${UFW_UNIVERSAL_DIR}\"\nif [ \"$?\" != \"0\" ]; then echo >&2 \"Error: mkdir failed\"; exit 1; fi\n\ncp -r \"${UFW_IPHONE_PATH}/.\" \"${UFW_FRAMEWORK}\"\n\nlipo -create -output \"${UFW_FRAMEWORK}/${FRAMEWORK_NAME}\" \"${UFW_SIMULATOR_PATH}/${FRAMEWORK_NAME}\" \"${UFW_IPHONE_PATH}/${FRAMEWORK_NAME}\"\nif [ \"$?\" != \"0\" ]; then echo >&2 \"Error: lipo failed\"; exit 1; fi\n"; + shellScript = "\nUFW_TARGET=\"CorePlot tvOS\"\nUFW_BUILD_DIR=\"${PROJECT_DIR}/../build\"\n\nif [ -z ${SDK_NAME} ]; then\n# Use the latest tvOS SDK available\nUFW_GREP_RESULT=$(xcodebuild -showsdks | grep -o \"appletvos.*$\")\nwhile read -r line; do\nUFW_SDK_VERSION=\"${line}\"\ndone <<< \"${UFW_GREP_RESULT}\"\nelse\n# Use the SDK specified by XCode\nUFW_SDK_VERSION=\"${SDK_NAME}\"\nfi\n\nFRAMEWORK_NAME=\"${PROJECT_NAME}\"\nUFW_SDK_VERSION=$(echo \"${UFW_SDK_VERSION}\" | grep -o \"[0-9].*$\")\nUFW_IPHONE_PATH=\"${UFW_BUILD_DIR}/Release-appletvos/${FRAMEWORK_NAME}.framework\"\nUFW_SIMULATOR_PATH=\"${UFW_BUILD_DIR}/Release-appletvsimulator/${FRAMEWORK_NAME}.framework\"\nUFW_UNIVERSAL_DIR=\"${UFW_BUILD_DIR}/Release-appletvuniversal\"\nUFW_FRAMEWORK=\"${UFW_UNIVERSAL_DIR}/${FRAMEWORK_NAME}.framework\"\n\n# Build Framework\n\nrm -rf \"${UFW_UNIVERSAL_DIR}\"\n\nxcodebuild -target \"${UFW_TARGET}\" -project CorePlot.xcodeproj -configuration Release -sdk appletvos${UFW_SDK_VERSION} clean build\nif [ \"$?\" != \"0\" ]; then echo >&2 \"Error: xcodebuild failed\"; exit 1; fi\nxcodebuild -target \"${UFW_TARGET}\" -project CorePlot.xcodeproj -configuration Release -sdk appletvsimulator${UFW_SDK_VERSION} build\nif [ \"$?\" != \"0\" ]; then echo >&2 \"Error: xcodebuild failed\"; exit 1; fi\n\nmkdir -p \"${UFW_UNIVERSAL_DIR}\"\nif [ \"$?\" != \"0\" ]; then echo >&2 \"Error: mkdir failed\"; exit 1; fi\n\ncp -r \"${UFW_IPHONE_PATH}/.\" \"${UFW_FRAMEWORK}\"\n\nlipo -create -output \"${UFW_FRAMEWORK}/${FRAMEWORK_NAME}\" \"${UFW_SIMULATOR_PATH}/${FRAMEWORK_NAME}\" \"${UFW_IPHONE_PATH}/${FRAMEWORK_NAME}\"\nif [ \"$?\" != \"0\" ]; then echo >&2 \"Error: lipo failed\"; exit 1; fi\n"; }; C38A09921A4618B600D45436 /* ShellScript */ = { isa = PBXShellScriptBuildPhase; @@ -2614,7 +2599,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "# Build the doxygen documentation for the project and load the docset into Xcode.\n\n# Use the following to adjust the value of the $DOXYGEN_PATH User-Defined Setting:\n# Binary install location: /Applications/Doxygen.app/Contents/Resources/doxygen\n# Source build install location: /usr/local/bin/doxygen\n\n# Graphical class diagrams require Graphviz.\n# Graphviz.app is available free online\n# http://www.graphviz.org/Download_macos.php\n\n# If the config file doesn't exist, run 'doxygen -g \"${SOURCE_ROOT}/../documentation/doxygen/doxygen touch.config\"' to\n# a get default file.\n\nDOXYGEN_FOLDER=\"${SOURCE_ROOT}/../documentation/doxygen\"\n\nif ! [ -f \"${DOXYGEN_FOLDER}/doxygen.config\" ]\nthen\necho doxygen config file does not exist\n${DOXYGEN_PATH} -g \"${DOXYGEN_FOLDER}/doxygen.config\"\nfi\n\n# Run doxygen on the updated config file.\n# Note: doxygen creates a Makefile that does most of the heavy lifting.\n${DOXYGEN_PATH} \"${SOURCE_ROOT}/../documentation/doxygen/doxygen touch.config\"\n\n# make a copy of the html docs\nDOCS_FOLDER=\"${SOURCE_ROOT}/../documentation/html/iOS\"\nmkdir -p \"${DOCS_FOLDER}\"\ncp -R \"${SOURCE_ROOT}/CorePlotTouchDocs.docset/html/\" \"${DOCS_FOLDER}\"\nrm -f \"${DOCS_FOLDER}/Info.plist\"\nrm -f \"${DOCS_FOLDER}/Makefile\"\nrm -f \"${DOCS_FOLDER}/Nodes.xml\"\nrm -f \"${DOCS_FOLDER}/Tokens.xml\"\n\n# fix nodes.xml so the docset gets the correct index page\nsed -i 's|index.html|index.html' \"${SOURCE_ROOT}/CorePlotTouchDocs.docset/html/nodes.xml\"\n\n# make will invoke docsetutil. Take a look at the Makefile to see how this is done.\nmake -C \"${SOURCE_ROOT}/CorePlotTouchDocs.docset/html\" install\n\n# add publisher info to the docset\nDOCSET_FOLDER=\"/Users/${USER}/Library/Developer/Shared/Documentation/DocSets/com.CorePlotTouch.Framework.docset\"\n\nfind \"${DOCSET_FOLDER}/Contents/\" -type f -name Info.plist | xargs perl -pi -e 's/\\<\\/dict\\>/\\t\\DocSetPublisherIdentifier\\<\\/key\\>\\n\\t\\com.CorePlot.documentation\\<\\/string\\>\\n\\t\\DocSetPublisherName\\<\\/key\\>\\n\\t\\Core Plot\\<\\/string\\>\\n\\t\\NSHumanReadableCopyright\\<\\/key\\>\\n\\t\\Copyright © 2013 Core Plot. All rights reserved.\\<\\/string\\>\\n\\t\\isJavaScriptEnabled\\<\\/key\\>\\n\\t\\\\n\\<\\/dict\\>\\n/g'\n\n# add docset icon\ncp \"${DOXYGEN_FOLDER}/icon.png\" \"${DOCSET_FOLDER}\"\n\n# make a copy of the docset\nrm -Rf \"${SOURCE_ROOT}/CorePlotTouchDocs.docset\"\ncp -R \"${DOCSET_FOLDER}\" \"${SOURCE_ROOT}\"\n\n# Construct a temporary applescript file to tell Xcode to load a docset.\nrm -f \"${TEMP_DIR}/loadDocSet.scpt\"\n\necho \"tell application \\\"Xcode\\\"\" >> \"${TEMP_DIR}/loadDocSet.scpt\"\necho \"load documentation set with path \\\"/Users/${USER}/Library/Developer/Shared/Documentation/DocSets/\\\"\" >> \"${TEMP_DIR}/loadDocSet.scpt\"\necho \"end tell\" >> \"${TEMP_DIR}/loadDocSet.scpt\"\n\n# Run the load-docset applescript command.\nosascript \"${TEMP_DIR}/loadDocSet.scpt\"\n\nexit 0"; + shellScript = "# Build the doxygen documentation for the project and load the docset into Xcode.\n\n# Use the following to adjust the value of the $DOXYGEN_PATH User-Defined Setting:\n# Binary install location: /Applications/Doxygen.app/Contents/Resources/doxygen\n# Source build install location: /usr/local/bin/doxygen\n\n# Graphical class diagrams require Graphviz.\n# Graphviz.app is available free online\n# http://www.graphviz.org/Download_macos.php\n\n# If the config file doesn't exist, run 'doxygen -g \"${SOURCE_ROOT}/../documentation/doxygen/doxygen touch.config\"' to\n# a get default file.\n\nDOXYGEN_FOLDER=\"${SOURCE_ROOT}/../documentation/doxygen\"\n\nif ! [ -f \"${DOXYGEN_FOLDER}/doxygen.config\" ]\nthen\necho doxygen config file does not exist\n${DOXYGEN_PATH} -g \"${DOXYGEN_FOLDER}/doxygen.config\"\nfi\n\n# Run doxygen on the updated config file.\n# Note: doxygen creates a Makefile that does most of the heavy lifting.\n${DOXYGEN_PATH} \"${SOURCE_ROOT}/../documentation/doxygen/doxygen touch.config\"\n\n# make a copy of the html docs\nDOCS_FOLDER=\"${SOURCE_ROOT}/../documentation/html/iOS\"\nmkdir -p \"${DOCS_FOLDER}\"\ncp -R \"${SOURCE_ROOT}/CorePlotTouchDocs.docset/html/\" \"${DOCS_FOLDER}\"\nrm -Rf \"${SOURCE_ROOT}/CorePlotTouchDocs.docset\"\nrm -f \"${DOCS_FOLDER}/Info.plist\"\nrm -f \"${DOCS_FOLDER}/Makefile\"\nrm -f \"${DOCS_FOLDER}/Nodes.xml\"\nrm -f \"${DOCS_FOLDER}/Tokens.xml\"\n\nexit 0"; }; C38A09971A46193F00D45436 /* ShellScript */ = { isa = PBXShellScriptBuildPhase; @@ -2627,7 +2612,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\nUFW_TARGET=\"CorePlot-CocoaTouch\"\nUFW_BUILD_DIR=\"${BUILD_DIR}\"\n\nif [ -z ${SDK_NAME} ]; then\n# Use the latest iphoneos SDK available\nUFW_GREP_RESULT=$(xcodebuild -showsdks | grep -o \"iphoneos.*$\")\nwhile read -r line; do\nUFW_SDK_VERSION=\"${line}\"\ndone <<< \"${UFW_GREP_RESULT}\"\nelse\n# Use the SDK specified by XCode\nUFW_SDK_VERSION=\"${SDK_NAME}\"\nfi\n\nUFW_SDK_VERSION=$(echo \"${UFW_SDK_VERSION}\" | grep -o \"[0-9].*$\")\nUFW_IPHONE_DIR=\"${UFW_BUILD_DIR}/Release-iphoneos\"\nUFW_SIMULATOR_DIR=\"${UFW_BUILD_DIR}/Release-iphonesimulator\"\nUFW_UNIVERSAL_DIR=\"${UFW_BUILD_DIR}/Release-universal\"\nUFW_HEADER_DIR=\"${UFW_UNIVERSAL_DIR}/CorePlotHeaders\"\nUFW_EXE_PATH=\"libCorePlot-CocoaTouch.a\"\n\n# Build Framework\n\nrm -rf \"${UFW_UNIVERSAL_DIR}\"\n\nxcodebuild -target \"${UFW_TARGET}\" -project CorePlot.xcodeproj -configuration Release -sdk iphoneos${UFW_SDK_VERSION} clean build\nif [ \"$?\" != \"0\" ]; then echo >&2 \"Error: xcodebuild failed\"; exit 1; fi\nxcodebuild -target \"${UFW_TARGET}\" -project CorePlot.xcodeproj -configuration Release -sdk iphonesimulator${UFW_SDK_VERSION} clean build\nif [ \"$?\" != \"0\" ]; then echo >&2 \"Error: xcodebuild failed\"; exit 1; fi\n\nmkdir -p \"${UFW_UNIVERSAL_DIR}\"\nif [ \"$?\" != \"0\" ]; then echo >&2 \"Error: mkdir failed\"; exit 1; fi\n\nlipo -create -output \"${UFW_UNIVERSAL_DIR}/${UFW_EXE_PATH}\" \"${UFW_IPHONE_DIR}/${UFW_EXE_PATH}\" \"${UFW_SIMULATOR_DIR}/${UFW_EXE_PATH}\"\nif [ \"$?\" != \"0\" ]; then echo >&2 \"Error: lipo failed\"; exit 1; fi\n\n# copy header files\nmkdir -p \"${UFW_HEADER_DIR}\"\nif [ \"$?\" != \"0\" ]; then echo >&2 \"Error: mkdir failed\"; exit 1; fi\n\ncp \"${SOURCE_ROOT}/CorePlot-CocoaTouch.h\" \"${UFW_HEADER_DIR}\"\ncp \"${SOURCE_ROOT}/iPhoneOnly/\"[!_]*.h \"${UFW_HEADER_DIR}/\"\ncp \"${SOURCE_ROOT}/Source/\"[!_]*.h \"${UFW_HEADER_DIR}/\"\n\nrm \"${UFW_HEADER_DIR}/\"*Tests.*"; + shellScript = "\nUFW_TARGET=\"CorePlot-CocoaTouch\"\nUFW_BUILD_DIR=\"${PROJECT_DIR}/../build\"\n\nif [ -z ${SDK_NAME} ]; then\n# Use the latest iphoneos SDK available\nUFW_GREP_RESULT=$(xcodebuild -showsdks | grep -o \"iphoneos.*$\")\nwhile read -r line; do\nUFW_SDK_VERSION=\"${line}\"\ndone <<< \"${UFW_GREP_RESULT}\"\nelse\n# Use the SDK specified by XCode\nUFW_SDK_VERSION=\"${SDK_NAME}\"\nfi\n\nUFW_SDK_VERSION=$(echo \"${UFW_SDK_VERSION}\" | grep -o \"[0-9].*$\")\nUFW_IPHONE_DIR=\"${UFW_BUILD_DIR}/Release-iphoneos\"\nUFW_SIMULATOR_DIR=\"${UFW_BUILD_DIR}/Release-iphonesimulator\"\nUFW_UNIVERSAL_DIR=\"${UFW_BUILD_DIR}/Release-universal\"\nUFW_HEADER_DIR=\"${UFW_UNIVERSAL_DIR}/CorePlotHeaders\"\nUFW_EXE_PATH=\"libCorePlot-CocoaTouch.a\"\n\n# Build Framework\n\nrm -rf \"${UFW_UNIVERSAL_DIR}\"\n\nxcodebuild -target \"${UFW_TARGET}\" -project CorePlot.xcodeproj -configuration Release -sdk iphoneos${UFW_SDK_VERSION} clean build\nif [ \"$?\" != \"0\" ]; then echo >&2 \"Error: xcodebuild failed\"; exit 1; fi\nxcodebuild -target \"${UFW_TARGET}\" -project CorePlot.xcodeproj -configuration Release -sdk iphonesimulator${UFW_SDK_VERSION} build\nif [ \"$?\" != \"0\" ]; then echo >&2 \"Error: xcodebuild failed\"; exit 1; fi\n\nmkdir -p \"${UFW_UNIVERSAL_DIR}\"\nif [ \"$?\" != \"0\" ]; then echo >&2 \"Error: mkdir failed\"; exit 1; fi\n\nlipo -create -output \"${UFW_UNIVERSAL_DIR}/${UFW_EXE_PATH}\" \"${UFW_IPHONE_DIR}/${UFW_EXE_PATH}\" \"${UFW_SIMULATOR_DIR}/${UFW_EXE_PATH}\"\nif [ \"$?\" != \"0\" ]; then echo >&2 \"Error: lipo failed\"; exit 1; fi\n\n# copy header files\nmkdir -p \"${UFW_HEADER_DIR}\"\nif [ \"$?\" != \"0\" ]; then echo >&2 \"Error: mkdir failed\"; exit 1; fi\n\ncp \"${SOURCE_ROOT}/CorePlot-CocoaTouch.h\" \"${UFW_HEADER_DIR}\"\ncp \"${SOURCE_ROOT}/iPhoneOnly/\"[!_]*.h \"${UFW_HEADER_DIR}/\"\ncp \"${SOURCE_ROOT}/Source/\"[!_]*.h \"${UFW_HEADER_DIR}/\"\n\nrm \"${UFW_HEADER_DIR}/\"*Tests.*\n"; }; C3A546801BC1A817005C1BBC /* ShellScript */ = { isa = PBXShellScriptBuildPhase; @@ -2640,7 +2625,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\nUFW_TARGET=\"CorePlot iOS\"\nUFW_BUILD_DIR=\"${BUILD_DIR}\"\n\nif [ -z ${SDK_NAME} ]; then\n# Use the latest iphoneos SDK available\nUFW_GREP_RESULT=$(xcodebuild -showsdks | grep -o \"iphoneos.*$\")\nwhile read -r line; do\nUFW_SDK_VERSION=\"${line}\"\ndone <<< \"${UFW_GREP_RESULT}\"\nelse\n# Use the SDK specified by XCode\nUFW_SDK_VERSION=\"${SDK_NAME}\"\nfi\n\nFRAMEWORK_NAME=\"${PROJECT_NAME}\"\nUFW_SDK_VERSION=$(echo \"${UFW_SDK_VERSION}\" | grep -o \"[0-9].*$\")\nUFW_IPHONE_PATH=\"${UFW_BUILD_DIR}/Release-iphoneos/${FRAMEWORK_NAME}.framework\"\nUFW_SIMULATOR_PATH=\"${UFW_BUILD_DIR}/Release-iphonesimulator/${FRAMEWORK_NAME}.framework\"\nUFW_UNIVERSAL_DIR=\"${UFW_BUILD_DIR}/Release-iphoneuniversal\"\nUFW_FRAMEWORK=\"${UFW_UNIVERSAL_DIR}/${FRAMEWORK_NAME}.framework\"\n\n# Build Framework\n\nrm -rf \"${UFW_UNIVERSAL_DIR}\"\n\nxcodebuild -target \"${UFW_TARGET}\" -project CorePlot.xcodeproj -configuration Release -sdk iphoneos${UFW_SDK_VERSION} clean build\nif [ \"$?\" != \"0\" ]; then echo >&2 \"Error: xcodebuild failed\"; exit 1; fi\nxcodebuild -target \"${UFW_TARGET}\" -project CorePlot.xcodeproj -configuration Release -sdk iphonesimulator${UFW_SDK_VERSION} clean build\nif [ \"$?\" != \"0\" ]; then echo >&2 \"Error: xcodebuild failed\"; exit 1; fi\n\nmkdir -p \"${UFW_UNIVERSAL_DIR}\"\nif [ \"$?\" != \"0\" ]; then echo >&2 \"Error: mkdir failed\"; exit 1; fi\n\ncp -r \"${UFW_IPHONE_PATH}/.\" \"${UFW_FRAMEWORK}\"\n\nlipo -create -output \"${UFW_FRAMEWORK}/${FRAMEWORK_NAME}\" \"${UFW_SIMULATOR_PATH}/${FRAMEWORK_NAME}\" \"${UFW_IPHONE_PATH}/${FRAMEWORK_NAME}\"\nif [ \"$?\" != \"0\" ]; then echo >&2 \"Error: lipo failed\"; exit 1; fi\n"; + shellScript = "\nUFW_TARGET=\"CorePlot iOS\"\nUFW_BUILD_DIR=\"${PROJECT_DIR}/../build\"\n\nif [ -z ${SDK_NAME} ]; then\n# Use the latest iphoneos SDK available\nUFW_GREP_RESULT=$(xcodebuild -showsdks | grep -o \"iphoneos.*$\")\nwhile read -r line; do\nUFW_SDK_VERSION=\"${line}\"\ndone <<< \"${UFW_GREP_RESULT}\"\nelse\n# Use the SDK specified by XCode\nUFW_SDK_VERSION=\"${SDK_NAME}\"\nfi\n\nFRAMEWORK_NAME=\"${PROJECT_NAME}\"\nUFW_SDK_VERSION=$(echo \"${UFW_SDK_VERSION}\" | grep -o \"[0-9].*$\")\nUFW_IPHONE_PATH=\"${UFW_BUILD_DIR}/Release-iphoneos/${FRAMEWORK_NAME}.framework\"\nUFW_SIMULATOR_PATH=\"${UFW_BUILD_DIR}/Release-iphonesimulator/${FRAMEWORK_NAME}.framework\"\nUFW_UNIVERSAL_DIR=\"${UFW_BUILD_DIR}/Release-iphoneuniversal\"\nUFW_FRAMEWORK=\"${UFW_UNIVERSAL_DIR}/${FRAMEWORK_NAME}.framework\"\n\n# Build Framework\n\nrm -rf \"${UFW_UNIVERSAL_DIR}\"\n\nxcodebuild -target \"${UFW_TARGET}\" -project CorePlot.xcodeproj -configuration Release -sdk iphoneos${UFW_SDK_VERSION} clean build\nif [ \"$?\" != \"0\" ]; then echo >&2 \"Error: xcodebuild failed\"; exit 1; fi\nxcodebuild -target \"${UFW_TARGET}\" -project CorePlot.xcodeproj -configuration Release -sdk iphonesimulator${UFW_SDK_VERSION} build\nif [ \"$?\" != \"0\" ]; then echo >&2 \"Error: xcodebuild failed\"; exit 1; fi\n\nmkdir -p \"${UFW_UNIVERSAL_DIR}\"\nif [ \"$?\" != \"0\" ]; then echo >&2 \"Error: mkdir failed\"; exit 1; fi\n\ncp -r \"${UFW_IPHONE_PATH}/.\" \"${UFW_FRAMEWORK}\"\n\nlipo -create -output \"${UFW_FRAMEWORK}/${FRAMEWORK_NAME}\" \"${UFW_SIMULATOR_PATH}/${FRAMEWORK_NAME}\" \"${UFW_IPHONE_PATH}/${FRAMEWORK_NAME}\"\nif [ \"$?\" != \"0\" ]; then echo >&2 \"Error: lipo failed\"; exit 1; fi\n"; }; /* End PBXShellScriptBuildPhase section */ @@ -2725,7 +2710,6 @@ BC55023310059F22005DF982 /* _CPTPlainBlackTheme.m in Sources */, BC55023510059F22005DF982 /* _CPTPlainWhiteTheme.m in Sources */, BC55023710059F22005DF982 /* _CPTStocksTheme.m in Sources */, - BC89A64110239D1D009D5261 /* CorePlotProbes.d in Sources */, 07A2E6FD102DF47900809BC5 /* CPTTimeFormatter.m in Sources */, 4C97EF02104D80C400B554F9 /* CPTNumericData.m in Sources */, 4C97EF04104D80C400B554F9 /* CPTNumericDataType.m in Sources */, @@ -2807,7 +2791,6 @@ C37EA5DF1BC83F2A0091C8F7 /* _CPTDarkGradientTheme.m in Sources */, C37EA5E01BC83F2A0091C8F7 /* _CPTPlainBlackTheme.m in Sources */, C37EA5E11BC83F2A0091C8F7 /* CPTNumericData.m in Sources */, - C37EA5E21BC83F2A0091C8F7 /* CorePlotProbes.d in Sources */, C37EA5E31BC83F2A0091C8F7 /* CPTXYAxisSet.m in Sources */, C37EA5E41BC83F2A0091C8F7 /* CPTLimitBand.m in Sources */, C37EA5E51BC83F2A0091C8F7 /* CPTGridLines.m in Sources */, @@ -2941,7 +2924,6 @@ C38A0B061A46261700D45436 /* _CPTDarkGradientTheme.m in Sources */, C38A0B071A46261700D45436 /* _CPTPlainBlackTheme.m in Sources */, C38A09DB1A461C7D00D45436 /* CPTNumericData.m in Sources */, - C38A09D51A461C1E00D45436 /* CorePlotProbes.d in Sources */, C38A0AE71A4625D400D45436 /* CPTXYAxisSet.m in Sources */, C38A0AB21A46241700D45436 /* CPTLimitBand.m in Sources */, C38A0AE11A4625D400D45436 /* CPTGridLines.m in Sources */, @@ -3108,7 +3090,6 @@ C38A09FD1A461D1400D45436 /* CPTMutablePlotRange.m in Sources */, C38A09F71A461D0100D45436 /* CPTUtilities.m in Sources */, C38A0A721A4620E200D45436 /* CPTGradient.m in Sources */, - C38A09D61A461C2B00D45436 /* CorePlotProbes.d in Sources */, C38A0A9A1A46219200D45436 /* CPTTimeFormatter.m in Sources */, C38A0A161A461E5800D45436 /* CPTAnimation.m in Sources */, C38A0AAC1A46240A00D45436 /* CPTXYGraph.m in Sources */, @@ -3211,11 +3192,83 @@ 089C1666FE841158C02AAC07 /* InfoPlist.strings */ = { isa = PBXVariantGroup; children = ( - 089C1667FE841158C02AAC07 /* English */, + C3564CBD22A2D0E1000A54C9 /* en */, ); name = InfoPlist.strings; sourceTree = ""; }; + C3490DF220E028CF0089F309 /* CorePlot-Info.plist */ = { + isa = PBXVariantGroup; + children = ( + C3490DF120E028CF0089F309 /* Base */, + ); + name = "CorePlot-Info.plist"; + path = Info; + sourceTree = ""; + }; + C3490DF420E028D30089F309 /* CorePlot-CocoaTouch-Info.plist */ = { + isa = PBXVariantGroup; + children = ( + C3490DF320E028D30089F309 /* Base */, + ); + name = "CorePlot-CocoaTouch-Info.plist"; + path = Info/Base.lproj; + sourceTree = ""; + }; + C3490DF620E028D80089F309 /* CorePlot-iOS-Info.plist */ = { + isa = PBXVariantGroup; + children = ( + C3490DF520E028D80089F309 /* Base */, + ); + name = "CorePlot-iOS-Info.plist"; + path = Info/Base.lproj; + sourceTree = ""; + }; + C3490DF820E028DC0089F309 /* CorePlot-tvOS-Info.plist */ = { + isa = PBXVariantGroup; + children = ( + C3490DF720E028DC0089F309 /* Base */, + ); + name = "CorePlot-tvOS-Info.plist"; + path = "/Users/eskroch/Projects/Core Plot/framework/Info/Base.lproj"; + sourceTree = ""; + }; + C37A406420E02B9D00C4FF48 /* CorePlot-tvOSTests-Info.plist */ = { + isa = PBXVariantGroup; + children = ( + C37A406320E02B9D00C4FF48 /* Base */, + ); + name = "CorePlot-tvOSTests-Info.plist"; + path = "/Users/eskroch/Projects/Core Plot/framework/Info"; + sourceTree = ""; + }; + C37A406620E02BA100C4FF48 /* CorePlot-CocoaTouchTests-Info.plist */ = { + isa = PBXVariantGroup; + children = ( + C37A406520E02BA100C4FF48 /* Base */, + ); + name = "CorePlot-CocoaTouchTests-Info.plist"; + path = Info; + sourceTree = SOURCE_ROOT; + }; + C37A406820E02BA500C4FF48 /* CorePlot-iOSTests-Info.plist */ = { + isa = PBXVariantGroup; + children = ( + C37A406720E02BA500C4FF48 /* Base */, + ); + name = "CorePlot-iOSTests-Info.plist"; + path = Info; + sourceTree = SOURCE_ROOT; + }; + C37A406A20E02BE900C4FF48 /* CorePlotTests-Info.plist */ = { + isa = PBXVariantGroup; + children = ( + C37A406920E02BE900C4FF48 /* Base */, + ); + name = "CorePlotTests-Info.plist"; + path = Info; + sourceTree = SOURCE_ROOT; + }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ @@ -3223,11 +3276,11 @@ isa = XCBuildConfiguration; baseConfigurationReference = C3C9D08C1BB5A44800931F32 /* CorePlotDebug.xcconfig */; buildSettings = { - INFOPLIST_FILE = "$(SRCROOT)/Info/CorePlotTests-Info.plist"; + INFOPLIST_FILE = "$(SRCROOT)/Info/Base.lproj/CorePlotTests-Info.plist"; INSTALL_PATH = "$(USER_LIBRARY_DIR)/Bundles"; - MACOSX_DEPLOYMENT_TARGET = 10.8; PRODUCT_NAME = UnitTests; SDKROOT = macosx; + USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/Source $(SRCROOT)/MacOnly"; }; name = Debug; }; @@ -3235,11 +3288,11 @@ isa = XCBuildConfiguration; baseConfigurationReference = C3C9D08D1BB5A45B00931F32 /* CorePlotRelease.xcconfig */; buildSettings = { - INFOPLIST_FILE = "$(SRCROOT)/Info/CorePlotTests-Info.plist"; + INFOPLIST_FILE = "$(SRCROOT)/Info/Base.lproj/CorePlotTests-Info.plist"; INSTALL_PATH = "$(USER_LIBRARY_DIR)/Bundles"; - MACOSX_DEPLOYMENT_TARGET = 10.8; PRODUCT_NAME = UnitTests; SDKROOT = macosx; + USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/Source $(SRCROOT)/MacOnly"; }; name = Release; }; @@ -3251,9 +3304,8 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; FRAMEWORK_VERSION = A; - INFOPLIST_FILE = "$(SRCROOT)/Info/CorePlot-Info.plist"; + INFOPLIST_FILE = "$(SRCROOT)/Info/Base.lproj/CorePlot-Info.plist"; INSTALL_PATH = "@rpath"; - MACOSX_DEPLOYMENT_TARGET = 10.8; PRODUCT_BUNDLE_IDENTIFIER = "com.CorePlot.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = CorePlot; SDKROOT = macosx; @@ -3270,9 +3322,8 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; FRAMEWORK_VERSION = A; - INFOPLIST_FILE = "$(SRCROOT)/Info/CorePlot-Info.plist"; + INFOPLIST_FILE = "$(SRCROOT)/Info/Base.lproj/CorePlot-Info.plist"; INSTALL_PATH = "@rpath"; - MACOSX_DEPLOYMENT_TARGET = 10.8; PRODUCT_BUNDLE_IDENTIFIER = "com.CorePlot.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = CorePlot; SDKROOT = macosx; @@ -3283,21 +3334,23 @@ }; 1DEB91B208733DA50010E9CD /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = C3C9D08C1BB5A44800931F32 /* CorePlotDebug.xcconfig */; buildSettings = { - CURRENT_PROJECT_VERSION = 2.1; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CURRENT_PROJECT_VERSION = 2.3; ENABLE_TESTABILITY = YES; + GCC_NO_COMMON_BLOCKS = YES; ONLY_ACTIVE_ARCH = YES; - SYMROOT = "$(PROJECT_DIR)/../build"; - TVOS_DEPLOYMENT_TARGET = 9.0; }; name = Debug; }; 1DEB91B308733DA50010E9CD /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = C3C9D08D1BB5A45B00931F32 /* CorePlotRelease.xcconfig */; buildSettings = { - CURRENT_PROJECT_VERSION = 2.1; - SYMROOT = "$(PROJECT_DIR)/../build"; - TVOS_DEPLOYMENT_TARGET = 9.0; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CURRENT_PROJECT_VERSION = 2.3; + GCC_NO_COMMON_BLOCKS = YES; }; name = Release; }; @@ -3359,19 +3412,19 @@ isa = XCBuildConfiguration; baseConfigurationReference = C3C9D08C1BB5A44800931F32 /* CorePlotDebug.xcconfig */; buildSettings = { - CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_IDENTITY = ""; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; - INFOPLIST_FILE = "$(SRCROOT)/Info/CorePlot-tvOS-Info.plist"; + INFOPLIST_FILE = "$(SRCROOT)/Info/Base.lproj/CorePlot-tvOS-Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MTL_ENABLE_DEBUG_INFO = YES; PRODUCT_BUNDLE_IDENTIFIER = "com.CorePlot.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = CorePlot; SDKROOT = appletvos; - TVOS_DEPLOYMENT_TARGET = 9.0; USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/Source $(SRCROOT)/iPhoneOnly"; }; name = Debug; @@ -3380,19 +3433,19 @@ isa = XCBuildConfiguration; baseConfigurationReference = C3C9D08D1BB5A45B00931F32 /* CorePlotRelease.xcconfig */; buildSettings = { - CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_IDENTITY = ""; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; - INFOPLIST_FILE = "$(SRCROOT)/Info/CorePlot-tvOS-Info.plist"; + INFOPLIST_FILE = "$(SRCROOT)/Info/Base.lproj/CorePlot-tvOS-Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MTL_ENABLE_DEBUG_INFO = NO; PRODUCT_BUNDLE_IDENTIFIER = "com.CorePlot.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = CorePlot; SDKROOT = appletvos; - TVOS_DEPLOYMENT_TARGET = 9.0; USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/Source $(SRCROOT)/iPhoneOnly"; }; name = Release; @@ -3402,13 +3455,12 @@ baseConfigurationReference = C3C9D08C1BB5A44800931F32 /* CorePlotDebug.xcconfig */; buildSettings = { CODE_SIGN_IDENTITY = "iPhone Developer"; - INFOPLIST_FILE = "$(SRCROOT)/Info/CorePlot-tvOSTests-Info.plist"; + INFOPLIST_FILE = "$(SRCROOT)/Info/Base.lproj/CorePlot-tvOSTests-Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MTL_ENABLE_DEBUG_INFO = YES; PRODUCT_BUNDLE_IDENTIFIER = "com.CorePlot.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = appletvos; - TVOS_DEPLOYMENT_TARGET = 9.0; USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/Source $(SRCROOT)/iPhoneOnly"; }; name = Debug; @@ -3418,13 +3470,12 @@ baseConfigurationReference = C3C9D08D1BB5A45B00931F32 /* CorePlotRelease.xcconfig */; buildSettings = { CODE_SIGN_IDENTITY = "iPhone Developer"; - INFOPLIST_FILE = "$(SRCROOT)/Info/CorePlot-tvOSTests-Info.plist"; + INFOPLIST_FILE = "$(SRCROOT)/Info/Base.lproj/CorePlot-tvOSTests-Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MTL_ENABLE_DEBUG_INFO = NO; PRODUCT_BUNDLE_IDENTIFIER = "com.CorePlot.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = appletvos; - TVOS_DEPLOYMENT_TARGET = 9.0; USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/Source $(SRCROOT)/iPhoneOnly"; }; name = Release; @@ -3433,14 +3484,14 @@ isa = XCBuildConfiguration; baseConfigurationReference = C3C9D08C1BB5A44800931F32 /* CorePlotDebug.xcconfig */; buildSettings = { - CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_IDENTITY = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; - INFOPLIST_FILE = "$(SRCROOT)/Info/CorePlot-iOS-Info.plist"; + INFOPLIST_FILE = "$(SRCROOT)/Info/Base.lproj/CorePlot-iOS-Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MTL_ENABLE_DEBUG_INFO = YES; PRODUCT_BUNDLE_IDENTIFIER = "com.CorePlot.$(PRODUCT_NAME:rfc1034identifier)"; @@ -3455,14 +3506,14 @@ isa = XCBuildConfiguration; baseConfigurationReference = C3C9D08D1BB5A45B00931F32 /* CorePlotRelease.xcconfig */; buildSettings = { - CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_IDENTITY = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; - INFOPLIST_FILE = "$(SRCROOT)/Info/CorePlot-iOS-Info.plist"; + INFOPLIST_FILE = "$(SRCROOT)/Info/Base.lproj/CorePlot-iOS-Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MTL_ENABLE_DEBUG_INFO = NO; PRODUCT_BUNDLE_IDENTIFIER = "com.CorePlot.$(PRODUCT_NAME:rfc1034identifier)"; @@ -3478,8 +3529,7 @@ baseConfigurationReference = C3C9D08C1BB5A44800931F32 /* CorePlotDebug.xcconfig */; buildSettings = { CODE_SIGN_IDENTITY = "iPhone Developer"; - INFOPLIST_FILE = "$(SRCROOT)/Info/CorePlot-iOSTests-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + INFOPLIST_FILE = "$(SRCROOT)/Info/Base.lproj/CorePlot-iOSTests-Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MTL_ENABLE_DEBUG_INFO = YES; PRODUCT_BUNDLE_IDENTIFIER = "com.CorePlot.$(PRODUCT_NAME:rfc1034identifier)"; @@ -3495,8 +3545,7 @@ baseConfigurationReference = C3C9D08D1BB5A45B00931F32 /* CorePlotRelease.xcconfig */; buildSettings = { CODE_SIGN_IDENTITY = "iPhone Developer"; - INFOPLIST_FILE = "$(SRCROOT)/Info/CorePlot-iOSTests-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + INFOPLIST_FILE = "$(SRCROOT)/Info/Base.lproj/CorePlot-iOSTests-Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MTL_ENABLE_DEBUG_INFO = NO; PRODUCT_BUNDLE_IDENTIFIER = "com.CorePlot.$(PRODUCT_NAME:rfc1034identifier)"; @@ -3540,7 +3589,6 @@ DOXYGEN_PATH = /Applications/Doxygen.app/Contents/Resources/doxygen; GCC_OPTIMIZATION_LEVEL = 0; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; - IPHONEOS_DEPLOYMENT_TARGET = 6.0; PRODUCT_NAME = "Documentation-iOS copy"; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = "iphonesimulator iphoneos"; @@ -3555,7 +3603,6 @@ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DOXYGEN_PATH = /Applications/Doxygen.app/Contents/Resources/doxygen; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; - IPHONEOS_DEPLOYMENT_TARGET = 6.0; PRODUCT_NAME = "Documentation-iOS copy"; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = "iphonesimulator iphoneos"; @@ -3568,10 +3615,8 @@ baseConfigurationReference = C3C9D08C1BB5A44800931F32 /* CorePlotDebug.xcconfig */; buildSettings = { CODE_SIGN_IDENTITY = "iPhone Developer"; - INFOPLIST_FILE = "$(SRCROOT)/Info/CorePlot-CocoaTouch-Info.plist"; + INFOPLIST_FILE = "$(SRCROOT)/Info/Base.lproj/CorePlot-CocoaTouch-Info.plist"; INSTALL_PATH = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)"; - IPHONEOS_DEPLOYMENT_TARGET = 6.0; - MACOSX_DEPLOYMENT_TARGET = ""; MTL_ENABLE_DEBUG_INFO = YES; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; @@ -3585,10 +3630,8 @@ baseConfigurationReference = C3C9D08D1BB5A45B00931F32 /* CorePlotRelease.xcconfig */; buildSettings = { CODE_SIGN_IDENTITY = "iPhone Developer"; - INFOPLIST_FILE = "$(SRCROOT)/Info/CorePlot-CocoaTouch-Info.plist"; + INFOPLIST_FILE = "$(SRCROOT)/Info/Base.lproj/CorePlot-CocoaTouch-Info.plist"; INSTALL_PATH = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)"; - IPHONEOS_DEPLOYMENT_TARGET = 6.0; - MACOSX_DEPLOYMENT_TARGET = ""; MTL_ENABLE_DEBUG_INFO = NO; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; @@ -3602,8 +3645,7 @@ baseConfigurationReference = C3C9D08C1BB5A44800931F32 /* CorePlotDebug.xcconfig */; buildSettings = { CODE_SIGN_IDENTITY = "iPhone Developer"; - INFOPLIST_FILE = "$(SRCROOT)/Info/CorePlot-CocoaTouchTests-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 6.0; + INFOPLIST_FILE = "$(SRCROOT)/Info/Base.lproj/CorePlot-CocoaTouchTests-Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MTL_ENABLE_DEBUG_INFO = YES; PRODUCT_BUNDLE_IDENTIFIER = "com.CorePlot.$(PRODUCT_NAME:rfc1034identifier)"; @@ -3619,8 +3661,7 @@ baseConfigurationReference = C3C9D08D1BB5A45B00931F32 /* CorePlotRelease.xcconfig */; buildSettings = { CODE_SIGN_IDENTITY = "iPhone Developer"; - INFOPLIST_FILE = "$(SRCROOT)/Info/CorePlot-CocoaTouchTests-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 6.0; + INFOPLIST_FILE = "$(SRCROOT)/Info/Base.lproj/CorePlot-CocoaTouchTests-Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MTL_ENABLE_DEBUG_INFO = NO; PRODUCT_BUNDLE_IDENTIFIER = "com.CorePlot.$(PRODUCT_NAME:rfc1034identifier)"; @@ -3639,7 +3680,6 @@ DOXYGEN_PATH = /Applications/Doxygen.app/Contents/Resources/doxygen; GCC_OPTIMIZATION_LEVEL = 0; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = "iphonesimulator iphoneos"; @@ -3654,7 +3694,6 @@ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DOXYGEN_PATH = /Applications/Doxygen.app/Contents/Resources/doxygen; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = "iphonesimulator iphoneos"; diff --git a/framework/CorePlot.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/framework/CorePlot.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 000000000..18d981003 --- /dev/null +++ b/framework/CorePlot.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/framework/CorePlot.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/framework/CorePlot.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 000000000..0c67376eb --- /dev/null +++ b/framework/CorePlot.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,5 @@ + + + + + diff --git a/framework/CorePlot.xcodeproj/xcshareddata/xcschemes/CorePlot Mac.xcscheme b/framework/CorePlot.xcodeproj/xcshareddata/xcschemes/CorePlot Mac.xcscheme index cf4ad0177..6567660c2 100644 --- a/framework/CorePlot.xcodeproj/xcshareddata/xcschemes/CorePlot Mac.xcscheme +++ b/framework/CorePlot.xcodeproj/xcshareddata/xcschemes/CorePlot Mac.xcscheme @@ -1,6 +1,6 @@ + shouldUseLaunchSchemeArgsEnv = "YES"> @@ -40,8 +39,6 @@ - - - - + shouldUseLaunchSchemeArgsEnv = "YES"> + + + + @@ -54,17 +62,6 @@ - - - - - - - - + shouldUseLaunchSchemeArgsEnv = "YES"> + + + + @@ -54,17 +62,6 @@ - - - - - - - - + shouldUseLaunchSchemeArgsEnv = "YES"> + + + + @@ -54,17 +62,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - + BlueprintIdentifier = "C37EA5C41BC83E900091C8F7" + BuildableName = "Universal tvOS Framework" + BlueprintName = "Universal tvOS Framework" + ReferencedContainer = "container:CorePlot.xcodeproj"> @@ -29,17 +29,6 @@ shouldUseLaunchSchemeArgsEnv = "YES"> - - - - - - - - - - - - - - - - diff --git a/framework/Info/CorePlot-CocoaTouch-Info.plist b/framework/Info/Base.lproj/CorePlot-CocoaTouch-Info.plist similarity index 100% rename from framework/Info/CorePlot-CocoaTouch-Info.plist rename to framework/Info/Base.lproj/CorePlot-CocoaTouch-Info.plist diff --git a/framework/Info/CorePlot-CocoaTouchTests-Info.plist b/framework/Info/Base.lproj/CorePlot-CocoaTouchTests-Info.plist similarity index 100% rename from framework/Info/CorePlot-CocoaTouchTests-Info.plist rename to framework/Info/Base.lproj/CorePlot-CocoaTouchTests-Info.plist diff --git a/framework/Info/CorePlot-Info.plist b/framework/Info/Base.lproj/CorePlot-Info.plist similarity index 100% rename from framework/Info/CorePlot-Info.plist rename to framework/Info/Base.lproj/CorePlot-Info.plist diff --git a/framework/Info/CorePlot-iOS-Info.plist b/framework/Info/Base.lproj/CorePlot-iOS-Info.plist similarity index 100% rename from framework/Info/CorePlot-iOS-Info.plist rename to framework/Info/Base.lproj/CorePlot-iOS-Info.plist diff --git a/framework/Info/CorePlot-iOSTests-Info.plist b/framework/Info/Base.lproj/CorePlot-iOSTests-Info.plist similarity index 100% rename from framework/Info/CorePlot-iOSTests-Info.plist rename to framework/Info/Base.lproj/CorePlot-iOSTests-Info.plist diff --git a/framework/Info/CorePlot-tvOS-Info.plist b/framework/Info/Base.lproj/CorePlot-tvOS-Info.plist similarity index 100% rename from framework/Info/CorePlot-tvOS-Info.plist rename to framework/Info/Base.lproj/CorePlot-tvOS-Info.plist diff --git a/framework/Info/CorePlot-tvOSTests-Info.plist b/framework/Info/Base.lproj/CorePlot-tvOSTests-Info.plist similarity index 100% rename from framework/Info/CorePlot-tvOSTests-Info.plist rename to framework/Info/Base.lproj/CorePlot-tvOSTests-Info.plist diff --git a/framework/Info/CorePlotTests-Info.plist b/framework/Info/Base.lproj/CorePlotTests-Info.plist similarity index 100% rename from framework/Info/CorePlotTests-Info.plist rename to framework/Info/Base.lproj/CorePlotTests-Info.plist diff --git a/framework/MacOnly/CPTGraphHostingView.m b/framework/MacOnly/CPTGraphHostingView.m index 70c1a73bc..531d6b06b 100644 --- a/framework/MacOnly/CPTGraphHostingView.m +++ b/framework/MacOnly/CPTGraphHostingView.m @@ -61,22 +61,32 @@ @implementation CPTGraphHostingView /// @cond --(nonnull instancetype)initWithFrame:(NSRect)frame +-(void)commonInit { - if ( (self = [super initWithFrame:frame]) ) { - hostedGraph = nil; - printRect = NSZeroRect; + self.hostedGraph = nil; + self.printRect = NSZeroRect; - closedHandCursor = [NSCursor closedHandCursor]; - openHandCursor = [NSCursor openHandCursor]; - allowPinchScaling = YES; + self.closedHandCursor = [NSCursor closedHandCursor]; + self.openHandCursor = [NSCursor openHandCursor]; + self.allowPinchScaling = YES; - locationInWindow = NSZeroPoint; - scrollOffset = CGPointZero; + self.locationInWindow = NSZeroPoint; + self.scrollOffset = CGPointZero; - if ( !self.superview.wantsLayer ) { - self.layer = [self makeBackingLayer]; - } + [self addObserver:self + forKeyPath:@"effectiveAppearance" + options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld | NSKeyValueObservingOptionInitial + context:CPTGraphHostingViewKVOContext]; + + if ( !self.superview.wantsLayer ) { + self.layer = [self makeBackingLayer]; + } +} + +-(nonnull instancetype)initWithFrame:(NSRect)frame +{ + if ((self = [super initWithFrame:frame])) { + [self commonInit]; } return self; } @@ -97,6 +107,8 @@ -(void)dealloc [space removeObserver:self forKeyPath:@"isDragging" context:CPTGraphHostingViewKVOContext]; } + [self removeObserver:self forKeyPath:@"effectiveAppearance" context:CPTGraphHostingViewKVOContext]; + [hostedGraph removeFromSuperlayer]; } @@ -124,11 +136,9 @@ -(void)encodeWithCoder:(nonnull NSCoder *)coder -(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super initWithCoder:coder]) ) { - CPTLayer *mainLayer = [[CPTLayer alloc] initWithFrame:NSRectToCGRect(self.frame)]; - self.layer = mainLayer; + if ((self = [super initWithCoder:coder])) { + [self commonInit]; - hostedGraph = nil; self.hostedGraph = [coder decodeObjectOfClass:[CPTGraph class] forKey:@"CPTLayerHostingView.hostedGraph"]; // setup layers self.printRect = [coder decodeRectForKey:@"CPTLayerHostingView.printRect"]; @@ -140,12 +150,6 @@ -(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder if ( [coder containsValueForKey:@"CPTLayerHostingView.allowPinchScaling"] ) { self.allowPinchScaling = [coder decodeBoolForKey:@"CPTLayerHostingView.allowPinchScaling"]; } - else { - self.allowPinchScaling = YES; - } - - self.locationInWindow = NSZeroPoint; - self.scrollOffset = CGPointZero; } return self; } @@ -169,7 +173,7 @@ +(BOOL)supportsSecureCoding /// @cond --(void)drawRect:(NSRect)dirtyRect +-(void)drawRect:(NSRect __unused)dirtyRect { if ( self.hostedGraph ) { if ( ![NSGraphicsContext currentContextDrawingToScreen] ) { @@ -181,19 +185,19 @@ -(void)drawRect:(NSRect)dirtyRect CGRect sourceRect = NSRectToCGRect(self.frame); CGRect destinationRect = NSRectToCGRect(self.printRect); - if ( CGRectEqualToRect(destinationRect, CGRectZero) ) { + if ( CGRectEqualToRect(destinationRect, CGRectZero)) { destinationRect = sourceRect; } // scale the view isotropically so that it fits on the printed page - CGFloat widthScale = ( sourceRect.size.width != CPTFloat(0.0) ) ? destinationRect.size.width / sourceRect.size.width : CPTFloat(1.0); - CGFloat heightScale = ( sourceRect.size.height != CPTFloat(0.0) ) ? destinationRect.size.height / sourceRect.size.height : CPTFloat(1.0); + CGFloat widthScale = (sourceRect.size.width != CPTFloat(0.0)) ? destinationRect.size.width / sourceRect.size.width : CPTFloat(1.0); + CGFloat heightScale = (sourceRect.size.height != CPTFloat(0.0)) ? destinationRect.size.height / sourceRect.size.height : CPTFloat(1.0); CGFloat scale = MIN(widthScale, heightScale); // position the view so that its centered on the printed page CGPoint offset = destinationRect.origin; - offset.x += ( ( destinationRect.size.width - (sourceRect.size.width * scale) ) / CPTFloat(2.0) ); - offset.y += ( ( destinationRect.size.height - (sourceRect.size.height * scale) ) / CPTFloat(2.0) ); + offset.x += ((destinationRect.size.width - (sourceRect.size.width * scale)) / CPTFloat(2.0)); + offset.y += ((destinationRect.size.height - (sourceRect.size.height * scale)) / CPTFloat(2.0)); NSAffineTransform *transform = [NSAffineTransform transform]; [transform translateXBy:offset.x yBy:offset.y]; @@ -225,7 +229,7 @@ -(BOOL)knowsPageRange:(nonnull NSRangePointer)rangePointer return YES; } --(NSRect)rectForPage:(NSInteger)pageNumber +-(NSRect)rectForPage:(NSInteger __unused)pageNumber { return self.printRect; } @@ -237,7 +241,7 @@ -(NSRect)rectForPage:(NSInteger)pageNumber /// @cond --(BOOL)acceptsFirstMouse:(nullable NSEvent *)theEvent +-(BOOL)acceptsFirstMouse:(nullable NSEvent *__unused)theEvent { return YES; } @@ -415,6 +419,8 @@ -(void)scrollWheel:(nonnull NSEvent *)theEvent -(void)viewDidChangeBackingProperties { + [super viewDidChangeBackingProperties]; + NSWindow *myWindow = self.window; if ( myWindow ) { @@ -442,7 +448,7 @@ -(void)resetCursorRects NSCursor *closedCursor = self.closedHandCursor; NSCursor *openCursor = self.openHandCursor; - if ( plotArea && (closedCursor || openCursor) ) { + if ( plotArea && (closedCursor || openCursor)) { BOOL allowsInteraction = NO; BOOL isDragging = NO; @@ -541,7 +547,7 @@ -(void)observeValueForKeyPath:(nullable NSString *)keyPath ofObject:(nullable id if ( [keyPath isEqualToString:@"isDragging"] && [object isKindOfClass:[CPTPlotSpace class]] ) { [self.window invalidateCursorRectsForView:self]; } - else if ( [keyPath isEqualToString:@"plotAreaFrame"] && (object == theGraph) ) { + else if ( [keyPath isEqualToString:@"plotAreaFrame"] && (object == theGraph)) { CPTPlotAreaFrame *oldPlotAreaFrame = change[NSKeyValueChangeOldKey]; CPTPlotAreaFrame *newPlotAreaFrame = change[NSKeyValueChangeNewKey]; @@ -556,7 +562,7 @@ -(void)observeValueForKeyPath:(nullable NSString *)keyPath ofObject:(nullable id context:CPTGraphHostingViewKVOContext]; } } - else if ( [keyPath isEqualToString:@"plotArea"] && (object == theGraph.plotAreaFrame) ) { + else if ( [keyPath isEqualToString:@"plotArea"] && (object == theGraph.plotAreaFrame)) { CPTPlotArea *oldPlotArea = change[NSKeyValueChangeOldKey]; CPTPlotArea *newPlotArea = change[NSKeyValueChangeNewKey]; @@ -573,6 +579,9 @@ -(void)observeValueForKeyPath:(nullable NSString *)keyPath ofObject:(nullable id object:newPlotArea]; } } + else if ( [keyPath isEqualToString:@"effectiveAppearance"] && (object == self)) { + [self.hostedGraph setNeedsDisplayAllLayers]; + } } else { [super observeValueForKeyPath:keyPath ofObject:object change:change context:context]; @@ -588,7 +597,7 @@ -(void)observeValueForKeyPath:(nullable NSString *)keyPath ofObject:(nullable id -(void)setHostedGraph:(nullable CPTGraph *)newGraph { - NSParameterAssert( (newGraph == nil) || [newGraph isKindOfClass:[CPTGraph class]] ); + NSParameterAssert((newGraph == nil) || [newGraph isKindOfClass:[CPTGraph class]]); if ( newGraph != hostedGraph ) { self.wantsLayer = YES; diff --git a/framework/MacOnly/CPTImagePlatformSpecific.m b/framework/MacOnly/CPTImagePlatformSpecific.m index 21b1a9ba8..4b845f2ba 100644 --- a/framework/MacOnly/CPTImagePlatformSpecific.m +++ b/framework/MacOnly/CPTImagePlatformSpecific.m @@ -12,7 +12,7 @@ @implementation CPTImage(CPTPlatformSpecificImageExtensions) **/ -(nonnull instancetype)initWithNativeImage:(nullable CPTNativeImage *)anImage { - if ( (self = [self init]) ) { + if ((self = [self init])) { self.nativeImage = anImage; } @@ -40,7 +40,7 @@ -(nonnull instancetype)initForPNGFile:(nonnull NSString *)path imageScale = MAX(imageScale, screen.backingScaleFactor); } - while ( imageScale > CPTFloat(1.0) ) { + while ( imageScale > CPTFloat(1.0)) { NSMutableString *hiDpiPath = [path mutableCopy]; NSUInteger replaceCount = [hiDpiPath replaceOccurrencesOfString:@".png" withString:[NSString stringWithFormat:@"@%dx.png", (int)imageScale] diff --git a/framework/MacOnly/CPTPlatformSpecificCategories.h b/framework/MacOnly/CPTPlatformSpecificCategories.h index 96732d478..2102bc1bf 100644 --- a/framework/MacOnly/CPTPlatformSpecificCategories.h +++ b/framework/MacOnly/CPTPlatformSpecificCategories.h @@ -16,17 +16,6 @@ @end -#pragma mark - CPTColor - -/** @category CPTColor(CPTPlatformSpecificColorExtensions) - * @brief Platform-specific extensions to CPTColor. - **/ -@interface CPTColor(CPTPlatformSpecificColorExtensions) - -@property (nonatomic, readonly, nonnull) NSColor *nsColor; - -@end - #pragma mark - NSAttributedString /** @category NSAttributedString(CPTPlatformSpecificAttributedStringExtensions) @@ -39,4 +28,9 @@ -(void)drawInRect:(CGRect)rect inContext:(nonnull CGContextRef)context; /// @} +/// @name Measurement +/// @{ +-(CGSize)sizeAsDrawn; +/// @} + @end diff --git a/framework/MacOnly/CPTPlatformSpecificCategories.m b/framework/MacOnly/CPTPlatformSpecificCategories.m index b87e1ab6d..8b6229cc5 100644 --- a/framework/MacOnly/CPTPlatformSpecificCategories.m +++ b/framework/MacOnly/CPTPlatformSpecificCategories.m @@ -19,9 +19,12 @@ -(nonnull CPTNativeImage *)imageOfLayer CGFloat scale = 0.0; if ( [self respondsToSelector:@selector(hostingView)] ) { - scale = ( (CPTGraph *)self ).hostingView.window.backingScaleFactor; + scale = ((CPTGraph *)self).hostingView.window.backingScaleFactor; } - else { + if ((scale == 0.0) && [CALayer instancesRespondToSelector:@selector(contentsScale)] ) { + scale = self.contentsScale; + } + if ( scale == 0.0 ) { NSWindow *myWindow = self.graph.hostingView.window; if ( myWindow ) { @@ -31,6 +34,7 @@ -(nonnull CPTNativeImage *)imageOfLayer scale = [NSScreen mainScreen].backingScaleFactor; } } + scale = MAX(scale, CPTFloat(1.0)); NSBitmapImageRep *layerImage = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL @@ -52,7 +56,7 @@ -(nonnull CPTNativeImage *)imageOfLayer NSGraphicsContext *bitmapContext = [NSGraphicsContext graphicsContextWithBitmapImageRep:layerImage]; CGContextRef context = (CGContextRef)bitmapContext.graphicsPort; - CGContextClearRect( context, CPTRectMake(0.0, 0.0, boundsSize.width, boundsSize.height) ); + CGContextClearRect(context, CPTRectMake(0.0, 0.0, boundsSize.width, boundsSize.height)); CGContextSetAllowsAntialiasing(context, true); CGContextSetShouldSmoothFonts(context, false); [self layoutAndRenderInContext:context]; @@ -66,22 +70,6 @@ -(nonnull CPTNativeImage *)imageOfLayer @end -#pragma mark - CPTColor - -@implementation CPTColor(CPTPlatformSpecificColorExtensions) - -/** @property nsColor - * @brief Gets the color value as an NSColor. - **/ -@dynamic nsColor; - --(nonnull NSColor *)nsColor -{ - return [NSColor colorWithCIColor:[CIColor colorWithCGColor:self.cgColor]]; -} - -@end - #pragma mark - NSAttributedString @implementation NSAttributedString(CPTPlatformSpecificAttributedStringExtensions) @@ -95,9 +83,34 @@ -(void)drawInRect:(CGRect)rect inContext:(nonnull CGContextRef)context CPTPushCGContext(context); [self drawWithRect:NSRectFromCGRect(rect) - options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading | NSStringDrawingTruncatesLastVisibleLine]; + options:CPTStringDrawingOptions]; CPTPopCGContext(); } +/** + * @brief Computes the size of the styled text when drawn rounded up to the nearest whole number in each dimension. + **/ +-(CGSize)sizeAsDrawn +{ + CGRect rect = CGRectZero; + + if ( [self respondsToSelector:@selector(boundingRectWithSize:options:context:)] ) { + rect = [self boundingRectWithSize:CPTSizeMake(10000.0, 10000.0) + options:CPTStringDrawingOptions + context:nil]; + } + else { + rect = [self boundingRectWithSize:CPTSizeMake(10000.0, 10000.0) + options:CPTStringDrawingOptions]; + } + + CGSize textSize = rect.size; + + textSize.width = ceil(textSize.width); + textSize.height = ceil(textSize.height); + + return textSize; +} + @end diff --git a/framework/MacOnly/CPTPlatformSpecificDefines.h b/framework/MacOnly/CPTPlatformSpecificDefines.h index 354989f9f..24d77c3c6 100644 --- a/framework/MacOnly/CPTPlatformSpecificDefines.h +++ b/framework/MacOnly/CPTPlatformSpecificDefines.h @@ -1,4 +1,6 @@ /// @file +typedef NSColor CPTNativeColor; ///< Platform-native color. typedef NSImage CPTNativeImage; ///< Platform-native image format. typedef NSEvent CPTNativeEvent; ///< Platform-native OS event. +typedef NSFont CPTNativeFont; ///< Platform-native font. diff --git a/framework/MacOnly/CPTPlatformSpecificFunctions.m b/framework/MacOnly/CPTPlatformSpecificFunctions.m index e32552b18..4e5668a58 100644 --- a/framework/MacOnly/CPTPlatformSpecificFunctions.m +++ b/framework/MacOnly/CPTPlatformSpecificFunctions.m @@ -109,7 +109,7 @@ CPTRGBAColor CPTRGBAColorFromNSColor(NSColor *__nonnull nsColor) #pragma mark - #pragma mark Debugging -CPTNativeImage * __nonnull CPTQuickLookImage(CGRect rect, __nonnull CPTQuickLookImageBlock renderBlock) +CPTNativeImage *__nonnull CPTQuickLookImage(CGRect rect, __nonnull CPTQuickLookImageBlock renderBlock) { NSBitmapImageRep *layerImage = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL diff --git a/framework/MacOnly/CPTTextStylePlatformSpecific.h b/framework/MacOnly/CPTTextStylePlatformSpecific.h index dcb6919af..3dbcb7fc9 100644 --- a/framework/MacOnly/CPTTextStylePlatformSpecific.h +++ b/framework/MacOnly/CPTTextStylePlatformSpecific.h @@ -3,6 +3,15 @@ /** * @brief Enumeration of paragraph alignments. **/ +#if (MAC_OS_X_VERSION_MAX_ALLOWED >= 101200) +typedef NS_ENUM (NSInteger, CPTTextAlignment) { + CPTTextAlignmentLeft = NSTextAlignmentLeft, ///< Left alignment. + CPTTextAlignmentCenter = NSTextAlignmentCenter, ///< Center alignment. + CPTTextAlignmentRight = NSTextAlignmentRight, ///< Right alignment. + CPTTextAlignmentJustified = NSTextAlignmentJustified, ///< Justified alignment. + CPTTextAlignmentNatural = NSTextAlignmentNatural ///< Natural alignment of the text's script. +}; +#else typedef NS_ENUM (NSInteger, CPTTextAlignment) { CPTTextAlignmentLeft = NSLeftTextAlignment, ///< Left alignment. CPTTextAlignmentCenter = NSCenterTextAlignment, ///< Center alignment. @@ -10,3 +19,4 @@ typedef NS_ENUM (NSInteger, CPTTextAlignment) { CPTTextAlignmentJustified = NSJustifiedTextAlignment, ///< Justified alignment. CPTTextAlignmentNatural = NSNaturalTextAlignment ///< Natural alignment of the text's script. }; +#endif diff --git a/framework/MacOnly/CPTTextStylePlatformSpecific.m b/framework/MacOnly/CPTTextStylePlatformSpecific.m index b733fc305..21af2ac93 100644 --- a/framework/MacOnly/CPTTextStylePlatformSpecific.m +++ b/framework/MacOnly/CPTTextStylePlatformSpecific.m @@ -40,6 +40,7 @@ +(nonnull instancetype)textStyleWithAttributes:(nullable CPTDictionary *)attribu NSFont *styleFont = attributes[NSFontAttributeName]; if ( styleFont ) { + newStyle.font = styleFont; newStyle.fontName = styleFont.fontName; newStyle.fontSize = styleFont.pointSize; } @@ -47,14 +48,14 @@ +(nonnull instancetype)textStyleWithAttributes:(nullable CPTDictionary *)attribu // Color NSColor *styleColor = attributes[NSForegroundColorAttributeName]; if ( styleColor ) { - // CGColor property is available in Mac OS 10.8 and later + // CGColor property is available in macOS 10.8 and later if ( [styleColor respondsToSelector:@selector(CGColor)] ) { newStyle.color = [CPTColor colorWithCGColor:styleColor.CGColor]; } else { const NSInteger numberOfComponents = styleColor.numberOfComponents; - CGFloat *components = calloc( (size_t)numberOfComponents, sizeof(CGFloat) ); + CGFloat *components = calloc((size_t)numberOfComponents, sizeof(CGFloat)); [styleColor getComponents:components]; CGColorSpaceRef colorSpace = styleColor.colorSpace.CGColorSpace; @@ -87,10 +88,10 @@ -(nonnull CPTDictionary *)attributes CPTMutableDictionary *myAttributes = [NSMutableDictionary dictionary]; // Font - NSFont *styleFont = nil; + NSFont *styleFont = self.font; NSString *fontName = self.fontName; - if ( fontName ) { + if ((styleFont == nil) && fontName ) { styleFont = [NSFont fontWithName:fontName size:self.fontSize]; } @@ -146,6 +147,7 @@ +(nonnull instancetype)textStyleWithAttributes:(nullable CPTDictionary *)attribu NSFont *styleFont = attributes[NSFontAttributeName]; if ( styleFont ) { + newStyle.font = styleFont; newStyle.fontName = styleFont.fontName; newStyle.fontSize = styleFont.pointSize; } @@ -153,14 +155,14 @@ +(nonnull instancetype)textStyleWithAttributes:(nullable CPTDictionary *)attribu // Color NSColor *styleColor = attributes[NSForegroundColorAttributeName]; if ( styleColor ) { - // CGColor property is available in Mac OS 10.8 and later + // CGColor property is available in macOS 10.8 and later if ( [styleColor respondsToSelector:@selector(CGColor)] ) { newStyle.color = [CPTColor colorWithCGColor:styleColor.CGColor]; } else { const NSInteger numberOfComponents = styleColor.numberOfComponents; - CGFloat *components = calloc( (size_t)numberOfComponents, sizeof(CGFloat) ); + CGFloat *components = calloc((size_t)numberOfComponents, sizeof(CGFloat)); [styleColor getComponents:components]; CGColorSpaceRef colorSpace = styleColor.colorSpace.CGColorSpace; @@ -198,26 +200,25 @@ @implementation NSString(CPTTextStyleExtensions) **/ -(CGSize)sizeWithTextStyle:(nullable CPTTextStyle *)style { - NSFont *theFont = nil; - NSString *fontName = style.fontName; + CGRect rect = CGRectZero; - if ( fontName ) { - theFont = [NSFont fontWithName:fontName size:style.fontSize]; - } - - CGSize textSize; - - if ( theFont ) { - CPTDictionary *attributes = @{ - NSFontAttributeName: theFont - }; - - textSize = NSSizeToCGSize([self sizeWithAttributes:attributes]); + if ( [self respondsToSelector:@selector(boundingRectWithSize:options:attributes:context:)] ) { + rect = [self boundingRectWithSize:CPTSizeMake(10000.0, 10000.0) + options:CPTStringDrawingOptions + attributes:style.attributes + context:nil]; } else { - textSize = CGSizeZero; + rect = [self boundingRectWithSize:CPTSizeMake(10000.0, 10000.0) + options:CPTStringDrawingOptions + attributes:style.attributes]; } + CGSize textSize = rect.size; + + textSize.width = ceil(textSize.width); + textSize.height = ceil(textSize.height); + return textSize; } @@ -242,10 +243,10 @@ -(void)drawInRect:(CGRect)rect withTextStyle:(nullable CPTTextStyle *)style inCo CPTPushCGContext(context); - NSFont *theFont = nil; + NSFont *theFont = style.font; NSString *fontName = style.fontName; - if ( fontName ) { + if ((theFont == nil) && fontName ) { theFont = [NSFont fontWithName:fontName size:style.fontSize]; } @@ -256,12 +257,12 @@ -(void)drawInRect:(CGRect)rect withTextStyle:(nullable CPTTextStyle *)style inCo paragraphStyle.lineBreakMode = style.lineBreakMode; CPTDictionary *attributes = @{ - NSFontAttributeName: theFont, - NSForegroundColorAttributeName: foregroundColor, - NSParagraphStyleAttributeName: paragraphStyle + NSFontAttributeName: theFont, + NSForegroundColorAttributeName: foregroundColor, + NSParagraphStyleAttributeName: paragraphStyle }; [self drawWithRect:NSRectFromCGRect(rect) - options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading | NSStringDrawingTruncatesLastVisibleLine + options:CPTStringDrawingOptions attributes:attributes]; } CPTPopCGContext(); diff --git a/framework/Source/CPTAnimation.h b/framework/Source/CPTAnimation.h index 1802cde6c..93f0e48ba 100644 --- a/framework/Source/CPTAnimation.h +++ b/framework/Source/CPTAnimation.h @@ -1,3 +1,5 @@ +#import + @class CPTAnimationOperation; @class CPTAnimationPeriod; @@ -39,10 +41,18 @@ typedef NS_ENUM (NSInteger, CPTAnimationCurve) { CPTAnimationCurveQuinticInOut ///< Quintic in and out animation curve. }; +#pragma mark - + /** * @brief Animation delegate. **/ +#if ((TARGET_OS_SIMULATOR || TARGET_OS_IPHONE || TARGET_OS_TV) && (__IPHONE_OS_VERSION_MAX_ALLOWED >= 100000)) \ + || (TARGET_OS_MAC && (MAC_OS_X_VERSION_MAX_ALLOWED >= 101200)) +// CAAnimationDelegate is defined by Core Animation in iOS 10.0+, macOS 10.12+, and tvOS 10.0+ +@protocol CPTAnimationDelegate +#else @protocol CPTAnimationDelegate +#endif @optional diff --git a/framework/Source/CPTAnimation.m b/framework/Source/CPTAnimation.m index b4ff5f3e6..a626f2dc7 100644 --- a/framework/Source/CPTAnimation.m +++ b/framework/Source/CPTAnimation.m @@ -1,10 +1,10 @@ #import "CPTAnimation.h" +#import "_CPTAnimationTimingFunctions.h" #import "CPTAnimationOperation.h" #import "CPTAnimationPeriod.h" #import "CPTDefinitions.h" #import "CPTPlotRange.h" -#import "_CPTAnimationTimingFunctions.h" static const CGFloat kCPTAnimationFrameRate = CPTFloat(1.0 / 60.0); // 60 frames per second @@ -100,7 +100,7 @@ @implementation CPTAnimation **/ -(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { animationOperations = [[NSMutableArray alloc] init]; runningAnimationOperations = [[NSMutableArray alloc] init]; timer = NULL; @@ -200,7 +200,7 @@ -(CPTAnimationOperation *)addAnimationOperation:(nonnull CPTAnimationOperation * id boundObject = animationOperation.boundObject; CPTAnimationPeriod *period = animationOperation.period; - if ( animationOperation.delegate || (boundObject && period && ![period.startValue isEqual:period.endValue]) ) { + if ( animationOperation.delegate || (boundObject && period && ![period.startValue isEqual:period.endValue])) { dispatch_async(self.animationQueue, ^{ [self.animationOperations addObject:animationOperation]; @@ -277,7 +277,7 @@ -(void)update CGFloat duration = period.duration; CGFloat startTime = period.startOffset; CGFloat delay = period.delay; - if ( isnan(delay) ) { + if ( isnan(delay)) { if ( [period canStartWithValueFromObject:animationOperation.boundObject propertyGetter:animationOperation.boundGetter] ) { period.delay = currentTime - startTime; startTime = currentTime; @@ -315,7 +315,7 @@ -(void)update for ( CPTAnimationOperation *operation in runningOperations ) { if ( operation.boundObject == boundObject ) { - if ( (operation.boundGetter == boundGetter) && (operation.boundSetter == boundSetter) ) { + if ((operation.boundGetter == boundGetter) && (operation.boundSetter == boundSetter)) { operation.canceled = YES; } } @@ -334,11 +334,11 @@ -(void)update CGFloat progress = timingFunction(currentTime - startTime, duration); CPTDictionary *parameters = @{ - CPTAnimationOperationKey: animationOperation, - CPTAnimationValueKey: [period tweenedValueForProgress:progress], - CPTAnimationValueClassKey: valueClass ? valueClass : [NSNull null], - CPTAnimationStartedKey: @(started), - CPTAnimationFinishedKey: @(currentTime >= endTime) + CPTAnimationOperationKey: animationOperation, + CPTAnimationValueKey: [period tweenedValueForProgress:progress], + CPTAnimationValueClassKey: valueClass ? valueClass : [NSNull null], + CPTAnimationStartedKey: @(started), + CPTAnimationFinishedKey: @(currentTime >= endTime) }; // Used -performSelectorOnMainThread:... instead of GCD to ensure the animation continues to run in all run loop common modes. @@ -400,13 +400,20 @@ -(void)updateOnMainThreadWithParameters:(nonnull CPTDictionary *)parameters id boundObject = animationOperation.boundObject; id tweenedValue = parameters[CPTAnimationValueKey]; - if ( [tweenedValue isKindOfClass:[NSDecimalNumber class]] ) { - NSDecimal buffer = ( (NSDecimalNumber *)tweenedValue ).decimalValue; + if ( !valueClass && [tweenedValue isKindOfClass:[NSDecimalNumber class]] ) { + NSDecimal buffer = ((NSDecimalNumber *)tweenedValue).decimalValue; typedef void (*SetterType)(id, SEL, NSDecimal); SetterType setterMethod = (SetterType)[boundObject methodForSelector:boundSetter]; setterMethod(boundObject, boundSetter, buffer); } + else if ( valueClass && [tweenedValue isKindOfClass:[NSNumber class]] ) { + NSNumber *value = (NSNumber *)tweenedValue; + + typedef void (*NumberSetterType)(id, SEL, NSNumber *); + NumberSetterType setterMethod = (NumberSetterType)[boundObject methodForSelector:boundSetter]; + setterMethod(boundObject, boundSetter, value); + } else if ( [tweenedValue isKindOfClass:[CPTPlotRange class]] ) { CPTPlotRange *range = (CPTPlotRange *)tweenedValue; @@ -425,7 +432,7 @@ -(void)updateOnMainThreadWithParameters:(nonnull CPTDictionary *)parameters invocation.target = boundObject; invocation.selector = boundSetter; - void *buffer = malloc(bufferSize); + void *buffer = calloc(1, bufferSize); [value getValue:buffer]; [invocation setArgument:buffer atIndex:2]; free(buffer); diff --git a/framework/Source/CPTAnimationOperation.m b/framework/Source/CPTAnimationOperation.m index f807cca63..e7047abc5 100644 --- a/framework/Source/CPTAnimationOperation.m +++ b/framework/Source/CPTAnimationOperation.m @@ -77,7 +77,7 @@ @implementation CPTAnimationOperation **/ -(nonnull instancetype)initWithAnimationPeriod:(nonnull CPTAnimationPeriod *)animationPeriod animationCurve:(CPTAnimationCurve)curve object:(nonnull id)object getter:(nonnull SEL)getter setter:(nonnull SEL)setter { - if ( (self = [super init]) ) { + if ((self = [super init])) { period = animationPeriod; animationCurve = curve; boundObject = object; diff --git a/framework/Source/CPTAnimationPeriod.m b/framework/Source/CPTAnimationPeriod.m index 4fac622c7..3d781b79c 100644 --- a/framework/Source/CPTAnimationPeriod.m +++ b/framework/Source/CPTAnimationPeriod.m @@ -1,8 +1,5 @@ #import "CPTAnimationPeriod.h" -#import "CPTAnimationOperation.h" -#import "CPTPlotRange.h" -#import "NSNumberExtensions.h" #import "_CPTAnimationCGFloatPeriod.h" #import "_CPTAnimationCGPointPeriod.h" #import "_CPTAnimationCGRectPeriod.h" @@ -10,6 +7,9 @@ #import "_CPTAnimationNSDecimalPeriod.h" #import "_CPTAnimationNSNumberPeriod.h" #import "_CPTAnimationPlotRangePeriod.h" +#import "CPTAnimationOperation.h" +#import "CPTPlotRange.h" +#import "NSNumberExtensions.h" /// @cond @interface CPTAnimationPeriod() @@ -125,7 +125,7 @@ +(nonnull instancetype)periodWithStartPoint:(CGPoint)aStartPoint endPoint:(CGPoi { NSValue *start = nil; - if ( !isnan(aStartPoint.x) && !isnan(aStartPoint.y) ) { + if ( !isnan(aStartPoint.x) && !isnan(aStartPoint.y)) { start = [NSValue valueWithBytes:&aStartPoint objCType:@encode(CGPoint)]; } @@ -148,7 +148,7 @@ +(nonnull instancetype)periodWithStartSize:(CGSize)aStartSize endSize:(CGSize)an { NSValue *start = nil; - if ( !isnan(aStartSize.width) && !isnan(aStartSize.height) ) { + if ( !isnan(aStartSize.width) && !isnan(aStartSize.height)) { start = [NSValue valueWithBytes:&aStartSize objCType:@encode(CGSize)]; } @@ -171,7 +171,7 @@ +(nonnull instancetype)periodWithStartRect:(CGRect)aStartRect endRect:(CGRect)an { NSValue *start = nil; - if ( !CGRectEqualToRect(aStartRect, CGRectNull) && !isnan(aStartRect.origin.x) && !isnan(aStartRect.origin.y) && !isnan(aStartRect.size.width) && !isnan(aStartRect.size.height) ) { + if ( !CGRectEqualToRect(aStartRect, CGRectNull) && !isnan(aStartRect.origin.x) && !isnan(aStartRect.origin.y) && !isnan(aStartRect.size.width) && !isnan(aStartRect.size.height)) { start = [NSValue valueWithBytes:&aStartRect objCType:@encode(CGRect)]; } @@ -230,7 +230,7 @@ +(nonnull instancetype)periodWithStartPlotRange:(nonnull CPTPlotRange *)aStartPl { CPTPlotRange *startRange = aStartPlotRange; - if ( isnan(aStartPlotRange.locationDouble) || isnan(aStartPlotRange.lengthDouble) ) { + if ( isnan(aStartPlotRange.locationDouble) || isnan(aStartPlotRange.lengthDouble)) { startRange = nil; } @@ -263,7 +263,7 @@ +(nonnull instancetype)periodWithStartPlotRange:(nonnull CPTPlotRange *)aStartPl **/ -(instancetype)initWithStartValue:(NSValue *)aStartValue endValue:(NSValue *)anEndValue ofClass:(Class)class duration:(CGFloat)aDuration withDelay:(CGFloat)aDelay { - if ( (self = [super init]) ) { + if ((self = [super init])) { startValue = [aStartValue copy]; endValue = [anEndValue copy]; valueClass = class; @@ -310,7 +310,7 @@ -(nonnull instancetype)initWithStartPoint:(CGPoint)aStartPoint endPoint:(CGPoint { NSValue *start = nil; - if ( !isnan(aStartPoint.x) && !isnan(aStartPoint.y) ) { + if ( !isnan(aStartPoint.x) && !isnan(aStartPoint.y)) { start = [NSValue valueWithBytes:&aStartPoint objCType:@encode(CGPoint)]; } @@ -335,7 +335,7 @@ -(nonnull instancetype)initWithStartSize:(CGSize)aStartSize endSize:(CGSize)anEn { NSValue *start = nil; - if ( !isnan(aStartSize.width) && !isnan(aStartSize.height) ) { + if ( !isnan(aStartSize.width) && !isnan(aStartSize.height)) { start = [NSValue valueWithBytes:&aStartSize objCType:@encode(CGSize)]; } @@ -360,7 +360,7 @@ -(nonnull instancetype)initWithStartRect:(CGRect)aStartRect endRect:(CGRect)anEn { NSValue *start = nil; - if ( !CGRectEqualToRect(aStartRect, CGRectNull) && !isnan(aStartRect.origin.x) && !isnan(aStartRect.origin.y) && !isnan(aStartRect.size.width) && !isnan(aStartRect.size.height) ) { + if ( !CGRectEqualToRect(aStartRect, CGRectNull) && !isnan(aStartRect.origin.x) && !isnan(aStartRect.origin.y) && !isnan(aStartRect.size.width) && !isnan(aStartRect.size.height)) { start = [NSValue valueWithBytes:&aStartRect objCType:@encode(CGRect)]; } @@ -425,7 +425,7 @@ -(nonnull instancetype)initWithStartPlotRange:(nonnull CPTPlotRange *)aStartPlot { CPTPlotRange *startRange = aStartPlotRange; - if ( isnan(aStartPlotRange.locationDouble) || isnan(aStartPlotRange.lengthDouble) ) { + if ( isnan(aStartPlotRange.locationDouble) || isnan(aStartPlotRange.lengthDouble)) { startRange = nil; } @@ -458,7 +458,7 @@ -(nonnull instancetype)init * @param boundObject The object to update for each animation frame. * @param boundGetter The getter method for the property to update. **/ --(void)setStartValueFromObject:(nonnull id)boundObject propertyGetter:(nonnull SEL)boundGetter +-(void)setStartValueFromObject:(nonnull id __unused)boundObject propertyGetter:(nonnull SEL __unused)boundGetter { [NSException raise:NSGenericException format:@"The -initializeStartValue method must be implemented by CPTAnimationPeriod subclasses."]; @@ -472,7 +472,7 @@ -(void)setStartValueFromObject:(nonnull id)boundObject propertyGetter:(nonnull S * @param progress The fraction of the animation progress. * @return The computed value. **/ --(nonnull NSValue *)tweenedValueForProgress:(CGFloat)progress +-(nonnull NSValue *)tweenedValueForProgress:(CGFloat __unused)progress { [NSException raise:NSGenericException format:@"The -tweenedValueForProgress: method must be implemented by CPTAnimationPeriod subclasses."]; @@ -485,7 +485,7 @@ -(nonnull NSValue *)tweenedValueForProgress:(CGFloat)progress * @param boundGetter The getter method for the property to update. * @return @YES if the current value of the bound property is between the start and end value. **/ --(BOOL)canStartWithValueFromObject:(nonnull id)boundObject propertyGetter:(nonnull SEL)boundGetter +-(BOOL)canStartWithValueFromObject:(nonnull id __unused)boundObject propertyGetter:(nonnull SEL __unused)boundGetter { [NSException raise:NSGenericException format:@"The -canStartWithValueFromObject:propertyGetter: method must be implemented by CPTAnimationPeriod subclasses."]; diff --git a/framework/Source/CPTAnnotation.m b/framework/Source/CPTAnnotation.m index 5021c4eaf..18483ec57 100644 --- a/framework/Source/CPTAnnotation.m +++ b/framework/Source/CPTAnnotation.m @@ -55,7 +55,7 @@ @implementation CPTAnnotation **/ -(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { annotationHostLayer = nil; contentLayer = nil; displacement = CGPointZero; @@ -83,7 +83,7 @@ -(void)encodeWithCoder:(nonnull NSCoder *)coder -(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super init]) ) { + if ((self = [super init])) { annotationHostLayer = [coder decodeObjectOfClass:[CPTAnnotationHostLayer class] forKey:@"CPTAnnotation.annotationHostLayer"]; contentLayer = [coder decodeObjectOfClass:[CPTLayer class] @@ -155,7 +155,7 @@ -(void)setAnnotationHostLayer:(nullable CPTAnnotationHostLayer *)newLayer -(void)setDisplacement:(CGPoint)newDisplacement { - if ( !CGPointEqualToPoint(newDisplacement, displacement) ) { + if ( !CGPointEqualToPoint(newDisplacement, displacement)) { displacement = newDisplacement; [self.contentLayer.superlayer setNeedsLayout]; } @@ -163,7 +163,7 @@ -(void)setDisplacement:(CGPoint)newDisplacement -(void)setContentAnchorPoint:(CGPoint)newAnchorPoint { - if ( !CGPointEqualToPoint(newAnchorPoint, contentAnchorPoint) ) { + if ( !CGPointEqualToPoint(newAnchorPoint, contentAnchorPoint)) { contentAnchorPoint = newAnchorPoint; [self.contentLayer.superlayer setNeedsLayout]; } diff --git a/framework/Source/CPTAnnotationHostLayer.m b/framework/Source/CPTAnnotationHostLayer.m index 701b8b859..6fa9af69b 100644 --- a/framework/Source/CPTAnnotationHostLayer.m +++ b/framework/Source/CPTAnnotationHostLayer.m @@ -43,7 +43,7 @@ @implementation CPTAnnotationHostLayer **/ -(nonnull instancetype)initWithFrame:(CGRect)newFrame { - if ( (self = [super initWithFrame:newFrame]) ) { + if ((self = [super initWithFrame:newFrame])) { mutableAnnotations = [[NSMutableArray alloc] init]; } return self; @@ -55,7 +55,7 @@ -(nonnull instancetype)initWithFrame:(CGRect)newFrame -(nonnull instancetype)initWithLayer:(nonnull id)layer { - if ( (self = [super initWithLayer:layer]) ) { + if ((self = [super initWithLayer:layer])) { CPTAnnotationHostLayer *theLayer = (CPTAnnotationHostLayer *)layer; mutableAnnotations = theLayer->mutableAnnotations; @@ -79,7 +79,7 @@ -(void)encodeWithCoder:(nonnull NSCoder *)coder -(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super initWithCoder:coder]) ) { + if ((self = [super initWithCoder:coder])) { CPTAnnotationArray *annotations = [coder decodeObjectOfClasses:[NSSet setWithArray:@[[NSArray class], [CPTAnnotation class]]] forKey:@"CPTAnnotationHostLayer.mutableAnnotations"]; if ( annotations ) { @@ -230,7 +230,7 @@ -(BOOL)pointingDeviceDownEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint) for ( CPTAnnotation *annotation in self.annotations ) { CPTLayer *content = annotation.contentLayer; if ( content ) { - if ( CGRectContainsPoint(content.frame, interactionPoint) ) { + if ( CGRectContainsPoint(content.frame, interactionPoint)) { BOOL handled = [content pointingDeviceDownEvent:event atPoint:interactionPoint]; if ( handled ) { return YES; @@ -261,7 +261,7 @@ -(BOOL)pointingDeviceUpEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)in for ( CPTAnnotation *annotation in self.annotations ) { CPTLayer *content = annotation.contentLayer; if ( content ) { - if ( CGRectContainsPoint(content.frame, interactionPoint) ) { + if ( CGRectContainsPoint(content.frame, interactionPoint)) { BOOL handled = [content pointingDeviceUpEvent:event atPoint:interactionPoint]; if ( handled ) { return YES; @@ -292,7 +292,7 @@ -(BOOL)pointingDeviceDraggedEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoi for ( CPTAnnotation *annotation in self.annotations ) { CPTLayer *content = annotation.contentLayer; if ( content ) { - if ( CGRectContainsPoint(content.frame, interactionPoint) ) { + if ( CGRectContainsPoint(content.frame, interactionPoint)) { BOOL handled = [content pointingDeviceDraggedEvent:event atPoint:interactionPoint]; if ( handled ) { return YES; diff --git a/framework/Source/CPTAxis.h b/framework/Source/CPTAxis.h index 2bde6b4ed..65bec6a8a 100644 --- a/framework/Source/CPTAxis.h +++ b/framework/Source/CPTAxis.h @@ -44,7 +44,7 @@ typedef NSMutableArray<__kindof CPTAxis *> CPTMutableAxisArray; /** * @brief Axis labeling delegate. **/ -@protocol CPTAxisDelegate +@protocol CPTAxisDelegate @optional diff --git a/framework/Source/CPTAxis.m b/framework/Source/CPTAxis.m index d91deca53..102318084 100644 --- a/framework/Source/CPTAxis.m +++ b/framework/Source/CPTAxis.m @@ -22,7 +22,7 @@ /** @defgroup axisAnimation Axes * @brief Axis properties that can be animated using Core Animation. * @if MacOnly - * @since Custom layer property animation is supported on MacOS 10.6 and later. + * @since Custom layer property animation is supported on macOS 10.6 and later. * @endif * @ingroup animation **/ @@ -540,7 +540,7 @@ @implementation CPTAxis **/ -(nonnull instancetype)initWithFrame:(CGRect)newFrame { - if ( (self = [super initWithFrame:newFrame]) ) { + if ((self = [super initWithFrame:newFrame])) { plotSpace = nil; majorTickLocations = [NSSet set]; minorTickLocations = [NSSet set]; @@ -619,7 +619,7 @@ -(nonnull instancetype)initWithFrame:(CGRect)newFrame -(nonnull instancetype)initWithLayer:(nonnull id)layer { - if ( (self = [super initWithLayer:layer]) ) { + if ((self = [super initWithLayer:layer])) { CPTAxis *theLayer = (CPTAxis *)layer; plotSpace = theLayer->plotSpace; @@ -774,7 +774,7 @@ -(void)encodeWithCoder:(nonnull NSCoder *)coder -(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super initWithCoder:coder]) ) { + if ((self = [super initWithCoder:coder])) { coordinate = (CPTCoordinate)[coder decodeIntegerForKey:@"CPTAxis.coordinate"]; plotSpace = [coder decodeObjectOfClass:[CPTPlotSpace class] forKey:@"CPTAxis.plotSpace"]; @@ -940,7 +940,7 @@ -(void)generateFixedIntervalMajorTickLocations:(CPTNumberSet *__autoreleasing *) NSDecimal zero = CPTDecimalFromInteger(0); NSDecimal majorInterval = self.majorIntervalLength.decimalValue; - if ( CPTDecimalGreaterThan(majorInterval, zero) ) { + if ( CPTDecimalGreaterThan(majorInterval, zero)) { CPTMutablePlotRange *range = [[self.plotSpace plotRangeForCoordinate:self.coordinate] mutableCopy]; if ( range ) { CPTPlotRange *theVisibleRange = self.visibleRange; @@ -954,7 +954,7 @@ -(void)generateFixedIntervalMajorTickLocations:(CPTNumberSet *__autoreleasing *) NSDecimal minorInterval; NSUInteger minorTickCount = self.minorTicksPerInterval; if ( minorTickCount > 0 ) { - minorInterval = CPTDecimalDivide( majorInterval, CPTDecimalFromUnsignedInteger(minorTickCount + 1) ); + minorInterval = CPTDecimalDivide(majorInterval, CPTDecimalFromUnsignedInteger(minorTickCount + 1)); } else { minorInterval = zero; @@ -971,7 +971,7 @@ -(void)generateFixedIntervalMajorTickLocations:(CPTNumberSet *__autoreleasing *) NSDecimal minorCoord = CPTDecimalSubtract(coord, minorInterval); for ( NSUInteger minorTickIndex = 0; minorTickIndex < minorTickCount; minorTickIndex++ ) { - if ( CPTDecimalLessThan(minorCoord, rangeMin) ) { + if ( CPTDecimalLessThan(minorCoord, rangeMin)) { break; } [minorLocations addObject:[NSDecimalNumber decimalNumberWithDecimal:minorCoord]]; @@ -980,7 +980,7 @@ -(void)generateFixedIntervalMajorTickLocations:(CPTNumberSet *__autoreleasing *) } // Set tick locations - while ( CPTDecimalLessThanOrEqualTo(coord, rangeMax) ) { + while ( CPTDecimalLessThanOrEqualTo(coord, rangeMax)) { // Major tick [majorLocations addObject:[NSDecimalNumber decimalNumberWithDecimal:coord]]; @@ -989,7 +989,7 @@ -(void)generateFixedIntervalMajorTickLocations:(CPTNumberSet *__autoreleasing *) NSDecimal minorCoord = CPTDecimalAdd(coord, minorInterval); for ( NSUInteger minorTickIndex = 0; minorTickIndex < minorTickCount; minorTickIndex++ ) { - if ( CPTDecimalGreaterThan(minorCoord, rangeMax) ) { + if ( CPTDecimalGreaterThan(minorCoord, rangeMax)) { break; } [minorLocations addObject:[NSDecimalNumber decimalNumberWithDecimal:minorCoord]]; @@ -1037,7 +1037,7 @@ -(void)autoGenerateMajorTickLocations:(CPTNumberSet *__autoreleasing *)newMajorL case CPTScaleTypeLog: // supported scale type--check range - if ( (range.minLimitDouble <= 0.0) || (range.maxLimitDouble <= 0.0) ) { + if ((range.minLimitDouble <= 0.0) || (range.maxLimitDouble <= 0.0)) { valid = NO; } break; @@ -1064,7 +1064,7 @@ -(void)autoGenerateMajorTickLocations:(CPTNumberSet *__autoreleasing *)newMajorL double length = fabs(range.lengthDouble); // Filter troublesome values and return empty sets - if ( length != 0.0 ) { + if ((length != 0.0) && !isinf(length)) { switch ( scaleType ) { case CPTScaleTypeLinear: { @@ -1091,16 +1091,16 @@ -(void)autoGenerateMajorTickLocations:(CPTNumberSet *__autoreleasing *)newMajorL majorInterval = CPTNiceLength(range.lengthDecimal); } else { - majorInterval = CPTDecimalDivide( range.lengthDecimal, CPTDecimalFromUnsignedInteger(numTicks - 1) ); + majorInterval = CPTDecimalDivide(range.lengthDecimal, CPTDecimalFromUnsignedInteger(numTicks - 1)); majorInterval = CPTNiceNum(majorInterval); } - if ( CPTDecimalLessThan(majorInterval, zero) ) { - majorInterval = CPTDecimalMultiply( majorInterval, CPTDecimalFromInteger(-1) ); + if ( CPTDecimalLessThan(majorInterval, zero)) { + majorInterval = CPTDecimalMultiply(majorInterval, CPTDecimalFromInteger(-1)); } NSDecimal minorInterval; if ( minorTicks > 1 ) { - minorInterval = CPTDecimalDivide( majorInterval, CPTDecimalFromUnsignedInteger(minorTicks) ); + minorInterval = CPTDecimalDivide(majorInterval, CPTDecimalFromUnsignedInteger(minorTicks)); } else { minorInterval = zero; @@ -1118,26 +1118,26 @@ -(void)autoGenerateMajorTickLocations:(CPTNumberSet *__autoreleasing *)newMajorL NSDecimalRound(&finalIndex, &finalIndex, 0, NSRoundUp); // Iterate through the indexes with visible ticks and build the locations sets - for ( NSDecimal i = initialIndex; CPTDecimalLessThanOrEqualTo(i, finalIndex); i = CPTDecimalAdd(i, one) ) { + for ( NSDecimal i = initialIndex; CPTDecimalLessThanOrEqualTo(i, finalIndex); i = CPTDecimalAdd(i, one)) { NSDecimal pointLocation = CPTDecimalMultiply(majorInterval, i); NSDecimal minorPointLocation = pointLocation; for ( NSUInteger j = 1; j < minorTicks; j++ ) { minorPointLocation = CPTDecimalAdd(minorPointLocation, minorInterval); - if ( CPTDecimalLessThan(minorPointLocation, minLimit) ) { + if ( CPTDecimalLessThan(minorPointLocation, minLimit)) { continue; } - if ( CPTDecimalGreaterThan(minorPointLocation, maxLimit) ) { + if ( CPTDecimalGreaterThan(minorPointLocation, maxLimit)) { continue; } [minorLocations addObject:[NSDecimalNumber decimalNumberWithDecimal:minorPointLocation]]; } - if ( CPTDecimalLessThan(pointLocation, minLimit) ) { + if ( CPTDecimalLessThan(pointLocation, minLimit)) { continue; } - if ( CPTDecimalGreaterThan(pointLocation, maxLimit) ) { + if ( CPTDecimalGreaterThan(pointLocation, maxLimit)) { continue; } [majorLocations addObject:[NSDecimalNumber decimalNumberWithDecimal:pointLocation]]; @@ -1150,19 +1150,19 @@ -(void)autoGenerateMajorTickLocations:(CPTNumberSet *__autoreleasing *)newMajorL double minLimit = range.minLimitDouble; double maxLimit = range.maxLimitDouble; - if ( (minLimit > 0.0) && (maxLimit > 0.0) ) { + if ((minLimit > 0.0) && (maxLimit > 0.0)) { // Determine interval value length = log10(maxLimit / minLimit); double interval = signbit(length) ? -1.0 : 1.0; - double intervalStep = pow( 10.0, fabs(interval) ); + double intervalStep = pow(10.0, fabs(interval)); // Determine minor interval - double minorInterval = intervalStep * 0.9 * pow( 10.0, floor( log10(minLimit) ) ) / minorTicks; + double minorInterval = intervalStep * 0.9 * pow(10.0, floor(log10(minLimit))) / minorTicks; // Determine the initial and final major indexes for the actual visible range - NSInteger initialIndex = (NSInteger)lrint( floor( log10( minLimit / fabs(interval) ) ) ); // can be negative - NSInteger finalIndex = (NSInteger)lrint( ceil( log10( maxLimit / fabs(interval) ) ) ); // can be negative + NSInteger initialIndex = (NSInteger)lrint(floor(log10(minLimit / fabs(interval)))); // can be negative + NSInteger finalIndex = (NSInteger)lrint(ceil(log10(maxLimit / fabs(interval)))); // can be negative // Iterate through the indexes with visible ticks and build the locations sets for ( NSInteger i = initialIndex; i <= finalIndex; i++ ) { @@ -1200,14 +1200,14 @@ -(void)autoGenerateMajorTickLocations:(CPTNumberSet *__autoreleasing *)newMajorL double modMinLimit = CPTLogModulus(minLimit); double modMaxLimit = CPTLogModulus(maxLimit); - double multiplier = pow( 10.0, floor( log10(length) ) ); + double multiplier = pow(10.0, floor(log10(length))); multiplier = (multiplier < 1.0) ? multiplier : 1.0; double intervalStep = 10.0; // Determine the initial and final major indexes for the actual visible range - NSInteger initialIndex = (NSInteger)lrint( floor(modMinLimit / multiplier) ); // can be negative - NSInteger finalIndex = (NSInteger)lrint( ceil(modMaxLimit / multiplier) ); // can be negative + NSInteger initialIndex = (NSInteger)lrint(floor(modMinLimit / multiplier)); // can be negative + NSInteger finalIndex = (NSInteger)lrint(ceil(modMaxLimit / multiplier)); // can be negative if ( initialIndex < 0 ) { // Determine minor interval @@ -1218,10 +1218,10 @@ -(void)autoGenerateMajorTickLocations:(CPTNumberSet *__autoreleasing *)newMajorL double sign = -multiplier; if ( multiplier < 1.0 ) { - pointLocation = sign * pow(10.0, fabs( (double)i ) - 1.0); + pointLocation = sign * pow(10.0, fabs((double)i) - 1.0); } else { - pointLocation = sign * pow( 10.0, fabs( (double)i ) ); + pointLocation = sign * pow(10.0, fabs((double)i)); } for ( NSUInteger j = 1; j < minorTicks; j++ ) { @@ -1258,10 +1258,10 @@ -(void)autoGenerateMajorTickLocations:(CPTNumberSet *__autoreleasing *)newMajorL double sign = multiplier; if ( multiplier < 1.0 ) { - pointLocation = sign * pow(10.0, fabs( (double)i ) - 1.0); + pointLocation = sign * pow(10.0, fabs((double)i) - 1.0); } else { - pointLocation = sign * pow( 10.0, fabs( (double)i ) ); + pointLocation = sign * pow(10.0, fabs((double)i)); } for ( NSUInteger j = 1; j < minorTicks; j++ ) { @@ -1330,15 +1330,15 @@ -(void)generateEqualMajorTickLocations:(CPTNumberSet *__autoreleasing *)newMajor if ( majorTickCount < 2 ) { majorTickCount = 2; } - NSDecimal majorInterval = CPTDecimalDivide( range.lengthDecimal, CPTDecimalFromUnsignedInteger(majorTickCount - 1) ); - if ( CPTDecimalLessThan(majorInterval, zero) ) { - majorInterval = CPTDecimalMultiply( majorInterval, CPTDecimalFromInteger(-1) ); + NSDecimal majorInterval = CPTDecimalDivide(range.lengthDecimal, CPTDecimalFromUnsignedInteger(majorTickCount - 1)); + if ( CPTDecimalLessThan(majorInterval, zero)) { + majorInterval = CPTDecimalMultiply(majorInterval, CPTDecimalFromInteger(-1)); } NSDecimal minorInterval; NSUInteger minorTickCount = self.minorTicksPerInterval; if ( minorTickCount > 0 ) { - minorInterval = CPTDecimalDivide( majorInterval, CPTDecimalFromUnsignedInteger(minorTickCount + 1) ); + minorInterval = CPTDecimalDivide(majorInterval, CPTDecimalFromUnsignedInteger(minorTickCount + 1)); } else { minorInterval = zero; @@ -1347,7 +1347,7 @@ -(void)generateEqualMajorTickLocations:(CPTNumberSet *__autoreleasing *)newMajor NSDecimal coord = rangeMin; // Set tick locations - while ( CPTDecimalLessThanOrEqualTo(coord, rangeMax) ) { + while ( CPTDecimalLessThanOrEqualTo(coord, rangeMax)) { // Major tick [majorLocations addObject:[NSDecimalNumber decimalNumberWithDecimal:coord]]; @@ -1356,7 +1356,7 @@ -(void)generateEqualMajorTickLocations:(CPTNumberSet *__autoreleasing *)newMajor NSDecimal minorCoord = CPTDecimalAdd(coord, minorInterval); for ( NSUInteger minorTickIndex = 0; minorTickIndex < minorTickCount; minorTickIndex++ ) { - if ( CPTDecimalGreaterThan(minorCoord, rangeMax) ) { + if ( CPTDecimalGreaterThan(minorCoord, rangeMax)) { break; } [minorLocations addObject:[NSDecimalNumber decimalNumberWithDecimal:minorCoord]]; @@ -1382,7 +1382,7 @@ NSDecimal CPTNiceNum(NSDecimal x) { NSDecimal zero = CPTDecimalFromInteger(0); - if ( CPTDecimalEquals(x, zero) ) { + if ( CPTDecimalEquals(x, zero)) { return zero; } @@ -1393,20 +1393,20 @@ NSDecimal CPTNiceNum(NSDecimal x) x = CPTDecimalMultiply(x, minusOne); } - short exponent = (short)lrint( floor( log10( CPTDecimalDoubleValue(x) ) ) ); + short exponent = (short)lrint(floor(log10(CPTDecimalDoubleValue(x)))); NSDecimal fractionPart; NSDecimalMultiplyByPowerOf10(&fractionPart, &x, -exponent, NSRoundPlain); NSDecimal roundedFraction; - if ( CPTDecimalLessThan( fractionPart, CPTDecimalFromDouble(1.5) ) ) { + if ( CPTDecimalLessThan(fractionPart, CPTDecimalFromDouble(1.5))) { roundedFraction = CPTDecimalFromInteger(1); } - else if ( CPTDecimalLessThan( fractionPart, CPTDecimalFromInteger(3) ) ) { + else if ( CPTDecimalLessThan(fractionPart, CPTDecimalFromInteger(3))) { roundedFraction = CPTDecimalFromInteger(2); } - else if ( CPTDecimalLessThan( fractionPart, CPTDecimalFromInteger(7) ) ) { + else if ( CPTDecimalLessThan(fractionPart, CPTDecimalFromInteger(7))) { roundedFraction = CPTDecimalFromInteger(5); } else { @@ -1426,13 +1426,13 @@ NSDecimal CPTNiceNum(NSDecimal x) /** * @internal * @brief Determines a @quote{nice} range length (a multiple of @num{2}, @num{5}, or @num{10}) less than or equal to the given length. - * @param x The length to round. + * @param length The length to round. */ NSDecimal CPTNiceLength(NSDecimal length) { NSDecimal zero = CPTDecimalFromInteger(0); - if ( CPTDecimalEquals(length, zero) ) { + if ( CPTDecimalEquals(length, zero)) { return zero; } @@ -1445,11 +1445,11 @@ NSDecimal CPTNiceLength(NSDecimal length) NSDecimal roundedNumber; - if ( CPTDecimalGreaterThan( length, CPTDecimalFromInteger(10) ) ) { + if ( CPTDecimalGreaterThan(length, CPTDecimalFromInteger(10))) { NSDecimalRound(&roundedNumber, &length, 0, NSRoundDown); } else { - short exponent = (short)lrint( floor( log10( CPTDecimalDoubleValue(length) ) ) ) - 1; + short exponent = (short)lrint(floor(log10(CPTDecimalDoubleValue(length)))) - 1; NSDecimalRound(&roundedNumber, &length, -exponent, NSRoundDown); } @@ -1548,7 +1548,7 @@ -(void)updateAxisLabelsAtLocations:(nullable CPTNumberSet *)locations inRange:(n BOOL theLabelFormatterChanged; CPTShadow *theShadow; - id theDelegate = self.delegate; + id theDelegate = (id)self.delegate; if ( useMajorAxisLabels ) { if ( locations.count > 0 ) { @@ -1589,7 +1589,7 @@ -(void)updateAxisLabelsAtLocations:(nullable CPTNumberSet *)locations inRange:(n theShadow = self.minorTickLabelShadow; } - if ( (locations.count == 0) || !theLabelTextStyle || !theLabelFormatter ) { + if ((locations.count == 0) || !theLabelTextStyle || !theLabelFormatter ) { if ( useMajorAxisLabels ) { self.axisLabels = nil; } @@ -1613,7 +1613,7 @@ -(void)updateAxisLabelsAtLocations:(nullable CPTNumberSet *)locations inRange:(n theLabelDirection = direction; } - if ( (direction == CPTSignNone) || (theLabelDirection == direction) ) { + if ((direction == CPTSignNone) || (theLabelDirection == direction)) { theLabelOffset += self.tickOffset; } @@ -1732,7 +1732,7 @@ -(void)relabel if ( !self.plotSpace ) { return; } - id theDelegate = self.delegate; + id theDelegate = (id)self.delegate; if ( [theDelegate respondsToSelector:@selector(axisShouldRelabel:)] && ![theDelegate axisShouldRelabel:self] ) { self.needsRelabel = NO; return; @@ -1836,7 +1836,12 @@ -(void)updateCustomTickLabels if ( range.lengthDouble != 0.0 ) { CPTCoordinate orthogonalCoordinate = CPTOrthogonalCoordinate(self.coordinate); - CPTSign direction = self.tickDirection; + + CPTSign direction = self.tickLabelDirection; + + if ( direction == CPTSignNone ) { + direction = self.tickDirection; + } for ( CPTAxisLabel *label in self.axisLabels ) { BOOL visible = [range containsNumber:label.tickLocation]; @@ -1870,7 +1875,7 @@ -(void)updateMajorTickLabelOffsets CGFloat majorOffset = self.labelOffset; - if ( (direction == CPTSignNone) || (labelDirection == direction) ) { + if ((direction == CPTSignNone) || (labelDirection == direction)) { majorOffset += self.tickOffset; } @@ -1890,7 +1895,7 @@ -(void)updateMinorTickLabelOffsets CGFloat minorOffset = self.minorTickLabelOffset; - if ( (direction == CPTSignNone) || (labelDirection == direction) ) { + if ((direction == CPTSignNone) || (labelDirection == direction)) { minorOffset += self.tickOffset; } @@ -2072,7 +2077,7 @@ -(BOOL)pointingDeviceDownEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint) return NO; } - id theDelegate = self.delegate; + id theDelegate = (id)self.delegate; // Tick labels if ( [theDelegate respondsToSelector:@selector(axis:labelTouchDown:)] || @@ -2084,7 +2089,7 @@ -(BOOL)pointingDeviceDownEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint) if ( contentLayer && !contentLayer.hidden ) { CGPoint labelPoint = [theGraph convertPoint:interactionPoint toLayer:contentLayer]; - if ( CGRectContainsPoint(contentLayer.bounds, labelPoint) ) { + if ( CGRectContainsPoint(contentLayer.bounds, labelPoint)) { self.pointingDeviceDownLabel = label; BOOL handled = NO; @@ -2116,7 +2121,7 @@ -(BOOL)pointingDeviceDownEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint) if ( contentLayer && !contentLayer.hidden ) { CGPoint labelPoint = [theGraph convertPoint:interactionPoint toLayer:contentLayer]; - if ( CGRectContainsPoint(contentLayer.bounds, labelPoint) ) { + if ( CGRectContainsPoint(contentLayer.bounds, labelPoint)) { self.pointingDeviceDownTickLabel = label; BOOL handled = NO; @@ -2183,7 +2188,7 @@ -(BOOL)pointingDeviceUpEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)in return NO; } - id theDelegate = self.delegate; + id theDelegate = (id)self.delegate; // Tick labels if ( [theDelegate respondsToSelector:@selector(axis:labelTouchUp:)] || @@ -2195,7 +2200,7 @@ -(BOOL)pointingDeviceUpEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)in if ( contentLayer && !contentLayer.hidden ) { CGPoint labelPoint = [theGraph convertPoint:interactionPoint toLayer:contentLayer]; - if ( CGRectContainsPoint(contentLayer.bounds, labelPoint) ) { + if ( CGRectContainsPoint(contentLayer.bounds, labelPoint)) { BOOL handled = NO; if ( [theDelegate respondsToSelector:@selector(axis:labelTouchUp:)] ) { @@ -2238,7 +2243,7 @@ -(BOOL)pointingDeviceUpEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)in if ( contentLayer && !contentLayer.hidden ) { CGPoint labelPoint = [theGraph convertPoint:interactionPoint toLayer:contentLayer]; - if ( CGRectContainsPoint(contentLayer.bounds, labelPoint) ) { + if ( CGRectContainsPoint(contentLayer.bounds, labelPoint)) { BOOL handled = NO; if ( [theDelegate respondsToSelector:@selector(axis:minorTickTouchUp:)] ) { @@ -2317,7 +2322,12 @@ -(void)setAxisLabels:(nullable CPTAxisLabelSet *)newLabels } } - [self updateMajorTickLabels]; + if ( self.labelingPolicy == CPTAxisLabelingPolicyNone ) { + [self updateCustomTickLabels]; + } + else { + [self updateMajorTickLabels]; + } } } @@ -2357,7 +2367,12 @@ -(void)setMinorTickAxisLabels:(nullable CPTAxisLabelSet *)newLabels } } - [self updateMinorTickLabels]; + if ( self.labelingPolicy == CPTAxisLabelingPolicyNone ) { + [self updateCustomTickLabels]; + } + else { + [self updateMinorTickLabels]; + } } } @@ -2370,7 +2385,7 @@ -(void)setLabelTextStyle:(nullable CPTTextStyle *)newStyle for ( CPTAxisLabel *axisLabel in self.axisLabels ) { CPTLayer *contentLayer = axisLabel.contentLayer; if ( [contentLayer isKindOfClass:textLayerClass] ) { - ( (CPTTextLayer *)contentLayer ).textStyle = labelTextStyle; + ((CPTTextLayer *)contentLayer).textStyle = labelTextStyle; } } @@ -2387,7 +2402,7 @@ -(void)setMinorTickLabelTextStyle:(nullable CPTTextStyle *)newStyle for ( CPTAxisLabel *axisLabel in self.minorTickAxisLabels ) { CPTLayer *contentLayer = axisLabel.contentLayer; if ( [contentLayer isKindOfClass:textLayerClass] ) { - ( (CPTTextLayer *)contentLayer ).textStyle = minorTickLabelTextStyle; + ((CPTTextLayer *)contentLayer).textStyle = minorTickLabelTextStyle; } } @@ -2448,7 +2463,7 @@ -(void)setTitleTextStyle:(nullable CPTTextStyle *)newStyle CPTLayer *contentLayer = self.axisTitle.contentLayer; if ( [contentLayer isKindOfClass:[CPTTextLayer class]] ) { - ( (CPTTextLayer *)contentLayer ).textStyle = titleTextStyle; + ((CPTTextLayer *)contentLayer).textStyle = titleTextStyle; [self updateAxisTitle]; } } @@ -2497,7 +2512,7 @@ -(void)setTitle:(nullable NSString *)newTitle if ( title ) { CPTLayer *contentLayer = self.axisTitle.contentLayer; if ( [contentLayer isKindOfClass:[CPTTextLayer class]] ) { - ( (CPTTextLayer *)contentLayer ).text = title; + ((CPTTextLayer *)contentLayer).text = title; [self updateAxisTitle]; } } @@ -2523,7 +2538,7 @@ -(void)setAttributedTitle:(nullable NSAttributedString *)newTitle CPTLayer *contentLayer = self.axisTitle.contentLayer; if ( [contentLayer isKindOfClass:[CPTTextLayer class]] ) { - ( (CPTTextLayer *)contentLayer ).attributedText = attributedTitle; + ((CPTTextLayer *)contentLayer).attributedText = attributedTitle; [self updateAxisTitle]; } } @@ -2556,7 +2571,7 @@ -(void)setTitleLocation:(nullable NSNumber *)newLocation -(nullable NSNumber *)titleLocation { - if ( isnan(titleLocation.doubleValue) ) { + if ( isnan(titleLocation.doubleValue)) { return self.defaultTitleLocation; } else { @@ -3055,6 +3070,9 @@ -(void)setPlotArea:(nullable CPTPlotArea *)newPlotArea for ( CPTAxisLabel *label in self.axisLabels ) { [label.contentLayer removeFromSuperlayer]; } + for ( CPTAxisLabel *label in self.minorTickAxisLabels ) { + [label.contentLayer removeFromSuperlayer]; + } [self.axisTitle.contentLayer removeFromSuperlayer]; } } @@ -3246,7 +3264,7 @@ @implementation CPTAxis(AbstractMethods) * @param coordinateValue The axis value in data coordinate space. * @return The drawing coordinates of the point. **/ --(CGPoint)viewPointForCoordinateValue:(nullable NSNumber *)coordinateValue +-(CGPoint)viewPointForCoordinateValue:(nullable NSNumber *__unused)coordinateValue { return CGPointZero; } @@ -3255,7 +3273,7 @@ -(CGPoint)viewPointForCoordinateValue:(nullable NSNumber *)coordinateValue * @param context The graphics context to draw into. * @param major Draw the major grid lines If @YES, minor grid lines otherwise. **/ --(void)drawGridLinesInContext:(nonnull CGContextRef)context isMajor:(BOOL)major +-(void)drawGridLinesInContext:(nonnull CGContextRef __unused)context isMajor:(BOOL __unused)major { // do nothing--subclasses must override to do their drawing } @@ -3263,7 +3281,7 @@ -(void)drawGridLinesInContext:(nonnull CGContextRef)context isMajor:(BOOL)major /** @brief Draws alternating background bands into the provided graphics context. * @param context The graphics context to draw into. **/ --(void)drawBackgroundBandsInContext:(nonnull CGContextRef)context +-(void)drawBackgroundBandsInContext:(nonnull CGContextRef __unused)context { // do nothing--subclasses must override to do their drawing } @@ -3271,7 +3289,7 @@ -(void)drawBackgroundBandsInContext:(nonnull CGContextRef)context /** @brief Draws background limit ranges into the provided graphics context. * @param context The graphics context to draw into. **/ --(void)drawBackgroundLimitsInContext:(nonnull CGContextRef)context +-(void)drawBackgroundLimitsInContext:(nonnull CGContextRef __unused)context { // do nothing--subclasses must override to do their drawing } diff --git a/framework/Source/CPTAxisLabel.m b/framework/Source/CPTAxisLabel.m index 48d201421..2f9f23f5e 100644 --- a/framework/Source/CPTAxisLabel.m +++ b/framework/Source/CPTAxisLabel.m @@ -63,7 +63,7 @@ -(nonnull instancetype)initWithText:(nullable NSString *)newText textStyle:(null **/ -(nonnull instancetype)initWithContentLayer:(nonnull CPTLayer *)layer { - if ( (self = [super init]) ) { + if ((self = [super init])) { contentLayer = layer; offset = CPTFloat(20.0); rotation = CPTFloat(0.0); @@ -105,7 +105,7 @@ -(void)encodeWithCoder:(nonnull NSCoder *)coder */ -(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super init]) ) { + if ((self = [super init])) { contentLayer = [coder decodeObjectOfClass:[CPTLayer class] forKey:@"CPTAxisLabel.contentLayer"]; offset = [coder decodeCGFloatForKey:@"CPTAxisLabel.offset"]; @@ -151,14 +151,14 @@ -(void)positionRelativeToViewPoint:(CGPoint)point forCoordinate:(CPTCoordinate)c } CGPoint newPosition = point; - CGFloat *value = ( coordinate == CPTCoordinateX ? &(newPosition.x) : &(newPosition.y) ); + CGFloat *value = (coordinate == CPTCoordinateX ? &(newPosition.x) : &(newPosition.y)); CGFloat angle = CPTFloat(0.0); CGFloat labelRotation = self.rotation; - if ( isnan(labelRotation) ) { - labelRotation = ( coordinate == CPTCoordinateX ? CPTFloat(M_PI_2) : CPTFloat(0.0) ); + if ( isnan(labelRotation)) { + labelRotation = (coordinate == CPTCoordinateX ? CPTFloat(M_PI_2) : CPTFloat(0.0)); } - content.transform = CATransform3DMakeRotation( labelRotation, CPTFloat(0.0), CPTFloat(0.0), CPTFloat(1.0) ); + content.transform = CATransform3DMakeRotation(labelRotation, CPTFloat(0.0), CPTFloat(0.0), CPTFloat(1.0)); CGRect contentFrame = content.frame; // Position the anchor point along the closest edge. @@ -272,7 +272,7 @@ -(void)positionRelativeToViewPoint:(CGPoint)point forCoordinate:(CPTCoordinate)c CGFloat newAnchorX = cos(angle); CGFloat newAnchorY = sin(angle); - if ( ABS(newAnchorX) <= ABS(newAnchorY) ) { + if ( ABS(newAnchorX) <= ABS(newAnchorY)) { newAnchorX /= ABS(newAnchorY); newAnchorY = signbit(newAnchorY) ? CPTFloat(-1.0) : CPTFloat(1.0); } @@ -280,7 +280,7 @@ -(void)positionRelativeToViewPoint:(CGPoint)point forCoordinate:(CPTCoordinate)c newAnchorY /= ABS(newAnchorX); newAnchorX = signbit(newAnchorX) ? CPTFloat(-1.0) : CPTFloat(1.0); } - CGPoint anchor = CPTPointMake( ( newAnchorX + CPTFloat(1.0) ) / CPTFloat(2.0), ( newAnchorY + CPTFloat(1.0) ) / CPTFloat(2.0) ); + CGPoint anchor = CPTPointMake((newAnchorX + CPTFloat(1.0)) / CPTFloat(2.0), (newAnchorY + CPTFloat(1.0)) / CPTFloat(2.0)); content.anchorPoint = anchor; content.position = newPosition; @@ -295,7 +295,7 @@ -(void)positionRelativeToViewPoint:(CGPoint)point forCoordinate:(CPTCoordinate)c **/ -(void)positionBetweenViewPoint:(CGPoint)firstPoint andViewPoint:(CGPoint)secondPoint forCoordinate:(CPTCoordinate)coordinate inDirection:(CPTSign)direction { - [self positionRelativeToViewPoint:CPTPointMake( (firstPoint.x + secondPoint.x) / CPTFloat(2.0), (firstPoint.y + secondPoint.y) / CPTFloat(2.0) ) + [self positionRelativeToViewPoint:CPTPointMake((firstPoint.x + secondPoint.x) / CPTFloat(2.0), (firstPoint.y + secondPoint.y) / CPTFloat(2.0)) forCoordinate:coordinate inDirection:direction]; } @@ -329,7 +329,7 @@ -(BOOL)isEqual:(nullable id)object return YES; } else if ( [object isKindOfClass:[self class]] ) { - NSNumber *location = ( (CPTAxisLabel *)object ).tickLocation; + NSNumber *location = ((CPTAxisLabel *)object).tickLocation; if ( location ) { return [self.tickLocation isEqualToNumber:location]; @@ -354,8 +354,8 @@ -(NSUInteger)hash // Equal objects must hash the same. double tickLocationAsDouble = self.tickLocation.doubleValue; - if ( !isnan(tickLocationAsDouble) ) { - hashValue = (NSUInteger)lrint( fmod(ABS(tickLocationAsDouble), (double)NSUIntegerMax) ); + if ( !isnan(tickLocationAsDouble)) { + hashValue = (NSUInteger)lrint(fmod(ABS(tickLocationAsDouble), (double)NSUIntegerMax)); } return hashValue; diff --git a/framework/Source/CPTAxisLabelGroup.m b/framework/Source/CPTAxisLabelGroup.m index 174f90bed..1693c7a78 100644 --- a/framework/Source/CPTAxisLabelGroup.m +++ b/framework/Source/CPTAxisLabelGroup.m @@ -15,7 +15,7 @@ -(void)display // nothing to draw } --(void)renderAsVectorInContext:(nonnull CGContextRef)context +-(void)renderAsVectorInContext:(nonnull CGContextRef __unused)context { // nothing to draw } diff --git a/framework/Source/CPTAxisLabelTests.m b/framework/Source/CPTAxisLabelTests.m index 22bf84e9a..ff3248137 100644 --- a/framework/Source/CPTAxisLabelTests.m +++ b/framework/Source/CPTAxisLabelTests.m @@ -6,7 +6,7 @@ #import "CPTUtilities.h" #import -static const double precision = 1.0e-6; +static const CGFloat precision = CPTFloat(1.0e-6); @implementation CPTAxisLabelTests @@ -19,8 +19,8 @@ static CGPoint roundPoint(CGPoint position, CGSize contentSize, CGPoint anchor) CGPoint newAnchor = CGPointMake(contentSize.width * anchor.x, contentSize.height * anchor.y); - newPosition.x = ceil( position.x - newAnchor.x - CPTFloat(0.5) ) + newAnchor.x; - newPosition.y = ceil( position.y - newAnchor.y - CPTFloat(0.5) ) + newAnchor.y; + newPosition.x = ceil(position.x - newAnchor.x - CPTFloat(0.5)) + newAnchor.x; + newPosition.y = ceil(position.y - newAnchor.y - CPTFloat(0.5)) + newAnchor.y; return newPosition; } @@ -32,7 +32,12 @@ -(void)testPositionRelativeToViewPointRaisesForInvalidDirection @try { label = [[CPTAxisLabel alloc] initWithText:@"CPTAxisLabelTests-testPositionRelativeToViewPointRaisesForInvalidDirection" textStyle:[CPTTextStyle textStyle]]; - XCTAssertThrowsSpecificNamed([label positionRelativeToViewPoint:CGPointZero forCoordinate:CPTCoordinateX inDirection:INT_MAX], NSException, NSInvalidArgumentException, @"Should raise NSInvalidArgumentException for invalid direction (type CPTSign)"); +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wassign-enum" + + XCTAssertThrowsSpecificNamed([label positionRelativeToViewPoint:CGPointZero forCoordinate:CPTCoordinateX inDirection:NSIntegerMax], NSException, NSInvalidArgumentException, @"Should raise NSInvalidArgumentException for invalid direction (type CPTSign)"); + +#pragma clang diagnostic pop } @finally { label = nil; @@ -60,8 +65,8 @@ -(void)testPositionRelativeToViewPointPositionsForXCoordinate CGPoint newPosition = roundPoint(CGPointMake(start - label.offset, start), contentSize, contentLayer.anchorPoint); - XCTAssertEqualWithAccuracy( contentLayer.position.x, newPosition.x, precision, @"Should add negative offset, %@ != %@", CPTStringFromPoint(contentLayer.position), CPTStringFromPoint(newPosition) ); - XCTAssertEqualWithAccuracy( contentLayer.position.y, newPosition.y, precision, @"Should add negative offset, %@ != %@", CPTStringFromPoint(contentLayer.position), CPTStringFromPoint(newPosition) ); + XCTAssertEqualWithAccuracy(contentLayer.position.x, newPosition.x, precision, @"Should add negative offset, %@ != %@", CPTStringFromPoint(contentLayer.position), CPTStringFromPoint(newPosition)); + XCTAssertEqualWithAccuracy(contentLayer.position.y, newPosition.y, precision, @"Should add negative offset, %@ != %@", CPTStringFromPoint(contentLayer.position), CPTStringFromPoint(newPosition)); XCTAssertEqualWithAccuracy(contentLayer.anchorPoint.x, CPTFloat(1.0), precision, @"Should anchor at (1.0, 0.5)"); XCTAssertEqualWithAccuracy(contentLayer.anchorPoint.y, CPTFloat(0.5), precision, @"Should anchor at (1.0, 0.5)"); @@ -73,8 +78,8 @@ -(void)testPositionRelativeToViewPointPositionsForXCoordinate newPosition = roundPoint(CGPointMake(start - label.offset, start), contentSize, contentLayer.anchorPoint); - XCTAssertEqualWithAccuracy( contentLayer.position.x, newPosition.x, precision, @"Should add negative offset, %@ != %@", CPTStringFromPoint(contentLayer.position), CPTStringFromPoint(newPosition) ); - XCTAssertEqualWithAccuracy( contentLayer.position.y, newPosition.y, precision, @"Should add negative offset, %@ != %@", CPTStringFromPoint(contentLayer.position), CPTStringFromPoint(newPosition) ); + XCTAssertEqualWithAccuracy(contentLayer.position.x, newPosition.x, precision, @"Should add negative offset, %@ != %@", CPTStringFromPoint(contentLayer.position), CPTStringFromPoint(newPosition)); + XCTAssertEqualWithAccuracy(contentLayer.position.y, newPosition.y, precision, @"Should add negative offset, %@ != %@", CPTStringFromPoint(contentLayer.position), CPTStringFromPoint(newPosition)); XCTAssertEqualWithAccuracy(contentLayer.anchorPoint.x, CPTFloat(1.0), precision, @"Should anchor at (1.0, 0.5)"); XCTAssertEqualWithAccuracy(contentLayer.anchorPoint.y, CPTFloat(0.5), precision, @"Should anchor at (1.0, 0.5)"); @@ -86,8 +91,8 @@ -(void)testPositionRelativeToViewPointPositionsForXCoordinate newPosition = roundPoint(CGPointMake(start + label.offset, start), contentSize, contentLayer.anchorPoint); - XCTAssertEqualWithAccuracy( contentLayer.position.x, newPosition.x, precision, @"Should add positive offset, %@ != %@", CPTStringFromPoint(contentLayer.position), CPTStringFromPoint(newPosition) ); - XCTAssertEqualWithAccuracy( contentLayer.position.y, newPosition.y, precision, @"Should add positive offset, %@ != %@", CPTStringFromPoint(contentLayer.position), CPTStringFromPoint(newPosition) ); + XCTAssertEqualWithAccuracy(contentLayer.position.x, newPosition.x, precision, @"Should add positive offset, %@ != %@", CPTStringFromPoint(contentLayer.position), CPTStringFromPoint(newPosition)); + XCTAssertEqualWithAccuracy(contentLayer.position.y, newPosition.y, precision, @"Should add positive offset, %@ != %@", CPTStringFromPoint(contentLayer.position), CPTStringFromPoint(newPosition)); XCTAssertEqualWithAccuracy(contentLayer.anchorPoint.x, CPTFloat(0.0), precision, @"Should anchor at (0.0, 0.5)"); XCTAssertEqualWithAccuracy(contentLayer.anchorPoint.y, CPTFloat(0.5), precision, @"Should anchor at (0.0, 0.5)"); } @@ -117,8 +122,8 @@ -(void)testPositionRelativeToViewPointPositionsForYCoordinate CGPoint newPosition = roundPoint(CGPointMake(start, start - label.offset), contentSize, contentLayer.anchorPoint); - XCTAssertEqualWithAccuracy( contentLayer.position.x, newPosition.x, precision, @"Should add negative offset, %@ != %@", CPTStringFromPoint(contentLayer.position), CPTStringFromPoint(newPosition) ); - XCTAssertEqualWithAccuracy( contentLayer.position.y, newPosition.y, precision, @"Should add negative offset, %@ != %@", CPTStringFromPoint(contentLayer.position), CPTStringFromPoint(newPosition) ); + XCTAssertEqualWithAccuracy(contentLayer.position.x, newPosition.x, precision, @"Should add negative offset, %@ != %@", CPTStringFromPoint(contentLayer.position), CPTStringFromPoint(newPosition)); + XCTAssertEqualWithAccuracy(contentLayer.position.y, newPosition.y, precision, @"Should add negative offset, %@ != %@", CPTStringFromPoint(contentLayer.position), CPTStringFromPoint(newPosition)); XCTAssertEqualWithAccuracy(contentLayer.anchorPoint.x, CPTFloat(0.5), precision, @"Should anchor at (0.5, 1.0)"); XCTAssertEqualWithAccuracy(contentLayer.anchorPoint.y, CPTFloat(1.0), precision, @"Should anchor at (0.5, 1.0)"); @@ -130,8 +135,8 @@ -(void)testPositionRelativeToViewPointPositionsForYCoordinate newPosition = roundPoint(CGPointMake(start, start - label.offset), contentSize, contentLayer.anchorPoint); - XCTAssertEqualWithAccuracy( contentLayer.position.x, newPosition.x, precision, @"Should add negative offset, %@ != %@", CPTStringFromPoint(contentLayer.position), CPTStringFromPoint(newPosition) ); - XCTAssertEqualWithAccuracy( contentLayer.position.y, newPosition.y, precision, @"Should add negative offset, %@ != %@", CPTStringFromPoint(contentLayer.position), CPTStringFromPoint(newPosition) ); + XCTAssertEqualWithAccuracy(contentLayer.position.x, newPosition.x, precision, @"Should add negative offset, %@ != %@", CPTStringFromPoint(contentLayer.position), CPTStringFromPoint(newPosition)); + XCTAssertEqualWithAccuracy(contentLayer.position.y, newPosition.y, precision, @"Should add negative offset, %@ != %@", CPTStringFromPoint(contentLayer.position), CPTStringFromPoint(newPosition)); XCTAssertEqualWithAccuracy(contentLayer.anchorPoint.x, CPTFloat(0.5), precision, @"Should anchor at (0.5, 1.0)"); XCTAssertEqualWithAccuracy(contentLayer.anchorPoint.y, CPTFloat(1.0), precision, @"Should anchor at (0.5, 1.0)"); @@ -143,8 +148,8 @@ -(void)testPositionRelativeToViewPointPositionsForYCoordinate newPosition = roundPoint(CGPointMake(start, start + label.offset), contentSize, contentLayer.anchorPoint); - XCTAssertEqualWithAccuracy( contentLayer.position.x, newPosition.x, precision, @"Should add positive offset, %@ != %@", CPTStringFromPoint(contentLayer.position), CPTStringFromPoint(newPosition) ); - XCTAssertEqualWithAccuracy( contentLayer.position.y, newPosition.y, precision, @"Should add positive offset, %@ != %@", CPTStringFromPoint(contentLayer.position), CPTStringFromPoint(newPosition) ); + XCTAssertEqualWithAccuracy(contentLayer.position.x, newPosition.x, precision, @"Should add positive offset, %@ != %@", CPTStringFromPoint(contentLayer.position), CPTStringFromPoint(newPosition)); + XCTAssertEqualWithAccuracy(contentLayer.position.y, newPosition.y, precision, @"Should add positive offset, %@ != %@", CPTStringFromPoint(contentLayer.position), CPTStringFromPoint(newPosition)); XCTAssertEqualWithAccuracy(contentLayer.anchorPoint.x, CPTFloat(0.5), precision, @"Should anchor at (0.5, 0.0)"); XCTAssertEqualWithAccuracy(contentLayer.anchorPoint.y, CPTFloat(0.0), precision, @"Should anchor at (0.5, 0.0)"); } diff --git a/framework/Source/CPTAxisSet.m b/framework/Source/CPTAxisSet.m index c5678d149..0f37e6cb5 100644 --- a/framework/Source/CPTAxisSet.m +++ b/framework/Source/CPTAxisSet.m @@ -38,7 +38,7 @@ @implementation CPTAxisSet **/ -(nonnull instancetype)initWithFrame:(CGRect)newFrame { - if ( (self = [super initWithFrame:newFrame]) ) { + if ((self = [super initWithFrame:newFrame])) { axes = @[]; borderLineStyle = nil; @@ -53,7 +53,7 @@ -(nonnull instancetype)initWithFrame:(CGRect)newFrame -(nonnull instancetype)initWithLayer:(nonnull id)layer { - if ( (self = [super initWithLayer:layer]) ) { + if ((self = [super initWithLayer:layer])) { CPTAxisSet *theLayer = (CPTAxisSet *)layer; axes = theLayer->axes; @@ -79,7 +79,7 @@ -(void)encodeWithCoder:(nonnull NSCoder *)coder -(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super initWithCoder:coder]) ) { + if ((self = [super initWithCoder:coder])) { axes = [[coder decodeObjectOfClasses:[NSSet setWithArray:@[[NSArray class], [CPTAxis class]]] forKey:@"CPTAxisSet.axes"] copy]; borderLineStyle = [[coder decodeObjectOfClass:[CPTLineStyle class] diff --git a/framework/Source/CPTAxisTitle.m b/framework/Source/CPTAxisTitle.m index d5d5a97da..99b26a321 100644 --- a/framework/Source/CPTAxisTitle.m +++ b/framework/Source/CPTAxisTitle.m @@ -18,7 +18,7 @@ @implementation CPTAxisTitle -(nonnull instancetype)initWithContentLayer:(nonnull CPTLayer *)layer { if ( layer ) { - if ( (self = [super initWithContentLayer:layer]) ) { + if ((self = [super initWithContentLayer:layer])) { self.rotation = CPTNAN; } } @@ -49,14 +49,14 @@ -(BOOL)isEqual:(nullable id)object else if ( [object isKindOfClass:[self class]] ) { CPTAxisTitle *otherTitle = object; - if ( (self.rotation != otherTitle.rotation) || (self.offset != otherTitle.offset) ) { + if ((self.rotation != otherTitle.rotation) || (self.offset != otherTitle.offset)) { return NO; } if ( ![self.contentLayer isEqual:otherTitle] ) { return NO; } - NSNumber *location = ( (CPTAxisLabel *)object ).tickLocation; + NSNumber *location = ((CPTAxisLabel *)object).tickLocation; if ( location ) { return [self.tickLocation isEqualToNumber:location]; @@ -81,11 +81,11 @@ -(NSUInteger)hash // Equal objects must hash the same. double tickLocationAsDouble = self.tickLocation.doubleValue; - if ( !isnan(tickLocationAsDouble) ) { - hashValue = (NSUInteger)lrint( fmod(ABS(tickLocationAsDouble), (double)NSUIntegerMax) ); + if ( !isnan(tickLocationAsDouble)) { + hashValue = (NSUInteger)lrint(fmod(ABS(tickLocationAsDouble), (double)NSUIntegerMax)); } - hashValue += (NSUInteger)lrint( fmod(ABS(self.rotation), (double)NSUIntegerMax) ); - hashValue += (NSUInteger)lrint( fmod(ABS(self.offset), (double)NSUIntegerMax) ); + hashValue += (NSUInteger)lrint(fmod(ABS(self.rotation), (double)NSUIntegerMax)); + hashValue += (NSUInteger)lrint(fmod(ABS(self.offset), (double)NSUIntegerMax)); return hashValue; } diff --git a/framework/Source/CPTBarPlot.h b/framework/Source/CPTBarPlot.h index 307be7b0b..282fd873d 100644 --- a/framework/Source/CPTBarPlot.h +++ b/framework/Source/CPTBarPlot.h @@ -13,13 +13,19 @@ @class CPTTextLayer; @class CPTTextStyle; +/** + * @brief Bar plot bindings. + **/ +typedef NSString *CPTBarPlotBinding cpt_swift_struct; + /// @ingroup plotBindingsBarPlot /// @{ -extern NSString *__nonnull const CPTBarPlotBindingBarLocations; -extern NSString *__nonnull const CPTBarPlotBindingBarTips; -extern NSString *__nonnull const CPTBarPlotBindingBarBases; -extern NSString *__nonnull const CPTBarPlotBindingBarFills; -extern NSString *__nonnull const CPTBarPlotBindingBarLineStyles; +extern CPTBarPlotBinding __nonnull const CPTBarPlotBindingBarLocations; +extern CPTBarPlotBinding __nonnull const CPTBarPlotBindingBarTips; +extern CPTBarPlotBinding __nonnull const CPTBarPlotBindingBarBases; +extern CPTBarPlotBinding __nonnull const CPTBarPlotBindingBarFills; +extern CPTBarPlotBinding __nonnull const CPTBarPlotBindingBarLineStyles; +extern CPTBarPlotBinding __nonnull const CPTBarPlotBindingBarWidths; /// @} /** @@ -78,6 +84,23 @@ typedef NS_ENUM (NSInteger, CPTBarPlotField) { **/ -(nullable CPTLineStyle *)barLineStyleForBarPlot:(nonnull CPTBarPlot *)barPlot recordIndex:(NSUInteger)idx; +/** @brief @optional Gets an array of bar widths for the given bar plot. + * @param barPlot The bar plot. + * @param indexRange The range of the data indexes of interest. + * @return An array of bar widths. + **/ +-(nullable CPTNumberArray *)barWidthsForBarPlot:(nonnull CPTBarPlot *)barPlot recordIndexRange:(NSRange)indexRange; + +/** @brief @optional Gets a bar width for the given bar plot. + * This method will not be called if + * @link CPTBarPlotDataSource::barWidthsForBarPlot:recordIndexRange: -barWidthsForBarPlot:recordIndexRange: @endlink + * is also implemented in the datasource. + * @param barPlot The bar plot. + * @param idx The data index of interest. + * @return The bar width for the bar with the given index. If the data source returns @nil, the default barWidth is used. + **/ +-(nullable NSNumber *)barWidthForBarPlot:(nonnull CPTBarPlot *)barPlot recordIndex:(NSUInteger)idx; + /// @} /// @name Legends @@ -220,6 +243,8 @@ typedef NS_ENUM (NSInteger, CPTBarPlotField) { -(void)reloadBarFillsInIndexRange:(NSRange)indexRange; -(void)reloadBarLineStyles; -(void)reloadBarLineStylesInIndexRange:(NSRange)indexRange; +-(void)reloadBarWidths; +-(void)reloadBarWidthsInIndexRange:(NSRange)indexRange; /// @} @end diff --git a/framework/Source/CPTBarPlot.m b/framework/Source/CPTBarPlot.m index 839825dd0..e667773e3 100644 --- a/framework/Source/CPTBarPlot.m +++ b/framework/Source/CPTBarPlot.m @@ -27,11 +27,12 @@ * @endif **/ -NSString *const CPTBarPlotBindingBarLocations = @"barLocations"; ///< Bar locations. -NSString *const CPTBarPlotBindingBarTips = @"barTips"; ///< Bar tips. -NSString *const CPTBarPlotBindingBarBases = @"barBases"; ///< Bar bases. -NSString *const CPTBarPlotBindingBarFills = @"barFills"; ///< Bar fills. -NSString *const CPTBarPlotBindingBarLineStyles = @"barLineStyles"; ///< Bar line styles. +CPTBarPlotBinding const CPTBarPlotBindingBarLocations = @"barLocations"; ///< Bar locations. +CPTBarPlotBinding const CPTBarPlotBindingBarTips = @"barTips"; ///< Bar tips. +CPTBarPlotBinding const CPTBarPlotBindingBarBases = @"barBases"; ///< Bar bases. +CPTBarPlotBinding const CPTBarPlotBindingBarFills = @"barFills"; ///< Bar fills. +CPTBarPlotBinding const CPTBarPlotBindingBarLineStyles = @"barLineStyles"; ///< Bar line styles. +CPTBarPlotBinding const CPTBarPlotBindingBarWidths = @"barWidths"; ///< Bar widths. /// @cond @interface CPTBarPlot() @@ -41,19 +42,21 @@ @interface CPTBarPlot() @property (nonatomic, readwrite, copy, nullable) CPTNumberArray *barBases; @property (nonatomic, readwrite, copy, nullable) CPTFillArray *barFills; @property (nonatomic, readwrite, copy, nullable) CPTLineStyleArray *barLineStyles; +@property (nonatomic, readwrite, copy, nullable) CPTLineStyleArray *barWidths; @property (nonatomic, readwrite, assign) NSUInteger pointingDeviceDownIndex; -(BOOL)barAtRecordIndex:(NSUInteger)idx basePoint:(nonnull CGPoint *)basePoint tipPoint:(nonnull CGPoint *)tipPoint; --(nonnull CGMutablePathRef)newBarPathWithContext:(nullable CGContextRef)context recordIndex:(NSUInteger)recordIndex; --(nonnull CGMutablePathRef)newBarPathWithContext:(nullable CGContextRef)context basePoint:(CGPoint)basePoint tipPoint:(CGPoint)tipPoint; +-(nullable CGMutablePathRef)newBarPathWithContext:(nullable CGContextRef)context recordIndex:(NSUInteger)recordIndex; +-(nonnull CGMutablePathRef)newBarPathWithContext:(nullable CGContextRef)context basePoint:(CGPoint)basePoint tipPoint:(CGPoint)tipPoint width:(NSNumber *)width; -(nullable CPTFill *)barFillForIndex:(NSUInteger)idx; -(nullable CPTLineStyle *)barLineStyleForIndex:(NSUInteger)idx; +-(nonnull NSNumber *)barWidthForIndex:(NSUInteger)idx; -(void)drawBarInContext:(nonnull CGContextRef)context recordIndex:(NSUInteger)idx; -(CGFloat)lengthInView:(NSDecimal)plotLength; -(double)doubleLengthInPlotCoordinates:(NSDecimal)decimalLength; --(BOOL)barIsVisibleWithBasePoint:(CGPoint)basePoint; +-(BOOL)barIsVisibleWithBasePoint:(CGPoint)basePoint width:(NSNumber *)width; @end @@ -75,6 +78,7 @@ @implementation CPTBarPlot @dynamic barBases; @dynamic barFills; @dynamic barLineStyles; +@dynamic barWidths; /** @property CGFloat barCornerRadius * @brief The corner radius for the end of the bars. Default is @num{0.0} for square corners. @@ -170,7 +174,7 @@ @implementation CPTBarPlot **/ +(nonnull instancetype)tubularBarPlotWithColor:(nonnull CPTColor *)color horizontalBars:(BOOL)horizontal { - CPTBarPlot *barPlot = [[CPTBarPlot alloc] init]; + CPTBarPlot *barPlot = [[self alloc] init]; CPTMutableLineStyle *barLineStyle = [[CPTMutableLineStyle alloc] init]; barLineStyle.lineWidth = CPTFloat(1.0); @@ -205,8 +209,10 @@ +(void)initialize [self exposeBinding:CPTBarPlotBindingBarBases]; [self exposeBinding:CPTBarPlotBindingBarFills]; [self exposeBinding:CPTBarPlotBindingBarLineStyles]; + [self exposeBinding:CPTBarPlotBindingBarWidths]; } } + #endif /// @endcond @@ -236,7 +242,7 @@ +(void)initialize **/ -(nonnull instancetype)initWithFrame:(CGRect)newFrame { - if ( (self = [super initWithFrame:newFrame]) ) { + if ((self = [super initWithFrame:newFrame])) { lineStyle = [[CPTLineStyle alloc] init]; fill = [CPTFill fillWithColor:[CPTColor blackColor]]; barWidth = @0.5; @@ -262,7 +268,7 @@ -(nonnull instancetype)initWithFrame:(CGRect)newFrame -(nonnull instancetype)initWithLayer:(nonnull id)layer { - if ( (self = [super initWithLayer:layer]) ) { + if ((self = [super initWithLayer:layer])) { CPTBarPlot *theLayer = (CPTBarPlot *)layer; lineStyle = theLayer->lineStyle; @@ -310,7 +316,7 @@ -(void)encodeWithCoder:(nonnull NSCoder *)coder -(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super initWithCoder:coder]) ) { + if ((self = [super initWithCoder:coder])) { NSNumber *num; lineStyle = [[coder decodeObjectOfClass:[CPTLineStyle class] @@ -367,6 +373,9 @@ -(void)reloadDataInIndexRange:(NSRange)indexRange // Bar line styles [self reloadBarLineStylesInIndexRange:indexRange]; + // Bar widths + [self reloadBarWidthsInIndexRange:indexRange]; + // Legend id theDataSource = (id)self.dataSource; @@ -405,7 +414,7 @@ -(void)reloadPlotDataInIndexRange:(NSRange)indexRange CPTMutableNumericData *locationData = nil; if ( self.doublePrecisionCache ) { locationData = [[CPTMutableNumericData alloc] initWithData:[NSData data] - dataType:CPTDataType( CPTFloatingPointDataType, sizeof(double), CFByteOrderGetCurrent() ) + dataType:CPTDataType(CPTFloatingPointDataType, sizeof(double), CFByteOrderGetCurrent()) shape:nil]; locationData.shape = @[@(indexRange.length)]; @@ -424,13 +433,13 @@ -(void)reloadPlotDataInIndexRange:(NSRange)indexRange } else { locationData = [[CPTMutableNumericData alloc] initWithData:[NSData data] - dataType:CPTDataType( CPTDecimalDataType, sizeof(NSDecimal), CFByteOrderGetCurrent() ) + dataType:CPTDataType(CPTDecimalDataType, sizeof(NSDecimal), CFByteOrderGetCurrent()) shape:nil]; locationData.shape = @[@(indexRange.length)]; NSDecimal delta = CPTDecimalFromInteger(1); if ( indexRange.length > 1 ) { - delta = CPTDecimalDivide( self.plotRange.lengthDecimal, CPTDecimalFromUnsignedInteger(indexRange.length - 1) ); + delta = CPTDecimalDivide(self.plotRange.lengthDecimal, CPTDecimalFromUnsignedInteger(indexRange.length - 1)); } NSDecimal locationDecimal = self.plotRange.locationDecimal; @@ -453,7 +462,7 @@ -(void)reloadPlotDataInIndexRange:(NSRange)indexRange CPTMutableNumericData *locationData = nil; if ( self.doublePrecisionCache ) { locationData = [[CPTMutableNumericData alloc] initWithData:[NSData data] - dataType:CPTDataType( CPTFloatingPointDataType, sizeof(double), CFByteOrderGetCurrent() ) + dataType:CPTDataType(CPTFloatingPointDataType, sizeof(double), CFByteOrderGetCurrent()) shape:nil]; locationData.shape = @[@(indexRange.length)]; @@ -467,7 +476,7 @@ -(void)reloadPlotDataInIndexRange:(NSRange)indexRange } else { locationData = [[CPTMutableNumericData alloc] initWithData:[NSData data] - dataType:CPTDataType( CPTDecimalDataType, sizeof(NSDecimal), CFByteOrderGetCurrent() ) + dataType:CPTDataType(CPTDecimalDataType, sizeof(NSDecimal), CFByteOrderGetCurrent()) shape:nil]; locationData.shape = @[@(indexRange.length)]; @@ -528,7 +537,9 @@ -(void)reloadBarFillsInIndexRange:(NSRange)indexRange } } - [self cacheArray:array forKey:CPTBarPlotBindingBarFills atRecordIndex:indexRange.location]; + [self cacheArray:array + forKey:CPTBarPlotBindingBarFills + atRecordIndex:indexRange.location]; } // Legend @@ -580,7 +591,9 @@ -(void)reloadBarLineStylesInIndexRange:(NSRange)indexRange } } - [self cacheArray:array forKey:CPTBarPlotBindingBarLineStyles atRecordIndex:indexRange.location]; + [self cacheArray:array + forKey:CPTBarPlotBindingBarLineStyles + atRecordIndex:indexRange.location]; } // Legend @@ -591,6 +604,49 @@ -(void)reloadBarLineStylesInIndexRange:(NSRange)indexRange [self setNeedsDisplay]; } +/** + * @brief Reload all bar widths from the data source immediately. + **/ +-(void)reloadBarWidths +{ + [self reloadBarWidthsInIndexRange:NSMakeRange(0, self.cachedDataCount)]; +} + +/** @brief Reload bar widths in the given index range from the data source immediately. + * @param indexRange The index range to load. + **/ +-(void)reloadBarWidthsInIndexRange:(NSRange)indexRange +{ + id theDataSource = (id)self.dataSource; + + if ( [theDataSource respondsToSelector:@selector(barWidthsForBarPlot:recordIndexRange:)] ) { + [self cacheArray:[theDataSource barWidthsForBarPlot:self recordIndexRange:indexRange] + forKey:CPTBarPlotBindingBarWidths + atRecordIndex:indexRange.location]; + } + else if ( [theDataSource respondsToSelector:@selector(barWidthForBarPlot:recordIndex:)] ) { + id nilObject = [CPTPlot nilData]; + CPTMutableNumberArray *array = [[NSMutableArray alloc] initWithCapacity:indexRange.length]; + NSUInteger maxIndex = NSMaxRange(indexRange); + + for ( NSUInteger idx = indexRange.location; idx < maxIndex; idx++ ) { + NSNumber *width = [theDataSource barWidthForBarPlot:self recordIndex:idx]; + if ( width ) { + [array addObject:width]; + } + else { + [array addObject:nilObject]; + } + } + + [self cacheArray:array + forKey:CPTBarPlotBindingBarWidths + atRecordIndex:indexRange.location]; + } + + [self setNeedsDisplay]; +} + #pragma mark - #pragma mark Length Conversions for Independent Coordinate (e.g., widths, offsets) @@ -788,12 +844,12 @@ -(nullable CPTPlotRange *)plotRangeEnclosingBars NSDecimal barOffsetLength = [self lengthInPlotCoordinates:self.barOffset.decimalValue]; NSDecimal barWidthLength = [self lengthInPlotCoordinates:self.barWidth.decimalValue]; - NSDecimal halfBarWidth = CPTDecimalDivide( barWidthLength, CPTDecimalFromInteger(2) ); + NSDecimal halfBarWidth = CPTDecimalDivide(barWidthLength, CPTDecimalFromInteger(2)); NSDecimal rangeLocation = range.locationDecimal; NSDecimal rangeLength = range.lengthDecimal; - if ( CPTDecimalGreaterThanOrEqualTo( rangeLength, CPTDecimalFromInteger(0) ) ) { + if ( CPTDecimalGreaterThanOrEqualTo(rangeLength, CPTDecimalFromInteger(0))) { rangeLocation = CPTDecimalSubtract(rangeLocation, halfBarWidth); range.locationDecimal = CPTDecimalAdd(rangeLocation, barOffsetLength); @@ -822,13 +878,13 @@ -(void)renderAsVectorInContext:(nonnull CGContextRef)context CPTMutableNumericData *cachedLocations = [self cachedNumbersForField:CPTBarPlotFieldBarLocation]; CPTMutableNumericData *cachedLengths = [self cachedNumbersForField:CPTBarPlotFieldBarTip]; - if ( (cachedLocations == nil) || (cachedLengths == nil) ) { + if ((cachedLocations == nil) || (cachedLengths == nil)) { return; } BOOL basesVary = self.barBasesVary; CPTMutableNumericData *cachedBases = [self cachedNumbersForField:CPTBarPlotFieldBarBase]; - if ( basesVary && (cachedBases == nil) ) { + if ( basesVary && (cachedBases == nil)) { return; } @@ -841,7 +897,7 @@ -(void)renderAsVectorInContext:(nonnull CGContextRef)context [NSException raise:CPTException format:@"Number of bar locations and lengths do not match"]; } - if ( basesVary && (cachedLengths.numberOfSamples != cachedBases.numberOfSamples) ) { + if ( basesVary && (cachedLengths.numberOfSamples != cachedBases.numberOfSamples)) { [NSException raise:CPTException format:@"Number of bar lengths and bases do not match"]; } @@ -868,13 +924,13 @@ -(BOOL)barAtRecordIndex:(NSUInteger)idx basePoint:(nonnull CGPoint *)basePoint t if ( self.doublePrecisionCache ) { double plotPoint[2]; plotPoint[independentCoord] = [self cachedDoubleForField:CPTBarPlotFieldBarLocation recordIndex:idx]; - if ( isnan(plotPoint[independentCoord]) ) { + if ( isnan(plotPoint[independentCoord])) { return NO; } // Tip point plotPoint[dependentCoord] = [self cachedDoubleForField:CPTBarPlotFieldBarTip recordIndex:idx]; - if ( isnan(plotPoint[dependentCoord]) ) { + if ( isnan(plotPoint[dependentCoord])) { return NO; } *tipPoint = [thePlotSpace plotAreaViewPointForDoublePrecisionPlotPoint:plotPoint numberOfCoordinates:2]; @@ -886,7 +942,7 @@ -(BOOL)barAtRecordIndex:(NSUInteger)idx basePoint:(nonnull CGPoint *)basePoint t else { plotPoint[dependentCoord] = [self cachedDoubleForField:CPTBarPlotFieldBarBase recordIndex:idx]; } - if ( isnan(plotPoint[dependentCoord]) ) { + if ( isnan(plotPoint[dependentCoord])) { return NO; } *basePoint = [thePlotSpace plotAreaViewPointForDoublePrecisionPlotPoint:plotPoint numberOfCoordinates:2]; @@ -894,13 +950,13 @@ -(BOOL)barAtRecordIndex:(NSUInteger)idx basePoint:(nonnull CGPoint *)basePoint t else { NSDecimal plotPoint[2]; plotPoint[independentCoord] = [self cachedDecimalForField:CPTBarPlotFieldBarLocation recordIndex:idx]; - if ( NSDecimalIsNotANumber(&plotPoint[independentCoord]) ) { + if ( NSDecimalIsNotANumber(&plotPoint[independentCoord])) { return NO; } // Tip point plotPoint[dependentCoord] = [self cachedDecimalForField:CPTBarPlotFieldBarTip recordIndex:idx]; - if ( NSDecimalIsNotANumber(&plotPoint[dependentCoord]) ) { + if ( NSDecimalIsNotANumber(&plotPoint[dependentCoord])) { return NO; } *tipPoint = [thePlotSpace plotAreaViewPointForPlotPoint:plotPoint numberOfCoordinates:2]; @@ -912,7 +968,7 @@ -(BOOL)barAtRecordIndex:(NSUInteger)idx basePoint:(nonnull CGPoint *)basePoint t else { plotPoint[dependentCoord] = [self cachedDecimalForField:CPTBarPlotFieldBarBase recordIndex:idx]; } - if ( NSDecimalIsNotANumber(&plotPoint[dependentCoord]) ) { + if ( NSDecimalIsNotANumber(&plotPoint[dependentCoord])) { return NO; } *basePoint = [thePlotSpace plotAreaViewPointForPlotPoint:plotPoint numberOfCoordinates:2]; @@ -934,7 +990,7 @@ -(BOOL)barAtRecordIndex:(NSUInteger)idx basePoint:(nonnull CGPoint *)basePoint t return YES; } --(nonnull CGMutablePathRef)newBarPathWithContext:(nullable CGContextRef)context recordIndex:(NSUInteger)recordIndex +-(nullable CGMutablePathRef)newBarPathWithContext:(nullable CGContextRef)context recordIndex:(NSUInteger)recordIndex { // Get base and tip points CGPoint basePoint, tipPoint; @@ -944,18 +1000,23 @@ -(nonnull CGMutablePathRef)newBarPathWithContext:(nullable CGContextRef)context return NULL; } - CGMutablePathRef path = [self newBarPathWithContext:context basePoint:basePoint tipPoint:tipPoint]; + NSNumber *width = [self barWidthForIndex:recordIndex]; + + CGMutablePathRef path = [self newBarPathWithContext:context + basePoint:basePoint + tipPoint:tipPoint + width:width]; return path; } --(nonnull CGMutablePathRef)newBarPathWithContext:(nullable CGContextRef)context basePoint:(CGPoint)basePoint tipPoint:(CGPoint)tipPoint +-(nonnull CGMutablePathRef)newBarPathWithContext:(nullable CGContextRef)context basePoint:(CGPoint)basePoint tipPoint:(CGPoint)tipPoint width:(NSNumber *)width { // This function is used to create a path which is used for both // drawing a bar and for doing hit-testing on a click/touch event BOOL horizontalBars = self.barsAreHorizontal; - CGFloat barWidthLength = [self lengthInView:self.barWidth.decimalValue]; + CGFloat barWidthLength = [self lengthInView:width.decimalValue]; CGFloat halfBarWidth = CPTFloat(0.5) * barWidthLength; CGRect barRect; @@ -984,7 +1045,7 @@ -(nonnull CGMutablePathRef)newBarPathWithContext:(nullable CGContextRef)context CGContextRef theContext = context; - if ( self.lineStyle.lineWidth > CPTFloat(0.0) ) { + if ( self.lineStyle.lineWidth > CPTFloat(0.0)) { barRect = CPTAlignRectToUserSpace(theContext, barRect); } else { @@ -992,21 +1053,21 @@ -(nonnull CGMutablePathRef)newBarPathWithContext:(nullable CGContextRef)context } } - CGFloat radius = MIN( MIN( self.barCornerRadius, ABS(barRect.size.width) * CPTFloat(0.5) ), ABS(barRect.size.height) * CPTFloat(0.5) ); - CGFloat baseRadius = MIN( MIN( self.barBaseCornerRadius, ABS(barRect.size.width) * CPTFloat(0.5) ), ABS(barRect.size.height) * CPTFloat(0.5) ); + CGFloat radius = MIN(MIN(self.barCornerRadius, ABS(barRect.size.width) * CPTFloat(0.5)), ABS(barRect.size.height) * CPTFloat(0.5)); + CGFloat baseRadius = MIN(MIN(self.barBaseCornerRadius, ABS(barRect.size.width) * CPTFloat(0.5)), ABS(barRect.size.height) * CPTFloat(0.5)); - if ( widthNegative && ( barRect.size.width > CPTFloat(0.0) ) ) { + if ( widthNegative && (barRect.size.width > CPTFloat(0.0))) { barRect.origin.x += barRect.size.width; barRect.size.width = -barRect.size.width; } - if ( heightNegative && ( barRect.size.height > CPTFloat(0.0) ) ) { + if ( heightNegative && (barRect.size.height > CPTFloat(0.0))) { barRect.origin.y += barRect.size.height; barRect.size.height = -barRect.size.height; } CGMutablePathRef path = CGPathCreateMutable(); - if ( radius == CPTFloat(0.0) ) { - if ( baseRadius == CPTFloat(0.0) ) { + if ( radius == CPTFloat(0.0)) { + if ( baseRadius == CPTFloat(0.0)) { // square corners CGPathAddRect(path, NULL, barRect); } @@ -1034,7 +1095,7 @@ -(nonnull CGMutablePathRef)newBarPathWithContext:(nullable CGContextRef)context CGFloat tipX = barRect.origin.x + barRect.size.width; CGFloat tipY = barRect.origin.y + barRect.size.height; - if ( baseRadius == CPTFloat(0.0) ) { + if ( baseRadius == CPTFloat(0.0)) { // rounded at tip end only CGPathMoveToPoint(path, NULL, barRect.origin.x, barRect.origin.y); if ( horizontalBars ) { @@ -1052,14 +1113,14 @@ -(nonnull CGMutablePathRef)newBarPathWithContext:(nullable CGContextRef)context else { // rounded at both ends if ( horizontalBars ) { - CGPathMoveToPoint( path, NULL, barRect.origin.x, CGRectGetMidY(barRect) ); + CGPathMoveToPoint(path, NULL, barRect.origin.x, CGRectGetMidY(barRect)); CGPathAddArcToPoint(path, NULL, barRect.origin.x, tipY, CGRectGetMidX(barRect), tipY, baseRadius); CGPathAddArcToPoint(path, NULL, tipX, tipY, tipX, CGRectGetMidY(barRect), radius); CGPathAddArcToPoint(path, NULL, tipX, barRect.origin.y, CGRectGetMidX(barRect), barRect.origin.y, radius); CGPathAddArcToPoint(path, NULL, barRect.origin.x, barRect.origin.y, barRect.origin.x, CGRectGetMidY(barRect), baseRadius); } else { - CGPathMoveToPoint( path, NULL, barRect.origin.x, CGRectGetMidY(barRect) ); + CGPathMoveToPoint(path, NULL, barRect.origin.x, CGRectGetMidY(barRect)); CGPathAddArcToPoint(path, NULL, barRect.origin.x, tipY, CGRectGetMidX(barRect), tipY, radius); CGPathAddArcToPoint(path, NULL, tipX, tipY, tipX, CGRectGetMidY(barRect), radius); CGPathAddArcToPoint(path, NULL, tipX, barRect.origin.y, CGRectGetMidX(barRect), barRect.origin.y, baseRadius); @@ -1072,16 +1133,16 @@ -(nonnull CGMutablePathRef)newBarPathWithContext:(nullable CGContextRef)context return path; } --(BOOL)barIsVisibleWithBasePoint:(CGPoint)basePoint +-(BOOL)barIsVisibleWithBasePoint:(CGPoint)basePoint width:(NSNumber *)width { BOOL horizontalBars = self.barsAreHorizontal; - CGFloat barWidthLength = [self lengthInView:self.barWidth.decimalValue]; + CGFloat barWidthLength = [self lengthInView:width.decimalValue]; CGFloat halfBarWidth = CPTFloat(0.5) * barWidthLength; CPTPlotArea *thePlotArea = self.plotArea; - CGFloat lowerBound = ( horizontalBars ? CGRectGetMinY(thePlotArea.bounds) : CGRectGetMinX(thePlotArea.bounds) ); - CGFloat upperBound = ( horizontalBars ? CGRectGetMaxY(thePlotArea.bounds) : CGRectGetMaxX(thePlotArea.bounds) ); + CGFloat lowerBound = (horizontalBars ? CGRectGetMinY(thePlotArea.bounds) : CGRectGetMinX(thePlotArea.bounds)); + CGFloat upperBound = (horizontalBars ? CGRectGetMaxY(thePlotArea.bounds) : CGRectGetMaxX(thePlotArea.bounds)); CGFloat base = (horizontalBars ? basePoint.y : basePoint.x); return (base + halfBarWidth >= lowerBound) && (base - halfBarWidth <= upperBound); @@ -1091,7 +1152,7 @@ -(nullable CPTFill *)barFillForIndex:(NSUInteger)idx { CPTFill *theBarFill = [self cachedValueForKey:CPTBarPlotBindingBarFills recordIndex:idx]; - if ( (theBarFill == nil) || (theBarFill == [CPTPlot nilData]) ) { + if ((theBarFill == nil) || (theBarFill == [CPTPlot nilData])) { theBarFill = self.fill; } @@ -1102,13 +1163,24 @@ -(nullable CPTLineStyle *)barLineStyleForIndex:(NSUInteger)idx { CPTLineStyle *theBarLineStyle = [self cachedValueForKey:CPTBarPlotBindingBarLineStyles recordIndex:idx]; - if ( (theBarLineStyle == nil) || (theBarLineStyle == [CPTPlot nilData]) ) { + if ((theBarLineStyle == nil) || (theBarLineStyle == [CPTPlot nilData])) { theBarLineStyle = self.lineStyle; } return theBarLineStyle; } +-(nonnull NSNumber *)barWidthForIndex:(NSUInteger)idx +{ + NSNumber *theBarWidth = [self cachedValueForKey:CPTBarPlotBindingBarWidths recordIndex:idx]; + + if ((theBarWidth == nil) || (theBarWidth == [CPTPlot nilData])) { + theBarWidth = self.barWidth; + } + + return theBarWidth; +} + -(void)drawBarInContext:(nonnull CGContextRef)context recordIndex:(NSUInteger)idx { // Get base and tip points @@ -1119,12 +1191,17 @@ -(void)drawBarInContext:(nonnull CGContextRef)context recordIndex:(NSUInteger)id return; } + NSNumber *width = [self barWidthForIndex:idx]; + // Return if bar is off screen - if ( ![self barIsVisibleWithBasePoint:basePoint] ) { + if ( ![self barIsVisibleWithBasePoint:basePoint width:width] ) { return; } - CGMutablePathRef path = [self newBarPathWithContext:context basePoint:basePoint tipPoint:tipPoint]; + CGMutablePathRef path = [self newBarPathWithContext:context + basePoint:basePoint + tipPoint:tipPoint + width:width]; if ( path ) { CGContextSaveGState(context); @@ -1230,7 +1307,7 @@ -(void)positionLabelAnnotation:(nonnull CPTPlotSpaceAnnotation *)label forIndex: BOOL horizontalBars = self.barsAreHorizontal; CPTCoordinate coordinate = (horizontalBars ? CPTCoordinateX : CPTCoordinateY); CPTPlotRange *lengthRange = [self.plotSpace plotRangeForCoordinate:coordinate]; - if ( CPTDecimalLessThan( lengthRange.lengthDecimal, CPTDecimalFromInteger(0) ) ) { + if ( CPTDecimalLessThan(lengthRange.lengthDecimal, CPTDecimalFromInteger(0))) { positiveDirection = !positiveDirection; } @@ -1350,10 +1427,10 @@ -(NSUInteger)dataIndexFromInteractionPoint:(CGPoint)point NSUInteger barCount = self.cachedDataCount; NSUInteger ii = 0; - while ( (ii < barCount) && (idx == NSNotFound) ) { + while ((ii < barCount) && (idx == NSNotFound)) { CGMutablePathRef path = [self newBarPathWithContext:NULL recordIndex:ii]; - if ( CGPathContainsPoint(path, NULL, point, false) ) { + if ( CGPathContainsPoint(path, NULL, point, false)) { idx = ii; } @@ -1397,7 +1474,7 @@ -(BOOL)pointingDeviceDownEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint) return NO; } - id theDelegate = self.delegate; + id theDelegate = (id)self.delegate; if ( [theDelegate respondsToSelector:@selector(barPlot:barTouchDownAtRecordIndex:)] || [theDelegate respondsToSelector:@selector(barPlot:barTouchDownAtRecordIndex:withEvent:)] || [theDelegate respondsToSelector:@selector(barPlot:barWasSelectedAtRecordIndex:)] || @@ -1466,7 +1543,7 @@ -(BOOL)pointingDeviceUpEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)in return NO; } - id theDelegate = self.delegate; + id theDelegate = (id)self.delegate; if ( [theDelegate respondsToSelector:@selector(barPlot:barTouchUpAtRecordIndex:)] || [theDelegate respondsToSelector:@selector(barPlot:barTouchUpAtRecordIndex:withEvent:)] || [theDelegate respondsToSelector:@selector(barPlot:barWasSelectedAtRecordIndex:)] || diff --git a/framework/Source/CPTBorderedLayer.m b/framework/Source/CPTBorderedLayer.m index 8113f5ba8..7a6126c00 100644 --- a/framework/Source/CPTBorderedLayer.m +++ b/framework/Source/CPTBorderedLayer.m @@ -1,10 +1,10 @@ #import "CPTBorderedLayer.h" +#import "_CPTBorderLayer.h" +#import "_CPTMaskLayer.h" #import "CPTFill.h" #import "CPTLineStyle.h" #import "CPTPathExtensions.h" -#import "_CPTBorderLayer.h" -#import "_CPTMaskLayer.h" /// @cond @@ -68,7 +68,7 @@ @implementation CPTBorderedLayer **/ -(nonnull instancetype)initWithFrame:(CGRect)newFrame { - if ( (self = [super initWithFrame:newFrame]) ) { + if ((self = [super initWithFrame:newFrame])) { borderLineStyle = nil; fill = nil; inLayout = NO; @@ -84,7 +84,7 @@ -(nonnull instancetype)initWithFrame:(CGRect)newFrame -(nonnull instancetype)initWithLayer:(nonnull id)layer { - if ( (self = [super initWithLayer:layer]) ) { + if ((self = [super initWithLayer:layer])) { CPTBorderedLayer *theLayer = (CPTBorderedLayer *)layer; borderLineStyle = theLayer->borderLineStyle; @@ -114,7 +114,7 @@ -(void)encodeWithCoder:(nonnull NSCoder *)coder -(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super initWithCoder:coder]) ) { + if ((self = [super initWithCoder:coder])) { borderLineStyle = [[coder decodeObjectOfClass:[CPTLineStyle class] forKey:@"CPTBorderedLayer.borderLineStyle"] copy]; fill = [[coder decodeObjectOfClass:[CPTFill class] @@ -183,7 +183,7 @@ -(void)renderBorderedLayerAsVectorInContext:(nonnull CGContextRef)context CGFloat radius = self.cornerRadius; - if ( radius > CPTFloat(0.0) ) { + if ( radius > CPTFloat(0.0)) { CGContextBeginPath(context); CPTAddRoundedRectPath(context, layerBounds, radius); [theLineStyle strokePathInContext:context]; @@ -212,7 +212,7 @@ -(void)sublayerMarginLeft:(nonnull CGFloat *)left top:(nonnull CGFloat *)top rig CGFloat inset = self.borderLineStyle.lineWidth * CPTFloat(0.5); - if ( inset > CPTFloat(0.0) ) { + if ( inset > CPTFloat(0.0)) { *left += inset; *top += inset; *right += inset; @@ -271,7 +271,7 @@ -(nullable CGPathRef)sublayerMaskingPath CGFloat lineWidth = self.borderLineStyle.lineWidth; CGRect selfBounds = CGRectInset(self.bounds, lineWidth, lineWidth); - path = CPTCreateRoundedRectPath( selfBounds, self.cornerRadius - lineWidth * CPTFloat(0.5) ); + path = CPTCreateRoundedRectPath(selfBounds, self.cornerRadius - lineWidth * CPTFloat(0.5)); self.innerBorderPath = path; CGPathRelease(path); @@ -306,7 +306,7 @@ -(void)removeFromSuperlayer -(void)updateOpacity { - BOOL opaqueLayer = ( self.cornerRadius <= CPTFloat(0.0) ); + BOOL opaqueLayer = (self.cornerRadius <= CPTFloat(0.0)); CPTFill *theFill = self.fill; @@ -353,7 +353,7 @@ -(void)setFill:(nullable CPTFill *)newFill fill = [newFill copy]; CPTLayer *border = self.borderLayer; - if ( self.cornerRadius != CPTFloat(0.0) ) { + if ( self.cornerRadius != CPTFloat(0.0)) { border.backgroundColor = NULL; } else { diff --git a/framework/Source/CPTCalendarFormatter.m b/framework/Source/CPTCalendarFormatter.m index abb1c3be0..928263b4e 100644 --- a/framework/Source/CPTCalendarFormatter.m +++ b/framework/Source/CPTCalendarFormatter.m @@ -67,7 +67,7 @@ -(nonnull instancetype)init **/ -(nonnull instancetype)initWithDateFormatter:(nullable NSDateFormatter *)aDateFormatter { - if ( (self = [super init]) ) { + if ((self = [super init])) { dateFormatter = aDateFormatter; referenceDate = nil; referenceCalendar = nil; @@ -99,7 +99,7 @@ -(void)encodeWithCoder:(nonnull NSCoder *)coder */ -(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super init]) ) { + if ((self = [super init])) { dateFormatter = [coder decodeObjectForKey:@"CPTCalendarFormatter.dateFormatter"]; referenceDate = [[coder decodeObjectForKey:@"CPTCalendarFormatter.referenceDate"] copy]; referenceCalendar = [[coder decodeObjectForKey:@"CPTCalendarFormatter.referenceCalendar"] copy]; @@ -142,7 +142,7 @@ -(nonnull id)copyWithZone:(nullable NSZone *)zone * @param coordinateValue The time value. * @return The date string. **/ --(nullable NSString *)stringForObjectValue:(nonnull id)coordinateValue +-(nullable NSString *)stringForObjectValue:(nullable id)coordinateValue { NSInteger componentIncrement = 0; @@ -189,7 +189,7 @@ -(nullable NSString *)stringForObjectValue:(nonnull id)coordinateValue dateComponents.weekdayOrdinal = componentIncrement; break; -#if MAC_OS_X_VERSION_10_5 @property (nonatomic, readonly, nonnull) CGColorRef cgColor; @property (nonatomic, readonly, getter = isOpaque) BOOL opaque; -/// @name Factory Methods +#if TARGET_OS_OSX +@property (nonatomic, readonly, nonnull) NSColor *nsColor; +#elif TARGET_OS_SIMULATOR || TARGET_OS_IPHONE +@property (nonatomic, readonly, nonnull) UIColor *uiColor; +#endif +@property (nonatomic, readonly, nonnull) CPTNativeColor *nativeColor; + +/// @name Standard Colors /// @{ +(nonnull instancetype)clearColor; +(nonnull instancetype)whiteColor; @@ -20,10 +29,21 @@ +(nonnull instancetype)orangeColor; +(nonnull instancetype)purpleColor; +(nonnull instancetype)brownColor; +/// @} +/// @name Factory Methods +/// @{ +(nonnull instancetype)colorWithCGColor:(nonnull CGColorRef)newCGColor; +(nonnull instancetype)colorWithComponentRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha; +(nonnull instancetype)colorWithGenericGray:(CGFloat)gray; + +#if TARGET_OS_OSX ++(nonnull instancetype)colorWithNSColor:(nonnull NSColor *)newNSColor; +#elif TARGET_OS_SIMULATOR || TARGET_OS_IPHONE ++(nonnull instancetype)colorWithUIColor:(nonnull UIColor *)newUIColor; +#endif ++(nonnull instancetype)colorWithNativeColor:(nonnull CPTNativeColor *)newColor; + /// @} /// @name Initialization @@ -32,6 +52,13 @@ -(nonnull instancetype)initWithComponentRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha; -(nullable instancetype)initWithCoder:(nonnull NSCoder *)decoder NS_DESIGNATED_INITIALIZER; +#if TARGET_OS_OSX +-(nonnull instancetype)initWithNSColor:(nonnull NSColor *)newNSColor NS_DESIGNATED_INITIALIZER; +#elif TARGET_OS_SIMULATOR || TARGET_OS_IPHONE +-(nonnull instancetype)initWithUIColor:(nonnull UIColor *)newUIColor NS_DESIGNATED_INITIALIZER; +#endif +-(nonnull instancetype)initWithNativeColor:(nonnull CPTNativeColor *)newColor; + -(nonnull instancetype)colorWithAlphaComponent:(CGFloat)alpha; /// @} diff --git a/framework/Source/CPTColor.m b/framework/Source/CPTColor.m index 7c47d318b..2be62efdf 100644 --- a/framework/Source/CPTColor.m +++ b/framework/Source/CPTColor.m @@ -5,6 +5,22 @@ #import "CPTPlatformSpecificCategories.h" #import "NSCoderExtensions.h" +/// @cond + +@interface CPTColor() + +#if TARGET_OS_OSX +@property (nonatomic, readonly, nullable) NSColor *nsColorCache; +#elif TARGET_OS_SIMULATOR || TARGET_OS_IPHONE +@property (nonatomic, readonly, nullable) UIColor *uiColorCache; +#endif + +@end + +/// @endcond + +#pragma mark - + /** @brief An immutable color. * * An immutable object wrapper class around @ref CGColorRef. @@ -14,18 +30,100 @@ **/ @implementation CPTColor +#if TARGET_OS_OSX + +/** @internal + * @property nullable NSColor *nsColorCache + * @brief The NSColor to wrap around. + **/ +@synthesize nsColorCache; + +/** @property nonnull NSColor *nsColor + * @brief The NSColor to wrap around. + **/ +@dynamic nsColor; + +-(NSColor *)nsColor +{ + NSColor *theNSColor = self.nsColorCache; + + if ( theNSColor ) { + return theNSColor; + } + else { + return [NSColor colorWithCIColor:[CIColor colorWithCGColor:self.cgColor]]; + } +} + +#elif TARGET_OS_SIMULATOR || TARGET_OS_IPHONE + +/** @internal + * @property nullable UIColor *uiColorCache + * @brief The UIColor to wrap around. + **/ +@synthesize uiColorCache; + +/** @property nonnull UIColor *uiColor + * @brief The UIColor to wrap around. + **/ +@dynamic uiColor; + +-(UIColor *)uiColor +{ + UIColor *theUIColor = self.uiColorCache; + + if ( theUIColor ) { + return theUIColor; + } + else { + return [UIColor colorWithCGColor:self.cgColor]; + } +} + +#endif + +/** @property nonnull CPTNativeColor *nativeColor + * @brief The platform-native color to wrap around. + **/ +@dynamic nativeColor; + +-(CPTNativeColor *)nativeColor +{ +#if TARGET_OS_OSX + return self.nsColor; +#elif TARGET_OS_SIMULATOR || TARGET_OS_IPHONE + return self.uiColor; +#endif +} + /** @property nonnull CGColorRef cgColor * @brief The @ref CGColorRef to wrap around. **/ @synthesize cgColor; +-(CGColorRef)cgColor +{ +#if TARGET_OS_OSX + NSColor *theNSColor = self.nsColorCache; + if ( theNSColor ) { + return theNSColor.CGColor; + } +#elif TARGET_OS_SIMULATOR || TARGET_OS_IPHONE + UIColor *theUIColor = self.uiColorCache; + if ( theUIColor ) { + return theUIColor.CGColor; + } +#endif + return cgColor; +} + /** @property BOOL opaque * @brief If @YES, the color is completely opaque. */ @dynamic opaque; #pragma mark - -#pragma mark Factory Methods +#pragma mark Standard Colors /** @brief Returns a shared instance of CPTColor initialized with a fully transparent color. * @@ -41,7 +139,7 @@ +(nonnull instancetype)clearColor CGColorRef clear = CGColorCreate([CPTColorSpace genericRGBSpace].cgColorSpace, values); - color = [[CPTColor alloc] initWithCGColor:clear]; + color = [[self alloc] initWithCGColor:clear]; CGColorRelease(clear); }); @@ -139,10 +237,10 @@ +(nonnull instancetype)redColor static dispatch_once_t onceToken = 0; dispatch_once(&onceToken, ^{ - color = [[CPTColor alloc] initWithComponentRed:CPTFloat(1.0) - green:CPTFloat(0.0) - blue:CPTFloat(0.0) - alpha:CPTFloat(1.0)]; + color = [[self alloc] initWithComponentRed:CPTFloat(1.0) + green:CPTFloat(0.0) + blue:CPTFloat(0.0) + alpha:CPTFloat(1.0)]; }); return color; @@ -158,10 +256,10 @@ +(nonnull instancetype)greenColor static dispatch_once_t onceToken = 0; dispatch_once(&onceToken, ^{ - color = [[CPTColor alloc] initWithComponentRed:CPTFloat(0.0) - green:CPTFloat(1.0) - blue:CPTFloat(0.0) - alpha:CPTFloat(1.0)]; + color = [[self alloc] initWithComponentRed:CPTFloat(0.0) + green:CPTFloat(1.0) + blue:CPTFloat(0.0) + alpha:CPTFloat(1.0)]; }); return color; @@ -177,10 +275,10 @@ +(nonnull instancetype)blueColor static dispatch_once_t onceToken = 0; dispatch_once(&onceToken, ^{ - color = [[CPTColor alloc] initWithComponentRed:CPTFloat(0.0) - green:CPTFloat(0.0) - blue:CPTFloat(1.0) - alpha:CPTFloat(1.0)]; + color = [[self alloc] initWithComponentRed:CPTFloat(0.0) + green:CPTFloat(0.0) + blue:CPTFloat(1.0) + alpha:CPTFloat(1.0)]; }); return color; @@ -196,10 +294,10 @@ +(nonnull instancetype)cyanColor static dispatch_once_t onceToken = 0; dispatch_once(&onceToken, ^{ - color = [[CPTColor alloc] initWithComponentRed:CPTFloat(0.0) - green:CPTFloat(1.0) - blue:CPTFloat(1.0) - alpha:CPTFloat(1.0)]; + color = [[self alloc] initWithComponentRed:CPTFloat(0.0) + green:CPTFloat(1.0) + blue:CPTFloat(1.0) + alpha:CPTFloat(1.0)]; }); return color; @@ -215,7 +313,7 @@ +(nonnull instancetype)yellowColor static dispatch_once_t onceToken = 0; dispatch_once(&onceToken, ^{ - color = [[CPTColor alloc] initWithComponentRed:CPTFloat(1.0) green:CPTFloat(1.0) blue:CPTFloat(0.0) alpha:CPTFloat(1.0)]; + color = [[self alloc] initWithComponentRed:CPTFloat(1.0) green:CPTFloat(1.0) blue:CPTFloat(0.0) alpha:CPTFloat(1.0)]; }); return color; @@ -230,7 +328,7 @@ +(nonnull instancetype)magentaColor static CPTColor *color = nil; if ( nil == color ) { - color = [[CPTColor alloc] initWithComponentRed:CPTFloat(1.0) green:CPTFloat(0.0) blue:CPTFloat(1.0) alpha:CPTFloat(1.0)]; + color = [[self alloc] initWithComponentRed:CPTFloat(1.0) green:CPTFloat(0.0) blue:CPTFloat(1.0) alpha:CPTFloat(1.0)]; } return color; } @@ -245,7 +343,7 @@ +(nonnull instancetype)orangeColor static dispatch_once_t onceToken = 0; dispatch_once(&onceToken, ^{ - color = [[CPTColor alloc] initWithComponentRed:CPTFloat(1.0) green:CPTFloat(0.5) blue:CPTFloat(0.0) alpha:CPTFloat(1.0)]; + color = [[self alloc] initWithComponentRed:CPTFloat(1.0) green:CPTFloat(0.5) blue:CPTFloat(0.0) alpha:CPTFloat(1.0)]; }); return color; @@ -261,7 +359,7 @@ +(nonnull instancetype)purpleColor static dispatch_once_t onceToken = 0; dispatch_once(&onceToken, ^{ - color = [[CPTColor alloc] initWithComponentRed:CPTFloat(0.5) green:CPTFloat(0.0) blue:CPTFloat(0.5) alpha:CPTFloat(1.0)]; + color = [[self alloc] initWithComponentRed:CPTFloat(0.5) green:CPTFloat(0.0) blue:CPTFloat(0.5) alpha:CPTFloat(1.0)]; }); return color; @@ -277,19 +375,22 @@ +(nonnull instancetype)brownColor static dispatch_once_t onceToken = 0; dispatch_once(&onceToken, ^{ - color = [[CPTColor alloc] initWithComponentRed:CPTFloat(0.6) green:CPTFloat(0.4) blue:CPTFloat(0.2) alpha:CPTFloat(1.0)]; + color = [[self alloc] initWithComponentRed:CPTFloat(0.6) green:CPTFloat(0.4) blue:CPTFloat(0.2) alpha:CPTFloat(1.0)]; }); return color; } +#pragma mark - +#pragma mark Factory Methods + /** @brief Creates and returns a new CPTColor instance initialized with the provided @ref CGColorRef. * @param newCGColor The color to wrap. * @return A new CPTColor instance initialized with the provided @ref CGColorRef. **/ +(nonnull instancetype)colorWithCGColor:(nonnull CGColorRef)newCGColor { - return [[CPTColor alloc] initWithCGColor:newCGColor]; + return [[self alloc] initWithCGColor:newCGColor]; } /** @brief Creates and returns a new CPTColor instance initialized with the provided RGBA color components. @@ -301,7 +402,7 @@ +(nonnull instancetype)colorWithCGColor:(nonnull CGColorRef)newCGColor **/ +(nonnull instancetype)colorWithComponentRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha { - return [[CPTColor alloc] initWithComponentRed:red green:green blue:blue alpha:alpha]; + return [[self alloc] initWithComponentRed:red green:green blue:blue alpha:alpha]; } /** @brief Creates and returns a new CPTColor instance initialized with the provided gray level. @@ -312,12 +413,58 @@ +(nonnull instancetype)colorWithGenericGray:(CGFloat)gray { CGFloat values[4] = { gray, gray, gray, CPTFloat(1.0) }; CGColorRef colorRef = CGColorCreate([CPTColorSpace genericRGBSpace].cgColorSpace, values); - CPTColor *color = [[CPTColor alloc] initWithCGColor:colorRef]; + CPTColor *color = [[self alloc] initWithCGColor:colorRef]; CGColorRelease(colorRef); return color; } +#if TARGET_OS_OSX + +/** @brief Creates and returns a new CPTColor instance initialized with the provided NSColor. + * + * The NSColor can be a dynamic system color or catalog color. This adds support for Dark Mode in macOS 10.14. + * + * @param newNSColor The color to wrap. + * @return A new CPTColor instance initialized with the provided NSColor. + **/ ++(nonnull instancetype)colorWithNSColor:(nonnull NSColor *)newNSColor +{ + return [[self alloc] initWithNSColor:newNSColor]; +} + +#elif TARGET_OS_SIMULATOR || TARGET_OS_IPHONE + +/** @brief Creates and returns a new CPTColor instance initialized with the provided UIColor. + * + * The UIColor can be a dynamic system color or catalog color. This adds support for Dark Mode in iOS 13. + * + * @param newUIColor The color to wrap. + * @return A new CPTColor instance initialized with the provided UIColor. + **/ ++(nonnull instancetype)colorWithUIColor:(nonnull UIColor *)newUIColor +{ + return [[self alloc] initWithUIColor:newUIColor]; +} + +#endif + +/** @brief Creates and returns a new CPTColor instance initialized with the provided platform-native color. + * + * The color can be a dynamic system color or catalog color. This adds support for Dark Mode in iOS13. + * + * @param newColor The color to wrap. + * @return A new CPTColor instance initialized with the provided platform-native color. + **/ ++(nonnull instancetype)colorWithNativeColor:(nonnull CPTNativeColor *)newColor +{ +#if TARGET_OS_OSX + return [[self alloc] initWithNSColor:newColor]; +#elif TARGET_OS_SIMULATOR || TARGET_OS_IPHONE + return [[self alloc] initWithUIColor:newColor]; +#endif +} + #pragma mark - #pragma mark Init/Dealloc @@ -328,7 +475,7 @@ +(nonnull instancetype)colorWithGenericGray:(CGFloat)gray **/ -(nonnull instancetype)initWithCGColor:(nonnull CGColorRef)newCGColor { - if ( (self = [super init]) ) { + if ((self = [super init])) { CGColorRetain(newCGColor); cgColor = newCGColor; } @@ -357,6 +504,58 @@ -(nonnull instancetype)initWithComponentRed:(CGFloat)red green:(CGFloat)green bl return self; } +#if TARGET_OS_OSX + +/** @brief Initializes a newly allocated CPTColor object with the provided NSColor. + * + * The NSColor can be a dynamic system color or catalog color. This adds support for Dark Mode in macOS 10.14. + * + * @param newNSColor The color to wrap. + * @return The initialized CPTColor object. + **/ +-(nonnull instancetype)initWithNSColor:(nonnull NSColor *)newNSColor +{ + if ((self = [super init])) { + nsColorCache = newNSColor; + } + return self; +} + +#elif TARGET_OS_SIMULATOR || TARGET_OS_IPHONE + +/** @brief Initializes a newly allocated CPTColor object with the provided UIColor. + * + * The UIColor can be a dynamic system color or catalog color. This adds support for Dark Mode in iOS 13. + * + * @param newUIColor The color to wrap. + * @return The initialized CPTColor object. + **/ +-(nonnull instancetype)initWithUIColor:(nonnull UIColor *)newUIColor +{ + if ((self = [super init])) { + uiColorCache = newUIColor; + } + return self; +} + +#endif + +/** @brief Initializes a newly allocated CPTColor object with the provided platform-native color. + * + * The color can be a dynamic system color or catalog color. This adds support for Dark Mode in macOS 10.14 and iOS 13. + * + * @param newColor The color to wrap. + * @return The initialized CPTColor object. + **/ +-(nonnull instancetype)initWithNativeColor:(nonnull CPTNativeColor *)newColor +{ +#if TARGET_OS_OSX + return [self initWithNSColor:newColor]; +#elif TARGET_OS_SIMULATOR || TARGET_OS_IPHONE + return [self initWithUIColor:newColor]; +#endif +} + /// @cond -(nonnull instancetype)init @@ -381,8 +580,21 @@ -(void)dealloc **/ -(nonnull instancetype)colorWithAlphaComponent:(CGFloat)alpha { +#if TARGET_OS_OSX + NSColor *theNSColor = self.nsColorCache; + if ( theNSColor ) { + NSColor *newNSColor = [theNSColor colorWithAlphaComponent:alpha]; + return [[self class] colorWithNSColor:newNSColor]; + } +#elif TARGET_OS_SIMULATOR || TARGET_OS_IPHONE + UIColor *theUIColor = self.uiColorCache; + if ( theUIColor ) { + UIColor *newUIColor = [theUIColor colorWithAlphaComponent:alpha]; + return [[self class] colorWithUIColor:newUIColor]; + } +#endif CGColorRef newCGColor = CGColorCreateCopyWithAlpha(self.cgColor, alpha); - CPTColor *newColor = [CPTColor colorWithCGColor:newCGColor]; + CPTColor *newColor = [[self class] colorWithCGColor:newCGColor]; CGColorRelease(newCGColor); return newColor; @@ -407,6 +619,12 @@ -(BOOL)isOpaque -(void)encodeWithCoder:(nonnull NSCoder *)coder { +#if TARGET_OS_OSX + [coder encodeConditionalObject:self.nsColorCache forKey:@"CPTColor.nsColorCache"]; +#elif TARGET_OS_SIMULATOR || TARGET_OS_IPHONE + [coder encodeConditionalObject:self.uiColorCache forKey:@"CPTColor.uiColorCache"]; +#endif + CGColorRef theColor = self.cgColor; [coder encodeCGColorSpace:CGColorGetColorSpace(theColor) forKey:@"CPTColor.colorSpace"]; @@ -430,12 +648,25 @@ -(void)encodeWithCoder:(nonnull NSCoder *)coder */ -(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super init]) ) { + if ((self = [super init])) { +#if TARGET_OS_OSX + NSColor *decodedNSColor = [coder decodeObjectOfClass:[NSColor class] + forKey:@"CPTColor.nsColorCache"]; + if ( decodedNSColor ) { + nsColorCache = decodedNSColor; + } +#elif TARGET_OS_SIMULATOR || TARGET_OS_IPHONE + UIColor *decodedUIColor = [coder decodeObjectOfClass:[UIColor class] + forKey:@"CPTColor.uiColorCache"]; + if ( decodedUIColor ) { + uiColorCache = decodedUIColor; + } +#endif CGColorSpaceRef colorSpace = [coder newCGColorSpaceDecodeForKey:@"CPTColor.colorSpace"]; size_t numberOfComponents = (size_t)[coder decodeInt64ForKey:@"CPTColor.numberOfComponents"]; - CGFloat *colorComponents = malloc( numberOfComponents * sizeof(CGFloat) ); + CGFloat *colorComponents = calloc(numberOfComponents, sizeof(CGFloat)); for ( size_t i = 0; i < numberOfComponents; i++ ) { NSString *newKey = [[NSString alloc] initWithFormat:@"CPTColor.component[%zu]", i]; @@ -470,6 +701,19 @@ +(BOOL)supportsSecureCoding -(nonnull id)copyWithZone:(nullable NSZone *)zone { +#if TARGET_OS_OSX + NSColor *nsColorCopy = [self.nsColorCache copyWithZone:zone]; + if ( nsColorCopy ) { + CPTColor *colorCopy = [[[self class] allocWithZone:zone] initWithNSColor:nsColorCopy]; + return colorCopy; + } +#elif TARGET_OS_SIMULATOR || TARGET_OS_IPHONE + UIColor *uiColorCopy = [self.uiColorCache copyWithZone:zone]; + if ( uiColorCopy ) { + CPTColor *colorCopy = [[[self class] allocWithZone:zone] initWithUIColor:uiColorCopy]; + return colorCopy; + } +#endif CGColorRef cgColorCopy = NULL; CGColorRef myColor = self.cgColor; @@ -504,7 +748,7 @@ -(BOOL)isEqual:(nullable id)object return YES; } else if ( [object isKindOfClass:[self class]] ) { - return CGColorEqualToColor(self.cgColor, ( (CPTColor *)object ).cgColor); + return CGColorEqualToColor(self.cgColor, ((CPTColor *)object).cgColor); } else { return NO; @@ -544,7 +788,6 @@ -(nullable id)debugQuickLookObject { #if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE return self.uiColor; - #else return self.nsColor; #endif diff --git a/framework/Source/CPTColorSpace.m b/framework/Source/CPTColorSpace.m index 22816b351..6086f09ef 100644 --- a/framework/Source/CPTColorSpace.m +++ b/framework/Source/CPTColorSpace.m @@ -37,7 +37,7 @@ +(nonnull instancetype)genericRGBSpace #else cgSpace = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB); #endif - space = [[CPTColorSpace alloc] initWithCGColorSpace:cgSpace]; + space = [[self alloc] initWithCGColorSpace:cgSpace]; CGColorSpaceRelease(cgSpace); }); @@ -55,7 +55,7 @@ +(nonnull instancetype)genericRGBSpace **/ -(nonnull instancetype)initWithCGColorSpace:(nonnull CGColorSpaceRef)colorSpace { - if ( (self = [super init]) ) { + if ((self = [super init])) { CGColorSpaceRetain(colorSpace); cgColorSpace = colorSpace; } @@ -106,7 +106,7 @@ -(void)encodeWithCoder:(nonnull NSCoder *)coder */ -(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super init]) ) { + if ((self = [super init])) { CGColorSpaceRef colorSpace = [coder newCGColorSpaceDecodeForKey:@"CPTColorSpace.cgColorSpace"]; if ( colorSpace ) { diff --git a/framework/Source/CPTColorSpaceTests.m b/framework/Source/CPTColorSpaceTests.m index 61a22d2c5..40fecd110 100644 --- a/framework/Source/CPTColorSpaceTests.m +++ b/framework/Source/CPTColorSpaceTests.m @@ -13,8 +13,18 @@ -(void)testKeyedArchivingRoundTrip CPTColorSpace *newColorSpace = [self archiveRoundTrip:colorSpace]; - CFDataRef iccProfile = CGColorSpaceCopyICCProfile(colorSpace.cgColorSpace); - CFDataRef newIccProfile = CGColorSpaceCopyICCProfile(newColorSpace.cgColorSpace); + CFDataRef iccProfile = NULL; + CFDataRef newIccProfile = NULL; + + // CGColorSpaceCopyICCProfile() is deprecated as of macOS 10.13 + if ( CGColorSpaceCopyICCData ) { + iccProfile = CGColorSpaceCopyICCData(colorSpace.cgColorSpace); + newIccProfile = CGColorSpaceCopyICCData(newColorSpace.cgColorSpace); + } + else { + iccProfile = CGColorSpaceCopyICCProfile(colorSpace.cgColorSpace); + newIccProfile = CGColorSpaceCopyICCProfile(newColorSpace.cgColorSpace); + } if ( iccProfile && newIccProfile ) { XCTAssertTrue([(__bridge NSData *) iccProfile isEqualToData:(__bridge NSData *)newIccProfile], @"Color spaces not equal"); diff --git a/framework/Source/CPTColorTests.m b/framework/Source/CPTColorTests.m index e2b0840a4..ea7a9fb8c 100644 --- a/framework/Source/CPTColorTests.m +++ b/framework/Source/CPTColorTests.m @@ -14,6 +14,20 @@ -(void)testKeyedArchivingRoundTrip CPTColor *newColor = [self archiveRoundTrip:color]; XCTAssertEqualObjects(color, newColor, @"Colors not equal"); + +#if TARGET_OS_OSX +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wundeclared-selector" + // Workaround since @available macro is not there + if ( [NSColor respondsToSelector:@selector(systemRedColor)] ) { + color = [CPTColor colorWithNSColor:[NSColor systemRedColor]]; + + newColor = [self archiveRoundTrip:color]; + + XCTAssertEqualObjects(color, newColor, @"Colors not equal"); + } +#pragma clang diagnostic pop +#endif } @end diff --git a/framework/Source/CPTConstraints.m b/framework/Source/CPTConstraints.m index ad47f70b9..c9896ea25 100644 --- a/framework/Source/CPTConstraints.m +++ b/framework/Source/CPTConstraints.m @@ -1,9 +1,9 @@ #import "CPTConstraints.h" -#import "CPTDefinitions.h" -#import "NSCoderExtensions.h" #import "_CPTConstraintsFixed.h" #import "_CPTConstraintsRelative.h" +#import "CPTDefinitions.h" +#import "NSCoderExtensions.h" /** @brief Implements a one-dimensional constrained position within a given numeric range. * @@ -90,7 +90,7 @@ -(nonnull instancetype)initWithRelativeOffset:(CGFloat)newOffset /// @cond --(nonnull id)copyWithZone:(nullable NSZone *)zone +-(nonnull id)copyWithZone:(nullable NSZone *__unused)zone { // do nothing--implemented in subclasses return nil; @@ -103,7 +103,7 @@ -(nonnull id)copyWithZone:(nullable NSZone *)zone /// @cond --(void)encodeWithCoder:(nonnull NSCoder *)coder +-(void)encodeWithCoder:(nonnull NSCoder *__unused)coder { // do nothing--implemented in subclasses } @@ -169,7 +169,7 @@ -(BOOL)isEqualToConstraint:(nullable CPTConstraints *)otherConstraint * @param upperBound The upper bound; must be greater than or equal to the @par{lowerBound}. * @return The calculated position. **/ --(CGFloat)positionForLowerBound:(CGFloat)lowerBound upperBound:(CGFloat)upperBound +-(CGFloat)positionForLowerBound:(CGFloat __unused)lowerBound upperBound:(CGFloat __unused)upperBound { // subclasses override to do position calculation here return CPTNAN; diff --git a/framework/Source/CPTDarkGradientThemeTests.m b/framework/Source/CPTDarkGradientThemeTests.m index 0f215c53f..71b64df7a 100644 --- a/framework/Source/CPTDarkGradientThemeTests.m +++ b/framework/Source/CPTDarkGradientThemeTests.m @@ -1,7 +1,7 @@ #import "CPTDarkGradientThemeTests.h" -#import "CPTDerivedXYGraph.h" #import "_CPTDarkGradientTheme.h" +#import "CPTDerivedXYGraph.h" @implementation CPTDarkGradientThemeTests diff --git a/framework/Source/CPTDataSourceTestCase.m b/framework/Source/CPTDataSourceTestCase.m index ce5a50380..1c71e3e1d 100644 --- a/framework/Source/CPTDataSourceTestCase.m +++ b/framework/Source/CPTDataSourceTestCase.m @@ -51,7 +51,7 @@ -(void)buildData arr = [NSMutableArray arrayWithCapacity:recordCount]; for ( NSUInteger i = 0; i < recordCount; i++ ) { - [arr insertObject:@( sin(2 * M_PI * (double)i / (double)recordCount) ) atIndex:i]; + [arr insertObject:@(sin(2 * M_PI * (double)i / (double)recordCount)) atIndex:i]; } self.yData = arr; } @@ -81,7 +81,7 @@ -(nonnull CPTPlotRange *)yRange CPTMutablePlotRange *range = [self plotRangeForData:data]; if ( self.plots.count > 1 ) { - range.lengthDecimal = CPTDecimalAdd( range.lengthDecimal, CPTDecimalFromUnsignedInteger(self.plots.count) ); + range.lengthDecimal = CPTDecimalAdd(range.lengthDecimal, CPTDecimalFromUnsignedInteger(self.plots.count)); } return range; @@ -100,7 +100,7 @@ -(nonnull CPTMutablePlotRange *)plotRangeForData:(nonnull CPTNumberArray *)dataA #pragma mark - #pragma mark Plot Data Source Methods --(NSUInteger)numberOfRecordsForPlot:(nonnull CPTPlot *)plot +-(NSUInteger)numberOfRecordsForPlot:(nonnull CPTPlot *__unused)plot { return self.nRecords; } @@ -122,7 +122,7 @@ -(nullable CPTNumberArray *)numbersForPlot:(nonnull CPTPlot *)plot XCTAssertTrue([[self plots] containsObject:plot], @"Plot missing"); CPTMutableNumberArray *shiftedResult = [NSMutableArray arrayWithCapacity:result.count]; for ( NSDecimalNumber *d in result ) { - [shiftedResult addObject:[d decimalNumberByAdding:[NSDecimalNumber decimalNumberWithDecimal:CPTDecimalFromDouble( CPTDataSourceTestCasePlotOffset * ([self.plots indexOfObject:plot] + 1) )]]]; + [shiftedResult addObject:[d decimalNumberByAdding:[NSDecimalNumber decimalNumberWithDecimal:CPTDecimalFromCGFloat(CPTDataSourceTestCasePlotOffset * ([self.plots indexOfObject:plot] + 1))]]]; } result = shiftedResult; diff --git a/framework/Source/CPTDebugQuickLook.h b/framework/Source/CPTDebugQuickLook.h index 4779168e7..62afb37c9 100644 --- a/framework/Source/CPTDebugQuickLook.h +++ b/framework/Source/CPTDebugQuickLook.h @@ -20,7 +20,8 @@ /** @category NSObject(CPTDebugQuickLookExtension) * @brief Debugging extensions to NSObject. **/ -@interface NSObject(CPTDebugQuickLookExtension) { +@interface NSObject(CPTDebugQuickLookExtension) +{ } @end diff --git a/framework/Source/CPTDefinitions.h b/framework/Source/CPTDefinitions.h index 10787bdb7..ff6f39eb7 100644 --- a/framework/Source/CPTDefinitions.h +++ b/framework/Source/CPTDefinitions.h @@ -40,7 +40,37 @@ * @brief Marks a method declaration as deprecated. **/ -#define cpt_deprecated __attribute__( (deprecated) ) +#define cpt_deprecated __attribute__((deprecated)) + +// Unused parameter attribute (DEBUG only) + +/** + * @def cpt_unused + * @hideinitializer + * @brief Marks a parameter value as unused only in RELEASE builds. + **/ + +#ifdef DEBUG +#define cpt_unused +#else +#define cpt_unused __unused +#endif + +// Swift wrappers + +/** + * @def cpt_swift_enum + * @hideinitializer + * @brief Marks a type definition to be imported into Swift as an enumeration. + **/ +#define cpt_swift_enum __attribute__((swift_wrapper(enum))) + +/** + * @def cpt_swift_struct + * @hideinitializer + * @brief Marks a type definition to be imported into Swift as a structure. + **/ +#define cpt_swift_struct __attribute__((swift_wrapper(struct))) // Type safety defines @@ -50,7 +80,7 @@ * @param x The number to cast. * @brief Casts a number to @ref CGFloat. **/ -#define CPTFloat(x) ( (CGFloat)(x) ) +#define CPTFloat(x) ((CGFloat)(x)) /** * @def CPTPointMake @@ -59,7 +89,7 @@ * @param y The y-coordinate of the point. * @brief A replacement for @ref CGPointMake(), casting each parameter to @ref CGFloat. **/ -#define CPTPointMake(x, y) CGPointMake( (CGFloat)(x), (CGFloat)(y) ) +#define CPTPointMake(x, y) CGPointMake((CGFloat)(x), (CGFloat)(y)) /** * @def CPTSizeMake @@ -68,7 +98,7 @@ * @param h The height of the size. * @brief A replacement for @ref CGSizeMake(), casting each parameter to @ref CGFloat. **/ -#define CPTSizeMake(w, h) CGSizeMake( (CGFloat)(w), (CGFloat)(h) ) +#define CPTSizeMake(w, h) CGSizeMake((CGFloat)(w), (CGFloat)(h)) /** * @def CPTRectMake @@ -79,7 +109,7 @@ * @param h The height of the rectangle. * @brief A replacement for @ref CGRectMake(), casting each parameter to @ref CGFloat. **/ -#define CPTRectMake(x, y, w, h) CGRectMake( (CGFloat)(x), (CGFloat)(y), (CGFloat)(w), (CGFloat)(h) ) +#define CPTRectMake(x, y, w, h) CGRectMake((CGFloat)(x), (CGFloat)(y), (CGFloat)(w), (CGFloat)(h)) /** * @def CPTRectInset @@ -89,14 +119,14 @@ * @param dy The y-offset. * @brief A replacement for @ref CGRectInset(), casting each offset parameter to @ref CGFloat. **/ -#define CPTRectInset(rect, dx, dy) CGRectInset( rect, (CGFloat)(dx), (CGFloat)(dy) ) +#define CPTRectInset(rect, dx, dy) CGRectInset(rect, (CGFloat)(dx), (CGFloat)(dy)) /** * @def CPTNAN * @hideinitializer * @brief The not-a-number constant (@NAN), cast to @ref CGFloat. **/ -#define CPTNAN ( (CGFloat)NAN ) +#define CPTNAN ((CGFloat)NAN) /** * @brief Enumeration of numeric types @@ -152,7 +182,7 @@ CPTRGBAColor; /** * @brief Enumeration of label positioning offset directions **/ -typedef NS_ENUM (NSInteger, CPTSign) { +typedef NS_CLOSED_ENUM(NSInteger, CPTSign) { CPTSignNone = 0, ///< No offset CPTSignPositive = +1, ///< Positive offset CPTSignNegative = -1 ///< Negative offset @@ -198,6 +228,8 @@ CPTEdgeInsets; extern const CPTEdgeInsets CPTEdgeInsetsZero; ///< Defines a set of stretchable image edge insets where all of the values are zero (@num{0}). +extern const NSStringDrawingOptions CPTStringDrawingOptions; ///< String drawing options used when measuring and drawing text. + /** * @brief An array of numbers. **/ diff --git a/framework/Source/CPTDefinitions.m b/framework/Source/CPTDefinitions.m index 7b54f79ab..5af8aaada 100644 --- a/framework/Source/CPTDefinitions.m +++ b/framework/Source/CPTDefinitions.m @@ -1,3 +1,7 @@ #import "CPTDefinitions.h" const CPTEdgeInsets CPTEdgeInsetsZero = { CPTFloat(0.0), CPTFloat(0.0), CPTFloat(0.0), CPTFloat(0.0) }; + +const NSStringDrawingOptions CPTStringDrawingOptions = NSStringDrawingUsesLineFragmentOrigin | + NSStringDrawingUsesFontLeading | + NSStringDrawingTruncatesLastVisibleLine; diff --git a/framework/Source/CPTExceptions.h b/framework/Source/CPTExceptions.h index d62def47a..67eed530c 100644 --- a/framework/Source/CPTExceptions.h +++ b/framework/Source/CPTExceptions.h @@ -1,8 +1,15 @@ /// @file +#import "CPTDefinitions.h" + +/** + * @brief Custom exception type. + **/ +typedef NSString *CPTExceptionType cpt_swift_struct; + /// @name Custom Exception Identifiers /// @{ -extern NSString *__nonnull const CPTException; -extern NSString *__nonnull const CPTDataException; -extern NSString *__nonnull const CPTNumericDataException; +extern CPTExceptionType __nonnull const CPTException; +extern CPTExceptionType __nonnull const CPTDataException; +extern CPTExceptionType __nonnull const CPTNumericDataException; /// @} diff --git a/framework/Source/CPTExceptions.m b/framework/Source/CPTExceptions.m index 349839242..efe533257 100644 --- a/framework/Source/CPTExceptions.m +++ b/framework/Source/CPTExceptions.m @@ -1,5 +1,5 @@ #import "CPTExceptions.h" -NSString *const CPTException = @"CPTException"; ///< General Core Plot exceptions. -NSString *const CPTDataException = @"CPTDataException"; ///< Core Plot data exceptions. -NSString *const CPTNumericDataException = @"CPTNumericDataException"; ///< Core Plot numeric data exceptions. +CPTExceptionType const CPTException = @"CPTException"; ///< General Core Plot exceptions. +CPTExceptionType const CPTDataException = @"CPTDataException"; ///< Core Plot data exceptions. +CPTExceptionType const CPTNumericDataException = @"CPTNumericDataException"; ///< Core Plot numeric data exceptions. diff --git a/framework/Source/CPTFill.m b/framework/Source/CPTFill.m index d833e5e9e..b884fdd99 100644 --- a/framework/Source/CPTFill.m +++ b/framework/Source/CPTFill.m @@ -1,12 +1,12 @@ #import "CPTFill.h" +#import "_CPTFillColor.h" +#import "_CPTFillGradient.h" +#import "_CPTFillImage.h" #import "CPTColor.h" #import "CPTGradient.h" #import "CPTImage.h" #import "CPTPlatformSpecificFunctions.h" -#import "_CPTFillColor.h" -#import "_CPTFillGradient.h" -#import "_CPTFillImage.h" /** @brief Draws area fills. * @@ -85,7 +85,7 @@ -(nonnull instancetype)initWithImage:(nonnull CPTImage *)anImage /// @cond --(nonnull id)copyWithZone:(nullable NSZone *)zone +-(nonnull id)copyWithZone:(nullable NSZone *__unused)zone { // do nothing--implemented in subclasses return nil; @@ -98,7 +98,7 @@ -(nonnull id)copyWithZone:(nullable NSZone *)zone /// @cond --(void)encodeWithCoder:(nonnull NSCoder *)coder +-(void)encodeWithCoder:(nonnull NSCoder *__unused)coder { // do nothing--implemented in subclasses } @@ -186,7 +186,7 @@ -(nullable CGColorRef)cgColor * @param rect The rectangle to draw into. * @param context The graphics context to draw into. **/ --(void)fillRect:(CGRect)rect inContext:(nonnull CGContextRef)context +-(void)fillRect:(CGRect __unused)rect inContext:(nonnull CGContextRef __unused)context { // do nothing--subclasses override to do drawing here } @@ -194,7 +194,7 @@ -(void)fillRect:(CGRect)rect inContext:(nonnull CGContextRef)context /** @brief Draws the gradient into the given graphics context clipped to the current drawing path. * @param context The graphics context to draw into. **/ --(void)fillPathInContext:(nonnull CGContextRef)context +-(void)fillPathInContext:(nonnull CGContextRef __unused)context { // do nothing--subclasses override to do drawing here } @@ -208,7 +208,7 @@ -(nullable id)debugQuickLookObject { const CGRect rect = CGRectMake(0.0, 0.0, 100.0, 100.0); - return CPTQuickLookImage(rect, ^(CGContextRef context, CGFloat scale, CGRect bounds) { + return CPTQuickLookImage(rect, ^(CGContextRef context, CGFloat __unused scale, CGRect bounds) { [self fillRect:bounds inContext:context]; }); } diff --git a/framework/Source/CPTFillTests.m b/framework/Source/CPTFillTests.m index 3bc0d7bb3..8029b0a73 100644 --- a/framework/Source/CPTFillTests.m +++ b/framework/Source/CPTFillTests.m @@ -1,12 +1,12 @@ #import "CPTFillTests.h" +#import "_CPTFillColor.h" +#import "_CPTFillGradient.h" +#import "_CPTFillImage.h" #import "CPTColor.h" #import "CPTFill.h" #import "CPTGradient.h" #import "CPTImage.h" -#import "_CPTFillColor.h" -#import "_CPTFillGradient.h" -#import "_CPTFillImage.h" @interface _CPTFillColor() diff --git a/framework/Source/CPTFunctionDataSource.h b/framework/Source/CPTFunctionDataSource.h index b7141b312..251919c40 100644 --- a/framework/Source/CPTFunctionDataSource.h +++ b/framework/Source/CPTFunctionDataSource.h @@ -25,14 +25,18 @@ typedef double (^CPTDataSourceBlock)(double); /// @name Factory Methods /// @{ -+(nonnull instancetype)dataSourceForPlot:(nonnull CPTPlot *)plot withFunction:(nonnull CPTDataSourceFunction)function; -+(nonnull instancetype)dataSourceForPlot:(nonnull CPTPlot *)plot withBlock:(nonnull CPTDataSourceBlock)block; ++(nonnull instancetype)dataSourceForPlot:(nonnull CPTPlot *)plot withFunction:(nonnull CPTDataSourceFunction) function NS_SWIFT_NAME(init(for:withFunction:)); + ++(nonnull instancetype)dataSourceForPlot:(nonnull CPTPlot *)plot withBlock:(nonnull CPTDataSourceBlock) block NS_SWIFT_NAME(init(for:withBlock:)); + /// @} /// @name Initialization /// @{ --(nonnull instancetype)initForPlot:(nonnull CPTPlot *)plot withFunction:(nonnull CPTDataSourceFunction)function; --(nonnull instancetype)initForPlot:(nonnull CPTPlot *)plot withBlock:(nonnull CPTDataSourceBlock)block; +-(nonnull instancetype)initForPlot:(nonnull CPTPlot *)plot withFunction:(nonnull CPTDataSourceFunction) function NS_SWIFT_NAME(init(forPlot:withFunction:)); + +-(nonnull instancetype)initForPlot:(nonnull CPTPlot *)plot withBlock:(nonnull CPTDataSourceBlock) block NS_SWIFT_NAME(init(forPlot:withBlock:)); + /// @} @end diff --git a/framework/Source/CPTFunctionDataSource.m b/framework/Source/CPTFunctionDataSource.m index 1aede27c1..0e038673a 100644 --- a/framework/Source/CPTFunctionDataSource.m +++ b/framework/Source/CPTFunctionDataSource.m @@ -97,7 +97,7 @@ -(nonnull instancetype)initForPlot:(nonnull CPTPlot *)plot withFunction:(nonnull { NSParameterAssert(function); - if ( (self = [self initForPlot:plot]) ) { + if ((self = [self initForPlot:plot])) { dataSourceFunction = function; plot.dataSource = self; @@ -114,7 +114,7 @@ -(nonnull instancetype)initForPlot:(nonnull CPTPlot *)plot withBlock:(nonnull CP { NSParameterAssert(block); - if ( (self = [self initForPlot:plot]) ) { + if ((self = [self initForPlot:plot])) { dataSourceBlock = block; plot.dataSource = self; @@ -128,7 +128,7 @@ -(nonnull instancetype)initForPlot:(nonnull CPTPlot *)plot { NSParameterAssert([plot isKindOfClass:[CPTScatterPlot class]]); - if ( (self = [super init]) ) { + if ((self = [super init])) { dataPlot = plot; dataSourceFunction = NULL; dataSourceBlock = nil; @@ -176,7 +176,7 @@ -(void)dealloc -(void)setResolution:(CGFloat)newResolution { - NSParameterAssert( newResolution > CPTFloat(0.0) ); + NSParameterAssert(newResolution > CPTFloat(0.0)); if ( newResolution != resolution ) { resolution = newResolution; @@ -221,8 +221,8 @@ -(void)plotBoundsChanged if ( plotSpace ) { CGFloat width = plot.bounds.size.width; - if ( width > CPTFloat(0.0) ) { - NSUInteger count = (NSUInteger)lrint( ceil(width / self.resolution) ) + 1; + if ( width > CPTFloat(0.0)) { + NSUInteger count = (NSUInteger)lrint(ceil(width / self.resolution)) + 1; if ( count > self.cachedCount ) { self.dataCount = count; @@ -261,7 +261,7 @@ -(void)plotSpaceChanged if ( [cachedRange containsRange:plotRange] ) { // no new data needed } - else if ( ![cachedRange intersectsRange:plotRange] || (step == 0.0) ) { + else if ( ![cachedRange intersectsRange:plotRange] || (step == 0.0)) { self.cachedCount = 0; self.cachedPlotRange = plotRange; @@ -271,7 +271,7 @@ -(void)plotSpaceChanged if ( step > 0.0 ) { double minLimit = plotRange.minLimitDouble; if ( ![cachedRange containsDouble:minLimit] ) { - NSUInteger numPoints = (NSUInteger)lrint( ( ceil( (cachedRange.minLimitDouble - minLimit) / step ) ) ); + NSUInteger numPoints = (NSUInteger)lrint((ceil((cachedRange.minLimitDouble - minLimit) / step))); NSDecimal offset = CPTDecimalFromDouble(step * numPoints); cachedRange.locationDecimal = CPTDecimalSubtract(cachedRange.locationDecimal, offset); @@ -284,7 +284,7 @@ -(void)plotSpaceChanged double maxLimit = plotRange.maxLimitDouble; if ( ![cachedRange containsDouble:maxLimit] ) { - NSUInteger numPoints = (NSUInteger)lrint( ceil( (maxLimit - cachedRange.maxLimitDouble) / step ) ); + NSUInteger numPoints = (NSUInteger)lrint(ceil((maxLimit - cachedRange.maxLimitDouble) / step)); NSDecimal offset = CPTDecimalFromDouble(step * numPoints); cachedRange.lengthDecimal = CPTDecimalAdd(cachedRange.lengthDecimal, offset); @@ -297,7 +297,7 @@ -(void)plotSpaceChanged else { double maxLimit = plotRange.maxLimitDouble; if ( ![cachedRange containsDouble:maxLimit] ) { - NSUInteger numPoints = (NSUInteger)lrint( ceil( (cachedRange.maxLimitDouble - maxLimit) / step ) ); + NSUInteger numPoints = (NSUInteger)lrint(ceil((cachedRange.maxLimitDouble - maxLimit) / step)); NSDecimal offset = CPTDecimalFromDouble(step * numPoints); cachedRange.locationDecimal = CPTDecimalSubtract(cachedRange.locationDecimal, offset); @@ -310,7 +310,7 @@ -(void)plotSpaceChanged double minLimit = plotRange.minLimitDouble; if ( ![cachedRange containsDouble:minLimit] ) { - NSUInteger numPoints = (NSUInteger)lrint( ceil( (minLimit - cachedRange.minLimitDouble) / step ) ); + NSUInteger numPoints = (NSUInteger)lrint(ceil((minLimit - cachedRange.minLimitDouble) / step)); NSDecimal offset = CPTDecimalFromDouble(step * numPoints); cachedRange.lengthDecimal = CPTDecimalAdd(cachedRange.lengthDecimal, offset); @@ -332,7 +332,7 @@ -(void)plotSpaceChanged -(void)observeValueForKeyPath:(nullable NSString *)keyPath ofObject:(nullable id)object change:(NSDictionary *)change context:(nullable void *)context { - if ( (context == CPTFunctionDataSourceKVOContext) && [keyPath isEqualToString:@"plotSpace"] && [object isEqual:self.dataPlot] ) { + if ((context == CPTFunctionDataSourceKVOContext) && [keyPath isEqualToString:@"plotSpace"] && [object isEqual:self.dataPlot] ) { CPTPlotSpace *oldSpace = change[NSKeyValueChangeOldKey]; CPTPlotSpace *newSpace = change[NSKeyValueChangeNewKey]; @@ -379,54 +379,56 @@ -(nullable CPTNumericData *)dataForPlot:(nonnull CPTPlot *)plot recordIndexRange { CPTNumericData *numericData = nil; - NSUInteger count = self.dataCount; + if ( [plot isEqual:self.dataPlot] ) { + NSUInteger count = self.dataCount; - if ( count > 0 ) { - CPTPlotRange *xRange = self.cachedPlotRange; + if ( count > 0 ) { + CPTPlotRange *xRange = self.cachedPlotRange; - if ( !xRange ) { - [self plotSpaceChanged]; - xRange = self.cachedPlotRange; - } + if ( !xRange ) { + [self plotSpaceChanged]; + xRange = self.cachedPlotRange; + } - NSMutableData *data = [[NSMutableData alloc] initWithLength:indexRange.length * 2 * sizeof(double)]; + NSMutableData *data = [[NSMutableData alloc] initWithLength:indexRange.length * 2 * sizeof(double)]; - double *xBytes = data.mutableBytes; - double *yBytes = data.mutableBytes + ( indexRange.length * sizeof(double) ); + double *xBytes = data.mutableBytes; + double *yBytes = data.mutableBytes + (indexRange.length * sizeof(double)); - double location = xRange.locationDouble; - double length = xRange.lengthDouble; - double denom = (double)( count - ( (count > 1) ? 1 : 0 ) ); + double location = xRange.locationDouble; + double length = xRange.lengthDouble; + double denom = (double)(count - ((count > 1) ? 1 : 0)); - NSUInteger lastIndex = NSMaxRange(indexRange); + NSUInteger lastIndex = NSMaxRange(indexRange); - CPTDataSourceFunction function = self.dataSourceFunction; + CPTDataSourceFunction function = self.dataSourceFunction; - if ( function ) { - for ( NSUInteger i = indexRange.location; i < lastIndex; i++ ) { - double x = location + ( (double)i / denom ) * length; + if ( function ) { + for ( NSUInteger i = indexRange.location; i < lastIndex; i++ ) { + double x = location + ((double)i / denom) * length; - *xBytes++ = x; - *yBytes++ = function(x); + *xBytes++ = x; + *yBytes++ = function(x); + } } - } - else { - CPTDataSourceBlock functionBlock = self.dataSourceBlock; + else { + CPTDataSourceBlock functionBlock = self.dataSourceBlock; - if ( functionBlock ) { - for ( NSUInteger i = indexRange.location; i < lastIndex; i++ ) { - double x = location + ( (double)i / denom ) * length; + if ( functionBlock ) { + for ( NSUInteger i = indexRange.location; i < lastIndex; i++ ) { + double x = location + ((double)i / denom) * length; - *xBytes++ = x; - *yBytes++ = functionBlock(x); + *xBytes++ = x; + *yBytes++ = functionBlock(x); + } } } - } - numericData = [CPTNumericData numericDataWithData:data - dataType:CPTDataType( CPTFloatingPointDataType, sizeof(double), CFByteOrderGetCurrent() ) - shape:@[@(indexRange.length), @2] - dataOrder:CPTDataOrderColumnsFirst]; + numericData = [CPTNumericData numericDataWithData:data + dataType:CPTDataType(CPTFloatingPointDataType, sizeof(double), CFByteOrderGetCurrent()) + shape:@[@(indexRange.length), @2] + dataOrder:CPTDataOrderColumnsFirst]; + } } return numericData; diff --git a/framework/Source/CPTGradient.h b/framework/Source/CPTGradient.h index c096bf189..b07f6d920 100644 --- a/framework/Source/CPTGradient.h +++ b/framework/Source/CPTGradient.h @@ -9,8 +9,8 @@ * @brief A structure representing one node in a linked list of RGBA colors. **/ typedef struct _CPTGradientElement { - CPTRGBAColor color; ///< Color - CGFloat position; ///< Gradient position (0 ≤ @par{position} ≤ 1) + CPTRGBAColor color; ///< Color + CGFloat position; ///< Gradient position (0 ≤ @par{position} ≤ 1) struct _CPTGradientElement *__nullable nextElement; ///< Pointer to the next CPTGradientElement in the list (last element == @NULL) } diff --git a/framework/Source/CPTGradient.m b/framework/Source/CPTGradient.m index c98d2de58..3d6028025 100644 --- a/framework/Source/CPTGradient.m +++ b/framework/Source/CPTGradient.m @@ -117,7 +117,7 @@ @implementation CPTGradient **/ -(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { [self commonInit]; self.blendingMode = CPTLinearBlendingMode; @@ -207,7 +207,7 @@ -(void)encodeWithCoder:(nonnull NSCoder *)coder -(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super init]) ) { + if ((self = [super init])) { [self commonInit]; gradientType = (CPTGradientType)[coder decodeIntegerForKey:@"CPTGradient.type"]; @@ -739,7 +739,7 @@ -(CPTGradient *)removeColorStopAtPosition:(CGFloat)position CPTGradient *newGradient = [self copy]; CPTGradientElement removedElement = [newGradient removeElementAtPosition:position]; - if ( isnan(removedElement.position) ) { + if ( isnan(removedElement.position)) { [NSException raise:NSRangeException format:@"-[%@ removeColorStopAtPosition:]: no such colorStop at position (%g)", [self class], (double)position]; } @@ -755,7 +755,7 @@ -(CPTGradient *)removeColorStopAtIndex:(NSUInteger)idx CPTGradient *newGradient = [self copy]; CPTGradientElement removedElement = [newGradient removeElementAtIndex:idx]; - if ( isnan(removedElement.position) ) { + if ( isnan(removedElement.position)) { [NSException raise:NSRangeException format:@"-[%@ removeColorStopAtIndex:]: index (%lu) beyond bounds", [self class], (unsigned long)idx]; } @@ -777,7 +777,6 @@ -(CGColorRef)newColorStopAtIndex:(NSUInteger)idx #if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE CGFloat colorComponents[4] = { element->color.red, element->color.green, element->color.blue, element->color.alpha }; return CGColorCreate(self.colorspace.cgColorSpace, colorComponents); - #else return CGColorCreateGenericRGB(element->color.red, element->color.green, element->color.blue, element->color.alpha); #endif @@ -799,15 +798,15 @@ -(CGColorRef)newColorAtPosition:(CGFloat)position switch ( self.blendingMode ) { case CPTLinearBlendingMode: - CPTLinearEvaluation( (__bridge void *)(self), &position, components ); + CPTLinearEvaluation((__bridge void *)(self), &position, components); break; case CPTChromaticBlendingMode: - CPTChromaticEvaluation( (__bridge void *)(self), &position, components ); + CPTChromaticEvaluation((__bridge void *)(self), &position, components); break; case CPTInverseChromaticBlendingMode: - CPTInverseChromaticEvaluation( (__bridge void *)(self), &position, components ); + CPTInverseChromaticEvaluation((__bridge void *)(self), &position, components); break; } @@ -866,7 +865,7 @@ -(void)fillRect:(CGRect)rect inContext:(nonnull CGContextRef)context **/ -(void)fillPathInContext:(nonnull CGContextRef)context { - if ( !CGContextIsPathEmpty(context) ) { + if ( !CGContextIsPathEmpty(context)) { CGShadingRef myCGShading = NULL; CGContextSaveGState(context); @@ -902,8 +901,8 @@ -(BOOL)isOpaque CPTGradientElement *list = self.elementList; - while ( opaqueGradient && (list != NULL) ) { - opaqueGradient = opaqueGradient && ( list->color.alpha >= CPTFloat(1.0) ); + while ( opaqueGradient && (list != NULL)) { + opaqueGradient = opaqueGradient && (list->color.alpha >= CPTFloat(1.0)); list = list->nextElement; } @@ -1003,7 +1002,7 @@ -(NSUInteger)hash return (NSUInteger)theHash; } else { - return self.blendingMode + self.gradientType; + return (NSUInteger)(self.blendingMode + self.gradientType); } } @@ -1034,13 +1033,13 @@ -(nonnull CGShadingRef)newAxialGradientInRect:(CGRect)rect // First Calculate where the beginning and ending points should be CGPoint startPoint, endPoint; - if ( self.angle == CPTFloat(0.0) ) { - startPoint = CPTPointMake( CGRectGetMinX(rect), CGRectGetMinY(rect) ); // right of rect - endPoint = CPTPointMake( CGRectGetMaxX(rect), CGRectGetMinY(rect) ); // left of rect + if ( self.angle == CPTFloat(0.0)) { + startPoint = CPTPointMake(CGRectGetMinX(rect), CGRectGetMinY(rect)); // right of rect + endPoint = CPTPointMake(CGRectGetMaxX(rect), CGRectGetMinY(rect)); // left of rect } - else if ( self.angle == CPTFloat(90.0) ) { - startPoint = CPTPointMake( CGRectGetMinX(rect), CGRectGetMinY(rect) ); // bottom of rect - endPoint = CPTPointMake( CGRectGetMinX(rect), CGRectGetMaxY(rect) ); // top of rect + else if ( self.angle == CPTFloat(90.0)) { + startPoint = CPTPointMake(CGRectGetMinX(rect), CGRectGetMinY(rect)); // bottom of rect + endPoint = CPTPointMake(CGRectGetMinX(rect), CGRectGetMaxY(rect)); // top of rect } else { // ok, we'll do the calculations now CGFloat x, y; @@ -1051,7 +1050,7 @@ -(nonnull CGShadingRef)newAxialGradientInRect:(CGRect)rect CGFloat rAngle = self.angle * CPTFloat(M_PI / 180.0); // convert the angle to radians - if ( fabs( tan(rAngle) ) <= CPTFloat(1.0) ) { // for range [-45,45], [135,225] + if ( fabs(tan(rAngle)) <= CPTFloat(1.0)) { // for range [-45,45], [135,225] x = CGRectGetWidth(rect); y = CGRectGetHeight(rect); @@ -1059,7 +1058,7 @@ -(nonnull CGShadingRef)newAxialGradientInRect:(CGRect)rect cosA = cos(rAngle); tanA = tan(rAngle); - length = x / fabs(cosA) + ( y - x * fabs(tanA) ) * fabs(sinA); + length = x / fabs(cosA) + (y - x * fabs(tanA)) * fabs(sinA); deltaX = length * cosA / CPTFloat(2.0); deltaY = length * sinA / CPTFloat(2.0); @@ -1074,7 +1073,7 @@ -(nonnull CGShadingRef)newAxialGradientInRect:(CGRect)rect cosA = cos(rAngle); tanA = tan(rAngle); - length = x / fabs(cosA) + ( y - x * fabs(tanA) ) * fabs(sinA); + length = x / fabs(cosA) + (y - x * fabs(tanA)) * fabs(sinA); deltaX = -length * sinA / CPTFloat(2.0); deltaY = length * cosA / CPTFloat(2.0); @@ -1097,15 +1096,15 @@ -(nonnull CGShadingRef)newRadialGradientInRect:(CGRect)rect context:(nonnull CGC CGPoint theStartAnchor = self.startAnchor; - startPoint = CPTPointMake( fma( CGRectGetWidth(rect), theStartAnchor.x, CGRectGetMinX(rect) ), - fma( CGRectGetHeight(rect), theStartAnchor.y, CGRectGetMinY(rect) ) ); + startPoint = CPTPointMake(fma(CGRectGetWidth(rect), theStartAnchor.x, CGRectGetMinX(rect)), + fma(CGRectGetHeight(rect), theStartAnchor.y, CGRectGetMinY(rect))); CGPoint theEndAnchor = self.endAnchor; - endPoint = CPTPointMake( fma( CGRectGetWidth(rect), theEndAnchor.x, CGRectGetMinX(rect) ), - fma( CGRectGetHeight(rect), theEndAnchor.y, CGRectGetMinY(rect) ) ); + endPoint = CPTPointMake(fma(CGRectGetWidth(rect), theEndAnchor.x, CGRectGetMinX(rect)), + fma(CGRectGetHeight(rect), theEndAnchor.y, CGRectGetMinY(rect))); startRadius = CPTFloat(-1.0); - if ( CGRectGetHeight(rect) > CGRectGetWidth(rect) ) { + if ( CGRectGetHeight(rect) > CGRectGetWidth(rect)) { scaleX = CGRectGetWidth(rect) / CGRectGetHeight(rect); startPoint.x /= scaleX; endPoint.x /= scaleX; @@ -1152,10 +1151,10 @@ -(void)setBlendingMode:(CPTGradientBlendingMode)mode static const CGFloat input_value_range[2] = { 0, 1 }; // range for the evaluator input static const CGFloat output_value_ranges[8] = { 0, 1, 0, 1, 0, 1, 0, 1 }; // ranges for the evaluator output (4 returned values) - CGFunctionRef cgFunction = CGFunctionCreate( (__bridge void *)(self), // the two transition colors - 1, input_value_range, // number of inputs (just fraction of progression) - 4, output_value_ranges, // number of outputs (4 - RGBa) - &evaluationCallbackInfo ); // info for using the evaluator function + CGFunctionRef cgFunction = CGFunctionCreate((__bridge void *)(self), // the two transition colors + 1, input_value_range, // number of inputs (just fraction of progression) + 4, output_value_ranges, // number of outputs (4 - RGBa) + &evaluationCallbackInfo); // info for using the evaluator function if ( cgFunction ) { self.gradientFunction = cgFunction; @@ -1166,9 +1165,9 @@ -(void)addElement:(nonnull CPTGradientElement *)newElement { CPTGradientElement *curElement = self.elementList; - if ( (curElement == NULL) || (newElement->position < curElement->position) ) { + if ((curElement == NULL) || (newElement->position < curElement->position)) { CPTGradientElement *tmpNext = curElement; - CPTGradientElement *newElementList = malloc( sizeof(CPTGradientElement) ); + CPTGradientElement *newElementList = calloc(1, sizeof(CPTGradientElement)); if ( newElementList ) { *newElementList = *newElement; newElementList->nextElement = tmpNext; @@ -1177,13 +1176,13 @@ -(void)addElement:(nonnull CPTGradientElement *)newElement } else { while ( curElement->nextElement != NULL && - !( (curElement->position <= newElement->position) && - (newElement->position < curElement->nextElement->position) ) ) { + !((curElement->position <= newElement->position) && + (newElement->position < curElement->nextElement->position))) { curElement = curElement->nextElement; } CPTGradientElement *tmpNext = curElement->nextElement; - curElement->nextElement = malloc( sizeof(CPTGradientElement) ); + curElement->nextElement = calloc(1, sizeof(CPTGradientElement)); *(curElement->nextElement) = *newElement; curElement->nextElement->nextElement = tmpNext; } @@ -1574,11 +1573,11 @@ void CPTTransformRGB_HSV(CGFloat *__nonnull components) // H,S,B -> R,G,B void CPTTransformHSV_RGB(CGFloat *__nonnull components) // H,S,B -> R,G,B { CGFloat R = CPTFloat(0.0), G = CPTFloat(0.0), B = CPTFloat(0.0); - CGFloat H = fmod( components[0], CPTFloat(360.0) ); // map to [0,360) + CGFloat H = fmod(components[0], CPTFloat(360.0)); // map to [0,360) CGFloat S = components[1]; CGFloat V = components[2]; - int Hi = (int)lrint( floor( H / CPTFloat(60.0) ) ) % 6; + int Hi = (int)lrint(floor(H / CPTFloat(60.0))) % 6; CGFloat f = H / CPTFloat(60.0) - Hi; CGFloat p = V * (CPTFloat(1.0) - S); CGFloat q = V * (CPTFloat(1.0) - f * S); @@ -1632,13 +1631,13 @@ void CPTTransformHSV_RGB(CGFloat *__nonnull components) // H,S,B -> R,G,B void CPTResolveHSV(CGFloat *__nonnull color1, CGFloat *__nonnull color2) // H value may be undefined (i.e. grayscale color) { // we want to fill it with a sensible value - if ( isnan(color1[0]) && isnan(color2[0]) ) { + if ( isnan(color1[0]) && isnan(color2[0])) { color1[0] = color2[0] = 0; } - else if ( isnan(color1[0]) ) { + else if ( isnan(color1[0])) { color1[0] = color2[0]; } - else if ( isnan(color2[0]) ) { + else if ( isnan(color2[0])) { color2[0] = color1[0]; } } @@ -1654,7 +1653,7 @@ -(nullable id)debugQuickLookObject { const CGRect rect = CGRectMake(0.0, 0.0, 100.0, 100.0); - return CPTQuickLookImage(rect, ^(CGContextRef context, CGFloat scale, CGRect bounds) { + return CPTQuickLookImage(rect, ^(CGContextRef context, CGFloat __unused scale, CGRect bounds) { switch ( self.gradientType ) { case CPTGradientTypeAxial: CGContextAddRect(context, bounds); diff --git a/framework/Source/CPTGraph.h b/framework/Source/CPTGraph.h index f6ac1f1c4..7c4c397ac 100644 --- a/framework/Source/CPTGraph.h +++ b/framework/Source/CPTGraph.h @@ -14,35 +14,45 @@ @class CPTTextStyle; @class CPTLayerAnnotation; +/** + * @brief Graph notification type. + **/ +typedef NSString *CPTGraphNotification cpt_swift_struct; + +/** + * @brief The userInfo dictionary keys used by CPTGraph plot space notifications. + **/ +typedef NSString *CPTGraphPlotSpaceKey cpt_swift_struct; + /// @name Graph /// @{ /** @brief Notification sent by various objects to tell the graph it should redraw itself. * @ingroup notification **/ -extern NSString *__nonnull const CPTGraphNeedsRedrawNotification; +extern CPTGraphNotification __nonnull const CPTGraphNeedsRedrawNotification NS_SWIFT_NAME(needsRedraw); /** @brief Notification sent by a graph after adding a new plot space. * @ingroup notification * * The notification userInfo dictionary will include the new plot space under the - * CPTGraphPlotSpaceNotificationKey key. + * #CPTGraphPlotSpaceNotificationKey key. **/ -extern NSString *__nonnull const CPTGraphDidAddPlotSpaceNotification; +extern CPTGraphNotification __nonnull const CPTGraphDidAddPlotSpaceNotification NS_SWIFT_NAME(didAddPlotSpace); /** @brief Notification sent by a graph after removing a plot space. * @ingroup notification * * The notification userInfo dictionary will include the removed plot space under the - * CPTGraphPlotSpaceNotificationKey key. + * #CPTGraphPlotSpaceNotificationKey key. **/ -extern NSString *__nonnull const CPTGraphDidRemovePlotSpaceNotification; +extern CPTGraphNotification __nonnull const CPTGraphDidRemovePlotSpaceNotification NS_SWIFT_NAME(didRemovePlotSpace); -/** @brief The userInfo dictionary key used by the CPTGraphDidAddPlotSpaceNotification - * and CPTGraphDidRemovePlotSpaceNotification notifications for the plot space. +/** @brief The userInfo dictionary key used by the #CPTGraphDidAddPlotSpaceNotification + * and #CPTGraphDidRemovePlotSpaceNotification notifications for the plot space. * @ingroup notification **/ -extern NSString *__nonnull const CPTGraphPlotSpaceNotificationKey; +extern CPTGraphPlotSpaceKey __nonnull const CPTGraphPlotSpaceNotificationKey; /// @} diff --git a/framework/Source/CPTGraph.m b/framework/Source/CPTGraph.m index ba591f216..9255efe02 100644 --- a/framework/Source/CPTGraph.m +++ b/framework/Source/CPTGraph.m @@ -17,15 +17,15 @@ /** @defgroup graphAnimation Graphs * @brief Graph properties that can be animated using Core Animation. * @if MacOnly - * @since Custom layer property animation is supported on MacOS 10.6 and later. + * @since Custom layer property animation is supported on macOS 10.6 and later. * @endif * @ingroup animation **/ -NSString *const CPTGraphNeedsRedrawNotification = @"CPTGraphNeedsRedrawNotification"; -NSString *const CPTGraphDidAddPlotSpaceNotification = @"CPTGraphDidAddPlotSpaceNotification"; -NSString *const CPTGraphDidRemovePlotSpaceNotification = @"CPTGraphDidRemovePlotSpaceNotification"; -NSString *const CPTGraphPlotSpaceNotificationKey = @"CPTGraphPlotSpaceNotificationKey"; +CPTGraphNotification const CPTGraphNeedsRedrawNotification = @"CPTGraphNeedsRedrawNotification"; +CPTGraphNotification const CPTGraphDidAddPlotSpaceNotification = @"CPTGraphDidAddPlotSpaceNotification"; +CPTGraphNotification const CPTGraphDidRemovePlotSpaceNotification = @"CPTGraphDidRemovePlotSpaceNotification"; +CPTGraphPlotSpaceKey const CPTGraphPlotSpaceNotificationKey = @"CPTGraphPlotSpaceNotificationKey"; /// @cond @interface CPTGraph() @@ -200,7 +200,7 @@ @implementation CPTGraph **/ -(nonnull instancetype)initWithFrame:(CGRect)newFrame { - if ( (self = [super initWithFrame:newFrame]) ) { + if ((self = [super initWithFrame:newFrame])) { hostingView = nil; plots = [[NSMutableArray alloc] init]; @@ -250,7 +250,7 @@ -(nonnull instancetype)initWithFrame:(CGRect)newFrame -(nonnull instancetype)initWithLayer:(nonnull id)layer { - if ( (self = [super initWithLayer:layer]) ) { + if ((self = [super initWithLayer:layer])) { CPTGraph *theLayer = (CPTGraph *)layer; hostingView = theLayer->hostingView; @@ -309,7 +309,7 @@ -(void)encodeWithCoder:(nonnull NSCoder *)coder -(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super initWithCoder:coder]) ) { + if ((self = [super initWithCoder:coder])) { hostingView = [coder decodeObjectOfClass:[CPTGraphHostingView class] forKey:@"CPTGraph.hostingView"]; plotAreaFrame = [coder decodeObjectOfClass:[CPTPlotAreaFrame class] @@ -324,13 +324,14 @@ -(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder plots = [[NSMutableArray alloc] init]; } + plotSpaces = [[NSMutableArray alloc] init]; + CPTPlotSpaceArray *plotSpaceArray = [coder decodeObjectOfClasses:[NSSet setWithArray:@[[NSArray class], [CPTPlotSpace class]]] forKey:@"CPTGraph.plotSpaces"]; if ( plotSpaceArray ) { - plotSpaces = [plotSpaceArray mutableCopy]; - } - else { - plotSpaces = [[NSMutableArray alloc] init]; + for ( CPTPlotSpace *space in plotSpaceArray ) { + [self addPlotSpace:space]; + } } title = [[coder decodeObjectOfClass:[NSString class] @@ -378,7 +379,43 @@ -(void)layoutAndRenderInContext:(nonnull CGContextRef)context { [self reloadDataIfNeeded]; [self.axisSet.axes makeObjectsPerformSelector:@selector(relabel)]; - [super layoutAndRenderInContext:context]; + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wundeclared-selector" +#if TARGET_OS_OSX + // Workaround since @available macro is not there + if ( [NSView instancesRespondToSelector:@selector(effectiveAppearance)] ) { + NSAppearance *oldAppearance = NSAppearance.currentAppearance; + NSView *view = (NSView *)self.hostingView; + NSAppearance.currentAppearance = view.effectiveAppearance; + [super layoutAndRenderInContext:context]; + NSAppearance.currentAppearance = oldAppearance; + } + else { + [super layoutAndRenderInContext:context]; + } +#else + if ( @available(iOS 13, *)) { + if ( [UITraitCollection instancesRespondToSelector:@selector(performAsCurrentTraitCollection:)] ) { + UITraitCollection *traitCollection = ((UIView *)self.hostingView).traitCollection; + if ( traitCollection ) { + [traitCollection performAsCurrentTraitCollection: ^{ + [super layoutAndRenderInContext:context]; + }]; + } + else { + [super layoutAndRenderInContext:context]; + } + } + else { + [super layoutAndRenderInContext:context]; + } + } + else { + [super layoutAndRenderInContext:context]; + } +#endif +#pragma clang diagnostic pop } /// @endcond @@ -781,7 +818,7 @@ -(void)setLegendAnchor:(CPTRectAnchor)newLegendAnchor -(void)setLegendDisplacement:(CGPoint)newLegendDisplacement { - if ( !CGPointEqualToPoint(newLegendDisplacement, legendDisplacement) ) { + if ( !CGPointEqualToPoint(newLegendDisplacement, legendDisplacement)) { legendDisplacement = newLegendDisplacement; self.legendAnnotation.displacement = newLegendDisplacement; } @@ -895,7 +932,7 @@ -(void)setTitle:(nullable NSString *)newTitle if ( title ) { if ( theTitleAnnotation ) { - ( (CPTTextLayer *)theTitleAnnotation.contentLayer ).text = title; + ((CPTTextLayer *)theTitleAnnotation.contentLayer).text = title; } else { CPTPlotAreaFrame *frameLayer = self.plotAreaFrame; @@ -937,7 +974,7 @@ -(void)setAttributedTitle:(nullable NSAttributedString *)newTitle self.title = [attributedTitle.string copy]; if ( theTitleAnnotation ) { - ( (CPTTextLayer *)theTitleAnnotation.contentLayer ).attributedText = attributedTitle; + ((CPTTextLayer *)theTitleAnnotation.contentLayer).attributedText = attributedTitle; } else { CPTPlotAreaFrame *frameLayer = self.plotAreaFrame; @@ -988,7 +1025,7 @@ -(void)setTitleTextStyle:(nullable CPTTextStyle *)newStyle -(void)setTitleDisplacement:(CGPoint)newDisplace { - if ( !CGPointEqualToPoint(newDisplace, titleDisplacement) ) { + if ( !CGPointEqualToPoint(newDisplace, titleDisplacement)) { titleDisplacement = newDisplace; self.titleAnnotation.displacement = newDisplace; @@ -1128,7 +1165,7 @@ -(BOOL)pointingDeviceUpEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)in // Plot spaces do not block events, because several spaces may need to receive // the same event sequence (e.g., dragging coordinate translation) for ( CPTPlotSpace *space in self.plotSpaces ) { - if ( !handledEvent || (handledEvent && space.isDragging) ) { + if ( !handledEvent || (handledEvent && space.isDragging)) { BOOL handled = [space pointingDeviceUpEvent:event atPoint:interactionPoint]; handledEvent |= handled; } @@ -1322,6 +1359,7 @@ -(BOOL)scrollWheelEvent:(nonnull CPTNativeEvent *)event fromPoint:(CGPoint)fromP return [super scrollWheelEvent:event fromPoint:fromPoint toPoint:toPoint]; } } + #endif /// @} diff --git a/framework/Source/CPTGridLineGroup.m b/framework/Source/CPTGridLineGroup.m index 431264fab..d68f67fc4 100644 --- a/framework/Source/CPTGridLineGroup.m +++ b/framework/Source/CPTGridLineGroup.m @@ -40,7 +40,7 @@ @implementation CPTGridLineGroup **/ -(nonnull instancetype)initWithFrame:(CGRect)newFrame { - if ( (self = [super initWithFrame:newFrame]) ) { + if ((self = [super initWithFrame:newFrame])) { plotArea = nil; major = NO; @@ -55,7 +55,7 @@ -(nonnull instancetype)initWithFrame:(CGRect)newFrame -(nonnull instancetype)initWithLayer:(nonnull id)layer { - if ( (self = [super initWithLayer:layer]) ) { + if ((self = [super initWithLayer:layer])) { CPTGridLineGroup *theLayer = (CPTGridLineGroup *)layer; plotArea = theLayer->plotArea; @@ -81,7 +81,7 @@ -(void)encodeWithCoder:(nonnull NSCoder *)coder -(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super initWithCoder:coder]) ) { + if ((self = [super initWithCoder:coder])) { plotArea = [coder decodeObjectOfClass:[CPTPlotArea class] forKey:@"CPTGridLineGroup.plotArea"]; major = [coder decodeBoolForKey:@"CPTGridLineGroup.major"]; diff --git a/framework/Source/CPTGridLines.m b/framework/Source/CPTGridLines.m index c9f39dbdc..6c0992e6b 100644 --- a/framework/Source/CPTGridLines.m +++ b/framework/Source/CPTGridLines.m @@ -35,7 +35,7 @@ @implementation CPTGridLines **/ -(nonnull instancetype)initWithFrame:(CGRect)newFrame { - if ( (self = [super initWithFrame:newFrame]) ) { + if ((self = [super initWithFrame:newFrame])) { axis = nil; major = NO; @@ -50,7 +50,7 @@ -(nonnull instancetype)initWithFrame:(CGRect)newFrame -(nonnull instancetype)initWithLayer:(nonnull id)layer { - if ( (self = [super initWithLayer:layer]) ) { + if ((self = [super initWithLayer:layer])) { CPTGridLines *theLayer = (CPTGridLines *)layer; axis = theLayer->axis; @@ -76,7 +76,7 @@ -(void)encodeWithCoder:(nonnull NSCoder *)coder -(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super initWithCoder:coder]) ) { + if ((self = [super initWithCoder:coder])) { axis = [coder decodeObjectOfClass:[CPTAxis class] forKey:@"CPTGridLines.axis"]; major = [coder decodeBoolForKey:@"CPTGridLines.major"]; diff --git a/framework/Source/CPTImage.m b/framework/Source/CPTImage.m index b94389961..baebbc284 100644 --- a/framework/Source/CPTImage.m +++ b/framework/Source/CPTImage.m @@ -19,7 +19,7 @@ typedef NS_ENUM (NSInteger, CPTSlice) { }; typedef struct _CPTImageSlices { - CGImageRef slice[9]; ///< The image slices used to render a stretchable image. + __nonnull CGImageRef slice[9]; ///< The image slices used to render a stretchable image. } CPTImageSlices; @@ -134,9 +134,9 @@ -(nonnull instancetype)initWithContentsOfFile:(nonnull NSString *)path **/ -(nonnull instancetype)initWithCGImage:(nullable CGImageRef)anImage scale:(CGFloat)newScale { - NSParameterAssert( newScale > CPTFloat(0.0) ); + NSParameterAssert(newScale > CPTFloat(0.0)); - if ( (self = [super init]) ) { + if ((self = [super init])) { CGImageRetain(anImage); nativeImage = nil; image = anImage; @@ -215,7 +215,7 @@ -(void)encodeWithCoder:(nonnull NSCoder *)coder */ -(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super init]) ) { + if ((self = [super init])) { nativeImage = [[coder decodeObjectOfClass:[CPTNativeImage class] forKey:@"CPTImage.nativeImage"] copy]; image = [coder newCGImageDecodeForKey:@"CPTImage.image"]; @@ -371,35 +371,35 @@ -(BOOL)isEqual:(nullable id)object CGColorSpaceRef otherColorSpace = CGImageGetColorSpace(otherCGImage); if ( equalImages ) { - equalImages = ( CGImageGetWidth(selfCGImage) == CGImageGetWidth(otherCGImage) ); + equalImages = (CGImageGetWidth(selfCGImage) == CGImageGetWidth(otherCGImage)); } if ( equalImages ) { - equalImages = ( CGImageGetHeight(selfCGImage) == CGImageGetHeight(otherCGImage) ); + equalImages = (CGImageGetHeight(selfCGImage) == CGImageGetHeight(otherCGImage)); } if ( equalImages ) { - equalImages = ( CGImageGetBitsPerComponent(selfCGImage) == CGImageGetBitsPerComponent(otherCGImage) ); + equalImages = (CGImageGetBitsPerComponent(selfCGImage) == CGImageGetBitsPerComponent(otherCGImage)); } if ( equalImages ) { - equalImages = ( CGImageGetBitsPerPixel(selfCGImage) == CGImageGetBitsPerPixel(otherCGImage) ); + equalImages = (CGImageGetBitsPerPixel(selfCGImage) == CGImageGetBitsPerPixel(otherCGImage)); } if ( equalImages ) { - equalImages = ( CGImageGetBytesPerRow(selfCGImage) == CGImageGetBytesPerRow(otherCGImage) ); + equalImages = (CGImageGetBytesPerRow(selfCGImage) == CGImageGetBytesPerRow(otherCGImage)); } if ( equalImages ) { - equalImages = ( CGImageGetBitmapInfo(selfCGImage) == CGImageGetBitmapInfo(otherCGImage) ); + equalImages = (CGImageGetBitmapInfo(selfCGImage) == CGImageGetBitmapInfo(otherCGImage)); } if ( equalImages ) { - equalImages = ( CGImageGetShouldInterpolate(selfCGImage) == CGImageGetShouldInterpolate(otherCGImage) ); + equalImages = (CGImageGetShouldInterpolate(selfCGImage) == CGImageGetShouldInterpolate(otherCGImage)); } if ( equalImages ) { - equalImages = ( CGImageGetRenderingIntent(selfCGImage) == CGImageGetRenderingIntent(otherCGImage) ); + equalImages = (CGImageGetRenderingIntent(selfCGImage) == CGImageGetRenderingIntent(otherCGImage)); } // decode array @@ -423,15 +423,15 @@ -(BOOL)isEqual:(nullable id)object equalImages = NO; } } - else if ( (selfDecodeArray && !otherDecodeArray) || (!selfDecodeArray && otherDecodeArray) ) { + else if ((selfDecodeArray && !otherDecodeArray) || (!selfDecodeArray && otherDecodeArray)) { equalImages = NO; } } // color space if ( equalImages ) { - equalImages = ( CGColorSpaceGetModel(selfColorSpace) == CGColorSpaceGetModel(otherColorSpace) ) && - ( CGColorSpaceGetNumberOfComponents(selfColorSpace) == CGColorSpaceGetNumberOfComponents(otherColorSpace) ); + equalImages = (CGColorSpaceGetModel(selfColorSpace) == CGColorSpaceGetModel(otherColorSpace)) && + (CGColorSpaceGetNumberOfComponents(selfColorSpace) == CGColorSpaceGetNumberOfComponents(otherColorSpace)); } // data provider @@ -472,13 +472,13 @@ -(NSUInteger)hash // Equal objects must hash the same. CGImageRef selfCGImage = self.image; - return ( CGImageGetWidth(selfCGImage) * CGImageGetHeight(selfCGImage) ) + + return (CGImageGetWidth(selfCGImage) * CGImageGetHeight(selfCGImage)) + CGImageGetBitsPerComponent(selfCGImage) + CGImageGetBitsPerPixel(selfCGImage) + CGImageGetBytesPerRow(selfCGImage) + CGImageGetBitmapInfo(selfCGImage) + CGImageGetShouldInterpolate(selfCGImage) + - CGImageGetRenderingIntent(selfCGImage) * (NSUInteger)self.scale; + (NSUInteger)(CGImageGetRenderingIntent(selfCGImage) * self.scale); } /// @endcond @@ -526,7 +526,7 @@ -(nullable CPTNativeImage *)nativeImage #if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE CGFloat theScale = self.scale; - if ( imageRef && ( theScale > CPTFloat(0.0) ) ) { + if ( imageRef && (theScale > CPTFloat(0.0))) { nativeImage = [UIImage imageWithCGImage:imageRef scale:theScale orientation:UIImageOrientationUp]; @@ -536,7 +536,7 @@ -(nullable CPTNativeImage *)nativeImage nativeImage = [[NSImage alloc] initWithCGImage:imageRef size:NSZeroSize]; } else { - CGSize imageSize = CGSizeMake( CGImageGetWidth(imageRef), CGImageGetHeight(imageRef) ); + CGSize imageSize = CGSizeMake(CGImageGetWidth(imageRef), CGImageGetHeight(imageRef)); NSBitmapImageRep *imageRep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL pixelsWide:(NSInteger)imageSize.width @@ -565,7 +565,7 @@ -(nullable CPTNativeImage *)nativeImage -(void)setScale:(CGFloat)newScale { - NSParameterAssert( newScale > CPTFloat(0.0) ); + NSParameterAssert(newScale > CPTFloat(0.0)); if ( newScale != scale ) { scale = newScale; @@ -574,7 +574,7 @@ -(void)setScale:(CGFloat)newScale -(void)setEdgeInsets:(CPTEdgeInsets)newEdgeInsets { - if ( !CPTEdgeInsetsEqualToEdgeInsets(edgeInsets, newEdgeInsets) ) { + if ( !CPTEdgeInsetsEqualToEdgeInsets(edgeInsets, newEdgeInsets)) { edgeInsets = newEdgeInsets; CPTImageSlices imageSlices = {}; @@ -592,7 +592,10 @@ -(void)setSlices:(CPTImageSlices)newSlices for ( NSUInteger i = 0; i < 9; i++ ) { CGImageRelease(slices.slice[i]); - slices.slice[i] = CGImageRetain(newSlices.slice[i]); + CGImageRef slice = CGImageRetain(newSlices.slice[i]); + if ( slice ) { + slices.slice[i] = slice; + } } } @@ -628,47 +631,56 @@ -(void)makeImageSlices } // top row - if ( capTop > CPTFloat(0.0) ) { - if ( capLeft > CPTFloat(0.0) ) { - imageSlices.slice[CPTSliceTopLeft] = CGImageCreateWithImageInRect( theImage, CPTRectMake(0.0, 0.0, capLeft, capTop) ); + if ( capTop > CPTFloat(0.0)) { + if ( capLeft > CPTFloat(0.0)) { + CGImageRef sliceImage = CGImageCreateWithImageInRect(theImage, CPTRectMake(0.0, 0.0, capLeft, capTop)); + imageSlices.slice[CPTSliceTopLeft] = sliceImage; } - if ( centerSize.width > CPTFloat(0.0) ) { - imageSlices.slice[CPTSliceTop] = CGImageCreateWithImageInRect( theImage, CPTRectMake(capLeft, 0.0, centerSize.width, capTop) ); + if ( centerSize.width > CPTFloat(0.0)) { + CGImageRef sliceImage = CGImageCreateWithImageInRect(theImage, CPTRectMake(capLeft, 0.0, centerSize.width, capTop)); + imageSlices.slice[CPTSliceTop] = sliceImage; } - if ( capRight > CPTFloat(0.0) ) { - imageSlices.slice[CPTSliceTopRight] = CGImageCreateWithImageInRect( theImage, CPTRectMake(width - capRight, 0.0, capRight, capTop) ); + if ( capRight > CPTFloat(0.0)) { + CGImageRef sliceImage = CGImageCreateWithImageInRect(theImage, CPTRectMake(width - capRight, 0.0, capRight, capTop)); + imageSlices.slice[CPTSliceTopRight] = sliceImage; } } // middle row - if ( centerSize.height > CPTFloat(0.0) ) { - if ( capLeft > CPTFloat(0.0) ) { - imageSlices.slice[CPTSliceLeft] = CGImageCreateWithImageInRect( theImage, CPTRectMake(0.0, capTop, capLeft, centerSize.height) ); + if ( centerSize.height > CPTFloat(0.0)) { + if ( capLeft > CPTFloat(0.0)) { + CGImageRef sliceImage = CGImageCreateWithImageInRect(theImage, CPTRectMake(0.0, capTop, capLeft, centerSize.height)); + imageSlices.slice[CPTSliceLeft] = sliceImage; } - if ( centerSize.width > CPTFloat(0.0) ) { - imageSlices.slice[CPTSliceMiddle] = CGImageCreateWithImageInRect( theImage, CPTRectMake(capLeft, capTop, centerSize.width, centerSize.height) ); + if ( centerSize.width > CPTFloat(0.0)) { + CGImageRef sliceImage = CGImageCreateWithImageInRect(theImage, CPTRectMake(capLeft, capTop, centerSize.width, centerSize.height)); + imageSlices.slice[CPTSliceMiddle] = sliceImage; } - if ( capRight > CPTFloat(0.0) ) { - imageSlices.slice[CPTSliceRight] = CGImageCreateWithImageInRect( theImage, CPTRectMake(width - capRight, capTop, capRight, centerSize.height) ); + if ( capRight > CPTFloat(0.0)) { + CGImageRef sliceImage = CGImageCreateWithImageInRect(theImage, CPTRectMake(width - capRight, capTop, capRight, centerSize.height)); + imageSlices.slice[CPTSliceRight] = sliceImage; } } // bottom row - if ( capBottom > CPTFloat(0.0) ) { - if ( capLeft > CPTFloat(0.0) ) { - imageSlices.slice[CPTSliceBottomLeft] = CGImageCreateWithImageInRect( theImage, CPTRectMake(0.0, height - capBottom, capLeft, capBottom) ); + if ( capBottom > CPTFloat(0.0)) { + if ( capLeft > CPTFloat(0.0)) { + CGImageRef sliceImage = CGImageCreateWithImageInRect(theImage, CPTRectMake(0.0, height - capBottom, capLeft, capBottom)); + imageSlices.slice[CPTSliceBottomLeft] = sliceImage; } - if ( centerSize.width > CPTFloat(0.0) ) { - imageSlices.slice[CPTSliceBottom] = CGImageCreateWithImageInRect( theImage, CPTRectMake(capLeft, height - capBottom, centerSize.width, capBottom) ); + if ( centerSize.width > CPTFloat(0.0)) { + CGImageRef sliceImage = CGImageCreateWithImageInRect(theImage, CPTRectMake(capLeft, height - capBottom, centerSize.width, capBottom)); + imageSlices.slice[CPTSliceBottom] = sliceImage; } - if ( capRight > CPTFloat(0.0) ) { - imageSlices.slice[CPTSliceBottomRight] = CGImageCreateWithImageInRect( theImage, CPTRectMake(width - capRight, height - capBottom, capRight, capBottom) ); + if ( capRight > CPTFloat(0.0)) { + CGImageRef sliceImage = CGImageCreateWithImageInRect(theImage, CPTRectMake(width - capRight, height - capBottom, capRight, capBottom)); + imageSlices.slice[CPTSliceBottomRight] = sliceImage; } } @@ -680,7 +692,7 @@ -(void)makeImageSlices -(void)drawImage:(nonnull CGImageRef)theImage inContext:(nonnull CGContextRef)context rect:(CGRect)rect scaleRatio:(CGFloat)scaleRatio { - if ( theImage && ( rect.size.width > CPTFloat(0.0) ) && ( rect.size.height > CPTFloat(0.0) ) ) { + if ( theImage && (rect.size.width > CPTFloat(0.0)) && (rect.size.height > CPTFloat(0.0))) { CGFloat imageScale = self.scale; CGContextSaveGState(context); @@ -723,13 +735,13 @@ -(void)drawInRect:(CGRect)rect inContext:(nonnull CGContextRef)context CGFloat lastScale = self.lastDrawnScale; CGFloat contextScale = CPTFloat(1.0); - if ( rect.size.height != CPTFloat(0.0) ) { + if ( rect.size.height != CPTFloat(0.0)) { CGRect deviceRect = CGContextConvertRectToDeviceSpace(context, rect); contextScale = deviceRect.size.height / rect.size.height; } // generate a Core Graphics image if needed - if ( !theImage || (contextScale != lastScale) ) { + if ( !theImage || (contextScale != lastScale)) { CPTNativeImage *theNativeImage = self.nativeImage; if ( theNativeImage ) { @@ -737,12 +749,9 @@ -(void)drawInRect:(CGRect)rect inContext:(nonnull CGContextRef)context theImage = theNativeImage.CGImage; self.scale = theNativeImage.scale; #else - NSSize imageSize = theNativeImage.size; - CGFloat sizeScale = CPTFloat(theNativeImage.representations.count + 1) - contextScale; - imageSize.width /= sizeScale; - imageSize.height /= sizeScale; - + NSSize imageSize = theNativeImage.size; NSRect drawingRect = NSMakeRect(0.0, 0.0, imageSize.width, imageSize.height); + theImage = [theNativeImage CGImageForProposedRect:&drawingRect context:[NSGraphicsContext graphicsContextWithGraphicsPort:context flipped:NO] hints:nil]; @@ -752,13 +761,17 @@ -(void)drawInRect:(CGRect)rect inContext:(nonnull CGContextRef)context } } + if ( !theImage ) { + return; + } + // draw the image CGFloat imageScale = self.scale; CGFloat scaleRatio = contextScale / imageScale; CPTEdgeInsets insets = self.edgeInsets; - if ( CPTEdgeInsetsEqualToEdgeInsets(insets, CPTEdgeInsetsZero) ) { + if ( CPTEdgeInsetsEqualToEdgeInsets(insets, CPTEdgeInsetsZero)) { [self drawImage:theImage inContext:context rect:rect scaleRatio:scaleRatio]; } else { @@ -773,7 +786,7 @@ -(void)drawInRect:(CGRect)rect inContext:(nonnull CGContextRef)context } // create new slices if needed - if ( !hasSlices || (contextScale != lastScale) ) { + if ( !hasSlices || (contextScale != lastScale)) { [self makeImageSlices]; imageSlices = self.slices; } diff --git a/framework/Source/CPTLayer.h b/framework/Source/CPTLayer.h index ec2381a44..4cca2d8b4 100644 --- a/framework/Source/CPTLayer.h +++ b/framework/Source/CPTLayer.h @@ -5,18 +5,44 @@ /// @file @class CPTGraph; +@class CPTLayer; @class CPTShadow; +/** + * @brief Layer notification type. + **/ +typedef NSString *CPTLayerNotification cpt_swift_struct; + /// @name Layout /// @{ /** @brief Notification sent by all layers when the layer @link CALayer::bounds bounds @endlink change. * @ingroup notification **/ -extern NSString *__nonnull const CPTLayerBoundsDidChangeNotification; +extern CPTLayerNotification __nonnull const CPTLayerBoundsDidChangeNotification NS_SWIFT_NAME(boundsDidChange); /// @} +/** + * @brief An array of CPTLayer objects. + **/ +typedef NSArray CPTLayerArray; + +/** + * @brief A mutable array of CPTLayer objects. + **/ +typedef NSMutableArray CPTMutableLayerArray; + +/** + * @brief A set of CPTLayer objects. + **/ +typedef NSSet CPTLayerSet; + +/** + * @brief A mutable set of CPTLayer objects. + **/ +typedef NSMutableSet CPTMutableLayerSet; + /** * @brief An array of CALayer objects. **/ @@ -37,6 +63,23 @@ typedef NSSet CPTSublayerSet; **/ typedef NSMutableSet CPTMutableSublayerSet; +#pragma mark - + +/** + * @brief Layer delegate. + **/ +#if ((TARGET_OS_SIMULATOR || TARGET_OS_IPHONE || TARGET_OS_TV) && (__IPHONE_OS_VERSION_MAX_ALLOWED >= 100000)) \ + || (TARGET_OS_MAC && (MAC_OS_X_VERSION_MAX_ALLOWED >= 101200)) +// CALayerDelegate is defined by Core Animation in iOS 10.0+, macOS 10.12+, and tvOS 10.0+ +@protocol CPTLayerDelegate +#else +@protocol CPTLayerDelegate +#endif + +@end + +#pragma mark - + @interface CPTLayer : CALayer /// @name Graph @@ -88,6 +131,7 @@ typedef NSMutableSet CPTMutableSublayerSet; /// @name Drawing /// @{ +-(void)setNeedsDisplayAllLayers; -(void)renderAsVectorInContext:(nonnull CGContextRef)context; -(void)recursivelyRenderInContext:(nonnull CGContextRef)context; -(void)layoutAndRenderInContext:(nonnull CGContextRef)context; diff --git a/framework/Source/CPTLayer.m b/framework/Source/CPTLayer.m index be45a9adc..eef476e9a 100644 --- a/framework/Source/CPTLayer.m +++ b/framework/Source/CPTLayer.m @@ -6,17 +6,16 @@ #import "CPTPlatformSpecificFunctions.h" #import "CPTShadow.h" #import "CPTUtilities.h" -#import "CorePlotProbes.h" #import "NSCoderExtensions.h" #import #import -NSString *const CPTLayerBoundsDidChangeNotification = @"CPTLayerBoundsDidChangeNotification"; +CPTLayerNotification const CPTLayerBoundsDidChangeNotification = @"CPTLayerBoundsDidChangeNotification"; /** @defgroup animation Animatable Properties * @brief Custom layer properties that can be animated using Core Animation. * @if MacOnly - * @since Custom layer property animation is supported on MacOS 10.6 and later. + * @since Custom layer property animation is supported on macOS 10.6 and later. * @endif **/ @@ -167,7 +166,7 @@ @implementation CPTLayer **/ -(nonnull instancetype)initWithFrame:(CGRect)newFrame { - if ( (self = [super init]) ) { + if ((self = [super init])) { paddingLeft = CPTFloat(0.0); paddingTop = CPTFloat(0.0); paddingRight = CPTFloat(0.0); @@ -208,7 +207,7 @@ -(nonnull instancetype)init */ -(nonnull instancetype)initWithLayer:(nonnull id)layer { - if ( (self = [super initWithLayer:layer]) ) { + if ((self = [super initWithLayer:layer])) { CPTLayer *theLayer = (CPTLayer *)layer; paddingLeft = theLayer->paddingLeft; @@ -269,7 +268,7 @@ -(void)encodeWithCoder:(nonnull NSCoder *)coder */ -(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super initWithCoder:coder]) ) { + if ((self = [super initWithCoder:coder])) { paddingLeft = [coder decodeCGFloatForKey:@"CPTLayer.paddingLeft"]; paddingTop = [coder decodeCGFloatForKey:@"CPTLayer.paddingTop"]; paddingRight = [coder decodeCGFloatForKey:@"CPTLayer.paddingRight"]; @@ -306,7 +305,7 @@ +(BOOL)supportsSecureCoding /// @cond --(id)actionForKey:(nonnull NSString *)aKey +-(id)actionForKey:(nonnull NSString *__unused)aKey { return nil; } @@ -324,7 +323,42 @@ -(void)display return; } else { - [super display]; +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wundeclared-selector" +#if TARGET_OS_OSX + // Workaround since @available macro is not there + + if ( [NSView instancesRespondToSelector:@selector(effectiveAppearance)] ) { + NSAppearance *oldAppearance = NSAppearance.currentAppearance; + NSAppearance.currentAppearance = ((NSView *)self.graph.hostingView).effectiveAppearance; + [super display]; + NSAppearance.currentAppearance = oldAppearance; + } + else { + [super display]; + } +#else + if ( @available(iOS 13, *)) { + if ( [UITraitCollection instancesRespondToSelector:@selector(performAsCurrentTraitCollection:)] ) { + UITraitCollection *traitCollection = ((UIView *)self.graph.hostingView).traitCollection; + if ( traitCollection ) { + [traitCollection performAsCurrentTraitCollection: ^{ + [super display]; + }]; + } + else { + [super display]; + } + } + else { + [super display]; + } + } + else { + [super display]; + } +#endif +#pragma clang diagnostic pop } } @@ -342,6 +376,23 @@ -(void)drawInContext:(nonnull CGContextRef)context /// @endcond +/** + * @brief Recursively marks this layer and all sublayers as needing to be redrawn. + **/ +-(void)setNeedsDisplayAllLayers +{ + [self setNeedsDisplay]; + + for ( CPTLayer *subLayer in self.sublayers ) { + if ( [subLayer respondsToSelector:@selector(setNeedsDisplayAllLayers)] ) { + [subLayer setNeedsDisplayAllLayers]; + } + else { + [subLayer setNeedsDisplay]; + } + } +} + /** @brief Draws layer content into the provided graphics context. * * This method replaces the CALayer @link CALayer::drawInContext: -drawInContext: @endlink method @@ -413,15 +464,15 @@ -(void)recursivelyRenderInContext:(nonnull CGContextRef)context -(void)applyTransform:(CATransform3D)transform3D toContext:(nonnull CGContextRef)context { - if ( !CATransform3DIsIdentity(transform3D) ) { - if ( CATransform3DIsAffine(transform3D) ) { + if ( !CATransform3DIsIdentity(transform3D)) { + if ( CATransform3DIsAffine(transform3D)) { CGRect selfBounds = self.bounds; CGPoint anchorPoint = self.anchorPoint; CGPoint anchorOffset = CPTPointMake(anchorOffset.x = selfBounds.origin.x + anchorPoint.x * selfBounds.size.width, anchorOffset.y = selfBounds.origin.y + anchorPoint.y * selfBounds.size.height); CGAffineTransform affineTransform = CGAffineTransformMakeTranslation(-anchorOffset.x, -anchorOffset.y); - affineTransform = CGAffineTransformConcat( affineTransform, CATransform3DGetAffineTransform(transform3D) ); + affineTransform = CGAffineTransformConcat(affineTransform, CATransform3DGetAffineTransform(transform3D)); affineTransform = CGAffineTransformTranslate(affineTransform, anchorOffset.x, anchorOffset.y); CGRect transformedBounds = CGRectApplyAffineTransform(selfBounds, affineTransform); @@ -449,7 +500,7 @@ -(void)layoutAndRenderInContext:(nonnull CGContextRef)context -(nonnull NSData *)dataForPDFRepresentationOfLayer { NSMutableData *pdfData = [[NSMutableData alloc] init]; - CGDataConsumerRef dataConsumer = CGDataConsumerCreateWithCFData( (__bridge CFMutableDataRef)pdfData ); + CGDataConsumerRef dataConsumer = CGDataConsumerCreateWithCFData((__bridge CFMutableDataRef)pdfData); const CGRect mediaBox = CPTRectMake(0.0, 0.0, self.bounds.size.width, self.bounds.size.height); CGContextRef pdfContext = CGPDFContextCreate(dataConsumer, &mediaBox, NULL); @@ -475,32 +526,33 @@ -(nonnull NSData *)dataForPDFRepresentationOfLayer /// @name User Interaction /// @{ --(BOOL)pointingDeviceDownEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint +-(BOOL)pointingDeviceDownEvent:(nonnull CPTNativeEvent *__unused)event atPoint:(CGPoint __unused)interactionPoint { return NO; } --(BOOL)pointingDeviceUpEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint +-(BOOL)pointingDeviceUpEvent:(nonnull CPTNativeEvent *__unused)event atPoint:(CGPoint __unused)interactionPoint { return NO; } --(BOOL)pointingDeviceDraggedEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint +-(BOOL)pointingDeviceDraggedEvent:(nonnull CPTNativeEvent *__unused)event atPoint:(CGPoint __unused)interactionPoint { return NO; } --(BOOL)pointingDeviceCancelledEvent:(nonnull CPTNativeEvent *)event +-(BOOL)pointingDeviceCancelledEvent:(nonnull CPTNativeEvent *__unused)event { return NO; } #if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE #else --(BOOL)scrollWheelEvent:(nonnull CPTNativeEvent *)event fromPoint:(CGPoint)fromPoint toPoint:(CGPoint)toPoint +-(BOOL)scrollWheelEvent:(nonnull CPTNativeEvent *__unused)event fromPoint:(CGPoint __unused)fromPoint toPoint:(CGPoint __unused)toPoint { return NO; } + #endif /// @} @@ -521,38 +573,38 @@ -(void)pixelAlign CGPoint newPosition; - if ( CGSizeEqualToSize(boundsSize, frameSize) ) { // rotated 0° or 180° + if ( CGSizeEqualToSize(boundsSize, frameSize)) { // rotated 0° or 180° CGPoint anchor = self.anchorPoint; CGPoint newAnchor = CGPointMake(boundsSize.width * anchor.x, boundsSize.height * anchor.y); - if ( scale == CPTFloat(1.0) ) { - newPosition.x = ceil( currentPosition.x - newAnchor.x - CPTFloat(0.5) ) + newAnchor.x; - newPosition.y = ceil( currentPosition.y - newAnchor.y - CPTFloat(0.5) ) + newAnchor.y; + if ( scale == CPTFloat(1.0)) { + newPosition.x = ceil(currentPosition.x - newAnchor.x - CPTFloat(0.5)) + newAnchor.x; + newPosition.y = ceil(currentPosition.y - newAnchor.y - CPTFloat(0.5)) + newAnchor.y; } else { - newPosition.x = ceil( (currentPosition.x - newAnchor.x) * scale - CPTFloat(0.5) ) / scale + newAnchor.x; - newPosition.y = ceil( (currentPosition.y - newAnchor.y) * scale - CPTFloat(0.5) ) / scale + newAnchor.y; + newPosition.x = ceil((currentPosition.x - newAnchor.x) * scale - CPTFloat(0.5)) / scale + newAnchor.x; + newPosition.y = ceil((currentPosition.y - newAnchor.y) * scale - CPTFloat(0.5)) / scale + newAnchor.y; } } - else if ( (boundsSize.width == frameSize.height) && (boundsSize.height == frameSize.width) ) { // rotated 90° or 270° + else if ((boundsSize.width == frameSize.height) && (boundsSize.height == frameSize.width)) { // rotated 90° or 270° CGPoint anchor = self.anchorPoint; CGPoint newAnchor = CGPointMake(boundsSize.height * anchor.y, boundsSize.width * anchor.x); - if ( scale == CPTFloat(1.0) ) { - newPosition.x = ceil( currentPosition.x - newAnchor.x - CPTFloat(0.5) ) + newAnchor.x; - newPosition.y = ceil( currentPosition.y - newAnchor.y - CPTFloat(0.5) ) + newAnchor.y; + if ( scale == CPTFloat(1.0)) { + newPosition.x = ceil(currentPosition.x - newAnchor.x - CPTFloat(0.5)) + newAnchor.x; + newPosition.y = ceil(currentPosition.y - newAnchor.y - CPTFloat(0.5)) + newAnchor.y; } else { - newPosition.x = ceil( (currentPosition.x - newAnchor.x) * scale - CPTFloat(0.5) ) / scale + newAnchor.x; - newPosition.y = ceil( (currentPosition.y - newAnchor.y) * scale - CPTFloat(0.5) ) / scale + newAnchor.y; + newPosition.x = ceil((currentPosition.x - newAnchor.x) * scale - CPTFloat(0.5)) / scale + newAnchor.x; + newPosition.y = ceil((currentPosition.y - newAnchor.y) * scale - CPTFloat(0.5)) / scale + newAnchor.y; } } else { - if ( scale == CPTFloat(1.0) ) { + if ( scale == CPTFloat(1.0)) { newPosition.x = round(currentPosition.x); newPosition.y = round(currentPosition.y); } @@ -609,7 +661,7 @@ -(CGSize)shadowMargin CGSize shadowOffset = myShadow.shadowOffset; CGFloat shadowRadius = myShadow.shadowBlurRadius; - margin = CGSizeMake( ceil( ABS(shadowOffset.width) + ABS(shadowRadius) ), ceil( ABS(shadowOffset.height) + ABS(shadowRadius) ) ); + margin = CGSizeMake(ceil(ABS(shadowOffset.width) + ABS(shadowRadius)), ceil(ABS(shadowOffset.height) + ABS(shadowRadius))); } return margin; @@ -639,14 +691,14 @@ -(void)layoutSublayers CGSize subLayerSize = selfBounds.size; subLayerSize.width -= leftPadding + rightPadding; - subLayerSize.width = MAX( subLayerSize.width, CPTFloat(0.0) ); + subLayerSize.width = MAX(subLayerSize.width, CPTFloat(0.0)); subLayerSize.width = round(subLayerSize.width); subLayerSize.height -= topPadding + bottomPadding; - subLayerSize.height = MAX( subLayerSize.height, CPTFloat(0.0) ); + subLayerSize.height = MAX(subLayerSize.height, CPTFloat(0.0)); subLayerSize.height = round(subLayerSize.height); CGRect subLayerFrame; - subLayerFrame.origin = CGPointMake( round(leftPadding), round(bottomPadding) ); + subLayerFrame.origin = CGPointMake(round(leftPadding), round(bottomPadding)); subLayerFrame.size = subLayerSize; CPTSublayerSet *excludedSublayers = self.sublayersExcludedFromAutomaticLayout; @@ -697,7 +749,7 @@ -(void)setSublayers:(nullable CPTSublayerArray *)sublayers CGFloat scale = self.contentsScale; for ( CALayer *layer in sublayers ) { if ( [layer isKindOfClass:layerClass] ) { - ( (CPTLayer *)layer ).contentsScale = scale; + ((CPTLayer *)layer).contentsScale = scale; } } } @@ -707,7 +759,7 @@ -(void)addSublayer:(nonnull CALayer *)layer [super addSublayer:layer]; if ( [layer isKindOfClass:[CPTLayer class]] ) { - ( (CPTLayer *)layer ).contentsScale = self.contentsScale; + ((CPTLayer *)layer).contentsScale = self.contentsScale; } } @@ -716,7 +768,7 @@ -(void)insertSublayer:(nonnull CALayer *)layer atIndex:(unsigned)idx [super insertSublayer:layer atIndex:idx]; if ( [layer isKindOfClass:[CPTLayer class]] ) { - ( (CPTLayer *)layer ).contentsScale = self.contentsScale; + ((CPTLayer *)layer).contentsScale = self.contentsScale; } } @@ -725,7 +777,7 @@ -(void)insertSublayer:(nonnull CALayer *)layer below:(nullable CALayer *)sibling [super insertSublayer:layer below:sibling]; if ( [layer isKindOfClass:[CPTLayer class]] ) { - ( (CPTLayer *)layer ).contentsScale = self.contentsScale; + ((CPTLayer *)layer).contentsScale = self.contentsScale; } } @@ -734,7 +786,7 @@ -(void)insertSublayer:(nonnull CALayer *)layer above:(nullable CALayer *)sibling [super insertSublayer:layer above:sibling]; if ( [layer isKindOfClass:[CPTLayer class]] ) { - ( (CPTLayer *)layer ).contentsScale = self.contentsScale; + ((CPTLayer *)layer).contentsScale = self.contentsScale; } } @@ -743,7 +795,7 @@ -(void)replaceSublayer:(nonnull CALayer *)layer with:(nonnull CALayer *)layer2 [super replaceSublayer:layer with:layer2]; if ( [layer2 isKindOfClass:[CPTLayer class]] ) { - ( (CPTLayer *)layer2 ).contentsScale = self.contentsScale; + ((CPTLayer *)layer2).contentsScale = self.contentsScale; } } @@ -802,7 +854,7 @@ -(void)applySublayerMaskToContext:(nonnull CGContextRef)context forSublayer:(non } CGAffineTransform sublayerTransform = CATransform3DGetAffineTransform(sublayer.transform); - CGContextConcatCTM( context, CGAffineTransformInvert(sublayerTransform) ); + CGContextConcatCTM(context, CGAffineTransformInvert(sublayerTransform)); CALayer *superlayer = self.superlayer; if ( [superlayer isKindOfClass:[CPTLayer class]] ) { @@ -876,16 +928,6 @@ -(void)setNeedsDisplay -(void)setPosition:(CGPoint)newPosition { super.position = newPosition; - if ( COREPLOT_LAYER_POSITION_CHANGE_ENABLED() ) { - CGRect currentFrame = self.frame; - if ( !CGRectEqualToRect( currentFrame, CGRectIntegral(self.frame) ) ) { - COREPLOT_LAYER_POSITION_CHANGE( (const char *)class_getName([self class]), - (int)lrint( ceil( currentFrame.origin.x * CPTFloat(1000.0) ) ), - (int)lrint( ceil( currentFrame.origin.y * CPTFloat(1000.0) ) ), - (int)lrint( ceil( currentFrame.size.width * CPTFloat(1000.0) ) ), - (int)lrint( ceil( currentFrame.size.height * CPTFloat(1000.0) ) ) ); - } - } } -(void)setHidden:(BOOL)newHidden @@ -900,7 +942,7 @@ -(void)setHidden:(BOOL)newHidden -(void)setContentsScale:(CGFloat)newContentsScale { - NSParameterAssert( newContentsScale > CPTFloat(0.0) ); + NSParameterAssert(newContentsScale > CPTFloat(0.0)); if ( self.contentsScale != newContentsScale ) { if ( [CALayer instancesRespondToSelector:@selector(setContentsScale:)] ) { @@ -972,7 +1014,7 @@ -(CGRect)bounds -(void)setBounds:(CGRect)newBounds { - if ( !CGRectEqualToRect(self.bounds, newBounds) ) { + if ( !CGRectEqualToRect(self.bounds, newBounds)) { if ( self.shadow ) { CGSize sizeOffset = self.shadowMargin; @@ -999,14 +1041,14 @@ -(CGPoint)anchorPoint if ( self.shadow ) { CGSize sizeOffset = self.shadowMargin; CGRect selfBounds = self.bounds; - CGSize adjustedSize = CGSizeMake( selfBounds.size.width + sizeOffset.width * CPTFloat(2.0), - selfBounds.size.height + sizeOffset.height * CPTFloat(2.0) ); + CGSize adjustedSize = CGSizeMake(selfBounds.size.width + sizeOffset.width * CPTFloat(2.0), + selfBounds.size.height + sizeOffset.height * CPTFloat(2.0)); - if ( selfBounds.size.width > CPTFloat(0.0) ) { - adjustedAnchor.x = ( adjustedAnchor.x - CPTFloat(0.5) ) * (adjustedSize.width / selfBounds.size.width) + CPTFloat(0.5); + if ( selfBounds.size.width > CPTFloat(0.0)) { + adjustedAnchor.x = (adjustedAnchor.x - CPTFloat(0.5)) * (adjustedSize.width / selfBounds.size.width) + CPTFloat(0.5); } - if ( selfBounds.size.height > CPTFloat(0.0) ) { - adjustedAnchor.y = ( adjustedAnchor.y - CPTFloat(0.5) ) * (adjustedSize.height / selfBounds.size.height) + CPTFloat(0.5); + if ( selfBounds.size.height > CPTFloat(0.0)) { + adjustedAnchor.y = (adjustedAnchor.y - CPTFloat(0.5)) * (adjustedSize.height / selfBounds.size.height) + CPTFloat(0.5); } } @@ -1018,14 +1060,14 @@ -(void)setAnchorPoint:(CGPoint)newAnchorPoint if ( self.shadow ) { CGSize sizeOffset = self.shadowMargin; CGRect selfBounds = self.bounds; - CGSize adjustedSize = CGSizeMake( selfBounds.size.width + sizeOffset.width * CPTFloat(2.0), - selfBounds.size.height + sizeOffset.height * CPTFloat(2.0) ); + CGSize adjustedSize = CGSizeMake(selfBounds.size.width + sizeOffset.width * CPTFloat(2.0), + selfBounds.size.height + sizeOffset.height * CPTFloat(2.0)); - if ( adjustedSize.width > CPTFloat(0.0) ) { - newAnchorPoint.x = ( newAnchorPoint.x - CPTFloat(0.5) ) * (selfBounds.size.width / adjustedSize.width) + CPTFloat(0.5); + if ( adjustedSize.width > CPTFloat(0.0)) { + newAnchorPoint.x = (newAnchorPoint.x - CPTFloat(0.5)) * (selfBounds.size.width / adjustedSize.width) + CPTFloat(0.5); } - if ( adjustedSize.height > CPTFloat(0.0) ) { - newAnchorPoint.y = ( newAnchorPoint.y - CPTFloat(0.5) ) * (selfBounds.size.height / adjustedSize.height) + CPTFloat(0.5); + if ( adjustedSize.height > CPTFloat(0.0)) { + newAnchorPoint.y = (newAnchorPoint.y - CPTFloat(0.5)) * (selfBounds.size.height / adjustedSize.height) + CPTFloat(0.5); } } diff --git a/framework/Source/CPTLayerAnnotation.h b/framework/Source/CPTLayerAnnotation.h index d16785280..23e1afeea 100644 --- a/framework/Source/CPTLayerAnnotation.h +++ b/framework/Source/CPTLayerAnnotation.h @@ -7,6 +7,8 @@ @property (nonatomic, readonly, cpt_weak_property, nullable) CPTLayer *anchorLayer; @property (nonatomic, readwrite, assign) CPTRectAnchor rectAnchor; +@property (nonatomic, readwrite, strong, nullable) CPTConstraints *xConstraints; +@property (nonatomic, readwrite, strong, nullable) CPTConstraints *yConstraints; /// @name Initialization /// @{ diff --git a/framework/Source/CPTLayerAnnotation.m b/framework/Source/CPTLayerAnnotation.m index 7759d90a3..69c68d6da 100644 --- a/framework/Source/CPTLayerAnnotation.m +++ b/framework/Source/CPTLayerAnnotation.m @@ -7,9 +7,6 @@ /// @cond @interface CPTLayerAnnotation() -@property (nonatomic, readwrite, strong, nullable) CPTConstraints *xConstraints; -@property (nonatomic, readwrite, strong, nullable) CPTConstraints *yConstraints; - -(void)setConstraints; @end @@ -36,7 +33,14 @@ @implementation CPTLayerAnnotation **/ @synthesize rectAnchor; +/** @property CPTConstraints *xConstraints + * @brief The constraints used to position the content layer relative to the reference layer in the x-direction. Setting the @ref rectAnchor resets the constraints. + **/ @synthesize xConstraints; + +/** @property CPTConstraints *yConstraints + * @brief The constraints used to position the content layer relative to the reference layer in the y-direction. Setting the @ref rectAnchor resets the constraints. + **/ @synthesize yConstraints; #pragma mark - @@ -57,7 +61,7 @@ -(nonnull instancetype)initWithAnchorLayer:(nonnull CPTLayer *)newAnchorLayer { NSParameterAssert(newAnchorLayer); - if ( (self = [super init]) ) { + if ((self = [super init])) { anchorLayer = newAnchorLayer; rectAnchor = CPTRectAnchorTop; xConstraints = nil; @@ -114,14 +118,23 @@ -(void)encodeWithCoder:(nonnull NSCoder *)coder */ -(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super initWithCoder:coder]) ) { - anchorLayer = [coder decodeObjectOfClass:[CPTLayer class] - forKey:@"CPTLayerAnnotation.anchorLayer"]; + if ((self = [super initWithCoder:coder])) { + CPTLayer *anchor = [coder decodeObjectOfClass:[CPTLayer class] + forKey:@"CPTLayerAnnotation.anchorLayer"]; xConstraints = [coder decodeObjectOfClass:[CPTConstraints class] forKey:@"CPTLayerAnnotation.xConstraints"]; yConstraints = [coder decodeObjectOfClass:[CPTConstraints class] forKey:@"CPTLayerAnnotation.yConstraints"]; rectAnchor = (CPTRectAnchor)[coder decodeIntegerForKey:@"CPTLayerAnnotation.rectAnchor"]; + + if ( anchor ) { + anchorLayer = anchor; + + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(positionContentLayer) + name:CPTLayerBoundsDidChangeNotification + object:anchor]; + } } return self; } @@ -155,7 +168,7 @@ -(void)positionContentLayer content.anchorPoint = self.contentAnchorPoint; content.position = newPosition; - content.transform = CATransform3DMakeRotation( self.rotation, CPTFloat(0.0), CPTFloat(0.0), CPTFloat(1.0) ); + content.transform = CATransform3DMakeRotation(self.rotation, CPTFloat(0.0), CPTFloat(0.0), CPTFloat(1.0)); [content pixelAlign]; } } @@ -249,6 +262,21 @@ -(void)setRectAnchor:(CPTRectAnchor)newAnchor if ( newAnchor != rectAnchor ) { rectAnchor = newAnchor; [self setConstraints]; + } +} + +-(void)setXConstraints:(CPTConstraints *)newConstraints +{ + if ( newConstraints != xConstraints ) { + xConstraints = newConstraints; + [self positionContentLayer]; + } +} + +-(void)setYConstraints:(CPTConstraints *)newConstraints +{ + if ( newConstraints != yConstraints ) { + yConstraints = newConstraints; [self positionContentLayer]; } } diff --git a/framework/Source/CPTLayerTests.m b/framework/Source/CPTLayerTests.m index ad279c43c..d94be1dc5 100644 --- a/framework/Source/CPTLayerTests.m +++ b/framework/Source/CPTLayerTests.m @@ -4,7 +4,7 @@ #import "CPTUtilities.h" #import "NSNumberExtensions.h" -static const double precision = 1.0e-6; +static const CGFloat precision = CPTFloat(1.0e-6); @interface CPTLayerTests() @@ -142,20 +142,20 @@ -(void)testPositionsWithScale:(CGFloat)scale anchorPoint:(CGPoint)anchor expecte self.layer.anchorPoint = anchor; for ( NSUInteger i = 0; i < positionCount; i++ ) { - CGFloat position = ( (NSNumber *)( (self.positions)[i] ) ).cgFloatValue; + CGFloat position = ((NSNumber *)((self.positions)[i])).cgFloatValue; CGPoint layerPosition = CGPointMake(position, position); self.layer.position = layerPosition; [self.layer pixelAlign]; CGPoint alignedPoint = self.layer.position; - CGFloat expected = ( (NSNumber *)(expectedValues[i]) ).cgFloatValue; + CGFloat expected = ((NSNumber *)(expectedValues[i])).cgFloatValue; NSString *errMessage; - errMessage = [NSString stringWithFormat:@"pixelAlign at x = %g with scale %g and anchor %@", position, scale, CPTStringFromPoint(anchor)]; + errMessage = [NSString stringWithFormat:@"pixelAlign at x = %g with scale %g and anchor %@", (double)position, (double)scale, CPTStringFromPoint(anchor)]; XCTAssertEqualWithAccuracy(alignedPoint.x, expected, precision, @"%@", errMessage); - errMessage = [NSString stringWithFormat:@"pixelAlign at y = %g with scale %g and anchor %@", position, scale, CPTStringFromPoint(anchor)]; + errMessage = [NSString stringWithFormat:@"pixelAlign at y = %g with scale %g and anchor %@", (double)position, (double)scale, CPTStringFromPoint(anchor)]; XCTAssertEqualWithAccuracy(alignedPoint.y, expected, precision, @"%@", errMessage); } } diff --git a/framework/Source/CPTLegend.h b/framework/Source/CPTLegend.h index a15240eac..d865a3e21 100644 --- a/framework/Source/CPTLegend.h +++ b/framework/Source/CPTLegend.h @@ -8,23 +8,28 @@ @class CPTLineStyle; @class CPTTextStyle; +/** + * @brief Graph notification type. + **/ +typedef NSString *CPTLegendNotification cpt_swift_struct; + /// @name Legend /// @{ /** @brief Notification sent by plots to tell the legend it should redraw itself. * @ingroup notification **/ -extern NSString *__nonnull const CPTLegendNeedsRedrawForPlotNotification; +extern CPTLegendNotification __nonnull const CPTLegendNeedsRedrawForPlotNotification NS_SWIFT_NAME(needsRedrawForPlot); /** @brief Notification sent by plots to tell the legend it should update its layout and redraw itself. * @ingroup notification **/ -extern NSString *__nonnull const CPTLegendNeedsLayoutForPlotNotification; +extern CPTLegendNotification __nonnull const CPTLegendNeedsLayoutForPlotNotification NS_SWIFT_NAME(needsLayoutForPlot); /** @brief Notification sent by plots to tell the legend it should reload all legend entries. * @ingroup notification **/ -extern NSString *__nonnull const CPTLegendNeedsReloadEntriesForPlotNotification; +extern CPTLegendNotification __nonnull const CPTLegendNeedsReloadEntriesForPlotNotification NS_SWIFT_NAME(needsReloadEntriesForPlot); /// @} @@ -32,8 +37,10 @@ extern NSString *__nonnull const CPTLegendNeedsReloadEntriesForPlotNotification; * @brief Enumeration of legend layout options. **/ typedef NS_ENUM (NSInteger, CPTLegendSwatchLayout) { - CPTLegendSwatchLayoutLeft, ///< Lay out the swatch to the left side of the title. - CPTLegendSwatchLayoutRight ///< Lay out the swatch to the right side of the title. + CPTLegendSwatchLayoutLeft, ///< Lay out the swatch to the left side of the title. + CPTLegendSwatchLayoutRight, ///< Lay out the swatch to the right side of the title. + CPTLegendSwatchLayoutTop, ///< Lay out the swatch above the title. + CPTLegendSwatchLayoutBottom ///< Lay out the swatch below the title. }; #pragma mark - @@ -41,7 +48,7 @@ typedef NS_ENUM (NSInteger, CPTLegendSwatchLayout) { /** * @brief Legend delegate. **/ -@protocol CPTLegendDelegate +@protocol CPTLegendDelegate @optional diff --git a/framework/Source/CPTLegend.m b/framework/Source/CPTLegend.m index a55c030c7..c5fcb69c4 100644 --- a/framework/Source/CPTLegend.m +++ b/framework/Source/CPTLegend.m @@ -15,14 +15,14 @@ /** @defgroup legendAnimation Legends * @brief Legend properties that can be animated using Core Animation. * @if MacOnly - * @since Custom layer property animation is supported on MacOS 10.6 and later. + * @since Custom layer property animation is supported on macOS 10.6 and later. * @endif * @ingroup animation **/ -NSString *const CPTLegendNeedsRedrawForPlotNotification = @"CPTLegendNeedsRedrawForPlotNotification"; -NSString *const CPTLegendNeedsLayoutForPlotNotification = @"CPTLegendNeedsLayoutForPlotNotification"; -NSString *const CPTLegendNeedsReloadEntriesForPlotNotification = @"CPTLegendNeedsReloadEntriesForPlotNotification"; +CPTLegendNotification const CPTLegendNeedsRedrawForPlotNotification = @"CPTLegendNeedsRedrawForPlotNotification"; +CPTLegendNotification const CPTLegendNeedsLayoutForPlotNotification = @"CPTLegendNeedsLayoutForPlotNotification"; +CPTLegendNotification const CPTLegendNeedsReloadEntriesForPlotNotification = @"CPTLegendNeedsReloadEntriesForPlotNotification"; /// @cond @interface CPTLegend() @@ -208,7 +208,7 @@ @implementation CPTLegend @synthesize titleOffset; /** @property CPTLegendSwatchLayout swatchLayout - * @brief Draw the legend swatch to the left or right side of the title. Default is #CPTLegendSwatchLayoutLeft. + * @brief Where to draw the legend swatch relative to the title. Default is #CPTLegendSwatchLayoutLeft. **/ @synthesize swatchLayout; @@ -301,7 +301,7 @@ +(nonnull instancetype)legendWithGraph:(nullable __kindof CPTGraph *)graph **/ -(nonnull instancetype)initWithFrame:(CGRect)newFrame { - if ( (self = [super initWithFrame:newFrame]) ) { + if ((self = [super initWithFrame:newFrame])) { plots = [[NSMutableArray alloc] init]; legendEntries = [[NSMutableArray alloc] init]; layoutChanged = YES; @@ -350,7 +350,7 @@ -(nonnull instancetype)initWithFrame:(CGRect)newFrame **/ -(nonnull instancetype)initWithPlots:(nullable CPTPlotArray *)newPlots { - if ( (self = [self initWithFrame:CGRectZero]) ) { + if ((self = [self initWithFrame:CGRectZero])) { for ( CPTPlot *plot in newPlots ) { [self addPlot:plot]; } @@ -364,7 +364,7 @@ -(nonnull instancetype)initWithPlots:(nullable CPTPlotArray *)newPlots **/ -(nonnull instancetype)initWithGraph:(nullable __kindof CPTGraph *)graph { - if ( (self = [self initWithFrame:CGRectZero]) ) { + if ((self = [self initWithFrame:CGRectZero])) { for ( CPTPlot *plot in [graph allPlots] ) { [self addPlot:plot]; } @@ -376,7 +376,7 @@ -(nonnull instancetype)initWithGraph:(nullable __kindof CPTGraph *)graph -(nonnull instancetype)initWithLayer:(nonnull id)layer { - if ( (self = [super initWithLayer:layer]) ) { + if ((self = [super initWithLayer:layer])) { CPTLegend *theLayer = (CPTLegend *)layer; plots = theLayer->plots; @@ -462,7 +462,7 @@ -(void)encodeWithCoder:(nonnull NSCoder *)coder -(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super initWithCoder:coder]) ) { + if ((self = [super initWithCoder:coder])) { NSArray *plotArray = [coder decodeObjectOfClasses:[NSSet setWithArray:@[[NSArray class], [CPTPlot class]]] forKey:@"CPTLegend.plots"]; if ( plotArray ) { @@ -552,11 +552,25 @@ -(void)renderAsVectorInContext:(nonnull CGContextRef)context return; } + BOOL isHorizontalLayout; + + switch ( self.swatchLayout ) { + case CPTLegendSwatchLayoutLeft: + case CPTLegendSwatchLayoutRight: + isHorizontalLayout = YES; + break; + + case CPTLegendSwatchLayoutTop: + case CPTLegendSwatchLayoutBottom: + isHorizontalLayout = NO; + break; + } + // calculate column positions CPTNumberArray *computedColumnWidths = self.columnWidthsThatFit; NSUInteger columnCount = computedColumnWidths.count; - CGFloat *actualColumnWidths = malloc(sizeof(CGFloat) * columnCount); - CGFloat *columnPositions = malloc(sizeof(CGFloat) * columnCount); + CGFloat *actualColumnWidths = calloc(columnCount, sizeof(CGFloat)); + CGFloat *columnPositions = calloc(columnCount, sizeof(CGFloat)); columnPositions[0] = self.paddingLeft; CGFloat theOffset = self.titleOffset; CGSize theSwatchSize = self.swatchSize; @@ -572,15 +586,15 @@ -(void)renderAsVectorInContext:(nonnull CGContextRef)context CGFloat width = [colWidth cgFloatValue]; actualColumnWidths[col] = width; if ( col < columnCount - 1 ) { - columnPositions[col + 1] = columnPositions[col] + padLeft + width + padRight + theOffset + theSwatchSize.width + theColumnMargin; + columnPositions[col + 1] = columnPositions[col] + padLeft + width + padRight + (isHorizontalLayout ? theOffset + theSwatchSize.width : CPTFloat(0.0)) + theColumnMargin; } } // calculate row positions CPTNumberArray *computedRowHeights = self.rowHeightsThatFit; NSUInteger rowCount = computedRowHeights.count; - CGFloat *actualRowHeights = malloc(sizeof(CGFloat) * rowCount); - CGFloat *rowPositions = malloc(sizeof(CGFloat) * rowCount); + CGFloat *actualRowHeights = calloc(rowCount, sizeof(CGFloat)); + CGFloat *rowPositions = calloc(rowCount, sizeof(CGFloat)); rowPositions[rowCount - 1] = self.paddingBottom; CGFloat theRowMargin = self.rowMargin; CGFloat lastRowHeight = 0.0; @@ -591,7 +605,7 @@ -(void)renderAsVectorInContext:(nonnull CGContextRef)context CGFloat height = [rowHeight cgFloatValue]; actualRowHeights[row] = height; if ( row < rowCount - 1 ) { - rowPositions[row] = rowPositions[row + 1] + padBottom + lastRowHeight + padTop + theRowMargin; + rowPositions[row] = rowPositions[row + 1] + padBottom + lastRowHeight + padTop + (isHorizontalLayout ? CPTFloat(0.0) : theOffset + theSwatchSize.height) + theRowMargin; } lastRowHeight = height; } @@ -613,17 +627,28 @@ -(void)renderAsVectorInContext:(nonnull CGContextRef)context NSUInteger row = legendEntry.row; NSUInteger col = legendEntry.column; - if ( ( (desiredRowCount == 0) || (row < desiredRowCount) ) && - ( (desiredColumnCount == 0) || (col < desiredColumnCount) ) ) { + if (((desiredRowCount == 0) || (row < desiredRowCount)) && + ((desiredColumnCount == 0) || (col < desiredColumnCount))) { NSUInteger entryIndex = legendEntry.index; CPTPlot *entryPlot = legendEntry.plot; CGFloat left = columnPositions[col]; CGFloat rowPosition = rowPositions[row]; - CGRect entryRect = CPTRectMake(left, - rowPosition, - padLeft + theSwatchSize.width + theOffset + actualColumnWidths[col] + CPTFloat(1.0) + padRight, - padBottom + actualRowHeights[row] + padTop); + + CGRect entryRect; + + if ( isHorizontalLayout ) { + entryRect = CPTRectMake(left, + rowPosition, + padLeft + theSwatchSize.width + theOffset + actualColumnWidths[col] + CPTFloat(1.0) + padRight, + padBottom + actualRowHeights[row] + padTop); + } + else { + entryRect = CPTRectMake(left, + rowPosition, + padLeft + MAX(theSwatchSize.width, actualColumnWidths[col]) + CPTFloat(1.0) + padRight, + padBottom + theSwatchSize.height + theOffset + actualRowHeights[row] + padTop); + } // draw background CPTFill *theFill = nil; @@ -654,24 +679,46 @@ -(void)renderAsVectorInContext:(nonnull CGContextRef)context } // lay out swatch and title - CGFloat swatchLeft; - CGFloat titleLeft; + CGFloat swatchLeft, swatchBottom; + CGFloat titleLeft, titleBottom; switch ( self.swatchLayout ) { case CPTLegendSwatchLayoutLeft: - swatchLeft = left + padLeft; - titleLeft = swatchLeft + theSwatchSize.width + theOffset; + swatchLeft = CGRectGetMinX(entryRect) + padLeft; + swatchBottom = CGRectGetMinY(entryRect) + (entryRect.size.height - theSwatchSize.height) * CPTFloat(0.5); + + titleLeft = swatchLeft + theSwatchSize.width + theOffset; + titleBottom = CGRectGetMinY(entryRect) + padBottom; break; case CPTLegendSwatchLayoutRight: - swatchLeft = CGRectGetMaxX(entryRect) - padRight - theSwatchSize.width; - titleLeft = left + padLeft; + swatchLeft = CGRectGetMaxX(entryRect) - padRight - theSwatchSize.width; + swatchBottom = CGRectGetMinY(entryRect) + (entryRect.size.height - theSwatchSize.height) * CPTFloat(0.5); + + titleLeft = CGRectGetMinX(entryRect) + padLeft; + titleBottom = CGRectGetMinY(entryRect) + padBottom; + break; + + case CPTLegendSwatchLayoutTop: + swatchLeft = CGRectGetMidX(entryRect) - theSwatchSize.width * CPTFloat(0.5); + swatchBottom = CGRectGetMaxY(entryRect) - padTop - theSwatchSize.height; + + titleLeft = CGRectGetMidX(entryRect) - actualColumnWidths[col] * CPTFloat(0.5); + titleBottom = CGRectGetMinY(entryRect) + padBottom; + break; + + case CPTLegendSwatchLayoutBottom: + swatchLeft = CGRectGetMidX(entryRect) - theSwatchSize.width * CPTFloat(0.5); + swatchBottom = CGRectGetMinY(entryRect) + padBottom; + + titleLeft = CGRectGetMidX(entryRect) - actualColumnWidths[col] * CPTFloat(0.5); + titleBottom = swatchBottom + theOffset + theSwatchSize.height; break; } // draw swatch CGRect swatchRect = CPTRectMake(swatchLeft, - rowPosition + (entryRect.size.height - theSwatchSize.height) * CPTFloat(0.5), + swatchBottom, theSwatchSize.width, theSwatchSize.height); @@ -691,7 +738,12 @@ -(void)renderAsVectorInContext:(nonnull CGContextRef)context } // draw title - [legendEntry drawTitleInRect:CPTAlignRectToUserSpace( context, CPTRectMake(titleLeft, rowPosition + padBottom, actualColumnWidths[col] + CPTFloat(1.0), actualRowHeights[row]) ) + CGRect titleRect = CPTRectMake(titleLeft, + titleBottom, + actualColumnWidths[col] + CPTFloat(1.0), + actualRowHeights[row]); + + [legendEntry drawTitleInRect:CPTAlignRectToUserSpace(context, titleRect) inContext:context scale:self.contentsScale]; } @@ -755,6 +807,20 @@ -(void)recalculateLayout return; } + BOOL isHorizontalLayout; + + switch ( self.swatchLayout ) { + case CPTLegendSwatchLayoutLeft: + case CPTLegendSwatchLayoutRight: + isHorizontalLayout = YES; + break; + + case CPTLegendSwatchLayoutTop: + case CPTLegendSwatchLayoutBottom: + isHorizontalLayout = NO; + break; + } + // compute the number of rows and columns needed to hold the legend entries NSUInteger rowCount = self.numberOfRows; NSUInteger columnCount = self.numberOfColumns; @@ -762,8 +828,8 @@ -(void)recalculateLayout NSUInteger desiredColumnCount = columnCount; NSUInteger legendEntryCount = self.legendEntries.count; - if ( (rowCount == 0) && (columnCount == 0) ) { - rowCount = (NSUInteger)lrint( sqrt( (double)legendEntryCount ) ); + if ((rowCount == 0) && (columnCount == 0)) { + rowCount = (NSUInteger)lrint(sqrt((double)legendEntryCount)); columnCount = rowCount; if ( rowCount * columnCount < legendEntryCount ) { columnCount++; @@ -772,13 +838,13 @@ -(void)recalculateLayout rowCount++; } } - else if ( (rowCount == 0) && (columnCount > 0) ) { + else if ((rowCount == 0) && (columnCount > 0)) { rowCount = legendEntryCount / columnCount; if ( legendEntryCount % columnCount ) { rowCount++; } } - else if ( (rowCount > 0) && (columnCount == 0) ) { + else if ((rowCount > 0) && (columnCount == 0)) { columnCount = legendEntryCount / rowCount; if ( legendEntryCount % rowCount ) { columnCount++; @@ -788,8 +854,8 @@ -(void)recalculateLayout // compute row heights and column widths NSUInteger row = 0; NSUInteger col = 0; - CGFloat *maxTitleHeight = calloc( rowCount, sizeof(CGFloat) ); - CGFloat *maxTitleWidth = calloc( columnCount, sizeof(CGFloat) ); + CGFloat *maxTitleHeight = calloc(rowCount, sizeof(CGFloat)); + CGFloat *maxTitleWidth = calloc(columnCount, sizeof(CGFloat)); CGSize theSwatchSize = self.swatchSize; CPTNumberArray *desiredRowHeights = self.rowHeights; CPTNumberArray *desiredColumnWidths = self.columnWidths; @@ -800,8 +866,11 @@ -(void)recalculateLayout legendEntry.column = col; CGSize titleSize = legendEntry.titleSize; - if ( (desiredRowCount == 0) || (row < desiredRowCount) ) { - maxTitleHeight[row] = MAX(MAX(maxTitleHeight[row], titleSize.height), theSwatchSize.height); + if ((desiredRowCount == 0) || (row < desiredRowCount)) { + maxTitleHeight[row] = MAX(maxTitleHeight[row], titleSize.height); + if ( isHorizontalLayout ) { + maxTitleHeight[row] = MAX(maxTitleHeight[row], theSwatchSize.height); + } if ( row < desiredRowHeights.count ) { id desiredRowHeight = desiredRowHeights[row]; @@ -811,8 +880,11 @@ -(void)recalculateLayout } } - if ( (desiredColumnCount == 0) || (col < desiredColumnCount) ) { - maxTitleWidth[col] = MAX(MAX(maxTitleWidth[col], titleSize.width), theSwatchSize.width); + if ((desiredColumnCount == 0) || (col < desiredColumnCount)) { + maxTitleWidth[col] = MAX(maxTitleWidth[col], titleSize.width); + if ( !isHorizontalLayout ) { + maxTitleWidth[col] = MAX(maxTitleWidth[col], theSwatchSize.width); + } if ( col < desiredColumnWidths.count ) { id desiredColumnWidth = desiredColumnWidths[col]; @@ -865,7 +937,10 @@ -(void)recalculateLayout } } if ( columnCount > 0 ) { - legendSize.width += ( (theSwatchSize.width + self.titleOffset + self.entryPaddingLeft + self.entryPaddingRight) * columnCount ) + ( self.columnMargin * (columnCount - 1) ); + legendSize.width += ((self.entryPaddingLeft + self.entryPaddingRight) * columnCount) + (self.columnMargin * (columnCount - 1)); + if ( isHorizontalLayout ) { + legendSize.width += (theSwatchSize.width + self.titleOffset) * columnCount; + } } NSUInteger rows = row; @@ -876,10 +951,13 @@ -(void)recalculateLayout legendSize.height += [height cgFloatValue]; } if ( rows > 0 ) { - legendSize.height += ( (self.entryPaddingBottom + self.entryPaddingTop) * rowCount ) + ( self.rowMargin * (rows - 1) ); + legendSize.height += ((self.entryPaddingBottom + self.entryPaddingTop) * rowCount) + (self.rowMargin * (rows - 1)); + if ( !isHorizontalLayout ) { + legendSize.height += (theSwatchSize.height + self.titleOffset) * rowCount; + } } - self.bounds = CPTRectMake( 0.0, 0.0, ceil(legendSize.width), ceil(legendSize.height) ); + self.bounds = CPTRectMake(0.0, 0.0, ceil(legendSize.width), ceil(legendSize.height)); [self pixelAlign]; self.layoutChanged = NO; @@ -1064,12 +1142,12 @@ -(void)removeLegendEntriesForPlot:(nonnull CPTPlot *)plot /// @cond --(void)legendNeedsRedraw:(nonnull NSNotification *)notif +-(void)legendNeedsRedraw:(nonnull NSNotification *__unused)notif { [self setNeedsDisplay]; } --(void)legendNeedsLayout:(nonnull NSNotification *)notif +-(void)legendNeedsLayout:(nonnull NSNotification *__unused)notif { self.layoutChanged = YES; [self setNeedsDisplay]; @@ -1152,7 +1230,7 @@ -(void)legendEntryForInteractionPoint:(CGPoint)interactionPoint row:(nonnull NSU for ( NSNumber *height in self.rowHeightsThatFit ) { CGFloat rowHeight = height.cgFloatValue + padVertical; - if ( (interactionPoint.y <= position) && (interactionPoint.y >= position - rowHeight) ) { + if ((interactionPoint.y <= position) && (interactionPoint.y >= position - rowHeight)) { *row = i; break; } @@ -1168,7 +1246,7 @@ -(void)legendEntryForInteractionPoint:(CGPoint)interactionPoint row:(nonnull NSU for ( NSNumber *width in self.columnWidthsThatFit ) { CGFloat colWidth = width.cgFloatValue + swatchWidth + padHorizontal; - if ( (interactionPoint.x >= position) && (interactionPoint.x <= position + colWidth) ) { + if ((interactionPoint.x >= position) && (interactionPoint.x <= position + colWidth)) { *col = i; break; } @@ -1202,11 +1280,11 @@ -(void)legendEntryForInteractionPoint:(CGPoint)interactionPoint row:(nonnull NSU **/ -(BOOL)pointingDeviceDownEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint { - if ( self.hidden || (self.plots.count == 0) ) { + if ( self.hidden || (self.plots.count == 0)) { return NO; } - id theDelegate = self.delegate; + id theDelegate = (id)self.delegate; if ( [theDelegate respondsToSelector:@selector(legend:legendEntryForPlot:touchDownAtIndex:)] || [theDelegate respondsToSelector:@selector(legend:legendEntryForPlot:touchDownAtIndex:withEvent:)] || [theDelegate respondsToSelector:@selector(legend:legendEntryForPlot:wasSelectedAtIndex:)] || @@ -1216,9 +1294,9 @@ -(BOOL)pointingDeviceDownEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint) [self legendEntryForInteractionPoint:interactionPoint row:&row col:&col]; // Notify the delegate if we found a hit - if ( (row != NSNotFound) && (col != NSNotFound) ) { + if ((row != NSNotFound) && (col != NSNotFound)) { for ( CPTLegendEntry *legendEntry in self.legendEntries ) { - if ( (legendEntry.row == row) && (legendEntry.column == col) ) { + if ((legendEntry.row == row) && (legendEntry.column == col)) { self.pointingDeviceDownEntry = legendEntry; CPTPlot *legendPlot = legendEntry.plot; @@ -1273,11 +1351,11 @@ -(BOOL)pointingDeviceUpEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)in self.pointingDeviceDownEntry = nil; - if ( self.hidden || (self.plots.count == 0) ) { + if ( self.hidden || (self.plots.count == 0)) { return NO; } - id theDelegate = self.delegate; + id theDelegate = (id)self.delegate; if ( [theDelegate respondsToSelector:@selector(legend:legendEntryForPlot:touchUpAtIndex:)] || [theDelegate respondsToSelector:@selector(legend:legendEntryForPlot:touchUpAtIndex:withEvent:)] || [theDelegate respondsToSelector:@selector(legend:legendEntryForPlot:wasSelectedAtIndex:)] || @@ -1287,9 +1365,9 @@ -(BOOL)pointingDeviceUpEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)in [self legendEntryForInteractionPoint:interactionPoint row:&row col:&col]; // Notify the delegate if we found a hit - if ( (row != NSNotFound) && (col != NSNotFound) ) { + if ((row != NSNotFound) && (col != NSNotFound)) { for ( CPTLegendEntry *legendEntry in self.legendEntries ) { - if ( (legendEntry.row == row) && (legendEntry.column == col) ) { + if ((legendEntry.row == row) && (legendEntry.column == col)) { BOOL handled = NO; CPTPlot *entryPlot = legendEntry.plot; @@ -1356,7 +1434,7 @@ -(void)setTextStyle:(nullable CPTTextStyle *)newTextStyle -(void)setSwatchSize:(CGSize)newSwatchSize { - if ( !CGSizeEqualToSize(newSwatchSize, swatchSize) ) { + if ( !CGSizeEqualToSize(newSwatchSize, swatchSize)) { swatchSize = newSwatchSize; self.layoutChanged = YES; } @@ -1366,10 +1444,10 @@ -(CGSize)swatchSize { CGSize theSwatchSize = swatchSize; - if ( CGSizeEqualToSize(theSwatchSize, CGSizeZero) ) { + if ( CGSizeEqualToSize(theSwatchSize, CGSizeZero)) { CPTTextStyle *theTextStyle = self.textStyle; CGFloat fontSize = theTextStyle.fontSize; - if ( fontSize > CPTFloat(0.0) ) { + if ( fontSize > CPTFloat(0.0)) { fontSize *= CPTFloat(1.5); fontSize = round(fontSize); theSwatchSize = CPTSizeMake(fontSize, fontSize); diff --git a/framework/Source/CPTLegendEntry.m b/framework/Source/CPTLegendEntry.m index 5d5d40a15..02f5bc365 100644 --- a/framework/Source/CPTLegendEntry.m +++ b/framework/Source/CPTLegendEntry.m @@ -86,7 +86,7 @@ @implementation CPTLegendEntry **/ -(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { plot = nil; index = 0; row = 0; @@ -114,7 +114,7 @@ -(void)encodeWithCoder:(nonnull NSCoder *)coder -(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super init]) ) { + if ((self = [super init])) { plot = [coder decodeObjectOfClass:[CPTPlot class] forKey:@"CPTLegendEntry.plot"]; index = (NSUInteger)[coder decodeIntegerForKey:@"CPTLegendEntry.index"]; @@ -153,15 +153,15 @@ -(void)drawTitleInRect:(CGRect)rect inContext:(nonnull CGContextRef)context scal #if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE CGContextSaveGState(context); CGContextTranslateCTM(context, CPTFloat(0.0), rect.origin.y); - CGContextScaleCTM( context, CPTFloat(1.0), CPTFloat(-1.0) ); - CGContextTranslateCTM( context, CPTFloat(0.0), -CGRectGetMaxY(rect) ); + CGContextScaleCTM(context, CPTFloat(1.0), CPTFloat(-1.0)); + CGContextTranslateCTM(context, CPTFloat(0.0), -CGRectGetMaxY(rect)); #endif // center the title vertically CGRect textRect = rect; CGSize theTitleSize = self.titleSize; if ( theTitleSize.height < textRect.size.height ) { CGFloat offset = (textRect.size.height - theTitleSize.height) / CPTFloat(2.0); - if ( scale == CPTFloat(1.0) ) { + if ( scale == CPTFloat(1.0)) { offset = round(offset); } else { @@ -173,7 +173,7 @@ -(void)drawTitleInRect:(CGRect)rect inContext:(nonnull CGContextRef)context scal NSAttributedString *styledTitle = self.attributedTitle; - if ( (styledTitle.length > 0) && [styledTitle respondsToSelector:@selector(drawInRect:)] ) { + if ((styledTitle.length > 0) && [styledTitle respondsToSelector:@selector(drawInRect:)] ) { [styledTitle drawInRect:textRect inContext:context]; } @@ -219,12 +219,8 @@ -(CGSize)titleSize NSAttributedString *styledTitle = self.attributedTitle; - if ( (styledTitle.length > 0) && [styledTitle respondsToSelector:@selector(size)] ) { -#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE - theTitleSize = styledTitle.size; -#else - theTitleSize = NSSizeToCGSize(styledTitle.size); -#endif + if ( styledTitle.length > 0 ) { + theTitleSize = [styledTitle sizeAsDrawn]; } else { NSString *theTitle = styledTitle.string; diff --git a/framework/Source/CPTLimitBand.m b/framework/Source/CPTLimitBand.m index d8ee6e061..2f75847c5 100644 --- a/framework/Source/CPTLimitBand.m +++ b/framework/Source/CPTLimitBand.m @@ -28,7 +28,7 @@ @implementation CPTLimitBand **/ +(nonnull instancetype)limitBandWithRange:(nullable CPTPlotRange *)newRange fill:(nullable CPTFill *)newFill { - return [[CPTLimitBand alloc] initWithRange:newRange fill:newFill]; + return [[self alloc] initWithRange:newRange fill:newFill]; } /** @brief Initializes a newly allocated CPTLimitBand object with the provided range and fill. @@ -38,7 +38,7 @@ +(nonnull instancetype)limitBandWithRange:(nullable CPTPlotRange *)newRange fill **/ -(nonnull instancetype)initWithRange:(nullable CPTPlotRange *)newRange fill:(nullable CPTFill *)newFill { - if ( (self = [super init]) ) { + if ((self = [super init])) { range = newRange; fill = newFill; } @@ -91,7 +91,7 @@ -(void)encodeWithCoder:(nonnull NSCoder *)encoder */ -(nullable instancetype)initWithCoder:(nonnull NSCoder *)decoder { - if ( (self = [super init]) ) { + if ((self = [super init])) { range = [decoder decodeObjectOfClass:[CPTPlotRange class] forKey:@"CPTLimitBand.range"]; fill = [decoder decodeObjectOfClass:[CPTFill class] diff --git a/framework/Source/CPTLineCap.m b/framework/Source/CPTLineCap.m index 1e8130b1b..5350d1149 100644 --- a/framework/Source/CPTLineCap.m +++ b/framework/Source/CPTLineCap.m @@ -80,7 +80,7 @@ @implementation CPTLineCap **/ -(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { size = CPTSizeMake(5.0, 5.0); lineCapType = CPTLineCapTypeNone; lineStyle = [[CPTLineStyle alloc] init]; @@ -124,7 +124,7 @@ -(void)encodeWithCoder:(nonnull NSCoder *)coder -(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super init]) ) { + if ((self = [super init])) { size = [coder decodeCPTSizeForKey:@"CPTLineCap.size"]; lineCapType = (CPTLineCapType)[coder decodeIntegerForKey:@"CPTLineCap.lineCapType"]; lineStyle = [coder decodeObjectOfClass:[CPTLineStyle class] @@ -160,7 +160,7 @@ +(BOOL)supportsSecureCoding -(void)setSize:(CGSize)newSize { - if ( !CGSizeEqualToSize(newSize, size) ) { + if ( !CGSizeEqualToSize(newSize, size)) { size = newSize; self.cachedLineCapPath = NULL; } @@ -431,16 +431,16 @@ -(void)renderAsVectorInContext:(nonnull CGContextRef)context atPoint:(CGPoint)ce if ( theLineStyle || theFill ) { CGContextSaveGState(context); CGContextTranslateCTM(context, center.x, center.y); - CGContextRotateCTM( context, atan2(direction.y, direction.x) - CPTFloat(M_PI_2) ); // standard symbol points up + CGContextRotateCTM(context, atan2(direction.y, direction.x) - CPTFloat(M_PI_2)); // standard symbol points up if ( theFill ) { // use fillRect instead of fillPath so that images and gradients are properly centered in the symbol CGSize symbolSize = self.size; - CGSize halfSize = CPTSizeMake( symbolSize.width / CPTFloat(2.0), symbolSize.height / CPTFloat(2.0) ); + CGSize halfSize = CPTSizeMake(symbolSize.width / CPTFloat(2.0), symbolSize.height / CPTFloat(2.0)); CGRect bounds = CPTRectMake(-halfSize.width, -halfSize.height, symbolSize.width, symbolSize.height); CGContextSaveGState(context); - if ( !CGPathIsEmpty(theLineCapPath) ) { + if ( !CGPathIsEmpty(theLineCapPath)) { CGContextBeginPath(context); CGContextAddPath(context, theLineCapPath); if ( self.usesEvenOddClipRule ) { @@ -480,7 +480,7 @@ -(nonnull CGPathRef)newLineCapPath { CGFloat dx, dy; CGSize lineCapSize = self.size; - CGSize halfSize = CPTSizeMake( lineCapSize.width / CPTFloat(2.0), lineCapSize.height / CPTFloat(2.0) ); + CGSize halfSize = CPTSizeMake(lineCapSize.width / CPTFloat(2.0), lineCapSize.height / CPTFloat(2.0)); CGMutablePathRef lineCapPath = CGPathCreateMutable(); @@ -491,47 +491,47 @@ -(nonnull CGPathRef)newLineCapPath case CPTLineCapTypeOpenArrow: CGPathMoveToPoint(lineCapPath, NULL, -halfSize.width, -halfSize.height); - CGPathAddLineToPoint( lineCapPath, NULL, CPTFloat(0.0), CPTFloat(0.0) ); + CGPathAddLineToPoint(lineCapPath, NULL, CPTFloat(0.0), CPTFloat(0.0)); CGPathAddLineToPoint(lineCapPath, NULL, halfSize.width, -halfSize.height); break; case CPTLineCapTypeSolidArrow: CGPathMoveToPoint(lineCapPath, NULL, -halfSize.width, -halfSize.height); - CGPathAddLineToPoint( lineCapPath, NULL, CPTFloat(0.0), CPTFloat(0.0) ); + CGPathAddLineToPoint(lineCapPath, NULL, CPTFloat(0.0), CPTFloat(0.0)); CGPathAddLineToPoint(lineCapPath, NULL, halfSize.width, -halfSize.height); CGPathCloseSubpath(lineCapPath); break; case CPTLineCapTypeSweptArrow: CGPathMoveToPoint(lineCapPath, NULL, -halfSize.width, -halfSize.height); - CGPathAddLineToPoint( lineCapPath, NULL, CPTFloat(0.0), CPTFloat(0.0) ); + CGPathAddLineToPoint(lineCapPath, NULL, CPTFloat(0.0), CPTFloat(0.0)); CGPathAddLineToPoint(lineCapPath, NULL, halfSize.width, -halfSize.height); - CGPathAddLineToPoint( lineCapPath, NULL, CPTFloat(0.0), -lineCapSize.height * CPTFloat(0.375) ); + CGPathAddLineToPoint(lineCapPath, NULL, CPTFloat(0.0), -lineCapSize.height * CPTFloat(0.375)); CGPathCloseSubpath(lineCapPath); break; case CPTLineCapTypeRectangle: - CGPathAddRect( lineCapPath, NULL, CPTRectMake( -halfSize.width, -halfSize.height, halfSize.width * CPTFloat(2.0), halfSize.height * CPTFloat(2.0) ) ); + CGPathAddRect(lineCapPath, NULL, CPTRectMake(-halfSize.width, -halfSize.height, halfSize.width * CPTFloat(2.0), halfSize.height * CPTFloat(2.0))); break; case CPTLineCapTypeEllipse: - CGPathAddEllipseInRect( lineCapPath, NULL, CPTRectMake( -halfSize.width, -halfSize.height, halfSize.width * CPTFloat(2.0), halfSize.height * CPTFloat(2.0) ) ); + CGPathAddEllipseInRect(lineCapPath, NULL, CPTRectMake(-halfSize.width, -halfSize.height, halfSize.width * CPTFloat(2.0), halfSize.height * CPTFloat(2.0))); break; case CPTLineCapTypeDiamond: CGPathMoveToPoint(lineCapPath, NULL, CPTFloat(0.0), halfSize.height); - CGPathAddLineToPoint( lineCapPath, NULL, halfSize.width, CPTFloat(0.0) ); + CGPathAddLineToPoint(lineCapPath, NULL, halfSize.width, CPTFloat(0.0)); CGPathAddLineToPoint(lineCapPath, NULL, CPTFloat(0.0), -halfSize.height); - CGPathAddLineToPoint( lineCapPath, NULL, -halfSize.width, CPTFloat(0.0) ); + CGPathAddLineToPoint(lineCapPath, NULL, -halfSize.width, CPTFloat(0.0)); CGPathCloseSubpath(lineCapPath); break; case CPTLineCapTypePentagon: CGPathMoveToPoint(lineCapPath, NULL, CPTFloat(0.0), halfSize.height); - CGPathAddLineToPoint( lineCapPath, NULL, halfSize.width * CPTFloat(0.95105651630), halfSize.height * CPTFloat(0.30901699437) ); - CGPathAddLineToPoint( lineCapPath, NULL, halfSize.width * CPTFloat(0.58778525229), -halfSize.height * CPTFloat(0.80901699437) ); - CGPathAddLineToPoint( lineCapPath, NULL, -halfSize.width * CPTFloat(0.58778525229), -halfSize.height * CPTFloat(0.80901699437) ); - CGPathAddLineToPoint( lineCapPath, NULL, -halfSize.width * CPTFloat(0.95105651630), halfSize.height * CPTFloat(0.30901699437) ); + CGPathAddLineToPoint(lineCapPath, NULL, halfSize.width * CPTFloat(0.95105651630), halfSize.height * CPTFloat(0.30901699437)); + CGPathAddLineToPoint(lineCapPath, NULL, halfSize.width * CPTFloat(0.58778525229), -halfSize.height * CPTFloat(0.80901699437)); + CGPathAddLineToPoint(lineCapPath, NULL, -halfSize.width * CPTFloat(0.58778525229), -halfSize.height * CPTFloat(0.80901699437)); + CGPathAddLineToPoint(lineCapPath, NULL, -halfSize.width * CPTFloat(0.95105651630), halfSize.height * CPTFloat(0.30901699437)); CGPathCloseSubpath(lineCapPath); break; @@ -549,8 +549,8 @@ -(nonnull CGPathRef)newLineCapPath break; case CPTLineCapTypeBar: - CGPathMoveToPoint( lineCapPath, NULL, halfSize.width, CPTFloat(0.0) ); - CGPathAddLineToPoint( lineCapPath, NULL, -halfSize.width, CPTFloat(0.0) ); + CGPathMoveToPoint(lineCapPath, NULL, halfSize.width, CPTFloat(0.0)); + CGPathAddLineToPoint(lineCapPath, NULL, -halfSize.width, CPTFloat(0.0)); break; case CPTLineCapTypeCross: @@ -581,8 +581,8 @@ -(nonnull CGPathRef)newLineCapPath CGFloat dy1 = lineCapSize.height / oldBounds.size.height; CGAffineTransform scaleTransform = CGAffineTransformScale(CGAffineTransformIdentity, dx1, dy1); - scaleTransform = CGAffineTransformConcat( scaleTransform, - CGAffineTransformMakeTranslation(-halfSize.width, -halfSize.height) ); + scaleTransform = CGAffineTransformConcat(scaleTransform, + CGAffineTransformMakeTranslation(-halfSize.width, -halfSize.height)); CGPathAddPath(lineCapPath, &scaleTransform, customPath); } } @@ -601,11 +601,11 @@ -(nonnull CGPathRef)newLineCapPath -(nullable id)debugQuickLookObject { const CGSize symbolSize = self.size; - const CGSize halfSize = CPTSizeMake( symbolSize.width * CPTFloat(0.5), symbolSize.height * CPTFloat(0.5) ); + const CGSize halfSize = CPTSizeMake(symbolSize.width * CPTFloat(0.5), symbolSize.height * CPTFloat(0.5)); const CGRect rect = CGRectMake(-halfSize.width, -halfSize.height, symbolSize.width, symbolSize.height); const CGPoint centerPoint = CGPointMake(halfSize.width, halfSize.height); - return CPTQuickLookImage(rect, ^(CGContextRef context, CGFloat scale, CGRect bounds) { + return CPTQuickLookImage(rect, ^(CGContextRef context, CGFloat __unused scale, CGRect bounds __unused) { [self renderAsVectorInContext:context atPoint:centerPoint inDirection:CGPointMake(1.0, 0.0)]; }); } diff --git a/framework/Source/CPTLineStyle.m b/framework/Source/CPTLineStyle.m index 27a8e6671..2208471f6 100644 --- a/framework/Source/CPTLineStyle.m +++ b/framework/Source/CPTLineStyle.m @@ -154,7 +154,7 @@ +(nonnull instancetype)lineStyleWithStyle:(nullable CPTLineStyle *)lineStyle **/ -(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { lineCap = kCGLineCapButt; lineJoin = kCGLineJoinMiter; miterLimit = CPTFloat(10.0); @@ -190,7 +190,7 @@ -(void)encodeWithCoder:(nonnull NSCoder *)coder -(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super init]) ) { + if ((self = [super init])) { lineCap = (CGLineCap)[coder decodeIntForKey:@"CPTLineStyle.lineCap"]; lineJoin = (CGLineJoin)[coder decodeIntForKey:@"CPTLineStyle.lineJoin"]; miterLimit = [coder decodeCGFloatForKey:@"CPTLineStyle.miterLimit"]; @@ -239,7 +239,7 @@ -(void)setLineStyleInContext:(nonnull CGContextRef)context NSUInteger dashCount = myDashPattern.count; if ( dashCount > 0 ) { - CGFloat *dashLengths = (CGFloat *)calloc( dashCount, sizeof(CGFloat) ); + CGFloat *dashLengths = (CGFloat *)calloc(dashCount, sizeof(CGFloat)); NSUInteger dashCounter = 0; for ( NSNumber *currentDashLength in myDashPattern ) { @@ -309,7 +309,7 @@ -(void)strokeRect:(CGRect)rect inContext:(nonnull CGContextRef)context -(void)strokePathWithGradient:(nonnull CPTGradient *)gradient inContext:(nonnull CGContextRef)context { if ( gradient ) { - CGRect deviceRect = CGContextConvertRectToDeviceSpace( context, CPTRectMake(0.0, 0.0, 1.0, 1.0) ); + CGRect deviceRect = CGContextConvertRectToDeviceSpace(context, CPTRectMake(0.0, 0.0, 1.0, 1.0)); CGFloat step = CPTFloat(2.0) / deviceRect.size.height; @@ -319,7 +319,7 @@ -(void)strokePathWithGradient:(nonnull CPTGradient *)gradient inContext:(nonnull CGContextBeginPath(context); CGFloat width = startWidth; - while ( width > CPTFloat(0.0) ) { + while ( width > CPTFloat(0.0)) { CGContextSetLineWidth(context, width); CGColorRef gradientColor = [gradient newColorAtPosition:CPTFloat(1.0) - width / startWidth]; @@ -421,7 +421,7 @@ -(nullable id)debugQuickLookObject { const CGRect rect = CGRectMake(0.0, 0.0, 100.0, 100.0); - return CPTQuickLookImage(rect, ^(CGContextRef context, CGFloat scale, CGRect bounds) { + return CPTQuickLookImage(rect, ^(CGContextRef context, CGFloat __unused scale, CGRect bounds) { const CGRect alignedRect = CPTAlignBorderedRectToUserSpace(context, bounds, self); [self setLineStyleInContext:context]; diff --git a/framework/Source/CPTMutableNumericData.h b/framework/Source/CPTMutableNumericData.h index 6f1768b33..32d299487 100644 --- a/framework/Source/CPTMutableNumericData.h +++ b/framework/Source/CPTMutableNumericData.h @@ -16,7 +16,7 @@ /// @name Samples /// @{ -(nullable void *)mutableSamplePointer:(NSUInteger)sample NS_RETURNS_INNER_POINTER; --(nullable void *)mutableSamplePointerAtIndex:(NSUInteger)idx, ...NS_RETURNS_INNER_POINTER; +-(nullable void *)mutableSamplePointerAtIndex:(NSUInteger)idx, ... NS_RETURNS_INNER_POINTER; /// @} @end diff --git a/framework/Source/CPTMutableNumericData.m b/framework/Source/CPTMutableNumericData.m index 4b6728c2a..631d70704 100644 --- a/framework/Source/CPTMutableNumericData.m +++ b/framework/Source/CPTMutableNumericData.m @@ -49,7 +49,7 @@ @implementation CPTMutableNumericData -(nullable void *)mutableSamplePointer:(NSUInteger)sample { if ( sample < self.numberOfSamples ) { - return (void *)( (char *)self.mutableBytes + sample * self.sampleBytes ); + return (void *)((char *)self.mutableBytes + sample * self.sampleBytes); } else { return NULL; @@ -62,7 +62,7 @@ -(nullable void *)mutableSamplePointer:(NSUInteger)sample * @return A pointer to the sample or @NULL if any of the sample indices are out of bounds. **/ -(nullable void *)mutableSamplePointerAtIndex:(NSUInteger)idx, ... - { +{ NSUInteger newIndex; if ( self.numberOfDimensions > 1 ) { @@ -87,7 +87,7 @@ -(nullable void *)mutableSamplePointerAtIndex:(NSUInteger)idx, ... -(nonnull void *)mutableBytes { - return ( (NSMutableData *)self.data ).mutableBytes; + return ((NSMutableData *)self.data).mutableBytes; } /// @endcond diff --git a/framework/Source/CPTMutableNumericDataTests.m b/framework/Source/CPTMutableNumericDataTests.m index bd9abf7ac..d5cc0870a 100644 --- a/framework/Source/CPTMutableNumericDataTests.m +++ b/framework/Source/CPTMutableNumericDataTests.m @@ -28,7 +28,7 @@ -(void)testNumberOfDimensionsGivesShapeCount NSMutableData *data = [NSMutableData dataWithLength:nElems * sizeof(float)]; CPTMutableNumericData *nd = [[CPTMutableNumericData alloc] initWithData:data - dataType:CPTDataType( CPTFloatingPointDataType, sizeof(float), NSHostByteOrder() ) + dataType:CPTDataType(CPTFloatingPointDataType, sizeof(float), NSHostByteOrder()) shape:shape]; XCTAssertEqual(nd.numberOfDimensions, nd.shape.count, @"numberOfDimensions == shape.count == 3"); @@ -64,7 +64,7 @@ -(void)testIllegalShapeRaisesException NSMutableData *data = [NSMutableData dataWithLength:nElems * sizeof(NSUInteger)]; XCTAssertThrowsSpecificNamed(testData = [[CPTMutableNumericData alloc] initWithData:data - dataType:CPTDataType( CPTUnsignedIntegerDataType, sizeof(NSUInteger), NSHostByteOrder() ) + dataType:CPTDataType(CPTUnsignedIntegerDataType, sizeof(NSUInteger), NSHostByteOrder()) shape:shape], NSException, CPTNumericDataException, @@ -95,7 +95,7 @@ -(void)testBytesEqualDataBytes } CPTMutableNumericData *nd = [[CPTMutableNumericData alloc] initWithData:data - dataType:CPTDataType( CPTIntegerDataType, sizeof(NSInteger), NSHostByteOrder() ) + dataType:CPTDataType(CPTIntegerDataType, sizeof(NSInteger), NSHostByteOrder()) shape:nil]; NSMutableData *expected = data; @@ -113,7 +113,7 @@ -(void)testArchivingRoundTrip } CPTMutableNumericData *nd = [[CPTMutableNumericData alloc] initWithData:data - dataType:CPTDataType( CPTFloatingPointDataType, sizeof(float), NSHostByteOrder() ) + dataType:CPTDataType(CPTFloatingPointDataType, sizeof(float), NSHostByteOrder()) shape:nil]; CPTMutableNumericData *nd2 = [self archiveRoundTrip:nd]; @@ -140,7 +140,7 @@ -(void)testNumberOfSamplesCorrectForDataType } CPTMutableNumericData *nd = [[CPTMutableNumericData alloc] initWithData:data - dataType:CPTDataType( CPTFloatingPointDataType, sizeof(float), NSHostByteOrder() ) + dataType:CPTDataType(CPTFloatingPointDataType, sizeof(float), NSHostByteOrder()) shape:nil]; XCTAssertEqual([nd numberOfSamples], nElems, @"numberOfSamples == nElems"); @@ -153,7 +153,7 @@ -(void)testNumberOfSamplesCorrectForDataType } nd = [[CPTMutableNumericData alloc] initWithData:data - dataType:CPTDataType( CPTIntegerDataType, sizeof(char), NSHostByteOrder() ) + dataType:CPTDataType(CPTIntegerDataType, sizeof(char), NSHostByteOrder()) shape:nil]; XCTAssertEqual([nd numberOfSamples], nElems, @"numberOfSamples == nElems"); @@ -170,7 +170,7 @@ -(void)testDataTypeAccessorsCorrectForDataType } CPTMutableNumericData *nd = [[CPTMutableNumericData alloc] initWithData:data - dataType:CPTDataType( CPTFloatingPointDataType, sizeof(float), NSHostByteOrder() ) + dataType:CPTDataType(CPTFloatingPointDataType, sizeof(float), NSHostByteOrder()) shape:nil]; XCTAssertEqual([nd dataTypeFormat], CPTFloatingPointDataType, @"dataTypeFormat"); @@ -189,7 +189,7 @@ -(void)testConvertTypeConvertsType } CPTMutableNumericData *fd = [[CPTMutableNumericData alloc] initWithData:data - dataType:CPTDataType( CPTFloatingPointDataType, sizeof(float), NSHostByteOrder() ) + dataType:CPTDataType(CPTFloatingPointDataType, sizeof(float), NSHostByteOrder()) shape:nil]; CPTNumericData *dd = [fd dataByConvertingToType:CPTFloatingPointDataType @@ -198,7 +198,7 @@ -(void)testConvertTypeConvertsType const double *doubleSamples = (const double *)dd.data.bytes; for ( NSUInteger i = 0; i < numberOfSamples; i++ ) { - XCTAssertTrue( (double)samples[i] == doubleSamples[i], @"(float)%g != (double)%g", (double)samples[i], doubleSamples[i] ); + XCTAssertTrue((double)samples[i] == doubleSamples[i], @"(float)%g != (double)%g", (double)samples[i], doubleSamples[i]); } } @@ -213,12 +213,12 @@ -(void)testSamplePointerCorrect } CPTMutableNumericData *fd = [[CPTMutableNumericData alloc] initWithData:data - dataType:CPTDataType( CPTFloatingPointDataType, sizeof(float), NSHostByteOrder() ) + dataType:CPTDataType(CPTFloatingPointDataType, sizeof(float), NSHostByteOrder()) shape:nil]; - XCTAssertEqual( ( (float *)[fd mutableBytes] ) + 4, (float *)[fd mutableSamplePointer:4], @"%p,%p", samples + 4, (float *)[fd mutableSamplePointer:4] ); - XCTAssertEqual( ( (float *)[fd mutableBytes] ), (float *)[fd mutableSamplePointer:0], @"" ); - XCTAssertEqual( ( (float *)[fd mutableBytes] ) + nElems - 1, (float *)[fd mutableSamplePointer:nElems - 1], @"" ); + XCTAssertEqual(((float *)[fd mutableBytes]) + 4, (float *)[fd mutableSamplePointer:4], @"%p,%p", samples + 4, (float *)[fd mutableSamplePointer:4]); + XCTAssertEqual(((float *)[fd mutableBytes]), (float *)[fd mutableSamplePointer:0], @""); + XCTAssertEqual(((float *)[fd mutableBytes]) + nElems - 1, (float *)[fd mutableSamplePointer:nElems - 1], @""); XCTAssertNil([fd samplePointer:nElems], @"too many samples"); } @@ -233,7 +233,7 @@ -(void)testSampleValueCorrect } CPTMutableNumericData *fd = [[CPTMutableNumericData alloc] initWithData:data - dataType:CPTDataType( CPTFloatingPointDataType, sizeof(float), NSHostByteOrder() ) + dataType:CPTDataType(CPTFloatingPointDataType, sizeof(float), NSHostByteOrder()) shape:nil]; XCTAssertEqualWithAccuracy([[fd sampleValue:0] doubleValue], sin(0), 0.01, @"sample value"); @@ -245,13 +245,13 @@ -(void)testMutableCopy const NSUInteger nElems = 10; NSMutableData *data = [NSMutableData dataWithLength:nElems * sizeof(float)]; CPTNumericData *nd = [[CPTNumericData alloc] initWithData:data - dataType:CPTDataType( CPTFloatingPointDataType, sizeof(float), NSHostByteOrder() ) + dataType:CPTDataType(CPTFloatingPointDataType, sizeof(float), NSHostByteOrder()) shape:nil]; CPTMutableNumericData *ndCopy = [nd mutableCopy]; // should be mutable--if not, this will error - ndCopy.dataType = CPTDataType( CPTFloatingPointDataType, sizeof(double), NSHostByteOrder() ); + ndCopy.dataType = CPTDataType(CPTFloatingPointDataType, sizeof(double), NSHostByteOrder()); } @end diff --git a/framework/Source/CPTMutableNumericDataTypeConversionTests.m b/framework/Source/CPTMutableNumericDataTypeConversionTests.m index ff8105309..2c01ecfe5 100644 --- a/framework/Source/CPTMutableNumericDataTypeConversionTests.m +++ b/framework/Source/CPTMutableNumericDataTypeConversionTests.m @@ -18,14 +18,14 @@ -(void)testFloatToDoubleInPlaceConversion } CPTMutableNumericData *numericData = [[CPTMutableNumericData alloc] initWithData:data - dataType:CPTDataType( CPTFloatingPointDataType, sizeof(float), NSHostByteOrder() ) + dataType:CPTDataType(CPTFloatingPointDataType, sizeof(float), NSHostByteOrder()) shape:nil]; numericData.sampleBytes = sizeof(double); const double *doubleSamples = (const double *)numericData.data.bytes; for ( NSUInteger i = 0; i < numberOfSamples; i++ ) { - XCTAssertEqualWithAccuracy( (double)samples[i], doubleSamples[i], precision, @"(float)%g != (double)%g", (double)samples[i], doubleSamples[i] ); + XCTAssertEqualWithAccuracy((double)samples[i], doubleSamples[i], precision, @"(float)%g != (double)%g", (double)samples[i], doubleSamples[i]); } } @@ -39,14 +39,14 @@ -(void)testDoubleToFloatInPlaceConversion } CPTMutableNumericData *numericData = [[CPTMutableNumericData alloc] initWithData:data - dataType:CPTDataType( CPTFloatingPointDataType, sizeof(double), NSHostByteOrder() ) + dataType:CPTDataType(CPTFloatingPointDataType, sizeof(double), NSHostByteOrder()) shape:nil]; numericData.sampleBytes = sizeof(float); const float *floatSamples = (const float *)numericData.data.bytes; for ( NSUInteger i = 0; i < numberOfSamples; i++ ) { - XCTAssertEqualWithAccuracy( (double)floatSamples[i], samples[i], precision, @"(float)%g != (double)%g", (double)floatSamples[i], samples[i] ); + XCTAssertEqualWithAccuracy((double)floatSamples[i], samples[i], precision, @"(float)%g != (double)%g", (double)floatSamples[i], samples[i]); } } @@ -60,14 +60,14 @@ -(void)testFloatToIntegerInPlaceConversion } CPTMutableNumericData *numericData = [[CPTMutableNumericData alloc] initWithData:data - dataType:CPTDataType( CPTFloatingPointDataType, sizeof(float), NSHostByteOrder() ) + dataType:CPTDataType(CPTFloatingPointDataType, sizeof(float), NSHostByteOrder()) shape:nil]; - numericData.dataType = CPTDataType( CPTIntegerDataType, sizeof(NSInteger), NSHostByteOrder() ); + numericData.dataType = CPTDataType(CPTIntegerDataType, sizeof(NSInteger), NSHostByteOrder()); const NSInteger *intSamples = (const NSInteger *)numericData.data.bytes; for ( NSUInteger i = 0; i < numberOfSamples; i++ ) { - XCTAssertEqualWithAccuracy( (NSInteger)samples[i], intSamples[i], precision, @"(float)%g != (NSInteger)%ld", (double)samples[i], (long)intSamples[i] ); + XCTAssertEqualWithAccuracy((NSInteger)samples[i], intSamples[i], precision, @"(float)%g != (NSInteger)%ld", (double)samples[i], (long)intSamples[i]); } } @@ -81,10 +81,10 @@ -(void)testIntegerToFloatInPlaceConversion } CPTMutableNumericData *numericData = [[CPTMutableNumericData alloc] initWithData:data - dataType:CPTDataType( CPTIntegerDataType, sizeof(NSInteger), NSHostByteOrder() ) + dataType:CPTDataType(CPTIntegerDataType, sizeof(NSInteger), NSHostByteOrder()) shape:nil]; - numericData.dataType = CPTDataType( CPTFloatingPointDataType, sizeof(float), NSHostByteOrder() ); + numericData.dataType = CPTDataType(CPTFloatingPointDataType, sizeof(float), NSHostByteOrder()); const float *floatSamples = (const float *)numericData.data.bytes; for ( NSUInteger i = 0; i < numberOfSamples; i++ ) { @@ -98,14 +98,14 @@ -(void)testDecimalToDoubleInPlaceConversion NSDecimal *samples = (NSDecimal *)data.mutableBytes; for ( NSUInteger i = 0; i < numberOfSamples; i++ ) { - samples[i] = CPTDecimalFromDouble( sin(i) ); + samples[i] = CPTDecimalFromDouble(sin(i)); } CPTMutableNumericData *numericData = [[CPTMutableNumericData alloc] initWithData:data - dataType:CPTDataType( CPTDecimalDataType, sizeof(NSDecimal), NSHostByteOrder() ) + dataType:CPTDataType(CPTDecimalDataType, sizeof(NSDecimal), NSHostByteOrder()) shape:nil]; - numericData.dataType = CPTDataType( CPTFloatingPointDataType, sizeof(double), NSHostByteOrder() ); + numericData.dataType = CPTDataType(CPTFloatingPointDataType, sizeof(double), NSHostByteOrder()); const double *doubleSamples = (const double *)numericData.data.bytes; for ( NSUInteger i = 0; i < numberOfSamples; i++ ) { @@ -123,14 +123,14 @@ -(void)testDoubleToDecimalInPlaceConversion } CPTMutableNumericData *numericData = [[CPTMutableNumericData alloc] initWithData:data - dataType:CPTDataType( CPTFloatingPointDataType, sizeof(double), NSHostByteOrder() ) + dataType:CPTDataType(CPTFloatingPointDataType, sizeof(double), NSHostByteOrder()) shape:nil]; - numericData.dataType = CPTDataType( CPTDecimalDataType, sizeof(NSDecimal), NSHostByteOrder() ); + numericData.dataType = CPTDataType(CPTDecimalDataType, sizeof(NSDecimal), NSHostByteOrder()); const NSDecimal *decimalSamples = (const NSDecimal *)numericData.data.bytes; for ( NSUInteger i = 0; i < numberOfSamples; i++ ) { - XCTAssertTrue(CPTDecimalEquals( decimalSamples[i], CPTDecimalFromDouble(samples[i]) ), @"(NSDecimal)%@ != (double)%g", CPTDecimalStringValue(decimalSamples[i]), samples[i]); + XCTAssertTrue(CPTDecimalEquals(decimalSamples[i], CPTDecimalFromDouble(samples[i])), @"(NSDecimal)%@ != (double)%g", CPTDecimalStringValue(decimalSamples[i]), samples[i]); } } @@ -177,7 +177,7 @@ -(void)testTypeConversionSwapsByteOrderDoubleInPlace uint64_t end = *(const uint64_t *)numericData.bytes; union swap { - double v; + double v; CFSwappedFloat64 sv; } result; diff --git a/framework/Source/CPTMutablePlotRange.m b/framework/Source/CPTMutablePlotRange.m index 4f17749f1..eb1079824 100644 --- a/framework/Source/CPTMutablePlotRange.m +++ b/framework/Source/CPTMutablePlotRange.m @@ -73,24 +73,76 @@ -(void)unionPlotRange:(nullable CPTPlotRange *)other NSDecimal min1 = self.minLimitDecimal; NSDecimal min2 = other.minLimitDecimal; - NSDecimal minimum = CPTDecimalLessThan(min1, min2) ? min1 : min2; + NSDecimal minimum = CPTDecimalMin(min1, min2); NSDecimal max1 = self.maxLimitDecimal; NSDecimal max2 = other.maxLimitDecimal; - NSDecimal maximum = CPTDecimalGreaterThan(max1, max2) ? max1 : max2; - - NSDecimal newLocation, newLength; - if ( CPTDecimalGreaterThanOrEqualTo( self.lengthDecimal, CPTDecimalFromInteger(0) ) ) { - newLocation = minimum; - newLength = CPTDecimalSubtract(maximum, minimum); + NSDecimal maximum = CPTDecimalMax(max1, max2); + + if ( self.isInfinite && other.isInfinite ) { + if ( self.lengthSign == other.lengthSign ) { + switch ( self.lengthSign ) { + case CPTSignPositive: + self.locationDecimal = minimum; + break; + + case CPTSignNegative: + self.locationDecimal = maximum; + break; + + default: + break; + } + } + else { + self.locationDouble = -HUGE_VAL; + self.lengthDouble = HUGE_VAL; + } + } + else if ( self.isInfinite && !other.isInfinite ) { + switch ( self.lengthSign ) { + case CPTSignPositive: + self.locationDecimal = minimum; + break; + + case CPTSignNegative: + self.locationDecimal = maximum; + break; + + default: + break; + } + } + else if ( !self.isInfinite && other.isInfinite ) { + switch ( other.lengthSign ) { + case CPTSignPositive: + self.locationDecimal = minimum; + self.lengthDouble = HUGE_VAL; + break; + + case CPTSignNegative: + self.locationDecimal = maximum; + self.lengthDouble = -HUGE_VAL; + break; + + default: + break; + } + } + else if ( NSDecimalIsNotANumber(&minimum) || NSDecimalIsNotANumber(&maximum)) { + self.locationDecimal = CPTDecimalNaN(); + self.lengthDecimal = CPTDecimalNaN(); } else { - newLocation = maximum; - newLength = CPTDecimalSubtract(minimum, maximum); + if ( CPTDecimalGreaterThanOrEqualTo(self.lengthDecimal, CPTDecimalFromInteger(0))) { + self.locationDecimal = minimum; + self.lengthDecimal = CPTDecimalSubtract(maximum, minimum); + } + else { + self.locationDecimal = maximum; + self.lengthDecimal = CPTDecimalSubtract(minimum, maximum); + } } - - self.locationDecimal = newLocation; - self.lengthDecimal = newLength; } /** @brief Sets the messaged object to the intersection with another range. The sign of @ref length is unchanged. @@ -104,28 +156,75 @@ -(void)intersectionPlotRange:(nullable CPTPlotRange *)other NSDecimal min1 = self.minLimitDecimal; NSDecimal min2 = other.minLimitDecimal; - NSDecimal minimum = CPTDecimalGreaterThan(min1, min2) ? min1 : min2; + NSDecimal minimum = CPTDecimalMax(min1, min2); NSDecimal max1 = self.maxLimitDecimal; NSDecimal max2 = other.maxLimitDecimal; - NSDecimal maximum = CPTDecimalLessThan(max1, max2) ? max1 : max2; + NSDecimal maximum = CPTDecimalMin(max1, max2); - if ( CPTDecimalGreaterThanOrEqualTo(maximum, minimum) ) { - NSDecimal newLocation, newLength; - if ( CPTDecimalGreaterThanOrEqualTo( self.lengthDecimal, CPTDecimalFromInteger(0) ) ) { - newLocation = minimum; - newLength = CPTDecimalSubtract(maximum, minimum); + if ( ![self intersectsRange:other] ) { + self.locationDecimal = CPTDecimalNaN(); + self.lengthDecimal = CPTDecimalNaN(); + } + else if ( self.isInfinite && other.isInfinite ) { + switch ( self.lengthSign ) { + case CPTSignPositive: + self.locationDecimal = minimum; + break; + + case CPTSignNegative: + self.locationDecimal = maximum; + break; + + default: + break; } - else { - newLocation = maximum; - newLength = CPTDecimalSubtract(minimum, maximum); + } + else if ( self.isInfinite && !other.isInfinite ) { + switch ( self.lengthSign ) { + case CPTSignPositive: + self.locationDecimal = minimum; + self.lengthDecimal = CPTDecimalSubtract(other.maxLimitDecimal, minimum); + break; + + case CPTSignNegative: + self.locationDecimal = maximum; + self.lengthDecimal = CPTDecimalSubtract(other.minLimitDecimal, maximum); + break; + + default: + break; + } + } + else if ( !self.isInfinite && other.isInfinite ) { + switch ( other.lengthSign ) { + case CPTSignPositive: + self.locationDecimal = minimum; + self.lengthDecimal = CPTDecimalSubtract(self.maxLimitDecimal, minimum); + break; + + case CPTSignNegative: + self.locationDecimal = maximum; + self.lengthDecimal = CPTDecimalSubtract(self.minLimitDecimal, maximum); + break; + + default: + break; } - - self.locationDecimal = newLocation; - self.lengthDecimal = newLength; + } + else if ( NSDecimalIsNotANumber(&minimum) || NSDecimalIsNotANumber(&maximum)) { + self.locationDecimal = CPTDecimalNaN(); + self.lengthDecimal = CPTDecimalNaN(); } else { - self.lengthDecimal = CPTDecimalFromInteger(0); + if ( CPTDecimalGreaterThanOrEqualTo(self.lengthDecimal, CPTDecimalFromInteger(0))) { + self.locationDecimal = minimum; + self.lengthDecimal = CPTDecimalSubtract(maximum, minimum); + } + else { + self.locationDecimal = maximum; + self.lengthDecimal = CPTDecimalSubtract(minimum, maximum); + } } } @@ -140,7 +239,7 @@ -(void)expandRangeByFactor:(nonnull NSNumber *)factor { NSDecimal oldLength = self.lengthDecimal; NSDecimal newLength = CPTDecimalMultiply(oldLength, factor.decimalValue); - NSDecimal locationOffset = CPTDecimalDivide( CPTDecimalSubtract(oldLength, newLength), CPTDecimalFromInteger(2) ); + NSDecimal locationOffset = CPTDecimalDivide(CPTDecimalSubtract(oldLength, newLength), CPTDecimalFromInteger(2)); NSDecimal newLocation = CPTDecimalAdd(self.locationDecimal, locationOffset); self.locationDecimal = newLocation; @@ -201,8 +300,10 @@ -(void)shiftEndToFitInRange:(nonnull CPTPlotRange *)otherRange /// @cond --(void)setLocation:(NSNumber *)newLocation +-(void)setLocation:(nonnull NSNumber *)newLocation { + NSParameterAssert(newLocation); + self.inValueUpdate = YES; self.locationDecimal = newLocation.decimalValue; @@ -211,8 +312,10 @@ -(void)setLocation:(NSNumber *)newLocation self.inValueUpdate = NO; } --(void)setLength:(NSNumber *)newLength +-(void)setLength:(nonnull NSNumber *)newLength { + NSParameterAssert(newLength); + self.inValueUpdate = YES; self.lengthDecimal = newLength.decimalValue; diff --git a/framework/Source/CPTMutableTextStyle.h b/framework/Source/CPTMutableTextStyle.h index 471a79bb0..e63ec361f 100644 --- a/framework/Source/CPTMutableTextStyle.h +++ b/framework/Source/CPTMutableTextStyle.h @@ -4,6 +4,7 @@ @interface CPTMutableTextStyle : CPTTextStyle +@property (readwrite, strong, nonatomic, nullable) CPTNativeFont *font; @property (readwrite, copy, nonatomic, nullable) NSString *fontName; @property (readwrite, assign, nonatomic) CGFloat fontSize; @property (readwrite, copy, nonatomic, nullable) CPTColor *color; diff --git a/framework/Source/CPTMutableTextStyle.m b/framework/Source/CPTMutableTextStyle.m index 0d63a221f..50cce383a 100644 --- a/framework/Source/CPTMutableTextStyle.m +++ b/framework/Source/CPTMutableTextStyle.m @@ -7,13 +7,20 @@ @implementation CPTMutableTextStyle +/** @property CPTNativeFont* font + * @brief The font. Default is @nil. + * + * Font will override fontName and fontSize if not @nil. + **/ +@synthesize font; + /** @property CGFloat fontSize - * @brief The font size. Default is @num{12.0}. + * @brief The font size. Default is @num{12.0}. Ignored if font is not @nil. **/ @dynamic fontSize; /** @property nullable NSString *fontName - * @brief The font name. Default is Helvetica. + * @brief The font name. Default is Helvetica. Ignored if font is not @nil. **/ @dynamic fontName; diff --git a/framework/Source/CPTNumericData+TypeConversion.m b/framework/Source/CPTNumericData+TypeConversion.m index 2790710ab..2ebfd19a1 100644 --- a/framework/Source/CPTNumericData+TypeConversion.m +++ b/framework/Source/CPTNumericData+TypeConversion.m @@ -1,7 +1,7 @@ #import "CPTNumericData+TypeConversion.h" -#import "CPTUtilities.h" #import "complex.h" +#import "CPTUtilities.h" @implementation CPTNumericData(TypeConversion) @@ -29,17 +29,17 @@ -(nonnull CPTNumericData *)dataByConvertingToDataType:(CPTNumericDataType)newDat NSParameterAssert(myDataType.dataTypeFormat != CPTUndefinedDataType); NSParameterAssert(myDataType.byteOrder != CFByteOrderUnknown); - NSParameterAssert( CPTDataTypeIsSupported(newDataType) ); + NSParameterAssert(CPTDataTypeIsSupported(newDataType)); NSParameterAssert(newDataType.dataTypeFormat != CPTUndefinedDataType); NSParameterAssert(newDataType.byteOrder != CFByteOrderUnknown); NSData *newData = nil; CFByteOrder hostByteOrder = CFByteOrderGetCurrent(); - if ( CPTDataTypeEqualToDataType(myDataType, newDataType) ) { + if ( CPTDataTypeEqualToDataType(myDataType, newDataType)) { newData = self.data; } - else if ( ( myDataType.sampleBytes == sizeof(int8_t) ) && ( newDataType.sampleBytes == sizeof(int8_t) ) ) { + else if ((myDataType.sampleBytes == sizeof(int8_t)) && (newDataType.sampleBytes == sizeof(int8_t))) { newData = self.data; } else { @@ -105,7 +105,7 @@ case sizeof(int8_t): switch ( destDataType->sampleBytes ) { case sizeof(int8_t): { // int8_t -> int8_t - memcpy( destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(int8_t) ); + memcpy(destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(int8_t)); } break; @@ -281,7 +281,7 @@ case sizeof(int8_t): case sizeof(int16_t): { // int16_t -> int16_t - memcpy( destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(int16_t) ); + memcpy(destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(int16_t)); } break; @@ -457,7 +457,7 @@ case sizeof(int16_t): case sizeof(int32_t): { // int32_t -> int32_t - memcpy( destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(int32_t) ); + memcpy(destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(int32_t)); } break; @@ -633,7 +633,7 @@ case sizeof(int32_t): case sizeof(int64_t): { // int64_t -> int64_t - memcpy( destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(int64_t) ); + memcpy(destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(int64_t)); } break; } @@ -817,7 +817,7 @@ case sizeof(int64_t): switch ( destDataType->sampleBytes ) { case sizeof(uint8_t): { // uint8_t -> uint8_t - memcpy( destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(uint8_t) ); + memcpy(destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(uint8_t)); } break; @@ -993,7 +993,7 @@ case sizeof(uint8_t): case sizeof(uint16_t): { // uint16_t -> uint16_t - memcpy( destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(uint16_t) ); + memcpy(destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(uint16_t)); } break; @@ -1169,7 +1169,7 @@ case sizeof(uint16_t): case sizeof(uint32_t): { // uint32_t -> uint32_t - memcpy( destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(uint32_t) ); + memcpy(destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(uint32_t)); } break; @@ -1345,7 +1345,7 @@ case sizeof(uint32_t): case sizeof(uint64_t): { // uint64_t -> uint64_t - memcpy( destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(uint64_t) ); + memcpy(destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(uint64_t)); } break; } @@ -1529,7 +1529,7 @@ case sizeof(uint64_t): switch ( destDataType->sampleBytes ) { case sizeof(float): { // float -> float - memcpy( destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(float) ); + memcpy(destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(float)); } break; @@ -1705,7 +1705,7 @@ case sizeof(float): case sizeof(double): { // double -> double - memcpy( destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(double) ); + memcpy(destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(double)); } break; } @@ -1889,7 +1889,7 @@ case sizeof(double): switch ( destDataType->sampleBytes ) { case sizeof(float complex): { // float complex -> float complex - memcpy( destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(float complex) ); + memcpy(destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(float complex)); } break; @@ -1914,7 +1914,7 @@ case sizeof(NSDecimal): const float complex *lastSample = fromBytes + sampleCount; NSDecimal *toBytes = (NSDecimal *)destData.mutableBytes; while ( fromBytes < lastSample ) { - *toBytes++ = CPTDecimalFromFloat( crealf(*fromBytes++) ); + *toBytes++ = CPTDecimalFromFloat(crealf(*fromBytes++)); } } break; @@ -2065,7 +2065,7 @@ case sizeof(float complex): case sizeof(double complex): { // double complex -> double complex - memcpy( destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(double complex) ); + memcpy(destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(double complex)); } break; } @@ -2079,7 +2079,7 @@ case sizeof(NSDecimal): const double complex *lastSample = fromBytes + sampleCount; NSDecimal *toBytes = (NSDecimal *)destData.mutableBytes; while ( fromBytes < lastSample ) { - *toBytes++ = CPTDecimalFromDouble( creal(*fromBytes++) ); + *toBytes++ = CPTDecimalFromDouble(creal(*fromBytes++)); } } break; @@ -2249,7 +2249,7 @@ case sizeof(double complex): switch ( destDataType->sampleBytes ) { case sizeof(NSDecimal): { // NSDecimal -> NSDecimal - memcpy( destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(NSDecimal) ); + memcpy(destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(NSDecimal)); } break; } diff --git a/framework/Source/CPTNumericData.h b/framework/Source/CPTNumericData.h index 69002469e..0215482fc 100644 --- a/framework/Source/CPTNumericData.h +++ b/framework/Source/CPTNumericData.h @@ -58,7 +58,7 @@ /// @{ -(NSUInteger)sampleIndex:(NSUInteger)idx, ...; -(nullable const void *)samplePointer:(NSUInteger)sample NS_RETURNS_INNER_POINTER; --(nullable const void *)samplePointerAtIndex:(NSUInteger)idx, ...NS_RETURNS_INNER_POINTER; +-(nullable const void *)samplePointerAtIndex:(NSUInteger)idx, ... NS_RETURNS_INNER_POINTER; -(nullable NSNumber *)sampleValue:(NSUInteger)sample; -(nullable NSNumber *)sampleValueAtIndex:(NSUInteger)idx, ...; -(nonnull CPTNumberArray *)sampleArray; diff --git a/framework/Source/CPTNumericData.m b/framework/Source/CPTNumericData.m index 6bdaa640e..b8c5d1243 100644 --- a/framework/Source/CPTNumericData.m +++ b/framework/Source/CPTNumericData.m @@ -1,10 +1,10 @@ #import "CPTNumericData.h" +#import "complex.h" #import "CPTExceptions.h" #import "CPTMutableNumericData.h" #import "CPTNumericData+TypeConversion.h" #import "CPTUtilities.h" -#import "complex.h" /// @cond @interface CPTNumericData() @@ -341,7 +341,7 @@ -(nonnull instancetype)initWithData:(nonnull NSData *)newData shape:(nullable CPTNumberArray *)shapeArray dataOrder:(CPTDataOrder)order { - if ( (self = [super init]) ) { + if ((self = [super init])) { [self commonInitWithData:newData dataType:newDataType shape:shapeArray @@ -418,7 +418,7 @@ -(nonnull instancetype)initWithArray:(nonnull CPTNumberArray *)newData -(nonnull instancetype)init { return [self initWithData:[NSData data] - dataType:CPTDataType( CPTFloatingPointDataType, sizeof(double), CFByteOrderGetCurrent() ) + dataType:CPTDataType(CPTFloatingPointDataType, sizeof(double), CFByteOrderGetCurrent()) shape:nil]; } @@ -427,7 +427,7 @@ -(void)commonInitWithData:(nonnull NSData *)newData shape:(nullable CPTNumberArray *)shapeArray dataOrder:(CPTDataOrder)order { - NSParameterAssert( CPTDataTypeIsSupported(newDataType) ); + NSParameterAssert(CPTDataTypeIsSupported(newDataType)); self.data = newData; self.dataType = newDataType; @@ -511,21 +511,21 @@ -(void)setDataType:(CPTNumericDataType)newDataType { CPTNumericDataType oldDataType = dataType; - if ( CPTDataTypeEqualToDataType(oldDataType, newDataType) ) { + if ( CPTDataTypeEqualToDataType(oldDataType, newDataType)) { return; } - NSParameterAssert( CPTDataTypeIsSupported(newDataType) ); + NSParameterAssert(CPTDataTypeIsSupported(newDataType)); NSParameterAssert(newDataType.dataTypeFormat != CPTUndefinedDataType); NSParameterAssert(newDataType.byteOrder != CFByteOrderUnknown); dataType = newDataType; - if ( ( oldDataType.sampleBytes == sizeof(int8_t) ) && ( newDataType.sampleBytes == sizeof(int8_t) ) ) { + if ((oldDataType.sampleBytes == sizeof(int8_t)) && (newDataType.sampleBytes == sizeof(int8_t))) { return; } - if ( (oldDataType.dataTypeFormat != CPTUndefinedDataType) && (oldDataType.byteOrder != CFByteOrderUnknown) ) { + if ((oldDataType.dataTypeFormat != CPTUndefinedDataType) && (oldDataType.byteOrder != CFByteOrderUnknown)) { NSMutableData *myData = (NSMutableData *)self.data; CFByteOrder hostByteOrder = CFByteOrderGetCurrent(); @@ -582,7 +582,7 @@ -(void)setShape:(nonnull CPTNumberArray *)newShape * dimension of the data buffer, this method returns @ref NSNotFound. **/ -(NSUInteger)sampleIndex:(NSUInteger)idx, ... - { +{ va_list indices; va_start(indices, idx); @@ -669,11 +669,11 @@ case sizeof(double): case CPTComplexFloatingPointDataType: switch ( self.sampleBytes ) { case sizeof(float complex): - result = @( crealf(*(const float complex *)[self samplePointer:sample]) ); + result = @(crealf(*(const float complex *)[self samplePointer:sample])); break; case sizeof(double complex): - result = @( creal(*(const double complex *)[self samplePointer:sample]) ); + result = @(creal(*(const double complex *)[self samplePointer:sample])); break; } break; @@ -703,7 +703,7 @@ case sizeof(NSDecimal): * @float or @double before being wrapped in an instance of NSNumber. **/ -(NSNumber *)sampleValueAtIndex:(NSUInteger)idx, ... - { +{ NSUInteger newIndex; if ( self.numberOfDimensions > 1 ) { @@ -728,7 +728,7 @@ -(NSNumber *)sampleValueAtIndex:(NSUInteger)idx, ... -(nullable const void *)samplePointer:(NSUInteger)sample { if ( sample < self.numberOfSamples ) { - return (const void *)( (const char *)self.bytes + sample * self.sampleBytes ); + return (const void *)((const char *)self.bytes + sample * self.sampleBytes); } else { return NULL; @@ -741,7 +741,7 @@ -(nullable const void *)samplePointer:(NSUInteger)sample * @return A pointer to the sample or @NULL if any of the sample indices are out of bounds. **/ -(nullable const void *)samplePointerAtIndex:(NSUInteger)idx, ... - { +{ NSUInteger newIndex; if ( self.numberOfDimensions > 1 ) { @@ -802,9 +802,9 @@ -(NSUInteger)sampleIndex:(NSUInteger)idx indexList:(va_list)indexList NSUInteger newIndex = 0; if ( numDims > 1 ) { - NSUInteger *dims = calloc( numDims, sizeof(NSUInteger) ); - NSUInteger *dimProducts = calloc( numDims, sizeof(NSUInteger) ); - NSUInteger *indices = calloc( numDims, sizeof(NSUInteger) ); + NSUInteger *dims = calloc(numDims, sizeof(NSUInteger)); + NSUInteger *dimProducts = calloc(numDims, sizeof(NSUInteger)); + NSUInteger *indices = calloc(numDims, sizeof(NSUInteger)); NSUInteger argIndex = 0; indices[0] = idx; @@ -865,7 +865,7 @@ -(NSUInteger)sampleIndex:(NSUInteger)idx indexList:(va_list)indexList -(nonnull NSData *)dataFromArray:(nonnull CPTNumberArray *)newData dataType:(CPTNumericDataType)newDataType { - NSParameterAssert( CPTDataTypeIsSupported(newDataType) ); + NSParameterAssert(CPTDataTypeIsSupported(newDataType)); NSParameterAssert(newDataType.dataTypeFormat != CPTUndefinedDataType); NSParameterAssert(newDataType.dataTypeFormat != CPTComplexFloatingPointDataType); @@ -1085,7 +1085,7 @@ case sizeof(NSDecimal): // End of code generated with "CPTNumericData+TypeConversions_Generation.py" // ======================================================================== - if ( ( newDataType.byteOrder != CFByteOrderGetCurrent() ) && (newDataType.byteOrder != CFByteOrderUnknown) ) { + if ((newDataType.byteOrder != CFByteOrderGetCurrent()) && (newDataType.byteOrder != CFByteOrderUnknown)) { [self swapByteOrderForData:sampleData sampleSize:newDataType.sampleBytes]; } @@ -1177,7 +1177,7 @@ -(void)encodeWithCoder:(nonnull NSCoder *)encoder */ -(nullable instancetype)initWithCoder:(nonnull NSCoder *)decoder { - if ( (self = [super init]) ) { + if ((self = [super init])) { NSData *newData; CPTNumericDataType newDataType; CPTNumberArray *shapeArray; @@ -1186,9 +1186,9 @@ -(nullable instancetype)initWithCoder:(nonnull NSCoder *)decoder newData = [decoder decodeObjectOfClass:[NSData class] forKey:@"CPTNumericData.data"]; - newDataType = CPTDataType( (CPTDataTypeFormat)[decoder decodeIntegerForKey:@"CPTNumericData.dataType.dataTypeFormat"], - (size_t)[decoder decodeInt64ForKey:@"CPTNumericData.dataType.sampleBytes"], - (CFByteOrder)[decoder decodeInt64ForKey:@"CPTNumericData.dataType.byteOrder"] ); + newDataType = CPTDataType((CPTDataTypeFormat)[decoder decodeIntegerForKey:@"CPTNumericData.dataType.dataTypeFormat"], + (size_t)[decoder decodeInt64ForKey:@"CPTNumericData.dataType.sampleBytes"], + (CFByteOrder)[decoder decodeInt64ForKey:@"CPTNumericData.dataType.byteOrder"]); shapeArray = [decoder decodeObjectOfClasses:[NSSet setWithArray:@[[NSArray class], [NSNumber class]]] forKey:@"CPTNumericData.shape"]; diff --git a/framework/Source/CPTNumericDataTests.m b/framework/Source/CPTNumericDataTests.m index be2c41a27..26e0ca4c6 100644 --- a/framework/Source/CPTNumericDataTests.m +++ b/framework/Source/CPTNumericDataTests.m @@ -27,7 +27,7 @@ -(void)testNumberOfDimensionsGivesShapeCount NSMutableData *data = [NSMutableData dataWithLength:nElems * sizeof(float)]; CPTNumericData *nd = [[CPTNumericData alloc] initWithData:data - dataType:CPTDataType( CPTFloatingPointDataType, sizeof(float), NSHostByteOrder() ) + dataType:CPTDataType(CPTFloatingPointDataType, sizeof(float), NSHostByteOrder()) shape:shape]; XCTAssertEqual(nd.numberOfDimensions, nd.shape.count, @"numberOfDimensions == shape.count == 3"); @@ -63,7 +63,7 @@ -(void)testIllegalShapeRaisesException NSMutableData *data = [NSMutableData dataWithLength:nElems * sizeof(NSUInteger)]; XCTAssertThrowsSpecificNamed(testData = [[CPTNumericData alloc] initWithData:data - dataType:CPTDataType( CPTUnsignedIntegerDataType, sizeof(NSUInteger), NSHostByteOrder() ) + dataType:CPTDataType(CPTUnsignedIntegerDataType, sizeof(NSUInteger), NSHostByteOrder()) shape:shape], NSException, CPTNumericDataException, @@ -94,7 +94,7 @@ -(void)testBytesEqualDataBytes } CPTNumericData *nd = [[CPTNumericData alloc] initWithData:data - dataType:CPTDataType( CPTIntegerDataType, sizeof(NSInteger), NSHostByteOrder() ) + dataType:CPTDataType(CPTIntegerDataType, sizeof(NSInteger), NSHostByteOrder()) shape:nil]; NSData *expected = data; @@ -113,7 +113,7 @@ -(void)testArchivingRoundTrip } CPTNumericData *nd = [[CPTNumericData alloc] initWithData:data - dataType:CPTDataType( CPTFloatingPointDataType, sizeof(float), NSHostByteOrder() ) + dataType:CPTDataType(CPTFloatingPointDataType, sizeof(float), NSHostByteOrder()) shape:nil]; CPTNumericData *nd2 = [self archiveRoundTrip:nd]; @@ -140,7 +140,7 @@ -(void)testKeyedArchivingRoundTrip } CPTNumericData *nd = [[CPTNumericData alloc] initWithData:data - dataType:CPTDataType( CPTFloatingPointDataType, sizeof(float), NSHostByteOrder() ) + dataType:CPTDataType(CPTFloatingPointDataType, sizeof(float), NSHostByteOrder()) shape:nil]; CPTNumericData *nd2 = [self archiveRoundTrip:nd]; @@ -167,7 +167,7 @@ -(void)testNumberOfSamplesCorrectForDataType } CPTNumericData *nd = [[CPTNumericData alloc] initWithData:data - dataType:CPTDataType( CPTFloatingPointDataType, sizeof(float), NSHostByteOrder() ) + dataType:CPTDataType(CPTFloatingPointDataType, sizeof(float), NSHostByteOrder()) shape:nil]; XCTAssertEqual([nd numberOfSamples], nElems, @"numberOfSamples == nElems"); @@ -180,7 +180,7 @@ -(void)testNumberOfSamplesCorrectForDataType } nd = [[CPTNumericData alloc] initWithData:data - dataType:CPTDataType( CPTIntegerDataType, sizeof(char), NSHostByteOrder() ) + dataType:CPTDataType(CPTIntegerDataType, sizeof(char), NSHostByteOrder()) shape:nil]; XCTAssertEqual([nd numberOfSamples], nElems, @"numberOfSamples == nElems"); @@ -197,7 +197,7 @@ -(void)testDataTypeAccessorsCorrectForDataType } CPTNumericData *nd = [[CPTNumericData alloc] initWithData:data - dataType:CPTDataType( CPTFloatingPointDataType, sizeof(float), NSHostByteOrder() ) + dataType:CPTDataType(CPTFloatingPointDataType, sizeof(float), NSHostByteOrder()) shape:nil]; XCTAssertEqual([nd dataTypeFormat], CPTFloatingPointDataType, @"dataTypeFormat"); @@ -216,7 +216,7 @@ -(void)testConvertTypeConvertsType } CPTNumericData *fd = [[CPTNumericData alloc] initWithData:data - dataType:CPTDataType( CPTFloatingPointDataType, sizeof(float), NSHostByteOrder() ) + dataType:CPTDataType(CPTFloatingPointDataType, sizeof(float), NSHostByteOrder()) shape:nil]; CPTNumericData *dd = [fd dataByConvertingToType:CPTFloatingPointDataType @@ -225,7 +225,7 @@ -(void)testConvertTypeConvertsType const double *doubleSamples = (const double *)dd.data.bytes; for ( NSUInteger i = 0; i < numberOfSamples; i++ ) { - XCTAssertTrue( (double)samples[i] == doubleSamples[i], @"(float)%g != (double)%g", (double)samples[i], doubleSamples[i] ); + XCTAssertTrue((double)samples[i] == doubleSamples[i], @"(float)%g != (double)%g", (double)samples[i], doubleSamples[i]); } } @@ -240,12 +240,12 @@ -(void)testSamplePointerCorrect } CPTNumericData *fd = [[CPTNumericData alloc] initWithData:data - dataType:CPTDataType( CPTFloatingPointDataType, sizeof(float), NSHostByteOrder() ) + dataType:CPTDataType(CPTFloatingPointDataType, sizeof(float), NSHostByteOrder()) shape:nil]; - XCTAssertEqual( ( (const float *)[fd.data bytes] ) + 4, (const float *)[fd samplePointer:4], @"%p,%p", samples + 4, (const float *)[fd samplePointer:4] ); - XCTAssertEqual( ( (const float *)[fd.data bytes] ), (const float *)[fd samplePointer:0], @"" ); - XCTAssertEqual( ( (const float *)[fd.data bytes] ) + nElems - 1, (const float *)[fd samplePointer:nElems - 1], @"" ); + XCTAssertEqual(((const float *)[fd.data bytes]) + 4, (const float *)[fd samplePointer:4], @"%p,%p", samples + 4, (const float *)[fd samplePointer:4]); + XCTAssertEqual(((const float *)[fd.data bytes]), (const float *)[fd samplePointer:0], @""); + XCTAssertEqual(((const float *)[fd.data bytes]) + nElems - 1, (const float *)[fd samplePointer:nElems - 1], @""); XCTAssertNil([fd samplePointer:nElems], @"too many samples"); } @@ -260,7 +260,7 @@ -(void)testSampleValueCorrect } CPTNumericData *fd = [[CPTNumericData alloc] initWithData:data - dataType:CPTDataType( CPTFloatingPointDataType, sizeof(float), NSHostByteOrder() ) + dataType:CPTDataType(CPTFloatingPointDataType, sizeof(float), NSHostByteOrder()) shape:nil]; XCTAssertEqualWithAccuracy([[fd sampleValue:0] doubleValue], sin(0), 0.01, @"sample value"); @@ -280,16 +280,16 @@ -(void)testSampleIndexRowsFirstOrder } CPTNumericData *fd = [[CPTNumericData alloc] initWithData:data - dataType:CPTDataType( CPTFloatingPointDataType, sizeof(NSUInteger), NSHostByteOrder() ) + dataType:CPTDataType(CPTFloatingPointDataType, sizeof(NSUInteger), NSHostByteOrder()) shape:@[@(rows), @(cols)] dataOrder:CPTDataOrderRowsFirst]; - XCTAssertEqual( ([fd sampleIndex:rows, 0]), (NSUInteger)NSNotFound, @"row index out of range" ); - XCTAssertEqual( ([fd sampleIndex:0, cols]), (NSUInteger)NSNotFound, @"column index out of range" ); + XCTAssertEqual(([fd sampleIndex:rows, 0]), (NSUInteger)NSNotFound, @"row index out of range"); + XCTAssertEqual(([fd sampleIndex:0, cols]), (NSUInteger)NSNotFound, @"column index out of range"); for ( NSUInteger i = 0; i < rows; i++ ) { for ( NSUInteger j = 0; j < cols; j++ ) { - XCTAssertEqual( ([fd sampleIndex:i, j]), i * cols + j, @"(%lu, %lu)", (unsigned long)i, (unsigned long)j ); + XCTAssertEqual(([fd sampleIndex:i, j]), i * cols + j, @"(%lu, %lu)", (unsigned long)i, (unsigned long)j); } } } @@ -307,16 +307,16 @@ -(void)testSampleIndexColumnsFirstOrder } CPTNumericData *fd = [[CPTNumericData alloc] initWithData:data - dataType:CPTDataType( CPTFloatingPointDataType, sizeof(NSUInteger), NSHostByteOrder() ) + dataType:CPTDataType(CPTFloatingPointDataType, sizeof(NSUInteger), NSHostByteOrder()) shape:@[@(rows), @(cols)] dataOrder:CPTDataOrderColumnsFirst]; - XCTAssertEqual( ([fd sampleIndex:rows, 0]), (NSUInteger)NSNotFound, @"row index out of range" ); - XCTAssertEqual( ([fd sampleIndex:0, cols]), (NSUInteger)NSNotFound, @"column index out of range" ); + XCTAssertEqual(([fd sampleIndex:rows, 0]), (NSUInteger)NSNotFound, @"row index out of range"); + XCTAssertEqual(([fd sampleIndex:0, cols]), (NSUInteger)NSNotFound, @"column index out of range"); for ( NSUInteger i = 0; i < rows; i++ ) { for ( NSUInteger j = 0; j < cols; j++ ) { - XCTAssertEqual( ([fd sampleIndex:i, j]), i + j * rows, @"(%lu, %lu)", (unsigned long)i, (unsigned long)j ); + XCTAssertEqual(([fd sampleIndex:i, j]), i + j * rows, @"(%lu, %lu)", (unsigned long)i, (unsigned long)j); } } } diff --git a/framework/Source/CPTNumericDataType.h b/framework/Source/CPTNumericDataType.h index 51d9017bc..0898f7b60 100644 --- a/framework/Source/CPTNumericDataType.h +++ b/framework/Source/CPTNumericDataType.h @@ -16,7 +16,7 @@ typedef NS_ENUM (NSInteger, CPTDataTypeFormat) { * @brief Enumeration of memory arrangements for multi-dimensional data arrays. * @see See Wikipedia for more information. **/ -typedef NS_ENUM (NSInteger, CPTDataOrder) { +typedef NS_CLOSED_ENUM(NSInteger, CPTDataOrder) { CPTDataOrderRowsFirst, ///< Numeric data is arranged in row-major order. CPTDataOrderColumnsFirst ///< Numeric data is arranged in column-major order. }; @@ -26,8 +26,8 @@ typedef NS_ENUM (NSInteger, CPTDataOrder) { **/ typedef struct _CPTNumericDataType { CPTDataTypeFormat dataTypeFormat; ///< Data type format - size_t sampleBytes; ///< Number of bytes in each sample - CFByteOrder byteOrder; ///< Byte order + size_t sampleBytes; ///< Number of bytes in each sample + CFByteOrder byteOrder; ///< Byte order } CPTNumericDataType; diff --git a/framework/Source/CPTNumericDataType.m b/framework/Source/CPTNumericDataType.m index 6ba0daa5a..af098066e 100644 --- a/framework/Source/CPTNumericDataType.m +++ b/framework/Source/CPTNumericDataType.m @@ -161,14 +161,14 @@ case sizeof(double): case sizeof(float complex): case sizeof(double complex): // only the native byte order is supported - valid = ( format.byteOrder == CFByteOrderGetCurrent() ); + valid = (format.byteOrder == CFByteOrderGetCurrent()); break; } break; case CPTDecimalDataType: // only the native byte order is supported - valid = ( format.sampleBytes == sizeof(NSDecimal) ) && ( format.byteOrder == CFByteOrderGetCurrent() ); + valid = (format.sampleBytes == sizeof(NSDecimal)) && (format.byteOrder == CFByteOrderGetCurrent()); break; } diff --git a/framework/Source/CPTNumericDataTypeConversionPerformanceTests.m b/framework/Source/CPTNumericDataTypeConversionPerformanceTests.m index e30e9214a..431999fcf 100644 --- a/framework/Source/CPTNumericDataTypeConversionPerformanceTests.m +++ b/framework/Source/CPTNumericDataTypeConversionPerformanceTests.m @@ -17,7 +17,7 @@ -(void)testFloatToDoubleConversion } CPTNumericData *floatNumericData = [[CPTNumericData alloc] initWithData:data - dataType:CPTDataType( CPTFloatingPointDataType, sizeof(float), CFByteOrderGetCurrent() ) + dataType:CPTDataType(CPTFloatingPointDataType, sizeof(float), CFByteOrderGetCurrent()) shape:nil]; __block CPTNumericData *doubleNumericData = nil; @@ -37,7 +37,7 @@ -(void)testDoubleToFloatConversion } CPTNumericData *doubleNumericData = [[CPTNumericData alloc] initWithData:data - dataType:CPTDataType( CPTFloatingPointDataType, sizeof(double), CFByteOrderGetCurrent() ) + dataType:CPTDataType(CPTFloatingPointDataType, sizeof(double), CFByteOrderGetCurrent()) shape:nil]; __block CPTNumericData *floatNumericData = nil; @@ -57,7 +57,7 @@ -(void)testIntegerToDoubleConversion } CPTNumericData *integerNumericData = [[CPTNumericData alloc] initWithData:data - dataType:CPTDataType( CPTIntegerDataType, sizeof(NSInteger), CFByteOrderGetCurrent() ) + dataType:CPTDataType(CPTIntegerDataType, sizeof(NSInteger), CFByteOrderGetCurrent()) shape:nil]; __block CPTNumericData *doubleNumericData = nil; @@ -77,7 +77,7 @@ -(void)testDoubleToIntegerConversion } CPTNumericData *doubleNumericData = [[CPTNumericData alloc] initWithData:data - dataType:CPTDataType( CPTFloatingPointDataType, sizeof(double), CFByteOrderGetCurrent() ) + dataType:CPTDataType(CPTFloatingPointDataType, sizeof(double), CFByteOrderGetCurrent()) shape:nil]; __block CPTNumericData *integerNumericData = nil; diff --git a/framework/Source/CPTNumericDataTypeConversionTests.m b/framework/Source/CPTNumericDataTypeConversionTests.m index 898559d8f..8fc215339 100644 --- a/framework/Source/CPTNumericDataTypeConversionTests.m +++ b/framework/Source/CPTNumericDataTypeConversionTests.m @@ -18,7 +18,7 @@ -(void)testFloatToDoubleConversion } CPTNumericData *fd = [[CPTNumericData alloc] initWithData:data - dataType:CPTDataType( CPTFloatingPointDataType, sizeof(float), NSHostByteOrder() ) + dataType:CPTDataType(CPTFloatingPointDataType, sizeof(float), NSHostByteOrder()) shape:nil]; CPTNumericData *dd = [fd dataByConvertingToType:CPTFloatingPointDataType @@ -27,7 +27,7 @@ -(void)testFloatToDoubleConversion const double *doubleSamples = (const double *)dd.data.bytes; for ( NSUInteger i = 0; i < numberOfSamples; i++ ) { - XCTAssertEqualWithAccuracy( (double)samples[i], doubleSamples[i], precision, @"(float)%g != (double)%g", (double)samples[i], doubleSamples[i] ); + XCTAssertEqualWithAccuracy((double)samples[i], doubleSamples[i], precision, @"(float)%g != (double)%g", (double)samples[i], doubleSamples[i]); } } @@ -41,7 +41,7 @@ -(void)testDoubleToFloatConversion } CPTNumericData *dd = [[CPTNumericData alloc] initWithData:data - dataType:CPTDataType( CPTFloatingPointDataType, sizeof(double), NSHostByteOrder() ) + dataType:CPTDataType(CPTFloatingPointDataType, sizeof(double), NSHostByteOrder()) shape:nil]; CPTNumericData *fd = [dd dataByConvertingToType:CPTFloatingPointDataType @@ -50,7 +50,7 @@ -(void)testDoubleToFloatConversion const float *floatSamples = (const float *)fd.data.bytes; for ( NSUInteger i = 0; i < numberOfSamples; i++ ) { - XCTAssertEqualWithAccuracy( (double)floatSamples[i], samples[i], precision, @"(float)%g != (double)%g", (double)floatSamples[i], samples[i] ); + XCTAssertEqualWithAccuracy((double)floatSamples[i], samples[i], precision, @"(float)%g != (double)%g", (double)floatSamples[i], samples[i]); } } @@ -64,7 +64,7 @@ -(void)testFloatToIntegerConversion } CPTNumericData *fd = [[CPTNumericData alloc] initWithData:data - dataType:CPTDataType( CPTFloatingPointDataType, sizeof(float), NSHostByteOrder() ) + dataType:CPTDataType(CPTFloatingPointDataType, sizeof(float), NSHostByteOrder()) shape:nil]; CPTNumericData *intData = [fd dataByConvertingToType:CPTIntegerDataType @@ -73,7 +73,7 @@ -(void)testFloatToIntegerConversion const NSInteger *intSamples = (const NSInteger *)intData.data.bytes; for ( NSUInteger i = 0; i < numberOfSamples; i++ ) { - XCTAssertEqualWithAccuracy( (NSInteger)samples[i], intSamples[i], precision, @"(float)%g != (NSInteger)%ld", (double)samples[i], (long)intSamples[i] ); + XCTAssertEqualWithAccuracy((NSInteger)samples[i], intSamples[i], precision, @"(float)%g != (NSInteger)%ld", (double)samples[i], (long)intSamples[i]); } } @@ -87,7 +87,7 @@ -(void)testIntegerToFloatConversion } CPTNumericData *intData = [[CPTNumericData alloc] initWithData:data - dataType:CPTDataType( CPTIntegerDataType, sizeof(NSInteger), NSHostByteOrder() ) + dataType:CPTDataType(CPTIntegerDataType, sizeof(NSInteger), NSHostByteOrder()) shape:nil]; CPTNumericData *fd = [intData dataByConvertingToType:CPTFloatingPointDataType @@ -136,11 +136,11 @@ -(void)testDecimalToDoubleConversion NSDecimal *samples = (NSDecimal *)data.mutableBytes; for ( NSUInteger i = 0; i < numberOfSamples; i++ ) { - samples[i] = CPTDecimalFromDouble( sin(i) ); + samples[i] = CPTDecimalFromDouble(sin(i)); } CPTNumericData *decimalData = [[CPTNumericData alloc] initWithData:data - dataType:CPTDataType( CPTDecimalDataType, sizeof(NSDecimal), NSHostByteOrder() ) + dataType:CPTDataType(CPTDecimalDataType, sizeof(NSDecimal), NSHostByteOrder()) shape:nil]; CPTNumericData *doubleData = [decimalData dataByConvertingToType:CPTFloatingPointDataType @@ -163,7 +163,7 @@ -(void)testDoubleToDecimalConversion } CPTNumericData *doubleData = [[CPTNumericData alloc] initWithData:data - dataType:CPTDataType( CPTFloatingPointDataType, sizeof(double), NSHostByteOrder() ) + dataType:CPTDataType(CPTFloatingPointDataType, sizeof(double), NSHostByteOrder()) shape:nil]; CPTNumericData *decimalData = [doubleData dataByConvertingToType:CPTDecimalDataType @@ -172,7 +172,7 @@ -(void)testDoubleToDecimalConversion const NSDecimal *decimalSamples = (const NSDecimal *)decimalData.data.bytes; for ( NSUInteger i = 0; i < numberOfSamples; i++ ) { - XCTAssertTrue(CPTDecimalEquals( decimalSamples[i], CPTDecimalFromDouble(samples[i]) ), @"(NSDecimal)%@ != (double)%g", CPTDecimalStringValue(decimalSamples[i]), samples[i]); + XCTAssertTrue(CPTDecimalEquals(decimalSamples[i], CPTDecimalFromDouble(samples[i])), @"(NSDecimal)%@ != (double)%g", CPTDecimalStringValue(decimalSamples[i]), samples[i]); } } @@ -196,7 +196,7 @@ -(void)testTypeConversionSwapsByteOrderDouble uint64_t end = *(const uint64_t *)swappedData.bytes; union swap { - double v; + double v; CFSwappedFloat64 sv; } result; @@ -220,7 +220,7 @@ -(void)testRoundTripToDoubleArray for ( NSUInteger i = 0; i < numberOfSamples; i++ ) { samples[i] = sin(i); } - CPTNumericDataType theDataType = CPTDataType( CPTFloatingPointDataType, sizeof(double), NSHostByteOrder() ); + CPTNumericDataType theDataType = CPTDataType(CPTFloatingPointDataType, sizeof(double), NSHostByteOrder()); CPTNumericData *doubleData = [[CPTNumericData alloc] initWithData:data dataType:theDataType @@ -248,7 +248,7 @@ -(void)testRoundTripToIntegerArray for ( NSUInteger i = 0; i < numberOfSamples; i++ ) { samples[i] = (NSInteger)(sin(i) * 1000.0); } - CPTNumericDataType theDataType = CPTDataType( CPTIntegerDataType, sizeof(NSInteger), NSHostByteOrder() ); + CPTNumericDataType theDataType = CPTDataType(CPTIntegerDataType, sizeof(NSInteger), NSHostByteOrder()); CPTNumericData *intData = [[CPTNumericData alloc] initWithData:data dataType:theDataType @@ -274,9 +274,9 @@ -(void)testRoundTripToDecimalArray NSDecimal *samples = (NSDecimal *)data.mutableBytes; for ( NSUInteger i = 0; i < numberOfSamples; i++ ) { - samples[i] = CPTDecimalFromDouble( sin(i) ); + samples[i] = CPTDecimalFromDouble(sin(i)); } - CPTNumericDataType theDataType = CPTDataType( CPTDecimalDataType, sizeof(NSDecimal), NSHostByteOrder() ); + CPTNumericDataType theDataType = CPTDataType(CPTDecimalDataType, sizeof(NSDecimal), NSHostByteOrder()); CPTNumericData *decimalData = [[CPTNumericData alloc] initWithData:data dataType:theDataType diff --git a/framework/Source/CPTPathExtensions.m b/framework/Source/CPTPathExtensions.m index 245c942ac..fbd20d904 100644 --- a/framework/Source/CPTPathExtensions.m +++ b/framework/Source/CPTPathExtensions.m @@ -10,10 +10,10 @@ **/ __nonnull CGPathRef CPTCreateRoundedRectPath(CGRect rect, CGFloat cornerRadius) { - if ( cornerRadius > CPTFloat(0.0) ) { - cornerRadius = MIN( MIN( cornerRadius, rect.size.width * CPTFloat(0.5) ), rect.size.height * CPTFloat(0.5) ); + if ( cornerRadius > CPTFloat(0.0)) { + cornerRadius = MIN(MIN(cornerRadius, rect.size.width * CPTFloat(0.5)), rect.size.height * CPTFloat(0.5)); - // CGPathCreateWithRoundedRect() is available in Mac OS X 10.9 and iOS 7 but not marked in the header file + // CGPathCreateWithRoundedRect() is available in macOS 10.9 and iOS 7 but not marked in the header file #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wunreachable-code" #pragma clang diagnostic ignored "-Wpointer-bool-conversion" diff --git a/framework/Source/CPTPieChart.h b/framework/Source/CPTPieChart.h index 1ff0d9587..3d568bb59 100644 --- a/framework/Source/CPTPieChart.h +++ b/framework/Source/CPTPieChart.h @@ -9,11 +9,16 @@ @class CPTTextLayer; @class CPTLineStyle; +/** + * @brief Pie chart bindings. + **/ +typedef NSString *CPTPieChartBinding cpt_swift_struct; + /// @ingroup plotBindingsPieChart /// @{ -extern NSString *__nonnull const CPTPieChartBindingPieSliceWidthValues; -extern NSString *__nonnull const CPTPieChartBindingPieSliceFills; -extern NSString *__nonnull const CPTPieChartBindingPieSliceRadialOffsets; +extern CPTPieChartBinding __nonnull const CPTPieChartBindingPieSliceWidthValues; +extern CPTPieChartBinding __nonnull const CPTPieChartBindingPieSliceFills; +extern CPTPieChartBinding __nonnull const CPTPieChartBindingPieSliceRadialOffsets; /// @} /** @@ -28,7 +33,7 @@ typedef NS_ENUM (NSInteger, CPTPieChartField) { /** * @brief Enumeration of pie slice drawing directions. **/ -typedef NS_ENUM (NSInteger, CPTPieDirection) { +typedef NS_CLOSED_ENUM(NSInteger, CPTPieDirection) { CPTPieDirectionClockwise, ///< Pie slices are drawn in a clockwise direction. CPTPieDirectionCounterClockwise ///< Pie slices are drawn in a counter-clockwise direction. }; diff --git a/framework/Source/CPTPieChart.m b/framework/Source/CPTPieChart.m index b63f7c6a6..83bbda7c8 100644 --- a/framework/Source/CPTPieChart.m +++ b/framework/Source/CPTPieChart.m @@ -25,9 +25,9 @@ * @endif **/ -NSString *const CPTPieChartBindingPieSliceWidthValues = @"sliceWidths"; ///< Pie slice widths. -NSString *const CPTPieChartBindingPieSliceFills = @"sliceFills"; ///< Pie slice interior fills. -NSString *const CPTPieChartBindingPieSliceRadialOffsets = @"sliceRadialOffsets"; ///< Pie slice radial offsets. +CPTPieChartBinding const CPTPieChartBindingPieSliceWidthValues = @"sliceWidths"; ///< Pie slice widths. +CPTPieChartBinding const CPTPieChartBindingPieSliceFills = @"sliceFills"; ///< Pie slice interior fills. +CPTPieChartBinding const CPTPieChartBindingPieSliceRadialOffsets = @"sliceRadialOffsets"; ///< Pie slice radial offsets. /// @cond @interface CPTPieChart() @@ -42,7 +42,7 @@ -(CGFloat)radiansForPieSliceValue:(CGFloat)pieSliceValue; -(CGFloat)normalizedPosition:(CGFloat)rawPosition; -(BOOL)angle:(CGFloat)touchedAngle betweenStartAngle:(CGFloat)startingAngle endAngle:(CGFloat)endingAngle; --(void)addSliceToPath:(nonnull CGMutablePathRef)slicePath centerPoint:(CGPoint)center startingAngle:(CGFloat)startingAngle finishingAngle:(CGFloat)finishingAngle; +-(void)addSliceToPath:(nonnull CGMutablePathRef)slicePath centerPoint:(CGPoint)center startingAngle:(CGFloat)startingAngle finishingAngle:(CGFloat)finishingAngle width:(CGFloat)currentWidth; -(nullable CPTFill *)sliceFillForIndex:(NSUInteger)idx; @end @@ -160,9 +160,9 @@ @implementation CPTPieChart +(nonnull CPTColor *)defaultPieSliceColorForIndex:(NSUInteger)pieSliceIndex { - return [CPTColor colorWithComponentRed:( colorLookupTable[pieSliceIndex % 10][0] + (CGFloat)(pieSliceIndex / 10) * CPTFloat(0.1) ) - green:( colorLookupTable[pieSliceIndex % 10][1] + (CGFloat)(pieSliceIndex / 10) * CPTFloat(0.1) ) - blue:( colorLookupTable[pieSliceIndex % 10][2] + (CGFloat)(pieSliceIndex / 10) * CPTFloat(0.1) ) + return [CPTColor colorWithComponentRed:(colorLookupTable[pieSliceIndex % 10][0] + (CGFloat)(pieSliceIndex / 10) * CPTFloat(0.1)) + green:(colorLookupTable[pieSliceIndex % 10][1] + (CGFloat)(pieSliceIndex / 10) * CPTFloat(0.1)) + blue:(colorLookupTable[pieSliceIndex % 10][2] + (CGFloat)(pieSliceIndex / 10) * CPTFloat(0.1)) alpha:CPTFloat(1.0)]; } @@ -181,6 +181,7 @@ +(void)initialize [self exposeBinding:CPTPieChartBindingPieSliceRadialOffsets]; } } + #endif /// @endcond @@ -208,8 +209,8 @@ +(void)initialize **/ -(nonnull instancetype)initWithFrame:(CGRect)newFrame { - if ( (self = [super initWithFrame:newFrame]) ) { - pieRadius = CPTFloat(0.8) * ( MIN(newFrame.size.width, newFrame.size.height) / CPTFloat(2.0) ); + if ((self = [super initWithFrame:newFrame])) { + pieRadius = CPTFloat(0.8) * (MIN(newFrame.size.width, newFrame.size.height) / CPTFloat(2.0)); pieInnerRadius = CPTFloat(0.0); startAngle = CPTFloat(M_PI_2); // pi/2 endAngle = CPTNAN; @@ -232,7 +233,7 @@ -(nonnull instancetype)initWithFrame:(CGRect)newFrame -(nonnull instancetype)initWithLayer:(nonnull id)layer { - if ( (self = [super initWithLayer:layer]) ) { + if ((self = [super initWithLayer:layer])) { CPTPieChart *theLayer = (CPTPieChart *)layer; pieRadius = theLayer->pieRadius; @@ -276,7 +277,7 @@ -(void)encodeWithCoder:(nonnull NSCoder *)coder -(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super initWithCoder:coder]) ) { + if ((self = [super initWithCoder:coder])) { pieRadius = [coder decodeCGFloatForKey:@"CPTPieChart.pieRadius"]; pieInnerRadius = [coder decodeCGFloatForKey:@"CPTPieChart.pieInnerRadius"]; startAngle = [coder decodeCGFloatForKey:@"CPTPieChart.startAngle"]; @@ -384,12 +385,12 @@ -(void)updateNormalizedData const double *dataEnd = dataBytes + sampleCount; while ( dataBytes < dataEnd ) { double currentWidth = *dataBytes++; - if ( !isnan(currentWidth) ) { + if ( !isnan(currentWidth)) { valueSum += currentWidth; } } - CPTNumericDataType dataType = CPTDataType( CPTFloatingPointDataType, sizeof(double), CFByteOrderGetCurrent() ); + CPTNumericDataType dataType = CPTDataType(CPTFloatingPointDataType, sizeof(double), CFByteOrderGetCurrent()); CPTMutableNumericData *normalizedSliceValues = [[CPTMutableNumericData alloc] initWithData:[NSData data] dataType:dataType shape:nil]; normalizedSliceValues.shape = @[@(sampleCount)]; @@ -403,7 +404,7 @@ -(void)updateNormalizedData double *cumulativeBytes = cumulativeSliceValues.mutableBytes; while ( dataBytes < dataEnd ) { double currentWidth = *dataBytes++; - if ( isnan(currentWidth) ) { + if ( isnan(currentWidth)) { *normalizedBytes++ = (double)NAN; } else { @@ -421,12 +422,12 @@ -(void)updateNormalizedData const NSDecimal *dataEnd = dataBytes + sampleCount; while ( dataBytes < dataEnd ) { NSDecimal currentWidth = *dataBytes++; - if ( !NSDecimalIsNotANumber(¤tWidth) ) { + if ( !NSDecimalIsNotANumber(¤tWidth)) { valueSum = CPTDecimalAdd(valueSum, currentWidth); } } - CPTNumericDataType dataType = CPTDataType( CPTDecimalDataType, sizeof(NSDecimal), CFByteOrderGetCurrent() ); + CPTNumericDataType dataType = CPTDataType(CPTDecimalDataType, sizeof(NSDecimal), CFByteOrderGetCurrent()); CPTMutableNumericData *normalizedSliceValues = [[CPTMutableNumericData alloc] initWithData:[NSData data] dataType:dataType shape:nil]; normalizedSliceValues.shape = @[@(sampleCount)]; @@ -441,7 +442,7 @@ -(void)updateNormalizedData NSDecimal *cumulativeBytes = cumulativeSliceValues.mutableBytes; while ( dataBytes < dataEnd ) { NSDecimal currentWidth = *dataBytes++; - if ( NSDecimalIsNotANumber(¤tWidth) ) { + if ( NSDecimalIsNotANumber(¤tWidth)) { *normalizedBytes++ = decimalNAN; } else { @@ -596,7 +597,7 @@ -(void)renderAsVectorInContext:(nonnull CGContextRef)context BOOL hasNonZeroOffsets = NO; CPTNumberArray *offsetArray = [self cachedArrayForKey:CPTPieChartBindingPieSliceRadialOffsets]; for ( NSNumber *offset in offsetArray ) { - if ( [offset cgFloatValue] != CPTFloat(0.0) ) { + if ( [offset cgFloatValue] != CPTFloat(0.0)) { hasNonZeroOffsets = YES; break; } @@ -606,7 +607,7 @@ -(void)renderAsVectorInContext:(nonnull CGContextRef)context if ( overlay && hasNonZeroOffsets ) { CGFloat radius = self.pieRadius + borderStyle.lineWidth * CPTFloat(0.5); - bounds = CPTRectMake( centerPoint.x - radius, centerPoint.y - radius, radius * CPTFloat(2.0), radius * CPTFloat(2.0) ); + bounds = CPTRectMake(centerPoint.x - radius, centerPoint.y - radius, radius * CPTFloat(2.0), radius * CPTFloat(2.0)); } else { bounds = CGRectZero; @@ -618,7 +619,7 @@ -(void)renderAsVectorInContext:(nonnull CGContextRef)context while ( currentIndex < sampleCount ) { CGFloat currentWidth = (CGFloat)[self cachedDoubleForField:CPTPieChartFieldSliceWidthNormalized recordIndex:currentIndex]; - if ( !isnan(currentWidth) ) { + if ( !isnan(currentWidth)) { CGFloat radialOffset = [(NSNumber *) offsetArray[currentIndex] cgFloatValue]; // draw slice @@ -630,7 +631,7 @@ -(void)renderAsVectorInContext:(nonnull CGContextRef)context CGFloat xOffset = CPTFloat(0.0); CGFloat yOffset = CPTFloat(0.0); CGPoint center = centerPoint; - if ( radialOffset != CPTFloat(0.0) ) { + if ( radialOffset != CPTFloat(0.0)) { CGFloat medianAngle = CPTFloat(0.5) * (startingAngle + finishingAngle); xOffset = cos(medianAngle) * radialOffset; yOffset = sin(medianAngle) * radialOffset; @@ -643,8 +644,7 @@ -(void)renderAsVectorInContext:(nonnull CGContextRef)context } CGMutablePathRef slicePath = CGPathCreateMutable(); - [self addSliceToPath:slicePath centerPoint:center startingAngle:startingAngle finishingAngle:finishingAngle]; - CGPathCloseSubpath(slicePath); + [self addSliceToPath:slicePath centerPoint:center startingAngle:startingAngle finishingAngle:finishingAngle width:currentWidth]; CPTFill *currentFill = [self sliceFillForIndex:currentIndex]; if ( [currentFill isKindOfClass:fillClass] ) { @@ -689,7 +689,7 @@ -(void)renderAsVectorInContext:(nonnull CGContextRef)context CGMutablePathRef fillPath = CGPathCreateMutable(); CGFloat innerRadius = self.pieInnerRadius; - if ( innerRadius > CPTFloat(0.0) ) { + if ( innerRadius > CPTFloat(0.0)) { CGPathAddArc(fillPath, NULL, centerPoint.x, centerPoint.y, self.pieRadius, CPTFloat(0.0), CPTFloat(2.0 * M_PI), false); CGPathAddArc(fillPath, NULL, centerPoint.x, centerPoint.y, innerRadius, CPTFloat(2.0 * M_PI), CPTFloat(0.0), true); } @@ -724,29 +724,42 @@ -(CGFloat)radiansForPieSliceValue:(CGFloat)pieSliceValue angle += pieSliceValue * pieRange; break; } - return fmod(angle, 2.0 * M_PI); + return isnan(endingAngle) ? angle : fmod(angle, CPTFloat(2.0 * M_PI)); } --(void)addSliceToPath:(nonnull CGMutablePathRef)slicePath centerPoint:(CGPoint)center startingAngle:(CGFloat)startingAngle finishingAngle:(CGFloat)finishingAngle +-(void)addSliceToPath:(nonnull CGMutablePathRef)slicePath centerPoint:(CGPoint)center startingAngle:(CGFloat)startingAngle finishingAngle:(CGFloat)finishingAngle width:(CGFloat)currentWidth { bool direction = (self.sliceDirection == CPTPieDirectionClockwise) ? true : false; + CGFloat outerRadius = self.pieRadius; CGFloat innerRadius = self.pieInnerRadius; - if ( innerRadius > CPTFloat(0.0) ) { - CGPathAddArc(slicePath, NULL, center.x, center.y, self.pieRadius, startingAngle, finishingAngle, direction); - CGPathAddArc(slicePath, NULL, center.x, center.y, innerRadius, finishingAngle, startingAngle, !direction); + if ( innerRadius > CPTFloat(0.0)) { + if ( currentWidth >= CPTFloat(1.0)) { + CGPathAddArc(slicePath, NULL, center.x, center.y, outerRadius, startingAngle, startingAngle + CPTFloat(2.0 * M_PI), direction); + CGPathAddArc(slicePath, NULL, center.x, center.y, innerRadius, startingAngle + CPTFloat(2.0 * M_PI), startingAngle, !direction); + } + else { + CGPathAddArc(slicePath, NULL, center.x, center.y, outerRadius, startingAngle, finishingAngle, direction); + CGPathAddArc(slicePath, NULL, center.x, center.y, innerRadius, finishingAngle, startingAngle, !direction); + } } else { - CGPathMoveToPoint(slicePath, NULL, center.x, center.y); - CGPathAddArc(slicePath, NULL, center.x, center.y, self.pieRadius, startingAngle, finishingAngle, direction); + if ( currentWidth >= CPTFloat(1.0)) { + CGPathAddEllipseInRect(slicePath, NULL, CGRectMake(center.x - outerRadius, center.y - outerRadius, outerRadius * CPTFloat(2.0), outerRadius * CPTFloat(2.0))); + } + else { + CGPathMoveToPoint(slicePath, NULL, center.x, center.y); + CGPathAddArc(slicePath, NULL, center.x, center.y, outerRadius, startingAngle, finishingAngle, direction); + } } + CGPathCloseSubpath(slicePath); } -(nullable CPTFill *)sliceFillForIndex:(NSUInteger)idx { CPTFill *currentFill = [self cachedValueForKey:CPTPieChartBindingPieSliceFills recordIndex:idx]; - if ( (currentFill == nil) || (currentFill == [CPTPlot nilData]) ) { + if ((currentFill == nil) || (currentFill == [CPTPlot nilData])) { currentFill = [CPTFill fillWithColor:[CPTPieChart defaultPieSliceColorForIndex:idx]]; } @@ -800,7 +813,7 @@ -(NSUInteger)pieSliceIndexAtAngle:(CGFloat)angle // of that pie slice. for ( NSUInteger currentIndex = 0; currentIndex < self.cachedDataCount; currentIndex++ ) { CGFloat width = CPTFloat([self cachedDoubleForField:CPTPieChartFieldSliceWidthNormalized recordIndex:currentIndex]); - if ( isnan(width) ) { + if ( isnan(width)) { continue; } CGFloat endingAngle = startingAngle; @@ -845,7 +858,7 @@ -(CGFloat)medianAngleForPieSliceIndex:(NSUInteger)idx CGFloat currentWidth = CPTFloat([self cachedDoubleForField:CPTPieChartFieldSliceWidthNormalized recordIndex:currentIndex]); // If the slice index is a match... - if ( !isnan(currentWidth) && (idx == currentIndex) ) { + if ( !isnan(currentWidth) && (idx == currentIndex)) { // Compute and return the angle that is halfway between the slice's starting and ending angles CGFloat startingAngle = [self radiansForPieSliceValue:startingWidth]; CGFloat finishingAngle = [self radiansForPieSliceValue:startingWidth + currentWidth]; @@ -927,7 +940,7 @@ -(void)positionLabelAnnotation:(nonnull CPTPlotSpaceAnnotation *)label forIndex: label.anchorPlotPoint = @[xValue, yValue]; CGFloat currentWidth = (CGFloat)[self cachedDoubleForField:CPTPieChartFieldSliceWidthNormalized recordIndex:idx]; - if ( self.hidden || isnan(currentWidth) ) { + if ( self.hidden || isnan(currentWidth)) { contentLayer.hidden = YES; } else { @@ -940,11 +953,11 @@ -(void)positionLabelAnnotation:(nonnull CPTPlotSpaceAnnotation *)label forIndex: } CGFloat labelAngle = [self radiansForPieSliceValue:startingWidth + currentWidth / CPTFloat(2.0)]; - label.displacement = CPTPointMake( labelRadius * cos(labelAngle), labelRadius * sin(labelAngle) ); + label.displacement = CPTPointMake(labelRadius * cos(labelAngle), labelRadius * sin(labelAngle)); if ( self.labelRotationRelativeToRadius ) { CGFloat rotation = [self normalizedPosition:self.labelRotation + labelAngle]; - if ( ( rotation > CPTFloat(0.25) ) && ( rotation < CPTFloat(0.75) ) ) { + if ((rotation > CPTFloat(0.25)) && (rotation < CPTFloat(0.75))) { rotation -= CPTFloat(0.5); } @@ -1031,8 +1044,8 @@ -(CGFloat)normalizedPosition:(CGFloat)rawPosition CGFloat result = rawPosition; result /= (CGFloat)(2.0 * M_PI); - result = fmod( result, CPTFloat(1.0) ); - if ( result < CPTFloat(0.0) ) { + result = fmod(result, CPTFloat(1.0)); + if ( result < CPTFloat(0.0)) { result += CPTFloat(1.0); } @@ -1043,19 +1056,19 @@ -(BOOL)angle:(CGFloat)touchedAngle betweenStartAngle:(CGFloat)startingAngle endA { switch ( self.sliceDirection ) { case CPTPieDirectionClockwise: - if ( (touchedAngle <= startingAngle) && (touchedAngle >= endingAngle) ) { + if ((touchedAngle <= startingAngle) && (touchedAngle >= endingAngle)) { return YES; } - else if ( ( endingAngle < CPTFloat(0.0) ) && (touchedAngle - CPTFloat(1.0) >= endingAngle) ) { + else if ((endingAngle < CPTFloat(0.0)) && (touchedAngle - CPTFloat(1.0) >= endingAngle)) { return YES; } break; case CPTPieDirectionCounterClockwise: - if ( (touchedAngle >= startingAngle) && (touchedAngle <= endingAngle) ) { + if ((touchedAngle >= startingAngle) && (touchedAngle <= endingAngle)) { return YES; } - else if ( ( endingAngle > CPTFloat(1.0) ) && (touchedAngle + CPTFloat(1.0) <= endingAngle) ) { + else if ((endingAngle > CPTFloat(1.0)) && (touchedAngle + CPTFloat(1.0) <= endingAngle)) { return YES; } break; @@ -1095,7 +1108,7 @@ -(BOOL)pointingDeviceDownEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint) return NO; } - id theDelegate = self.delegate; + id theDelegate = (id)self.delegate; if ( [theDelegate respondsToSelector:@selector(pieChart:sliceTouchDownAtRecordIndex:)] || [theDelegate respondsToSelector:@selector(pieChart:sliceTouchDownAtRecordIndex:withEvent:)] || [theDelegate respondsToSelector:@selector(pieChart:sliceWasSelectedAtRecordIndex:)] || @@ -1164,7 +1177,7 @@ -(BOOL)pointingDeviceUpEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)in return NO; } - id theDelegate = self.delegate; + id theDelegate = (id)self.delegate; if ( [theDelegate respondsToSelector:@selector(pieChart:sliceTouchUpAtRecordIndex:)] || [theDelegate respondsToSelector:@selector(pieChart:sliceTouchUpAtRecordIndex:withEvent:)] || [theDelegate respondsToSelector:@selector(pieChart:sliceWasSelectedAtRecordIndex:)] || @@ -1247,17 +1260,17 @@ -(NSUInteger)dataIndexFromInteractionPoint:(CGPoint)point switch ( self.sliceDirection ) { case CPTPieDirectionClockwise: - if ( isnan(theEndAngle) || ( CPTFloat(2.0 * M_PI) == ABS(theEndAngle - theStartAngle) ) ) { + if ( isnan(theEndAngle) || (CPTFloat(2.0 * M_PI) == ABS(theEndAngle - theStartAngle))) { widthFactor = CPTFloat(1.0); } else { - widthFactor = CPTFloat(2.0 * M_PI) / ( CPTFloat(2.0 * M_PI) - ABS(theEndAngle - theStartAngle) ); + widthFactor = CPTFloat(2.0 * M_PI) / (CPTFloat(2.0 * M_PI) - ABS(theEndAngle - theStartAngle)); } for ( NSUInteger currentIndex = 0; currentIndex < sampleCount; currentIndex++ ) { // calculate angles for this slice CGFloat width = (CGFloat)[self cachedDoubleForField:CPTPieChartFieldSliceWidthNormalized recordIndex:currentIndex]; - if ( isnan(width) ) { + if ( isnan(width)) { continue; } @@ -1269,7 +1282,7 @@ -(NSUInteger)dataIndexFromInteractionPoint:(CGPoint)point CGFloat offsetTouchedAngle = touchedAngle; CGFloat offsetDistanceSquared = distanceSquared; CGFloat radialOffset = [(NSNumber *)[self cachedValueForKey:CPTPieChartBindingPieSliceRadialOffsets recordIndex:currentIndex] cgFloatValue]; - if ( radialOffset != CPTFloat(0.0) ) { + if ( radialOffset != CPTFloat(0.0)) { CGPoint offsetCenter; CGFloat medianAngle = CPTFloat(M_PI) * (startingAngle + endingAngle); offsetCenter = CPTPointMake(centerPoint.x + cos(medianAngle) * radialOffset, @@ -1294,7 +1307,7 @@ -(NSUInteger)dataIndexFromInteractionPoint:(CGPoint)point } // check distance - if ( angleInSlice && (offsetDistanceSquared >= chartInnerRadiusSquared) && (offsetDistanceSquared <= chartRadiusSquared) ) { + if ( angleInSlice && (offsetDistanceSquared >= chartInnerRadiusSquared) && (offsetDistanceSquared <= chartRadiusSquared)) { return currentIndex; } @@ -1304,7 +1317,7 @@ -(NSUInteger)dataIndexFromInteractionPoint:(CGPoint)point break; case CPTPieDirectionCounterClockwise: - if ( isnan(theEndAngle) || (theStartAngle == theEndAngle) ) { + if ( isnan(theEndAngle) || (theStartAngle == theEndAngle)) { widthFactor = CPTFloat(1.0); } else { @@ -1314,7 +1327,7 @@ -(NSUInteger)dataIndexFromInteractionPoint:(CGPoint)point for ( NSUInteger currentIndex = 0; currentIndex < sampleCount; currentIndex++ ) { // calculate angles for this slice CGFloat width = (CGFloat)[self cachedDoubleForField:CPTPieChartFieldSliceWidthNormalized recordIndex:currentIndex]; - if ( isnan(width) ) { + if ( isnan(width)) { continue; } width /= widthFactor; @@ -1325,7 +1338,7 @@ -(NSUInteger)dataIndexFromInteractionPoint:(CGPoint)point CGFloat offsetTouchedAngle = touchedAngle; CGFloat offsetDistanceSquared = distanceSquared; CGFloat radialOffset = [(NSNumber *)[self cachedValueForKey:CPTPieChartBindingPieSliceRadialOffsets recordIndex:currentIndex] cgFloatValue]; - if ( radialOffset != CPTFloat(0.0) ) { + if ( radialOffset != CPTFloat(0.0)) { CGPoint offsetCenter; CGFloat medianAngle = CPTFloat(M_PI) * (startingAngle + endingAngle); offsetCenter = CPTPointMake(centerPoint.x + cos(medianAngle) * radialOffset, @@ -1350,7 +1363,7 @@ -(NSUInteger)dataIndexFromInteractionPoint:(CGPoint)point } // check distance - if ( angleInSlice && (offsetDistanceSquared >= chartInnerRadiusSquared) && (offsetDistanceSquared <= chartRadiusSquared) ) { + if ( angleInSlice && (offsetDistanceSquared >= chartInnerRadiusSquared) && (offsetDistanceSquared <= chartRadiusSquared)) { return currentIndex; } @@ -1459,7 +1472,7 @@ -(void)setBorderLineStyle:(nullable CPTLineStyle *)newStyle -(void)setCenterAnchor:(CGPoint)newCenterAnchor { - if ( !CGPointEqualToPoint(centerAnchor, newCenterAnchor) ) { + if ( !CGPointEqualToPoint(centerAnchor, newCenterAnchor)) { centerAnchor = newCenterAnchor; [self setNeedsDisplay]; [self repositionAllLabelAnnotations]; diff --git a/framework/Source/CPTPlot.h b/framework/Source/CPTPlot.h index e9d2833f8..d9dd3d976 100644 --- a/framework/Source/CPTPlot.h +++ b/framework/Source/CPTPlot.h @@ -14,9 +14,14 @@ @class CPTPlotRange; @class CPTTextStyle; +/** + * @brief Plot bindings. + **/ +typedef NSString *CPTPlotBinding cpt_swift_struct; + /// @ingroup plotBindingsAllPlots /// @{ -extern NSString *__nonnull const CPTPlotBindingDataLabels; +extern CPTPlotBinding __nonnull const CPTPlotBindingDataLabels; /// @} /** @@ -139,7 +144,7 @@ typedef NSMutableArray<__kindof CPTPlot *> CPTMutablePlotArray; * @param indexRange The range of the data indexes of interest. * @return An array of data labels. **/ --(nullable NSArray *)dataLabelsForPlot:(nonnull CPTPlot *)plot recordIndexRange:(NSRange)indexRange; +-(nullable CPTLayerArray *)dataLabelsForPlot:(nonnull CPTPlot *)plot recordIndexRange:(NSRange)indexRange; /** @brief @optional Gets a data label for the given plot. * This method will not be called if @@ -162,7 +167,7 @@ typedef NSMutableArray<__kindof CPTPlot *> CPTMutablePlotArray; /** * @brief Plot delegate. **/ -@protocol CPTPlotDelegate +@protocol CPTPlotDelegate @optional @@ -327,8 +332,10 @@ typedef NSMutableArray<__kindof CPTPlot *> CPTMutablePlotArray; -(void)reloadDataInIndexRange:(NSRange)indexRange; -(void)insertDataAtIndex:(NSUInteger)idx numberOfRecords:(NSUInteger)numberOfRecords; -(void)deleteDataInIndexRange:(NSRange)indexRange; --(void)reloadPlotData; --(void)reloadPlotDataInIndexRange:(NSRange)indexRange; +-(void) reloadPlotData NS_SWIFT_NAME(CPTPlot.reloadPlotData()); + +-(void)reloadPlotDataInIndexRange:(NSRange) indexRange NS_SWIFT_NAME(CPTPlot.reloadPlotData(inIndexRange:)); + /// @} /// @name Plot Data diff --git a/framework/Source/CPTPlot.m b/framework/Source/CPTPlot.m index 7df92b6df..5cd2637a0 100644 --- a/framework/Source/CPTPlot.m +++ b/framework/Source/CPTPlot.m @@ -16,13 +16,12 @@ #import "CPTTextLayer.h" #import "CPTUtilities.h" #import "NSCoderExtensions.h" -#import #import /** @defgroup plotAnimation Plots * @brief Plot properties that can be animated using Core Animation. * @if MacOnly - * @since Custom layer property animation is supported on MacOS 10.6 and later. + * @since Custom layer property animation is supported on macOS 10.6 and later. * @endif * @ingroup animation **/ @@ -45,7 +44,7 @@ * @endif **/ -NSString *const CPTPlotBindingDataLabels = @"dataLabels"; ///< Plot data labels. +CPTPlotBinding const CPTPlotBindingDataLabels = @"dataLabels"; ///< Plot data labels. /// @cond @interface CPTPlot() @@ -56,7 +55,7 @@ @interface CPTPlot() @property (nonatomic, readwrite, assign) BOOL needsRelabel; @property (nonatomic, readwrite, assign) NSRange labelIndexRange; @property (nonatomic, readwrite, strong, nullable) CPTMutableAnnotationArray *labelAnnotations; -@property (nonatomic, readwrite, copy, nullable) NSArray *dataLabels; +@property (nonatomic, readwrite, copy, nullable) CPTLayerArray *dataLabels; @property (nonatomic, readwrite, assign) NSUInteger pointingDeviceDownLabelIndex; @property (nonatomic, readwrite, assign) NSUInteger cachedDataCount; @@ -79,7 +78,7 @@ -(void)updateContentAnchorForLabel:(nonnull CPTPlotSpaceAnnotation *)label; * Each data series on the graph is represented by a plot. Data is provided by * a datasource that conforms to the CPTPlotDataSource protocol. * @if MacOnly - * Plots also support data binding on MacOS. + * Plots also support data binding on macOS. * @endif * * A Core Plot plot will request its data from the datasource when it is first displayed. @@ -256,6 +255,7 @@ +(void)initialize [self exposeBinding:CPTPlotBindingDataLabels]; } } + #endif /// @endcond @@ -292,7 +292,7 @@ +(void)initialize **/ -(nonnull instancetype)initWithFrame:(CGRect)newFrame { - if ( (self = [super initWithFrame:newFrame]) ) { + if ((self = [super initWithFrame:newFrame])) { cachedData = [[NSMutableDictionary alloc] initWithCapacity:5]; cachedDataCount = 0; cachePrecision = CPTPlotCachePrecisionAuto; @@ -330,7 +330,7 @@ -(nonnull instancetype)initWithFrame:(CGRect)newFrame -(nonnull instancetype)initWithLayer:(nonnull id)layer { - if ( (self = [super initWithLayer:layer]) ) { + if ((self = [super initWithLayer:layer])) { CPTPlot *theLayer = (CPTPlot *)layer; cachedData = theLayer->cachedData; @@ -404,7 +404,7 @@ -(void)encodeWithCoder:(nonnull NSCoder *)coder -(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super initWithCoder:coder]) ) { + if ((self = [super initWithCoder:coder])) { dataSource = [coder decodeObjectOfClass:[NSObject class] forKey:@"CPTPlot.dataSource"]; title = [[coder decodeObjectOfClass:[NSString class] @@ -473,7 +473,7 @@ +(BOOL)supportsSecureCoding /// @cond --(nullable Class)valueClassForBinding:(nonnull NSString *)binding +-(nullable Class)valueClassForBinding:(nonnull NSString *__unused)binding { return [NSArray class]; } @@ -628,6 +628,15 @@ -(void)insertDataAtIndex:(NSUInteger)idx numberOfRecords:(NSUInteger)numberOfRec } } + CPTMutableAnnotationArray *labelArray = self.labelAnnotations; + if ( labelArray ) { + id nullObject = [NSNull null]; + NSUInteger lastIndex = idx + numberOfRecords - 1; + for ( NSUInteger i = idx; i <= lastIndex; i++ ) { + [labelArray insertObject:nullObject atIndex:i]; + } + } + self.cachedDataCount += numberOfRecords; [self reloadDataInIndexRange:NSMakeRange(idx, numberOfRecords)]; } @@ -659,8 +668,20 @@ -(void)deleteDataInIndexRange:(NSRange)indexRange } } + CPTMutableAnnotationArray *labelArray = self.labelAnnotations; + + NSUInteger maxIndex = NSMaxRange(indexRange); + Class annotationClass = [CPTAnnotation class]; + + for ( NSUInteger i = indexRange.location; i < maxIndex; i++ ) { + CPTAnnotation *annotation = labelArray[i]; + if ( [annotation isKindOfClass:annotationClass] ) { + [self removeAnnotation:annotation]; + } + } + [labelArray removeObjectsInRange:indexRange]; + self.cachedDataCount -= indexRange.length; - [self relabelIndexRange:NSMakeRange(indexRange.location, self.cachedDataCount - indexRange.location)]; [self setNeedsDisplay]; } @@ -681,7 +702,7 @@ -(void)reloadPlotData /** @brief Reload plot data in the given index range from the data source immediately. * @param indexRange The index range to load. **/ --(void)reloadPlotDataInIndexRange:(NSRange)indexRange +-(void)reloadPlotDataInIndexRange:(NSRange __unused)indexRange { // do nothing--implementation provided by subclasses } @@ -709,9 +730,9 @@ -(void)reloadDataLabelsInIndexRange:(NSRange)indexRange atRecordIndex:indexRange.location]; } else if ( [theDataSource respondsToSelector:@selector(dataLabelForPlot:recordIndex:)] ) { - id nilObject = [CPTPlot nilData]; - NSMutableArray *array = [[NSMutableArray alloc] initWithCapacity:indexRange.length]; - NSUInteger maxIndex = NSMaxRange(indexRange); + id nilObject = [CPTPlot nilData]; + CPTMutableLayerArray *array = [[NSMutableArray alloc] initWithCapacity:indexRange.length]; + NSUInteger maxIndex = NSMaxRange(indexRange); for ( NSUInteger idx = indexRange.location; idx < maxIndex; idx++ ) { CPTLayer *labelLayer = [theDataSource dataLabelForPlot:self recordIndex:idx]; @@ -834,7 +855,7 @@ -(BOOL)loadNumbersForAllFieldsFromDataSourceInRecordIndexRange:(NSRange)indexRan const NSUInteger sampleCount = data.numberOfSamples; CPTNumericDataType dataType = data.dataType; - if ( (sampleCount > 0) && (data.numberOfDimensions == 2) ) { + if ((sampleCount > 0) && (data.numberOfDimensions == 2)) { CPTNumberArray *theShape = data.shape; const NSUInteger rowCount = theShape[0].unsignedIntegerValue; const NSUInteger fieldCount = theShape[1].unsignedIntegerValue; @@ -844,14 +865,14 @@ -(BOOL)loadNumbersForAllFieldsFromDataSourceInRecordIndexRange:(NSRange)indexRan switch ( self.cachePrecision ) { case CPTPlotCachePrecisionAuto: if ( self.doublePrecisionCache ) { - if ( !CPTDataTypeEqualToDataType(dataType, self.doubleDataType) ) { + if ( !CPTDataTypeEqualToDataType(dataType, self.doubleDataType)) { CPTMutableNumericData *mutableData = [data mutableCopy]; mutableData.dataType = self.doubleDataType; data = mutableData; } } else { - if ( !CPTDataTypeEqualToDataType(dataType, self.decimalDataType) ) { + if ( !CPTDataTypeEqualToDataType(dataType, self.decimalDataType)) { CPTMutableNumericData *mutableData = [data mutableCopy]; mutableData.dataType = self.decimalDataType; data = mutableData; @@ -860,7 +881,7 @@ -(BOOL)loadNumbersForAllFieldsFromDataSourceInRecordIndexRange:(NSRange)indexRan break; case CPTPlotCachePrecisionDecimal: - if ( !CPTDataTypeEqualToDataType(dataType, self.decimalDataType) ) { + if ( !CPTDataTypeEqualToDataType(dataType, self.decimalDataType)) { CPTMutableNumericData *mutableData = [data mutableCopy]; mutableData.dataType = self.decimalDataType; data = mutableData; @@ -868,7 +889,7 @@ -(BOOL)loadNumbersForAllFieldsFromDataSourceInRecordIndexRange:(NSRange)indexRan break; case CPTPlotCachePrecisionDouble: - if ( !CPTDataTypeEqualToDataType(dataType, self.doubleDataType) ) { + if ( !CPTDataTypeEqualToDataType(dataType, self.doubleDataType)) { CPTMutableNumericData *mutableData = [data mutableCopy]; mutableData.dataType = self.doubleDataType; data = mutableData; @@ -887,7 +908,7 @@ -(BOOL)loadNumbersForAllFieldsFromDataSourceInRecordIndexRange:(NSRange)indexRan for ( NSUInteger fieldNum = 0; fieldNum < fieldCount; fieldNum++ ) { NSMutableData *tempData = [[NSMutableData alloc] initWithLength:bufferLength]; - if ( CPTDataTypeEqualToDataType(dataType, self.doubleDataType) ) { + if ( CPTDataTypeEqualToDataType(dataType, self.doubleDataType)) { const double *sourceData = [data samplePointerAtIndex:0, fieldNum]; double *destData = tempData.mutableBytes; @@ -1120,7 +1141,7 @@ -(void)cacheNumbers:(nullable id)numbers forField:(NSUInteger)fieldEnum atRecord break; } - if ( mutableNumbers && (sampleCount > 0) ) { + if ( mutableNumbers && (sampleCount > 0)) { // Ensure the data cache exists and is the right size CPTMutableNumericData *cachedNumbers = (self.cachedData)[cacheKey]; if ( !cachedNumbers ) { @@ -1159,7 +1180,7 @@ -(nonnull CPTMutableNumericData *)numericDataForNumbers:(nonnull id)numbers mutableNumbers = [numbers mutableCopy]; // ensure the numeric data is in a supported format; default to double if not already NSDecimal if ( !CPTDataTypeEqualToDataType(mutableNumbers.dataType, self.decimalDataType) && - !CPTDataTypeEqualToDataType(mutableNumbers.dataType, self.doubleDataType) ) { + !CPTDataTypeEqualToDataType(mutableNumbers.dataType, self.doubleDataType)) { mutableNumbers.dataType = self.doubleDataType; } } @@ -1168,10 +1189,10 @@ -(nonnull CPTMutableNumericData *)numericDataForNumbers:(nonnull id)numbers mutableNumbers = [[CPTMutableNumericData alloc] initWithData:numbers dataType:loadedDataType shape:nil]; } else if ( [numbers isKindOfClass:[NSArray class]] ) { - if ( ( (CPTNumberArray *)numbers ).count == 0 ) { + if (((CPTNumberArray *)numbers).count == 0 ) { loadedDataType = self.doubleDataType; } - else if ( [( (NSArray < NSNumber * > *)numbers )[0] isKindOfClass:[NSDecimalNumber class]] ) { + else if ( [((NSArray *)numbers)[0] isKindOfClass:[NSDecimalNumber class]] ) { loadedDataType = self.decimalDataType; } else { @@ -1200,7 +1221,7 @@ -(BOOL)doublePrecisionCache Class numberClass = [NSNumber class]; for ( id key in dataCache.allKeys ) { if ( [key isKindOfClass:numberClass] ) { - result = CPTDataTypeEqualToDataType( ( (CPTMutableNumericData *)dataCache[key] ).dataType, self.doubleDataType ); + result = CPTDataTypeEqualToDataType(((CPTMutableNumericData *)dataCache[key]).dataType, self.doubleDataType); break; } } @@ -1337,7 +1358,7 @@ -(CPTNumericDataType)doubleDataType static dispatch_once_t onceToken = 0; dispatch_once(&onceToken, ^{ - dataType = CPTDataType( CPTFloatingPointDataType, sizeof(double), CFByteOrderGetCurrent() ); + dataType = CPTDataType(CPTFloatingPointDataType, sizeof(double), CFByteOrderGetCurrent()); }); return dataType; @@ -1349,7 +1370,7 @@ -(CPTNumericDataType)decimalDataType static dispatch_once_t onceToken = 0; dispatch_once(&onceToken, ^{ - dataType = CPTDataType( CPTDecimalDataType, sizeof(NSDecimal), CFByteOrderGetCurrent() ); + dataType = CPTDataType(CPTDecimalDataType, sizeof(NSDecimal), CFByteOrderGetCurrent()); }); return dataType; @@ -1446,31 +1467,21 @@ -(nullable CPTPlotRange *)plotRangeForField:(NSUInteger)fieldEnum NSUInteger numberOfSamples = numbers.numberOfSamples; if ( numberOfSamples > 0 ) { if ( self.doublePrecisionCache ) { - const double *doubles = (const double *)numbers.bytes; - double min = (double)INFINITY; double max = -(double)INFINITY; - vDSP_minvD(doubles, 1, &min, (vDSP_Length)numberOfSamples); - vDSP_maxvD(doubles, 1, &max, (vDSP_Length)numberOfSamples); - - if ( isnan(min) || isnan(max) ) { - // vDSP functions may return NAN if any data in the array is NAN - min = (double)INFINITY; - max = -(double)INFINITY; - - const double *lastSample = doubles + numberOfSamples; + const double *doubles = (const double *)numbers.bytes; + const double *lastSample = doubles + numberOfSamples; - while ( doubles < lastSample ) { - double value = *doubles++; + while ( doubles < lastSample ) { + double value = *doubles++; - if ( !isnan(value) ) { - if ( value < min ) { - min = value; - } - if ( value > max ) { - max = value; - } + if ( !isnan(value)) { + if ( value < min ) { + min = value; + } + if ( value > max ) { + max = value; } } } @@ -1485,20 +1496,21 @@ -(nullable CPTPlotRange *)plotRangeForField:(NSUInteger)fieldEnum const NSDecimal *decimals = (const NSDecimal *)numbers.bytes; const NSDecimal *lastSample = decimals + numberOfSamples; + while ( decimals < lastSample ) { NSDecimal value = *decimals++; - if ( !NSDecimalIsNotANumber(&value) ) { - if ( CPTDecimalLessThan(value, min) ) { + if ( !NSDecimalIsNotANumber(&value)) { + if ( CPTDecimalLessThan(value, min)) { min = value; } - if ( CPTDecimalGreaterThan(value, max) ) { + if ( CPTDecimalGreaterThan(value, max)) { max = value; } } } - if ( CPTDecimalGreaterThanOrEqualTo(max, min) ) { + if ( CPTDecimalGreaterThanOrEqualTo(max, min)) { range = [CPTPlotRange plotRangeWithLocationDecimal:min lengthDecimal:CPTDecimalSubtract(max, min)]; } } @@ -1599,8 +1611,8 @@ -(void)relabel NSFormatter *dataLabelFormatter = self.labelFormatter; BOOL plotProvidesLabels = dataLabelTextStyle && dataLabelFormatter; - BOOL hasCachedLabels = NO; - NSMutableArray *cachedLabels = (NSMutableArray *)[self cachedArrayForKey:CPTPlotBindingDataLabels]; + BOOL hasCachedLabels = NO; + CPTMutableLayerArray *cachedLabels = (CPTMutableLayerArray *)[self cachedArrayForKey:CPTPlotBindingDataLabels]; for ( CPTLayer *label in cachedLabels ) { if ( ![label isKindOfClass:nullClass] ) { hasCachedLabels = YES; @@ -1608,7 +1620,7 @@ -(void)relabel } } - if ( !self.showLabels || (!hasCachedLabels && !plotProvidesLabels) ) { + if ( !self.showLabels || (!hasCachedLabels && !plotProvidesLabels)) { for ( CPTAnnotation *annotation in self.labelAnnotations ) { if ( [annotation isKindOfClass:annotationClass] ) { [self removeAnnotation:annotation]; @@ -1643,13 +1655,13 @@ -(void)relabel NSNumber *dataValue = [labelFieldDataCache sampleValue:i]; CPTLayer *newLabelLayer; - if ( isnan([dataValue doubleValue]) ) { + if ( isnan([dataValue doubleValue])) { newLabelLayer = nil; } else { newLabelLayer = [self cachedValueForKey:CPTPlotBindingDataLabels recordIndex:i]; - if ( ( (newLabelLayer == nil) || (newLabelLayer == nilObject) ) && plotProvidesLabels ) { + if (((newLabelLayer == nil) || (newLabelLayer == nilObject)) && plotProvidesLabels ) { if ( hasAttributedFormatter ) { NSAttributedString *labelString = [dataLabelFormatter attributedStringForObjectValue:dataValue withDefaultAttributes:textAttributes]; newLabelLayer = [[CPTTextLayer alloc] initWithAttributedText:labelString]; @@ -1660,7 +1672,7 @@ -(void)relabel } } - if ( [newLabelLayer isKindOfClass:nullClass] || (newLabelLayer == nilObject) ) { + if ( [newLabelLayer isKindOfClass:nullClass] || (newLabelLayer == nilObject)) { newLabelLayer = nil; } } @@ -1728,14 +1740,14 @@ -(void)updateContentAnchorForLabel:(nonnull CPTPlotSpaceAnnotation *)label { if ( label && self.adjustLabelAnchors ) { CGPoint displacement = label.displacement; - if ( CGPointEqualToPoint(displacement, CGPointZero) ) { + if ( CGPointEqualToPoint(displacement, CGPointZero)) { displacement.y = CPTFloat(1.0); // put the label above the data point if zero displacement } CGFloat angle = CPTFloat(M_PI) + atan2(displacement.y, displacement.x) - label.rotation; CGFloat newAnchorX = cos(angle); CGFloat newAnchorY = sin(angle); - if ( ABS(newAnchorX) <= ABS(newAnchorY) ) { + if ( ABS(newAnchorX) <= ABS(newAnchorY)) { newAnchorX /= ABS(newAnchorY); newAnchorY = signbit(newAnchorY) ? CPTFloat(-1.0) : CPTFloat(1.0); } @@ -1744,7 +1756,7 @@ -(void)updateContentAnchorForLabel:(nonnull CPTPlotSpaceAnnotation *)label newAnchorX = signbit(newAnchorX) ? CPTFloat(-1.0) : CPTFloat(1.0); } - label.contentAnchorPoint = CPTPointMake( ( newAnchorX + CPTFloat(1.0) ) / CPTFloat(2.0), ( newAnchorY + CPTFloat(1.0) ) / CPTFloat(2.0) ); + label.contentAnchorPoint = CPTPointMake((newAnchorX + CPTFloat(1.0)) / CPTFloat(2.0), (newAnchorY + CPTFloat(1.0)) / CPTFloat(2.0)); } } @@ -1783,7 +1795,7 @@ -(NSUInteger)numberOfLegendEntries * @param idx The index of the desired title. * @return The title of the legend entry at the requested index. **/ --(nullable NSString *)titleForLegendEntryAtIndex:(NSUInteger)idx +-(nullable NSString *)titleForLegendEntryAtIndex:(NSUInteger __unused)idx { NSString *legendTitle = self.title; @@ -1802,7 +1814,7 @@ -(nullable NSString *)titleForLegendEntryAtIndex:(NSUInteger)idx * @param idx The index of the desired title. * @return The styled title of the legend entry at the requested index. **/ --(nullable NSAttributedString *)attributedTitleForLegendEntryAtIndex:(NSUInteger)idx +-(nullable NSAttributedString *)attributedTitleForLegendEntryAtIndex:(NSUInteger __unused)idx { NSAttributedString *legendTitle = self.attributedTitle; @@ -1829,6 +1841,7 @@ -(void)drawSwatchForLegend:(nonnull CPTLegend *)legend atIndex:(NSUInteger)idx i id theDelegate = (id)self.delegate; CPTFill *theFill = nil; + if ( [theDelegate respondsToSelector:@selector(legend:fillForSwatchAtIndex:forPlot:)] ) { theFill = [theDelegate legend:legend fillForSwatchAtIndex:idx forPlot:self]; } @@ -1895,7 +1908,7 @@ -(BOOL)pointingDeviceDownEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint) return NO; } - id theDelegate = self.delegate; + id theDelegate = (id)self.delegate; if ( [theDelegate respondsToSelector:@selector(plot:dataLabelTouchDownAtRecordIndex:)] || [theDelegate respondsToSelector:@selector(plot:dataLabelTouchDownAtRecordIndex:withEvent:)] || [theDelegate respondsToSelector:@selector(plot:dataLabelWasSelectedAtRecordIndex:)] || @@ -1912,7 +1925,7 @@ -(BOOL)pointingDeviceDownEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint) if ( labelLayer && !labelLayer.hidden ) { CGPoint labelPoint = [theGraph convertPoint:interactionPoint toLayer:labelLayer]; - if ( CGRectContainsPoint(labelLayer.bounds, labelPoint) ) { + if ( CGRectContainsPoint(labelLayer.bounds, labelPoint)) { self.pointingDeviceDownLabelIndex = idx; BOOL handled = NO; @@ -1973,7 +1986,7 @@ -(BOOL)pointingDeviceUpEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)in return NO; } - id theDelegate = self.delegate; + id theDelegate = (id)self.delegate; if ( [theDelegate respondsToSelector:@selector(plot:dataLabelTouchUpAtRecordIndex:)] || [theDelegate respondsToSelector:@selector(plot:dataLabelTouchUpAtRecordIndex:withEvent:)] || [theDelegate respondsToSelector:@selector(plot:dataLabelWasSelectedAtRecordIndex:)] || @@ -1990,7 +2003,7 @@ -(BOOL)pointingDeviceUpEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)in if ( labelLayer && !labelLayer.hidden ) { CGPoint labelPoint = [theGraph convertPoint:interactionPoint toLayer:labelLayer]; - if ( CGRectContainsPoint(labelLayer.bounds, labelPoint) ) { + if ( CGRectContainsPoint(labelLayer.bounds, labelPoint)) { BOOL handled = NO; if ( [theDelegate respondsToSelector:@selector(plot:dataLabelTouchUpAtRecordIndex:)] ) { @@ -2034,12 +2047,12 @@ -(BOOL)pointingDeviceUpEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)in /// @cond --(nullable NSArray *)dataLabels +-(nullable CPTLayerArray *)dataLabels { return [self cachedArrayForKey:CPTPlotBindingDataLabels]; } --(void)setDataLabels:(nullable NSArray *)newDataLabels +-(void)setDataLabels:(nullable CPTLayerArray *)newDataLabels { [self cacheArray:newDataLabels forKey:CPTPlotBindingDataLabels]; [self setNeedsRelabel]; @@ -2250,7 +2263,7 @@ -(nonnull CPTNumberArray *)fieldIdentifiers * @param coord The coordinate for which the corresponding field identifiers are desired. * @return Array of NSNumber objects for the field identifiers. **/ --(nonnull CPTNumberArray *)fieldIdentifiersForCoordinate:(CPTCoordinate)coord +-(nonnull CPTNumberArray *)fieldIdentifiersForCoordinate:(CPTCoordinate __unused)coord { return @[]; } @@ -2259,7 +2272,7 @@ -(nonnull CPTNumberArray *)fieldIdentifiersForCoordinate:(CPTCoordinate)coord * @param field The field identifier for which the corresponding coordinate is desired. * @return The coordinate that corresponds to a particular field identifier or #CPTCoordinateNone if there is no matching coordinate. */ --(CPTCoordinate)coordinateForFieldIdentifier:(NSUInteger)field +-(CPTCoordinate)coordinateForFieldIdentifier:(NSUInteger __unused)field { return CPTCoordinateNone; } @@ -2271,7 +2284,7 @@ -(CPTCoordinate)coordinateForFieldIdentifier:(NSUInteger)field * @param label The annotation for the data label. * @param idx The data index for the label. **/ --(void)positionLabelAnnotation:(nonnull CPTPlotSpaceAnnotation *)label forIndex:(NSUInteger)idx +-(void)positionLabelAnnotation:(nonnull CPTPlotSpaceAnnotation *__unused)label forIndex:(NSUInteger __unused)idx { // do nothing--implementation provided by subclasses } @@ -2284,7 +2297,7 @@ -(void)positionLabelAnnotation:(nonnull CPTPlotSpaceAnnotation *)label forIndex: * @param point The coordinates of the interaction. * @return The index of the data point that is under the given point or @ref NSNotFound if none was found. */ --(NSUInteger)dataIndexFromInteractionPoint:(CGPoint)point +-(NSUInteger)dataIndexFromInteractionPoint:(CGPoint __unused)point { return NSNotFound; } diff --git a/framework/Source/CPTPlotArea.h b/framework/Source/CPTPlotArea.h index b606caa2c..1d29c5f78 100644 --- a/framework/Source/CPTPlotArea.h +++ b/framework/Source/CPTPlotArea.h @@ -14,7 +14,7 @@ /** * @brief Plot area delegate. **/ -@protocol CPTPlotAreaDelegate +@protocol CPTPlotAreaDelegate @optional diff --git a/framework/Source/CPTPlotArea.m b/framework/Source/CPTPlotArea.m index 216ca4152..34f04616d 100644 --- a/framework/Source/CPTPlotArea.m +++ b/framework/Source/CPTPlotArea.m @@ -152,7 +152,7 @@ @implementation CPTPlotArea **/ -(nonnull instancetype)initWithFrame:(CGRect)newFrame { - if ( (self = [super initWithFrame:newFrame]) ) { + if ((self = [super initWithFrame:newFrame])) { minorGridLineGroup = nil; majorGridLineGroup = nil; axisSet = nil; @@ -162,7 +162,7 @@ -(nonnull instancetype)initWithFrame:(CGRect)newFrame fill = nil; touchedPoint = CPTPointMake(NAN, NAN); topDownLayerOrder = nil; - bottomUpLayerOrder = malloc( kCPTNumberOfLayers * sizeof(CPTGraphLayerType) ); + bottomUpLayerOrder = calloc(kCPTNumberOfLayers, sizeof(CPTGraphLayerType)); [self updateLayerOrder]; CPTPlotGroup *newPlotGroup = [[CPTPlotGroup alloc] initWithFrame:newFrame]; @@ -183,7 +183,7 @@ -(nonnull instancetype)initWithFrame:(CGRect)newFrame -(nonnull instancetype)initWithLayer:(nonnull id)layer { - if ( (self = [super initWithLayer:layer]) ) { + if ((self = [super initWithLayer:layer])) { CPTPlotArea *theLayer = (CPTPlotArea *)layer; minorGridLineGroup = theLayer->minorGridLineGroup; @@ -195,8 +195,8 @@ -(nonnull instancetype)initWithLayer:(nonnull id)layer fill = theLayer->fill; touchedPoint = theLayer->touchedPoint; topDownLayerOrder = theLayer->topDownLayerOrder; - bottomUpLayerOrder = malloc( kCPTNumberOfLayers * sizeof(CPTGraphLayerType) ); - memcpy( bottomUpLayerOrder, theLayer->bottomUpLayerOrder, kCPTNumberOfLayers * sizeof(CPTGraphLayerType) ); + bottomUpLayerOrder = calloc(kCPTNumberOfLayers, sizeof(CPTGraphLayerType)); + memcpy(bottomUpLayerOrder, theLayer->bottomUpLayerOrder, kCPTNumberOfLayers * sizeof(CPTGraphLayerType)); widthDecimal = theLayer->widthDecimal; heightDecimal = theLayer->heightDecimal; } @@ -238,7 +238,7 @@ -(void)encodeWithCoder:(nonnull NSCoder *)coder -(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super initWithCoder:coder]) ) { + if ((self = [super initWithCoder:coder])) { minorGridLineGroup = [coder decodeObjectOfClass:[CPTGridLineGroup class] forKey:@"CPTPlotArea.minorGridLineGroup"]; majorGridLineGroup = [coder decodeObjectOfClass:[CPTGridLineGroup class] @@ -256,7 +256,7 @@ -(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder topDownLayerOrder = [coder decodeObjectOfClasses:[NSSet setWithArray:@[[NSArray class], [NSNumber class]]] forKey:@"CPTPlotArea.topDownLayerOrder"]; - bottomUpLayerOrder = malloc( kCPTNumberOfLayers * sizeof(CPTGraphLayerType) ); + bottomUpLayerOrder = calloc(kCPTNumberOfLayers, sizeof(CPTGraphLayerType)); [self updateLayerOrder]; touchedPoint = CPTPointMake(NAN, NAN); @@ -702,7 +702,7 @@ -(BOOL)pointingDeviceDownEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint) return NO; } - id theDelegate = self.delegate; + id theDelegate = (id)self.delegate; if ( [theDelegate respondsToSelector:@selector(plotAreaTouchDown:)] || [theDelegate respondsToSelector:@selector(plotAreaTouchDown:withEvent:)] || [theDelegate respondsToSelector:@selector(plotAreaWasSelected:)] || @@ -710,7 +710,7 @@ -(BOOL)pointingDeviceDownEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint) // Inform delegate if a point was hit CGPoint plotAreaPoint = [theGraph convertPoint:interactionPoint toLayer:self]; - if ( CGRectContainsPoint(self.bounds, plotAreaPoint) ) { + if ( CGRectContainsPoint(self.bounds, plotAreaPoint)) { self.touchedPoint = plotAreaPoint; if ( [theDelegate respondsToSelector:@selector(plotAreaTouchDown:)] ) { @@ -756,7 +756,7 @@ -(BOOL)pointingDeviceUpEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)in CGPoint lastPoint = self.touchedPoint; self.touchedPoint = CPTPointMake(NAN, NAN); - id theDelegate = self.delegate; + id theDelegate = (id)self.delegate; if ( [theDelegate respondsToSelector:@selector(plotAreaTouchUp:)] || [theDelegate respondsToSelector:@selector(plotAreaTouchUp:withEvent:)] || [theDelegate respondsToSelector:@selector(plotAreaWasSelected:)] || @@ -764,9 +764,9 @@ -(BOOL)pointingDeviceUpEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)in // Inform delegate if a point was hit CGPoint plotAreaPoint = [theGraph convertPoint:interactionPoint toLayer:self]; - if ( CGRectContainsPoint(self.bounds, plotAreaPoint) ) { + if ( CGRectContainsPoint(self.bounds, plotAreaPoint)) { CGVector offset = CGVectorMake(plotAreaPoint.x - lastPoint.x, plotAreaPoint.y - lastPoint.y); - if ( (offset.dx * offset.dx + offset.dy * offset.dy) <= CPTFloat(25.0) ) { + if ((offset.dx * offset.dx + offset.dy * offset.dy) <= CPTFloat(25.0)) { if ( [theDelegate respondsToSelector:@selector(plotAreaTouchUp:)] ) { [theDelegate plotAreaTouchUp:self]; } @@ -818,7 +818,7 @@ -(void)setFill:(nullable CPTFill *)newFill -(void)setMinorGridLineGroup:(nullable CPTGridLineGroup *)newGridLines { - if ( (newGridLines != minorGridLineGroup) || self.isUpdatingLayers ) { + if ((newGridLines != minorGridLineGroup) || self.isUpdatingLayers ) { [minorGridLineGroup removeFromSuperlayer]; minorGridLineGroup = newGridLines; if ( newGridLines ) { @@ -834,7 +834,7 @@ -(void)setMinorGridLineGroup:(nullable CPTGridLineGroup *)newGridLines -(void)setMajorGridLineGroup:(nullable CPTGridLineGroup *)newGridLines { - if ( (newGridLines != majorGridLineGroup) || self.isUpdatingLayers ) { + if ((newGridLines != majorGridLineGroup) || self.isUpdatingLayers ) { [majorGridLineGroup removeFromSuperlayer]; majorGridLineGroup = newGridLines; if ( newGridLines ) { @@ -850,7 +850,7 @@ -(void)setMajorGridLineGroup:(nullable CPTGridLineGroup *)newGridLines -(void)setAxisSet:(nullable CPTAxisSet *)newAxisSet { - if ( (newAxisSet != axisSet) || self.isUpdatingLayers ) { + if ((newAxisSet != axisSet) || self.isUpdatingLayers ) { [axisSet removeFromSuperlayer]; for ( CPTAxis *axis in axisSet.axes ) { axis.plotArea = nil; @@ -878,7 +878,7 @@ -(void)setAxisSet:(nullable CPTAxisSet *)newAxisSet -(void)setPlotGroup:(nullable CPTPlotGroup *)newPlotGroup { - if ( (newPlotGroup != plotGroup) || self.isUpdatingLayers ) { + if ((newPlotGroup != plotGroup) || self.isUpdatingLayers ) { [plotGroup removeFromSuperlayer]; plotGroup = newPlotGroup; if ( newPlotGroup ) { @@ -892,7 +892,7 @@ -(void)setPlotGroup:(nullable CPTPlotGroup *)newPlotGroup -(void)setAxisLabelGroup:(nullable CPTAxisLabelGroup *)newAxisLabelGroup { - if ( (newAxisLabelGroup != axisLabelGroup) || self.isUpdatingLayers ) { + if ((newAxisLabelGroup != axisLabelGroup) || self.isUpdatingLayers ) { [axisLabelGroup removeFromSuperlayer]; axisLabelGroup = newAxisLabelGroup; if ( newAxisLabelGroup ) { @@ -906,7 +906,7 @@ -(void)setAxisLabelGroup:(nullable CPTAxisLabelGroup *)newAxisLabelGroup -(void)setAxisTitleGroup:(nullable CPTAxisLabelGroup *)newAxisTitleGroup { - if ( (newAxisTitleGroup != axisTitleGroup) || self.isUpdatingLayers ) { + if ((newAxisTitleGroup != axisTitleGroup) || self.isUpdatingLayers ) { [axisTitleGroup removeFromSuperlayer]; axisTitleGroup = newAxisTitleGroup; if ( newAxisTitleGroup ) { @@ -939,7 +939,7 @@ -(void)setGraph:(nullable CPTGraph *)newGraph -(void)setBounds:(CGRect)newBounds { - if ( !CGRectEqualToRect(self.bounds, newBounds) ) { + if ( !CGRectEqualToRect(self.bounds, newBounds)) { self.widthDecimal = CPTDecimalFromCGFloat(newBounds.size.width); self.heightDecimal = CPTDecimalFromCGFloat(newBounds.size.height); diff --git a/framework/Source/CPTPlotAreaFrame.m b/framework/Source/CPTPlotAreaFrame.m index b706c27c5..c5723c6a0 100644 --- a/framework/Source/CPTPlotAreaFrame.m +++ b/framework/Source/CPTPlotAreaFrame.m @@ -56,7 +56,7 @@ @implementation CPTPlotAreaFrame **/ -(nonnull instancetype)initWithFrame:(CGRect)newFrame { - if ( (self = [super initWithFrame:newFrame]) ) { + if ((self = [super initWithFrame:newFrame])) { plotArea = nil; CPTPlotArea *newPlotArea = [[CPTPlotArea alloc] initWithFrame:newFrame]; @@ -74,7 +74,7 @@ -(nonnull instancetype)initWithFrame:(CGRect)newFrame -(nonnull instancetype)initWithLayer:(nonnull id)layer { - if ( (self = [super initWithLayer:layer]) ) { + if ((self = [super initWithLayer:layer])) { CPTPlotAreaFrame *theLayer = (CPTPlotAreaFrame *)layer; plotArea = theLayer->plotArea; @@ -98,7 +98,7 @@ -(void)encodeWithCoder:(nonnull NSCoder *)coder -(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super initWithCoder:coder]) ) { + if ((self = [super initWithCoder:coder])) { plotArea = [coder decodeObjectOfClass:[CPTPlotArea class] forKey:@"CPTPlotAreaFrame.plotArea"]; } diff --git a/framework/Source/CPTPlotGroup.m b/framework/Source/CPTPlotGroup.m index 09c4ea9e6..4a224e691 100644 --- a/framework/Source/CPTPlotGroup.m +++ b/framework/Source/CPTPlotGroup.m @@ -14,7 +14,7 @@ @implementation CPTPlotGroup -(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super initWithCoder:coder]) ) { + if ((self = [super initWithCoder:coder])) { // support old archives if ( [coder containsValueForKey:@"CPTPlotGroup.identifier"] ) { self.identifier = [coder decodeObjectOfClass:[NSObject class] @@ -83,7 +83,7 @@ -(void)display // nothing to draw } --(void)renderAsVectorInContext:(nonnull CGContextRef)context +-(void)renderAsVectorInContext:(nonnull CGContextRef __unused)context { // nothing to draw } diff --git a/framework/Source/CPTPlotRange.h b/framework/Source/CPTPlotRange.h index 6ba3f43ff..9a3460e96 100644 --- a/framework/Source/CPTPlotRange.h +++ b/framework/Source/CPTPlotRange.h @@ -7,10 +7,11 @@ /** * @brief Enumeration of possible results of a plot range comparison. **/ -typedef NS_ENUM (NSInteger, CPTPlotRangeComparisonResult) { +typedef NS_CLOSED_ENUM(NSInteger, CPTPlotRangeComparisonResult) { CPTPlotRangeComparisonResultNumberBelowRange, ///< Number is below the range. CPTPlotRangeComparisonResultNumberInRange, ///< Number is in the range. - CPTPlotRangeComparisonResultNumberAboveRange ///< Number is above the range. + CPTPlotRangeComparisonResultNumberAboveRange, ///< Number is above the range. + CPTPlotRangeComparisonResultNumberUndefined ///< Number is undefined (e.g., @NAN). }; /** @@ -46,6 +47,9 @@ typedef NSMutableArray CPTMutablePlotRangeArray; @property (nonatomic, readonly) double minLimitDouble; @property (nonatomic, readonly) double midPointDouble; @property (nonatomic, readonly) double maxLimitDouble; + +@property (nonatomic, readonly) BOOL isInfinite; +@property (nonatomic, readonly) CPTSign lengthSign; /// @} /// @name Factory Methods @@ -56,8 +60,8 @@ typedef NSMutableArray CPTMutablePlotRangeArray; /// @name Initialization /// @{ --(nonnull instancetype)initWithLocation:(nonnull NSNumber *)loc length:(nonnull NSNumber *)len; --(nonnull instancetype)initWithLocationDecimal:(NSDecimal)loc lengthDecimal:(NSDecimal)len NS_DESIGNATED_INITIALIZER; +-(nonnull instancetype)initWithLocation:(nonnull NSNumber *)loc length:(nonnull NSNumber *)len NS_DESIGNATED_INITIALIZER; +-(nonnull instancetype)initWithLocationDecimal:(NSDecimal)loc lengthDecimal:(NSDecimal)len; -(nullable instancetype)initWithCoder:(nonnull NSCoder *)decoder NS_DESIGNATED_INITIALIZER; /// @} diff --git a/framework/Source/CPTPlotRange.m b/framework/Source/CPTPlotRange.m index df3932021..c83c432e6 100644 --- a/framework/Source/CPTPlotRange.m +++ b/framework/Source/CPTPlotRange.m @@ -12,6 +12,9 @@ @interface CPTPlotRange() @property (nonatomic, readwrite) double locationDouble; @property (nonatomic, readwrite) double lengthDouble; +@property (nonatomic, readwrite) BOOL isInfinite; +@property (nonatomic, readwrite) CPTSign lengthSign; + @property (nonatomic, readwrite) BOOL inValueUpdate; @end @@ -121,6 +124,16 @@ @implementation CPTPlotRange **/ @dynamic maxLimitDouble; +/** @property BOOL isInfinite + * @brief @YES if the length of the range is infinite. + **/ +@synthesize isInfinite; + +/** @property CPTSign lengthSign + * @brief The direction (positive or negative) if the length of the range is infinite. + **/ +@synthesize lengthSign; + @synthesize inValueUpdate; #pragma mark - @@ -156,8 +169,24 @@ -(nonnull instancetype)initWithLocation:(nonnull NSNumber *)loc length:(nonnull NSParameterAssert(loc); NSParameterAssert(len); - return [self initWithLocationDecimal:loc.decimalValue - lengthDecimal:len.decimalValue]; + if ((self = [super init])) { + locationDecimal = loc.decimalValue; + locationDouble = loc.doubleValue; + + lengthDecimal = len.decimalValue; + lengthDouble = len.doubleValue; + + if ( isnan(lengthDouble)) { + isInfinite = NO; + lengthSign = CPTSignNone; + } + else { + isInfinite = (BOOL)isinf(lengthDouble); + lengthSign = signbit(lengthDouble) ? CPTSignNegative : CPTSignPositive; + } + } + + return self; } /** @brief Initializes a newly allocated CPTPlotRange object with the provided location and length. @@ -167,11 +196,8 @@ -(nonnull instancetype)initWithLocation:(nonnull NSNumber *)loc length:(nonnull **/ -(nonnull instancetype)initWithLocationDecimal:(NSDecimal)loc lengthDecimal:(NSDecimal)len { - if ( (self = [super init]) ) { - self.locationDecimal = loc; - self.lengthDecimal = len; - } - return self; + return [self initWithLocation:[NSDecimalNumber decimalNumberWithDecimal:loc] + length:[NSDecimalNumber decimalNumberWithDecimal:len]]; } /// @name Initialization @@ -204,11 +230,15 @@ -(NSNumber *)location -(void)setLocationDecimal:(NSDecimal)newLocation { - if ( !CPTDecimalEquals(locationDecimal, newLocation) ) { + if ( !CPTDecimalEquals(locationDecimal, newLocation)) { locationDecimal = newLocation; if ( !self.inValueUpdate ) { - self.locationDouble = [NSDecimalNumber decimalNumberWithDecimal:newLocation].doubleValue; + self.inValueUpdate = YES; + + self.locationDouble = CPTDecimalDoubleValue(newLocation); + + self.inValueUpdate = NO; } } } @@ -219,7 +249,11 @@ -(void)setLocationDouble:(double)newLocation locationDouble = newLocation; if ( !self.inValueUpdate ) { - self.locationDecimal = @(newLocation).decimalValue; + self.inValueUpdate = YES; + + self.locationDecimal = CPTDecimalFromDouble(newLocation); + + self.inValueUpdate = NO; } } } @@ -231,11 +265,15 @@ -(NSNumber *)length -(void)setLengthDecimal:(NSDecimal)newLength { - if ( !CPTDecimalEquals(lengthDecimal, newLength) ) { + if ( !CPTDecimalEquals(lengthDecimal, newLength)) { lengthDecimal = newLength; if ( !self.inValueUpdate ) { - self.lengthDouble = [NSDecimalNumber decimalNumberWithDecimal:newLength].doubleValue; + self.inValueUpdate = YES; + + self.lengthDouble = CPTDecimalDoubleValue(newLength); + + self.inValueUpdate = NO; } } } @@ -245,8 +283,21 @@ -(void)setLengthDouble:(double)newLength if ( lengthDouble != newLength ) { lengthDouble = newLength; + if ( isnan(newLength)) { + self.isInfinite = NO; + self.lengthSign = CPTSignNone; + } + else { + self.isInfinite = (BOOL)isinf(newLength); + self.lengthSign = signbit(newLength) ? CPTSignNegative : CPTSignPositive; + } + if ( !self.inValueUpdate ) { - self.lengthDecimal = @(newLength).decimalValue; + self.inValueUpdate = YES; + + self.lengthDecimal = CPTDecimalFromDouble(newLength); + + self.inValueUpdate = NO; } } } @@ -276,7 +327,10 @@ -(NSDecimal)minLimitDecimal NSDecimal loc = self.locationDecimal; NSDecimal len = self.lengthDecimal; - if ( CPTDecimalLessThan( len, CPTDecimalFromInteger(0) ) ) { + if ( NSDecimalIsNotANumber(&len)) { + return loc; + } + else if ( CPTDecimalLessThan(len, CPTDecimalFromInteger(0))) { return CPTDecimalAdd(loc, len); } else { @@ -304,7 +358,7 @@ -(NSNumber *)midPoint -(NSDecimal)midPointDecimal { - return CPTDecimalAdd( self.locationDecimal, CPTDecimalDivide( self.lengthDecimal, CPTDecimalFromInteger(2) ) ); + return CPTDecimalAdd(self.locationDecimal, CPTDecimalDivide(self.lengthDecimal, CPTDecimalFromInteger(2))); } -(double)midPointDouble @@ -322,7 +376,10 @@ -(NSDecimal)maxLimitDecimal NSDecimal loc = self.locationDecimal; NSDecimal len = self.lengthDecimal; - if ( CPTDecimalGreaterThan( len, CPTDecimalFromInteger(0) ) ) { + if ( NSDecimalIsNotANumber(&len)) { + return loc; + } + else if ( CPTDecimalGreaterThan(len, CPTDecimalFromInteger(0))) { return CPTDecimalAdd(loc, len); } else { @@ -355,10 +412,15 @@ -(nonnull id)copyWithZone:(nullable NSZone *)zone CPTPlotRange *newRange = [[CPTPlotRange allocWithZone:zone] init]; if ( newRange ) { + newRange.inValueUpdate = YES; + newRange.locationDecimal = self.locationDecimal; - newRange.lengthDecimal = self.lengthDecimal; newRange.locationDouble = self.locationDouble; - newRange.lengthDouble = self.lengthDouble; + + newRange.lengthDecimal = self.lengthDecimal; + newRange.lengthDouble = self.lengthDouble; + + newRange.inValueUpdate = NO; } return newRange; } @@ -375,10 +437,15 @@ -(nonnull id)mutableCopyWithZone:(nullable NSZone *)zone CPTPlotRange *newRange = [[CPTMutablePlotRange allocWithZone:zone] init]; if ( newRange ) { + newRange.inValueUpdate = YES; + newRange.locationDecimal = self.locationDecimal; - newRange.lengthDecimal = self.lengthDecimal; newRange.locationDouble = self.locationDouble; - newRange.lengthDouble = self.lengthDouble; + + newRange.lengthDecimal = self.lengthDecimal; + newRange.lengthDouble = self.lengthDouble; + + newRange.inValueUpdate = NO; } return newRange; } @@ -394,6 +461,8 @@ -(void)encodeWithCoder:(nonnull NSCoder *)encoder { [encoder encodeDecimal:self.locationDecimal forKey:@"CPTPlotRange.location"]; [encoder encodeDecimal:self.lengthDecimal forKey:@"CPTPlotRange.length"]; + [encoder encodeBool:self.isInfinite forKey:@"CPTPlotRange.isInfinite"]; + [encoder encodeInteger:self.lengthSign forKey:@"CPTPlotRange.lengthSign"]; } /// @endcond @@ -404,9 +473,12 @@ -(void)encodeWithCoder:(nonnull NSCoder *)encoder */ -(nullable instancetype)initWithCoder:(nonnull NSCoder *)decoder { - if ( (self = [super init]) ) { + if ((self = [super init])) { self.locationDecimal = [decoder decodeDecimalForKey:@"CPTPlotRange.location"]; self.lengthDecimal = [decoder decodeDecimalForKey:@"CPTPlotRange.length"]; + + isInfinite = [decoder decodeBoolForKey:@"CPTPlotRange.isInfinite"]; + lengthSign = [decoder decodeIntegerForKey:@"CPTPlotRange.lengthSign"]; } return self; @@ -433,7 +505,27 @@ +(BOOL)supportsSecureCoding **/ -(BOOL)contains:(NSDecimal)number { - return CPTDecimalGreaterThanOrEqualTo(number, self.minLimitDecimal) && CPTDecimalLessThanOrEqualTo(number, self.maxLimitDecimal); + BOOL result = NO; + + if ( self.isInfinite ) { + switch ( self.lengthSign ) { + case CPTSignPositive: + result = CPTDecimalGreaterThanOrEqualTo(number, self.minLimitDecimal); + break; + + case CPTSignNegative: + result = CPTDecimalLessThanOrEqualTo(number, self.maxLimitDecimal); + break; + + default: + break; + } + } + else { + result = CPTDecimalGreaterThanOrEqualTo(number, self.minLimitDecimal) && CPTDecimalLessThanOrEqualTo(number, self.maxLimitDecimal); + } + + return result; } /** @brief Determines whether a given number is inside the range. @@ -452,12 +544,10 @@ -(BOOL)containsDouble:(double)number -(BOOL)containsNumber:(nullable NSNumber *)number { if ( [number isKindOfClass:[NSDecimalNumber class]] ) { - NSDecimal numericValue = number.decimalValue; - return CPTDecimalGreaterThanOrEqualTo(numericValue, self.minLimitDecimal) && CPTDecimalLessThanOrEqualTo(numericValue, self.maxLimitDecimal); + return [self contains:number.decimalValue]; } else { - double numericValue = number.doubleValue; - return (numericValue >= self.minLimitDouble) && (numericValue <= self.maxLimitDouble); + return [self containsDouble:number.doubleValue]; } } @@ -468,7 +558,10 @@ -(BOOL)containsNumber:(nullable NSNumber *)number -(BOOL)isEqualToRange:(nullable CPTPlotRange *)otherRange { if ( otherRange ) { - return CPTDecimalEquals(self.locationDecimal, otherRange.locationDecimal) && CPTDecimalEquals(self.lengthDecimal, otherRange.lengthDecimal); + return CPTDecimalEquals(self.locationDecimal, otherRange.locationDecimal) && + CPTDecimalEquals(self.lengthDecimal, otherRange.lengthDecimal) && + (self.isInfinite == otherRange.isInfinite) && + (self.lengthSign == otherRange.lengthSign); } else { return NO; @@ -481,12 +574,31 @@ -(BOOL)isEqualToRange:(nullable CPTPlotRange *)otherRange **/ -(BOOL)containsRange:(nullable CPTPlotRange *)otherRange { + BOOL result = NO; + if ( otherRange ) { - return CPTDecimalGreaterThanOrEqualTo(otherRange.minLimitDecimal, self.minLimitDecimal) && CPTDecimalLessThanOrEqualTo(otherRange.maxLimitDecimal, self.maxLimitDecimal); - } - else { - return NO; + if ( self.isInfinite ) { + if ( !otherRange.isInfinite || (otherRange.lengthSign == self.lengthSign)) { + switch ( self.lengthSign ) { + case CPTSignPositive: + result = CPTDecimalGreaterThanOrEqualTo(otherRange.minLimitDecimal, self.minLimitDecimal); + break; + + case CPTSignNegative: + result = CPTDecimalLessThanOrEqualTo(otherRange.maxLimitDecimal, self.maxLimitDecimal); + break; + + default: + break; + } + } + } + else { + result = CPTDecimalGreaterThanOrEqualTo(otherRange.minLimitDecimal, self.minLimitDecimal) && CPTDecimalLessThanOrEqualTo(otherRange.maxLimitDecimal, self.maxLimitDecimal); + } } + + return result; } /** @brief Determines whether a given range intersects the receiver. @@ -495,19 +607,58 @@ -(BOOL)containsRange:(nullable CPTPlotRange *)otherRange **/ -(BOOL)intersectsRange:(nullable CPTPlotRange *)otherRange { - if ( !otherRange ) { - return NO; - } - - NSDecimal min1 = self.minLimitDecimal; - NSDecimal min2 = otherRange.minLimitDecimal; - NSDecimal minimum = CPTDecimalGreaterThan(min1, min2) ? min1 : min2; + BOOL result = NO; - NSDecimal max1 = self.maxLimitDecimal; - NSDecimal max2 = otherRange.maxLimitDecimal; - NSDecimal maximum = CPTDecimalLessThan(max1, max2) ? max1 : max2; + if ( otherRange ) { + if ( self.isInfinite ) { + if ( otherRange.isInfinite ) { + result = (otherRange.lengthSign == self.lengthSign); + } + if ( !result ) { + switch ( self.lengthSign ) { + case CPTSignPositive: + result = CPTDecimalGreaterThanOrEqualTo(otherRange.maxLimitDecimal, self.minLimitDecimal); + break; + + case CPTSignNegative: + result = CPTDecimalLessThanOrEqualTo(otherRange.minLimitDecimal, self.maxLimitDecimal); + break; + + default: + break; + } + } + } + else { + if ( otherRange.isInfinite ) { + switch ( otherRange.lengthSign ) { + case CPTSignPositive: + result = CPTDecimalLessThanOrEqualTo(otherRange.minLimitDecimal, self.maxLimitDecimal); + break; + + case CPTSignNegative: + result = CPTDecimalLessThanOrEqualTo(otherRange.maxLimitDecimal, self.minLimitDecimal); + break; + + default: + break; + } + } + else { + NSDecimal min1 = self.minLimitDecimal; + NSDecimal min2 = otherRange.minLimitDecimal; + NSDecimal minimum = CPTDecimalMax(min1, min2); + + NSDecimal max1 = self.maxLimitDecimal; + NSDecimal max2 = otherRange.maxLimitDecimal; + NSDecimal maximum = CPTDecimalMin(max1, max2); + + result = CPTDecimalGreaterThanOrEqualTo(maximum, minimum); + } + } + } - return CPTDecimalGreaterThanOrEqualTo(maximum, minimum); + return result; } /** @brief Compares a number to the range, determining if it is in the range, or above or below it. @@ -535,10 +686,13 @@ -(CPTPlotRangeComparisonResult)compareToDecimal:(NSDecimal)number { CPTPlotRangeComparisonResult result; - if ( [self contains:number] ) { + if ( NSDecimalIsNotANumber(&number)) { + result = CPTPlotRangeComparisonResultNumberUndefined; + } + else if ( [self contains:number] ) { result = CPTPlotRangeComparisonResultNumberInRange; } - else if ( CPTDecimalLessThan(number, self.minLimitDecimal) ) { + else if ( CPTDecimalLessThan(number, self.minLimitDecimal)) { result = CPTPlotRangeComparisonResultNumberBelowRange; } else { @@ -555,7 +709,10 @@ -(CPTPlotRangeComparisonResult)compareToDouble:(double)number { CPTPlotRangeComparisonResult result; - if ( number < self.minLimitDouble ) { + if ( isnan(number)) { + result = CPTPlotRangeComparisonResultNumberUndefined; + } + else if ( number < self.minLimitDouble ) { result = CPTPlotRangeComparisonResultNumberBelowRange; } else if ( number > self.maxLimitDouble ) { @@ -608,7 +765,7 @@ -(nullable NSString *)description return [NSString stringWithFormat:@"<%@ {%@, %@}>", super.description, NSDecimalString(&myLocation, [NSLocale currentLocale]), - NSDecimalString(&myLength, [NSLocale currentLocale])]; + self.isInfinite ? (self.lengthSign == CPTSignPositive ? @"+INF" : @"-INF") : NSDecimalString(&myLength, [NSLocale currentLocale])]; } /// @endcond @@ -625,7 +782,7 @@ -(nullable id)debugQuickLookObject return [NSString stringWithFormat:@"Location: %@\nLength: %@", NSDecimalString(&myLocation, [NSLocale currentLocale]), - NSDecimalString(&myLength, [NSLocale currentLocale])]; + self.isInfinite ? (self.lengthSign == CPTSignPositive ? @"+INF" : @"-INF") : NSDecimalString(&myLength, [NSLocale currentLocale])]; } /// @endcond diff --git a/framework/Source/CPTPlotRangeTests.m b/framework/Source/CPTPlotRangeTests.m index 0701a3d48..c5cfeabd0 100644 --- a/framework/Source/CPTPlotRangeTests.m +++ b/framework/Source/CPTPlotRangeTests.m @@ -37,6 +37,17 @@ -(void)testContains XCTAssertFalse([self.plotRange contains:CPTDecimalFromDouble(3.001)], @"Test contains:3.001"); } +-(void)testContainsInfinite +{ + self.plotRange.lengthDouble = HUGE_VAL; + + XCTAssertFalse([self.plotRange contains:CPTDecimalFromDouble(0.999)], @"Test contains:0.999"); + XCTAssertTrue([self.plotRange contains:CPTDecimalFromDouble(1.0)], @"Test contains:1.0"); + XCTAssertTrue([self.plotRange contains:CPTDecimalFromDouble(2.0)], @"Test contains:2.0"); + XCTAssertTrue([self.plotRange contains:CPTDecimalFromDouble(3.0)], @"Test contains:3.0"); + XCTAssertTrue([self.plotRange contains:CPTDecimalFromDouble(3.001)], @"Test contains:3.001"); +} + -(void)testContainsNegative { self.plotRange.lengthDouble = -2.0; @@ -48,6 +59,17 @@ -(void)testContainsNegative XCTAssertFalse([self.plotRange contains:CPTDecimalFromDouble(1.001)], @"Test contains:1.001"); } +-(void)testContainsNegativeInfinite +{ + self.plotRange.lengthDouble = -HUGE_VAL; + + XCTAssertTrue([self.plotRange contains:CPTDecimalFromDouble(-1.001)], @"Test contains:-1.001"); + XCTAssertTrue([self.plotRange contains:CPTDecimalFromDouble(-1.0)], @"Test contains:-1.0"); + XCTAssertTrue([self.plotRange contains:CPTDecimalFromDouble(0.0)], @"Test contains:0.0"); + XCTAssertTrue([self.plotRange contains:CPTDecimalFromDouble(1.0)], @"Test contains:1.0"); + XCTAssertFalse([self.plotRange contains:CPTDecimalFromDouble(1.001)], @"Test contains:1.001"); +} + -(void)testContainsDouble { XCTAssertFalse([self.plotRange containsDouble:0.999], @"Test contains:0.999"); @@ -57,6 +79,17 @@ -(void)testContainsDouble XCTAssertFalse([self.plotRange containsDouble:3.001], @"Test contains:3.001"); } +-(void)testContainsDoubleInfinite +{ + self.plotRange.lengthDouble = HUGE_VAL; + + XCTAssertFalse([self.plotRange containsDouble:0.999], @"Test contains:0.999"); + XCTAssertTrue([self.plotRange containsDouble:1.0], @"Test contains:1.0"); + XCTAssertTrue([self.plotRange containsDouble:2.0], @"Test contains:2.0"); + XCTAssertTrue([self.plotRange containsDouble:3.0], @"Test contains:3.0"); + XCTAssertTrue([self.plotRange containsDouble:3.001], @"Test contains:3.001"); +} + -(void)testContainsNumber { XCTAssertFalse([self.plotRange containsNumber:@(0.999)], @"Test contains:0.999"); @@ -66,6 +99,17 @@ -(void)testContainsNumber XCTAssertFalse([self.plotRange containsNumber:@(3.001)], @"Test contains:3.001"); } +-(void)testContainsNumberInfinite +{ + self.plotRange.lengthDouble = HUGE_VAL; + + XCTAssertFalse([self.plotRange containsNumber:@(0.999)], @"Test contains:0.999"); + XCTAssertTrue([self.plotRange containsNumber:[NSDecimalNumber one]], @"Test contains:1.0"); + XCTAssertTrue([self.plotRange containsNumber:@(2.0)], @"Test contains:2.0"); + XCTAssertTrue([self.plotRange containsNumber:@(3.0)], @"Test contains:3.0"); + XCTAssertTrue([self.plotRange containsNumber:@(3.001)], @"Test contains:3.001"); +} + -(void)testContainsDoubleNegative { self.plotRange.lengthDouble = -2.0; @@ -77,6 +121,17 @@ -(void)testContainsDoubleNegative XCTAssertFalse([self.plotRange containsDouble:1.001], @"Test contains:1.001"); } +-(void)testContainsDoubleNegativeInfinite +{ + self.plotRange.lengthDouble = -HUGE_VAL; + + XCTAssertTrue([self.plotRange containsDouble:-1.001], @"Test contains:-1.001"); + XCTAssertTrue([self.plotRange containsDouble:-1.0], @"Test contains:-1.0"); + XCTAssertTrue([self.plotRange containsDouble:0.0], @"Test contains:0.0"); + XCTAssertTrue([self.plotRange containsDouble:1.0], @"Test contains:1.0"); + XCTAssertFalse([self.plotRange containsDouble:1.001], @"Test contains:1.001"); +} + -(void)testContainsRange { CPTPlotRange *otherRange = [CPTPlotRange plotRangeWithLocation:@0.0 length:@4.0]; @@ -96,6 +151,48 @@ -(void)testContainsRange XCTAssertFalse([self.plotRange containsRange:otherRange], @"otherRange was {%g, %g}", otherRange.locationDouble, otherRange.lengthDouble); } +-(void)testContainsRangeInfinite +{ + self.plotRange.lengthDouble = HUGE_VAL; + + CPTPlotRange *otherRange = [CPTPlotRange plotRangeWithLocation:@0.0 length:@4.0]; + + XCTAssertFalse([self.plotRange containsRange:otherRange], @"otherRange was {%g, %g}", otherRange.locationDouble, otherRange.lengthDouble); + + otherRange = [CPTPlotRange plotRangeWithLocation:@1.0 length:@2.0]; + XCTAssertTrue([self.plotRange containsRange:otherRange], @"otherRange was {%g, %g}", otherRange.locationDouble, otherRange.lengthDouble); + + otherRange = [CPTPlotRange plotRangeWithLocation:@2.0 length:@1.0]; + XCTAssertTrue([self.plotRange containsRange:otherRange], @"otherRange was {%g, %g}", otherRange.locationDouble, otherRange.lengthDouble); + + otherRange = [CPTPlotRange plotRangeWithLocation:@2.0 length:@4.0]; + XCTAssertTrue([self.plotRange containsRange:otherRange], @"otherRange was {%g, %g}", otherRange.locationDouble, otherRange.lengthDouble); + + otherRange = [CPTPlotRange plotRangeWithLocation:@0.0 length:@2.0]; + XCTAssertFalse([self.plotRange containsRange:otherRange], @"otherRange was {%g, %g}", otherRange.locationDouble, otherRange.lengthDouble); +} + +-(void)testContainsRangeNegativeInfinite +{ + self.plotRange.lengthDouble = -HUGE_VAL; + + CPTPlotRange *otherRange = [CPTPlotRange plotRangeWithLocation:@0.0 length:@4.0]; + + XCTAssertFalse([self.plotRange containsRange:otherRange], @"otherRange was {%g, %g}", otherRange.locationDouble, otherRange.lengthDouble); + + otherRange = [CPTPlotRange plotRangeWithLocation:@1.0 length:@(-2.0)]; + XCTAssertTrue([self.plotRange containsRange:otherRange], @"otherRange was {%g, %g}", otherRange.locationDouble, otherRange.lengthDouble); + + otherRange = [CPTPlotRange plotRangeWithLocation:@2.0 length:@(-1.0)]; + XCTAssertFalse([self.plotRange containsRange:otherRange], @"otherRange was {%g, %g}", otherRange.locationDouble, otherRange.lengthDouble); + + otherRange = [CPTPlotRange plotRangeWithLocation:@2.0 length:@4.0]; + XCTAssertFalse([self.plotRange containsRange:otherRange], @"otherRange was {%g, %g}", otherRange.locationDouble, otherRange.lengthDouble); + + otherRange = [CPTPlotRange plotRangeWithLocation:@0.0 length:@(-2.0)]; + XCTAssertTrue([self.plotRange containsRange:otherRange], @"otherRange was {%g, %g}", otherRange.locationDouble, otherRange.lengthDouble); +} + #pragma mark - #pragma mark Union @@ -120,6 +217,32 @@ -(void)testUnionRange [self checkRangeWithLocation:-5.0 length:12.0]; } +-(void)testUnionRangeInfinite +{ + self.plotRange.lengthDouble = HUGE_VAL; + + [self.plotRange unionPlotRange:[CPTPlotRange plotRangeWithLocation:@0.0 length:@4.0]]; + [self checkRangeWithLocation:0.0 length:HUGE_VAL]; + + [self.plotRange unionPlotRange:[CPTPlotRange plotRangeWithLocation:@(-1.0) length:@1.0]]; + [self checkRangeWithLocation:-1.0 length:HUGE_VAL]; + + [self.plotRange unionPlotRange:[CPTPlotRange plotRangeWithLocation:@5.0 length:@2.0]]; + [self checkRangeWithLocation:-1.0 length:HUGE_VAL]; + + [self.plotRange unionPlotRange:[CPTPlotRange plotRangeWithLocation:@0.0 length:@(-4.0)]]; + [self checkRangeWithLocation:-4.0 length:HUGE_VAL]; + + [self.plotRange unionPlotRange:[CPTPlotRange plotRangeWithLocation:@(-1.0) length:@(-4.0)]]; + [self checkRangeWithLocation:-5.0 length:HUGE_VAL]; + + [self.plotRange unionPlotRange:[CPTPlotRange plotRangeWithLocation:@5.0 length:@(HUGE_VAL)]]; + [self checkRangeWithLocation:-5.0 length:HUGE_VAL]; + + [self.plotRange unionPlotRange:[CPTPlotRange plotRangeWithLocation:@5.0 length:@(-HUGE_VAL)]]; + [self checkRangeWithLocation:-HUGE_VAL length:HUGE_VAL]; +} + -(void)testUnionRangeNegative { self.plotRange.lengthDouble = -2.0; @@ -143,6 +266,32 @@ -(void)testUnionRangeNegative [self checkRangeWithLocation:7.0 length:-12.0]; } +-(void)testUnionRangeNegativeInfinite +{ + self.plotRange.lengthDouble = -HUGE_VAL; + + [self.plotRange unionPlotRange:[CPTPlotRange plotRangeWithLocation:@0.0 length:@4.0]]; + [self checkRangeWithLocation:4.0 length:-HUGE_VAL]; + + [self.plotRange unionPlotRange:[CPTPlotRange plotRangeWithLocation:@(-1.0) length:@1.0]]; + [self checkRangeWithLocation:4.0 length:-HUGE_VAL]; + + [self.plotRange unionPlotRange:[CPTPlotRange plotRangeWithLocation:@5.0 length:@2.0]]; + [self checkRangeWithLocation:7.0 length:-HUGE_VAL]; + + [self.plotRange unionPlotRange:[CPTPlotRange plotRangeWithLocation:@0.0 length:@(-4.0)]]; + [self checkRangeWithLocation:7.0 length:-HUGE_VAL]; + + [self.plotRange unionPlotRange:[CPTPlotRange plotRangeWithLocation:@(-1.0) length:@(-4.0)]]; + [self checkRangeWithLocation:7.0 length:-HUGE_VAL]; + + [self.plotRange unionPlotRange:[CPTPlotRange plotRangeWithLocation:@10.0 length:@(-HUGE_VAL)]]; + [self checkRangeWithLocation:10.0 length:-HUGE_VAL]; + + [self.plotRange unionPlotRange:[CPTPlotRange plotRangeWithLocation:@5.0 length:@(HUGE_VAL)]]; + [self checkRangeWithLocation:-HUGE_VAL length:HUGE_VAL]; +} + #pragma mark - #pragma mark Intersection @@ -162,7 +311,7 @@ -(void)testIntersectRange otherRange = [CPTPlotRange plotRangeWithLocation:@(-1.0) length:@1.0]; XCTAssertFalse([self.plotRange intersectsRange:otherRange], @"otherRange was {%g, %g}", otherRange.locationDouble, otherRange.lengthDouble); [self.plotRange intersectionPlotRange:otherRange]; - [self checkRangeWithLocation:1.0 length:0.0]; + [self checkRangeWithLocation:(double)NAN length:(double)NAN]; } -(void)testIntersectRange2 @@ -181,7 +330,7 @@ -(void)testIntersectRange2 otherRange = [CPTPlotRange plotRangeWithLocation:@0.0 length:@(-4.0)]; XCTAssertFalse([self.plotRange intersectsRange:otherRange], @"otherRange was {%g, %g}", otherRange.locationDouble, otherRange.lengthDouble); [self.plotRange intersectionPlotRange:otherRange]; - [self checkRangeWithLocation:1.0 length:0.0]; + [self checkRangeWithLocation:(double)NAN length:(double)NAN]; } -(void)testIntersectRangeNegative @@ -201,7 +350,7 @@ -(void)testIntersectRangeNegative otherRange = [CPTPlotRange plotRangeWithLocation:@5.0 length:@2.0]; XCTAssertFalse([self.plotRange intersectsRange:otherRange], @"otherRange was {%g, %g}", otherRange.locationDouble, otherRange.lengthDouble); [self.plotRange intersectionPlotRange:otherRange]; - [self checkRangeWithLocation:1.0 length:0.0]; + [self checkRangeWithLocation:(double)NAN length:(double)NAN]; } -(void)testIntersectRangeNegative2 @@ -221,7 +370,67 @@ -(void)testIntersectRangeNegative2 otherRange = [CPTPlotRange plotRangeWithLocation:@5.0 length:@(-4.0)]; XCTAssertFalse([self.plotRange intersectsRange:otherRange], @"otherRange was {%g, %g}", otherRange.locationDouble, otherRange.lengthDouble); [self.plotRange intersectionPlotRange:otherRange]; - [self checkRangeWithLocation:0.0 length:0.0]; + [self checkRangeWithLocation:(double)NAN length:(double)NAN]; +} + +-(void)testIntersectRangeInfinite1 +{ + self.plotRange.lengthDouble = HUGE_VAL; + + CPTPlotRange *otherRange = [CPTPlotRange plotRangeWithLocation:@0.0 length:@4.0]; + XCTAssertTrue([self.plotRange intersectsRange:otherRange], @"otherRange was {%g, %g}", otherRange.locationDouble, otherRange.lengthDouble); + [self.plotRange intersectionPlotRange:otherRange]; + [self checkRangeWithLocation:1.0 length:3.0]; +} + +-(void)testIntersectRangeInfinite2 +{ + self.plotRange.lengthDouble = HUGE_VAL; + + CPTPlotRange *otherRange = [CPTPlotRange plotRangeWithLocation:@0.0 length:@(HUGE_VAL)]; + XCTAssertTrue([self.plotRange intersectsRange:otherRange], @"otherRange was {%g, %g}", otherRange.locationDouble, otherRange.lengthDouble); + [self.plotRange intersectionPlotRange:otherRange]; + [self checkRangeWithLocation:1.0 length:HUGE_VAL]; +} + +-(void)testIntersectRangeInfinite3 +{ + self.plotRange.lengthDouble = HUGE_VAL; + + CPTPlotRange *otherRange = [CPTPlotRange plotRangeWithLocation:@0.0 length:@(-4.0)]; + XCTAssertFalse([self.plotRange intersectsRange:otherRange], @"otherRange was {%g, %g}", otherRange.locationDouble, otherRange.lengthDouble); + [self.plotRange intersectionPlotRange:otherRange]; + [self checkRangeWithLocation:(double)NAN length:(double)NAN]; +} + +-(void)testIntersectRangeNegativeInfinite1 +{ + self.plotRange.lengthDouble = -HUGE_VAL; + + CPTPlotRange *otherRange = [CPTPlotRange plotRangeWithLocation:@0.0 length:@4.0]; + XCTAssertTrue([self.plotRange intersectsRange:otherRange], @"otherRange was {%g, %g}", otherRange.locationDouble, otherRange.lengthDouble); + [self.plotRange intersectionPlotRange:otherRange]; + [self checkRangeWithLocation:1.0 length:-1.0]; +} + +-(void)testIntersectRangeNegativeInfinite2 +{ + self.plotRange.lengthDouble = -HUGE_VAL; + + CPTPlotRange *otherRange = [CPTPlotRange plotRangeWithLocation:@0.0 length:@(-HUGE_VAL)]; + XCTAssertTrue([self.plotRange intersectsRange:otherRange], @"otherRange was {%g, %g}", otherRange.locationDouble, otherRange.lengthDouble); + [self.plotRange intersectionPlotRange:otherRange]; + [self checkRangeWithLocation:0.0 length:-HUGE_VAL]; +} + +-(void)testIntersectRangeNegativeInfinite3 +{ + self.plotRange.lengthDouble = -HUGE_VAL; + + CPTPlotRange *otherRange = [CPTPlotRange plotRangeWithLocation:@10.0 length:@(-4.0)]; + XCTAssertFalse([self.plotRange intersectsRange:otherRange], @"otherRange was {%g, %g}", otherRange.locationDouble, otherRange.lengthDouble); + [self.plotRange intersectionPlotRange:otherRange]; + [self checkRangeWithLocation:(double)NAN length:(double)NAN]; } #pragma mark - @@ -370,6 +579,19 @@ -(void)testCompareToDecimal XCTAssertEqual([self.plotRange compareToDecimal:CPTDecimalFromDouble(2.0)], CPTPlotRangeComparisonResultNumberInRange, @"Test compareTo:2.0"); XCTAssertEqual([self.plotRange compareToDecimal:CPTDecimalFromDouble(3.0)], CPTPlotRangeComparisonResultNumberInRange, @"Test compareTo:3.0"); XCTAssertEqual([self.plotRange compareToDecimal:CPTDecimalFromDouble(3.001)], CPTPlotRangeComparisonResultNumberAboveRange, @"Test compareTo:3.001"); + XCTAssertEqual([self.plotRange compareToDecimal:CPTDecimalNaN()], CPTPlotRangeComparisonResultNumberUndefined, @"Test compareTo:NAN"); +} + +-(void)testCompareToDecimalInfinite +{ + self.plotRange.lengthDouble = HUGE_VAL; + + XCTAssertEqual([self.plotRange compareToDecimal:CPTDecimalFromDouble(0.999)], CPTPlotRangeComparisonResultNumberBelowRange, @"Test compareTo:0.999"); + XCTAssertEqual([self.plotRange compareToDecimal:CPTDecimalFromDouble(1.0)], CPTPlotRangeComparisonResultNumberInRange, @"Test compareTo:1.0"); + XCTAssertEqual([self.plotRange compareToDecimal:CPTDecimalFromDouble(2.0)], CPTPlotRangeComparisonResultNumberInRange, @"Test compareTo:2.0"); + XCTAssertEqual([self.plotRange compareToDecimal:CPTDecimalFromDouble(3.0)], CPTPlotRangeComparisonResultNumberInRange, @"Test compareTo:3.0"); + XCTAssertEqual([self.plotRange compareToDecimal:CPTDecimalFromDouble(3.001)], CPTPlotRangeComparisonResultNumberInRange, @"Test compareTo:3.001"); + XCTAssertEqual([self.plotRange compareToDecimal:CPTDecimalNaN()], CPTPlotRangeComparisonResultNumberUndefined, @"Test compareTo:NAN"); } -(void)testCompareToDecimalNegative @@ -381,6 +603,19 @@ -(void)testCompareToDecimalNegative XCTAssertEqual([self.plotRange compareToDecimal:CPTDecimalFromDouble(0.0)], CPTPlotRangeComparisonResultNumberInRange, @"Test compareTo:0.0"); XCTAssertEqual([self.plotRange compareToDecimal:CPTDecimalFromDouble(1.0)], CPTPlotRangeComparisonResultNumberInRange, @"Test compareTo:1.0"); XCTAssertEqual([self.plotRange compareToDecimal:CPTDecimalFromDouble(1.001)], CPTPlotRangeComparisonResultNumberAboveRange, @"Test compareTo:1.001"); + XCTAssertEqual([self.plotRange compareToDecimal:CPTDecimalNaN()], CPTPlotRangeComparisonResultNumberUndefined, @"Test compareTo:NAN"); +} + +-(void)testCompareToDecimalNegativeInfinite +{ + self.plotRange.lengthDouble = -HUGE_VAL; + + XCTAssertEqual([self.plotRange compareToDecimal:CPTDecimalFromDouble(-1.001)], CPTPlotRangeComparisonResultNumberInRange, @"Test compareTo:-1.001"); + XCTAssertEqual([self.plotRange compareToDecimal:CPTDecimalFromDouble(-1.0)], CPTPlotRangeComparisonResultNumberInRange, @"Test compareTo:-1.0"); + XCTAssertEqual([self.plotRange compareToDecimal:CPTDecimalFromDouble(0.0)], CPTPlotRangeComparisonResultNumberInRange, @"Test compareTo:0.0"); + XCTAssertEqual([self.plotRange compareToDecimal:CPTDecimalFromDouble(1.0)], CPTPlotRangeComparisonResultNumberInRange, @"Test compareTo:1.0"); + XCTAssertEqual([self.plotRange compareToDecimal:CPTDecimalFromDouble(1.001)], CPTPlotRangeComparisonResultNumberAboveRange, @"Test compareTo:1.001"); + XCTAssertEqual([self.plotRange compareToDecimal:CPTDecimalNaN()], CPTPlotRangeComparisonResultNumberUndefined, @"Test compareTo:NAN"); } -(void)testCompareToDouble @@ -390,6 +625,23 @@ -(void)testCompareToDouble XCTAssertEqual([self.plotRange compareToDouble:2.0], CPTPlotRangeComparisonResultNumberInRange, @"Test compareTo:2.0"); XCTAssertEqual([self.plotRange compareToDouble:3.0], CPTPlotRangeComparisonResultNumberInRange, @"Test compareTo:3.0"); XCTAssertEqual([self.plotRange compareToDouble:3.001], CPTPlotRangeComparisonResultNumberAboveRange, @"Test compareTo:3.001"); + XCTAssertEqual([self.plotRange compareToDouble:HUGE_VAL], CPTPlotRangeComparisonResultNumberAboveRange, @"Test compareTo:+INF"); + XCTAssertEqual([self.plotRange compareToDouble:-HUGE_VAL], CPTPlotRangeComparisonResultNumberBelowRange, @"Test compareTo:-INF"); + XCTAssertEqual([self.plotRange compareToDouble:(double)NAN], CPTPlotRangeComparisonResultNumberUndefined, @"Test compareTo:NAN"); +} + +-(void)testCompareToDoubleInfinite +{ + self.plotRange.lengthDouble = HUGE_VAL; + + XCTAssertEqual([self.plotRange compareToDouble:0.999], CPTPlotRangeComparisonResultNumberBelowRange, @"Test compareTo:0.999"); + XCTAssertEqual([self.plotRange compareToDouble:1.0], CPTPlotRangeComparisonResultNumberInRange, @"Test compareTo:1.0"); + XCTAssertEqual([self.plotRange compareToDouble:2.0], CPTPlotRangeComparisonResultNumberInRange, @"Test compareTo:2.0"); + XCTAssertEqual([self.plotRange compareToDouble:3.0], CPTPlotRangeComparisonResultNumberInRange, @"Test compareTo:3.0"); + XCTAssertEqual([self.plotRange compareToDouble:3.001], CPTPlotRangeComparisonResultNumberInRange, @"Test compareTo:3.001"); + XCTAssertEqual([self.plotRange compareToDouble:HUGE_VAL], CPTPlotRangeComparisonResultNumberInRange, @"Test compareTo:+INF"); + XCTAssertEqual([self.plotRange compareToDouble:-HUGE_VAL], CPTPlotRangeComparisonResultNumberBelowRange, @"Test compareTo:-INF"); + XCTAssertEqual([self.plotRange compareToDouble:(double)NAN], CPTPlotRangeComparisonResultNumberUndefined, @"Test compareTo:NAN"); } -(void)testCompareToDoubleNegative @@ -401,6 +653,23 @@ -(void)testCompareToDoubleNegative XCTAssertEqual([self.plotRange compareToDouble:0.0], CPTPlotRangeComparisonResultNumberInRange, @"Test compareTo:0.0"); XCTAssertEqual([self.plotRange compareToDouble:1.0], CPTPlotRangeComparisonResultNumberInRange, @"Test compareTo:1.0"); XCTAssertEqual([self.plotRange compareToDouble:1.001], CPTPlotRangeComparisonResultNumberAboveRange, @"Test compareTo:1.001"); + XCTAssertEqual([self.plotRange compareToDouble:HUGE_VAL], CPTPlotRangeComparisonResultNumberAboveRange, @"Test compareTo:+INF"); + XCTAssertEqual([self.plotRange compareToDouble:-HUGE_VAL], CPTPlotRangeComparisonResultNumberBelowRange, @"Test compareTo:-INF"); + XCTAssertEqual([self.plotRange compareToDouble:(double)NAN], CPTPlotRangeComparisonResultNumberUndefined, @"Test compareTo:NAN"); +} + +-(void)testCompareToDoubleNegativeInfinite +{ + self.plotRange.lengthDouble = -HUGE_VAL; + + XCTAssertEqual([self.plotRange compareToDouble:-1.001], CPTPlotRangeComparisonResultNumberInRange, @"Test compareTo:-1.001"); + XCTAssertEqual([self.plotRange compareToDouble:-1.0], CPTPlotRangeComparisonResultNumberInRange, @"Test compareTo:-1.0"); + XCTAssertEqual([self.plotRange compareToDouble:0.0], CPTPlotRangeComparisonResultNumberInRange, @"Test compareTo:0.0"); + XCTAssertEqual([self.plotRange compareToDouble:1.0], CPTPlotRangeComparisonResultNumberInRange, @"Test compareTo:1.0"); + XCTAssertEqual([self.plotRange compareToDouble:1.001], CPTPlotRangeComparisonResultNumberAboveRange, @"Test compareTo:1.001"); + XCTAssertEqual([self.plotRange compareToDouble:HUGE_VAL], CPTPlotRangeComparisonResultNumberAboveRange, @"Test compareTo:+INF"); + XCTAssertEqual([self.plotRange compareToDouble:-HUGE_VAL], CPTPlotRangeComparisonResultNumberInRange, @"Test compareTo:-INF"); + XCTAssertEqual([self.plotRange compareToDouble:(double)NAN], CPTPlotRangeComparisonResultNumberUndefined, @"Test compareTo:NAN"); } #pragma mark - @@ -423,11 +692,11 @@ -(void)checkRangeWithLocation:(double)loc length:(double)len NSDecimal newLocation = self.plotRange.locationDecimal; errMessage = [NSString stringWithFormat:@"expected location = %g, was %@", loc, NSDecimalString(&newLocation, nil)]; - XCTAssertTrue(CPTDecimalEquals( newLocation, CPTDecimalFromDouble(loc) ), @"%@", errMessage); + XCTAssertTrue(CPTDecimalEquals(newLocation, CPTDecimalFromDouble(loc)), @"%@", errMessage); NSDecimal newLength = self.plotRange.lengthDecimal; errMessage = [NSString stringWithFormat:@"expected location = %g, was %@", loc, NSDecimalString(&newLength, nil)]; - XCTAssertTrue(CPTDecimalEquals( newLength, CPTDecimalFromDouble(len) ), @"%@", errMessage); + XCTAssertTrue(CPTDecimalEquals(newLength, CPTDecimalFromDouble(len)), @"%@", errMessage); } @end diff --git a/framework/Source/CPTPlotSpace.h b/framework/Source/CPTPlotSpace.h index 646e906fa..902817b73 100644 --- a/framework/Source/CPTPlotSpace.h +++ b/framework/Source/CPTPlotSpace.h @@ -7,6 +7,16 @@ @class CPTGraph; @class CPTPlotSpace; +/** + * @brief Plot space mapping notification type. + **/ +typedef NSString *CPTPlotSpaceCoordinateMapping cpt_swift_struct; + +/** + * @brief The userInfo dictionary keys used by #CPTPlotSpaceCoordinateMappingDidChangeNotification notifications. + **/ +typedef NSString *CPTPlotSpaceInfoKey cpt_swift_struct; + /// @name Plot Space /// @{ @@ -16,32 +26,32 @@ * the plot space coordinate system and drawing coordinates changes. * @ingroup notification **/ -extern NSString *__nonnull const CPTPlotSpaceCoordinateMappingDidChangeNotification; +extern CPTPlotSpaceCoordinateMapping __nonnull const CPTPlotSpaceCoordinateMappingDidChangeNotification; -/** @brief The userInfo dictionary key used by the CPTPlotSpaceCoordinateMappingDidChangeNotification +/** @brief The userInfo dictionary key used by the #CPTPlotSpaceCoordinateMappingDidChangeNotification * to indicate the plot coordinate affected by the mapping change. * * The value associated with this key is the CPTCoordinate affected by the change wrapped in an instance of NSNumber. * @ingroup notification **/ -extern NSString *__nonnull const CPTPlotSpaceCoordinateKey; +extern CPTPlotSpaceInfoKey __nonnull const CPTPlotSpaceCoordinateKey; -/** @brief The userInfo dictionary key used by the CPTPlotSpaceCoordinateMappingDidChangeNotification +/** @brief The userInfo dictionary key used by the #CPTPlotSpaceCoordinateMappingDidChangeNotification * to indicate whether the mapping change is a scroll movement or other change. * * The value associated with this key is a boolean value wrapped in an instance of NSNumber. The value * is @YES if the plot space change represents a horizontal or vertical translation, @NO otherwise. * @ingroup notification **/ -extern NSString *__nonnull const CPTPlotSpaceScrollingKey; +extern CPTPlotSpaceInfoKey __nonnull const CPTPlotSpaceScrollingKey; -/** @brief The userInfo dictionary key used by the CPTPlotSpaceCoordinateMappingDidChangeNotification +/** @brief The userInfo dictionary key used by the #CPTPlotSpaceCoordinateMappingDidChangeNotification * to indicate the displacement offset for scrolling changes in drawing coordinates. * * The value associated with this key is the displacement offset wrapped in an instance of NSNumber. * @ingroup notification **/ -extern NSString *__nonnull const CPTPlotSpaceDisplacementKey; +extern CPTPlotSpaceInfoKey __nonnull const CPTPlotSpaceDisplacementKey; /// @} diff --git a/framework/Source/CPTPlotSpace.m b/framework/Source/CPTPlotSpace.m index 8a40414a2..644b1df79 100644 --- a/framework/Source/CPTPlotSpace.m +++ b/framework/Source/CPTPlotSpace.m @@ -4,11 +4,11 @@ #import "CPTMutablePlotRange.h" #import "CPTUtilities.h" -NSString *const CPTPlotSpaceCoordinateMappingDidChangeNotification = @"CPTPlotSpaceCoordinateMappingDidChangeNotification"; +CPTPlotSpaceCoordinateMapping const CPTPlotSpaceCoordinateMappingDidChangeNotification = @"CPTPlotSpaceCoordinateMappingDidChangeNotification"; -NSString *const CPTPlotSpaceCoordinateKey = @"CPTPlotSpaceCoordinateKey"; -NSString *const CPTPlotSpaceScrollingKey = @"CPTPlotSpaceScrollingKey"; -NSString *const CPTPlotSpaceDisplacementKey = @"CPTPlotSpaceDisplacementKey"; +CPTPlotSpaceInfoKey const CPTPlotSpaceCoordinateKey = @"CPTPlotSpaceCoordinateKey"; +CPTPlotSpaceInfoKey const CPTPlotSpaceScrollingKey = @"CPTPlotSpaceScrollingKey"; +CPTPlotSpaceInfoKey const CPTPlotSpaceDisplacementKey = @"CPTPlotSpaceDisplacementKey"; /// @cond @@ -92,7 +92,7 @@ @implementation CPTPlotSpace **/ -(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { identifier = nil; allowsUserInteraction = NO; isDragging = NO; @@ -143,7 +143,7 @@ -(void)encodeWithCoder:(nonnull NSCoder *)coder */ -(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super init]) ) { + if ((self = [super init])) { graph = [coder decodeObjectOfClass:[CPTGraph class] forKey:@"CPTPlotSpace.graph"]; identifier = [[coder decodeObjectOfClass:[NSObject class] @@ -481,6 +481,7 @@ -(BOOL)scrollWheelEvent:(nonnull CPTNativeEvent *)event fromPoint:(CGPoint)fromP } return handledByDelegate; } + #endif /// @} @@ -504,7 +505,7 @@ -(NSUInteger)numberOfCoordinates * @param plotPoint An array of data point coordinates (as NSNumber values). * @return The drawing coordinates of the data point. **/ --(CGPoint)plotAreaViewPointForPlotPoint:(nonnull CPTNumberArray *)plotPoint +-(CGPoint)plotAreaViewPointForPlotPoint:(nonnull CPTNumberArray *cpt_unused)plotPoint { NSParameterAssert(plotPoint.count == self.numberOfCoordinates); @@ -516,7 +517,7 @@ -(CGPoint)plotAreaViewPointForPlotPoint:(nonnull CPTNumberArray *)plotPoint * @param count The number of coordinate values in the @par{plotPoint} array. * @return The drawing coordinates of the data point. **/ --(CGPoint)plotAreaViewPointForPlotPoint:(nonnull NSDecimal *)plotPoint numberOfCoordinates:(NSUInteger)count +-(CGPoint)plotAreaViewPointForPlotPoint:(nonnull NSDecimal *__unused)plotPoint numberOfCoordinates:(NSUInteger cpt_unused)count { NSParameterAssert(count == self.numberOfCoordinates); @@ -528,7 +529,7 @@ -(CGPoint)plotAreaViewPointForPlotPoint:(nonnull NSDecimal *)plotPoint numberOfC * @param count The number of coordinate values in the @par{plotPoint} array. * @return The drawing coordinates of the data point. **/ --(CGPoint)plotAreaViewPointForDoublePrecisionPlotPoint:(nonnull double *)plotPoint numberOfCoordinates:(NSUInteger)count +-(CGPoint)plotAreaViewPointForDoublePrecisionPlotPoint:(nonnull double *__unused)plotPoint numberOfCoordinates:(NSUInteger cpt_unused)count { NSParameterAssert(count == self.numberOfCoordinates); @@ -539,7 +540,7 @@ -(CGPoint)plotAreaViewPointForDoublePrecisionPlotPoint:(nonnull double *)plotPoi * @param point The drawing coordinates of the data point. * @return An array of data point coordinates (as NSNumber values). **/ --(nullable CPTNumberArray *)plotPointForPlotAreaViewPoint:(CGPoint)point +-(nullable CPTNumberArray *)plotPointForPlotAreaViewPoint:(CGPoint __unused)point { return nil; } @@ -549,7 +550,7 @@ -(nullable CPTNumberArray *)plotPointForPlotAreaViewPoint:(CGPoint)point * @param count The number of coordinate values in the @par{plotPoint} array. * @param point The drawing coordinates of the data point. **/ --(void)plotPoint:(nonnull NSDecimal *)plotPoint numberOfCoordinates:(NSUInteger)count forPlotAreaViewPoint:(CGPoint)point +-(void)plotPoint:(nonnull NSDecimal *__unused)plotPoint numberOfCoordinates:(NSUInteger cpt_unused)count forPlotAreaViewPoint:(CGPoint __unused)point { NSParameterAssert(count == self.numberOfCoordinates); } @@ -559,7 +560,7 @@ -(void)plotPoint:(nonnull NSDecimal *)plotPoint numberOfCoordinates:(NSUInteger) * @param count The number of coordinate values in the @par{plotPoint} array. * @param point The drawing coordinates of the data point. **/ --(void)doublePrecisionPlotPoint:(nonnull double *)plotPoint numberOfCoordinates:(NSUInteger)count forPlotAreaViewPoint:(CGPoint)point +-(void)doublePrecisionPlotPoint:(nonnull double *__unused)plotPoint numberOfCoordinates:(NSUInteger cpt_unused)count forPlotAreaViewPoint:(CGPoint __unused)point { NSParameterAssert(count == self.numberOfCoordinates); } @@ -568,7 +569,7 @@ -(void)doublePrecisionPlotPoint:(nonnull double *)plotPoint numberOfCoordinates: * @param event The event. * @return The drawing coordinates of the point. **/ --(CGPoint)plotAreaViewPointForEvent:(nonnull CPTNativeEvent *)event +-(CGPoint)plotAreaViewPointForEvent:(nonnull CPTNativeEvent *__unused)event { return CGPointZero; } @@ -577,7 +578,7 @@ -(CGPoint)plotAreaViewPointForEvent:(nonnull CPTNativeEvent *)event * @param event The event. * @return An array of data point coordinates (as NSNumber values). **/ --(nullable CPTNumberArray *)plotPointForEvent:(nonnull CPTNativeEvent *)event +-(nullable CPTNumberArray *)plotPointForEvent:(nonnull CPTNativeEvent *__unused)event { return nil; } @@ -587,7 +588,7 @@ -(nullable CPTNumberArray *)plotPointForEvent:(nonnull CPTNativeEvent *)event * @param count The number of coordinate values in the @par{plotPoint} array. * @param event The event. **/ --(void)plotPoint:(nonnull NSDecimal *)plotPoint numberOfCoordinates:(NSUInteger)count forEvent:(nonnull CPTNativeEvent *)event +-(void)plotPoint:(nonnull NSDecimal *__unused)plotPoint numberOfCoordinates:(NSUInteger cpt_unused)count forEvent:(nonnull CPTNativeEvent *__unused)event { NSParameterAssert(count == self.numberOfCoordinates); } @@ -597,7 +598,7 @@ -(void)plotPoint:(nonnull NSDecimal *)plotPoint numberOfCoordinates:(NSUInteger) * @param count The number of coordinate values in the @par{plotPoint} array. * @param event The event. **/ --(void)doublePrecisionPlotPoint:(nonnull double *)plotPoint numberOfCoordinates:(NSUInteger)count forEvent:(nonnull CPTNativeEvent *)event +-(void)doublePrecisionPlotPoint:(nonnull double *__unused)plotPoint numberOfCoordinates:(NSUInteger cpt_unused)count forEvent:(nonnull CPTNativeEvent *__unused)event { NSParameterAssert(count == self.numberOfCoordinates); } @@ -606,7 +607,7 @@ -(void)doublePrecisionPlotPoint:(nonnull double *)plotPoint numberOfCoordinates: * @param newRange The new plot range. * @param coordinate The axis coordinate. **/ --(void)setPlotRange:(nonnull CPTPlotRange *)newRange forCoordinate:(CPTCoordinate)coordinate +-(void)setPlotRange:(nonnull CPTPlotRange *__unused)newRange forCoordinate:(CPTCoordinate __unused)coordinate { } @@ -614,7 +615,7 @@ -(void)setPlotRange:(nonnull CPTPlotRange *)newRange forCoordinate:(CPTCoordinat * @param coordinate The axis coordinate. * @return The range of values. **/ --(nullable CPTPlotRange *)plotRangeForCoordinate:(CPTCoordinate)coordinate +-(nullable CPTPlotRange *)plotRangeForCoordinate:(CPTCoordinate __unused)coordinate { return nil; } @@ -623,7 +624,7 @@ -(nullable CPTPlotRange *)plotRangeForCoordinate:(CPTCoordinate)coordinate * @param newType The new scale type. * @param coordinate The axis coordinate. **/ --(void)setScaleType:(CPTScaleType)newType forCoordinate:(CPTCoordinate)coordinate +-(void)setScaleType:(CPTScaleType __unused)newType forCoordinate:(CPTCoordinate __unused)coordinate { } @@ -631,7 +632,7 @@ -(void)setScaleType:(CPTScaleType)newType forCoordinate:(CPTCoordinate)coordinat * @param coordinate The axis coordinate. * @return The scale type. **/ --(CPTScaleType)scaleTypeForCoordinate:(CPTCoordinate)coordinate +-(CPTScaleType)scaleTypeForCoordinate:(CPTCoordinate __unused)coordinate { return CPTScaleTypeLinear; } @@ -639,7 +640,7 @@ -(CPTScaleType)scaleTypeForCoordinate:(CPTCoordinate)coordinate /** @brief Scales the plot ranges so that the plots just fit in the visible space. * @param plots An array of the plots that have to fit in the visible area. **/ --(void)scaleToFitPlots:(nullable CPTPlotArray *)plots +-(void)scaleToFitPlots:(nullable CPTPlotArray *__unused)plots { } @@ -665,7 +666,7 @@ -(void)scaleToFitPlots:(nullable CPTPlotArray *)plots forCoordinate:(CPTCoordina // Set range if ( unionRange ) { - if ( CPTDecimalEquals( unionRange.lengthDecimal, CPTDecimalFromInteger(0) ) ) { + if ( CPTDecimalEquals(unionRange.lengthDecimal, CPTDecimalFromInteger(0))) { [unionRange unionPlotRange:[self plotRangeForCoordinate:coordinate]]; } [self setPlotRange:unionRange forCoordinate:coordinate]; @@ -675,7 +676,7 @@ -(void)scaleToFitPlots:(nullable CPTPlotArray *)plots forCoordinate:(CPTCoordina /** @brief Scales the plot ranges so that the plots just fit in the visible space. * @param plots An array of the plots that have to fit in the visible area. **/ --(void)scaleToFitEntirePlots:(nullable CPTPlotArray *)plots +-(void)scaleToFitEntirePlots:(nullable CPTPlotArray *__unused)plots { } @@ -701,7 +702,7 @@ -(void)scaleToFitEntirePlots:(nullable CPTPlotArray *)plots forCoordinate:(CPTCo // Set range if ( unionRange ) { - if ( CPTDecimalEquals( unionRange.lengthDecimal, CPTDecimalFromInteger(0) ) ) { + if ( CPTDecimalEquals(unionRange.lengthDecimal, CPTDecimalFromInteger(0))) { [unionRange unionPlotRange:[self plotRangeForCoordinate:coordinate]]; } [self setPlotRange:unionRange forCoordinate:coordinate]; @@ -712,7 +713,7 @@ -(void)scaleToFitEntirePlots:(nullable CPTPlotArray *)plots forCoordinate:(CPTCo * @param interactionScale The scaling factor. One (@num{1}) gives no scaling. * @param interactionPoint The plot area view point about which the scaling occurs. **/ --(void)scaleBy:(CGFloat)interactionScale aboutPoint:(CGPoint)interactionPoint +-(void)scaleBy:(CGFloat __unused)interactionScale aboutPoint:(CGPoint __unused)interactionPoint { } diff --git a/framework/Source/CPTPlotSpaceAnnotation.m b/framework/Source/CPTPlotSpaceAnnotation.m index 9cebb758b..db08c4303 100644 --- a/framework/Source/CPTPlotSpaceAnnotation.m +++ b/framework/Source/CPTPlotSpaceAnnotation.m @@ -60,7 +60,7 @@ -(nonnull instancetype)initWithPlotSpace:(nonnull CPTPlotSpace *)newPlotSpace an { NSParameterAssert(newPlotSpace); - if ( (self = [super init]) ) { + if ((self = [super init])) { plotSpace = newPlotSpace; self.anchorPlotPoint = newPlotPoint; @@ -112,14 +112,19 @@ -(void)encodeWithCoder:(nonnull NSCoder *)coder */ -(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super initWithCoder:coder]) ) { - anchorPlotPoint = [[coder decodeObjectOfClasses:[NSSet setWithArray:@[[NSArray class], [NSNumber class]]] - forKey:@"CPTPlotSpaceAnnotation.anchorPlotPoint"] copy]; + if ((self = [super initWithCoder:coder])) { + self.anchorPlotPoint = [[coder decodeObjectOfClasses:[NSSet setWithArray:@[[NSArray class], [NSNumber class]]] + forKey:@"CPTPlotSpaceAnnotation.anchorPlotPoint"] copy]; CPTPlotSpace *thePlotSpace = [coder decodeObjectOfClass:[CPTPlotSpace class] forKey:@"CPTPlotSpaceAnnotation.plotSpace"]; if ( thePlotSpace ) { plotSpace = thePlotSpace; + + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(setContentNeedsLayout) + name:CPTPlotSpaceCoordinateMappingDidChangeNotification + object:plotSpace]; } } return self; @@ -175,7 +180,7 @@ -(void)positionContentLayer content.anchorPoint = self.contentAnchorPoint; content.position = newPosition; - content.transform = CATransform3DMakeRotation( self.rotation, CPTFloat(0.0), CPTFloat(0.0), CPTFloat(1.0) ); + content.transform = CATransform3DMakeRotation(self.rotation, CPTFloat(0.0), CPTFloat(0.0), CPTFloat(1.0)); [content pixelAlign]; } } @@ -196,7 +201,7 @@ -(void)setAnchorPlotPoint:(nullable CPTNumberArray *)newPlotPoint self.anchorCount = anchorPlotPoint.count; - NSDecimal *decimalPoint = malloc(sizeof(NSDecimal) * self.anchorCount); + NSDecimal *decimalPoint = calloc(self.anchorCount, sizeof(NSDecimal)); for ( NSUInteger i = 0; i < self.anchorCount; i++ ) { decimalPoint[i] = anchorPlotPoint[i].decimalValue; } diff --git a/framework/Source/CPTPlotSymbol.m b/framework/Source/CPTPlotSymbol.m index b37dd0359..9bae6be66 100644 --- a/framework/Source/CPTPlotSymbol.m +++ b/framework/Source/CPTPlotSymbol.m @@ -98,7 +98,7 @@ @implementation CPTPlotSymbol **/ -(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { anchorPoint = CPTPointMake(0.5, 0.5); size = CPTSizeMake(5.0, 5.0); symbolType = CPTPlotSymbolTypeNone; @@ -151,7 +151,7 @@ -(void)encodeWithCoder:(nonnull NSCoder *)coder -(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super init]) ) { + if ((self = [super init])) { anchorPoint = [coder decodeCPTPointForKey:@"CPTPlotSymbol.anchorPoint"]; size = [coder decodeCPTSizeForKey:@"CPTPlotSymbol.size"]; symbolType = (CPTPlotSymbolType)[coder decodeIntegerForKey:@"CPTPlotSymbol.symbolType"]; @@ -192,7 +192,7 @@ +(BOOL)supportsSecureCoding -(void)setSize:(CGSize)newSize { - if ( !CGSizeEqualToSize(newSize, size) ) { + if ( !CGSizeEqualToSize(newSize, size)) { size = newSize; self.cachedSymbolPath = NULL; } @@ -479,7 +479,7 @@ -(void)renderInContext:(nonnull CGContextRef)context atPoint:(CGPoint)center sca CGLayerRef theCachedLayer = self.cachedLayer; CGFloat theCachedScale = self.cachedScale; - if ( !theCachedLayer || (theCachedScale != scale) ) { + if ( !theCachedLayer || (theCachedScale != scale)) { CGSize layerSize = [self layerSizeForScale:scale]; self.anchorPoint = CPTPointMake(0.5, 0.5); @@ -488,7 +488,7 @@ -(void)renderInContext:(nonnull CGContextRef)context atPoint:(CGPoint)center sca CGContextRef layerContext = CGLayerGetContext(newLayer); [self renderAsVectorInContext:layerContext - atPoint:CPTPointMake( layerSize.width * CPTFloat(0.5), layerSize.height * CPTFloat(0.5) ) + atPoint:CPTPointMake(layerSize.width * CPTFloat(0.5), layerSize.height * CPTFloat(0.5)) scale:scale]; self.cachedLayer = newLayer; @@ -500,18 +500,18 @@ -(void)renderInContext:(nonnull CGContextRef)context atPoint:(CGPoint)center sca if ( theCachedLayer ) { CGSize layerSize = CGLayerGetSize(theCachedLayer); - if ( scale != CPTFloat(1.0) ) { + if ( scale != CPTFloat(1.0)) { layerSize.width /= scale; layerSize.height /= scale; } CGSize symbolSize = self.size; - CGPoint origin = CPTPointMake( center.x - layerSize.width * CPTFloat(0.5) - symbolSize.width * ( symbolAnchor.x - CPTFloat(0.5) ), - center.y - layerSize.height * CPTFloat(0.5) - symbolSize.height * ( symbolAnchor.y - CPTFloat(0.5) ) ); + CGPoint origin = CPTPointMake(center.x - layerSize.width * CPTFloat(0.5) - symbolSize.width * (symbolAnchor.x - CPTFloat(0.5)), + center.y - layerSize.height * CPTFloat(0.5) - symbolSize.height * (symbolAnchor.y - CPTFloat(0.5))); if ( alignToPixels ) { - if ( scale == CPTFloat(1.0) ) { + if ( scale == CPTFloat(1.0)) { origin.x = round(origin.x); origin.y = round(origin.y); } @@ -599,12 +599,12 @@ -(void)renderAsVectorInContext:(nonnull CGContextRef)context atPoint:(CGPoint)ce CPTShadow *myShadow = self.shadow; CGContextSaveGState(context); - CGContextTranslateCTM(context, center.x + ( symbolAnchor.x - CPTFloat(0.5) ) * symbolSize.width, center.y + ( symbolAnchor.y - CPTFloat(0.5) ) * symbolSize.height); + CGContextTranslateCTM(context, center.x + (symbolAnchor.x - CPTFloat(0.5)) * symbolSize.width, center.y + (symbolAnchor.y - CPTFloat(0.5)) * symbolSize.height); CGContextScaleCTM(context, scale, scale); [myShadow setShadowInContext:context]; // redraw only symbol rectangle - CGSize halfSize = CPTSizeMake( symbolSize.width * CPTFloat(0.5), symbolSize.height * CPTFloat(0.5) ); + CGSize halfSize = CPTSizeMake(symbolSize.width * CPTFloat(0.5), symbolSize.height * CPTFloat(0.5)); CGRect bounds = CPTRectMake(-halfSize.width, -halfSize.height, symbolSize.width, symbolSize.height); CGRect symbolRect = bounds; @@ -612,7 +612,7 @@ -(void)renderAsVectorInContext:(nonnull CGContextRef)context atPoint:(CGPoint)ce if ( myShadow ) { CGFloat shadowRadius = myShadow.shadowBlurRadius; CGSize shadowOffset = myShadow.shadowOffset; - symbolRect = CGRectInset( symbolRect, -( ABS(shadowOffset.width) + ABS(shadowRadius) ), -( ABS(shadowOffset.height) + ABS(shadowRadius) ) ); + symbolRect = CGRectInset(symbolRect, -(ABS(shadowOffset.width) + ABS(shadowRadius)), -(ABS(shadowOffset.height) + ABS(shadowRadius))); } if ( theLineStyle ) { CGFloat lineWidth = ABS(theLineStyle.lineWidth); @@ -626,7 +626,7 @@ -(void)renderAsVectorInContext:(nonnull CGContextRef)context atPoint:(CGPoint)ce if ( theFill ) { // use fillRect instead of fillPath so that images and gradients are properly centered in the symbol CGContextSaveGState(context); - if ( !CGPathIsEmpty(theSymbolPath) ) { + if ( !CGPathIsEmpty(theSymbolPath)) { CGContextBeginPath(context); CGContextAddPath(context, theSymbolPath); if ( self.usesEvenOddClipRule ) { @@ -666,7 +666,7 @@ -(nonnull CGPathRef)newSymbolPath { CGFloat dx, dy; CGSize symbolSize = self.size; - CGSize halfSize = CPTSizeMake( symbolSize.width * CPTFloat(0.5), symbolSize.height * CPTFloat(0.5) ); + CGSize halfSize = CPTSizeMake(symbolSize.width * CPTFloat(0.5), symbolSize.height * CPTFloat(0.5)); CGMutablePathRef symbolPath = CGPathCreateMutable(); @@ -676,11 +676,11 @@ -(nonnull CGPathRef)newSymbolPath break; case CPTPlotSymbolTypeRectangle: - CGPathAddRect( symbolPath, NULL, CPTRectMake(-halfSize.width, -halfSize.height, symbolSize.width, symbolSize.height) ); + CGPathAddRect(symbolPath, NULL, CPTRectMake(-halfSize.width, -halfSize.height, symbolSize.width, symbolSize.height)); break; case CPTPlotSymbolTypeEllipse: - CGPathAddEllipseInRect( symbolPath, NULL, CPTRectMake(-halfSize.width, -halfSize.height, symbolSize.width, symbolSize.height) ); + CGPathAddEllipseInRect(symbolPath, NULL, CPTRectMake(-halfSize.width, -halfSize.height, symbolSize.width, symbolSize.height)); break; case CPTPlotSymbolTypeCross: @@ -693,38 +693,38 @@ -(nonnull CGPathRef)newSymbolPath case CPTPlotSymbolTypePlus: CGPathMoveToPoint(symbolPath, NULL, CPTFloat(0.0), halfSize.height); CGPathAddLineToPoint(symbolPath, NULL, CPTFloat(0.0), -halfSize.height); - CGPathMoveToPoint( symbolPath, NULL, -halfSize.width, CPTFloat(0.0) ); - CGPathAddLineToPoint( symbolPath, NULL, halfSize.width, CPTFloat(0.0) ); + CGPathMoveToPoint(symbolPath, NULL, -halfSize.width, CPTFloat(0.0)); + CGPathAddLineToPoint(symbolPath, NULL, halfSize.width, CPTFloat(0.0)); break; case CPTPlotSymbolTypePentagon: CGPathMoveToPoint(symbolPath, NULL, CPTFloat(0.0), halfSize.height); - CGPathAddLineToPoint( symbolPath, NULL, halfSize.width * CPTFloat(0.95105651630), halfSize.height * CPTFloat(0.30901699437) ); - CGPathAddLineToPoint( symbolPath, NULL, halfSize.width * CPTFloat(0.58778525229), -halfSize.height * CPTFloat(0.80901699437) ); - CGPathAddLineToPoint( symbolPath, NULL, -halfSize.width * CPTFloat(0.58778525229), -halfSize.height * CPTFloat(0.80901699437) ); - CGPathAddLineToPoint( symbolPath, NULL, -halfSize.width * CPTFloat(0.95105651630), halfSize.height * CPTFloat(0.30901699437) ); + CGPathAddLineToPoint(symbolPath, NULL, halfSize.width * CPTFloat(0.95105651630), halfSize.height * CPTFloat(0.30901699437)); + CGPathAddLineToPoint(symbolPath, NULL, halfSize.width * CPTFloat(0.58778525229), -halfSize.height * CPTFloat(0.80901699437)); + CGPathAddLineToPoint(symbolPath, NULL, -halfSize.width * CPTFloat(0.58778525229), -halfSize.height * CPTFloat(0.80901699437)); + CGPathAddLineToPoint(symbolPath, NULL, -halfSize.width * CPTFloat(0.95105651630), halfSize.height * CPTFloat(0.30901699437)); CGPathCloseSubpath(symbolPath); break; case CPTPlotSymbolTypeStar: CGPathMoveToPoint(symbolPath, NULL, CPTFloat(0.0), halfSize.height); - CGPathAddLineToPoint( symbolPath, NULL, halfSize.width * CPTFloat(0.22451398829), halfSize.height * CPTFloat(0.30901699437) ); - CGPathAddLineToPoint( symbolPath, NULL, halfSize.width * CPTFloat(0.95105651630), halfSize.height * CPTFloat(0.30901699437) ); - CGPathAddLineToPoint( symbolPath, NULL, halfSize.width * CPTFloat(0.36327126400), -halfSize.height * CPTFloat(0.11803398875) ); - CGPathAddLineToPoint( symbolPath, NULL, halfSize.width * CPTFloat(0.58778525229), -halfSize.height * CPTFloat(0.80901699437) ); - CGPathAddLineToPoint( symbolPath, NULL, CPTFloat(0.0), -halfSize.height * CPTFloat(0.38196601125) ); - CGPathAddLineToPoint( symbolPath, NULL, -halfSize.width * CPTFloat(0.58778525229), -halfSize.height * CPTFloat(0.80901699437) ); - CGPathAddLineToPoint( symbolPath, NULL, -halfSize.width * CPTFloat(0.36327126400), -halfSize.height * CPTFloat(0.11803398875) ); - CGPathAddLineToPoint( symbolPath, NULL, -halfSize.width * CPTFloat(0.95105651630), halfSize.height * CPTFloat(0.30901699437) ); - CGPathAddLineToPoint( symbolPath, NULL, -halfSize.width * CPTFloat(0.22451398829), halfSize.height * CPTFloat(0.30901699437) ); + CGPathAddLineToPoint(symbolPath, NULL, halfSize.width * CPTFloat(0.22451398829), halfSize.height * CPTFloat(0.30901699437)); + CGPathAddLineToPoint(symbolPath, NULL, halfSize.width * CPTFloat(0.95105651630), halfSize.height * CPTFloat(0.30901699437)); + CGPathAddLineToPoint(symbolPath, NULL, halfSize.width * CPTFloat(0.36327126400), -halfSize.height * CPTFloat(0.11803398875)); + CGPathAddLineToPoint(symbolPath, NULL, halfSize.width * CPTFloat(0.58778525229), -halfSize.height * CPTFloat(0.80901699437)); + CGPathAddLineToPoint(symbolPath, NULL, CPTFloat(0.0), -halfSize.height * CPTFloat(0.38196601125)); + CGPathAddLineToPoint(symbolPath, NULL, -halfSize.width * CPTFloat(0.58778525229), -halfSize.height * CPTFloat(0.80901699437)); + CGPathAddLineToPoint(symbolPath, NULL, -halfSize.width * CPTFloat(0.36327126400), -halfSize.height * CPTFloat(0.11803398875)); + CGPathAddLineToPoint(symbolPath, NULL, -halfSize.width * CPTFloat(0.95105651630), halfSize.height * CPTFloat(0.30901699437)); + CGPathAddLineToPoint(symbolPath, NULL, -halfSize.width * CPTFloat(0.22451398829), halfSize.height * CPTFloat(0.30901699437)); CGPathCloseSubpath(symbolPath); break; case CPTPlotSymbolTypeDiamond: CGPathMoveToPoint(symbolPath, NULL, CPTFloat(0.0), halfSize.height); - CGPathAddLineToPoint( symbolPath, NULL, halfSize.width, CPTFloat(0.0) ); + CGPathAddLineToPoint(symbolPath, NULL, halfSize.width, CPTFloat(0.0)); CGPathAddLineToPoint(symbolPath, NULL, CPTFloat(0.0), -halfSize.height); - CGPathAddLineToPoint( symbolPath, NULL, -halfSize.width, CPTFloat(0.0) ); + CGPathAddLineToPoint(symbolPath, NULL, -halfSize.width, CPTFloat(0.0)); CGPathCloseSubpath(symbolPath); break; @@ -739,8 +739,8 @@ -(nonnull CGPathRef)newSymbolPath break; case CPTPlotSymbolTypeDash: - CGPathMoveToPoint( symbolPath, NULL, halfSize.width, CPTFloat(0.0) ); - CGPathAddLineToPoint( symbolPath, NULL, -halfSize.width, CPTFloat(0.0) ); + CGPathMoveToPoint(symbolPath, NULL, halfSize.width, CPTFloat(0.0)); + CGPathAddLineToPoint(symbolPath, NULL, -halfSize.width, CPTFloat(0.0)); break; case CPTPlotSymbolTypeHexagon: @@ -777,8 +777,8 @@ -(nonnull CGPathRef)newSymbolPath CGFloat dy1 = symbolSize.height / oldBounds.size.height; CGAffineTransform scaleTransform = CGAffineTransformScale(CGAffineTransformIdentity, dx1, dy1); - scaleTransform = CGAffineTransformConcat( scaleTransform, - CGAffineTransformMakeTranslation(-halfSize.width, -halfSize.height) ); + scaleTransform = CGAffineTransformConcat(scaleTransform, + CGAffineTransformMakeTranslation(-halfSize.width, -halfSize.height)); CGPathAddPath(symbolPath, &scaleTransform, customPath); } } @@ -808,7 +808,7 @@ -(nullable id)debugQuickLookObject self.anchorPoint = CPTPointMake(0.5, 0.5); - [self renderAsVectorInContext:context atPoint:CGPointMake( CGRectGetMidX(bounds), CGRectGetMidY(bounds) ) scale:scale]; + [self renderAsVectorInContext:context atPoint:CGPointMake(CGRectGetMidX(bounds), CGRectGetMidY(bounds)) scale:scale]; self.anchorPoint = symbolAnchor; }); diff --git a/framework/Source/CPTRangePlot.h b/framework/Source/CPTRangePlot.h index e8a0cb07e..5e3434e38 100644 --- a/framework/Source/CPTRangePlot.h +++ b/framework/Source/CPTRangePlot.h @@ -5,27 +5,41 @@ @class CPTFill; @class CPTRangePlot; +/** + * @brief Range plot bindings. + **/ +typedef NSString *CPTRangePlotBinding cpt_swift_struct; + /// @ingroup plotBindingsRangePlot /// @{ -extern NSString *__nonnull const CPTRangePlotBindingXValues; -extern NSString *__nonnull const CPTRangePlotBindingYValues; -extern NSString *__nonnull const CPTRangePlotBindingHighValues; -extern NSString *__nonnull const CPTRangePlotBindingLowValues; -extern NSString *__nonnull const CPTRangePlotBindingLeftValues; -extern NSString *__nonnull const CPTRangePlotBindingRightValues; -extern NSString *__nonnull const CPTRangePlotBindingBarLineStyles; +extern CPTRangePlotBinding __nonnull const CPTRangePlotBindingXValues; +extern CPTRangePlotBinding __nonnull const CPTRangePlotBindingYValues; +extern CPTRangePlotBinding __nonnull const CPTRangePlotBindingHighValues; +extern CPTRangePlotBinding __nonnull const CPTRangePlotBindingLowValues; +extern CPTRangePlotBinding __nonnull const CPTRangePlotBindingLeftValues; +extern CPTRangePlotBinding __nonnull const CPTRangePlotBindingRightValues; +extern CPTRangePlotBinding __nonnull const CPTRangePlotBindingBarLineStyles; +extern CPTRangePlotBinding __nonnull const CPTRangePlotBindingBarWidths; /// @} /** * @brief Enumeration of range plot data source field types **/ typedef NS_ENUM (NSInteger, CPTRangePlotField) { - CPTRangePlotFieldX, ///< X values. - CPTRangePlotFieldY, ///< Y values. - CPTRangePlotFieldHigh, ///< relative High values. - CPTRangePlotFieldLow, ///< relative Low values. - CPTRangePlotFieldLeft, ///< relative Left values. - CPTRangePlotFieldRight, ///< relative Right values. + CPTRangePlotFieldX, ///< X values. + CPTRangePlotFieldY, ///< Y values. + CPTRangePlotFieldHigh, ///< relative High values. + CPTRangePlotFieldLow, ///< relative Low values. + CPTRangePlotFieldLeft, ///< relative Left values. + CPTRangePlotFieldRight ///< relative Right values. +}; + +/** + * @brief Enumeration of range plot data fill directions + **/ +typedef NS_ENUM (NSInteger, CPTRangePlotFillDirection) { + CPTRangePlotFillHorizontal, ///< Fill between the high and low values in a horizontal direction. + CPTRangePlotFillVertical ///< Fill between the left and right values in a vertical direction. }; #pragma mark - @@ -57,6 +71,23 @@ typedef NS_ENUM (NSInteger, CPTRangePlotField) { **/ -(nullable CPTLineStyle *)barLineStyleForRangePlot:(nonnull CPTRangePlot *)plot recordIndex:(NSUInteger)idx; +/** @brief @optional Gets an array of bar widths for the given range plot. + * @param plot The range plot. + * @param indexRange The range of the data indexes of interest. + * @return An array of bar widths. + **/ +-(nullable CPTNumberArray *)barWidthsForRangePlot:(nonnull CPTRangePlot *)barPlot recordIndexRange:(NSRange)indexRange; + +/** @brief @optional Gets a bar width for the given range plot. + * This method will not be called if + * @link CPTRangePlotDataSource::barWidthForRangePlot:recordIndexRange: -barWidthForRangePlot:recordIndexRange: @endlink + * is also implemented in the datasource. + * @param plot The range plot. + * @param idx The data index of interest. + * @return The bar width for the bar with the given index. If the data source returns @nil, the default barWidth is used. + **/ +-(nullable NSNumber *)barWidthForRangePlot:(nonnull CPTRangePlot *)plot recordIndex:(NSUInteger)idx; + /// @} @end @@ -154,6 +185,7 @@ typedef NS_ENUM (NSInteger, CPTRangePlotField) { /// @name Drawing /// @{ +@property (nonatomic, readwrite) CPTRangePlotFillDirection fillDirection; @property (nonatomic, copy, nullable) CPTFill *areaFill; @property (nonatomic, readwrite, copy, nullable) CPTLineStyle *areaBorderLineStyle; /// @} @@ -162,6 +194,8 @@ typedef NS_ENUM (NSInteger, CPTRangePlotField) { /// @{ -(void)reloadBarLineStyles; -(void)reloadBarLineStylesInIndexRange:(NSRange)indexRange; +-(void)reloadBarWidths; +-(void)reloadBarWidthsInIndexRange:(NSRange)indexRange; /// @} @end diff --git a/framework/Source/CPTRangePlot.m b/framework/Source/CPTRangePlot.m index 95ee7a8ac..b03c7e6e2 100644 --- a/framework/Source/CPTRangePlot.m +++ b/framework/Source/CPTRangePlot.m @@ -13,6 +13,7 @@ #import "CPTUtilities.h" #import "CPTXYPlotSpace.h" #import "NSCoderExtensions.h" +#import "NSNumberExtensions.h" #import "tgmath.h" /** @defgroup plotAnimationRangePlot Range Plot @@ -27,13 +28,14 @@ * @endif **/ -NSString *const CPTRangePlotBindingXValues = @"xValues"; ///< X values. -NSString *const CPTRangePlotBindingYValues = @"yValues"; ///< Y values. -NSString *const CPTRangePlotBindingHighValues = @"highValues"; ///< High values. -NSString *const CPTRangePlotBindingLowValues = @"lowValues"; ///< Low values. -NSString *const CPTRangePlotBindingLeftValues = @"leftValues"; ///< Left price values. -NSString *const CPTRangePlotBindingRightValues = @"rightValues"; ///< Right price values. -NSString *const CPTRangePlotBindingBarLineStyles = @"barLineStyles"; ///< Bar line styles. +CPTRangePlotBinding const CPTRangePlotBindingXValues = @"xValues"; ///< X values. +CPTRangePlotBinding const CPTRangePlotBindingYValues = @"yValues"; ///< Y values. +CPTRangePlotBinding const CPTRangePlotBindingHighValues = @"highValues"; ///< High values. +CPTRangePlotBinding const CPTRangePlotBindingLowValues = @"lowValues"; ///< Low values. +CPTRangePlotBinding const CPTRangePlotBindingLeftValues = @"leftValues"; ///< Left price values. +CPTRangePlotBinding const CPTRangePlotBindingRightValues = @"rightValues"; ///< Right price values. +CPTRangePlotBinding const CPTRangePlotBindingBarLineStyles = @"barLineStyles"; ///< Bar line styles. +CPTRangePlotBinding const CPTRangePlotBindingBarWidths = @"barWidths"; ///< Bar widths. /// @cond struct CGPointError { @@ -55,15 +57,17 @@ @interface CPTRangePlot() @property (nonatomic, readwrite, copy, nullable) CPTMutableNumericData *leftValues; @property (nonatomic, readwrite, copy, nullable) CPTMutableNumericData *rightValues; @property (nonatomic, readwrite, copy, nullable) CPTLineStyleArray *barLineStyles; +@property (nonatomic, readwrite, copy, nullable) CPTLineStyleArray *barWidths; @property (nonatomic, readwrite, assign) NSUInteger pointingDeviceDownIndex; --(void)calculatePointsToDraw:(nonnull BOOL *)pointDrawFlags numberOfPoints:(NSUInteger)dataCount forPlotSpace:(nonnull CPTXYPlotSpace *)xyPlotSpace includeVisiblePointsOnly:(BOOL)visibleOnly; +-(void)calculatePointsToDraw:(nonnull BOOL *)pointDrawFlags numberOfPoints:(NSUInteger)dataCount forPlotSpace:(nonnull CPTXYPlotSpace *)xyPlotSpace; -(void)calculateViewPoints:(nonnull CGPointError *)viewPoints withDrawPointFlags:(nonnull BOOL *)drawPointFlags numberOfPoints:(NSUInteger)dataCount; -(void)alignViewPointsToUserSpace:(nonnull CGPointError *)viewPoints withContext:(nonnull CGContextRef)context drawPointFlags:(nonnull BOOL *)drawPointFlag numberOfPoints:(NSUInteger)dataCounts; -(NSInteger)extremeDrawnPointIndexForFlags:(nonnull BOOL *)pointDrawFlags numberOfPoints:(NSUInteger)dataCount extremeNumIsLowerBound:(BOOL)isLowerBound; -(void)drawRangeInContext:(nonnull CGContextRef)context lineStyle:(nonnull CPTLineStyle *)lineStyle viewPoint:(CGPointError *)viewPoint halfGapSize:(CGSize)halfGapSize halfBarWidth:(CGFloat)halfBarWidth alignPoints:(BOOL)alignPoints; -(CPTLineStyle *)barLineStyleForIndex:(NSUInteger)idx; +-(nonnull NSNumber *)barWidthForIndex:(NSUInteger)idx; @end @@ -88,6 +92,13 @@ @implementation CPTRangePlot @dynamic leftValues; @dynamic rightValues; @dynamic barLineStyles; +@dynamic barWidths; + +/** @property CPTRangePlotFillDirection fillDirection + * @brief Fill the range in a horizontal or vertical direction. + * Default is CPTRangePlotFillHorizontal. + **/ +@synthesize fillDirection; /** @property CPTFill *areaFill * @brief The fill used to render the area. @@ -150,8 +161,10 @@ +(void)initialize [self exposeBinding:CPTRangePlotBindingLeftValues]; [self exposeBinding:CPTRangePlotBindingRightValues]; [self exposeBinding:CPTRangePlotBindingBarLineStyles]; + [self exposeBinding:CPTRangePlotBindingBarWidths]; } } + #endif /// @endcond @@ -163,7 +176,12 @@ +(void)initialize * * This is the designated initializer. The initialized layer will have the following properties: * - @ref barLineStyle = default line style + * - @ref fillDirection = CPTRangePlotFillHorizontal * - @ref areaFill = @nil + * - @ref areaBorderLineStyle = @nil + * - @ref barWidth = 0.0 + * - @ref gapHeight = 0.0 + * - @ref gapWidth = 0.0 * - @ref labelField = #CPTRangePlotFieldX * * @param newFrame The frame rectangle. @@ -171,10 +189,14 @@ +(void)initialize **/ -(nonnull instancetype)initWithFrame:(CGRect)newFrame { - if ( (self = [super initWithFrame:newFrame]) ) { + if ((self = [super initWithFrame:newFrame])) { barLineStyle = [[CPTLineStyle alloc] init]; + fillDirection = CPTRangePlotFillHorizontal; areaFill = nil; areaBorderLineStyle = nil; + barWidth = CPTFloat(0.0); + gapHeight = CPTFloat(0.0); + gapWidth = CPTFloat(0.0); pointingDeviceDownIndex = NSNotFound; @@ -189,12 +211,16 @@ -(nonnull instancetype)initWithFrame:(CGRect)newFrame -(nonnull instancetype)initWithLayer:(nonnull id)layer { - if ( (self = [super initWithLayer:layer]) ) { + if ((self = [super initWithLayer:layer])) { CPTRangePlot *theLayer = (CPTRangePlot *)layer; barLineStyle = theLayer->barLineStyle; + fillDirection = theLayer->fillDirection; areaFill = theLayer->areaFill; areaBorderLineStyle = theLayer->areaBorderLineStyle; + barWidth = theLayer->barWidth; + gapHeight = theLayer->gapHeight; + gapWidth = theLayer->gapWidth; pointingDeviceDownIndex = NSNotFound; } @@ -216,6 +242,7 @@ -(void)encodeWithCoder:(nonnull NSCoder *)coder [coder encodeCGFloat:self.barWidth forKey:@"CPTRangePlot.barWidth"]; [coder encodeCGFloat:self.gapHeight forKey:@"CPTRangePlot.gapHeight"]; [coder encodeCGFloat:self.gapWidth forKey:@"CPTRangePlot.gapWidth"]; + [coder encodeInteger:self.fillDirection forKey:@"CPTRangePlot.fillDirection"]; [coder encodeObject:self.areaFill forKey:@"CPTRangePlot.areaFill"]; [coder encodeObject:self.areaBorderLineStyle forKey:@"CPTRangePlot.areaBorderLineStyle"]; @@ -225,14 +252,15 @@ -(void)encodeWithCoder:(nonnull NSCoder *)coder -(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super initWithCoder:coder]) ) { + if ((self = [super initWithCoder:coder])) { barLineStyle = [[coder decodeObjectOfClass:[CPTLineStyle class] forKey:@"CPTRangePlot.barLineStyle"] copy]; - barWidth = [coder decodeCGFloatForKey:@"CPTRangePlot.barWidth"]; - gapHeight = [coder decodeCGFloatForKey:@"CPTRangePlot.gapHeight"]; - gapWidth = [coder decodeCGFloatForKey:@"CPTRangePlot.gapWidth"]; - areaFill = [[coder decodeObjectOfClass:[CPTFill class] - forKey:@"CPTRangePlot.areaFill"] copy]; + barWidth = [coder decodeCGFloatForKey:@"CPTRangePlot.barWidth"]; + gapHeight = [coder decodeCGFloatForKey:@"CPTRangePlot.gapHeight"]; + gapWidth = [coder decodeCGFloatForKey:@"CPTRangePlot.gapWidth"]; + fillDirection = [coder decodeIntegerForKey:@"CPTRangePlot.fillDirection"]; + areaFill = [[coder decodeObjectOfClass:[CPTFill class] + forKey:@"CPTRangePlot.areaFill"] copy]; areaBorderLineStyle = [[coder decodeObjectOfClass:[CPTLineStyle class] forKey:@"CPTRangePlot.areaBorderLineStyle"] copy]; @@ -260,7 +288,7 @@ +(BOOL)supportsSecureCoding /// @cond --(void)calculatePointsToDraw:(nonnull BOOL *)pointDrawFlags numberOfPoints:(NSUInteger)dataCount forPlotSpace:(nonnull CPTXYPlotSpace *)xyPlotSpace includeVisiblePointsOnly:(BOOL)visibleOnly +-(void)calculatePointsToDraw:(nonnull BOOL *)pointDrawFlags numberOfPoints:(NSUInteger)dataCount forPlotSpace:(nonnull CPTXYPlotSpace *)xyPlotSpace { if ( dataCount == 0 ) { return; @@ -273,9 +301,9 @@ -(void)calculatePointsToDraw:(nonnull BOOL *)pointDrawFlags numberOfPoints:(NSUI } } else { - CPTPlotRangeComparisonResult *xRangeFlags = malloc( dataCount * sizeof(CPTPlotRangeComparisonResult) ); - CPTPlotRangeComparisonResult *yRangeFlags = malloc( dataCount * sizeof(CPTPlotRangeComparisonResult) ); - BOOL *nanFlags = malloc( dataCount * sizeof(BOOL) ); + CPTPlotRangeComparisonResult *xRangeFlags = calloc(dataCount, sizeof(CPTPlotRangeComparisonResult)); + CPTPlotRangeComparisonResult *yRangeFlags = calloc(dataCount, sizeof(CPTPlotRangeComparisonResult)); + BOOL *nanFlags = calloc(dataCount, sizeof(BOOL)); CPTPlotRange *xRange = xyPlotSpace.xRange; CPTPlotRange *yRange = xyPlotSpace.yRange; @@ -291,7 +319,7 @@ -(void)calculatePointsToDraw:(nonnull BOOL *)pointDrawFlags numberOfPoints:(NSUI xRangeFlags[i] = [xRange compareToDouble:x]; yRangeFlags[i] = [yRange compareToDouble:y]; - nanFlags[i] = isnan(x) || isnan(y); + nanFlags[i] = isnan(x) || isnan(y); }); } else { @@ -304,7 +332,7 @@ -(void)calculatePointsToDraw:(nonnull BOOL *)pointDrawFlags numberOfPoints:(NSUI xRangeFlags[i] = [xRange compareToDecimal:x]; yRangeFlags[i] = [yRange compareToDecimal:y]; - nanFlags[i] = NSDecimalIsNotANumber(&x); + nanFlags[i] = NSDecimalIsNotANumber(&x); }); } @@ -336,13 +364,13 @@ -(void)calculateViewPoints:(nonnull CGPointError *)viewPoints withDrawPointFlags const double *rightBytes = (const double *)[self cachedNumbersForField:CPTRangePlotFieldRight].data.bytes; dispatch_apply(dataCount, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(size_t i) { - const double x = xBytes[i]; - const double y = yBytes[i]; - const double high = highBytes[i]; - const double low = lowBytes[i]; - const double left = leftBytes[i]; + const double x = xBytes[i]; + const double y = yBytes[i]; + const double high = highBytes[i]; + const double low = lowBytes[i]; + const double left = leftBytes[i]; const double right = rightBytes[i]; - if ( !drawPointFlags[i] || isnan(x) || isnan(y) ) { + if ( !drawPointFlags[i] || isnan(x) || isnan(y)) { viewPoints[i].x = CPTNAN; // depending coordinates viewPoints[i].y = CPTNAN; } @@ -350,29 +378,29 @@ -(void)calculateViewPoints:(nonnull CGPointError *)viewPoints withDrawPointFlags double plotPoint[2]; plotPoint[CPTCoordinateX] = x; plotPoint[CPTCoordinateY] = y; - CGPoint pos = [thePlotSpace plotAreaViewPointForDoublePrecisionPlotPoint:plotPoint numberOfCoordinates:2]; - viewPoints[i].x = pos.x; - viewPoints[i].y = pos.y; + CGPoint pos = [thePlotSpace plotAreaViewPointForDoublePrecisionPlotPoint:plotPoint numberOfCoordinates:2]; + viewPoints[i].x = pos.x; + viewPoints[i].y = pos.y; plotPoint[CPTCoordinateX] = x; plotPoint[CPTCoordinateY] = y + high; - pos = [thePlotSpace plotAreaViewPointForDoublePrecisionPlotPoint:plotPoint numberOfCoordinates:2]; - viewPoints[i].high = pos.y; + pos = [thePlotSpace plotAreaViewPointForDoublePrecisionPlotPoint:plotPoint numberOfCoordinates:2]; + viewPoints[i].high = pos.y; plotPoint[CPTCoordinateX] = x; plotPoint[CPTCoordinateY] = y - low; - pos = [thePlotSpace plotAreaViewPointForDoublePrecisionPlotPoint:plotPoint numberOfCoordinates:2]; - viewPoints[i].low = pos.y; + pos = [thePlotSpace plotAreaViewPointForDoublePrecisionPlotPoint:plotPoint numberOfCoordinates:2]; + viewPoints[i].low = pos.y; plotPoint[CPTCoordinateX] = x - left; plotPoint[CPTCoordinateY] = y; - pos = [thePlotSpace plotAreaViewPointForDoublePrecisionPlotPoint:plotPoint numberOfCoordinates:2]; - viewPoints[i].left = pos.x; + pos = [thePlotSpace plotAreaViewPointForDoublePrecisionPlotPoint:plotPoint numberOfCoordinates:2]; + viewPoints[i].left = pos.x; plotPoint[CPTCoordinateX] = x + right; plotPoint[CPTCoordinateY] = y; - pos = [thePlotSpace plotAreaViewPointForDoublePrecisionPlotPoint:plotPoint numberOfCoordinates:2]; - viewPoints[i].right = pos.x; + pos = [thePlotSpace plotAreaViewPointForDoublePrecisionPlotPoint:plotPoint numberOfCoordinates:2]; + viewPoints[i].right = pos.x; } }); } @@ -385,14 +413,14 @@ -(void)calculateViewPoints:(nonnull CGPointError *)viewPoints withDrawPointFlags const NSDecimal *rightBytes = (const NSDecimal *)[self cachedNumbersForField:CPTRangePlotFieldRight].data.bytes; dispatch_apply(dataCount, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(size_t i) { - const NSDecimal x = xBytes[i]; - const NSDecimal y = yBytes[i]; - const NSDecimal high = highBytes[i]; - const NSDecimal low = lowBytes[i]; - const NSDecimal left = leftBytes[i]; + const NSDecimal x = xBytes[i]; + const NSDecimal y = yBytes[i]; + const NSDecimal high = highBytes[i]; + const NSDecimal low = lowBytes[i]; + const NSDecimal left = leftBytes[i]; const NSDecimal right = rightBytes[i]; - if ( !drawPointFlags[i] || NSDecimalIsNotANumber(&x) || NSDecimalIsNotANumber(&y) ) { + if ( !drawPointFlags[i] || NSDecimalIsNotANumber(&x) || NSDecimalIsNotANumber(&y)) { viewPoints[i].x = CPTNAN; // depending coordinates viewPoints[i].y = CPTNAN; } @@ -400,52 +428,52 @@ -(void)calculateViewPoints:(nonnull CGPointError *)viewPoints withDrawPointFlags NSDecimal plotPoint[2]; plotPoint[CPTCoordinateX] = x; plotPoint[CPTCoordinateY] = y; - CGPoint pos = [thePlotSpace plotAreaViewPointForPlotPoint:plotPoint numberOfCoordinates:2]; - viewPoints[i].x = pos.x; - viewPoints[i].y = pos.y; + CGPoint pos = [thePlotSpace plotAreaViewPointForPlotPoint:plotPoint numberOfCoordinates:2]; + viewPoints[i].x = pos.x; + viewPoints[i].y = pos.y; - if ( !NSDecimalIsNotANumber(&high) ) { + if ( !NSDecimalIsNotANumber(&high)) { plotPoint[CPTCoordinateX] = x; NSDecimal yh; NSDecimalAdd(&yh, &y, &high, NSRoundPlain); plotPoint[CPTCoordinateY] = yh; - pos = [thePlotSpace plotAreaViewPointForPlotPoint:plotPoint numberOfCoordinates:2]; - viewPoints[i].high = pos.y; + pos = [thePlotSpace plotAreaViewPointForPlotPoint:plotPoint numberOfCoordinates:2]; + viewPoints[i].high = pos.y; } else { viewPoints[i].high = CPTNAN; } - if ( !NSDecimalIsNotANumber(&low) ) { + if ( !NSDecimalIsNotANumber(&low)) { plotPoint[CPTCoordinateX] = x; NSDecimal yl; NSDecimalSubtract(&yl, &y, &low, NSRoundPlain); plotPoint[CPTCoordinateY] = yl; - pos = [thePlotSpace plotAreaViewPointForPlotPoint:plotPoint numberOfCoordinates:2]; - viewPoints[i].low = pos.y; + pos = [thePlotSpace plotAreaViewPointForPlotPoint:plotPoint numberOfCoordinates:2]; + viewPoints[i].low = pos.y; } else { viewPoints[i].low = CPTNAN; } - if ( !NSDecimalIsNotANumber(&left) ) { + if ( !NSDecimalIsNotANumber(&left)) { NSDecimal xl; NSDecimalSubtract(&xl, &x, &left, NSRoundPlain); plotPoint[CPTCoordinateX] = xl; plotPoint[CPTCoordinateY] = y; - pos = [thePlotSpace plotAreaViewPointForPlotPoint:plotPoint numberOfCoordinates:2]; - viewPoints[i].left = pos.x; + pos = [thePlotSpace plotAreaViewPointForPlotPoint:plotPoint numberOfCoordinates:2]; + viewPoints[i].left = pos.x; } else { viewPoints[i].left = CPTNAN; } - if ( !NSDecimalIsNotANumber(&right) ) { + if ( !NSDecimalIsNotANumber(&right)) { NSDecimal xr; NSDecimalAdd(&xr, &x, &right, NSRoundPlain); plotPoint[CPTCoordinateX] = xr; plotPoint[CPTCoordinateY] = y; - pos = [thePlotSpace plotAreaViewPointForPlotPoint:plotPoint numberOfCoordinates:2]; - viewPoints[i].right = pos.x; + pos = [thePlotSpace plotAreaViewPointForPlotPoint:plotPoint numberOfCoordinates:2]; + viewPoints[i].right = pos.x; } else { viewPoints[i].right = CPTNAN; @@ -459,22 +487,22 @@ -(void)alignViewPointsToUserSpace:(nonnull CGPointError *)viewPoints withContext { // Align to device pixels if there is a data line. // Otherwise, align to view space, so fills are sharp at edges. - if ( self.barLineStyle.lineWidth > CPTFloat(0.0) ) { + if ( self.barLineStyle.lineWidth > CPTFloat(0.0)) { dispatch_apply(dataCount, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(size_t i) { if ( drawPointFlags[i] ) { - CGFloat x = viewPoints[i].x; - CGFloat y = viewPoints[i].y; - CGPoint pos = CPTAlignPointToUserSpace( context, CPTPointMake(viewPoints[i].x, viewPoints[i].y) ); + CGFloat x = viewPoints[i].x; + CGFloat y = viewPoints[i].y; + CGPoint pos = CPTAlignPointToUserSpace(context, CPTPointMake(viewPoints[i].x, viewPoints[i].y)); viewPoints[i].x = pos.x; viewPoints[i].y = pos.y; - pos = CPTAlignPointToUserSpace( context, CPTPointMake(x, viewPoints[i].high) ); - viewPoints[i].high = pos.y; - pos = CPTAlignPointToUserSpace( context, CPTPointMake(x, viewPoints[i].low) ); - viewPoints[i].low = pos.y; - pos = CPTAlignPointToUserSpace( context, CPTPointMake(viewPoints[i].left, y) ); - viewPoints[i].left = pos.x; - pos = CPTAlignPointToUserSpace( context, CPTPointMake(viewPoints[i].right, y) ); + pos = CPTAlignPointToUserSpace(context, CPTPointMake(x, viewPoints[i].high)); + viewPoints[i].high = pos.y; + pos = CPTAlignPointToUserSpace(context, CPTPointMake(x, viewPoints[i].low)); + viewPoints[i].low = pos.y; + pos = CPTAlignPointToUserSpace(context, CPTPointMake(viewPoints[i].left, y)); + viewPoints[i].left = pos.x; + pos = CPTAlignPointToUserSpace(context, CPTPointMake(viewPoints[i].right, y)); viewPoints[i].right = pos.x; } }); @@ -482,19 +510,19 @@ -(void)alignViewPointsToUserSpace:(nonnull CGPointError *)viewPoints withContext else { dispatch_apply(dataCount, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(size_t i) { if ( drawPointFlags[i] ) { - CGFloat x = viewPoints[i].x; - CGFloat y = viewPoints[i].y; - CGPoint pos = CPTAlignIntegralPointToUserSpace( context, CPTPointMake(viewPoints[i].x, viewPoints[i].y) ); + CGFloat x = viewPoints[i].x; + CGFloat y = viewPoints[i].y; + CGPoint pos = CPTAlignIntegralPointToUserSpace(context, CPTPointMake(viewPoints[i].x, viewPoints[i].y)); viewPoints[i].x = pos.x; viewPoints[i].y = pos.y; - pos = CPTAlignIntegralPointToUserSpace( context, CPTPointMake(x, viewPoints[i].high) ); - viewPoints[i].high = pos.y; - pos = CPTAlignIntegralPointToUserSpace( context, CPTPointMake(x, viewPoints[i].low) ); - viewPoints[i].low = pos.y; - pos = CPTAlignIntegralPointToUserSpace( context, CPTPointMake(viewPoints[i].left, y) ); - viewPoints[i].left = pos.x; - pos = CPTAlignIntegralPointToUserSpace( context, CPTPointMake(viewPoints[i].right, y) ); + pos = CPTAlignIntegralPointToUserSpace(context, CPTPointMake(x, viewPoints[i].high)); + viewPoints[i].high = pos.y; + pos = CPTAlignIntegralPointToUserSpace(context, CPTPointMake(x, viewPoints[i].low)); + viewPoints[i].low = pos.y; + pos = CPTAlignIntegralPointToUserSpace(context, CPTPointMake(viewPoints[i].left, y)); + viewPoints[i].left = pos.x; + pos = CPTAlignIntegralPointToUserSpace(context, CPTPointMake(viewPoints[i].right, y)); viewPoints[i].right = pos.x; } }); @@ -513,7 +541,7 @@ -(NSInteger)extremeDrawnPointIndexForFlags:(nonnull BOOL *)pointDrawFlags number result = i; break; } - if ( (delta < 0) && (i == 0) ) { + if ((delta < 0) && (i == 0)) { break; } } @@ -534,6 +562,9 @@ -(void)reloadDataInIndexRange:(NSRange)indexRange // Bar line styles [self reloadBarLineStylesInIndexRange:indexRange]; + + // Bar widths + [self reloadBarWidthsInIndexRange:indexRange]; } -(void)reloadPlotDataInIndexRange:(NSRange)indexRange @@ -622,6 +653,49 @@ -(void)reloadBarLineStylesInIndexRange:(NSRange)indexRange [self setNeedsDisplay]; } +/** + * @brief Reload all bar widths from the data source immediately. + **/ +-(void)reloadBarWidths +{ + [self reloadBarWidthsInIndexRange:NSMakeRange(0, self.cachedDataCount)]; +} + +/** @brief Reload bar widths in the given index range from the data source immediately. + * @param indexRange The index range to load. + **/ +-(void)reloadBarWidthsInIndexRange:(NSRange)indexRange +{ + id theDataSource = (id)self.dataSource; + + if ( [theDataSource respondsToSelector:@selector(barWidthsForRangePlot:recordIndexRange:)] ) { + [self cacheArray:[theDataSource barWidthsForRangePlot:self recordIndexRange:indexRange] + forKey:CPTRangePlotBindingBarWidths + atRecordIndex:indexRange.location]; + } + else if ( [theDataSource respondsToSelector:@selector(barWidthForRangePlot:recordIndex:)] ) { + id nilObject = [CPTPlot nilData]; + CPTMutableNumberArray *array = [[NSMutableArray alloc] initWithCapacity:indexRange.length]; + NSUInteger maxIndex = NSMaxRange(indexRange); + + for ( NSUInteger idx = indexRange.location; idx < maxIndex; idx++ ) { + NSNumber *width = [theDataSource barWidthForRangePlot:self recordIndex:idx]; + if ( width ) { + [array addObject:width]; + } + else { + [array addObject:nilObject]; + } + } + + [self cacheArray:array + forKey:CPTRangePlotBindingBarWidths + atRecordIndex:indexRange.location]; + } + + [self setNeedsDisplay]; +} + #pragma mark - #pragma mark Drawing @@ -636,7 +710,7 @@ -(void)renderAsVectorInContext:(nonnull CGContextRef)context CPTMutableNumericData *xValueData = [self cachedNumbersForField:CPTRangePlotFieldX]; CPTMutableNumericData *yValueData = [self cachedNumbersForField:CPTRangePlotFieldY]; - if ( (xValueData == nil) || (yValueData == nil) ) { + if ((xValueData == nil) || (yValueData == nil)) { return; } NSUInteger dataCount = self.cachedDataCount; @@ -650,11 +724,11 @@ -(void)renderAsVectorInContext:(nonnull CGContextRef)context [super renderAsVectorInContext:context]; // Calculate view points, and align to user space - CGPointError *viewPoints = calloc( dataCount, sizeof(CGPointError) ); - BOOL *drawPointFlags = calloc( dataCount, sizeof(BOOL) ); + CGPointError *viewPoints = calloc(dataCount, sizeof(CGPointError)); + BOOL *drawPointFlags = calloc(dataCount, sizeof(BOOL)); CPTXYPlotSpace *thePlotSpace = (CPTXYPlotSpace *)self.plotSpace; - [self calculatePointsToDraw:drawPointFlags numberOfPoints:dataCount forPlotSpace:thePlotSpace includeVisiblePointsOnly:NO]; + [self calculatePointsToDraw:drawPointFlags numberOfPoints:dataCount forPlotSpace:thePlotSpace]; [self calculateViewPoints:viewPoints withDrawPointFlags:drawPointFlags numberOfPoints:dataCount]; if ( self.alignsPointsToPixels ) { [self alignViewPointsToUserSpace:viewPoints withContext:context drawPointFlags:drawPointFlags numberOfPoints:dataCount]; @@ -668,39 +742,80 @@ -(void)renderAsVectorInContext:(nonnull CGContextRef)context if ( self.areaFill ) { CGMutablePathRef fillPath = CGPathCreateMutable(); - // First do the top points - for ( NSUInteger i = (NSUInteger)firstDrawnPointIndex; i <= (NSUInteger)lastDrawnPointIndex; i++ ) { - CGFloat x = viewPoints[i].x; - CGFloat y = viewPoints[i].high; - if ( isnan(y) ) { - y = viewPoints[i].y; - } - - if ( !isnan(x) && !isnan(y) ) { - if ( i == (NSUInteger)firstDrawnPointIndex ) { - CGPathMoveToPoint(fillPath, NULL, x, y); + switch ( self.fillDirection ) { + case CPTRangePlotFillHorizontal: + // First do the top points + for ( NSUInteger i = (NSUInteger)firstDrawnPointIndex; i <= (NSUInteger)lastDrawnPointIndex; i++ ) { + CGFloat x = viewPoints[i].x; + CGFloat y = viewPoints[i].high; + if ( isnan(y)) { + y = viewPoints[i].y; + } + + if ( !isnan(x) && !isnan(y)) { + if ( i == (NSUInteger)firstDrawnPointIndex ) { + CGPathMoveToPoint(fillPath, NULL, x, y); + } + else { + CGPathAddLineToPoint(fillPath, NULL, x, y); + } + } } - else { - CGPathAddLineToPoint(fillPath, NULL, x, y); + + // Then reverse over bottom points + for ( NSUInteger j = (NSUInteger)lastDrawnPointIndex; j >= (NSUInteger)firstDrawnPointIndex; j-- ) { + CGFloat x = viewPoints[j].x; + CGFloat y = viewPoints[j].low; + if ( isnan(y)) { + y = viewPoints[j].y; + } + + if ( !isnan(x) && !isnan(y)) { + CGPathAddLineToPoint(fillPath, NULL, x, y); + } + if ( j == (NSUInteger)firstDrawnPointIndex ) { + // This could be done a bit more elegant + break; + } } - } - } + break; - // Then reverse over bottom points - for ( NSUInteger j = (NSUInteger)lastDrawnPointIndex; j >= (NSUInteger)firstDrawnPointIndex; j-- ) { - CGFloat x = viewPoints[j].x; - CGFloat y = viewPoints[j].low; - if ( isnan(y) ) { - y = viewPoints[j].y; - } + case CPTRangePlotFillVertical: + // First do the left points + for ( NSUInteger i = (NSUInteger)firstDrawnPointIndex; i <= (NSUInteger)lastDrawnPointIndex; i++ ) { + CGFloat x = viewPoints[i].left; + CGFloat y = viewPoints[i].y; + if ( isnan(x)) { + y = viewPoints[i].x; + } + + if ( !isnan(x) && !isnan(y)) { + if ( i == (NSUInteger)firstDrawnPointIndex ) { + CGPathMoveToPoint(fillPath, NULL, x, y); + } + else { + CGPathAddLineToPoint(fillPath, NULL, x, y); + } + } + } - if ( !isnan(x) && !isnan(y) ) { - CGPathAddLineToPoint(fillPath, NULL, x, y); - } - if ( j == (NSUInteger)firstDrawnPointIndex ) { - // This could be done a bit more elegant + // Then reverse over right points + for ( NSUInteger j = (NSUInteger)lastDrawnPointIndex; j >= (NSUInteger)firstDrawnPointIndex; j-- ) { + CGFloat x = viewPoints[j].right; + CGFloat y = viewPoints[j].y; + if ( isnan(x)) { + y = viewPoints[j].x; + } + + if ( !isnan(x) && !isnan(y)) { + CGPathAddLineToPoint(fillPath, NULL, x, y); + } + if ( j == (NSUInteger)firstDrawnPointIndex ) { + // This could be done a bit more elegant + break; + } + } break; - } } // Close the path to have a closed loop @@ -723,11 +838,12 @@ -(void)renderAsVectorInContext:(nonnull CGContextRef)context CGPathRelease(fillPath); } - CGSize halfGapSize = CPTSizeMake( self.gapWidth * CPTFloat(0.5), self.gapHeight * CPTFloat(0.5) ); - CGFloat halfBarWidth = self.barWidth * CPTFloat(0.5); - BOOL alignPoints = self.alignsPointsToPixels; + CGSize halfGapSize = CPTSizeMake(self.gapWidth * CPTFloat(0.5), self.gapHeight * CPTFloat(0.5)); + BOOL alignPoints = self.alignsPointsToPixels; for ( NSUInteger i = (NSUInteger)firstDrawnPointIndex; i <= (NSUInteger)lastDrawnPointIndex; i++ ) { + CGFloat halfBarWidth = [self barWidthForIndex:i].cgFloatValue * CPTFloat(0.5); + [self drawRangeInContext:context lineStyle:[self barLineStyleForIndex:i] viewPoint:&viewPoints[i] @@ -748,18 +864,18 @@ -(void)drawRangeInContext:(nonnull CGContextRef)context halfBarWidth:(CGFloat)halfBarWidth alignPoints:(BOOL)alignPoints { - if ( [lineStyle isKindOfClass:[CPTLineStyle class]] && !isnan(viewPoint->x) && !isnan(viewPoint->y) ) { + if ( [lineStyle isKindOfClass:[CPTLineStyle class]] && !isnan(viewPoint->x) && !isnan(viewPoint->y)) { CPTAlignPointFunction alignmentFunction = CPTAlignPointToUserSpace; CGFloat lineWidth = lineStyle.lineWidth; - if ( ( self.contentsScale > CPTFloat(1.0) ) && (round(lineWidth) == lineWidth) ) { + if ((self.contentsScale > CPTFloat(1.0)) && (round(lineWidth) == lineWidth)) { alignmentFunction = CPTAlignIntegralPointToUserSpace; } CGMutablePathRef path = CGPathCreateMutable(); // centre-high - if ( !isnan(viewPoint->high) ) { + if ( !isnan(viewPoint->high)) { CGPoint alignedHighPoint = CPTPointMake(viewPoint->x, viewPoint->y + halfGapSize.height); CGPoint alignedLowPoint = CPTPointMake(viewPoint->x, viewPoint->high); if ( alignPoints ) { @@ -771,7 +887,7 @@ -(void)drawRangeInContext:(nonnull CGContextRef)context } // centre-low - if ( !isnan(viewPoint->low) ) { + if ( !isnan(viewPoint->low)) { CGPoint alignedHighPoint = CPTPointMake(viewPoint->x, viewPoint->y - halfGapSize.height); CGPoint alignedLowPoint = CPTPointMake(viewPoint->x, viewPoint->low); if ( alignPoints ) { @@ -783,7 +899,7 @@ -(void)drawRangeInContext:(nonnull CGContextRef)context } // top bar - if ( !isnan(viewPoint->high) ) { + if ( !isnan(viewPoint->high)) { CGPoint alignedHighPoint = CPTPointMake(viewPoint->x - halfBarWidth, viewPoint->high); CGPoint alignedLowPoint = CPTPointMake(viewPoint->x + halfBarWidth, viewPoint->high); if ( alignPoints ) { @@ -795,7 +911,7 @@ -(void)drawRangeInContext:(nonnull CGContextRef)context } // bottom bar - if ( !isnan(viewPoint->low) ) { + if ( !isnan(viewPoint->low)) { CGPoint alignedHighPoint = CPTPointMake(viewPoint->x - halfBarWidth, viewPoint->low); CGPoint alignedLowPoint = CPTPointMake(viewPoint->x + halfBarWidth, viewPoint->low); if ( alignPoints ) { @@ -807,7 +923,7 @@ -(void)drawRangeInContext:(nonnull CGContextRef)context } // centre-left - if ( !isnan(viewPoint->left) ) { + if ( !isnan(viewPoint->left)) { CGPoint alignedHighPoint = CPTPointMake(viewPoint->x - halfGapSize.width, viewPoint->y); CGPoint alignedLowPoint = CPTPointMake(viewPoint->left, viewPoint->y); if ( alignPoints ) { @@ -819,7 +935,7 @@ -(void)drawRangeInContext:(nonnull CGContextRef)context } // centre-right - if ( !isnan(viewPoint->right) ) { + if ( !isnan(viewPoint->right)) { CGPoint alignedHighPoint = CPTPointMake(viewPoint->x + halfGapSize.width, viewPoint->y); CGPoint alignedLowPoint = CPTPointMake(viewPoint->right, viewPoint->y); if ( alignPoints ) { @@ -831,7 +947,7 @@ -(void)drawRangeInContext:(nonnull CGContextRef)context } // left bar - if ( !isnan(viewPoint->left) ) { + if ( !isnan(viewPoint->left)) { CGPoint alignedHighPoint = CPTPointMake(viewPoint->left, viewPoint->y - halfBarWidth); CGPoint alignedLowPoint = CPTPointMake(viewPoint->left, viewPoint->y + halfBarWidth); if ( alignPoints ) { @@ -843,7 +959,7 @@ -(void)drawRangeInContext:(nonnull CGContextRef)context } // right bar - if ( !isnan(viewPoint->right) ) { + if ( !isnan(viewPoint->right)) { CGPoint alignedHighPoint = CPTPointMake(viewPoint->right, viewPoint->y - halfBarWidth); CGPoint alignedLowPoint = CPTPointMake(viewPoint->right, viewPoint->y + halfBarWidth); if ( alignPoints ) { @@ -897,7 +1013,7 @@ -(void)drawSwatchForLegend:(nonnull CPTLegend *)legend atIndex:(NSUInteger)idx i [self drawRangeInContext:context lineStyle:theBarLineStyle viewPoint:&viewPoint - halfGapSize:CPTSizeMake( MIN( self.gapWidth, rect.size.width / CPTFloat(2.0) ) * CPTFloat(0.5), MIN( self.gapHeight, rect.size.height / CPTFloat(2.0) ) * CPTFloat(0.5) ) + halfGapSize:CPTSizeMake(MIN(self.gapWidth, rect.size.width / CPTFloat(2.0)) * CPTFloat(0.5), MIN(self.gapHeight, rect.size.height / CPTFloat(2.0)) * CPTFloat(0.5)) halfBarWidth:MIN(MIN(self.barWidth, rect.size.width), rect.size.height) * CPTFloat(0.5) alignPoints:YES]; } @@ -908,13 +1024,24 @@ -(nullable CPTLineStyle *)barLineStyleForIndex:(NSUInteger)idx { CPTLineStyle *theBarLineStyle = [self cachedValueForKey:CPTRangePlotBindingBarLineStyles recordIndex:idx]; - if ( (theBarLineStyle == nil) || (theBarLineStyle == [CPTPlot nilData]) ) { + if ((theBarLineStyle == nil) || (theBarLineStyle == [CPTPlot nilData])) { theBarLineStyle = self.barLineStyle; } return theBarLineStyle; } +-(nonnull NSNumber *)barWidthForIndex:(NSUInteger)idx +{ + NSNumber *theBarWidth = [self cachedValueForKey:CPTRangePlotBindingBarWidths recordIndex:idx]; + + if ((theBarWidth == nil) || (theBarWidth == [CPTPlot nilData])) { + theBarWidth = @(self.barWidth); + } + + return theBarWidth; +} + /// @endcond #pragma mark - @@ -970,11 +1097,11 @@ -(nonnull CPTNumberArray *)fieldIdentifiersForCoordinate:(CPTCoordinate)coord switch ( coord ) { case CPTCoordinateX: result = @[@(CPTRangePlotFieldX)]; - break; + break; case CPTCoordinateY: result = @[@(CPTRangePlotFieldY)]; - break; + break; default: [NSException raise:CPTException format:@"Invalid coordinate passed to fieldIdentifiersForCoordinate:"]; @@ -1017,24 +1144,15 @@ -(CPTCoordinate)coordinateForFieldIdentifier:(NSUInteger)field -(void)positionLabelAnnotation:(nonnull CPTPlotSpaceAnnotation *)label forIndex:(NSUInteger)idx { NSNumber *xValue = [self cachedNumberForField:CPTRangePlotFieldX recordIndex:idx]; + NSNumber *yValue = [self cachedNumberForField:CPTRangePlotFieldY recordIndex:idx]; BOOL positiveDirection = YES; CPTPlotRange *yRange = [self.plotSpace plotRangeForCoordinate:CPTCoordinateY]; - if ( CPTDecimalLessThan( yRange.lengthDecimal, CPTDecimalFromInteger(0) ) ) { + if ( CPTDecimalLessThan(yRange.lengthDecimal, CPTDecimalFromInteger(0))) { positiveDirection = !positiveDirection; } - NSNumber *yValue; - CPTNumberArray *yValues = @[[self cachedNumberForField:CPTRangePlotFieldY recordIndex:idx]]; - CPTNumberArray *yValuesSorted = [yValues sortedArrayUsingSelector:@selector(compare:)]; - if ( positiveDirection ) { - yValue = yValuesSorted.lastObject; - } - else { - yValue = yValuesSorted[0]; - } - label.anchorPlotPoint = @[xValue, yValue]; label.contentLayer.hidden = self.hidden || isnan([xValue doubleValue]) || isnan([yValue doubleValue]); @@ -1056,10 +1174,10 @@ -(void)positionLabelAnnotation:(nonnull CPTPlotSpaceAnnotation *)label forIndex: -(NSUInteger)dataIndexFromInteractionPoint:(CGPoint)point { NSUInteger dataCount = self.cachedDataCount; - CGPointError *viewPoints = calloc( dataCount, sizeof(CGPointError) ); - BOOL *drawPointFlags = malloc( dataCount * sizeof(BOOL) ); + CGPointError *viewPoints = calloc(dataCount, sizeof(CGPointError)); + BOOL *drawPointFlags = calloc(dataCount, sizeof(BOOL)); - [self calculatePointsToDraw:drawPointFlags numberOfPoints:dataCount forPlotSpace:(id)self.plotSpace includeVisiblePointsOnly:YES]; + [self calculatePointsToDraw:drawPointFlags numberOfPoints:dataCount forPlotSpace:(CPTXYPlotSpace *)self.plotSpace]; [self calculateViewPoints:viewPoints withDrawPointFlags:drawPointFlags numberOfPoints:dataCount]; NSInteger result = [self extremeDrawnPointIndexForFlags:drawPointFlags numberOfPoints:dataCount extremeNumIsLowerBound:YES]; @@ -1071,7 +1189,7 @@ -(NSUInteger)dataIndexFromInteractionPoint:(CGPoint)point lastViewPoint = viewPoints[i]; CGPoint lastPoint = CPTPointMake(lastViewPoint.x, lastViewPoint.y); CGFloat distanceSquared = squareOfDistanceBetweenPoints(point, lastPoint); - if ( isnan(minimumDistanceSquared) || (distanceSquared < minimumDistanceSquared) ) { + if ( isnan(minimumDistanceSquared) || (distanceSquared < minimumDistanceSquared)) { minimumDistanceSquared = distanceSquared; result = (NSInteger)i; } @@ -1080,16 +1198,16 @@ -(NSUInteger)dataIndexFromInteractionPoint:(CGPoint)point if ( result != NSNotFound ) { lastViewPoint = viewPoints[result]; - if ( !isnan(lastViewPoint.left) && (point.x < lastViewPoint.left) ) { + if ( !isnan(lastViewPoint.left) && (point.x < lastViewPoint.left)) { result = NSNotFound; } - if ( !isnan(lastViewPoint.right) && (point.x > lastViewPoint.right) ) { + if ( !isnan(lastViewPoint.right) && (point.x > lastViewPoint.right)) { result = NSNotFound; } - if ( !isnan(lastViewPoint.high) && (point.y > lastViewPoint.high) ) { + if ( !isnan(lastViewPoint.high) && (point.y > lastViewPoint.high)) { result = NSNotFound; } - if ( !isnan(lastViewPoint.low) && (point.y < lastViewPoint.low) ) { + if ( !isnan(lastViewPoint.low) && (point.y < lastViewPoint.low)) { result = NSNotFound; } } @@ -1133,7 +1251,7 @@ -(BOOL)pointingDeviceDownEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint) return NO; } - id theDelegate = self.delegate; + id theDelegate = (id)self.delegate; if ( [theDelegate respondsToSelector:@selector(rangePlot:rangeTouchDownAtRecordIndex:)] || [theDelegate respondsToSelector:@selector(rangePlot:rangeTouchDownAtRecordIndex:withEvent:)] || [theDelegate respondsToSelector:@selector(rangePlot:rangeWasSelectedAtRecordIndex:)] || @@ -1202,7 +1320,7 @@ -(BOOL)pointingDeviceUpEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)in return NO; } - id theDelegate = self.delegate; + id theDelegate = (id)self.delegate; if ( [theDelegate respondsToSelector:@selector(rangePlot:rangeTouchUpAtRecordIndex:)] || [theDelegate respondsToSelector:@selector(rangePlot:rangeTouchUpAtRecordIndex:withEvent:)] || [theDelegate respondsToSelector:@selector(rangePlot:rangeWasSelectedAtRecordIndex:)] || diff --git a/framework/Source/CPTScatterPlot.h b/framework/Source/CPTScatterPlot.h index 2d09335c5..8cd3b9a7d 100644 --- a/framework/Source/CPTScatterPlot.h +++ b/framework/Source/CPTScatterPlot.h @@ -9,11 +9,16 @@ @class CPTScatterPlot; @class CPTFill; +/** + * @brief Scatter plot bindings. + **/ +typedef NSString *CPTScatterPlotBinding cpt_swift_struct; + /// @ingroup plotBindingsScatterPlot /// @{ -extern NSString *__nonnull const CPTScatterPlotBindingXValues; -extern NSString *__nonnull const CPTScatterPlotBindingYValues; -extern NSString *__nonnull const CPTScatterPlotBindingPlotSymbols; +extern CPTScatterPlotBinding __nonnull const CPTScatterPlotBindingXValues; +extern CPTScatterPlotBinding __nonnull const CPTScatterPlotBindingYValues; +extern CPTScatterPlotBinding __nonnull const CPTScatterPlotBindingPlotSymbols; /// @} /** diff --git a/framework/Source/CPTScatterPlot.m b/framework/Source/CPTScatterPlot.m index 6ab1d51a2..d8417fc1f 100644 --- a/framework/Source/CPTScatterPlot.m +++ b/framework/Source/CPTScatterPlot.m @@ -27,9 +27,9 @@ * @endif **/ -NSString *const CPTScatterPlotBindingXValues = @"xValues"; ///< X values. -NSString *const CPTScatterPlotBindingYValues = @"yValues"; ///< Y values. -NSString *const CPTScatterPlotBindingPlotSymbols = @"plotSymbols"; ///< Plot symbols. +CPTScatterPlotBinding const CPTScatterPlotBindingXValues = @"xValues"; ///< X values. +CPTScatterPlotBinding const CPTScatterPlotBindingYValues = @"yValues"; ///< Y values. +CPTScatterPlotBinding const CPTScatterPlotBindingPlotSymbols = @"plotSymbols"; ///< Plot symbols. /// @cond @interface CPTScatterPlot() @@ -206,6 +206,7 @@ +(void)initialize [self exposeBinding:CPTScatterPlotBindingPlotSymbols]; } } + #endif /// @endcond @@ -236,7 +237,7 @@ +(void)initialize **/ -(nonnull instancetype)initWithFrame:(CGRect)newFrame { - if ( (self = [super initWithFrame:newFrame]) ) { + if ((self = [super initWithFrame:newFrame])) { dataLineStyle = [[CPTLineStyle alloc] init]; plotSymbol = nil; areaFill = nil; @@ -263,7 +264,7 @@ -(nonnull instancetype)initWithFrame:(CGRect)newFrame -(nonnull instancetype)initWithLayer:(nonnull id)layer { - if ( (self = [super initWithLayer:layer]) ) { + if ((self = [super initWithLayer:layer])) { CPTScatterPlot *theLayer = (CPTScatterPlot *)layer; dataLineStyle = theLayer->dataLineStyle; @@ -319,7 +320,7 @@ -(void)encodeWithCoder:(nonnull NSCoder *)coder -(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super initWithCoder:coder]) ) { + if ((self = [super initWithCoder:coder])) { interpolation = (CPTScatterPlotInterpolation)[coder decodeIntegerForKey:@"CPTScatterPlot.interpolation"]; histogramOption = (CPTScatterPlotHistogramOption)[coder decodeIntegerForKey:@"CPTScatterPlot.histogramOption"]; curvedInterpolationOption = (CPTScatterPlotCurvedInterpolationOption)[coder decodeIntegerForKey:@"CPTScatterPlot.curvedInterpolationOption"]; @@ -455,7 +456,7 @@ -(nullable CPTPlotSymbol *)plotSymbolForRecordIndex:(NSUInteger)idx { CPTPlotSymbol *symbol = [self cachedValueForKey:CPTScatterPlotBindingPlotSymbols recordIndex:idx]; - if ( (symbol == nil) || (symbol == [CPTPlot nilData]) ) { + if ((symbol == nil) || (symbol == [CPTPlot nilData])) { symbol = self.plotSymbol; } @@ -475,16 +476,16 @@ -(void)calculatePointsToDraw:(nonnull BOOL *)pointDrawFlags forPlotSpace:(nonnul CPTLineStyle *lineStyle = self.dataLineStyle; - if ( self.areaFill || self.areaFill2 || lineStyle.dashPattern || lineStyle.lineFill || (self.interpolation == CPTScatterPlotInterpolationCurved) ) { + if ( self.areaFill || self.areaFill2 || lineStyle.dashPattern || lineStyle.lineFill || (self.interpolation == CPTScatterPlotInterpolationCurved)) { // show all points to preserve the line dash and area fills for ( NSUInteger i = 0; i < dataCount; i++ ) { pointDrawFlags[i] = YES; } } else { - CPTPlotRangeComparisonResult *xRangeFlags = malloc( dataCount * sizeof(CPTPlotRangeComparisonResult) ); - CPTPlotRangeComparisonResult *yRangeFlags = malloc( dataCount * sizeof(CPTPlotRangeComparisonResult) ); - BOOL *nanFlags = malloc( dataCount * sizeof(BOOL) ); + CPTPlotRangeComparisonResult *xRangeFlags = calloc(dataCount, sizeof(CPTPlotRangeComparisonResult)); + CPTPlotRangeComparisonResult *yRangeFlags = calloc(dataCount, sizeof(CPTPlotRangeComparisonResult)); + BOOL *nanFlags = calloc(dataCount, sizeof(BOOL)); CPTPlotRange *xRange = xyPlotSpace.xRange; CPTPlotRange *yRange = xyPlotSpace.yRange; @@ -499,7 +500,7 @@ -(void)calculatePointsToDraw:(nonnull BOOL *)pointDrawFlags forPlotSpace:(nonnul const double y = yBytes[i]; CPTPlotRangeComparisonResult xFlag = [xRange compareToDouble:x]; - xRangeFlags[i] = xFlag; + xRangeFlags[i] = xFlag; if ( xFlag != CPTPlotRangeComparisonResultNumberInRange ) { yRangeFlags[i] = CPTPlotRangeComparisonResultNumberInRange; // if x is out of range, then y doesn't matter } @@ -519,7 +520,7 @@ -(void)calculatePointsToDraw:(nonnull BOOL *)pointDrawFlags forPlotSpace:(nonnul const NSDecimal y = yBytes[i]; CPTPlotRangeComparisonResult xFlag = [xRange compareToDecimal:x]; - xRangeFlags[i] = xFlag; + xRangeFlags[i] = xFlag; if ( xFlag != CPTPlotRangeComparisonResultNumberInRange ) { yRangeFlags[i] = CPTPlotRangeComparisonResultNumberInRange; // if x is out of range, then y doesn't matter } @@ -535,7 +536,7 @@ -(void)calculatePointsToDraw:(nonnull BOOL *)pointDrawFlags forPlotSpace:(nonnul // are included. This ensures no lines are left out that shouldn't be. CPTScatterPlotInterpolation theInterpolation = self.interpolation; - memset( pointDrawFlags, NO, dataCount * sizeof(BOOL) ); + memset(pointDrawFlags, NO, dataCount * sizeof(BOOL)); if ( dataCount > 0 ) { pointDrawFlags[0] = (xRangeFlags[0] == CPTPlotRangeComparisonResultNumberInRange && yRangeFlags[0] == CPTPlotRangeComparisonResultNumberInRange && @@ -543,9 +544,9 @@ -(void)calculatePointsToDraw:(nonnull BOOL *)pointDrawFlags forPlotSpace:(nonnul } if ( visibleOnly ) { for ( NSUInteger i = 1; i < dataCount; i++ ) { - if ( (xRangeFlags[i] == CPTPlotRangeComparisonResultNumberInRange) && - (yRangeFlags[i] == CPTPlotRangeComparisonResultNumberInRange) && - !nanFlags[i] ) { + if ((xRangeFlags[i] == CPTPlotRangeComparisonResultNumberInRange) && + (yRangeFlags[i] == CPTPlotRangeComparisonResultNumberInRange) && + !nanFlags[i] ) { pointDrawFlags[i] = YES; } } @@ -555,13 +556,13 @@ -(void)calculatePointsToDraw:(nonnull BOOL *)pointDrawFlags forPlotSpace:(nonnul case CPTScatterPlotInterpolationCurved: // Keep 2 points outside of the visible area on each side to maintain the correct curvature of the line if ( dataCount > 1 ) { - if ( !nanFlags[0] && !nanFlags[1] && ( (xRangeFlags[0] != xRangeFlags[1]) || (yRangeFlags[0] != yRangeFlags[1]) ) ) { + if ( !nanFlags[0] && !nanFlags[1] && ((xRangeFlags[0] != xRangeFlags[1]) || (yRangeFlags[0] != yRangeFlags[1]))) { pointDrawFlags[0] = YES; pointDrawFlags[1] = YES; } - else if ( (xRangeFlags[1] == CPTPlotRangeComparisonResultNumberInRange) && - (yRangeFlags[1] == CPTPlotRangeComparisonResultNumberInRange) && - !nanFlags[1] ) { + else if ((xRangeFlags[1] == CPTPlotRangeComparisonResultNumberInRange) && + (yRangeFlags[1] == CPTPlotRangeComparisonResultNumberInRange) && + !nanFlags[1] ) { pointDrawFlags[1] = YES; } } @@ -572,14 +573,14 @@ -(void)calculatePointsToDraw:(nonnull BOOL *)pointDrawFlags forPlotSpace:(nonnul pointDrawFlags[i - 1] = YES; pointDrawFlags[i] = YES; } - else if ( !nanFlags[i - 1] && !nanFlags[i] && ( (xRangeFlags[i - 1] != xRangeFlags[i]) || (yRangeFlags[i - 1] != yRangeFlags[i]) ) ) { + else if ( !nanFlags[i - 1] && !nanFlags[i] && ((xRangeFlags[i - 1] != xRangeFlags[i]) || (yRangeFlags[i - 1] != yRangeFlags[i]))) { pointDrawFlags[i - 2] = YES; pointDrawFlags[i - 1] = YES; pointDrawFlags[i] = YES; } - else if ( (xRangeFlags[i] == CPTPlotRangeComparisonResultNumberInRange) && - (yRangeFlags[i] == CPTPlotRangeComparisonResultNumberInRange) && - !nanFlags[i] ) { + else if ((xRangeFlags[i] == CPTPlotRangeComparisonResultNumberInRange) && + (yRangeFlags[i] == CPTPlotRangeComparisonResultNumberInRange) && + !nanFlags[i] ) { pointDrawFlags[i] = YES; } } @@ -588,13 +589,13 @@ -(void)calculatePointsToDraw:(nonnull BOOL *)pointDrawFlags forPlotSpace:(nonnul default: // Keep 1 point outside of the visible area on each side for ( NSUInteger i = 1; i < dataCount; i++ ) { - if ( !nanFlags[i - 1] && !nanFlags[i] && ( (xRangeFlags[i - 1] != xRangeFlags[i]) || (yRangeFlags[i - 1] != yRangeFlags[i]) ) ) { + if ( !nanFlags[i - 1] && !nanFlags[i] && ((xRangeFlags[i - 1] != xRangeFlags[i]) || (yRangeFlags[i - 1] != yRangeFlags[i]))) { pointDrawFlags[i - 1] = YES; pointDrawFlags[i] = YES; } - else if ( (xRangeFlags[i] == CPTPlotRangeComparisonResultNumberInRange) && - (yRangeFlags[i] == CPTPlotRangeComparisonResultNumberInRange) && - !nanFlags[i] ) { + else if ((xRangeFlags[i] == CPTPlotRangeComparisonResultNumberInRange) && + (yRangeFlags[i] == CPTPlotRangeComparisonResultNumberInRange) && + !nanFlags[i] ) { pointDrawFlags[i] = YES; } } @@ -620,7 +621,7 @@ -(void)calculateViewPoints:(nonnull CGPoint *)viewPoints withDrawPointFlags:(non dispatch_apply(dataCount, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(size_t i) { const double x = xBytes[i]; const double y = yBytes[i]; - if ( !drawPointFlags[i] || isnan(x) || isnan(y) ) { + if ( !drawPointFlags[i] || isnan(x) || isnan(y)) { viewPoints[i] = CPTPointMake(NAN, NAN); } else { @@ -642,7 +643,7 @@ -(void)calculateViewPoints:(nonnull CGPoint *)viewPoints withDrawPointFlags:(non dispatch_apply(dataCount, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(size_t i) { const NSDecimal x = xBytes[i]; const NSDecimal y = yBytes[i]; - if ( !drawPointFlags[i] || NSDecimalIsNotANumber(&x) || NSDecimalIsNotANumber(&y) ) { + if ( !drawPointFlags[i] || NSDecimalIsNotANumber(&x) || NSDecimalIsNotANumber(&y)) { viewPoints[i] = CPTPointMake(NAN, NAN); } else { @@ -660,7 +661,7 @@ -(void)alignViewPointsToUserSpace:(nonnull CGPoint *)viewPoints withContext:(non { // Align to device pixels if there is a data line. // Otherwise, align to view space, so fills are sharp at edges. - if ( self.dataLineStyle.lineWidth > CPTFloat(0.0) ) { + if ( self.dataLineStyle.lineWidth > CPTFloat(0.0)) { dispatch_apply(dataCount, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(size_t i) { if ( drawPointFlags[i] ) { viewPoints[i] = CPTAlignPointToUserSpace(context, viewPoints[i]); @@ -688,7 +689,7 @@ -(NSInteger)extremeDrawnPointIndexForFlags:(nonnull BOOL *)pointDrawFlags number result = i; break; } - if ( (delta < 0) && (i == 0) ) { + if ((delta < 0) && (i == 0)) { break; } } @@ -717,10 +718,10 @@ -(NSUInteger)dataIndexFromInteractionPoint:(CGPoint)point -(NSUInteger)indexOfVisiblePointClosestToPlotAreaPoint:(CGPoint)viewPoint { NSUInteger dataCount = self.cachedDataCount; - CGPoint *viewPoints = calloc( dataCount, sizeof(CGPoint) ); - BOOL *drawPointFlags = calloc( dataCount, sizeof(BOOL) ); + CGPoint *viewPoints = calloc(dataCount, sizeof(CGPoint)); + BOOL *drawPointFlags = calloc(dataCount, sizeof(BOOL)); - [self calculatePointsToDraw:drawPointFlags forPlotSpace:(id)self.plotSpace includeVisiblePointsOnly:YES numberOfPoints:dataCount]; + [self calculatePointsToDraw:drawPointFlags forPlotSpace:(CPTXYPlotSpace *)self.plotSpace includeVisiblePointsOnly:YES numberOfPoints:dataCount]; [self calculateViewPoints:viewPoints withDrawPointFlags:drawPointFlags numberOfPoints:dataCount]; NSInteger result = [self extremeDrawnPointIndexForFlags:drawPointFlags numberOfPoints:dataCount extremeNumIsLowerBound:YES]; @@ -729,7 +730,7 @@ -(NSUInteger)indexOfVisiblePointClosestToPlotAreaPoint:(CGPoint)viewPoint for ( NSUInteger i = (NSUInteger)result; i < dataCount; ++i ) { if ( drawPointFlags[i] ) { CGFloat distanceSquared = squareOfDistanceBetweenPoints(viewPoint, viewPoints[i]); - if ( isnan(minimumDistanceSquared) || (distanceSquared < minimumDistanceSquared) ) { + if ( isnan(minimumDistanceSquared) || (distanceSquared < minimumDistanceSquared)) { minimumDistanceSquared = distanceSquared; result = (NSInteger)i; } @@ -786,14 +787,14 @@ -(void)renderAsVectorInContext:(nonnull CGContextRef)context CPTMutableNumericData *xValueData = [self cachedNumbersForField:CPTScatterPlotFieldX]; CPTMutableNumericData *yValueData = [self cachedNumbersForField:CPTScatterPlotFieldY]; - if ( (xValueData == nil) || (yValueData == nil) ) { + if ((xValueData == nil) || (yValueData == nil)) { return; } NSUInteger dataCount = self.cachedDataCount; if ( dataCount == 0 ) { return; } - if ( !(self.dataLineStyle || self.areaFill || self.areaFill2 || self.plotSymbol || self.plotSymbols.count) ) { + if ( !(self.dataLineStyle || self.areaFill || self.areaFill2 || self.plotSymbol || self.plotSymbols.count)) { return; } if ( xValueData.numberOfSamples != yValueData.numberOfSamples ) { @@ -803,8 +804,8 @@ -(void)renderAsVectorInContext:(nonnull CGContextRef)context [super renderAsVectorInContext:context]; // Calculate view points, and align to user space - CGPoint *viewPoints = malloc( dataCount * sizeof(CGPoint) ); - BOOL *drawPointFlags = malloc( dataCount * sizeof(BOOL) ); + CGPoint *viewPoints = calloc(dataCount, sizeof(CGPoint)); + BOOL *drawPointFlags = calloc(dataCount, sizeof(BOOL)); CPTXYPlotSpace *thePlotSpace = (CPTXYPlotSpace *)self.plotSpace; [self calculatePointsToDraw:drawPointFlags forPlotSpace:thePlotSpace includeVisiblePointsOnly:NO numberOfPoints:dataCount]; @@ -820,7 +821,7 @@ -(void)renderAsVectorInContext:(nonnull CGContextRef)context NSInteger firstDrawnPointIndex = [self extremeDrawnPointIndexForFlags:drawPointFlags numberOfPoints:dataCount extremeNumIsLowerBound:YES]; if ( firstDrawnPointIndex != NSNotFound ) { - NSRange viewIndexRange = NSMakeRange( (NSUInteger)firstDrawnPointIndex, (NSUInteger)(lastDrawnPointIndex - firstDrawnPointIndex + 1) ); + NSRange viewIndexRange = NSMakeRange((NSUInteger)firstDrawnPointIndex, (NSUInteger)(lastDrawnPointIndex - firstDrawnPointIndex + 1)); CPTPlotArea *thePlotArea = self.plotArea; CPTLineStyle *theLineStyle = self.dataLineStyle; @@ -846,8 +847,8 @@ -(void)renderAsVectorInContext:(nonnull CGContextRef)context theAreaBaseValue = CPTDecimalNaN(); break; } - if ( !NSDecimalIsNotANumber(&theAreaBaseValue) ) { - if ( theFill || ( (i == 0) && fillBands ) ) { + if ( !NSDecimalIsNotANumber(&theAreaBaseValue)) { + if ( theFill || ((i == 0) && fillBands)) { // clear the plot shadow if any--not needed for fills when the plot has a data line if ( theLineStyle ) { CGContextSaveGState(context); @@ -872,8 +873,8 @@ -(void)renderAsVectorInContext:(nonnull CGContextRef)context } // Draw fill bands - if ( (i == 0) && fillBands ) { - CGFloat height = CPTFloat( CGBitmapContextGetHeight(context) ); + if ((i == 0) && fillBands ) { + CGFloat height = CPTFloat(CGBitmapContextGetHeight(context)); for ( CPTLimitBand *band in fillBands ) { CGContextSaveGState(context); @@ -891,7 +892,7 @@ -(void)renderAsVectorInContext:(nonnull CGContextRef)context maxPoint = CPTAlignIntegralPointToUserSpace(context, maxPoint); } - CGContextClipToRect( context, CGRectMake(minPoint.x, 0.0, maxPoint.x - minPoint.x, height) ); + CGContextClipToRect(context, CGRectMake(minPoint.x, 0.0, maxPoint.x - minPoint.x, height)); CGContextBeginPath(context); CGContextAddPath(context, dataLinePath); @@ -915,7 +916,7 @@ -(void)renderAsVectorInContext:(nonnull CGContextRef)context CGPathRef dataLinePath = [self newDataLinePathForViewPoints:viewPoints indexRange:viewIndexRange baselineYValue:CPTNAN]; // Give the delegate a chance to prepare for the drawing. - id theDelegate = self.delegate; + id theDelegate = (id)self.delegate; if ( [theDelegate respondsToSelector:@selector(scatterPlot:prepareForDrawingPlotLine:inContext:)] ) { [theDelegate scatterPlot:self prepareForDrawingPlotLine:dataLinePath inContext:context]; } @@ -983,9 +984,9 @@ -(nonnull CGPathRef)newDataLinePathForViewPoints:(nonnull CGPoint *)viewPoints i for ( NSUInteger i = indexRange.location; i <= lastDrawnPointIndex; i++ ) { CGPoint viewPoint = viewPoints[i]; - if ( isnan(viewPoint.x) || isnan(viewPoint.y) ) { + if ( isnan(viewPoint.x) || isnan(viewPoint.y)) { if ( !lastPointSkipped ) { - if ( !isnan(baselineYValue) ) { + if ( !isnan(baselineYValue)) { CGPathAddLineToPoint(dataLinePath, NULL, lastPoint.x, baselineYValue); CGPathAddLineToPoint(dataLinePath, NULL, firstPoint.x, baselineYValue); CGPathCloseSubpath(dataLinePath); @@ -1032,7 +1033,7 @@ -(nonnull CGPathRef)newDataLinePathForViewPoints:(nonnull CGPoint *)viewPoints i } } - if ( !lastPointSkipped && !isnan(baselineYValue) ) { + if ( !lastPointSkipped && !isnan(baselineYValue)) { CGPathAddLineToPoint(dataLinePath, NULL, lastPoint.x, baselineYValue); CGPathAddLineToPoint(dataLinePath, NULL, firstPoint.x, baselineYValue); CGPathCloseSubpath(dataLinePath); @@ -1053,8 +1054,8 @@ -(nonnull CGPathRef)newCurvedDataLinePathForViewPoints:(nonnull CGPoint *)viewPo CPTScatterPlotCurvedInterpolationOption interpolationOption = self.curvedInterpolationOption; if ( lastDrawnPointIndex > 0 ) { - CGPoint *controlPoints1 = calloc( lastDrawnPointIndex, sizeof(CGPoint) ); - CGPoint *controlPoints2 = calloc( lastDrawnPointIndex, sizeof(CGPoint) ); + CGPoint *controlPoints1 = calloc(lastDrawnPointIndex, sizeof(CGPoint)); + CGPoint *controlPoints2 = calloc(lastDrawnPointIndex, sizeof(CGPoint)); lastDrawnPointIndex--; @@ -1062,7 +1063,7 @@ -(nonnull CGPathRef)newCurvedDataLinePathForViewPoints:(nonnull CGPoint *)viewPo for ( NSUInteger i = indexRange.location; i <= lastDrawnPointIndex; i++ ) { CGPoint viewPoint = viewPoints[i]; - if ( isnan(viewPoint.x) || isnan(viewPoint.y) ) { + if ( isnan(viewPoint.x) || isnan(viewPoint.y)) { if ( !lastPointSkipped ) { switch ( interpolationOption ) { case CPTScatterPlotCurvedInterpolationNormal: @@ -1181,9 +1182,9 @@ -(nonnull CGPathRef)newCurvedDataLinePathForViewPoints:(nonnull CGPoint *)viewPo for ( NSUInteger i = indexRange.location; i <= lastDrawnPointIndex; i++ ) { CGPoint viewPoint = viewPoints[i]; - if ( isnan(viewPoint.x) || isnan(viewPoint.y) ) { + if ( isnan(viewPoint.x) || isnan(viewPoint.y)) { if ( !lastPointSkipped ) { - if ( !isnan(baselineYValue) ) { + if ( !isnan(baselineYValue)) { CGPathAddLineToPoint(dataLinePath, NULL, lastPoint.x, baselineYValue); CGPathAddLineToPoint(dataLinePath, NULL, firstPoint.x, baselineYValue); CGPathCloseSubpath(dataLinePath); @@ -1207,13 +1208,13 @@ -(nonnull CGPathRef)newCurvedDataLinePathForViewPoints:(nonnull CGPoint *)viewPo // add the control points CGPathMoveToPoint(dataLinePath, NULL, cp1.x - CPTFloat(5.0), cp1.y); CGPathAddLineToPoint(dataLinePath, NULL, cp1.x + CPTFloat(5.0), cp1.y); - CGPathMoveToPoint( dataLinePath, NULL, cp1.x, cp1.y - CPTFloat(5.0) ); - CGPathAddLineToPoint( dataLinePath, NULL, cp1.x, cp1.y + CPTFloat(5.0) ); + CGPathMoveToPoint(dataLinePath, NULL, cp1.x, cp1.y - CPTFloat(5.0)); + CGPathAddLineToPoint(dataLinePath, NULL, cp1.x, cp1.y + CPTFloat(5.0)); - CGPathMoveToPoint( dataLinePath, NULL, cp2.x - CPTFloat(3.5), cp2.y - CPTFloat(3.5) ); - CGPathAddLineToPoint( dataLinePath, NULL, cp2.x + CPTFloat(3.5), cp2.y + CPTFloat(3.5) ); - CGPathMoveToPoint( dataLinePath, NULL, cp2.x + CPTFloat(3.5), cp2.y - CPTFloat(3.5) ); - CGPathAddLineToPoint( dataLinePath, NULL, cp2.x - CPTFloat(3.5), cp2.y + CPTFloat(3.5) ); + CGPathMoveToPoint(dataLinePath, NULL, cp2.x - CPTFloat(3.5), cp2.y - CPTFloat(3.5)); + CGPathAddLineToPoint(dataLinePath, NULL, cp2.x + CPTFloat(3.5), cp2.y + CPTFloat(3.5)); + CGPathMoveToPoint(dataLinePath, NULL, cp2.x + CPTFloat(3.5), cp2.y - CPTFloat(3.5)); + CGPathAddLineToPoint(dataLinePath, NULL, cp2.x - CPTFloat(3.5), cp2.y + CPTFloat(3.5)); // add a line connecting the control points CGPathMoveToPoint(dataLinePath, NULL, cp1.x, cp1.y); @@ -1228,7 +1229,7 @@ -(nonnull CGPathRef)newCurvedDataLinePathForViewPoints:(nonnull CGPoint *)viewPo } } - if ( !lastPointSkipped && !isnan(baselineYValue) ) { + if ( !lastPointSkipped && !isnan(baselineYValue)) { CGPathAddLineToPoint(dataLinePath, NULL, lastPoint.x, baselineYValue); CGPathAddLineToPoint(dataLinePath, NULL, firstPoint.x, baselineYValue); CGPathCloseSubpath(dataLinePath); @@ -1284,12 +1285,12 @@ -(void)computeCatmullRomControlPoints:(nonnull CGPoint *)points points2:(nonnull CGFloat d2 = hypot(p2.x - p1.x, p2.y - p1.y); CGFloat d3 = hypot(p3.x - p2.x, p3.y - p2.y); // constants - CGFloat d1_a = pow(d1, alpha); // d1^alpha - CGFloat d2_a = pow(d2, alpha); // d2^alpha - CGFloat d3_a = pow(d3, alpha); // d3^alpha - CGFloat d1_2a = pow( d1_a, CPTFloat(2.0) ); // d1^alpha^2 = d1^2*alpha - CGFloat d2_2a = pow( d2_a, CPTFloat(2.0) ); // d2^alpha^2 = d2^2*alpha - CGFloat d3_2a = pow( d3_a, CPTFloat(2.0) ); // d3^alpha^2 = d3^2*alpha + CGFloat d1_a = pow(d1, alpha); // d1^alpha + CGFloat d2_a = pow(d2, alpha); // d2^alpha + CGFloat d3_a = pow(d3, alpha); // d3^alpha + CGFloat d1_2a = pow(d1_a, CPTFloat(2.0)); // d1^alpha^2 = d1^2*alpha + CGFloat d2_2a = pow(d2_a, CPTFloat(2.0)); // d2^alpha^2 = d2^2*alpha + CGFloat d3_2a = pow(d3_a, CPTFloat(2.0)); // d3^alpha^2 = d3^2*alpha // calculate the control points // see : http://www.cemyuksel.com/research/catmullrom_param/catmullrom.pdf under point 3. @@ -1299,9 +1300,9 @@ -(void)computeCatmullRomControlPoints:(nonnull CGPoint *)points points2:(nonnull } else { CGFloat divisor = CPTFloat(3.0) * d1_a * (d1_a + d2_a); - cp1 = CPTPointMake( (p2.x * d1_2a - p0.x * d2_2a + (2 * d1_2a + 3 * d1_a * d2_a + d2_2a) * p1.x) / divisor, - (p2.y * d1_2a - p0.y * d2_2a + (2 * d1_2a + 3 * d1_a * d2_a + d2_2a) * p1.y) / divisor - ); + cp1 = CPTPointMake((p2.x * d1_2a - p0.x * d2_2a + (2 * d1_2a + 3 * d1_a * d2_a + d2_2a) * p1.x) / divisor, + (p2.y * d1_2a - p0.y * d2_2a + (2 * d1_2a + 3 * d1_a * d2_a + d2_2a) * p1.y) / divisor + ); } if ( fabs(d3) <= epsilon ) { @@ -1309,8 +1310,8 @@ -(void)computeCatmullRomControlPoints:(nonnull CGPoint *)points points2:(nonnull } else { CGFloat divisor = 3 * d3_a * (d3_a + d2_a); - cp2 = CPTPointMake( (d3_2a * p1.x - d2_2a * p3.x + (2 * d3_2a + 3 * d3_a * d2_a + d2_2a) * p2.x) / divisor, - (d3_2a * p1.y - d2_2a * p3.y + (2 * d3_2a + 3 * d3_a * d2_a + d2_2a) * p2.y) / divisor ); + cp2 = CPTPointMake((d3_2a * p1.x - d2_2a * p3.x + (2 * d3_2a + 3 * d3_a * d2_a + d2_2a) * p2.x) / divisor, + (d3_2a * p1.y - d2_2a * p3.y + (2 * d3_2a + 3 * d3_a * d2_a + d2_2a) * p2.y) / divisor); } points[index + 1] = cp1; @@ -1363,17 +1364,17 @@ -(void)computeHermiteControlPoints:(nonnull CGPoint *)points points2:(nonnull CG m.dy = p2.y - p0.y; if ( monotonic ) { - if ( m.dx > CPTFloat(0.0) ) { + if ( m.dx > CPTFloat(0.0)) { m.dx = MIN(p2.x - p1.x, p1.x - p0.x); } - else if ( m.dx < CPTFloat(0.0) ) { + else if ( m.dx < CPTFloat(0.0)) { m.dx = MAX(p2.x - p1.x, p1.x - p0.x); } - if ( m.dy > CPTFloat(0.0) ) { + if ( m.dy > CPTFloat(0.0)) { m.dy = MIN(p2.y - p1.y, p1.y - p0.y); } - else if ( m.dy < CPTFloat(0.0) ) { + else if ( m.dy < CPTFloat(0.0)) { m.dy = MAX(p2.y - p1.y, p1.y - p0.y); } } @@ -1483,10 +1484,10 @@ -(void)computeBezierControlPoints:(nonnull CGPoint *)cp1 points2:(nonnull CGPoin NSUInteger n = indexRange.length - 1; // rhs vector - CGPoint *a = malloc( n * sizeof(CGPoint) ); - CGPoint *b = malloc( n * sizeof(CGPoint) ); - CGPoint *c = malloc( n * sizeof(CGPoint) ); - CGPoint *r = malloc( n * sizeof(CGPoint) ); + CGPoint *a = calloc(n, sizeof(CGPoint)); + CGPoint *b = calloc(n, sizeof(CGPoint)); + CGPoint *c = calloc(n, sizeof(CGPoint)); + CGPoint *r = calloc(n, sizeof(CGPoint)); // left most segment a[0] = CGPointZero; @@ -1533,11 +1534,11 @@ -(void)computeBezierControlPoints:(nonnull CGPoint *)cp1 points2:(nonnull CGPoin cp1[indexRange.location + n] = CGPointMake(r[n - 1].x / b[n - 1].x, r[n - 1].y / b[n - 1].y); for ( NSUInteger i = n - 2; i > 0; i-- ) { - cp1[indexRange.location + i + 1] = CGPointMake( (r[i].x - c[i].x * cp1[indexRange.location + i + 2].x) / b[i].x, - (r[i].y - c[i].y * cp1[indexRange.location + i + 2].y) / b[i].y ); + cp1[indexRange.location + i + 1] = CGPointMake((r[i].x - c[i].x * cp1[indexRange.location + i + 2].x) / b[i].x, + (r[i].y - c[i].y * cp1[indexRange.location + i + 2].y) / b[i].y); } - cp1[indexRange.location + 1] = CGPointMake( (r[0].x - c[0].x * cp1[indexRange.location + 2].x) / b[0].x, - (r[0].y - c[0].y * cp1[indexRange.location + 2].y) / b[0].y ); + cp1[indexRange.location + 1] = CGPointMake((r[0].x - c[0].x * cp1[indexRange.location + 2].x) / b[0].x, + (r[0].y - c[0].y * cp1[indexRange.location + 2].y) / b[0].y); // we have p1, now compute p2 NSUInteger rangeEnd = NSMaxRange(indexRange) - 1; @@ -1546,8 +1547,8 @@ -(void)computeBezierControlPoints:(nonnull CGPoint *)cp1 points2:(nonnull CGPoin CPTFloat(2.0) * viewPoints[i].y - cp1[i + 1].y); } - cp2[rangeEnd] = CGPointMake( CPTFloat(0.5) * (viewPoints[rangeEnd].x + cp1[rangeEnd].x), - CPTFloat(0.5) * (viewPoints[rangeEnd].y + cp1[rangeEnd].y) ); + cp2[rangeEnd] = CGPointMake(CPTFloat(0.5) * (viewPoints[rangeEnd].x + cp1[rangeEnd].x), + CPTFloat(0.5) * (viewPoints[rangeEnd].y + cp1[rangeEnd].y)); // clean up free(a); @@ -1567,8 +1568,8 @@ -(void)drawSwatchForLegend:(nonnull CPTLegend *)legend atIndex:(NSUInteger)idx i if ( theLineStyle ) { [theLineStyle setLineStyleInContext:context]; - CGPoint alignedStartPoint = CPTAlignPointToUserSpace( context, CPTPointMake( CGRectGetMinX(rect), CGRectGetMidY(rect) ) ); - CGPoint alignedEndPoint = CPTAlignPointToUserSpace( context, CPTPointMake( CGRectGetMaxX(rect), CGRectGetMidY(rect) ) ); + CGPoint alignedStartPoint = CPTAlignPointToUserSpace(context, CPTPointMake(CGRectGetMinX(rect), CGRectGetMidY(rect))); + CGPoint alignedEndPoint = CPTAlignPointToUserSpace(context, CPTPointMake(CGRectGetMaxX(rect), CGRectGetMidY(rect))); CGContextMoveToPoint(context, alignedStartPoint.x, alignedStartPoint.y); CGContextAddLineToPoint(context, alignedEndPoint.x, alignedEndPoint.y); @@ -1579,7 +1580,7 @@ -(void)drawSwatchForLegend:(nonnull CPTLegend *)legend atIndex:(NSUInteger)idx i if ( thePlotSymbol ) { [thePlotSymbol renderInContext:context - atPoint:CPTPointMake( CGRectGetMidX(rect), CGRectGetMidY(rect) ) + atPoint:CPTPointMake(CGRectGetMidX(rect), CGRectGetMidY(rect)) scale:self.contentsScale alignToPixels:YES]; } @@ -1607,13 +1608,13 @@ -(void)drawSwatchForLegend:(nonnull CPTLegend *)legend atIndex:(NSUInteger)idx i CGContextAddPath(context, swatchPath); CGContextClip(context); - if ( CPTDecimalGreaterThanOrEqualTo(self.areaBaseValue2.decimalValue, self.areaBaseValue.decimalValue) ) { - [fill1 fillRect:CPTRectMake( CGRectGetMinX(rect), CGRectGetMinY(rect), rect.size.width, rect.size.height / CPTFloat(2.0) ) inContext:context]; - [fill2 fillRect:CPTRectMake( CGRectGetMinX(rect), CGRectGetMidY(rect), rect.size.width, rect.size.height / CPTFloat(2.0) ) inContext:context]; + if ( CPTDecimalGreaterThanOrEqualTo(self.areaBaseValue2.decimalValue, self.areaBaseValue.decimalValue)) { + [fill1 fillRect:CPTRectMake(CGRectGetMinX(rect), CGRectGetMinY(rect), rect.size.width, rect.size.height / CPTFloat(2.0)) inContext:context]; + [fill2 fillRect:CPTRectMake(CGRectGetMinX(rect), CGRectGetMidY(rect), rect.size.width, rect.size.height / CPTFloat(2.0)) inContext:context]; } else { - [fill2 fillRect:CPTRectMake( CGRectGetMinX(rect), CGRectGetMinY(rect), rect.size.width, rect.size.height / CPTFloat(2.0) ) inContext:context]; - [fill1 fillRect:CPTRectMake( CGRectGetMinX(rect), CGRectGetMidY(rect), rect.size.width, rect.size.height / CPTFloat(2.0) ) inContext:context]; + [fill2 fillRect:CPTRectMake(CGRectGetMinX(rect), CGRectGetMinY(rect), rect.size.width, rect.size.height / CPTFloat(2.0)) inContext:context]; + [fill1 fillRect:CPTRectMake(CGRectGetMinX(rect), CGRectGetMidY(rect), rect.size.width, rect.size.height / CPTFloat(2.0)) inContext:context]; } CGContextRestoreGState(context); @@ -1635,8 +1636,8 @@ -(nonnull CGPathRef)newDataLinePath } // Calculate view points - CGPoint *viewPoints = malloc( dataCount * sizeof(CGPoint) ); - BOOL *drawPointFlags = malloc( dataCount * sizeof(BOOL) ); + CGPoint *viewPoints = calloc(dataCount, sizeof(CGPoint)); + BOOL *drawPointFlags = calloc(dataCount, sizeof(BOOL)); for ( NSUInteger i = 0; i < dataCount; i++ ) { drawPointFlags[i] = YES; @@ -1702,8 +1703,8 @@ -(nullable CPTPlotRange *)plotRangeEnclosingField:(NSUInteger)fieldEnum CGPathRelease(dataLinePath); CPTNumberArray *lowerLeft = [space plotPointForPlotAreaViewPoint:boundingBox.origin]; - CPTNumberArray *upperRight = [space plotPointForPlotAreaViewPoint:CGPointMake( CGRectGetMaxX(boundingBox), - CGRectGetMaxY(boundingBox) )]; + CPTNumberArray *upperRight = [space plotPointForPlotAreaViewPoint:CGPointMake(CGRectGetMaxX(boundingBox), + CGRectGetMaxY(boundingBox))]; switch ( fieldEnum ) { case CPTScatterPlotFieldX: @@ -1759,11 +1760,11 @@ -(nonnull CPTNumberArray *)fieldIdentifiersForCoordinate:(CPTCoordinate)coord switch ( coord ) { case CPTCoordinateX: result = @[@(CPTScatterPlotFieldX)]; - break; + break; case CPTCoordinateY: result = @[@(CPTScatterPlotFieldY)]; - break; + break; default: [NSException raise:CPTException format:@"Invalid coordinate passed to fieldIdentifiersForCoordinate:"]; @@ -1807,7 +1808,7 @@ -(void)positionLabelAnnotation:(nonnull CPTPlotSpaceAnnotation *)label forIndex: BOOL positiveDirection = YES; CPTPlotRange *yRange = [self.plotSpace plotRangeForCoordinate:CPTCoordinateY]; - if ( CPTDecimalLessThan( yRange.lengthDecimal, CPTDecimalFromInteger(0) ) ) { + if ( CPTDecimalLessThan(yRange.lengthDecimal, CPTDecimalFromInteger(0))) { positiveDirection = !positiveDirection; } @@ -1913,7 +1914,7 @@ -(BOOL)pointingDeviceDownEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint) return NO; } - id theDelegate = self.delegate; + id theDelegate = (id)self.delegate; BOOL symbolTouchUpHandled = NO; if ( [theDelegate respondsToSelector:@selector(scatterPlot:plotSymbolTouchDownAtRecordIndex:)] || @@ -1938,9 +1939,9 @@ -(BOOL)pointingDeviceDownEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint) CGFloat margin = self.plotSymbolMarginForHitDetection * CPTFloat(2.0); symbolRect.size.width += margin; symbolRect.size.height += margin; - symbolRect.origin = CPTPointMake( center.x - CPTFloat(0.5) * CGRectGetWidth(symbolRect), center.y - CPTFloat(0.5) * CGRectGetHeight(symbolRect) ); + symbolRect.origin = CPTPointMake(center.x - CPTFloat(0.5) * CGRectGetWidth(symbolRect), center.y - CPTFloat(0.5) * CGRectGetHeight(symbolRect)); - if ( CGRectContainsPoint(symbolRect, plotAreaPoint) ) { + if ( CGRectContainsPoint(symbolRect, plotAreaPoint)) { self.pointingDeviceDownIndex = idx; if ( [theDelegate respondsToSelector:@selector(scatterPlot:plotSymbolTouchDownAtRecordIndex:)] ) { @@ -1963,7 +1964,7 @@ -(BOOL)pointingDeviceDownEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint) ([theDelegate respondsToSelector:@selector(scatterPlotDataLineTouchDown:)] || [theDelegate respondsToSelector:@selector(scatterPlot:dataLineTouchDownWithEvent:)] || [theDelegate respondsToSelector:@selector(scatterPlotDataLineWasSelected:)] || - [theDelegate respondsToSelector:@selector(scatterPlot:dataLineWasSelectedWithEvent:)]) ) { + [theDelegate respondsToSelector:@selector(scatterPlot:dataLineWasSelectedWithEvent:)])) { plotSelected = [self plotWasLineHitByInteractionPoint:interactionPoint]; if ( plotSelected ) { // Let the delegate know that the plot was selected. @@ -2030,7 +2031,7 @@ -(BOOL)pointingDeviceUpEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)in return NO; } - id theDelegate = self.delegate; + id theDelegate = (id)self.delegate; BOOL symbolSelectHandled = NO; if ( [theDelegate respondsToSelector:@selector(scatterPlot:plotSymbolTouchUpAtRecordIndex:)] || @@ -2055,9 +2056,9 @@ -(BOOL)pointingDeviceUpEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)in CGFloat margin = self.plotSymbolMarginForHitDetection * CPTFloat(2.0); symbolRect.size.width += margin; symbolRect.size.height += margin; - symbolRect.origin = CPTPointMake( center.x - CPTFloat(0.5) * CGRectGetWidth(symbolRect), center.y - CPTFloat(0.5) * CGRectGetHeight(symbolRect) ); + symbolRect.origin = CPTPointMake(center.x - CPTFloat(0.5) * CGRectGetWidth(symbolRect), center.y - CPTFloat(0.5) * CGRectGetHeight(symbolRect)); - if ( CGRectContainsPoint(symbolRect, plotAreaPoint) ) { + if ( CGRectContainsPoint(symbolRect, plotAreaPoint)) { self.pointingDeviceDownIndex = idx; if ( [theDelegate respondsToSelector:@selector(scatterPlot:plotSymbolTouchUpAtRecordIndex:)] ) { @@ -2092,7 +2093,7 @@ -(BOOL)pointingDeviceUpEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)in ([theDelegate respondsToSelector:@selector(scatterPlotDataLineTouchUp:)] || [theDelegate respondsToSelector:@selector(scatterPlot:dataLineTouchUpWithEvent:)] || [theDelegate respondsToSelector:@selector(scatterPlotDataLineWasSelected:)] || - [theDelegate respondsToSelector:@selector(scatterPlot:dataLineWasSelectedWithEvent:)]) ) { + [theDelegate respondsToSelector:@selector(scatterPlot:dataLineWasSelectedWithEvent:)])) { plotSelected = [self plotWasLineHitByInteractionPoint:interactionPoint]; if ( plotSelected ) { @@ -2136,8 +2137,8 @@ -(BOOL)plotWasLineHitByInteractionPoint:(CGPoint)interactionPoint NSUInteger dataCount = self.cachedDataCount; if ( theGraph && thePlotArea && !self.hidden && dataCount ) { - CGPoint *viewPoints = malloc( dataCount * sizeof(CGPoint) ); - BOOL *drawPointFlags = malloc( dataCount * sizeof(BOOL) ); + CGPoint *viewPoints = calloc(dataCount, sizeof(CGPoint)); + BOOL *drawPointFlags = calloc(dataCount, sizeof(BOOL)); CPTXYPlotSpace *thePlotSpace = (CPTXYPlotSpace *)self.plotSpace; [self calculatePointsToDraw:drawPointFlags forPlotSpace:thePlotSpace includeVisiblePointsOnly:NO numberOfPoints:dataCount]; @@ -2147,14 +2148,14 @@ -(BOOL)plotWasLineHitByInteractionPoint:(CGPoint)interactionPoint if ( firstDrawnPointIndex != NSNotFound ) { NSInteger lastDrawnPointIndex = [self extremeDrawnPointIndexForFlags:drawPointFlags numberOfPoints:dataCount extremeNumIsLowerBound:NO]; - NSRange viewIndexRange = NSMakeRange( (NSUInteger)firstDrawnPointIndex, (NSUInteger)(lastDrawnPointIndex - firstDrawnPointIndex + 1) ); + NSRange viewIndexRange = NSMakeRange((NSUInteger)firstDrawnPointIndex, (NSUInteger)(lastDrawnPointIndex - firstDrawnPointIndex + 1)); CGPathRef dataLinePath = [self newDataLinePathForViewPoints:viewPoints indexRange:viewIndexRange baselineYValue:CPTNAN]; - CGPathRef path = CGPathCreateCopyByStrokingPath( dataLinePath, - NULL, - self.plotLineMarginForHitDetection * CPTFloat(2.0), - kCGLineCapRound, - kCGLineJoinRound, - CPTFloat(3.0) ); + CGPathRef path = CGPathCreateCopyByStrokingPath(dataLinePath, + NULL, + self.plotLineMarginForHitDetection * CPTFloat(2.0), + kCGLineCapRound, + kCGLineJoinRound, + CPTFloat(3.0)); CGPoint plotAreaPoint = [theGraph convertPoint:interactionPoint toLayer:thePlotArea]; @@ -2203,10 +2204,10 @@ -(void)setCurvedInterpolationOption:(CPTScatterPlotCurvedInterpolationOption)new -(void)setCurvedInterpolationCustomAlpha:(CGFloat)newCurvedInterpolationCustomAlpha { - if ( newCurvedInterpolationCustomAlpha > CPTFloat(1.0) ) { + if ( newCurvedInterpolationCustomAlpha > CPTFloat(1.0)) { newCurvedInterpolationCustomAlpha = CPTFloat(1.0); } - if ( newCurvedInterpolationCustomAlpha < CPTFloat(0.0) ) { + if ( newCurvedInterpolationCustomAlpha < CPTFloat(0.0)) { newCurvedInterpolationCustomAlpha = CPTFloat(0.0); } diff --git a/framework/Source/CPTScatterPlotTests.m b/framework/Source/CPTScatterPlotTests.m index 7372909d7..5cecafe5b 100644 --- a/framework/Source/CPTScatterPlotTests.m +++ b/framework/Source/CPTScatterPlotTests.m @@ -42,7 +42,7 @@ -(void)testCalculatePointsToDrawAllInRange { CPTNumberArray *inRangeValues = @[@0.1, @0.2, @0.15, @0.6, @0.9]; - BOOL *drawFlags = malloc(sizeof(BOOL) * inRangeValues.count); + BOOL *drawFlags = calloc(inRangeValues.count, sizeof(BOOL)); CPTXYPlotSpace *thePlotSpace = self.plotSpace; @@ -60,7 +60,7 @@ -(void)testCalculatePointsToDrawAllInRangeVisibleOnly { CPTNumberArray *inRangeValues = @[@0.1, @0.2, @0.15, @0.6, @0.9]; - BOOL *drawFlags = malloc(sizeof(BOOL) * inRangeValues.count); + BOOL *drawFlags = calloc(inRangeValues.count, sizeof(BOOL)); CPTXYPlotSpace *thePlotSpace = self.plotSpace; @@ -78,7 +78,7 @@ -(void)testCalculatePointsToDrawNoneInRange { CPTNumberArray *inRangeValues = @[@(-0.1), @(-0.2), @(-0.15), @(-0.6), @(-0.9)]; - BOOL *drawFlags = malloc(sizeof(BOOL) * inRangeValues.count); + BOOL *drawFlags = calloc(inRangeValues.count, sizeof(BOOL)); CPTXYPlotSpace *thePlotSpace = self.plotSpace; @@ -96,7 +96,7 @@ -(void)testCalculatePointsToDrawNoneInRangeVisibleOnly { CPTNumberArray *inRangeValues = @[@(-0.1), @(-0.2), @(-0.15), @(-0.6), @(-0.9)]; - BOOL *drawFlags = malloc(sizeof(BOOL) * inRangeValues.count); + BOOL *drawFlags = calloc(inRangeValues.count, sizeof(BOOL)); CPTXYPlotSpace *thePlotSpace = self.plotSpace; @@ -114,7 +114,7 @@ -(void)testCalculatePointsToDrawNoneInRangeDifferentRegions { CPTNumberArray *inRangeValues = @[@(-0.1), @2, @(-0.15), @3, @(-0.9)]; - BOOL *drawFlags = malloc(sizeof(BOOL) * inRangeValues.count); + BOOL *drawFlags = calloc(inRangeValues.count, sizeof(BOOL)); CPTXYPlotSpace *thePlotSpace = self.plotSpace; @@ -132,7 +132,7 @@ -(void)testCalculatePointsToDrawNoneInRangeDifferentRegionsVisibleOnly { CPTNumberArray *inRangeValues = @[@(-0.1), @2, @(-0.15), @3, @(-0.9)]; - BOOL *drawFlags = malloc(sizeof(BOOL) * inRangeValues.count); + BOOL *drawFlags = calloc(inRangeValues.count, sizeof(BOOL)); CPTXYPlotSpace *thePlotSpace = self.plotSpace; @@ -151,7 +151,7 @@ -(void)testCalculatePointsToDrawSomeInRange CPTNumberArray *inRangeValues = @[@(-0.1), @0.1, @0.2, @1.2, @1.5]; BOOL expected[5] = { YES, YES, YES, YES, NO }; - BOOL *drawFlags = malloc(sizeof(BOOL) * inRangeValues.count); + BOOL *drawFlags = calloc(inRangeValues.count, sizeof(BOOL)); CPTXYPlotSpace *thePlotSpace = self.plotSpace; @@ -173,7 +173,7 @@ -(void)testCalculatePointsToDrawSomeInRangeVisibleOnly { CPTNumberArray *inRangeValues = @[@(-0.1), @0.1, @0.2, @1.2, @1.5]; - BOOL *drawFlags = malloc(sizeof(BOOL) * inRangeValues.count); + BOOL *drawFlags = calloc(inRangeValues.count, sizeof(BOOL)); CPTXYPlotSpace *thePlotSpace = self.plotSpace; @@ -196,8 +196,8 @@ -(void)testCalculatePointsToDrawSomeInRangeCrossing { CPTNumberArray *inRangeValues = @[@(-0.1), @1.1, @0.9, @(-0.1), @(-0.2)]; - BOOL *drawFlags = malloc(sizeof(BOOL) * inRangeValues.count); - BOOL *expected = malloc(sizeof(BOOL) * inRangeValues.count); + BOOL *drawFlags = calloc(inRangeValues.count, sizeof(BOOL)); + BOOL *expected = calloc(inRangeValues.count, sizeof(BOOL)); for ( NSUInteger i = 0; i < inRangeValues.count - 1; i++ ) { expected[i] = YES; @@ -226,7 +226,7 @@ -(void)testCalculatePointsToDrawSomeInRangeCrossingVisibleOnly { CPTNumberArray *inRangeValues = @[@(-0.1), @1.1, @0.9, @(-0.1), @(-0.2)]; - BOOL *drawFlags = malloc(sizeof(BOOL) * inRangeValues.count); + BOOL *drawFlags = calloc(inRangeValues.count, sizeof(BOOL)); CPTXYPlotSpace *thePlotSpace = self.plotSpace; diff --git a/framework/Source/CPTShadow.m b/framework/Source/CPTShadow.m index bd26fc5bf..6204c3943 100644 --- a/framework/Source/CPTShadow.m +++ b/framework/Source/CPTShadow.m @@ -70,7 +70,7 @@ +(nonnull instancetype)shadow **/ -(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { shadowOffset = CGSizeZero; shadowBlurRadius = CPTFloat(0.0); shadowColor = nil; @@ -94,7 +94,7 @@ -(void)encodeWithCoder:(nonnull NSCoder *)coder -(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super init]) ) { + if ((self = [super init])) { shadowOffset = [coder decodeCPTSizeForKey:@"CPTShadow.shadowOffset"]; shadowBlurRadius = [coder decodeCGFloatForKey:@"CPTShadow.shadowBlurRadius"]; shadowColor = [coder decodeObjectOfClass:[CPTColor class] @@ -174,7 +174,7 @@ -(nonnull id)mutableCopyWithZone:(nullable NSZone *)zone -(void)setShadowBlurRadius:(CGFloat)newShadowBlurRadius { - NSParameterAssert( newShadowBlurRadius >= CPTFloat(0.0) ); + NSParameterAssert(newShadowBlurRadius >= CPTFloat(0.0)); if ( newShadowBlurRadius != shadowBlurRadius ) { shadowBlurRadius = newShadowBlurRadius; diff --git a/framework/Source/CPTTestCase.m b/framework/Source/CPTTestCase.m index 9ad27ca63..effe3adec 100644 --- a/framework/Source/CPTTestCase.m +++ b/framework/Source/CPTTestCase.m @@ -2,12 +2,12 @@ @implementation CPTTestCase --(id)archiveRoundTrip:(id)object +-(nullable id)archiveRoundTrip:(nonnull id)object { return [self archiveRoundTrip:object toClass:[object class]]; } --(nullable id)archiveRoundTrip:(nonnull id)object toClass:(Class)archiveClass +-(nullable id)archiveRoundTrip:(nonnull id)object toClass:(nonnull Class)archiveClass { const BOOL secure = ![archiveClass isSubclassOfClass:[NSNumberFormatter class]]; diff --git a/framework/Source/CPTTextLayer.m b/framework/Source/CPTTextLayer.m index f220ce7d9..45a208f31 100644 --- a/framework/Source/CPTTextLayer.m +++ b/framework/Source/CPTTextLayer.m @@ -71,7 +71,7 @@ @implementation CPTTextLayer **/ -(nonnull instancetype)initWithText:(nullable NSString *)newText style:(nullable CPTTextStyle *)newStyle { - if ( (self = [super initWithFrame:CGRectZero]) ) { + if ((self = [super initWithFrame:CGRectZero])) { textStyle = newStyle; text = [newText copy]; attributedText = nil; @@ -102,7 +102,7 @@ -(nonnull instancetype)initWithAttributedText:(nullable NSAttributedString *)new { CPTTextStyle *newStyle = [CPTTextStyle textStyleWithAttributes:[newText attributesAtIndex:0 effectiveRange:NULL]]; - if ( (self = [self initWithText:newText.string style:newStyle]) ) { + if ((self = [self initWithText:newText.string style:newStyle])) { attributedText = [newText copy]; [self sizeToFit]; @@ -115,7 +115,7 @@ -(nonnull instancetype)initWithAttributedText:(nullable NSAttributedString *)new -(nonnull instancetype)initWithLayer:(nonnull id)layer { - if ( (self = [super initWithLayer:layer]) ) { + if ((self = [super initWithLayer:layer])) { CPTTextLayer *theLayer = (CPTTextLayer *)layer; textStyle = theLayer->textStyle; @@ -141,7 +141,7 @@ -(nonnull instancetype)initWithLayer:(nonnull id)layer * @param newFrame The frame rectangle. * @return The initialized CPTTextLayer object. **/ --(nonnull instancetype)initWithFrame:(CGRect)newFrame +-(nonnull instancetype)initWithFrame:(CGRect __unused)newFrame { return [self initWithText:nil style:nil]; } @@ -167,7 +167,7 @@ -(void)encodeWithCoder:(nonnull NSCoder *)coder -(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super initWithCoder:coder]) ) { + if ((self = [super initWithCoder:coder])) { textStyle = [coder decodeObjectOfClass:[CPTTextStyle class] forKey:@"CPTTextLayer.textStyle"]; text = [[coder decodeObjectOfClass:[NSString class] @@ -255,7 +255,7 @@ -(void)setAttributedText:(nullable NSAttributedString *)newValue -(void)setMaximumSize:(CGSize)newSize { - if ( !CGSizeEqualToSize(maximumSize, newSize) ) { + if ( !CGSizeEqualToSize(maximumSize, newSize)) { maximumSize = newSize; [self sizeToFit]; } @@ -316,12 +316,8 @@ -(CGSize)sizeThatFits if ( myText.length > 0 ) { NSAttributedString *styledText = self.attributedText; - if ( (styledText.length > 0) && [styledText respondsToSelector:@selector(size)] ) { -#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE - textSize = styledText.size; -#else - textSize = NSSizeToCGSize(styledText.size); -#endif + if ( styledText.length > 0 ) { + textSize = [styledText sizeAsDrawn]; } else { textSize = [myText sizeWithTextStyle:self.textStyle]; @@ -351,10 +347,10 @@ -(void)sizeToFit newBounds.size.height += self.paddingTop + self.paddingBottom; CGSize myMaxSize = self.maximumSize; - if ( myMaxSize.width > CPTFloat(0.0) ) { + if ( myMaxSize.width > CPTFloat(0.0)) { newBounds.size.width = MIN(newBounds.size.width, myMaxSize.width); } - if ( myMaxSize.height > CPTFloat(0.0) ) { + if ( myMaxSize.height > CPTFloat(0.0)) { newBounds.size.height = MIN(newBounds.size.height, myMaxSize.height); } @@ -385,7 +381,7 @@ -(void)renderAsVectorInContext:(nonnull CGContextRef)context #if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE CGContextSaveGState(context); CGContextTranslateCTM(context, CPTFloat(0.0), self.bounds.size.height); - CGContextScaleCTM( context, CPTFloat(1.0), CPTFloat(-1.0) ); + CGContextScaleCTM(context, CPTFloat(1.0), CPTFloat(-1.0)); #endif CGRect newBounds = CGRectInset(self.bounds, kCPTTextLayerMarginWidth, kCPTTextLayerMarginWidth); @@ -399,7 +395,7 @@ -(void)renderAsVectorInContext:(nonnull CGContextRef)context newBounds.size.height -= self.paddingTop + self.paddingBottom; NSAttributedString *styledText = self.attributedText; - if ( (styledText.length > 0) && [styledText respondsToSelector:@selector(drawInRect:)] ) { + if ((styledText.length > 0) && [styledText respondsToSelector:@selector(drawInRect:)] ) { [styledText drawInRect:newBounds inContext:context]; } diff --git a/framework/Source/CPTTextStyle.h b/framework/Source/CPTTextStyle.h index b9163364c..df94cd374 100644 --- a/framework/Source/CPTTextStyle.h +++ b/framework/Source/CPTTextStyle.h @@ -1,4 +1,5 @@ #import "CPTDefinitions.h" +#import "CPTPlatformSpecificDefines.h" #import "CPTTextStylePlatformSpecific.h" @class CPTColor; @@ -16,6 +17,8 @@ typedef NSMutableArray CPTMutableTextStyleArray; @interface CPTTextStyle : NSObject +// font would override fontName/fontSize if not nil +@property (readonly, strong, nonatomic, nullable) CPTNativeFont *font; @property (readonly, copy, nonatomic, nullable) NSString *fontName; @property (readonly, nonatomic) CGFloat fontSize; @property (readonly, copy, nonatomic, nullable) CPTColor *color; diff --git a/framework/Source/CPTTextStyle.m b/framework/Source/CPTTextStyle.m index 3213df8f6..f1c5c4628 100644 --- a/framework/Source/CPTTextStyle.m +++ b/framework/Source/CPTTextStyle.m @@ -7,6 +7,8 @@ /// @cond @interface CPTTextStyle() +// font would override fontName/fontSize if not nil +@property (readwrite, strong, nonatomic, nullable) CPTNativeFont *font; @property (readwrite, copy, nonatomic, nullable) NSString *fontName; @property (readwrite, assign, nonatomic) CGFloat fontSize; @property (readwrite, copy, nonatomic, nullable) CPTColor *color; @@ -26,13 +28,20 @@ @interface CPTTextStyle() @implementation CPTTextStyle +/** @property CPTNativeFont* font + * @brief The font. Default is @nil. + * + * Font will override fontName and fontSize if not @nil. + **/ +@synthesize font; + /** @property CGFloat fontSize - * @brief The font size. Default is @num{12.0}. + * @brief The font size. Default is @num{12.0}. Ignored if font is not @nil. **/ @synthesize fontSize; /** @property nullable NSString *fontName - * @brief The font name. Default is Helvetica. + * @brief The font name. Default is Helvetica. Ignored if font is not @nil. **/ @synthesize fontName; @@ -73,6 +82,7 @@ +(nonnull instancetype)textStyleWithStyle:(nullable CPTTextStyle *)textStyle { CPTTextStyle *newTextStyle = [[self alloc] init]; + newTextStyle.font = textStyle.font; newTextStyle.color = textStyle.color; newTextStyle.fontName = textStyle.fontName; newTextStyle.fontSize = textStyle.fontSize; @@ -88,9 +98,10 @@ +(nonnull instancetype)textStyleWithStyle:(nullable CPTTextStyle *)textStyle /// @name Initialization /// @{ -/** @brief Initializes a newly allocated CPTAnnotation object. +/** @brief Initializes a newly allocated CPTTextStyle object. * * The initialized object will have the following properties: + * - @ref font = nil * - @ref fontName = Helvetica * - @ref fontSize = @num{12.0} * - @ref color = opaque black @@ -101,7 +112,8 @@ +(nonnull instancetype)textStyleWithStyle:(nullable CPTTextStyle *)textStyle **/ -(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { + font = nil; fontName = @"Helvetica"; fontSize = CPTFloat(12.0); color = [CPTColor blackColor]; @@ -120,6 +132,16 @@ -(nonnull instancetype)init -(void)encodeWithCoder:(nonnull NSCoder *)coder { +#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE || TARGET_OS_TV + if ( self.font ) { + // UIFont does not support NSCoding :( + [coder encodeObject:[self.font fontDescriptor] forKey:@"CPTTextStyle.font+descriptor"]; + } +#else + // NSFont supports NSCoding :) + [coder encodeObject:self.font forKey:@"CPTTextStyle.font"]; +#endif + [coder encodeObject:self.fontName forKey:@"CPTTextStyle.fontName"]; [coder encodeCGFloat:self.fontSize forKey:@"CPTTextStyle.fontSize"]; [coder encodeObject:self.color forKey:@"CPTTextStyle.color"]; @@ -129,7 +151,20 @@ -(void)encodeWithCoder:(nonnull NSCoder *)coder -(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super init]) ) { + if ((self = [super init])) { +#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE || TARGET_OS_TV + // UIFont does not support NSCoding :( + UIFontDescriptor *fontDescriptor = [coder decodeObjectOfClass:[UIFontDescriptor class] + forKey:@"CPTTextStyle.font+descriptor"]; + if ( fontDescriptor ) { + font = [UIFont fontWithDescriptor:fontDescriptor size:0]; // 0 will keep the same font size + } +#else + // NSFont supports NSCoding :) + font = [coder decodeObjectOfClass:[NSFont class] + forKey:@"CPTTextStyle.font"]; +#endif + fontName = [[coder decodeObjectOfClass:[NSString class] forKey:@"CPTTextStyle.fontName"] copy]; fontSize = [coder decodeCGFloatForKey:@"CPTTextStyle.fontSize"]; @@ -164,6 +199,7 @@ -(nonnull id)copyWithZone:(nullable NSZone *)zone { CPTTextStyle *newCopy = [[CPTTextStyle allocWithZone:zone] init]; + newCopy.font = self.font; newCopy.fontName = self.fontName; newCopy.color = self.color; newCopy.fontSize = self.fontSize; @@ -184,6 +220,7 @@ -(nonnull id)mutableCopyWithZone:(nullable NSZone *)zone { CPTTextStyle *newCopy = [[CPTMutableTextStyle allocWithZone:zone] init]; + newCopy.font = self.font; newCopy.fontName = self.fontName; newCopy.color = self.color; newCopy.fontSize = self.fontSize; diff --git a/framework/Source/CPTTheme.h b/framework/Source/CPTTheme.h index 705ef54ec..83cda6ef7 100644 --- a/framework/Source/CPTTheme.h +++ b/framework/Source/CPTTheme.h @@ -1,10 +1,17 @@ +#import "CPTDefinitions.h" + +/** + * @brief Theme name type. + **/ +typedef NSString *CPTThemeName cpt_swift_struct; + /// @ingroup themeNames /// @{ -extern NSString *__nonnull const kCPTDarkGradientTheme; ///< A graph theme with dark gray gradient backgrounds and light gray lines. -extern NSString *__nonnull const kCPTPlainBlackTheme; ///< A graph theme with black backgrounds and white lines. -extern NSString *__nonnull const kCPTPlainWhiteTheme; ///< A graph theme with white backgrounds and black lines. -extern NSString *__nonnull const kCPTSlateTheme; ///< A graph theme with colors that match the default iPhone navigation bar, toolbar buttons, and table views. -extern NSString *__nonnull const kCPTStocksTheme; ///< A graph theme with a gradient background and white lines. +extern CPTThemeName __nonnull const kCPTDarkGradientTheme; ///< A graph theme with dark gray gradient backgrounds and light gray lines. +extern CPTThemeName __nonnull const kCPTPlainBlackTheme; ///< A graph theme with black backgrounds and white lines. +extern CPTThemeName __nonnull const kCPTPlainWhiteTheme; ///< A graph theme with white backgrounds and black lines. +extern CPTThemeName __nonnull const kCPTSlateTheme; ///< A graph theme with colors that match the default iPhone navigation bar, toolbar buttons, and table views. +extern CPTThemeName __nonnull const kCPTStocksTheme; ///< A graph theme with a gradient background and white lines. /// @} @class CPTGraph; @@ -20,8 +27,8 @@ extern NSString *__nonnull const kCPTStocksTheme; ///< A graph theme with /// @{ +(void)registerTheme:(nonnull Class)themeClass; +(nullable NSArray *)themeClasses; -+(nullable instancetype)themeNamed:(nullable NSString *)themeName; -+(nonnull NSString *)name; ++(nullable instancetype)themeNamed:(nullable CPTThemeName)themeName; ++(nonnull CPTThemeName)name; /// @} /// @name Theme Usage diff --git a/framework/Source/CPTTheme.m b/framework/Source/CPTTheme.m index 350ffa90b..9d17a6e00 100644 --- a/framework/Source/CPTTheme.m +++ b/framework/Source/CPTTheme.m @@ -40,7 +40,7 @@ @implementation CPTTheme **/ -(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { graphClass = Nil; } return self; @@ -110,7 +110,7 @@ +(BOOL)supportsSecureCoding * @return A CPTTheme instance with name matching @par{themeName} or @nil if no themes with a matching name were found. * @see See @ref themeNames "Theme Names" for a list of named themes provided by Core Plot. **/ -+(nullable instancetype)themeNamed:(nullable NSString *)themeName ++(nullable instancetype)themeNamed:(nullable CPTThemeName)themeName { CPTTheme *newTheme = nil; @@ -131,8 +131,7 @@ +(void)registerTheme:(nonnull Class)themeClass { NSParameterAssert(themeClass); - @synchronized(self) - { + @synchronized ( self ) { if ( !themes ) { themes = [[NSMutableSet alloc] init]; } @@ -149,7 +148,7 @@ +(void)registerTheme:(nonnull Class)themeClass /** @brief The name used for this theme class. * @return The name. **/ -+(nonnull NSString *)name ++(nonnull CPTThemeName)name { return NSStringFromClass(self); } @@ -214,21 +213,21 @@ -(nullable id)newGraph /** @brief Applies the background theme to the provided graph. * @param graph The graph to style. **/ --(void)applyThemeToBackground:(nonnull CPTGraph *)graph +-(void)applyThemeToBackground:(nonnull CPTGraph *__unused)graph { } /** @brief Applies the theme to the provided plot area. * @param plotAreaFrame The plot area to style. **/ --(void)applyThemeToPlotArea:(nonnull CPTPlotAreaFrame *)plotAreaFrame +-(void)applyThemeToPlotArea:(nonnull CPTPlotAreaFrame *__unused)plotAreaFrame { } /** @brief Applies the theme to the provided axis set. * @param axisSet The axis set to style. **/ --(void)applyThemeToAxisSet:(nonnull CPTAxisSet *)axisSet +-(void)applyThemeToAxisSet:(nonnull CPTAxisSet *__unused)axisSet { } diff --git a/framework/Source/CPTThemeTests.m b/framework/Source/CPTThemeTests.m index 04486cebc..d0007cb38 100644 --- a/framework/Source/CPTThemeTests.m +++ b/framework/Source/CPTThemeTests.m @@ -1,13 +1,13 @@ #import "CPTThemeTests.h" -#import "CPTDerivedXYGraph.h" -#import "CPTExceptions.h" -#import "CPTTheme.h" #import "_CPTDarkGradientTheme.h" #import "_CPTPlainBlackTheme.h" #import "_CPTPlainWhiteTheme.h" #import "_CPTSlateTheme.h" #import "_CPTStocksTheme.h" +#import "CPTDerivedXYGraph.h" +#import "CPTExceptions.h" +#import "CPTTheme.h" @implementation CPTThemeTests diff --git a/framework/Source/CPTTimeFormatter.m b/framework/Source/CPTTimeFormatter.m index d35d6dc94..8d0ad4b51 100644 --- a/framework/Source/CPTTimeFormatter.m +++ b/framework/Source/CPTTimeFormatter.m @@ -49,7 +49,7 @@ -(nonnull instancetype)init **/ -(nonnull instancetype)initWithDateFormatter:(nullable NSDateFormatter *)aDateFormatter { - if ( (self = [super init]) ) { + if ((self = [super init])) { dateFormatter = aDateFormatter; referenceDate = nil; } @@ -77,7 +77,7 @@ -(void)encodeWithCoder:(nonnull NSCoder *)coder */ -(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super init]) ) { + if ((self = [super init])) { dateFormatter = [coder decodeObjectForKey:@"CPTTimeFormatter.dateFormatter"]; referenceDate = [[coder decodeObjectForKey:@"CPTTimeFormatter.referenceDate"] copy]; } @@ -116,7 +116,7 @@ -(nonnull id)copyWithZone:(nullable NSZone *)zone * @param coordinateValue The time value. * @return The date string. **/ --(nullable NSString *)stringForObjectValue:(nonnull id)coordinateValue +-(nullable NSString *)stringForObjectValue:(nullable id)coordinateValue { NSString *string = nil; diff --git a/framework/Source/CPTTradingRangePlot.h b/framework/Source/CPTTradingRangePlot.h index 513d8ccaf..b32085afe 100644 --- a/framework/Source/CPTTradingRangePlot.h +++ b/framework/Source/CPTTradingRangePlot.h @@ -7,18 +7,24 @@ @class CPTTradingRangePlot; +/** + * @brief Trading range plot bindings. + **/ +typedef NSString *CPTTradingRangePlotBinding cpt_swift_struct; + /// @ingroup plotBindingsTradingRangePlot /// @{ -extern NSString *__nonnull const CPTTradingRangePlotBindingXValues; -extern NSString *__nonnull const CPTTradingRangePlotBindingOpenValues; -extern NSString *__nonnull const CPTTradingRangePlotBindingHighValues; -extern NSString *__nonnull const CPTTradingRangePlotBindingLowValues; -extern NSString *__nonnull const CPTTradingRangePlotBindingCloseValues; -extern NSString *__nonnull const CPTTradingRangePlotBindingIncreaseFills; -extern NSString *__nonnull const CPTTradingRangePlotBindingDecreaseFills; -extern NSString *__nonnull const CPTTradingRangePlotBindingLineStyles; -extern NSString *__nonnull const CPTTradingRangePlotBindingIncreaseLineStyles; -extern NSString *__nonnull const CPTTradingRangePlotBindingDecreaseLineStyles; +extern CPTTradingRangePlotBinding __nonnull const CPTTradingRangePlotBindingXValues; +extern CPTTradingRangePlotBinding __nonnull const CPTTradingRangePlotBindingOpenValues; +extern CPTTradingRangePlotBinding __nonnull const CPTTradingRangePlotBindingHighValues; +extern CPTTradingRangePlotBinding __nonnull const CPTTradingRangePlotBindingLowValues; +extern CPTTradingRangePlotBinding __nonnull const CPTTradingRangePlotBindingCloseValues; +extern CPTTradingRangePlotBinding __nonnull const CPTTradingRangePlotBindingIncreaseFills; +extern CPTTradingRangePlotBinding __nonnull const CPTTradingRangePlotBindingDecreaseFills; +extern CPTTradingRangePlotBinding __nonnull const CPTTradingRangePlotBindingLineStyles; +extern CPTTradingRangePlotBinding __nonnull const CPTTradingRangePlotBindingIncreaseLineStyles; +extern CPTTradingRangePlotBinding __nonnull const CPTTradingRangePlotBindingDecreaseLineStyles; +extern CPTTradingRangePlotBinding __nonnull const CPTTradingRangePlotBindingBarWidths; /// @} /** @@ -86,6 +92,23 @@ typedef NS_ENUM (NSInteger, CPTTradingRangePlotField) { **/ -(nullable CPTFill *)decreaseFillForTradingRangePlot:(nonnull CPTTradingRangePlot *)plot recordIndex:(NSUInteger)idx; +/** @brief @optional Gets an array of bar widths for the given trading range plot. + * @param plot The trading range plot. + * @param indexRange The range of the data indexes of interest. + * @return An array of bar widths. + **/ +-(nullable CPTNumberArray *)barWidthsForTradingRangePlot:(nonnull CPTTradingRangePlot *)barPlot recordIndexRange:(NSRange)indexRange; + +/** @brief @optional Gets a bar width for the given trading range plot. + * This method will not be called if + * @link CPTTradingRangePlotDataSource::barWidthForTradingRangePlot:recordIndexRange: -barWidthForTradingRangePlot:recordIndexRange: @endlink + * is also implemented in the datasource. + * @param plot The tradingrange plot. + * @param idx The data index of interest. + * @return The bar width for the bar with the given index. If the data source returns @nil, the default barWidth is used. + **/ +-(nullable NSNumber *)barWidthForTradingRangePlot:(nonnull CPTTradingRangePlot *)plot recordIndex:(NSUInteger)idx; + /// @} /// @name Bar Line Styles @@ -256,6 +279,8 @@ typedef NS_ENUM (NSInteger, CPTTradingRangePlotField) { -(void)reloadBarFillsInIndexRange:(NSRange)indexRange; -(void)reloadBarLineStyles; -(void)reloadBarLineStylesInIndexRange:(NSRange)indexRange; +-(void)reloadBarWidths; +-(void)reloadBarWidthsInIndexRange:(NSRange)indexRange; /// @} @end diff --git a/framework/Source/CPTTradingRangePlot.m b/framework/Source/CPTTradingRangePlot.m index 99085ddcc..3589b2870 100644 --- a/framework/Source/CPTTradingRangePlot.m +++ b/framework/Source/CPTTradingRangePlot.m @@ -12,6 +12,7 @@ #import "CPTUtilities.h" #import "CPTXYPlotSpace.h" #import "NSCoderExtensions.h" +#import "NSNumberExtensions.h" #import "tgmath.h" /** @defgroup plotAnimationTradingRangePlot Trading Range Plot @@ -26,16 +27,17 @@ * @endif **/ -NSString *const CPTTradingRangePlotBindingXValues = @"xValues"; ///< X values. -NSString *const CPTTradingRangePlotBindingOpenValues = @"openValues"; ///< Open price values. -NSString *const CPTTradingRangePlotBindingHighValues = @"highValues"; ///< High price values. -NSString *const CPTTradingRangePlotBindingLowValues = @"lowValues"; ///< Low price values. -NSString *const CPTTradingRangePlotBindingCloseValues = @"closeValues"; ///< Close price values. -NSString *const CPTTradingRangePlotBindingIncreaseFills = @"increaseFills"; ///< Fills used with a candlestick plot when close >= open. -NSString *const CPTTradingRangePlotBindingDecreaseFills = @"decreaseFills"; ///< Fills used with a candlestick plot when close < open. -NSString *const CPTTradingRangePlotBindingLineStyles = @"lineStyles"; ///< Line styles used to draw candlestick or OHLC symbols. -NSString *const CPTTradingRangePlotBindingIncreaseLineStyles = @"increaseLineStyles"; ///< Line styles used to outline candlestick symbols when close >= open. -NSString *const CPTTradingRangePlotBindingDecreaseLineStyles = @"decreaseLineStyles"; ///< Line styles used to outline candlestick symbols when close < open. +CPTTradingRangePlotBinding const CPTTradingRangePlotBindingXValues = @"xValues"; ///< X values. +CPTTradingRangePlotBinding const CPTTradingRangePlotBindingOpenValues = @"openValues"; ///< Open price values. +CPTTradingRangePlotBinding const CPTTradingRangePlotBindingHighValues = @"highValues"; ///< High price values. +CPTTradingRangePlotBinding const CPTTradingRangePlotBindingLowValues = @"lowValues"; ///< Low price values. +CPTTradingRangePlotBinding const CPTTradingRangePlotBindingCloseValues = @"closeValues"; ///< Close price values. +CPTTradingRangePlotBinding const CPTTradingRangePlotBindingIncreaseFills = @"increaseFills"; ///< Fills used with a candlestick plot when close >= open. +CPTTradingRangePlotBinding const CPTTradingRangePlotBindingDecreaseFills = @"decreaseFills"; ///< Fills used with a candlestick plot when close < open. +CPTTradingRangePlotBinding const CPTTradingRangePlotBindingLineStyles = @"lineStyles"; ///< Line styles used to draw candlestick or OHLC symbols. +CPTTradingRangePlotBinding const CPTTradingRangePlotBindingIncreaseLineStyles = @"increaseLineStyles"; ///< Line styles used to outline candlestick symbols when close >= open. +CPTTradingRangePlotBinding const CPTTradingRangePlotBindingDecreaseLineStyles = @"decreaseLineStyles"; ///< Line styles used to outline candlestick symbols when close < open. +CPTTradingRangePlotBinding const CPTTradingRangePlotBindingBarWidths = @"barWidths"; ///< Bar widths. static const CPTCoordinate independentCoord = CPTCoordinateX; static const CPTCoordinate dependentCoord = CPTCoordinateY; @@ -53,9 +55,10 @@ @interface CPTTradingRangePlot() @property (nonatomic, readwrite, copy, nullable) CPTLineStyleArray *lineStyles; @property (nonatomic, readwrite, copy, nullable) CPTLineStyleArray *increaseLineStyles; @property (nonatomic, readwrite, copy, nullable) CPTLineStyleArray *decreaseLineStyles; +@property (nonatomic, readwrite, copy, nullable) CPTLineStyleArray *barWidths; @property (nonatomic, readwrite, assign) NSUInteger pointingDeviceDownIndex; --(void)drawCandleStickInContext:(nonnull CGContextRef)context atIndex:(NSUInteger)idx x:(CGFloat)x open:(CGFloat)openValue close:(CGFloat)closeValue high:(CGFloat)highValue low:(CGFloat)lowValue alignPoints:(BOOL)alignPoints; +-(void)drawCandleStickInContext:(nonnull CGContextRef)context atIndex:(NSUInteger)idx x:(CGFloat)x open:(CGFloat)openValue close:(CGFloat)closeValue high:(CGFloat)highValue low:(CGFloat)lowValue width:(CGFloat)width alignPoints:(BOOL)alignPoints; -(void)drawOHLCInContext:(nonnull CGContextRef)context atIndex:(NSUInteger)idx x:(CGFloat)x open:(CGFloat)openValue close:(CGFloat)closeValue high:(CGFloat)highValue low:(CGFloat)lowValue alignPoints:(BOOL)alignPoints; -(nullable CPTFill *)increaseFillForIndex:(NSUInteger)idx; @@ -65,6 +68,8 @@ -(nullable CPTLineStyle *)lineStyleForIndex:(NSUInteger)idx; -(nullable CPTLineStyle *)increaseLineStyleForIndex:(NSUInteger)idx; -(nullable CPTLineStyle *)decreaseLineStyleForIndex:(NSUInteger)idx; +-(nonnull NSNumber *)barWidthForIndex:(NSUInteger)idx; + @end /// @endcond @@ -90,6 +95,7 @@ @implementation CPTTradingRangePlot @dynamic lineStyles; @dynamic increaseLineStyles; @dynamic decreaseLineStyles; +@dynamic barWidths; /** @property nullable CPTLineStyle *lineStyle * @brief The line style used to draw candlestick or OHLC symbols. @@ -174,8 +180,10 @@ +(void)initialize [self exposeBinding:CPTTradingRangePlotBindingLineStyles]; [self exposeBinding:CPTTradingRangePlotBindingIncreaseLineStyles]; [self exposeBinding:CPTTradingRangePlotBindingDecreaseLineStyles]; + [self exposeBinding:CPTTradingRangePlotBindingBarWidths]; } } + #endif /// @endcond @@ -203,7 +211,7 @@ +(void)initialize **/ -(nonnull instancetype)initWithFrame:(CGRect)newFrame { - if ( (self = [super initWithFrame:newFrame]) ) { + if ((self = [super initWithFrame:newFrame])) { plotStyle = CPTTradingRangePlotStyleOHLC; lineStyle = [[CPTLineStyle alloc] init]; increaseLineStyle = nil; @@ -228,7 +236,7 @@ -(nonnull instancetype)initWithFrame:(CGRect)newFrame -(nonnull instancetype)initWithLayer:(nonnull id)layer { - if ( (self = [super initWithLayer:layer]) ) { + if ((self = [super initWithLayer:layer])) { CPTTradingRangePlot *theLayer = (CPTTradingRangePlot *)layer; plotStyle = theLayer->plotStyle; @@ -275,7 +283,7 @@ -(void)encodeWithCoder:(nonnull NSCoder *)coder -(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super initWithCoder:coder]) ) { + if ((self = [super initWithCoder:coder])) { lineStyle = [[coder decodeObjectOfClass:[CPTLineStyle class] forKey:@"CPTTradingRangePlot.lineStyle"] copy]; increaseLineStyle = [[coder decodeObjectOfClass:[CPTLineStyle class] @@ -325,6 +333,9 @@ -(void)reloadDataInIndexRange:(NSRange)indexRange // Line styles [self reloadBarLineStylesInIndexRange:indexRange]; + + // Bar widths + [self reloadBarWidthsInIndexRange:indexRange]; } -(void)reloadPlotDataInIndexRange:(NSRange)indexRange @@ -548,6 +559,49 @@ -(void)reloadBarLineStylesInIndexRange:(NSRange)indexRange [self setNeedsDisplay]; } +/** + * @brief Reload all bar widths from the data source immediately. + **/ +-(void)reloadBarWidths +{ + [self reloadBarWidthsInIndexRange:NSMakeRange(0, self.cachedDataCount)]; +} + +/** @brief Reload bar widths in the given index range from the data source immediately. + * @param indexRange The index range to load. + **/ +-(void)reloadBarWidthsInIndexRange:(NSRange)indexRange +{ + id theDataSource = (id)self.dataSource; + + if ( [theDataSource respondsToSelector:@selector(barWidthsForTradingRangePlot:recordIndexRange:)] ) { + [self cacheArray:[theDataSource barWidthsForTradingRangePlot:self recordIndexRange:indexRange] + forKey:CPTTradingRangePlotBindingBarWidths + atRecordIndex:indexRange.location]; + } + else if ( [theDataSource respondsToSelector:@selector(barWidthForTradingRangePlot:recordIndex:)] ) { + id nilObject = [CPTPlot nilData]; + CPTMutableNumberArray *array = [[NSMutableArray alloc] initWithCapacity:indexRange.length]; + NSUInteger maxIndex = NSMaxRange(indexRange); + + for ( NSUInteger idx = indexRange.location; idx < maxIndex; idx++ ) { + NSNumber *width = [theDataSource barWidthForTradingRangePlot:self recordIndex:idx]; + if ( width ) { + [array addObject:width]; + } + else { + [array addObject:nilObject]; + } + } + + [self cacheArray:array + forKey:CPTTradingRangePlotBindingBarWidths + atRecordIndex:indexRange.location]; + } + + [self setNeedsDisplay]; +} + #pragma mark - #pragma mark Drawing @@ -569,11 +623,11 @@ -(void)renderAsVectorInContext:(nonnull CGContextRef)context if ( sampleCount == 0 ) { return; } - if ( (opens == nil) || (highs == nil) || (lows == nil) || (closes == nil) ) { + if ((opens == nil) || (highs == nil) || (lows == nil) || (closes == nil)) { return; } - if ( (opens.numberOfSamples != sampleCount) || (highs.numberOfSamples != sampleCount) || (lows.numberOfSamples != sampleCount) || (closes.numberOfSamples != sampleCount) ) { + if ((opens.numberOfSamples != sampleCount) || (highs.numberOfSamples != sampleCount) || (lows.numberOfSamples != sampleCount) || (closes.numberOfSamples != sampleCount)) { [NSException raise:CPTException format:@"Mismatching number of data values in trading range plot"]; } @@ -597,7 +651,7 @@ -(void)renderAsVectorInContext:(nonnull CGContextRef)context for ( NSUInteger i = 0; i < sampleCount; i++ ) { double plotPoint[2]; plotPoint[independentCoord] = *locationBytes++; - if ( isnan(plotPoint[independentCoord]) ) { + if ( isnan(plotPoint[independentCoord])) { openBytes++; highBytes++; lowBytes++; @@ -607,7 +661,7 @@ -(void)renderAsVectorInContext:(nonnull CGContextRef)context // open point plotPoint[dependentCoord] = *openBytes++; - if ( isnan(plotPoint[dependentCoord]) ) { + if ( isnan(plotPoint[dependentCoord])) { openPoint = CPTPointMake(NAN, NAN); } else { @@ -616,7 +670,7 @@ -(void)renderAsVectorInContext:(nonnull CGContextRef)context // high point plotPoint[dependentCoord] = *highBytes++; - if ( isnan(plotPoint[dependentCoord]) ) { + if ( isnan(plotPoint[dependentCoord])) { highPoint = CPTPointMake(NAN, NAN); } else { @@ -625,7 +679,7 @@ -(void)renderAsVectorInContext:(nonnull CGContextRef)context // low point plotPoint[dependentCoord] = *lowBytes++; - if ( isnan(plotPoint[dependentCoord]) ) { + if ( isnan(plotPoint[dependentCoord])) { lowPoint = CPTPointMake(NAN, NAN); } else { @@ -634,7 +688,7 @@ -(void)renderAsVectorInContext:(nonnull CGContextRef)context // close point plotPoint[dependentCoord] = *closeBytes++; - if ( isnan(plotPoint[dependentCoord]) ) { + if ( isnan(plotPoint[dependentCoord])) { closePoint = CPTPointMake(NAN, NAN); } else { @@ -642,17 +696,17 @@ -(void)renderAsVectorInContext:(nonnull CGContextRef)context } CGFloat xCoord = openPoint.x; - if ( isnan(xCoord) ) { + if ( isnan(xCoord)) { xCoord = highPoint.x; } - else if ( isnan(xCoord) ) { + else if ( isnan(xCoord)) { xCoord = lowPoint.x; } - else if ( isnan(xCoord) ) { + else if ( isnan(xCoord)) { xCoord = closePoint.x; } - if ( !isnan(xCoord) ) { + if ( !isnan(xCoord)) { // Draw switch ( thePlotStyle ) { case CPTTradingRangePlotStyleOHLC: @@ -674,6 +728,7 @@ -(void)renderAsVectorInContext:(nonnull CGContextRef)context close:closePoint.y high:highPoint.y low:lowPoint.y + width:[self barWidthForIndex:i].cgFloatValue alignPoints:alignPoints]; break; } @@ -690,7 +745,7 @@ -(void)renderAsVectorInContext:(nonnull CGContextRef)context for ( NSUInteger i = 0; i < sampleCount; i++ ) { NSDecimal plotPoint[2]; plotPoint[independentCoord] = *locationBytes++; - if ( NSDecimalIsNotANumber(&plotPoint[independentCoord]) ) { + if ( NSDecimalIsNotANumber(&plotPoint[independentCoord])) { openBytes++; highBytes++; lowBytes++; @@ -700,7 +755,7 @@ -(void)renderAsVectorInContext:(nonnull CGContextRef)context // open point plotPoint[dependentCoord] = *openBytes++; - if ( NSDecimalIsNotANumber(&plotPoint[dependentCoord]) ) { + if ( NSDecimalIsNotANumber(&plotPoint[dependentCoord])) { openPoint = CPTPointMake(NAN, NAN); } else { @@ -709,7 +764,7 @@ -(void)renderAsVectorInContext:(nonnull CGContextRef)context // high point plotPoint[dependentCoord] = *highBytes++; - if ( NSDecimalIsNotANumber(&plotPoint[dependentCoord]) ) { + if ( NSDecimalIsNotANumber(&plotPoint[dependentCoord])) { highPoint = CPTPointMake(NAN, NAN); } else { @@ -718,7 +773,7 @@ -(void)renderAsVectorInContext:(nonnull CGContextRef)context // low point plotPoint[dependentCoord] = *lowBytes++; - if ( NSDecimalIsNotANumber(&plotPoint[dependentCoord]) ) { + if ( NSDecimalIsNotANumber(&plotPoint[dependentCoord])) { lowPoint = CPTPointMake(NAN, NAN); } else { @@ -727,7 +782,7 @@ -(void)renderAsVectorInContext:(nonnull CGContextRef)context // close point plotPoint[dependentCoord] = *closeBytes++; - if ( NSDecimalIsNotANumber(&plotPoint[dependentCoord]) ) { + if ( NSDecimalIsNotANumber(&plotPoint[dependentCoord])) { closePoint = CPTPointMake(NAN, NAN); } else { @@ -735,17 +790,17 @@ -(void)renderAsVectorInContext:(nonnull CGContextRef)context } CGFloat xCoord = openPoint.x; - if ( isnan(xCoord) ) { + if ( isnan(xCoord)) { xCoord = highPoint.x; } - else if ( isnan(xCoord) ) { + else if ( isnan(xCoord)) { xCoord = lowPoint.x; } - else if ( isnan(xCoord) ) { + else if ( isnan(xCoord)) { xCoord = closePoint.x; } - if ( !isnan(xCoord) ) { + if ( !isnan(xCoord)) { // Draw switch ( thePlotStyle ) { case CPTTradingRangePlotStyleOHLC: @@ -767,6 +822,7 @@ -(void)renderAsVectorInContext:(nonnull CGContextRef)context close:closePoint.y high:highPoint.y low:lowPoint.y + width:[self barWidthForIndex:i].cgFloatValue alignPoints:alignPoints]; break; } @@ -784,13 +840,15 @@ -(void)drawCandleStickInContext:(nonnull CGContextRef)context close:(CGFloat)closeValue high:(CGFloat)highValue low:(CGFloat)lowValue + width:(CGFloat)width alignPoints:(BOOL)alignPoints { - const CGFloat halfBarWidth = CPTFloat(0.5) * self.barWidth; + const CGFloat halfBarWidth = CPTFloat(0.5) * width; + CPTFill *currentBarFill = nil; CPTLineStyle *theBorderLineStyle = nil; - if ( !isnan(openValue) && !isnan(closeValue) ) { + if ( !isnan(openValue) && !isnan(closeValue)) { if ( openValue < closeValue ) { theBorderLineStyle = [self increaseLineStyleForIndex:idx]; currentBarFill = [self increaseFillForIndex:idx]; @@ -815,13 +873,13 @@ -(void)drawCandleStickInContext:(nonnull CGContextRef)context [theBorderLineStyle setLineStyleInContext:context]; CGFloat lineWidth = theBorderLineStyle.lineWidth; - if ( ( self.contentsScale > CPTFloat(1.0) ) && (round(lineWidth) == lineWidth) ) { + if ((self.contentsScale > CPTFloat(1.0)) && (round(lineWidth) == lineWidth)) { alignmentFunction = CPTAlignIntegralPointToUserSpace; } } // high - low only - if ( hasLineStyle && !isnan(highValue) && !isnan(lowValue) && ( isnan(openValue) || isnan(closeValue) ) ) { + if ( hasLineStyle && !isnan(highValue) && !isnan(lowValue) && (isnan(openValue) || isnan(closeValue))) { CGPoint alignedHighPoint = CPTPointMake(x, highValue); CGPoint alignedLowPoint = CPTPointMake(x, lowValue); if ( alignPoints ) { @@ -841,10 +899,10 @@ -(void)drawCandleStickInContext:(nonnull CGContextRef)context } // open-close - if ( !isnan(openValue) && !isnan(closeValue) ) { + if ( !isnan(openValue) && !isnan(closeValue)) { if ( currentBarFill || hasLineStyle ) { CGFloat radius = MIN(self.barCornerRadius, halfBarWidth); - radius = MIN( radius, ABS(closeValue - openValue) ); + radius = MIN(radius, ABS(closeValue - openValue)); CGPoint alignedPoint1 = CPTPointMake(x + halfBarWidth, openValue); CGPoint alignedPoint2 = CPTPointMake(x + halfBarWidth, closeValue); @@ -868,7 +926,7 @@ -(void)drawCandleStickInContext:(nonnull CGContextRef)context } } - if ( hasLineStyle && (openValue == closeValue) ) { + if ( hasLineStyle && (openValue == closeValue)) { // #285 Draw a cross with open/close values marked const CGFloat halfLineWidth = CPTFloat(0.5) * theBorderLineStyle.lineWidth; @@ -898,9 +956,9 @@ -(void)drawCandleStickInContext:(nonnull CGContextRef)context path = CGPathCreateMutable(); } - if ( !isnan(lowValue) ) { - if ( lowValue < MIN(openValue, closeValue) ) { - CGPoint alignedStartPoint = CPTPointMake( x, MIN(openValue, closeValue) ); + if ( !isnan(lowValue)) { + if ( lowValue < MIN(openValue, closeValue)) { + CGPoint alignedStartPoint = CPTPointMake(x, MIN(openValue, closeValue)); CGPoint alignedLowPoint = CPTPointMake(x, lowValue); if ( alignPoints ) { alignedStartPoint = alignmentFunction(context, alignedStartPoint); @@ -911,9 +969,9 @@ -(void)drawCandleStickInContext:(nonnull CGContextRef)context CGPathAddLineToPoint(path, NULL, alignedLowPoint.x, alignedLowPoint.y); } } - if ( !isnan(highValue) ) { - if ( highValue > MAX(openValue, closeValue) ) { - CGPoint alignedStartPoint = CPTPointMake( x, MAX(openValue, closeValue) ); + if ( !isnan(highValue)) { + if ( highValue > MAX(openValue, closeValue)) { + CGPoint alignedStartPoint = CPTPointMake(x, MAX(openValue, closeValue)); CGPoint alignedHighPoint = CPTPointMake(x, highValue); if ( alignPoints ) { alignedStartPoint = alignmentFunction(context, alignedStartPoint); @@ -945,7 +1003,7 @@ -(void)drawOHLCInContext:(nonnull CGContextRef)context { CPTLineStyle *theLineStyle = [self lineStyleForIndex:idx]; - if ( !isnan(openValue) && !isnan(closeValue) ) { + if ( !isnan(openValue) && !isnan(closeValue)) { if ( openValue < closeValue ) { CPTLineStyle *lineStyleForIncrease = [self increaseLineStyleForIndex:idx]; if ( [lineStyleForIncrease isKindOfClass:[CPTLineStyle class]] ) { @@ -967,12 +1025,12 @@ -(void)drawOHLCInContext:(nonnull CGContextRef)context CPTAlignPointFunction alignmentFunction = CPTAlignPointToUserSpace; CGFloat lineWidth = theLineStyle.lineWidth; - if ( ( self.contentsScale > CPTFloat(1.0) ) && (round(lineWidth) == lineWidth) ) { + if ((self.contentsScale > CPTFloat(1.0)) && (round(lineWidth) == lineWidth)) { alignmentFunction = CPTAlignIntegralPointToUserSpace; } // high-low - if ( !isnan(highValue) && !isnan(lowValue) ) { + if ( !isnan(highValue) && !isnan(lowValue)) { CGPoint alignedHighPoint = CPTPointMake(x, highValue); CGPoint alignedLowPoint = CPTPointMake(x, lowValue); if ( alignPoints ) { @@ -984,7 +1042,7 @@ -(void)drawOHLCInContext:(nonnull CGContextRef)context } // open - if ( !isnan(openValue) ) { + if ( !isnan(openValue)) { CGPoint alignedOpenStartPoint = CPTPointMake(x, openValue); CGPoint alignedOpenEndPoint = CPTPointMake(x - theStickLength, openValue); // left side if ( alignPoints ) { @@ -996,7 +1054,7 @@ -(void)drawOHLCInContext:(nonnull CGContextRef)context } // close - if ( !isnan(closeValue) ) { + if ( !isnan(closeValue)) { CGPoint alignedCloseStartPoint = CPTPointMake(x, closeValue); CGPoint alignedCloseEndPoint = CPTPointMake(x + theStickLength, closeValue); // right side if ( alignPoints ) { @@ -1025,7 +1083,7 @@ -(void)drawSwatchForLegend:(nonnull CPTLegend *)legend atIndex:(NSUInteger)idx i switch ( self.plotStyle ) { case CPTTradingRangePlotStyleOHLC: [self drawOHLCInContext:context - atIndex:idx + atIndex:0 x:CGRectGetMidX(rect) open:CGRectGetMinY(rect) + rect.size.height / CPTFloat(3.0) close:CGRectGetMinY(rect) + rect.size.height * (CGFloat)(2.0 / 3.0) @@ -1036,12 +1094,13 @@ -(void)drawSwatchForLegend:(nonnull CPTLegend *)legend atIndex:(NSUInteger)idx i case CPTTradingRangePlotStyleCandleStick: [self drawCandleStickInContext:context - atIndex:idx + atIndex:0 x:CGRectGetMidX(rect) open:CGRectGetMinY(rect) + rect.size.height / CPTFloat(3.0) close:CGRectGetMinY(rect) + rect.size.height * (CGFloat)(2.0 / 3.0) high:CGRectGetMaxY(rect) low:CGRectGetMinY(rect) + width:rect.size.width * CPTFloat(0.8) alignPoints:YES]; break; } @@ -1052,7 +1111,7 @@ -(nullable CPTFill *)increaseFillForIndex:(NSUInteger)idx { CPTFill *theFill = [self cachedValueForKey:CPTTradingRangePlotBindingIncreaseFills recordIndex:idx]; - if ( (theFill == nil) || (theFill == [CPTPlot nilData]) ) { + if ((theFill == nil) || (theFill == [CPTPlot nilData])) { theFill = self.increaseFill; } @@ -1063,7 +1122,7 @@ -(nullable CPTFill *)decreaseFillForIndex:(NSUInteger)idx { CPTFill *theFill = [self cachedValueForKey:CPTTradingRangePlotBindingDecreaseFills recordIndex:idx]; - if ( (theFill == nil) || (theFill == [CPTPlot nilData]) ) { + if ((theFill == nil) || (theFill == [CPTPlot nilData])) { theFill = self.decreaseFill; } @@ -1074,7 +1133,7 @@ -(nullable CPTLineStyle *)lineStyleForIndex:(NSUInteger)idx { CPTLineStyle *theLineStyle = [self cachedValueForKey:CPTTradingRangePlotBindingLineStyles recordIndex:idx]; - if ( (theLineStyle == nil) || (theLineStyle == [CPTPlot nilData]) ) { + if ((theLineStyle == nil) || (theLineStyle == [CPTPlot nilData])) { theLineStyle = self.lineStyle; } @@ -1085,7 +1144,7 @@ -(nullable CPTLineStyle *)increaseLineStyleForIndex:(NSUInteger)idx { CPTLineStyle *theLineStyle = [self cachedValueForKey:CPTTradingRangePlotBindingIncreaseLineStyles recordIndex:idx]; - if ( (theLineStyle == nil) || (theLineStyle == [CPTPlot nilData]) ) { + if ((theLineStyle == nil) || (theLineStyle == [CPTPlot nilData])) { theLineStyle = self.increaseLineStyle; } @@ -1100,7 +1159,7 @@ -(nullable CPTLineStyle *)decreaseLineStyleForIndex:(NSUInteger)idx { CPTLineStyle *theLineStyle = [self cachedValueForKey:CPTTradingRangePlotBindingDecreaseLineStyles recordIndex:idx]; - if ( (theLineStyle == nil) || (theLineStyle == [CPTPlot nilData]) ) { + if ((theLineStyle == nil) || (theLineStyle == [CPTPlot nilData])) { theLineStyle = self.decreaseLineStyle; } @@ -1111,6 +1170,17 @@ -(nullable CPTLineStyle *)decreaseLineStyleForIndex:(NSUInteger)idx return theLineStyle; } +-(nonnull NSNumber *)barWidthForIndex:(NSUInteger)idx +{ + NSNumber *theBarWidth = [self cachedValueForKey:CPTTradingRangePlotBindingBarWidths recordIndex:idx]; + + if ((theBarWidth == nil) || (theBarWidth == [CPTPlot nilData])) { + theBarWidth = @(self.barWidth); + } + + return theBarWidth; +} + /// @endcond #pragma mark - @@ -1166,14 +1236,14 @@ -(nonnull CPTNumberArray *)fieldIdentifiersForCoordinate:(CPTCoordinate)coord switch ( coord ) { case CPTCoordinateX: result = @[@(CPTTradingRangePlotFieldX)]; - break; + break; case CPTCoordinateY: result = @[@(CPTTradingRangePlotFieldOpen), @(CPTTradingRangePlotFieldLow), @(CPTTradingRangePlotFieldHigh), @(CPTTradingRangePlotFieldClose)]; - break; + break; default: [NSException raise:CPTException format:@"Invalid coordinate passed to fieldIdentifiersForCoordinate:"]; @@ -1217,16 +1287,21 @@ -(void)positionLabelAnnotation:(nonnull CPTPlotSpaceAnnotation *)label forIndex: BOOL positiveDirection = YES; CPTPlotRange *yRange = [self.plotSpace plotRangeForCoordinate:CPTCoordinateY]; - if ( CPTDecimalLessThan( yRange.lengthDecimal, CPTDecimalFromInteger(0) ) ) { + if ( CPTDecimalLessThan(yRange.lengthDecimal, CPTDecimalFromInteger(0))) { positiveDirection = !positiveDirection; } - NSNumber *xValue = [self cachedNumberForField:CPTTradingRangePlotFieldX recordIndex:idx]; + NSNumber *xValue = [self cachedNumberForField:CPTTradingRangePlotFieldX recordIndex:idx]; + NSNumber *openValue = [self cachedNumberForField:CPTTradingRangePlotFieldOpen recordIndex:idx]; + NSNumber *closeValue = [self cachedNumberForField:CPTTradingRangePlotFieldClose recordIndex:idx]; + NSNumber *highValue = [self cachedNumberForField:CPTTradingRangePlotFieldHigh recordIndex:idx]; + NSNumber *lowValue = [self cachedNumberForField:CPTTradingRangePlotFieldLow recordIndex:idx]; + NSNumber *yValue; - CPTNumberArray *yValues = @[[self cachedNumberForField:CPTTradingRangePlotFieldOpen recordIndex:idx], - [self cachedNumberForField:CPTTradingRangePlotFieldClose recordIndex:idx], - [self cachedNumberForField:CPTTradingRangePlotFieldHigh recordIndex:idx], - [self cachedNumberForField:CPTTradingRangePlotFieldLow recordIndex:idx]]; + CPTNumberArray *yValues = @[openValue, + closeValue, + highValue, + lowValue]; CPTNumberArray *yValuesSorted = [yValues sortedArrayUsingSelector:@selector(compare:)]; if ( positiveDirection ) { yValue = yValuesSorted.lastObject; @@ -1301,7 +1376,7 @@ -(NSUInteger)dataIndexFromInteractionPoint:(CGPoint)point if ( !isnan(plotPoint[dependentCoord]) && [yRange containsDouble:plotPoint[dependentCoord]] ) { openPoint = [thePlotSpace plotAreaViewPointForDoublePrecisionPlotPoint:plotPoint numberOfCoordinates:2]; CGFloat distanceSquared = squareOfDistanceBetweenPoints(point, openPoint); - if ( isnan(minimumDistanceSquared) || (distanceSquared < minimumDistanceSquared) ) { + if ( isnan(minimumDistanceSquared) || (distanceSquared < minimumDistanceSquared)) { minimumDistanceSquared = distanceSquared; result = i; } @@ -1315,7 +1390,7 @@ -(NSUInteger)dataIndexFromInteractionPoint:(CGPoint)point if ( !isnan(plotPoint[dependentCoord]) && [yRange containsDouble:plotPoint[dependentCoord]] ) { highPoint = [thePlotSpace plotAreaViewPointForDoublePrecisionPlotPoint:plotPoint numberOfCoordinates:2]; CGFloat distanceSquared = squareOfDistanceBetweenPoints(point, highPoint); - if ( isnan(minimumDistanceSquared) || (distanceSquared < minimumDistanceSquared) ) { + if ( isnan(minimumDistanceSquared) || (distanceSquared < minimumDistanceSquared)) { minimumDistanceSquared = distanceSquared; result = i; } @@ -1329,7 +1404,7 @@ -(NSUInteger)dataIndexFromInteractionPoint:(CGPoint)point if ( !isnan(plotPoint[dependentCoord]) && [yRange containsDouble:plotPoint[dependentCoord]] ) { lowPoint = [thePlotSpace plotAreaViewPointForDoublePrecisionPlotPoint:plotPoint numberOfCoordinates:2]; CGFloat distanceSquared = squareOfDistanceBetweenPoints(point, lowPoint); - if ( isnan(minimumDistanceSquared) || (distanceSquared < minimumDistanceSquared) ) { + if ( isnan(minimumDistanceSquared) || (distanceSquared < minimumDistanceSquared)) { minimumDistanceSquared = distanceSquared; result = i; } @@ -1343,7 +1418,7 @@ -(NSUInteger)dataIndexFromInteractionPoint:(CGPoint)point if ( !isnan(plotPoint[dependentCoord]) && [yRange containsDouble:plotPoint[dependentCoord]] ) { closePoint = [thePlotSpace plotAreaViewPointForDoublePrecisionPlotPoint:plotPoint numberOfCoordinates:2]; CGFloat distanceSquared = squareOfDistanceBetweenPoints(point, closePoint); - if ( isnan(minimumDistanceSquared) || (distanceSquared < minimumDistanceSquared) ) { + if ( isnan(minimumDistanceSquared) || (distanceSquared < minimumDistanceSquared)) { minimumDistanceSquared = distanceSquared; result = i; } @@ -1354,18 +1429,18 @@ -(NSUInteger)dataIndexFromInteractionPoint:(CGPoint)point if ( result == i ) { lastViewX = openPoint.x; - if ( isnan(lastViewX) ) { + if ( isnan(lastViewX)) { lastViewX = highPoint.x; } - else if ( isnan(lastViewX) ) { + else if ( isnan(lastViewX)) { lastViewX = lowPoint.x; } - else if ( isnan(lastViewX) ) { + else if ( isnan(lastViewX)) { lastViewX = closePoint.x; } - lastViewMin = MIN( MIN(openPoint.y, closePoint.y), MIN(highPoint.y, lowPoint.y) ); - lastViewMax = MAX( MAX(openPoint.y, closePoint.y), MAX(highPoint.y, lowPoint.y) ); + lastViewMin = MIN(MIN(openPoint.y, closePoint.y), MIN(highPoint.y, lowPoint.y)); + lastViewMax = MAX(MAX(openPoint.y, closePoint.y), MAX(highPoint.y, lowPoint.y)); } } } @@ -1394,7 +1469,7 @@ -(NSUInteger)dataIndexFromInteractionPoint:(CGPoint)point if ( !NSDecimalIsNotANumber(&plotPoint[dependentCoord]) && [yRange contains:plotPoint[dependentCoord]] ) { openPoint = [thePlotSpace plotAreaViewPointForPlotPoint:plotPoint numberOfCoordinates:2]; CGFloat distanceSquared = squareOfDistanceBetweenPoints(point, openPoint); - if ( isnan(minimumDistanceSquared) || (distanceSquared < minimumDistanceSquared) ) { + if ( isnan(minimumDistanceSquared) || (distanceSquared < minimumDistanceSquared)) { minimumDistanceSquared = distanceSquared; result = i; } @@ -1408,7 +1483,7 @@ -(NSUInteger)dataIndexFromInteractionPoint:(CGPoint)point if ( !NSDecimalIsNotANumber(&plotPoint[dependentCoord]) && [yRange contains:plotPoint[dependentCoord]] ) { highPoint = [thePlotSpace plotAreaViewPointForPlotPoint:plotPoint numberOfCoordinates:2]; CGFloat distanceSquared = squareOfDistanceBetweenPoints(point, highPoint); - if ( isnan(minimumDistanceSquared) || (distanceSquared < minimumDistanceSquared) ) { + if ( isnan(minimumDistanceSquared) || (distanceSquared < minimumDistanceSquared)) { minimumDistanceSquared = distanceSquared; result = i; } @@ -1422,7 +1497,7 @@ -(NSUInteger)dataIndexFromInteractionPoint:(CGPoint)point if ( !NSDecimalIsNotANumber(&plotPoint[dependentCoord]) && [yRange contains:plotPoint[dependentCoord]] ) { lowPoint = [thePlotSpace plotAreaViewPointForPlotPoint:plotPoint numberOfCoordinates:2]; CGFloat distanceSquared = squareOfDistanceBetweenPoints(point, lowPoint); - if ( isnan(minimumDistanceSquared) || (distanceSquared < minimumDistanceSquared) ) { + if ( isnan(minimumDistanceSquared) || (distanceSquared < minimumDistanceSquared)) { minimumDistanceSquared = distanceSquared; result = i; } @@ -1436,7 +1511,7 @@ -(NSUInteger)dataIndexFromInteractionPoint:(CGPoint)point if ( !NSDecimalIsNotANumber(&plotPoint[dependentCoord]) && [yRange contains:plotPoint[dependentCoord]] ) { closePoint = [thePlotSpace plotAreaViewPointForPlotPoint:plotPoint numberOfCoordinates:2]; CGFloat distanceSquared = squareOfDistanceBetweenPoints(point, closePoint); - if ( isnan(minimumDistanceSquared) || (distanceSquared < minimumDistanceSquared) ) { + if ( isnan(minimumDistanceSquared) || (distanceSquared < minimumDistanceSquared)) { minimumDistanceSquared = distanceSquared; result = i; } @@ -1447,18 +1522,18 @@ -(NSUInteger)dataIndexFromInteractionPoint:(CGPoint)point if ( result == i ) { lastViewX = openPoint.x; - if ( isnan(lastViewX) ) { + if ( isnan(lastViewX)) { lastViewX = highPoint.x; } - else if ( isnan(lastViewX) ) { + else if ( isnan(lastViewX)) { lastViewX = lowPoint.x; } - else if ( isnan(lastViewX) ) { + else if ( isnan(lastViewX)) { lastViewX = closePoint.x; } - lastViewMin = MIN( MIN(openPoint.y, closePoint.y), MIN(highPoint.y, lowPoint.y) ); - lastViewMax = MAX( MAX(openPoint.y, closePoint.y), MAX(highPoint.y, lowPoint.y) ); + lastViewMin = MIN(MIN(openPoint.y, closePoint.y), MIN(highPoint.y, lowPoint.y)); + lastViewMax = MAX(MAX(openPoint.y, closePoint.y), MAX(highPoint.y, lowPoint.y)); } } } @@ -1472,14 +1547,14 @@ -(NSUInteger)dataIndexFromInteractionPoint:(CGPoint)point break; case CPTTradingRangePlotStyleCandleStick: - offset = self.barWidth * CPTFloat(0.5); + offset = [self barWidthForIndex:result].cgFloatValue * CPTFloat(0.5); break; } - if ( ( point.x < (lastViewX - offset) ) || ( point.x > (lastViewX + offset) ) ) { + if ((point.x < (lastViewX - offset)) || (point.x > (lastViewX + offset))) { result = NSNotFound; } - if ( (point.y < lastViewMin) || (point.y > lastViewMax) ) { + if ((point.y < lastViewMin) || (point.y > lastViewMax)) { result = NSNotFound; } } @@ -1519,7 +1594,7 @@ -(BOOL)pointingDeviceDownEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint) return NO; } - id theDelegate = self.delegate; + id theDelegate = (id)self.delegate; if ( [theDelegate respondsToSelector:@selector(tradingRangePlot:barTouchDownAtRecordIndex:)] || [theDelegate respondsToSelector:@selector(tradingRangePlot:barTouchDownAtRecordIndex:withEvent:)] || [theDelegate respondsToSelector:@selector(tradingRangePlot:barWasSelectedAtRecordIndex:)] || @@ -1588,7 +1663,7 @@ -(BOOL)pointingDeviceUpEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)in return NO; } - id theDelegate = self.delegate; + id theDelegate = (id)self.delegate; if ( [theDelegate respondsToSelector:@selector(tradingRangePlot:barTouchUpAtRecordIndex:)] || [theDelegate respondsToSelector:@selector(tradingRangePlot:barTouchUpAtRecordIndex:withEvent:)] || [theDelegate respondsToSelector:@selector(tradingRangePlot:barWasSelectedAtRecordIndex:)] || diff --git a/framework/Source/CPTUtilities.m b/framework/Source/CPTUtilities.m index 373f11b5b..1a4641de6 100644 --- a/framework/Source/CPTUtilities.m +++ b/framework/Source/CPTUtilities.m @@ -40,7 +40,17 @@ int16_t CPTDecimalShortValue(NSDecimal decimalNumber) **/ int32_t CPTDecimalLongValue(NSDecimal decimalNumber) { - return (int32_t)[NSDecimalNumber decimalNumberWithDecimal:decimalNumber].longValue; + NSDecimalNumber *d = [NSDecimalNumber decimalNumberWithDecimal:decimalNumber]; + + d = [d decimalNumberByRoundingAccordingToBehavior: + [NSDecimalNumberHandler decimalNumberHandlerWithRoundingMode:NSRoundDown + scale:0 + raiseOnExactness:NO + raiseOnOverflow:NO + raiseOnUnderflow:NO + raiseOnDivideByZero:NO]]; + + return (int32_t)d.longValue; } /** @@ -50,7 +60,17 @@ int32_t CPTDecimalLongValue(NSDecimal decimalNumber) **/ int64_t CPTDecimalLongLongValue(NSDecimal decimalNumber) { - return (int64_t)[NSDecimalNumber decimalNumberWithDecimal:decimalNumber].longLongValue; + NSDecimalNumber *d = [NSDecimalNumber decimalNumberWithDecimal:decimalNumber]; + + d = [d decimalNumberByRoundingAccordingToBehavior: + [NSDecimalNumberHandler decimalNumberHandlerWithRoundingMode:NSRoundDown + scale:0 + raiseOnExactness:NO + raiseOnOverflow:NO + raiseOnUnderflow:NO + raiseOnDivideByZero:NO]]; + + return (int64_t)d.longLongValue; } /** @@ -70,7 +90,17 @@ int CPTDecimalIntValue(NSDecimal decimalNumber) **/ NSInteger CPTDecimalIntegerValue(NSDecimal decimalNumber) { - return (NSInteger)[NSDecimalNumber decimalNumberWithDecimal:decimalNumber].integerValue; + NSDecimalNumber *d = [NSDecimalNumber decimalNumberWithDecimal:decimalNumber]; + + d = [d decimalNumberByRoundingAccordingToBehavior: + [NSDecimalNumberHandler decimalNumberHandlerWithRoundingMode:NSRoundDown + scale:0 + raiseOnExactness:NO + raiseOnOverflow:NO + raiseOnUnderflow:NO + raiseOnDivideByZero:NO]]; + + return (NSInteger)d.integerValue; } /** @@ -100,7 +130,17 @@ uint16_t CPTDecimalUnsignedShortValue(NSDecimal decimalNumber) **/ uint32_t CPTDecimalUnsignedLongValue(NSDecimal decimalNumber) { - return (uint32_t)[NSDecimalNumber decimalNumberWithDecimal:decimalNumber].unsignedLongValue; + NSDecimalNumber *d = [NSDecimalNumber decimalNumberWithDecimal:decimalNumber]; + + d = [d decimalNumberByRoundingAccordingToBehavior: + [NSDecimalNumberHandler decimalNumberHandlerWithRoundingMode:NSRoundDown + scale:0 + raiseOnExactness:NO + raiseOnOverflow:NO + raiseOnUnderflow:NO + raiseOnDivideByZero:NO]]; + + return (uint32_t)d.unsignedLongValue; } /** @@ -110,7 +150,17 @@ uint32_t CPTDecimalUnsignedLongValue(NSDecimal decimalNumber) **/ uint64_t CPTDecimalUnsignedLongLongValue(NSDecimal decimalNumber) { - return (uint64_t)[NSDecimalNumber decimalNumberWithDecimal:decimalNumber].unsignedLongLongValue; + NSDecimalNumber *d = [NSDecimalNumber decimalNumberWithDecimal:decimalNumber]; + + d = [d decimalNumberByRoundingAccordingToBehavior: + [NSDecimalNumberHandler decimalNumberHandlerWithRoundingMode:NSRoundDown + scale:0 + raiseOnExactness:NO + raiseOnOverflow:NO + raiseOnUnderflow:NO + raiseOnDivideByZero:NO]]; + + return (uint64_t)d.unsignedLongLongValue; } /** @@ -130,7 +180,17 @@ unsigned int CPTDecimalUnsignedIntValue(NSDecimal decimalNumber) **/ NSUInteger CPTDecimalUnsignedIntegerValue(NSDecimal decimalNumber) { - return (NSUInteger)[NSDecimalNumber decimalNumberWithDecimal:decimalNumber].unsignedIntegerValue; + NSDecimalNumber *d = [NSDecimalNumber decimalNumberWithDecimal:decimalNumber]; + + d = [d decimalNumberByRoundingAccordingToBehavior: + [NSDecimalNumberHandler decimalNumberHandlerWithRoundingMode:NSRoundDown + scale:0 + raiseOnExactness:NO + raiseOnOverflow:NO + raiseOnUnderflow:NO + raiseOnDivideByZero:NO]]; + + return (NSUInteger)d.unsignedIntegerValue; } /** @@ -162,7 +222,6 @@ CGFloat CPTDecimalCGFloatValue(NSDecimal decimalNumber) { #if CGFLOAT_IS_DOUBLE return (CGFloat)[NSDecimalNumber decimalNumberWithDecimal:decimalNumber].doubleValue; - #else return (CGFloat)[[NSDecimalNumber decimalNumberWithDecimal:decimalNumber] floatValue]; #endif @@ -188,7 +247,7 @@ CGFloat CPTDecimalCGFloatValue(NSDecimal decimalNumber) **/ NSDecimal CPTDecimalFromChar(int8_t anInt) { - if ( (anInt >= 0) && (anInt < kCacheSize) ) { + if ((anInt >= 0) && (anInt < kCacheSize)) { if ( !cacheValueInitialized[anInt] ) { NSString *stringValue = [[NSString alloc] initWithFormat:@"%hhd", anInt]; cache[anInt] = CPTDecimalFromString(stringValue); @@ -211,7 +270,7 @@ NSDecimal CPTDecimalFromChar(int8_t anInt) **/ NSDecimal CPTDecimalFromShort(int16_t anInt) { - if ( (anInt >= 0) && (anInt < kCacheSize) ) { + if ((anInt >= 0) && (anInt < kCacheSize)) { if ( !cacheValueInitialized[anInt] ) { NSString *stringValue = [[NSString alloc] initWithFormat:@"%hd", anInt]; cache[anInt] = CPTDecimalFromString(stringValue); @@ -234,7 +293,7 @@ NSDecimal CPTDecimalFromShort(int16_t anInt) **/ NSDecimal CPTDecimalFromLong(int32_t anInt) { - if ( (anInt >= 0) && (anInt < kCacheSize) ) { + if ((anInt >= 0) && (anInt < kCacheSize)) { if ( !cacheValueInitialized[anInt] ) { NSString *stringValue = [[NSString alloc] initWithFormat:@"%d", anInt]; cache[anInt] = CPTDecimalFromString(stringValue); @@ -257,7 +316,7 @@ NSDecimal CPTDecimalFromLong(int32_t anInt) **/ NSDecimal CPTDecimalFromLongLong(int64_t anInt) { - if ( (anInt >= 0) && (anInt < kCacheSize) ) { + if ((anInt >= 0) && (anInt < kCacheSize)) { if ( !cacheValueInitialized[anInt] ) { NSString *stringValue = [[NSString alloc] initWithFormat:@"%lld", anInt]; cache[anInt] = CPTDecimalFromString(stringValue); @@ -280,7 +339,7 @@ NSDecimal CPTDecimalFromLongLong(int64_t anInt) **/ NSDecimal CPTDecimalFromInt(int anInt) { - if ( (anInt >= 0) && (anInt < kCacheSize) ) { + if ((anInt >= 0) && (anInt < kCacheSize)) { if ( !cacheValueInitialized[anInt] ) { NSString *stringValue = [[NSString alloc] initWithFormat:@"%d", anInt]; cache[anInt] = CPTDecimalFromString(stringValue); @@ -303,7 +362,7 @@ NSDecimal CPTDecimalFromInt(int anInt) **/ NSDecimal CPTDecimalFromInteger(NSInteger anInt) { - if ( (anInt >= 0) && (anInt < kCacheSize) ) { + if ((anInt >= 0) && (anInt < kCacheSize)) { if ( !cacheValueInitialized[anInt] ) { NSString *stringValue = [[NSString alloc] initWithFormat:@"%ld", (long)anInt]; cache[anInt] = CPTDecimalFromString(stringValue); @@ -464,7 +523,7 @@ NSDecimal CPTDecimalFromUnsignedInteger(NSUInteger anInt) **/ NSDecimal CPTDecimalFromFloat(float aFloat) { - if ( isnan(aFloat) ) { + if ( isnan(aFloat) || isinf(aFloat)) { return CPTDecimalNaN(); } else { @@ -482,7 +541,7 @@ NSDecimal CPTDecimalFromFloat(float aFloat) **/ NSDecimal CPTDecimalFromDouble(double aDouble) { - if ( isnan(aDouble) ) { + if ( isnan(aDouble) || isinf(aDouble)) { return CPTDecimalNaN(); } else { @@ -500,7 +559,7 @@ NSDecimal CPTDecimalFromDouble(double aDouble) **/ NSDecimal CPTDecimalFromCGFloat(CGFloat aCGFloat) { - if ( isnan(aCGFloat) ) { + if ( isnan(aCGFloat) || isinf(aCGFloat)) { return CPTDecimalNaN(); } else { @@ -684,7 +743,13 @@ NSDecimal CPTDecimalNaN(void) **/ NSDecimal CPTDecimalMin(NSDecimal leftOperand, NSDecimal rightOperand) { - if ( NSDecimalCompare(&leftOperand, &rightOperand) == NSOrderedAscending ) { + if ( NSDecimalIsNotANumber(&leftOperand)) { + return rightOperand; + } + else if ( NSDecimalIsNotANumber(&rightOperand)) { + return leftOperand; + } + else if ( NSDecimalCompare(&leftOperand, &rightOperand) == NSOrderedAscending ) { return leftOperand; } else { @@ -700,7 +765,13 @@ NSDecimal CPTDecimalMin(NSDecimal leftOperand, NSDecimal rightOperand) **/ NSDecimal CPTDecimalMax(NSDecimal leftOperand, NSDecimal rightOperand) { - if ( NSDecimalCompare(&leftOperand, &rightOperand) == NSOrderedDescending ) { + if ( NSDecimalIsNotANumber(&leftOperand)) { + return rightOperand; + } + else if ( NSDecimalIsNotANumber(&rightOperand)) { + return leftOperand; + } + else if ( NSDecimalCompare(&leftOperand, &rightOperand) == NSOrderedDescending ) { return leftOperand; } else { @@ -715,11 +786,11 @@ NSDecimal CPTDecimalMax(NSDecimal leftOperand, NSDecimal rightOperand) **/ NSDecimal CPTDecimalAbs(NSDecimal value) { - if ( CPTDecimalGreaterThanOrEqualTo( value, CPTDecimalFromInteger(0) ) ) { + if ( CPTDecimalGreaterThanOrEqualTo(value, CPTDecimalFromInteger(0))) { return value; } else { - return CPTDecimalMultiply( value, CPTDecimalFromInteger(-1) ); + return CPTDecimalMultiply(value, CPTDecimalFromInteger(-1)); } } @@ -741,7 +812,7 @@ NSRange CPTExpandedRange(NSRange range, NSInteger expandBy) NSInteger lowerExpansion = (NSInteger)range.location - loc; NSInteger length = MAX(0, (NSInteger)range.length + lowerExpansion + expandBy); - return NSMakeRange( (NSUInteger)loc, (NSUInteger)length ); + return NSMakeRange((NSUInteger)loc, (NSUInteger)length); } #pragma mark - @@ -816,7 +887,7 @@ CGPoint CPTAlignPointToUserSpace(__nonnull CGContextRef context, CGPoint point) // Ensure that coordinates are at exactly the corner // of a device pixel. - point.x = round( point.x - CPTFloat(0.5) ) + CPTFloat(0.5); + point.x = round(point.x - CPTFloat(0.5)) + CPTFloat(0.5); point.y = ceil(point.y) - CPTFloat(0.5); // Convert the device aligned coordinate back to user space. @@ -863,11 +934,11 @@ CGRect CPTAlignRectToUserSpace(__nonnull CGContextRef context, CGRect rect) CGPoint oldOrigin = rect.origin; - rect.origin.x = round( rect.origin.x - CPTFloat(0.5) ); - rect.size.width = round( oldOrigin.x + rect.size.width - CPTFloat(0.5) ) - rect.origin.x; + rect.origin.x = round(rect.origin.x - CPTFloat(0.5)); + rect.size.width = round(oldOrigin.x + rect.size.width - CPTFloat(0.5)) - rect.origin.x; rect.origin.x += CPTFloat(0.5); - rect.origin.y = ceil( CGRectGetMaxY(rect) ) - CPTFloat(0.5); + rect.origin.y = ceil(CGRectGetMaxY(rect)) - CPTFloat(0.5); rect.size.height = ceil(oldOrigin.y - CPTFloat(0.5) - rect.origin.y); return CGContextConvertRectToUserSpace(context, rect); @@ -890,7 +961,7 @@ CGPoint CPTAlignIntegralPointToUserSpace(__nonnull CGContextRef context, CGPoint point = CGContextConvertPointToDeviceSpace(context, point); point.x = round(point.x); - point.y = ceil( point.y - CPTFloat(0.5) ); + point.y = ceil(point.y - CPTFloat(0.5)); return CGContextConvertPointToUserSpace(context, point); } @@ -914,7 +985,7 @@ CGRect CPTAlignIntegralRectToUserSpace(__nonnull CGContextRef context, CGRect re rect.origin.x = round(rect.origin.x); rect.size.width = round(oldOrigin.x + rect.size.width) - rect.origin.x; - rect.origin.y = ceil( CGRectGetMaxY(rect) - CPTFloat(0.5) ); + rect.origin.y = ceil(CGRectGetMaxY(rect) - CPTFloat(0.5)); rect.size.height = ceil(oldOrigin.y - CPTFloat(0.5) - rect.origin.y); return CGContextConvertRectToUserSpace(context, rect); @@ -925,14 +996,14 @@ CGRect CPTAlignBorderedRectToUserSpace(__nonnull CGContextRef context, CGRect re CGRect borderRect; CGFloat contextScale = CPTFloat(1.0); - if ( rect.size.height != CPTFloat(0.0) ) { + if ( rect.size.height != CPTFloat(0.0)) { CGRect deviceRect = CGContextConvertRectToDeviceSpace(context, rect); contextScale = deviceRect.size.height / rect.size.height; } - if ( contextScale != CPTFloat(1.0) ) { + if ( contextScale != CPTFloat(1.0)) { CGFloat borderWidth = borderLineStyle.lineWidth; - if ( ( borderWidth > CPTFloat(0.0) ) && ( borderWidth == round(borderWidth) ) ) { + if ((borderWidth > CPTFloat(0.0)) && (borderWidth == round(borderWidth))) { borderRect = CPTAlignIntegralRectToUserSpace(context, rect); } else { @@ -953,7 +1024,7 @@ CGRect CPTAlignBorderedRectToUserSpace(__nonnull CGContextRef context, CGRect re * @param point The point. * @return A string with the format {x, y}. **/ -NSString * __nonnull CPTStringFromPoint(CGPoint point) +NSString *__nonnull CPTStringFromPoint(CGPoint point) { return [NSString stringWithFormat:@"{%g, %g}", (double)point.x, (double)point.y]; } @@ -1066,7 +1137,7 @@ BOOL CPTEdgeInsetsEqualToEdgeInsets(CPTEdgeInsets insets1, CPTEdgeInsets insets2 if ( value != 0.0 ) { double sign = (signbit(value) ? -1.0 : +1.0); - return sign * (pow( 10.0, fabs(value) ) - 1.0); + return sign * (pow(10.0, fabs(value)) - 1.0); } else { return 0.0; diff --git a/framework/Source/CPTUtilitiesTests.m b/framework/Source/CPTUtilitiesTests.m index c9c613c6d..c8335a100 100644 --- a/framework/Source/CPTUtilitiesTests.m +++ b/framework/Source/CPTUtilitiesTests.m @@ -50,7 +50,7 @@ -(void)testCPTDecimalIntegerValue XCTAssertEqual(CPTDecimalIntegerValue([d decimalValue]), (NSInteger)42, @"Result incorrect"); d = [NSDecimalNumber decimalNumberWithString:@"42.1"]; - XCTAssertEqual( (NSInteger)CPTDecimalIntegerValue([d decimalValue]), (NSInteger)42, @"Result incorrect" ); + XCTAssertEqual((NSInteger)CPTDecimalIntegerValue([d decimalValue]), (NSInteger)42, @"Result incorrect"); } -(void)testCPTDecimalFloatValue @@ -82,7 +82,7 @@ -(void)testToDecimalConversion XCTAssertEqualObjects([NSDecimalNumber decimalNumberWithString:@"100"], [NSDecimalNumber decimalNumberWithDecimal:CPTDecimalFromInteger(i)], @"NSInteger to NSDecimal conversion failed"); XCTAssertEqualObjects([NSDecimalNumber decimalNumberWithString:@"100"], [NSDecimalNumber decimalNumberWithDecimal:CPTDecimalFromUnsignedInteger(unsignedI)], @"NSUInteger to NSDecimal conversion failed"); - XCTAssertEqualWithAccuracy([@(f)floatValue], [[NSDecimalNumber decimalNumberWithDecimal:CPTDecimalFromFloat(f)] floatValue], 1.0e-7f, @"float to NSDecimal conversion failed"); + XCTAssertEqualWithAccuracy([@(f) floatValue], [[NSDecimalNumber decimalNumberWithDecimal:CPTDecimalFromFloat(f)] floatValue], 1.0e-7f, @"float to NSDecimal conversion failed"); XCTAssertEqualObjects(@(d), [NSDecimalNumber decimalNumberWithDecimal:CPTDecimalFromDouble(d)], @"double to NSDecimal conversion failed."); } @@ -122,6 +122,130 @@ -(void)testConvertNegativeOne XCTAssertTrue(NSDecimalCompare(&testValue, &negativeOne) == NSOrderedSame, @"%@", errMessage); } +#pragma mark - +#pragma mark Decimal utilities + +-(void)testDecimalMax +{ + NSDecimal zero = CPTDecimalFromInteger(0); + NSDecimal one = CPTDecimalFromInteger(1); + NSDecimal dNAN = CPTDecimalNaN(); + + NSDecimal testValue; + NSString *errMessage; + + testValue = CPTDecimalMin(zero, one); + errMessage = [NSString stringWithFormat:@"test min(0, 1), expected %@", NSDecimalString(&zero, nil)]; + XCTAssertTrue(NSDecimalCompare(&testValue, &zero) == NSOrderedSame, @"%@", errMessage); + + testValue = CPTDecimalMin(one, zero); + errMessage = [NSString stringWithFormat:@"test min(1, 0), expected %@", NSDecimalString(&zero, nil)]; + XCTAssertTrue(NSDecimalCompare(&testValue, &zero) == NSOrderedSame, @"%@", errMessage); + + testValue = CPTDecimalMin(one, dNAN); + errMessage = [NSString stringWithFormat:@"test min(1, NAN), expected %@", NSDecimalString(&one, nil)]; + XCTAssertTrue(NSDecimalCompare(&testValue, &one) == NSOrderedSame, @"%@", errMessage); + + testValue = CPTDecimalMin(dNAN, one); + errMessage = [NSString stringWithFormat:@"test min(NAN, 1), expected %@", NSDecimalString(&one, nil)]; + XCTAssertTrue(NSDecimalCompare(&testValue, &one) == NSOrderedSame, @"%@", errMessage); + + testValue = CPTDecimalMin(dNAN, dNAN); + errMessage = [NSString stringWithFormat:@"test min(NAN, NAN), expected %@", NSDecimalString(&dNAN, nil)]; + XCTAssertTrue(NSDecimalCompare(&testValue, &dNAN) == NSOrderedSame, @"%@", errMessage); +} + +-(void)testDecimalMin +{ + NSDecimal zero = CPTDecimalFromInteger(0); + NSDecimal one = CPTDecimalFromInteger(1); + NSDecimal dNAN = CPTDecimalNaN(); + + NSDecimal testValue; + NSString *errMessage; + + testValue = CPTDecimalMax(zero, one); + errMessage = [NSString stringWithFormat:@"test min(0, 1), expected %@", NSDecimalString(&one, nil)]; + XCTAssertTrue(NSDecimalCompare(&testValue, &one) == NSOrderedSame, @"%@", errMessage); + + testValue = CPTDecimalMax(one, zero); + errMessage = [NSString stringWithFormat:@"test min(1, 0), expected %@", NSDecimalString(&one, nil)]; + XCTAssertTrue(NSDecimalCompare(&testValue, &one) == NSOrderedSame, @"%@", errMessage); + + testValue = CPTDecimalMax(one, dNAN); + errMessage = [NSString stringWithFormat:@"test min(1, NAN), expected %@", NSDecimalString(&one, nil)]; + XCTAssertTrue(NSDecimalCompare(&testValue, &one) == NSOrderedSame, @"%@", errMessage); + + testValue = CPTDecimalMax(dNAN, one); + errMessage = [NSString stringWithFormat:@"test min(NAN, 1), expected %@", NSDecimalString(&one, nil)]; + XCTAssertTrue(NSDecimalCompare(&testValue, &one) == NSOrderedSame, @"%@", errMessage); + + testValue = CPTDecimalMin(dNAN, dNAN); + errMessage = [NSString stringWithFormat:@"test min(NAN, NAN), expected %@", NSDecimalString(&dNAN, nil)]; + XCTAssertTrue(NSDecimalCompare(&testValue, &dNAN) == NSOrderedSame, @"%@", errMessage); +} + +-(void)testDecimalAbs +{ + NSDecimal zero = CPTDecimalFromInteger(0); + NSDecimal one = CPTDecimalFromInteger(1); + NSDecimal negativeOne = CPTDecimalFromInteger(-1); + + NSDecimal testValue; + NSString *errMessage; + + testValue = CPTDecimalAbs(one); + errMessage = [NSString stringWithFormat:@"test value was %@, expected %@", NSDecimalString(&testValue, nil), NSDecimalString(&one, nil)]; + XCTAssertTrue(NSDecimalCompare(&testValue, &one) == NSOrderedSame, @"%@", errMessage); + + testValue = CPTDecimalAbs(zero); + errMessage = [NSString stringWithFormat:@"test value was %@, expected %@", NSDecimalString(&testValue, nil), NSDecimalString(&zero, nil)]; + XCTAssertTrue(NSDecimalCompare(&testValue, &zero) == NSOrderedSame, @"%@", errMessage); + + testValue = CPTDecimalAbs(negativeOne); + errMessage = [NSString stringWithFormat:@"test value was %@, expected %@", NSDecimalString(&testValue, nil), NSDecimalString(&one, nil)]; + XCTAssertTrue(NSDecimalCompare(&testValue, &one) == NSOrderedSame, @"%@", errMessage); +} + +#pragma mark - +#pragma mark NSDecimalNumber tests + +// Fix issues with incorrect values when converting NSDecimalNumber to non-double values (due to bugs in NSDecimalNumber, see radar #32520109) +-(void)testNSDecimalNumberBugFix +{ + NSArray *strings = + @[ + @"0", // validation tests + @"1", + @"1.8446744073709551615", // 64/65 bit tests (radar 32520109) + @"1.8446744073709551616", + @"9.821426272392280061", // radar 25465729 tests + @"9.821426272392280060", + ]; + + for ( NSString *string in strings ) { + NSDecimalNumber *v = [NSDecimalNumber decimalNumberWithString:string]; + NSDecimal d = v.decimalValue; + double expectedDouble = v.doubleValue; + + XCTAssertEqual(CPTDecimalCharValue(d), (char)expectedDouble); + XCTAssertEqual(CPTDecimalUnsignedCharValue(d), (unsigned char)expectedDouble); + XCTAssertEqual(CPTDecimalShortValue(d), (short)expectedDouble); + XCTAssertEqual(CPTDecimalUnsignedShortValue(d), (unsigned short)expectedDouble); + XCTAssertEqual(CPTDecimalIntValue(d), (int)expectedDouble); + XCTAssertEqual(CPTDecimalUnsignedIntValue(d), (unsigned int)expectedDouble); + XCTAssertEqual(CPTDecimalLongValue(d), (long)expectedDouble); + XCTAssertEqual(CPTDecimalUnsignedLongValue(d), (unsigned long)expectedDouble); + XCTAssertEqual(CPTDecimalLongLongValue(d), (long long)expectedDouble); + XCTAssertEqual(CPTDecimalUnsignedLongLongValue(d), (unsigned long long)expectedDouble); + + XCTAssertEqual(CPTDecimalFloatValue(d), (float)expectedDouble); + + XCTAssertEqual(CPTDecimalIntegerValue(d), (NSInteger)expectedDouble); + XCTAssertEqual(CPTDecimalUnsignedIntegerValue(d), (NSUInteger)expectedDouble); + } +} + #pragma mark - #pragma mark Cached values @@ -595,11 +719,11 @@ -(void)testInverseLogModulus { XCTAssertEqual(CPTInverseLogModulus(0.0), 0.0, @"CPTInverseLogModulus(0.0)"); - XCTAssertEqualWithAccuracy(CPTInverseLogModulus( log10(11.0) ), 10.0, 1.0e-7, @"CPTInverseLogModulus(log10(11.0))"); - XCTAssertEqualWithAccuracy(CPTInverseLogModulus( -log10(11.0) ), -10.0, 1.0e-7, @"CPTInverseLogModulus(-log10(11.0))"); + XCTAssertEqualWithAccuracy(CPTInverseLogModulus(log10(11.0)), 10.0, 1.0e-7, @"CPTInverseLogModulus(log10(11.0))"); + XCTAssertEqualWithAccuracy(CPTInverseLogModulus(-log10(11.0)), -10.0, 1.0e-7, @"CPTInverseLogModulus(-log10(11.0))"); - XCTAssertEqualWithAccuracy(CPTInverseLogModulus( log10(101.0) ), 100.0, 1.0e-7, @"CPTInverseLogModulus(log10(101.0))"); - XCTAssertEqualWithAccuracy(CPTInverseLogModulus( -log10(101.0) ), -100.0, 1.0e-7, @"CPTInverseLogModulus(-log10(101.0))"); + XCTAssertEqualWithAccuracy(CPTInverseLogModulus(log10(101.0)), 100.0, 1.0e-7, @"CPTInverseLogModulus(log10(101.0))"); + XCTAssertEqualWithAccuracy(CPTInverseLogModulus(-log10(101.0)), -100.0, 1.0e-7, @"CPTInverseLogModulus(-log10(101.0))"); } /// @endcond diff --git a/framework/Source/CPTXYAxis.m b/framework/Source/CPTXYAxis.m index 42f001c20..9b0c117a4 100644 --- a/framework/Source/CPTXYAxis.m +++ b/framework/Source/CPTXYAxis.m @@ -67,7 +67,7 @@ @implementation CPTXYAxis **/ -(nonnull instancetype)initWithFrame:(CGRect)newFrame { - if ( (self = [super initWithFrame:newFrame]) ) { + if ((self = [super initWithFrame:newFrame])) { orthogonalPosition = @0.0; axisConstraints = nil; self.tickDirection = CPTSignNone; @@ -81,7 +81,7 @@ -(nonnull instancetype)initWithFrame:(CGRect)newFrame -(nonnull instancetype)initWithLayer:(nonnull id)layer { - if ( (self = [super initWithLayer:layer]) ) { + if ((self = [super initWithLayer:layer])) { CPTXYAxis *theLayer = (CPTXYAxis *)layer; orthogonalPosition = theLayer->orthogonalPosition; @@ -107,7 +107,7 @@ -(void)encodeWithCoder:(nonnull NSCoder *)coder -(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super initWithCoder:coder]) ) { + if ((self = [super initWithCoder:coder])) { orthogonalPosition = [coder decodeObjectOfClass:[NSNumber class] forKey:@"CPTXYAxis.orthogonalPosition"]; axisConstraints = [coder decodeObjectOfClass:[CPTConstraints class] @@ -205,13 +205,13 @@ -(CGPoint)viewPointForCoordinateValue:(nullable NSNumber *)coordinateValue } } - if ( isnan(point.x) || isnan(point.y) ) { - NSLog( @"[CPTXYAxis viewPointForCoordinateValue:%@] was %@", coordinateValue, CPTStringFromPoint(point) ); + if ( isnan(point.x) || isnan(point.y)) { + NSLog(@"[CPTXYAxis viewPointForCoordinateValue:%@] was %@", coordinateValue, CPTStringFromPoint(point)); - if ( isnan(point.x) ) { + if ( isnan(point.x)) { point.x = CPTFloat(0.0); } - if ( isnan(point.y) ) { + if ( isnan(point.y)) { point.y = CPTFloat(0.0); } } @@ -237,7 +237,7 @@ -(void)drawTicksInContext:(nonnull CGContextRef)context atLocations:(nullable CP CGFloat lineWidth = lineStyle.lineWidth; CPTAlignPointFunction alignmentFunction = NULL; - if ( ( self.contentsScale > CPTFloat(1.0) ) && (round(lineWidth) == lineWidth) ) { + if ((self.contentsScale > CPTFloat(1.0)) && (round(lineWidth) == lineWidth)) { alignmentFunction = CPTAlignIntegralPointToUserSpace; } else { @@ -348,7 +348,7 @@ -(void)renderAsVectorInContext:(nonnull CGContextRef)context CPTAlignPointFunction alignmentFunction = CPTAlignPointToUserSpace; if ( theLineStyle ) { CGFloat lineWidth = theLineStyle.lineWidth; - if ( ( self.contentsScale > CPTFloat(1.0) ) && (round(lineWidth) == lineWidth) ) { + if ((self.contentsScale > CPTFloat(1.0)) && (round(lineWidth) == lineWidth)) { alignmentFunction = CPTAlignIntegralPointToUserSpace; } @@ -443,7 +443,7 @@ -(void)drawGridLinesInContext:(nonnull CGContextRef)context isMajor:(BOOL)major CGFloat lineWidth = lineStyle.lineWidth; CPTAlignPointFunction alignmentFunction = NULL; - if ( ( self.contentsScale > CPTFloat(1.0) ) && (round(lineWidth) == lineWidth) ) { + if ((self.contentsScale > CPTFloat(1.0)) && (round(lineWidth) == lineWidth)) { alignmentFunction = CPTAlignIntegralPointToUserSpace; } else { @@ -501,7 +501,7 @@ -(NSUInteger)initialBandIndexForSortedLocations:(CPTNumberArray *)sortedLocation NSNumber *bandAnchor = self.alternatingBandAnchor; NSUInteger bandCount = self.alternatingBandFills.count; - if ( bandAnchor && (bandCount > 0) ) { + if ( bandAnchor && (bandCount > 0)) { NSDecimal anchor = bandAnchor.decimalValue; CPTPlotRange *theVisibleRange = self.visibleRange; @@ -552,7 +552,7 @@ -(NSUInteger)initialBandIndexForSortedLocations:(CPTNumberArray *)sortedLocation // user provided tick locations; they're not guaranteed to be evenly spaced, but band drawing always starts with the first location if ( range.lengthDouble >= 0.0 ) { for ( NSNumber *location in sortedLocations ) { - if ( CPTDecimalLessThan(anchor, location.decimalValue) ) { + if ( CPTDecimalLessThan(anchor, location.decimalValue)) { break; } @@ -561,7 +561,7 @@ -(NSUInteger)initialBandIndexForSortedLocations:(CPTNumberArray *)sortedLocation } else { for ( NSNumber *location in sortedLocations ) { - if ( CPTDecimalGreaterThanOrEqualTo(anchor, location.decimalValue) ) { + if ( CPTDecimalGreaterThanOrEqualTo(anchor, location.decimalValue)) { break; } @@ -574,7 +574,7 @@ -(NSUInteger)initialBandIndexForSortedLocations:(CPTNumberArray *)sortedLocation break; } - if ( !CPTDecimalEquals(majorInterval, zero) ) { + if ( !CPTDecimalEquals(majorInterval, zero)) { coord = CPTDecimalDivide(CPTDecimalSubtract(rangeStart, origin), majorInterval); NSDecimalRound(&coord, &coord, 0, NSRoundUp); NSInteger stepCount = CPTDecimalIntegerValue(coord) + CPTDecimalIntegerValue(offset) + 1; @@ -622,7 +622,7 @@ -(void)drawBackgroundBandsInContext:(nonnull CGContextRef)context const NSDecimal zero = CPTDecimalFromInteger(0); NSSortDescriptor *sortDescriptor = nil; if ( range ) { - if ( CPTDecimalGreaterThanOrEqualTo(range.lengthDecimal, zero) ) { + if ( CPTDecimalGreaterThanOrEqualTo(range.lengthDecimal, zero)) { sortDescriptor = [[NSSortDescriptor alloc] initWithKey:nil ascending:YES]; } else { @@ -659,7 +659,7 @@ -(void)drawBackgroundBandsInContext:(nonnull CGContextRef)context for ( NSDecimalNumber *location in locations ) { NSDecimal currentLocation = location.decimalValue; - if ( !CPTDecimalEquals(CPTDecimalSubtract(currentLocation, lastLocation), zero) ) { + if ( !CPTDecimalEquals(CPTDecimalSubtract(currentLocation, lastLocation), zero)) { CPTFill *bandFill = bandArray[bandIndex++]; bandIndex %= bandCount; @@ -673,10 +673,10 @@ -(void)drawBackgroundBandsInContext:(nonnull CGContextRef)context CGPoint endViewPoint = [thePlotSpace plotAreaViewPointForPlotPoint:endPlotPoint numberOfCoordinates:2]; // Fill band - CGRect fillRect = CPTRectMake( MIN(startViewPoint.x, endViewPoint.x), - MIN(startViewPoint.y, endViewPoint.y), - ABS(endViewPoint.x - startViewPoint.x), - ABS(endViewPoint.y - startViewPoint.y) ); + CGRect fillRect = CPTRectMake(MIN(startViewPoint.x, endViewPoint.x), + MIN(startViewPoint.y, endViewPoint.y), + ABS(endViewPoint.x - startViewPoint.x), + ABS(endViewPoint.y - startViewPoint.y)); [bandFill fillRect:CPTAlignIntegralRectToUserSpace(context, fillRect) inContext:context]; } } @@ -692,7 +692,7 @@ -(void)drawBackgroundBandsInContext:(nonnull CGContextRef)context else { endLocation = CPTDecimalNaN(); } - if ( !CPTDecimalEquals(lastLocation, endLocation) ) { + if ( !CPTDecimalEquals(lastLocation, endLocation)) { CPTFill *bandFill = bandArray[bandIndex]; if ( bandFill != null ) { @@ -705,10 +705,10 @@ -(void)drawBackgroundBandsInContext:(nonnull CGContextRef)context CGPoint endViewPoint = [thePlotSpace plotAreaViewPointForPlotPoint:endPlotPoint numberOfCoordinates:2]; // Fill band - CGRect fillRect = CPTRectMake( MIN(startViewPoint.x, endViewPoint.x), - MIN(startViewPoint.y, endViewPoint.y), - ABS(endViewPoint.x - startViewPoint.x), - ABS(endViewPoint.y - startViewPoint.y) ); + CGRect fillRect = CPTRectMake(MIN(startViewPoint.x, endViewPoint.x), + MIN(startViewPoint.y, endViewPoint.y), + ABS(endViewPoint.x - startViewPoint.x), + ABS(endViewPoint.y - startViewPoint.y)); [bandFill fillRect:CPTAlignIntegralRectToUserSpace(context, fillRect) inContext:context]; } } @@ -763,10 +763,10 @@ -(void)drawBackgroundLimitsInContext:(nonnull CGContextRef)context CGPoint endViewPoint = [thePlotSpace plotAreaViewPointForPlotPoint:endPlotPoint numberOfCoordinates:2]; // Fill band - CGRect fillRect = CPTRectMake( MIN(startViewPoint.x, endViewPoint.x), - MIN(startViewPoint.y, endViewPoint.y), - ABS(endViewPoint.x - startViewPoint.x), - ABS(endViewPoint.y - startViewPoint.y) ); + CGRect fillRect = CPTRectMake(MIN(startViewPoint.x, endViewPoint.x), + MIN(startViewPoint.y, endViewPoint.y), + ABS(endViewPoint.x - startViewPoint.x), + ABS(endViewPoint.y - startViewPoint.y)); [bandFill fillRect:CPTAlignIntegralRectToUserSpace(context, fillRect) inContext:context]; } } @@ -824,8 +824,8 @@ -(nonnull NSNumber *)defaultTitleLocation double loc = axisRange.locationDouble; double end = axisRange.endDouble; - if ( (loc > 0.0) && (end >= 0.0) ) { - location = @( pow(10.0, ( log10(loc) + log10(end) ) / 2.0) ); + if ((loc > 0.0) && (end >= 0.0)) { + location = @(pow(10.0, (log10(loc) + log10(end)) / 2.0)); } else { location = axisRange.midPoint; @@ -838,7 +838,7 @@ -(nonnull NSNumber *)defaultTitleLocation double loc = axisRange.locationDouble; double end = axisRange.endDouble; - location = @( CPTInverseLogModulus( ( CPTLogModulus(loc) + CPTLogModulus(end) ) / 2.0 ) ); + location = @(CPTInverseLogModulus((CPTLogModulus(loc) + CPTLogModulus(end)) / 2.0)); } break; diff --git a/framework/Source/CPTXYAxisSet.m b/framework/Source/CPTXYAxisSet.m index 8f14af251..70c48c5bf 100644 --- a/framework/Source/CPTXYAxisSet.m +++ b/framework/Source/CPTXYAxisSet.m @@ -42,7 +42,7 @@ @implementation CPTXYAxisSet **/ -(nonnull instancetype)initWithFrame:(CGRect)newFrame { - if ( (self = [super initWithFrame:newFrame]) ) { + if ((self = [super initWithFrame:newFrame])) { CPTXYAxis *xAxis = [[CPTXYAxis alloc] initWithFrame:newFrame]; xAxis.coordinate = CPTCoordinateX; xAxis.tickDirection = CPTSignNegative; @@ -80,7 +80,7 @@ -(void)renderAsVectorInContext:(nonnull CGContextRef)context CGFloat radius = superlayer.cornerRadius; - if ( radius > CPTFloat(0.0) ) { + if ( radius > CPTFloat(0.0)) { CGContextBeginPath(context); CPTAddRoundedRectPath(context, borderRect, radius); diff --git a/framework/Source/CPTXYGraph.m b/framework/Source/CPTXYGraph.m index 4f4ab0c88..480c28bb6 100644 --- a/framework/Source/CPTXYGraph.m +++ b/framework/Source/CPTXYGraph.m @@ -47,7 +47,7 @@ @implementation CPTXYGraph **/ -(nonnull instancetype)initWithFrame:(CGRect)newFrame xScaleType:(CPTScaleType)newXScaleType yScaleType:(CPTScaleType)newYScaleType { - if ( (self = [super initWithFrame:newFrame]) ) { + if ((self = [super initWithFrame:newFrame])) { xScaleType = newXScaleType; yScaleType = newYScaleType; } @@ -78,7 +78,7 @@ -(nonnull instancetype)initWithFrame:(CGRect)newFrame -(nonnull instancetype)initWithLayer:(nonnull id)layer { - if ( (self = [super initWithLayer:layer]) ) { + if ((self = [super initWithLayer:layer])) { CPTXYGraph *theLayer = (CPTXYGraph *)layer; xScaleType = theLayer->xScaleType; @@ -104,7 +104,7 @@ -(void)encodeWithCoder:(nonnull NSCoder *)coder -(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super initWithCoder:coder]) ) { + if ((self = [super initWithCoder:coder])) { xScaleType = (CPTScaleType)[coder decodeIntegerForKey:@"CPTXYGraph.xScaleType"]; yScaleType = (CPTScaleType)[coder decodeIntegerForKey:@"CPTXYGraph.yScaleType"]; } diff --git a/framework/Source/CPTXYPlotSpace.m b/framework/Source/CPTXYPlotSpace.m index e1cd65691..3b2750488 100644 --- a/framework/Source/CPTXYPlotSpace.m +++ b/framework/Source/CPTXYPlotSpace.m @@ -198,7 +198,7 @@ @implementation CPTXYPlotSpace **/ -(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { xRange = [[CPTPlotRange alloc] initWithLocation:@0.0 length:@1.0]; yRange = [[CPTPlotRange alloc] initWithLocation:@0.0 length:@1.0]; globalXRange = nil; @@ -241,8 +241,8 @@ -(void)encodeWithCoder:(nonnull NSCoder *)coder [coder encodeInteger:self.yScaleType forKey:@"CPTXYPlotSpace.yScaleType"]; [coder encodeBool:self.allowsMomentumX forKey:@"CPTXYPlotSpace.allowsMomentumX"]; [coder encodeBool:self.allowsMomentumY forKey:@"CPTXYPlotSpace.allowsMomentumY"]; - [coder encodeInt:self.momentumAnimationCurve forKey:@"CPTXYPlotSpace.momentumAnimationCurve"]; - [coder encodeInt:self.bounceAnimationCurve forKey:@"CPTXYPlotSpace.bounceAnimationCurve"]; + [coder encodeInteger:self.momentumAnimationCurve forKey:@"CPTXYPlotSpace.momentumAnimationCurve"]; + [coder encodeInteger:self.bounceAnimationCurve forKey:@"CPTXYPlotSpace.bounceAnimationCurve"]; [coder encodeCGFloat:self.momentumAcceleration forKey:@"CPTXYPlotSpace.momentumAcceleration"]; [coder encodeCGFloat:self.bounceAcceleration forKey:@"CPTXYPlotSpace.bounceAcceleration"]; [coder encodeCGFloat:self.minimumDisplacementToDrag forKey:@"CPTXYPlotSpace.minimumDisplacementToDrag"]; @@ -257,7 +257,7 @@ -(void)encodeWithCoder:(nonnull NSCoder *)coder -(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super initWithCoder:coder]) ) { + if ((self = [super initWithCoder:coder])) { CPTPlotRange *range = [coder decodeObjectOfClass:[CPTPlotRange class] forKey:@"CPTXYPlotSpace.xRange"]; if ( range ) { @@ -282,8 +282,8 @@ -(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder allowsMomentumX = [coder decodeBoolForKey:@"CPTXYPlotSpace.allowsMomentumX"]; allowsMomentumY = [coder decodeBoolForKey:@"CPTXYPlotSpace.allowsMomentumY"]; } - momentumAnimationCurve = (CPTAnimationCurve)[coder decodeIntForKey:@"CPTXYPlotSpace.momentumAnimationCurve"]; - bounceAnimationCurve = (CPTAnimationCurve)[coder decodeIntForKey:@"CPTXYPlotSpace.bounceAnimationCurve"]; + momentumAnimationCurve = (CPTAnimationCurve)[coder decodeIntegerForKey:@"CPTXYPlotSpace.momentumAnimationCurve"]; + bounceAnimationCurve = (CPTAnimationCurve)[coder decodeIntegerForKey:@"CPTXYPlotSpace.bounceAnimationCurve"]; momentumAcceleration = [coder decodeCGFloatForKey:@"CPTXYPlotSpace.momentumAcceleration"]; bounceAcceleration = [coder decodeCGFloatForKey:@"CPTXYPlotSpace.bounceAcceleration"]; minimumDisplacementToDrag = [coder decodeCGFloatForKey:@"CPTXYPlotSpace.minimumDisplacementToDrag"]; @@ -418,14 +418,14 @@ -(void)setXRange:(nonnull CPTPlotRange *)range if ( xRange && constrainedRange ) { isScrolling = !CPTDecimalEquals(constrainedRange.locationDecimal, xRange.locationDecimal) && CPTDecimalEquals(constrainedRange.lengthDecimal, xRange.lengthDecimal); - if ( isScrolling && ( displacement == CPTFloat(0.0) ) ) { + if ( isScrolling && (displacement == CPTFloat(0.0))) { CPTGraph *theGraph = self.graph; CPTPlotArea *plotArea = theGraph.plotAreaFrame.plotArea; if ( plotArea ) { NSDecimal rangeLength = constrainedRange.lengthDecimal; - if ( !CPTDecimalEquals( rangeLength, CPTDecimalFromInteger(0) ) ) { + if ( !CPTDecimalEquals(rangeLength, CPTDecimalFromInteger(0))) { NSDecimal diff = CPTDecimalDivide(CPTDecimalSubtract(constrainedRange.locationDecimal, xRange.locationDecimal), rangeLength); displacement = plotArea.bounds.size.width * CPTDecimalCGFloatValue(diff); @@ -482,14 +482,14 @@ -(void)setYRange:(nonnull CPTPlotRange *)range if ( yRange && constrainedRange ) { isScrolling = !CPTDecimalEquals(constrainedRange.locationDecimal, yRange.locationDecimal) && CPTDecimalEquals(constrainedRange.lengthDecimal, yRange.lengthDecimal); - if ( isScrolling && ( displacement == CPTFloat(0.0) ) ) { + if ( isScrolling && (displacement == CPTFloat(0.0))) { CPTGraph *theGraph = self.graph; CPTPlotArea *plotArea = theGraph.plotAreaFrame.plotArea; if ( plotArea ) { NSDecimal rangeLength = constrainedRange.lengthDecimal; - if ( !CPTDecimalEquals( rangeLength, CPTDecimalFromInteger(0) ) ) { + if ( !CPTDecimalEquals(rangeLength, CPTDecimalFromInteger(0))) { NSDecimal diff = CPTDecimalDivide(CPTDecimalSubtract(constrainedRange.locationDecimal, yRange.locationDecimal), rangeLength); displacement = plotArea.bounds.size.height * CPTDecimalCGFloatValue(diff); @@ -531,7 +531,7 @@ -(nonnull CPTPlotRange *)constrainRange:(nonnull CPTPlotRange *)existingRange to CPTPlotRange *theGlobalRange = globalRange; - if ( CPTDecimalGreaterThanOrEqualTo(existingRange.lengthDecimal, theGlobalRange.lengthDecimal) ) { + if ( CPTDecimalGreaterThanOrEqualTo(existingRange.lengthDecimal, theGlobalRange.lengthDecimal)) { return [theGlobalRange copy]; } else { @@ -595,8 +595,8 @@ -(void)animateRangeForCoordinate:(CPTCoordinate)coordinate shift:(NSDecimal)shif CPTPlotRange *constrainedRange = [self constrainRange:newRange toGlobalRange:globalRange]; if ( ![newRange isEqualToRange:constrainedRange] && ![globalRange containsRange:newRange] ) { - BOOL direction = ( CPTDecimalGreaterThan(shift, zero) && CPTDecimalGreaterThan(oldRange.lengthDecimal, zero) ) || - ( CPTDecimalLessThan(shift, zero) && CPTDecimalLessThan(oldRange.lengthDecimal, zero) ); + BOOL direction = (CPTDecimalGreaterThan(shift, zero) && CPTDecimalGreaterThan(oldRange.lengthDecimal, zero)) || + (CPTDecimalLessThan(shift, zero) && CPTDecimalLessThan(oldRange.lengthDecimal, zero)); // decelerate at the global range if ( hasShift ) { @@ -610,11 +610,11 @@ -(void)animateRangeForCoordinate:(CPTCoordinate)coordinate shift:(NSDecimal)shif CGFloat brakingOffset = globalPoint - oldPoint; brakingDelay = CPTFirstPositiveRoot(acceleration, speed, brakingOffset); - if ( !isnan(brakingDelay) ) { + if ( !isnan(brakingDelay)) { speed -= brakingDelay * acceleration; // slow down quickly - while ( momentumTime > CPTFloat(0.1) ) { + while ( momentumTime > CPTFloat(0.1)) { acceleration *= CPTFloat(2.0); momentumTime = speed / (CPTFloat(2.0) * acceleration); } @@ -651,10 +651,10 @@ -(void)animateRangeForCoordinate:(CPTCoordinate)coordinate shift:(NSDecimal)shif brakingDelay = CPTFloat(0.0); // slow down quickly - while ( momentumTime > CPTFloat(0.1) ) { + while ( momentumTime > CPTFloat(0.1)) { momentumTime *= CPTFloat(0.5); - shift = CPTDecimalDivide( shift, CPTDecimalFromInteger(2) ); + shift = CPTDecimalDivide(shift, CPTDecimalFromInteger(2)); } newRange = [oldRange mutableCopy]; @@ -662,7 +662,7 @@ -(void)animateRangeForCoordinate:(CPTCoordinate)coordinate shift:(NSDecimal)shif newRange.locationDecimal = CPTDecimalAdd(newRange.locationDecimal, shift); } - if ( !isnan(brakingDelay) ) { + if ( !isnan(brakingDelay)) { op = [CPTAnimation animate:self property:property fromPlotRange:constrainedRange @@ -736,11 +736,11 @@ CGFloat CPTFirstPositiveRoot(CGFloat a, CGFloat b, CGFloat c) CGFloat root1 = (-b + discriminant) / (CPTFloat(2.0) * a); CGFloat root2 = (-b - discriminant) / (CPTFloat(2.0) * a); - if ( !isnan(root1) && !isnan(root2) ) { - if ( root1 >= CPTFloat(0.0) ) { + if ( !isnan(root1) && !isnan(root2)) { + if ( root1 >= CPTFloat(0.0)) { root = root1; } - if ( ( root2 >= CPTFloat(0.0) ) && ( isnan(root) || (root2 < root) ) ) { + if ((root2 >= CPTFloat(0.0)) && (isnan(root) || (root2 < root))) { root = root2; } } @@ -789,13 +789,13 @@ -(void)scaleToFitPlots:(nullable CPTPlotArray *)plots // Set range NSDecimal zero = CPTDecimalFromInteger(0); if ( unionXRange ) { - if ( CPTDecimalEquals(unionXRange.lengthDecimal, zero) ) { + if ( CPTDecimalEquals(unionXRange.lengthDecimal, zero)) { [unionXRange unionPlotRange:self.xRange]; } self.xRange = unionXRange; } if ( unionYRange ) { - if ( CPTDecimalEquals(unionYRange.lengthDecimal, zero) ) { + if ( CPTDecimalEquals(unionYRange.lengthDecimal, zero)) { [unionYRange unionPlotRange:self.yRange]; } self.yRange = unionYRange; @@ -827,13 +827,13 @@ -(void)scaleToFitEntirePlots:(nullable CPTPlotArray *)plots // Set range NSDecimal zero = CPTDecimalFromInteger(0); if ( unionXRange ) { - if ( CPTDecimalEquals(unionXRange.lengthDecimal, zero) ) { + if ( CPTDecimalEquals(unionXRange.lengthDecimal, zero)) { [unionXRange unionPlotRange:self.xRange]; } self.xRange = unionXRange; } if ( unionYRange ) { - if ( CPTDecimalEquals(unionYRange.lengthDecimal, zero) ) { + if ( CPTDecimalEquals(unionYRange.lengthDecimal, zero)) { [unionYRange unionPlotRange:self.yRange]; } self.yRange = unionYRange; @@ -891,7 +891,7 @@ -(CGFloat)viewCoordinateForViewLength:(NSDecimal)viewLength linearPlotRange:(non } NSDecimal factor = CPTDecimalDivide(CPTDecimalSubtract(plotCoord, range.locationDecimal), range.lengthDecimal); - if ( NSDecimalIsNotANumber(&factor) ) { + if ( NSDecimalIsNotANumber(&factor)) { factor = CPTDecimalFromInteger(0); } @@ -902,17 +902,17 @@ -(CGFloat)viewCoordinateForViewLength:(NSDecimal)viewLength linearPlotRange:(non -(CGFloat)viewCoordinateForViewLength:(CGFloat)viewLength linearPlotRange:(nonnull CPTPlotRange *)range doublePrecisionPlotCoordinateValue:(double)plotCoord { - if ( !range || (range.lengthDouble == 0.0) ) { + if ( !range || (range.lengthDouble == 0.0)) { return CPTFloat(0.0); } - return viewLength * (CGFloat)( (plotCoord - range.locationDouble) / range.lengthDouble ); + return viewLength * (CGFloat)((plotCoord - range.locationDouble) / range.lengthDouble); } -(NSDecimal)plotCoordinateForViewLength:(NSDecimal)viewLength linearPlotRange:(nonnull CPTPlotRange *)range boundsLength:(NSDecimal)boundsLength { const NSDecimal zero = CPTDecimalFromInteger(0); - if ( CPTDecimalEquals(boundsLength, zero) ) { + if ( CPTDecimalEquals(boundsLength, zero)) { return zero; } @@ -929,7 +929,7 @@ -(NSDecimal)plotCoordinateForViewLength:(NSDecimal)viewLength linearPlotRange:(n -(double)doublePrecisionPlotCoordinateForViewLength:(CGFloat)viewLength linearPlotRange:(nonnull CPTPlotRange *)range boundsLength:(CGFloat)boundsLength { - if ( boundsLength == CPTFloat(0.0) ) { + if ( boundsLength == CPTFloat(0.0)) { return 0.0; } @@ -943,7 +943,7 @@ -(double)doublePrecisionPlotCoordinateForViewLength:(CGFloat)viewLength linearPl // Log (only one version since there are no transcendental functions for NSDecimal) -(CGFloat)viewCoordinateForViewLength:(CGFloat)viewLength logPlotRange:(nonnull CPTPlotRange *)range doublePrecisionPlotCoordinateValue:(double)plotCoord { - if ( (range.minLimitDouble <= 0.0) || (range.maxLimitDouble <= 0.0) || (plotCoord <= 0.0) ) { + if ((range.minLimitDouble <= 0.0) || (range.maxLimitDouble <= 0.0) || (plotCoord <= 0.0)) { return CPTFloat(0.0); } @@ -951,12 +951,12 @@ -(CGFloat)viewCoordinateForViewLength:(CGFloat)viewLength logPlotRange:(nonnull double logCoord = log10(plotCoord); double logEnd = log10(range.endDouble); - return viewLength * (CGFloat)( (logCoord - logLoc) / (logEnd - logLoc) ); + return viewLength * (CGFloat)((logCoord - logLoc) / (logEnd - logLoc)); } -(double)doublePrecisionPlotCoordinateForViewLength:(CGFloat)viewLength logPlotRange:(nonnull CPTPlotRange *)range boundsLength:(CGFloat)boundsLength { - if ( boundsLength == CPTFloat(0.0) ) { + if ( boundsLength == CPTFloat(0.0)) { return 0.0; } @@ -979,12 +979,12 @@ -(CGFloat)viewCoordinateForViewLength:(CGFloat)viewLength logModulusPlotRange:(n double logCoord = CPTLogModulus(plotCoord); double logEnd = CPTLogModulus(range.endDouble); - return viewLength * (CGFloat)( (logCoord - logLoc) / (logEnd - logLoc) ); + return viewLength * (CGFloat)((logCoord - logLoc) / (logEnd - logLoc)); } -(double)doublePrecisionPlotCoordinateForViewLength:(CGFloat)viewLength logModulusPlotRange:(nonnull CPTPlotRange *)range boundsLength:(CGFloat)boundsLength { - if ( boundsLength == CPTFloat(0.0) ) { + if ( boundsLength == CPTFloat(0.0)) { return 0.0; } @@ -1418,7 +1418,7 @@ -(void)scaleBy:(CGFloat)interactionScale aboutPoint:(CGPoint)plotAreaPoint CPTGraph *theGraph = self.graph; CPTPlotArea *plotArea = theGraph.plotAreaFrame.plotArea; - if ( !plotArea || ( interactionScale <= CPTFloat(1.e-6) ) ) { + if ( !plotArea || (interactionScale <= CPTFloat(1.e-6))) { return; } if ( ![plotArea containsPoint:plotAreaPoint] ) { @@ -1451,7 +1451,7 @@ -(void)scaleBy:(CGFloat)interactionScale aboutPoint:(CGPoint)plotAreaPoint // New locations NSDecimal newLocationX; - if ( CPTDecimalGreaterThanOrEqualTo( oldRangeX.lengthDecimal, CPTDecimalFromInteger(0) ) ) { + if ( CPTDecimalGreaterThanOrEqualTo(oldRangeX.lengthDecimal, CPTDecimalFromInteger(0))) { NSDecimal oldFirstLengthX = CPTDecimalSubtract(plotInteractionPoint[CPTCoordinateX], oldRangeX.minLimitDecimal); // x - minX NSDecimal newFirstLengthX = CPTDecimalDivide(oldFirstLengthX, decimalScale); // (x - minX) / scale newLocationX = CPTDecimalSubtract(plotInteractionPoint[CPTCoordinateX], newFirstLengthX); @@ -1463,7 +1463,7 @@ -(void)scaleBy:(CGFloat)interactionScale aboutPoint:(CGPoint)plotAreaPoint } NSDecimal newLocationY; - if ( CPTDecimalGreaterThanOrEqualTo( oldRangeY.lengthDecimal, CPTDecimalFromInteger(0) ) ) { + if ( CPTDecimalGreaterThanOrEqualTo(oldRangeY.lengthDecimal, CPTDecimalFromInteger(0))) { NSDecimal oldFirstLengthY = CPTDecimalSubtract(plotInteractionPoint[CPTCoordinateY], oldRangeY.minLimitDecimal); // y - minY NSDecimal newFirstLengthY = CPTDecimalDivide(oldFirstLengthY, decimalScale); // (y - minY) / scale newLocationY = CPTDecimalSubtract(plotInteractionPoint[CPTCoordinateY], newFirstLengthY); @@ -1601,7 +1601,7 @@ -(BOOL)pointingDeviceUpEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)in NSTimeInterval deltaT = event.timestamp - self.lastDragTime; NSTimeInterval lastDeltaT = self.lastDeltaTime; - if ( (deltaT > 0.0) && (deltaT < 0.05) && (lastDeltaT > 0.0) ) { + if ((deltaT > 0.0) && (deltaT < 0.05) && (lastDeltaT > 0.0)) { CGPoint pointInPlotArea = [theGraph convertPoint:interactionPoint toLayer:plotArea]; CGPoint displacement = self.lastDisplacement; @@ -1609,7 +1609,7 @@ -(BOOL)pointingDeviceUpEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)in speed = sqrt(displacement.x * displacement.x + displacement.y * displacement.y) / CPTFloat(lastDeltaT); momentumTime = speed / (CPTFloat(2.0) * acceleration); CGFloat distanceTraveled = speed * momentumTime - CPTFloat(0.5) * acceleration * momentumTime * momentumTime; - distanceTraveled = MAX( distanceTraveled, CPTFloat(0.0) ); + distanceTraveled = MAX(distanceTraveled, CPTFloat(0.0)); CGFloat theta = atan2(displacement.y, displacement.x); scaleX = cos(theta); @@ -1755,13 +1755,13 @@ -(nullable CPTPlotRange *)shiftRange:(nonnull CPTPlotRange *)oldRange by:(NSDeci // reduce the shift as we get farther outside the global range NSDecimal rangeLength = newRange.lengthDecimal; - if ( !CPTDecimalEquals( rangeLength, CPTDecimalFromInteger(0) ) ) { + if ( !CPTDecimalEquals(rangeLength, CPTDecimalFromInteger(0))) { NSDecimal diff = CPTDecimalDivide(CPTDecimalSubtract(constrainedRange.locationDecimal, newRange.locationDecimal), rangeLength); - diff = CPTDecimalMax( CPTDecimalMin( CPTDecimalMultiply( diff, CPTDecimalFromDouble(2.5) ), CPTDecimalFromInteger(1) ), CPTDecimalFromInteger(-1) ); + diff = CPTDecimalMax(CPTDecimalMin(CPTDecimalMultiply(diff, CPTDecimalFromDouble(2.5)), CPTDecimalFromInteger(1)), CPTDecimalFromInteger(-1)); - newRange.locationDecimal = CPTDecimalSubtract( newRange.locationDecimal, CPTDecimalMultiply( shift, CPTDecimalAbs(diff) ) ); + newRange.locationDecimal = CPTDecimalSubtract(newRange.locationDecimal, CPTDecimalMultiply(shift, CPTDecimalAbs(diff))); - *displacement = *displacement * ( CPTFloat(1.0) - ABS( CPTDecimalCGFloatValue(diff) ) ); + *displacement = *displacement * (CPTFloat(1.0) - ABS(CPTDecimalCGFloatValue(diff))); } } } @@ -1845,6 +1845,7 @@ -(BOOL)scrollWheelEvent:(nonnull CPTNativeEvent *)event fromPoint:(CGPoint)fromP return YES; } + #endif /** diff --git a/framework/Source/CPTXYPlotSpaceTests.m b/framework/Source/CPTXYPlotSpaceTests.m index 1185faedf..888b6045d 100644 --- a/framework/Source/CPTXYPlotSpaceTests.m +++ b/framework/Source/CPTXYPlotSpaceTests.m @@ -146,7 +146,7 @@ -(void)testViewPointForPlotPointArrayLog plotSpace.yRange = [CPTPlotRange plotRangeWithLocation:@1.0 length:@9.0]; - CPTNumberArray *plotPoint = @[@( sqrt(10.0) ), @( sqrt(10.0) )]; + CPTNumberArray *plotPoint = @[@(sqrt(10.0)), @(sqrt(10.0))]; CGPoint viewPoint = [plotSpace plotAreaViewPointForPlotPoint:plotPoint]; @@ -177,8 +177,8 @@ -(void)testViewPointForPlotPointLog length:@9.0]; NSDecimal plotPoint[2]; - plotPoint[CPTCoordinateX] = CPTDecimalFromDouble( sqrt(10.0) ); - plotPoint[CPTCoordinateY] = CPTDecimalFromDouble( sqrt(10.0) ); + plotPoint[CPTCoordinateX] = CPTDecimalFromDouble(sqrt(10.0)); + plotPoint[CPTCoordinateY] = CPTDecimalFromDouble(sqrt(10.0)); CGPoint viewPoint = [plotSpace plotAreaViewPointForPlotPoint:plotPoint numberOfCoordinates:2]; @@ -315,9 +315,9 @@ -(void)testPlotPointArrayForViewPointLinear NSString *errMessage; errMessage = [NSString stringWithFormat:@"plotPoint[CPTCoordinateX] was %@", plotPoint[CPTCoordinateX]]; - XCTAssertTrue(CPTDecimalEquals( [plotPoint[CPTCoordinateX] decimalValue], CPTDecimalFromDouble(5.0) ), @"%@", errMessage); + XCTAssertTrue(CPTDecimalEquals([plotPoint[CPTCoordinateX] decimalValue], CPTDecimalFromDouble(5.0)), @"%@", errMessage); errMessage = [NSString stringWithFormat:@"plotPoint[CPTCoordinateY] was %@", plotPoint[CPTCoordinateY]]; - XCTAssertTrue(CPTDecimalEquals( [plotPoint[CPTCoordinateY] decimalValue], CPTDecimalFromDouble(5.0) ), @"%@", errMessage); + XCTAssertTrue(CPTDecimalEquals([plotPoint[CPTCoordinateY] decimalValue], CPTDecimalFromDouble(5.0)), @"%@", errMessage); } -(void)testPlotPointForViewPointLinear @@ -339,9 +339,9 @@ -(void)testPlotPointForViewPointLinear [plotSpace plotPoint:plotPoint numberOfCoordinates:2 forPlotAreaViewPoint:viewPoint]; errMessage = [NSString stringWithFormat:@"plotPoint[CPTCoordinateX] was %@", NSDecimalString(&plotPoint[CPTCoordinateX], nil)]; - XCTAssertTrue(CPTDecimalEquals( plotPoint[CPTCoordinateX], CPTDecimalFromDouble(5.0) ), @"%@", errMessage); + XCTAssertTrue(CPTDecimalEquals(plotPoint[CPTCoordinateX], CPTDecimalFromDouble(5.0)), @"%@", errMessage); errMessage = [NSString stringWithFormat:@"plotPoint[CPTCoordinateY] was %@", NSDecimalString(&plotPoint[CPTCoordinateY], nil)]; - XCTAssertTrue(CPTDecimalEquals( plotPoint[CPTCoordinateY], CPTDecimalFromDouble(5.0) ), @"%@", errMessage); + XCTAssertTrue(CPTDecimalEquals(plotPoint[CPTCoordinateY], CPTDecimalFromDouble(5.0)), @"%@", errMessage); } -(void)testDoublePrecisionPlotPointForViewPointLinear @@ -414,9 +414,9 @@ -(void)testPlotPointForViewPointLog [plotSpace plotPoint:plotPoint numberOfCoordinates:2 forPlotAreaViewPoint:viewPoint]; errMessage = [NSString stringWithFormat:@"plotPoint[CPTCoordinateX] was %@", NSDecimalString(&plotPoint[CPTCoordinateX], nil)]; - XCTAssertTrue(CPTDecimalEquals( plotPoint[CPTCoordinateX], CPTDecimalFromDouble( sqrt(10.0) ) ), @"%@", errMessage); + XCTAssertTrue(CPTDecimalEquals(plotPoint[CPTCoordinateX], CPTDecimalFromDouble(sqrt(10.0))), @"%@", errMessage); errMessage = [NSString stringWithFormat:@"plotPoint[CPTCoordinateY] was %@", NSDecimalString(&plotPoint[CPTCoordinateY], nil)]; - XCTAssertTrue(CPTDecimalEquals( plotPoint[CPTCoordinateY], CPTDecimalFromDouble( sqrt(10.0) ) ), @"%@", errMessage); + XCTAssertTrue(CPTDecimalEquals(plotPoint[CPTCoordinateY], CPTDecimalFromDouble(sqrt(10.0))), @"%@", errMessage); } -(void)testDoublePrecisionPlotPointForViewPointLog @@ -465,7 +465,7 @@ -(void)testPlotPointArrayForViewPointLogModulus [plotSpace plotPointForPlotAreaViewPoint:viewPoint]; errMessage = [NSString stringWithFormat:@"plotPoint[CPTCoordinateX] was %@", plotPoint[CPTCoordinateX]]; - XCTAssertEqualWithAccuracy([plotPoint[CPTCoordinateX] doubleValue], CPTInverseLogModulus(1.0), CPTFloat(0.01), @"%@", errMessage); + XCTAssertEqualWithAccuracy([plotPoint[CPTCoordinateX] doubleValue], CPTInverseLogModulus(1.0), 0.01, @"%@", errMessage); errMessage = [NSString stringWithFormat:@"plotPoint[CPTCoordinateY] was %@", plotPoint[CPTCoordinateY]]; XCTAssertEqual([plotPoint[CPTCoordinateY] doubleValue], 0.0, @"%@", errMessage); } @@ -489,9 +489,9 @@ -(void)testPlotPointForViewPointLogModulus [plotSpace plotPoint:plotPoint numberOfCoordinates:2 forPlotAreaViewPoint:viewPoint]; errMessage = [NSString stringWithFormat:@"plotPoint[CPTCoordinateX] was %@", NSDecimalString(&plotPoint[CPTCoordinateX], nil)]; - XCTAssertTrue(CPTDecimalEquals( plotPoint[CPTCoordinateX], CPTDecimalFromInteger(0) ), @"%@", errMessage); + XCTAssertTrue(CPTDecimalEquals(plotPoint[CPTCoordinateX], CPTDecimalFromInteger(0)), @"%@", errMessage); errMessage = [NSString stringWithFormat:@"plotPoint[CPTCoordinateY] was %@", NSDecimalString(&plotPoint[CPTCoordinateY], nil)]; - XCTAssertTrue(CPTDecimalEquals( plotPoint[CPTCoordinateY], CPTDecimalFromInteger(0) ), @"%@", errMessage); + XCTAssertTrue(CPTDecimalEquals(plotPoint[CPTCoordinateY], CPTDecimalFromInteger(0)), @"%@", errMessage); } -(void)testDoublePrecisionPlotPointForViewPointLogModulus @@ -513,7 +513,7 @@ -(void)testDoublePrecisionPlotPointForViewPointLogModulus [plotSpace doublePrecisionPlotPoint:plotPoint numberOfCoordinates:2 forPlotAreaViewPoint:viewPoint]; errMessage = [NSString stringWithFormat:@"plotPoint[CPTCoordinateX] was %g", plotPoint[CPTCoordinateX]]; - XCTAssertEqualWithAccuracy(plotPoint[CPTCoordinateX], CPTInverseLogModulus(1.0), CPTFloat(0.01), @"%@", errMessage); + XCTAssertEqualWithAccuracy(plotPoint[CPTCoordinateX], CPTInverseLogModulus(1.0), 0.01, @"%@", errMessage); errMessage = [NSString stringWithFormat:@"plotPoint[CPTCoordinateY] was %g", plotPoint[CPTCoordinateY]]; XCTAssertEqual(plotPoint[CPTCoordinateY], 0.0, @"%@", errMessage); } @@ -610,7 +610,7 @@ -(void)testScaleByAboutPoint1 CGRect myBounds = self.graph.bounds; - [plotSpace scaleBy:0.5 aboutPoint:CGPointMake( CGRectGetMidX(myBounds), CGRectGetMidY(myBounds) )]; + [plotSpace scaleBy:0.5 aboutPoint:CGPointMake(CGRectGetMidX(myBounds), CGRectGetMidY(myBounds))]; CPTPlotRange *expectedRangeX = [CPTPlotRange plotRangeWithLocation:@(-5.0) length:@20.0]; @@ -637,7 +637,7 @@ -(void)testScaleByAboutPoint2 CGRect myBounds = self.graph.bounds; - [plotSpace scaleBy:2.0 aboutPoint:CGPointMake( CGRectGetMidX(myBounds), CGRectGetMidY(myBounds) )]; + [plotSpace scaleBy:2.0 aboutPoint:CGPointMake(CGRectGetMidX(myBounds), CGRectGetMidY(myBounds))]; CPTPlotRange *expectedRangeX = [CPTPlotRange plotRangeWithLocation:@2.5 length:@5.0]; diff --git a/framework/Source/NSCoderExtensions.m b/framework/Source/NSCoderExtensions.m index a527f68c7..cfa40b7f7 100644 --- a/framework/Source/NSCoderExtensions.m +++ b/framework/Source/NSCoderExtensions.m @@ -72,13 +72,27 @@ -(void)encodeCPTRect:(CGRect)rect forKey:(nonnull NSString *)key * @param key The key to associate with the color space. * @note The current implementation only works with named color spaces. **/ +#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunused-parameter" +#endif -(void)encodeCGColorSpace:(nullable CGColorSpaceRef)colorSpace forKey:(nonnull NSString *)key { #if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE NSLog(@"Color space encoding is not supported on iOS. Decoding will return a generic RGB color space."); +#pragma clang diagnostic pop #else if ( colorSpace ) { - CFDataRef iccProfile = CGColorSpaceCopyICCProfile(colorSpace); + CFDataRef iccProfile = NULL; + + // CGColorSpaceCopyICCProfile() is deprecated as of macOS 10.13 + if ( CGColorSpaceCopyICCData ) { + iccProfile = CGColorSpaceCopyICCData(colorSpace); + } + else { + iccProfile = CGColorSpaceCopyICCProfile(colorSpace); + } + [self encodeObject:(__bridge NSData *)iccProfile forKey:key]; CFRelease(iccProfile); } @@ -228,7 +242,7 @@ -(void)encodeCGImage:(nullable CGImageRef)image forKey:(nonnull NSString *)key [self encodeBool:CGImageGetShouldInterpolate(image) forKey:newKey]; newKey = [[NSString alloc] initWithFormat:@"%@.renderingIntent", key]; - [self encodeInt:CGImageGetRenderingIntent(image) forKey:newKey]; + [self encodeInt32:CGImageGetRenderingIntent(image) forKey:newKey]; } /** @brief Encodes an @ref NSDecimal and associates it with the string @par{key}. @@ -253,7 +267,6 @@ -(CGFloat)decodeCGFloatForKey:(nonnull NSString *)key { #if CGFLOAT_IS_DOUBLE return [self decodeDoubleForKey:key]; - #else return [self decodeFloatForKey:key]; #endif @@ -326,6 +339,10 @@ -(CGRect)decodeCPTRectForKey:(nonnull NSString *)key * @return The new path. * @note The current implementation only works with named color spaces. **/ +#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunused-parameter" +#endif -(nullable CGColorSpaceRef)newCGColorSpaceDecodeForKey:(nonnull NSString *)key { CGColorSpaceRef colorSpace = NULL; @@ -333,11 +350,18 @@ -(nullable CGColorSpaceRef)newCGColorSpaceDecodeForKey:(nonnull NSString *)key #if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE NSLog(@"Color space decoding is not supported on iOS. Using generic RGB color space."); colorSpace = CGColorSpaceCreateDeviceRGB(); +#pragma clang diagnostic pop #else NSData *iccProfile = [self decodeObjectOfClass:[NSData class] forKey:key]; if ( iccProfile ) { - colorSpace = CGColorSpaceCreateWithICCProfile( (__bridge CFDataRef)iccProfile ); + // CGColorSpaceCreateWithICCProfile() is deprecated as of macOS 10.13 + if ( CGColorSpaceCreateWithICCData ) { + colorSpace = CGColorSpaceCreateWithICCData((__bridge CFDataRef)iccProfile); + } + else { + colorSpace = CGColorSpaceCreateWithICCProfile((__bridge CFDataRef)iccProfile); + } } else { NSLog(@"Color space not available for key '%@'. Using generic RGB color space.", key); @@ -447,15 +471,15 @@ -(nullable CGImageRef)newCGImageDecodeForKey:(nonnull NSString *)key const CGBitmapInfo *bitmapInfo = (const void *)[self decodeBytesForKey:newKey returnedLength:&length]; newKey = [[NSString alloc] initWithFormat:@"%@.provider", key]; - CGDataProviderRef provider = CGDataProviderCreateWithCFData( (__bridge CFDataRef)[self decodeObjectOfClass:[NSData class] - forKey:newKey] ); + CGDataProviderRef provider = CGDataProviderCreateWithCFData((__bridge CFDataRef)[self decodeObjectOfClass:[NSData class] + forKey:newKey]); newKey = [[NSString alloc] initWithFormat:@"%@.numberOfComponents", key]; size_t numberOfComponents = (size_t)[self decodeInt64ForKey:newKey]; CGFloat *decodeArray = NULL; if ( numberOfComponents ) { - decodeArray = malloc( numberOfComponents * 2 * sizeof(CGFloat) ); + decodeArray = calloc((numberOfComponents * 2), sizeof(CGFloat)); for ( size_t i = 0; i < numberOfComponents; i++ ) { newKey = [[NSString alloc] initWithFormat:@"%@.decode[%zu].lower", key, i]; @@ -470,7 +494,7 @@ -(nullable CGImageRef)newCGImageDecodeForKey:(nonnull NSString *)key bool shouldInterpolate = [self decodeBoolForKey:newKey]; newKey = [[NSString alloc] initWithFormat:@"%@.renderingIntent", key]; - CGColorRenderingIntent intent = (CGColorRenderingIntent)[self decodeIntForKey:newKey]; + CGColorRenderingIntent intent = (CGColorRenderingIntent)[self decodeInt32ForKey:newKey]; CGImageRef newImage = CGImageCreate(width, height, diff --git a/framework/Source/NSNumberExtensions.m b/framework/Source/NSNumberExtensions.m index 3f49c824f..a9ee47ab0 100644 --- a/framework/Source/NSNumberExtensions.m +++ b/framework/Source/NSNumberExtensions.m @@ -18,7 +18,6 @@ -(CGFloat)cgFloatValue { #if CGFLOAT_IS_DOUBLE return self.doubleValue; - #else return [self floatValue]; #endif @@ -32,7 +31,6 @@ -(nonnull instancetype)initWithCGFloat:(CGFloat)number { #if CGFLOAT_IS_DOUBLE return [self initWithDouble:number]; - #else return [self initWithFloat:number]; #endif diff --git a/framework/Source/_CPTAnimationCGFloatPeriod.m b/framework/Source/_CPTAnimationCGFloatPeriod.m index 3d5cde004..1bcf82cea 100644 --- a/framework/Source/_CPTAnimationCGFloatPeriod.m +++ b/framework/Source/_CPTAnimationCGFloatPeriod.m @@ -31,7 +31,7 @@ CGFloat CPTCurrentFloatValue(id __nonnull boundObject, SEL __nonnull boundGetter -(void)setStartValueFromObject:(nonnull id)boundObject propertyGetter:(nonnull SEL)boundGetter { - self.startValue = @( CPTCurrentFloatValue(boundObject, boundGetter) ); + self.startValue = @(CPTCurrentFloatValue(boundObject, boundGetter)); } -(BOOL)canStartWithValueFromObject:(nonnull id)boundObject propertyGetter:(nonnull SEL)boundGetter @@ -47,7 +47,7 @@ -(BOOL)canStartWithValueFromObject:(nonnull id)boundObject propertyGetter:(nonnu [self.startValue getValue:&start]; [self.endValue getValue:&end]; - return ( (current >= start) && (current <= end) ) || ( (current >= end) && (current <= start) ); + return ((current >= start) && (current <= end)) || ((current >= end) && (current <= start)); } -(nonnull NSValue *)tweenedValueForProgress:(CGFloat)progress diff --git a/framework/Source/_CPTAnimationCGPointPeriod.m b/framework/Source/_CPTAnimationCGPointPeriod.m index 62a825574..bb6246379 100644 --- a/framework/Source/_CPTAnimationCGPointPeriod.m +++ b/framework/Source/_CPTAnimationCGPointPeriod.m @@ -47,8 +47,8 @@ -(BOOL)canStartWithValueFromObject:(nonnull id)boundObject propertyGetter:(nonnu [self.startValue getValue:&start]; [self.endValue getValue:&end]; - return ( ( (current.x >= start.x) && (current.x <= end.x) ) || ( (current.x >= end.x) && (current.x <= start.x) ) ) && - ( ( (current.y >= start.y) && (current.y <= end.y) ) || ( (current.y >= end.y) && (current.y <= start.y) ) ); + return (((current.x >= start.x) && (current.x <= end.x)) || ((current.x >= end.x) && (current.x <= start.x))) && + (((current.y >= start.y) && (current.y <= end.y)) || ((current.y >= end.y) && (current.y <= start.y))); } -(nonnull NSValue *)tweenedValueForProgress:(CGFloat)progress diff --git a/framework/Source/_CPTAnimationCGRectPeriod.m b/framework/Source/_CPTAnimationCGRectPeriod.m index 2ab3fde6a..1e05bf9b8 100644 --- a/framework/Source/_CPTAnimationCGRectPeriod.m +++ b/framework/Source/_CPTAnimationCGRectPeriod.m @@ -47,10 +47,10 @@ -(BOOL)canStartWithValueFromObject:(nonnull id)boundObject propertyGetter:(nonnu [self.startValue getValue:&start]; [self.endValue getValue:&end]; - return ( ( (current.origin.x >= start.origin.x) && (current.origin.x <= end.origin.x) ) || ( (current.origin.x >= end.origin.x) && (current.origin.x <= start.origin.x) ) ) && - ( ( (current.origin.y >= start.origin.y) && (current.origin.y <= end.origin.y) ) || ( (current.origin.y >= end.origin.y) && (current.origin.y <= start.origin.y) ) ) && - ( ( (current.size.width >= start.size.width) && (current.size.width <= end.size.width) ) || ( (current.size.width >= end.size.width) && (current.size.width <= start.size.width) ) ) && - ( ( (current.size.height >= start.size.height) && (current.size.height <= end.size.height) ) || ( (current.size.height >= end.size.height) && (current.size.height <= start.size.height) ) ); + return (((current.origin.x >= start.origin.x) && (current.origin.x <= end.origin.x)) || ((current.origin.x >= end.origin.x) && (current.origin.x <= start.origin.x))) && + (((current.origin.y >= start.origin.y) && (current.origin.y <= end.origin.y)) || ((current.origin.y >= end.origin.y) && (current.origin.y <= start.origin.y))) && + (((current.size.width >= start.size.width) && (current.size.width <= end.size.width)) || ((current.size.width >= end.size.width) && (current.size.width <= start.size.width))) && + (((current.size.height >= start.size.height) && (current.size.height <= end.size.height)) || ((current.size.height >= end.size.height) && (current.size.height <= start.size.height))); } -(nonnull NSValue *)tweenedValueForProgress:(CGFloat)progress diff --git a/framework/Source/_CPTAnimationCGSizePeriod.m b/framework/Source/_CPTAnimationCGSizePeriod.m index 89499b687..e0b54f48e 100644 --- a/framework/Source/_CPTAnimationCGSizePeriod.m +++ b/framework/Source/_CPTAnimationCGSizePeriod.m @@ -47,8 +47,8 @@ -(BOOL)canStartWithValueFromObject:(nonnull id)boundObject propertyGetter:(nonnu [self.startValue getValue:&start]; [self.endValue getValue:&end]; - return ( ( (current.width >= start.width) && (current.width <= end.width) ) || ( (current.width >= end.width) && (current.width <= start.width) ) ) && - ( ( (current.height >= start.height) && (current.height <= end.height) ) || ( (current.height >= end.height) && (current.height <= start.height) ) ); + return (((current.width >= start.width) && (current.width <= end.width)) || ((current.width >= end.width) && (current.width <= start.width))) && + (((current.height >= start.height) && (current.height <= end.height)) || ((current.height >= end.height) && (current.height <= start.height))); } -(nonnull NSValue *)tweenedValueForProgress:(CGFloat)progress diff --git a/framework/Source/_CPTAnimationNSDecimalPeriod.m b/framework/Source/_CPTAnimationNSDecimalPeriod.m index f70877093..bcf36e651 100644 --- a/framework/Source/_CPTAnimationNSDecimalPeriod.m +++ b/framework/Source/_CPTAnimationNSDecimalPeriod.m @@ -43,20 +43,20 @@ -(BOOL)canStartWithValueFromObject:(nonnull id)boundObject propertyGetter:(nonnu } NSDecimal current = CPTCurrentDecimalValue(boundObject, boundGetter); - NSDecimal start = ( (NSDecimalNumber *)self.startValue ).decimalValue; - NSDecimal end = ( (NSDecimalNumber *)self.endValue ).decimalValue; + NSDecimal start = ((NSDecimalNumber *)self.startValue).decimalValue; + NSDecimal end = ((NSDecimalNumber *)self.endValue).decimalValue; - return ( CPTDecimalGreaterThanOrEqualTo(current, start) && CPTDecimalLessThanOrEqualTo(current, end) ) || - ( CPTDecimalGreaterThanOrEqualTo(current, end) && CPTDecimalLessThanOrEqualTo(current, start) ); + return (CPTDecimalGreaterThanOrEqualTo(current, start) && CPTDecimalLessThanOrEqualTo(current, end)) || + (CPTDecimalGreaterThanOrEqualTo(current, end) && CPTDecimalLessThanOrEqualTo(current, start)); } -(nonnull NSValue *)tweenedValueForProgress:(CGFloat)progress { - NSDecimal start = ( (NSDecimalNumber *)self.startValue ).decimalValue; - NSDecimal end = ( (NSDecimalNumber *)self.endValue ).decimalValue; + NSDecimal start = ((NSDecimalNumber *)self.startValue).decimalValue; + NSDecimal end = ((NSDecimalNumber *)self.endValue).decimalValue; NSDecimal length = CPTDecimalSubtract(end, start); - NSDecimal tweenedValue = CPTDecimalAdd( start, CPTDecimalMultiply(CPTDecimalFromCGFloat(progress), length) ); + NSDecimal tweenedValue = CPTDecimalAdd(start, CPTDecimalMultiply(CPTDecimalFromCGFloat(progress), length)); return [NSDecimalNumber decimalNumberWithDecimal:tweenedValue]; } diff --git a/framework/Source/_CPTAnimationNSNumberPeriod.m b/framework/Source/_CPTAnimationNSNumberPeriod.m index 362e4a309..e4692f041 100644 --- a/framework/Source/_CPTAnimationNSNumberPeriod.m +++ b/framework/Source/_CPTAnimationNSNumberPeriod.m @@ -32,16 +32,16 @@ -(BOOL)canStartWithValueFromObject:(id)boundObject propertyGetter:(SEL)boundGett NSDecimal startDecimal = start.decimalValue; NSDecimal endDecimal = end.decimalValue; - return ( CPTDecimalGreaterThanOrEqualTo(currentDecimal, startDecimal) && CPTDecimalLessThanOrEqualTo(currentDecimal, endDecimal) ) || - ( CPTDecimalGreaterThanOrEqualTo(currentDecimal, endDecimal) && CPTDecimalLessThanOrEqualTo(currentDecimal, startDecimal) ); + return (CPTDecimalGreaterThanOrEqualTo(currentDecimal, startDecimal) && CPTDecimalLessThanOrEqualTo(currentDecimal, endDecimal)) || + (CPTDecimalGreaterThanOrEqualTo(currentDecimal, endDecimal) && CPTDecimalLessThanOrEqualTo(currentDecimal, startDecimal)); } else { double currentDouble = current.doubleValue; double startDouble = start.doubleValue; double endDouble = end.doubleValue; - return ( (currentDouble >= startDouble) && (currentDouble <= endDouble) ) || - ( (currentDouble >= endDouble) && (currentDouble <= startDouble) ); + return ((currentDouble >= startDouble) && (currentDouble <= endDouble)) || + ((currentDouble >= endDouble) && (currentDouble <= startDouble)); } } @@ -57,7 +57,7 @@ -(NSValue *)tweenedValueForProgress:(CGFloat)progress NSDecimal endDecimal = end.decimalValue; NSDecimal length = CPTDecimalSubtract(endDecimal, startDecimal); - NSDecimal tweenedValue = CPTDecimalAdd( startDecimal, CPTDecimalMultiply(CPTDecimalFromCGFloat(progress), length) ); + NSDecimal tweenedValue = CPTDecimalAdd(startDecimal, CPTDecimalMultiply(CPTDecimalFromCGFloat(progress), length)); return [NSDecimalNumber decimalNumberWithDecimal:tweenedValue]; } diff --git a/framework/Source/_CPTAnimationPlotRangePeriod.m b/framework/Source/_CPTAnimationPlotRangePeriod.m index fdcabbb21..857d65506 100644 --- a/framework/Source/_CPTAnimationPlotRangePeriod.m +++ b/framework/Source/_CPTAnimationPlotRangePeriod.m @@ -30,8 +30,8 @@ -(BOOL)canStartWithValueFromObject:(nonnull id)boundObject propertyGetter:(nonnu NSDecimal startLoc = start.locationDecimal; NSDecimal endLoc = end.locationDecimal; - return ( CPTDecimalGreaterThanOrEqualTo(currentLoc, startLoc) && CPTDecimalLessThanOrEqualTo(currentLoc, endLoc) ) || - ( CPTDecimalGreaterThanOrEqualTo(currentLoc, endLoc) && CPTDecimalLessThanOrEqualTo(currentLoc, startLoc) ); + return (CPTDecimalGreaterThanOrEqualTo(currentLoc, startLoc) && CPTDecimalLessThanOrEqualTo(currentLoc, endLoc)) || + (CPTDecimalGreaterThanOrEqualTo(currentLoc, endLoc) && CPTDecimalLessThanOrEqualTo(currentLoc, startLoc)); } -(nonnull NSValue *)tweenedValueForProgress:(CGFloat)progress @@ -42,10 +42,10 @@ -(nonnull NSValue *)tweenedValueForProgress:(CGFloat)progress NSDecimal progressDecimal = CPTDecimalFromCGFloat(progress); NSDecimal locationDiff = CPTDecimalSubtract(end.locationDecimal, start.locationDecimal); - NSDecimal tweenedLocation = CPTDecimalAdd( start.locationDecimal, CPTDecimalMultiply(progressDecimal, locationDiff) ); + NSDecimal tweenedLocation = CPTDecimalAdd(start.locationDecimal, CPTDecimalMultiply(progressDecimal, locationDiff)); NSDecimal lengthDiff = CPTDecimalSubtract(end.lengthDecimal, start.lengthDecimal); - NSDecimal tweenedLength = CPTDecimalAdd( start.lengthDecimal, CPTDecimalMultiply(progressDecimal, lengthDiff) ); + NSDecimal tweenedLength = CPTDecimalAdd(start.lengthDecimal, CPTDecimalMultiply(progressDecimal, lengthDiff)); return (NSValue *)[CPTPlotRange plotRangeWithLocationDecimal:tweenedLocation lengthDecimal:tweenedLength]; } diff --git a/framework/Source/_CPTAnimationTimingFunctions.m b/framework/Source/_CPTAnimationTimingFunctions.m index a50417ad6..36b20aa6e 100644 --- a/framework/Source/_CPTAnimationTimingFunctions.m +++ b/framework/Source/_CPTAnimationTimingFunctions.m @@ -15,13 +15,13 @@ **/ CGFloat CPTAnimationTimingFunctionLinear(CGFloat elapsedTime, CGFloat duration) { - if ( elapsedTime <= CPTFloat(0.0) ) { + if ( elapsedTime <= CPTFloat(0.0)) { return CPTFloat(0.0); } elapsedTime /= duration; - if ( elapsedTime >= CPTFloat(1.0) ) { + if ( elapsedTime >= CPTFloat(1.0)) { return CPTFloat(1.0); } @@ -41,17 +41,17 @@ CGFloat CPTAnimationTimingFunctionBackIn(CGFloat elapsedTime, CGFloat duration) { const CGFloat s = CPTFloat(1.70158); - if ( elapsedTime <= CPTFloat(0.0) ) { + if ( elapsedTime <= CPTFloat(0.0)) { return CPTFloat(0.0); } elapsedTime /= duration; - if ( elapsedTime >= CPTFloat(1.0) ) { + if ( elapsedTime >= CPTFloat(1.0)) { return CPTFloat(1.0); } - return elapsedTime * elapsedTime * ( ( s + CPTFloat(1.0) ) * elapsedTime - s ); + return elapsedTime * elapsedTime * ((s + CPTFloat(1.0)) * elapsedTime - s); } /** @@ -64,17 +64,17 @@ CGFloat CPTAnimationTimingFunctionBackOut(CGFloat elapsedTime, CGFloat duration) { const CGFloat s = CPTFloat(1.70158); - if ( elapsedTime <= CPTFloat(0.0) ) { + if ( elapsedTime <= CPTFloat(0.0)) { return CPTFloat(0.0); } elapsedTime = elapsedTime / duration - CPTFloat(1.0); - if ( elapsedTime >= CPTFloat(0.0) ) { + if ( elapsedTime >= CPTFloat(0.0)) { return CPTFloat(1.0); } - return elapsedTime * elapsedTime * ( ( s + CPTFloat(1.0) ) * elapsedTime + s ) + CPTFloat(1.0); + return elapsedTime * elapsedTime * ((s + CPTFloat(1.0)) * elapsedTime + s) + CPTFloat(1.0); } /** @@ -87,23 +87,23 @@ CGFloat CPTAnimationTimingFunctionBackInOut(CGFloat elapsedTime, CGFloat duratio { const CGFloat s = CPTFloat(1.70158 * 1.525); - if ( elapsedTime <= CPTFloat(0.0) ) { + if ( elapsedTime <= CPTFloat(0.0)) { return CPTFloat(0.0); } elapsedTime /= duration * CPTFloat(0.5); - if ( elapsedTime >= CPTFloat(2.0) ) { + if ( elapsedTime >= CPTFloat(2.0)) { return CPTFloat(1.0); } - if ( elapsedTime < CPTFloat(1.0) ) { - return CPTFloat(0.5) * ( elapsedTime * elapsedTime * ( ( s + CPTFloat(1.0) ) * elapsedTime - s ) ); + if ( elapsedTime < CPTFloat(1.0)) { + return CPTFloat(0.5) * (elapsedTime * elapsedTime * ((s + CPTFloat(1.0)) * elapsedTime - s)); } else { elapsedTime -= CPTFloat(2.0); - return CPTFloat(0.5) * ( elapsedTime * elapsedTime * ( ( s + CPTFloat(1.0) ) * elapsedTime + s ) + CPTFloat(2.0) ); + return CPTFloat(0.5) * (elapsedTime * elapsedTime * ((s + CPTFloat(1.0)) * elapsedTime + s) + CPTFloat(2.0)); } } @@ -129,25 +129,25 @@ CGFloat CPTAnimationTimingFunctionBounceIn(CGFloat elapsedTime, CGFloat duration **/ CGFloat CPTAnimationTimingFunctionBounceOut(CGFloat elapsedTime, CGFloat duration) { - if ( elapsedTime <= CPTFloat(0.0) ) { + if ( elapsedTime <= CPTFloat(0.0)) { return CPTFloat(0.0); } elapsedTime /= duration; - if ( elapsedTime >= CPTFloat(1.0) ) { + if ( elapsedTime >= CPTFloat(1.0)) { return CPTFloat(1.0); } - if ( elapsedTime < CPTFloat(1.0 / 2.75) ) { + if ( elapsedTime < CPTFloat(1.0 / 2.75)) { return CPTFloat(7.5625) * elapsedTime * elapsedTime; } - else if ( elapsedTime < CPTFloat(2.0 / 2.75) ) { + else if ( elapsedTime < CPTFloat(2.0 / 2.75)) { elapsedTime -= CPTFloat(1.5 / 2.75); return CPTFloat(7.5625) * elapsedTime * elapsedTime + CPTFloat(0.75); } - else if ( elapsedTime < CPTFloat(2.5 / 2.75) ) { + else if ( elapsedTime < CPTFloat(2.5 / 2.75)) { elapsedTime -= CPTFloat(2.25 / 2.75); return CPTFloat(7.5625) * elapsedTime * elapsedTime + CPTFloat(0.9375); @@ -167,7 +167,7 @@ CGFloat CPTAnimationTimingFunctionBounceOut(CGFloat elapsedTime, CGFloat duratio **/ CGFloat CPTAnimationTimingFunctionBounceInOut(CGFloat elapsedTime, CGFloat duration) { - if ( elapsedTime < duration * CPTFloat(0.5) ) { + if ( elapsedTime < duration * CPTFloat(0.5)) { return CPTAnimationTimingFunctionBounceIn(elapsedTime * CPTFloat(2.0), duration) * CPTFloat(0.5); } else { @@ -187,17 +187,17 @@ CGFloat CPTAnimationTimingFunctionBounceInOut(CGFloat elapsedTime, CGFloat durat **/ CGFloat CPTAnimationTimingFunctionCircularIn(CGFloat elapsedTime, CGFloat duration) { - if ( elapsedTime <= CPTFloat(0.0) ) { + if ( elapsedTime <= CPTFloat(0.0)) { return CPTFloat(0.0); } elapsedTime /= duration; - if ( elapsedTime >= CPTFloat(1.0) ) { + if ( elapsedTime >= CPTFloat(1.0)) { return CPTFloat(1.0); } - return -( sqrt(CPTFloat(1.0) - elapsedTime * elapsedTime) - CPTFloat(1.0) ); + return -(sqrt(CPTFloat(1.0) - elapsedTime * elapsedTime) - CPTFloat(1.0)); } /** @@ -208,13 +208,13 @@ CGFloat CPTAnimationTimingFunctionCircularIn(CGFloat elapsedTime, CGFloat durati **/ CGFloat CPTAnimationTimingFunctionCircularOut(CGFloat elapsedTime, CGFloat duration) { - if ( elapsedTime <= CPTFloat(0.0) ) { + if ( elapsedTime <= CPTFloat(0.0)) { return CPTFloat(0.0); } elapsedTime = elapsedTime / duration - CPTFloat(1.0); - if ( elapsedTime >= CPTFloat(0.0) ) { + if ( elapsedTime >= CPTFloat(0.0)) { return CPTFloat(1.0); } @@ -229,23 +229,23 @@ CGFloat CPTAnimationTimingFunctionCircularOut(CGFloat elapsedTime, CGFloat durat **/ CGFloat CPTAnimationTimingFunctionCircularInOut(CGFloat elapsedTime, CGFloat duration) { - if ( elapsedTime <= CPTFloat(0.0) ) { + if ( elapsedTime <= CPTFloat(0.0)) { return CPTFloat(0.0); } elapsedTime /= duration * CPTFloat(0.5); - if ( elapsedTime >= CPTFloat(2.0) ) { + if ( elapsedTime >= CPTFloat(2.0)) { return CPTFloat(1.0); } - if ( elapsedTime < CPTFloat(1.0) ) { - return CPTFloat(-0.5) * ( sqrt(CPTFloat(1.0) - elapsedTime * elapsedTime) - CPTFloat(1.0) ); + if ( elapsedTime < CPTFloat(1.0)) { + return CPTFloat(-0.5) * (sqrt(CPTFloat(1.0) - elapsedTime * elapsedTime) - CPTFloat(1.0)); } else { elapsedTime -= CPTFloat(2.0); - return CPTFloat(0.5) * ( sqrt(CPTFloat(1.0) - elapsedTime * elapsedTime) + CPTFloat(1.0) ); + return CPTFloat(0.5) * (sqrt(CPTFloat(1.0) - elapsedTime * elapsedTime) + CPTFloat(1.0)); } } @@ -260,13 +260,13 @@ CGFloat CPTAnimationTimingFunctionCircularInOut(CGFloat elapsedTime, CGFloat dur **/ CGFloat CPTAnimationTimingFunctionElasticIn(CGFloat elapsedTime, CGFloat duration) { - if ( elapsedTime <= CPTFloat(0.0) ) { + if ( elapsedTime <= CPTFloat(0.0)) { return CPTFloat(0.0); } elapsedTime /= duration; - if ( elapsedTime >= CPTFloat(1.0) ) { + if ( elapsedTime >= CPTFloat(1.0)) { return CPTFloat(1.0); } @@ -275,7 +275,7 @@ CGFloat CPTAnimationTimingFunctionElasticIn(CGFloat elapsedTime, CGFloat duratio elapsedTime -= CPTFloat(1.0); - return -( pow(CPTFloat(2.0), CPTFloat(10.0) * elapsedTime) * sin( (elapsedTime * duration - s) * CPTFloat(2.0 * M_PI) / period ) ); + return -(pow(CPTFloat(2.0), CPTFloat(10.0) * elapsedTime) * sin((elapsedTime * duration - s) * CPTFloat(2.0 * M_PI) / period)); } /** @@ -286,20 +286,20 @@ CGFloat CPTAnimationTimingFunctionElasticIn(CGFloat elapsedTime, CGFloat duratio **/ CGFloat CPTAnimationTimingFunctionElasticOut(CGFloat elapsedTime, CGFloat duration) { - if ( elapsedTime <= CPTFloat(0.0) ) { + if ( elapsedTime <= CPTFloat(0.0)) { return CPTFloat(0.0); } elapsedTime /= duration; - if ( elapsedTime >= CPTFloat(1.0) ) { + if ( elapsedTime >= CPTFloat(1.0)) { return CPTFloat(1.0); } CGFloat period = duration * CPTFloat(0.3); CGFloat s = period * CPTFloat(0.25); - return pow(CPTFloat(2.0), CPTFloat(-10.0) * elapsedTime) * sin( (elapsedTime * duration - s) * CPTFloat(2.0 * M_PI) / period ) + CPTFloat(1.0); + return pow(CPTFloat(2.0), CPTFloat(-10.0) * elapsedTime) * sin((elapsedTime * duration - s) * CPTFloat(2.0 * M_PI) / period) + CPTFloat(1.0); } /** @@ -310,13 +310,13 @@ CGFloat CPTAnimationTimingFunctionElasticOut(CGFloat elapsedTime, CGFloat durati **/ CGFloat CPTAnimationTimingFunctionElasticInOut(CGFloat elapsedTime, CGFloat duration) { - if ( elapsedTime <= CPTFloat(0.0) ) { + if ( elapsedTime <= CPTFloat(0.0)) { return CPTFloat(0.0); } elapsedTime /= duration * CPTFloat(0.5); - if ( elapsedTime >= CPTFloat(2.0) ) { + if ( elapsedTime >= CPTFloat(2.0)) { return CPTFloat(1.0); } @@ -325,11 +325,11 @@ CGFloat CPTAnimationTimingFunctionElasticInOut(CGFloat elapsedTime, CGFloat dura elapsedTime -= CPTFloat(1.0); - if ( elapsedTime < CPTFloat(0.0) ) { - return CPTFloat(-0.5) * ( pow(CPTFloat(2.0), CPTFloat(10.0) * elapsedTime) * sin( (elapsedTime * duration - s) * CPTFloat(2.0 * M_PI) / period ) ); + if ( elapsedTime < CPTFloat(0.0)) { + return CPTFloat(-0.5) * (pow(CPTFloat(2.0), CPTFloat(10.0) * elapsedTime) * sin((elapsedTime * duration - s) * CPTFloat(2.0 * M_PI) / period)); } else { - return pow(CPTFloat(2.0), CPTFloat(-10.0) * elapsedTime) * sin( (elapsedTime * duration - s) * CPTFloat(2.0 * M_PI) / period ) * CPTFloat(0.5) + CPTFloat(1.0); + return pow(CPTFloat(2.0), CPTFloat(-10.0) * elapsedTime) * sin((elapsedTime * duration - s) * CPTFloat(2.0 * M_PI) / period) * CPTFloat(0.5) + CPTFloat(1.0); } } @@ -344,17 +344,17 @@ CGFloat CPTAnimationTimingFunctionElasticInOut(CGFloat elapsedTime, CGFloat dura **/ CGFloat CPTAnimationTimingFunctionExponentialIn(CGFloat elapsedTime, CGFloat duration) { - if ( elapsedTime <= CPTFloat(0.0) ) { + if ( elapsedTime <= CPTFloat(0.0)) { return CPTFloat(0.0); } elapsedTime /= duration; - if ( elapsedTime >= CPTFloat(1.0) ) { + if ( elapsedTime >= CPTFloat(1.0)) { return CPTFloat(1.0); } - return pow( CPTFloat(2.0), CPTFloat(10.0) * ( elapsedTime - CPTFloat(1.0) ) ); + return pow(CPTFloat(2.0), CPTFloat(10.0) * (elapsedTime - CPTFloat(1.0))); } /** @@ -365,13 +365,13 @@ CGFloat CPTAnimationTimingFunctionExponentialIn(CGFloat elapsedTime, CGFloat dur **/ CGFloat CPTAnimationTimingFunctionExponentialOut(CGFloat elapsedTime, CGFloat duration) { - if ( elapsedTime <= CPTFloat(0.0) ) { + if ( elapsedTime <= CPTFloat(0.0)) { return CPTFloat(0.0); } elapsedTime /= duration; - if ( elapsedTime >= CPTFloat(1.0) ) { + if ( elapsedTime >= CPTFloat(1.0)) { return CPTFloat(1.0); } @@ -386,22 +386,22 @@ CGFloat CPTAnimationTimingFunctionExponentialOut(CGFloat elapsedTime, CGFloat du **/ CGFloat CPTAnimationTimingFunctionExponentialInOut(CGFloat elapsedTime, CGFloat duration) { - if ( elapsedTime <= CPTFloat(0.0) ) { + if ( elapsedTime <= CPTFloat(0.0)) { return CPTFloat(0.0); } elapsedTime /= duration * CPTFloat(0.5); elapsedTime -= CPTFloat(1.0); - if ( elapsedTime >= CPTFloat(1.0) ) { + if ( elapsedTime >= CPTFloat(1.0)) { return CPTFloat(1.0); } - if ( elapsedTime < CPTFloat(0.0) ) { + if ( elapsedTime < CPTFloat(0.0)) { return CPTFloat(0.5) * pow(CPTFloat(2.0), CPTFloat(10.0) * elapsedTime); } else { - return CPTFloat(0.5) * ( -pow(CPTFloat(2.0), CPTFloat(-10.0) * elapsedTime) + CPTFloat(2.0) ); + return CPTFloat(0.5) * (-pow(CPTFloat(2.0), CPTFloat(-10.0) * elapsedTime) + CPTFloat(2.0)); } } @@ -416,17 +416,17 @@ CGFloat CPTAnimationTimingFunctionExponentialInOut(CGFloat elapsedTime, CGFloat **/ CGFloat CPTAnimationTimingFunctionSinusoidalIn(CGFloat elapsedTime, CGFloat duration) { - if ( elapsedTime <= CPTFloat(0.0) ) { + if ( elapsedTime <= CPTFloat(0.0)) { return CPTFloat(0.0); } elapsedTime /= duration; - if ( elapsedTime >= CPTFloat(1.0) ) { + if ( elapsedTime >= CPTFloat(1.0)) { return CPTFloat(1.0); } - return -cos( elapsedTime * CPTFloat(M_PI_2) ) + CPTFloat(1.0); + return -cos(elapsedTime * CPTFloat(M_PI_2)) + CPTFloat(1.0); } /** @@ -437,17 +437,17 @@ CGFloat CPTAnimationTimingFunctionSinusoidalIn(CGFloat elapsedTime, CGFloat dura **/ CGFloat CPTAnimationTimingFunctionSinusoidalOut(CGFloat elapsedTime, CGFloat duration) { - if ( elapsedTime <= CPTFloat(0.0) ) { + if ( elapsedTime <= CPTFloat(0.0)) { return CPTFloat(0.0); } elapsedTime /= duration; - if ( elapsedTime >= CPTFloat(1.0) ) { + if ( elapsedTime >= CPTFloat(1.0)) { return CPTFloat(1.0); } - return sin( elapsedTime * CPTFloat(M_PI_2) ); + return sin(elapsedTime * CPTFloat(M_PI_2)); } /** @@ -458,17 +458,17 @@ CGFloat CPTAnimationTimingFunctionSinusoidalOut(CGFloat elapsedTime, CGFloat dur **/ CGFloat CPTAnimationTimingFunctionSinusoidalInOut(CGFloat elapsedTime, CGFloat duration) { - if ( elapsedTime <= CPTFloat(0.0) ) { + if ( elapsedTime <= CPTFloat(0.0)) { return CPTFloat(0.0); } elapsedTime /= duration; - if ( elapsedTime >= CPTFloat(1.0) ) { + if ( elapsedTime >= CPTFloat(1.0)) { return CPTFloat(1.0); } - return CPTFloat(-0.5) * ( cos(CPTFloat(M_PI) * elapsedTime) - CPTFloat(1.0) ); + return CPTFloat(-0.5) * (cos(CPTFloat(M_PI) * elapsedTime) - CPTFloat(1.0)); } #pragma mark - @@ -482,13 +482,13 @@ CGFloat CPTAnimationTimingFunctionSinusoidalInOut(CGFloat elapsedTime, CGFloat d **/ CGFloat CPTAnimationTimingFunctionCubicIn(CGFloat elapsedTime, CGFloat duration) { - if ( elapsedTime <= CPTFloat(0.0) ) { + if ( elapsedTime <= CPTFloat(0.0)) { return CPTFloat(0.0); } elapsedTime /= duration; - if ( elapsedTime >= CPTFloat(1.0) ) { + if ( elapsedTime >= CPTFloat(1.0)) { return CPTFloat(1.0); } @@ -503,13 +503,13 @@ CGFloat CPTAnimationTimingFunctionCubicIn(CGFloat elapsedTime, CGFloat duration) **/ CGFloat CPTAnimationTimingFunctionCubicOut(CGFloat elapsedTime, CGFloat duration) { - if ( elapsedTime <= CPTFloat(0.0) ) { + if ( elapsedTime <= CPTFloat(0.0)) { return CPTFloat(0.0); } elapsedTime = elapsedTime / duration - CPTFloat(1.0); - if ( elapsedTime >= CPTFloat(0.0) ) { + if ( elapsedTime >= CPTFloat(0.0)) { return CPTFloat(1.0); } @@ -524,23 +524,23 @@ CGFloat CPTAnimationTimingFunctionCubicOut(CGFloat elapsedTime, CGFloat duration **/ CGFloat CPTAnimationTimingFunctionCubicInOut(CGFloat elapsedTime, CGFloat duration) { - if ( elapsedTime <= CPTFloat(0.0) ) { + if ( elapsedTime <= CPTFloat(0.0)) { return CPTFloat(0.0); } elapsedTime /= duration * CPTFloat(0.5); - if ( elapsedTime >= CPTFloat(2.0) ) { + if ( elapsedTime >= CPTFloat(2.0)) { return CPTFloat(1.0); } - if ( elapsedTime < CPTFloat(1.0) ) { + if ( elapsedTime < CPTFloat(1.0)) { return CPTFloat(0.5) * elapsedTime * elapsedTime * elapsedTime; } else { elapsedTime -= CPTFloat(2.0); - return CPTFloat(0.5) * ( elapsedTime * elapsedTime * elapsedTime + CPTFloat(2.0) ); + return CPTFloat(0.5) * (elapsedTime * elapsedTime * elapsedTime + CPTFloat(2.0)); } } @@ -555,13 +555,13 @@ CGFloat CPTAnimationTimingFunctionCubicInOut(CGFloat elapsedTime, CGFloat durati **/ CGFloat CPTAnimationTimingFunctionQuadraticIn(CGFloat elapsedTime, CGFloat duration) { - if ( elapsedTime <= CPTFloat(0.0) ) { + if ( elapsedTime <= CPTFloat(0.0)) { return CPTFloat(0.0); } elapsedTime /= duration; - if ( elapsedTime >= CPTFloat(1.0) ) { + if ( elapsedTime >= CPTFloat(1.0)) { return CPTFloat(1.0); } @@ -576,17 +576,17 @@ CGFloat CPTAnimationTimingFunctionQuadraticIn(CGFloat elapsedTime, CGFloat durat **/ CGFloat CPTAnimationTimingFunctionQuadraticOut(CGFloat elapsedTime, CGFloat duration) { - if ( elapsedTime <= CPTFloat(0.0) ) { + if ( elapsedTime <= CPTFloat(0.0)) { return CPTFloat(0.0); } elapsedTime /= duration; - if ( elapsedTime >= CPTFloat(1.0) ) { + if ( elapsedTime >= CPTFloat(1.0)) { return CPTFloat(1.0); } - return -elapsedTime * ( elapsedTime - CPTFloat(2.0) ); + return -elapsedTime * (elapsedTime - CPTFloat(2.0)); } /** @@ -597,23 +597,23 @@ CGFloat CPTAnimationTimingFunctionQuadraticOut(CGFloat elapsedTime, CGFloat dura **/ CGFloat CPTAnimationTimingFunctionQuadraticInOut(CGFloat elapsedTime, CGFloat duration) { - if ( elapsedTime <= CPTFloat(0.0) ) { + if ( elapsedTime <= CPTFloat(0.0)) { return CPTFloat(0.0); } elapsedTime /= duration * CPTFloat(0.5); - if ( elapsedTime >= CPTFloat(2.0) ) { + if ( elapsedTime >= CPTFloat(2.0)) { return CPTFloat(1.0); } - if ( elapsedTime < CPTFloat(1.0) ) { + if ( elapsedTime < CPTFloat(1.0)) { return CPTFloat(0.5) * elapsedTime * elapsedTime; } else { elapsedTime -= CPTFloat(1.0); - return CPTFloat(-0.5) * ( elapsedTime * ( elapsedTime - CPTFloat(2.0) ) - CPTFloat(1.0) ); + return CPTFloat(-0.5) * (elapsedTime * (elapsedTime - CPTFloat(2.0)) - CPTFloat(1.0)); } } @@ -628,13 +628,13 @@ CGFloat CPTAnimationTimingFunctionQuadraticInOut(CGFloat elapsedTime, CGFloat du **/ CGFloat CPTAnimationTimingFunctionQuarticIn(CGFloat elapsedTime, CGFloat duration) { - if ( elapsedTime <= CPTFloat(0.0) ) { + if ( elapsedTime <= CPTFloat(0.0)) { return CPTFloat(0.0); } elapsedTime /= duration; - if ( elapsedTime >= CPTFloat(1.0) ) { + if ( elapsedTime >= CPTFloat(1.0)) { return CPTFloat(1.0); } @@ -649,17 +649,17 @@ CGFloat CPTAnimationTimingFunctionQuarticIn(CGFloat elapsedTime, CGFloat duratio **/ CGFloat CPTAnimationTimingFunctionQuarticOut(CGFloat elapsedTime, CGFloat duration) { - if ( elapsedTime <= CPTFloat(0.0) ) { + if ( elapsedTime <= CPTFloat(0.0)) { return CPTFloat(0.0); } elapsedTime = elapsedTime / duration - CPTFloat(1.0); - if ( elapsedTime >= CPTFloat(0.0) ) { + if ( elapsedTime >= CPTFloat(0.0)) { return CPTFloat(1.0); } - return -( elapsedTime * elapsedTime * elapsedTime * elapsedTime - CPTFloat(1.0) ); + return -(elapsedTime * elapsedTime * elapsedTime * elapsedTime - CPTFloat(1.0)); } /** @@ -670,23 +670,23 @@ CGFloat CPTAnimationTimingFunctionQuarticOut(CGFloat elapsedTime, CGFloat durati **/ CGFloat CPTAnimationTimingFunctionQuarticInOut(CGFloat elapsedTime, CGFloat duration) { - if ( elapsedTime <= CPTFloat(0.0) ) { + if ( elapsedTime <= CPTFloat(0.0)) { return CPTFloat(0.0); } elapsedTime /= duration * CPTFloat(0.5); - if ( elapsedTime >= CPTFloat(2.0) ) { + if ( elapsedTime >= CPTFloat(2.0)) { return CPTFloat(1.0); } - if ( elapsedTime < CPTFloat(1.0) ) { + if ( elapsedTime < CPTFloat(1.0)) { return CPTFloat(0.5) * elapsedTime * elapsedTime * elapsedTime * elapsedTime; } else { elapsedTime -= CPTFloat(2.0); - return CPTFloat(-0.5) * ( elapsedTime * elapsedTime * elapsedTime * elapsedTime - CPTFloat(2.0) ); + return CPTFloat(-0.5) * (elapsedTime * elapsedTime * elapsedTime * elapsedTime - CPTFloat(2.0)); } } @@ -701,13 +701,13 @@ CGFloat CPTAnimationTimingFunctionQuarticInOut(CGFloat elapsedTime, CGFloat dura **/ CGFloat CPTAnimationTimingFunctionQuinticIn(CGFloat elapsedTime, CGFloat duration) { - if ( elapsedTime <= CPTFloat(0.0) ) { + if ( elapsedTime <= CPTFloat(0.0)) { return CPTFloat(0.0); } elapsedTime /= duration; - if ( elapsedTime >= CPTFloat(1.0) ) { + if ( elapsedTime >= CPTFloat(1.0)) { return CPTFloat(1.0); } @@ -722,13 +722,13 @@ CGFloat CPTAnimationTimingFunctionQuinticIn(CGFloat elapsedTime, CGFloat duratio **/ CGFloat CPTAnimationTimingFunctionQuinticOut(CGFloat elapsedTime, CGFloat duration) { - if ( elapsedTime <= CPTFloat(0.0) ) { + if ( elapsedTime <= CPTFloat(0.0)) { return CPTFloat(0.0); } elapsedTime = elapsedTime / duration - CPTFloat(1.0); - if ( elapsedTime >= CPTFloat(0.0) ) { + if ( elapsedTime >= CPTFloat(0.0)) { return CPTFloat(1.0); } @@ -743,22 +743,22 @@ CGFloat CPTAnimationTimingFunctionQuinticOut(CGFloat elapsedTime, CGFloat durati **/ CGFloat CPTAnimationTimingFunctionQuinticInOut(CGFloat elapsedTime, CGFloat duration) { - if ( elapsedTime <= CPTFloat(0.0) ) { + if ( elapsedTime <= CPTFloat(0.0)) { return CPTFloat(0.0); } elapsedTime /= duration * CPTFloat(0.5); - if ( elapsedTime >= CPTFloat(2.0) ) { + if ( elapsedTime >= CPTFloat(2.0)) { return CPTFloat(1.0); } - if ( elapsedTime < CPTFloat(1.0) ) { + if ( elapsedTime < CPTFloat(1.0)) { return CPTFloat(0.5) * elapsedTime * elapsedTime * elapsedTime * elapsedTime * elapsedTime; } else { elapsedTime -= CPTFloat(2.0); - return CPTFloat(0.5) * ( elapsedTime * elapsedTime * elapsedTime * elapsedTime * elapsedTime + CPTFloat(2.0) ); + return CPTFloat(0.5) * (elapsedTime * elapsedTime * elapsedTime * elapsedTime * elapsedTime + CPTFloat(2.0)); } } diff --git a/framework/Source/_CPTBorderLayer.m b/framework/Source/_CPTBorderLayer.m index 05930cbe6..009fa48eb 100644 --- a/framework/Source/_CPTBorderLayer.m +++ b/framework/Source/_CPTBorderLayer.m @@ -33,7 +33,7 @@ @implementation CPTBorderLayer **/ -(nonnull instancetype)initWithFrame:(CGRect)newFrame { - if ( (self = [super initWithFrame:newFrame]) ) { + if ((self = [super initWithFrame:newFrame])) { maskedLayer = nil; self.needsDisplayOnBoundsChange = YES; @@ -47,7 +47,7 @@ -(nonnull instancetype)initWithFrame:(CGRect)newFrame -(nonnull instancetype)initWithLayer:(nonnull id)layer { - if ( (self = [super initWithLayer:layer]) ) { + if ((self = [super initWithLayer:layer])) { CPTBorderLayer *theLayer = (CPTBorderLayer *)layer; maskedLayer = theLayer->maskedLayer; @@ -71,7 +71,7 @@ -(void)encodeWithCoder:(nonnull NSCoder *)coder -(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super initWithCoder:coder]) ) { + if ((self = [super initWithCoder:coder])) { maskedLayer = [coder decodeObjectOfClass:[CPTBorderedLayer class] forKey:@"CPTBorderLayer.maskedLayer"]; } @@ -177,7 +177,7 @@ -(void)setMaskedLayer:(nullable CPTBorderedLayer *)newLayer -(void)setBounds:(CGRect)newBounds { - if ( !CGRectEqualToRect(newBounds, self.bounds) ) { + if ( !CGRectEqualToRect(newBounds, self.bounds)) { super.bounds = newBounds; [self setNeedsLayout]; } diff --git a/framework/Source/_CPTConstraintsFixed.m b/framework/Source/_CPTConstraintsFixed.m index d00c30606..7cef014bc 100644 --- a/framework/Source/_CPTConstraintsFixed.m +++ b/framework/Source/_CPTConstraintsFixed.m @@ -32,7 +32,7 @@ @implementation _CPTConstraintsFixed **/ -(nonnull instancetype)initWithLowerOffset:(CGFloat)newOffset { - if ( (self = [super init]) ) { + if ((self = [super init])) { offset = newOffset; isFixedToLower = YES; } @@ -46,7 +46,7 @@ -(nonnull instancetype)initWithLowerOffset:(CGFloat)newOffset **/ -(nonnull instancetype)initWithUpperOffset:(CGFloat)newOffset { - if ( (self = [super init]) ) { + if ((self = [super init])) { offset = newOffset; isFixedToLower = NO; } @@ -62,8 +62,8 @@ -(BOOL)isEqualToConstraint:(nullable CPTConstraints *)otherConstraint if ( [self class] != [otherConstraint class] ) { return NO; } - return (self.offset == ( (_CPTConstraintsFixed *)otherConstraint ).offset) && - (self.isFixedToLower == ( (_CPTConstraintsFixed *)otherConstraint ).isFixedToLower); + return (self.offset == ((_CPTConstraintsFixed *)otherConstraint).offset) && + (self.isFixedToLower == ((_CPTConstraintsFixed *)otherConstraint).isFixedToLower); } #pragma mark - @@ -131,7 +131,7 @@ -(void)encodeWithCoder:(nonnull NSCoder *)coder */ -(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super init]) ) { + if ((self = [super init])) { offset = [coder decodeCGFloatForKey:@"_CPTConstraintsFixed.offset"]; isFixedToLower = [coder decodeBoolForKey:@"_CPTConstraintsFixed.isFixedToLower"]; } diff --git a/framework/Source/_CPTConstraintsRelative.m b/framework/Source/_CPTConstraintsRelative.m index 4edf53338..533e204ed 100644 --- a/framework/Source/_CPTConstraintsRelative.m +++ b/framework/Source/_CPTConstraintsRelative.m @@ -35,7 +35,7 @@ @implementation _CPTConstraintsRelative **/ -(nonnull instancetype)initWithRelativeOffset:(CGFloat)newOffset { - if ( (self = [super init]) ) { + if ((self = [super init])) { offset = newOffset; } @@ -50,7 +50,7 @@ -(BOOL)isEqualToConstraint:(nullable CPTConstraints *)otherConstraint if ( [self class] != [otherConstraint class] ) { return NO; } - return self.offset == ( (_CPTConstraintsRelative *)otherConstraint ).offset; + return self.offset == ((_CPTConstraintsRelative *)otherConstraint).offset; } #pragma mark - @@ -109,7 +109,7 @@ -(void)encodeWithCoder:(nonnull NSCoder *)coder */ -(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super init]) ) { + if ((self = [super init])) { offset = [coder decodeCGFloatForKey:@"_CPTConstraintsRelative.offset"]; } return self; diff --git a/framework/Source/_CPTDarkGradientTheme.m b/framework/Source/_CPTDarkGradientTheme.m index 34c2f40c6..e15eaf091 100644 --- a/framework/Source/_CPTDarkGradientTheme.m +++ b/framework/Source/_CPTDarkGradientTheme.m @@ -12,16 +12,7 @@ #import "CPTXYAxisSet.h" #import "CPTXYGraph.h" -NSString *const kCPTDarkGradientTheme = @"Dark Gradients"; - -/// @cond -@interface _CPTDarkGradientTheme() - --(void)applyThemeToAxis:(CPTXYAxis *)axis usingMajorLineStyle:(nonnull CPTLineStyle *)majorLineStyle minorLineStyle:(nonnull CPTLineStyle *)minorLineStyle textStyle:(nonnull CPTMutableTextStyle *)textStyle minorTickTextStyle:(nonnull CPTMutableTextStyle *)minorTickTextStyle; - -@end - -/// @endcond +CPTThemeName const kCPTDarkGradientTheme = @"Dark Gradients"; #pragma mark - @@ -42,23 +33,6 @@ +(nonnull NSString *)name #pragma mark - --(void)applyThemeToAxis:(CPTXYAxis *)axis usingMajorLineStyle:(nonnull CPTLineStyle *)majorLineStyle minorLineStyle:(nonnull CPTLineStyle *)minorLineStyle textStyle:(nonnull CPTMutableTextStyle *)textStyle minorTickTextStyle:(nonnull CPTMutableTextStyle *)minorTickTextStyle -{ - axis.labelingPolicy = CPTAxisLabelingPolicyFixedInterval; - axis.majorIntervalLength = @0.5; - axis.orthogonalPosition = @0.0; - axis.tickDirection = CPTSignNone; - axis.minorTicksPerInterval = 4; - axis.majorTickLineStyle = majorLineStyle; - axis.minorTickLineStyle = minorLineStyle; - axis.axisLineStyle = majorLineStyle; - axis.majorTickLength = CPTFloat(7.0); - axis.minorTickLength = CPTFloat(5.0); - axis.labelTextStyle = textStyle; - axis.minorTickLabelTextStyle = minorTickTextStyle; - axis.titleTextStyle = textStyle; -} - -(void)applyThemeToBackground:(nonnull CPTGraph *)graph { CPTColor *endColor = [CPTColor colorWithGenericGray:CPTFloat(0.1)]; @@ -108,7 +82,19 @@ -(void)applyThemeToAxisSet:(nonnull CPTAxisSet *)axisSet whiteMinorTickTextStyle.fontSize = CPTFloat(12.0); for ( CPTXYAxis *axis in axisSet.axes ) { - [self applyThemeToAxis:axis usingMajorLineStyle:majorLineStyle minorLineStyle:minorLineStyle textStyle:whiteTextStyle minorTickTextStyle:whiteMinorTickTextStyle]; + axis.labelingPolicy = CPTAxisLabelingPolicyFixedInterval; + axis.majorIntervalLength = @0.5; + axis.orthogonalPosition = @0.0; + axis.tickDirection = CPTSignNone; + axis.minorTicksPerInterval = 4; + axis.majorTickLineStyle = majorLineStyle; + axis.minorTickLineStyle = minorLineStyle; + axis.axisLineStyle = majorLineStyle; + axis.majorTickLength = CPTFloat(7.0); + axis.minorTickLength = CPTFloat(5.0); + axis.labelTextStyle = whiteTextStyle; + axis.minorTickLabelTextStyle = whiteMinorTickTextStyle; + axis.titleTextStyle = whiteTextStyle; } } diff --git a/framework/Source/_CPTFillColor.m b/framework/Source/_CPTFillColor.m index ed4df6cd4..628f5b6d1 100644 --- a/framework/Source/_CPTFillColor.m +++ b/framework/Source/_CPTFillColor.m @@ -32,7 +32,7 @@ @implementation _CPTFillColor **/ -(nonnull instancetype)initWithColor:(nonnull CPTColor *)aColor { - if ( (self = [super init]) ) { + if ((self = [super init])) { fillColor = aColor; } return self; @@ -119,7 +119,7 @@ -(void)encodeWithCoder:(nonnull NSCoder *)coder */ -(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super init]) ) { + if ((self = [super init])) { CPTColor *color = [coder decodeObjectOfClass:[CPTColor class] forKey:@"_CPTFillColor.fillColor"]; diff --git a/framework/Source/_CPTFillGradient.m b/framework/Source/_CPTFillGradient.m index 4f088d325..c7d0aa70c 100644 --- a/framework/Source/_CPTFillGradient.m +++ b/framework/Source/_CPTFillGradient.m @@ -32,7 +32,7 @@ @implementation _CPTFillGradient **/ -(nonnull instancetype)initWithGradient:(nonnull CPTGradient *)aGradient { - if ( (self = [super init]) ) { + if ((self = [super init])) { fillGradient = aGradient; } return self; @@ -105,7 +105,7 @@ -(void)encodeWithCoder:(nonnull NSCoder *)coder */ -(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super init]) ) { + if ((self = [super init])) { CPTGradient *gradient = [coder decodeObjectOfClass:[CPTGradient class] forKey:@"_CPTFillGradient.fillGradient"]; diff --git a/framework/Source/_CPTFillImage.m b/framework/Source/_CPTFillImage.m index a79793aa7..48614de11 100644 --- a/framework/Source/_CPTFillImage.m +++ b/framework/Source/_CPTFillImage.m @@ -32,7 +32,7 @@ @implementation _CPTFillImage **/ -(nonnull instancetype)initWithImage:(nonnull CPTImage *)anImage { - if ( (self = [super init]) ) { + if ((self = [super init])) { fillImage = anImage; } return self; @@ -111,7 +111,7 @@ -(void)encodeWithCoder:(nonnull NSCoder *)coder */ -(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super init]) ) { + if ((self = [super init])) { CPTImage *image = [coder decodeObjectOfClass:[CPTImage class] forKey:@"_CPTFillImage.fillImage"]; diff --git a/framework/Source/_CPTMaskLayer.m b/framework/Source/_CPTMaskLayer.m index d4cceba9f..14e3dc603 100644 --- a/framework/Source/_CPTMaskLayer.m +++ b/framework/Source/_CPTMaskLayer.m @@ -18,7 +18,7 @@ @implementation CPTMaskLayer **/ -(nonnull instancetype)initWithFrame:(CGRect)newFrame { - if ( (self = [super initWithFrame:newFrame]) ) { + if ((self = [super initWithFrame:newFrame])) { self.needsDisplayOnBoundsChange = YES; } return self; @@ -36,7 +36,7 @@ -(void)renderAsVectorInContext:(nonnull CGContextRef)context CPTLayer *theMaskedLayer = (CPTLayer *)self.superlayer; if ( theMaskedLayer ) { - CGContextSetRGBFillColor( context, CPTFloat(0.0), CPTFloat(0.0), CPTFloat(0.0), CPTFloat(1.0) ); + CGContextSetRGBFillColor(context, CPTFloat(0.0), CPTFloat(0.0), CPTFloat(0.0), CPTFloat(1.0)); if ( [theMaskedLayer isKindOfClass:[CPTLayer class]] ) { CGPathRef maskingPath = theMaskedLayer.sublayerMaskingPath; diff --git a/framework/Source/_CPTPlainBlackTheme.m b/framework/Source/_CPTPlainBlackTheme.m index ad52aa0b8..05783b4f1 100644 --- a/framework/Source/_CPTPlainBlackTheme.m +++ b/framework/Source/_CPTPlainBlackTheme.m @@ -11,7 +11,7 @@ #import "CPTXYAxisSet.h" #import "CPTXYGraph.h" -NSString *const kCPTPlainBlackTheme = @"Plain Black"; +CPTThemeName const kCPTPlainBlackTheme = @"Plain Black"; /** * @brief Creates a CPTXYGraph instance formatted with black backgrounds and white lines. @@ -49,7 +49,6 @@ -(void)applyThemeToPlotArea:(nonnull CPTPlotAreaFrame *)plotAreaFrame -(void)applyThemeToAxisSet:(nonnull CPTAxisSet *)axisSet { - CPTXYAxisSet *xyAxisSet = (CPTXYAxisSet *)axisSet; CPTMutableLineStyle *majorLineStyle = [CPTMutableLineStyle lineStyle]; majorLineStyle.lineCap = kCGLineCapRound; @@ -60,42 +59,29 @@ -(void)applyThemeToAxisSet:(nonnull CPTAxisSet *)axisSet minorLineStyle.lineColor = [CPTColor whiteColor]; minorLineStyle.lineWidth = CPTFloat(3.0); - CPTXYAxis *x = xyAxisSet.xAxis; CPTMutableTextStyle *whiteTextStyle = [[CPTMutableTextStyle alloc] init]; whiteTextStyle.color = [CPTColor whiteColor]; whiteTextStyle.fontSize = CPTFloat(14.0); + CPTMutableTextStyle *minorTickWhiteTextStyle = [[CPTMutableTextStyle alloc] init]; minorTickWhiteTextStyle.color = [CPTColor whiteColor]; minorTickWhiteTextStyle.fontSize = CPTFloat(12.0); - x.labelingPolicy = CPTAxisLabelingPolicyFixedInterval; - x.majorIntervalLength = @0.5; - x.orthogonalPosition = @0.0; - x.tickDirection = CPTSignNone; - x.minorTicksPerInterval = 4; - x.majorTickLineStyle = majorLineStyle; - x.minorTickLineStyle = minorLineStyle; - x.axisLineStyle = majorLineStyle; - x.majorTickLength = CPTFloat(7.0); - x.minorTickLength = CPTFloat(5.0); - x.labelTextStyle = whiteTextStyle; - x.minorTickLabelTextStyle = whiteTextStyle; - x.titleTextStyle = whiteTextStyle; - - CPTXYAxis *y = xyAxisSet.yAxis; - y.labelingPolicy = CPTAxisLabelingPolicyFixedInterval; - y.majorIntervalLength = @0.5; - y.minorTicksPerInterval = 4; - y.orthogonalPosition = @0.0; - y.tickDirection = CPTSignNone; - y.majorTickLineStyle = majorLineStyle; - y.minorTickLineStyle = minorLineStyle; - y.axisLineStyle = majorLineStyle; - y.majorTickLength = CPTFloat(7.0); - y.minorTickLength = CPTFloat(5.0); - y.labelTextStyle = whiteTextStyle; - y.minorTickLabelTextStyle = minorTickWhiteTextStyle; - y.titleTextStyle = whiteTextStyle; + for ( CPTXYAxis *axis in axisSet.axes ) { + axis.labelingPolicy = CPTAxisLabelingPolicyFixedInterval; + axis.majorIntervalLength = @0.5; + axis.orthogonalPosition = @0.0; + axis.tickDirection = CPTSignNone; + axis.minorTicksPerInterval = 4; + axis.majorTickLineStyle = majorLineStyle; + axis.minorTickLineStyle = minorLineStyle; + axis.axisLineStyle = majorLineStyle; + axis.majorTickLength = CPTFloat(7.0); + axis.minorTickLength = CPTFloat(5.0); + axis.labelTextStyle = whiteTextStyle; + axis.minorTickLabelTextStyle = whiteTextStyle; + axis.titleTextStyle = whiteTextStyle; + } } #pragma mark - diff --git a/framework/Source/_CPTPlainWhiteTheme.m b/framework/Source/_CPTPlainWhiteTheme.m index 485475e47..5a8ed24f2 100644 --- a/framework/Source/_CPTPlainWhiteTheme.m +++ b/framework/Source/_CPTPlainWhiteTheme.m @@ -11,7 +11,7 @@ #import "CPTXYAxisSet.h" #import "CPTXYGraph.h" -NSString *const kCPTPlainWhiteTheme = @"Plain White"; +CPTThemeName const kCPTPlainWhiteTheme = @"Plain White"; /** * @brief Creates a CPTXYGraph instance formatted with white backgrounds and black lines. @@ -49,7 +49,6 @@ -(void)applyThemeToPlotArea:(nonnull CPTPlotAreaFrame *)plotAreaFrame -(void)applyThemeToAxisSet:(nonnull CPTAxisSet *)axisSet { - CPTXYAxisSet *xyAxisSet = (CPTXYAxisSet *)axisSet; CPTMutableLineStyle *majorLineStyle = [CPTMutableLineStyle lineStyle]; majorLineStyle.lineCap = kCGLineCapButt; @@ -69,35 +68,21 @@ -(void)applyThemeToAxisSet:(nonnull CPTAxisSet *)axisSet minorTickBlackTextStyle.color = [CPTColor blackColor]; minorTickBlackTextStyle.fontSize = CPTFloat(12.0); - CPTXYAxis *x = xyAxisSet.xAxis; - x.labelingPolicy = CPTAxisLabelingPolicyFixedInterval; - x.majorIntervalLength = @0.5; - x.orthogonalPosition = @0.0; - x.tickDirection = CPTSignNone; - x.minorTicksPerInterval = 4; - x.majorTickLineStyle = majorLineStyle; - x.minorTickLineStyle = minorLineStyle; - x.axisLineStyle = majorLineStyle; - x.majorTickLength = CPTFloat(7.0); - x.minorTickLength = CPTFloat(5.0); - x.labelTextStyle = blackTextStyle; - x.minorTickLabelTextStyle = blackTextStyle; - x.titleTextStyle = blackTextStyle; - - CPTXYAxis *y = xyAxisSet.yAxis; - y.labelingPolicy = CPTAxisLabelingPolicyFixedInterval; - y.majorIntervalLength = @0.5; - y.minorTicksPerInterval = 4; - y.orthogonalPosition = @0.0; - y.tickDirection = CPTSignNone; - y.majorTickLineStyle = majorLineStyle; - y.minorTickLineStyle = minorLineStyle; - y.axisLineStyle = majorLineStyle; - y.majorTickLength = CPTFloat(7.0); - y.minorTickLength = CPTFloat(5.0); - y.labelTextStyle = blackTextStyle; - y.minorTickLabelTextStyle = minorTickBlackTextStyle; - y.titleTextStyle = blackTextStyle; + for ( CPTXYAxis *axis in axisSet.axes ) { + axis.labelingPolicy = CPTAxisLabelingPolicyFixedInterval; + axis.majorIntervalLength = @0.5; + axis.orthogonalPosition = @0.0; + axis.tickDirection = CPTSignNone; + axis.minorTicksPerInterval = 4; + axis.majorTickLineStyle = majorLineStyle; + axis.minorTickLineStyle = minorLineStyle; + axis.axisLineStyle = majorLineStyle; + axis.majorTickLength = CPTFloat(7.0); + axis.minorTickLength = CPTFloat(5.0); + axis.labelTextStyle = blackTextStyle; + axis.minorTickLabelTextStyle = blackTextStyle; + axis.titleTextStyle = blackTextStyle; + } } #pragma mark - diff --git a/framework/Source/_CPTSlateTheme.m b/framework/Source/_CPTSlateTheme.m index 35cff032b..c357e48a9 100644 --- a/framework/Source/_CPTSlateTheme.m +++ b/framework/Source/_CPTSlateTheme.m @@ -12,16 +12,7 @@ #import "CPTXYAxisSet.h" #import "CPTXYGraph.h" -NSString *const kCPTSlateTheme = @"Slate"; - -/// @cond -@interface _CPTSlateTheme() - --(void)applyThemeToAxis:(CPTXYAxis *)axis usingMajorLineStyle:(nonnull CPTLineStyle *)majorLineStyle minorLineStyle:(nonnull CPTLineStyle *)minorLineStyle textStyle:(nonnull CPTMutableTextStyle *)textStyle minorTickTextStyle:(nonnull CPTMutableTextStyle *)minorTickTextStyle; - -@end - -/// @endcond +CPTThemeName const kCPTSlateTheme = @"Slate"; #pragma mark - @@ -42,23 +33,6 @@ +(nonnull NSString *)name #pragma mark - --(void)applyThemeToAxis:(CPTXYAxis *)axis usingMajorLineStyle:(nonnull CPTLineStyle *)majorLineStyle minorLineStyle:(nonnull CPTLineStyle *)minorLineStyle textStyle:(nonnull CPTMutableTextStyle *)textStyle minorTickTextStyle:(nonnull CPTMutableTextStyle *)minorTickTextStyle -{ - axis.labelingPolicy = CPTAxisLabelingPolicyFixedInterval; - axis.majorIntervalLength = @0.5; - axis.orthogonalPosition = @0.0; - axis.tickDirection = CPTSignNone; - axis.minorTicksPerInterval = 4; - axis.majorTickLineStyle = majorLineStyle; - axis.minorTickLineStyle = minorLineStyle; - axis.axisLineStyle = majorLineStyle; - axis.majorTickLength = CPTFloat(7.0); - axis.minorTickLength = CPTFloat(5.0); - axis.labelTextStyle = textStyle; - axis.minorTickLabelTextStyle = minorTickTextStyle; - axis.titleTextStyle = textStyle; -} - -(void)applyThemeToBackground:(nonnull CPTGraph *)graph { CPTGradient *gradient = [CPTGradient gradientWithBeginningColor:[CPTColor colorWithComponentRed:CPTFloat(0.43) green:CPTFloat(0.51) blue:CPTFloat(0.63) alpha:CPTFloat(1.0)] @@ -107,7 +81,19 @@ -(void)applyThemeToAxisSet:(nonnull CPTAxisSet *)axisSet minorTickBlackTextStyle.fontSize = CPTFloat(12.0); for ( CPTXYAxis *axis in axisSet.axes ) { - [self applyThemeToAxis:axis usingMajorLineStyle:majorLineStyle minorLineStyle:minorLineStyle textStyle:blackTextStyle minorTickTextStyle:minorTickBlackTextStyle]; + axis.labelingPolicy = CPTAxisLabelingPolicyFixedInterval; + axis.majorIntervalLength = @0.5; + axis.orthogonalPosition = @0.0; + axis.tickDirection = CPTSignNone; + axis.minorTicksPerInterval = 4; + axis.majorTickLineStyle = majorLineStyle; + axis.minorTickLineStyle = minorLineStyle; + axis.axisLineStyle = majorLineStyle; + axis.majorTickLength = CPTFloat(7.0); + axis.minorTickLength = CPTFloat(5.0); + axis.labelTextStyle = blackTextStyle; + axis.minorTickLabelTextStyle = minorTickBlackTextStyle; + axis.titleTextStyle = blackTextStyle; } } diff --git a/framework/Source/_CPTStocksTheme.m b/framework/Source/_CPTStocksTheme.m index 83d2dc92d..4e3dcf0bc 100644 --- a/framework/Source/_CPTStocksTheme.m +++ b/framework/Source/_CPTStocksTheme.m @@ -12,7 +12,7 @@ #import "CPTXYAxisSet.h" #import "CPTXYGraph.h" -NSString *const kCPTStocksTheme = @"Stocks"; +CPTThemeName const kCPTStocksTheme = @"Stocks"; /** * @brief Creates a CPTXYGraph instance formatted with a gradient background and white lines. @@ -62,7 +62,6 @@ -(void)applyThemeToPlotArea:(nonnull CPTPlotAreaFrame *)plotAreaFrame -(void)applyThemeToAxisSet:(nonnull CPTAxisSet *)axisSet { - CPTXYAxisSet *xyAxisSet = (CPTXYAxisSet *)axisSet; CPTMutableLineStyle *majorLineStyle = [CPTMutableLineStyle lineStyle]; majorLineStyle.lineCap = kCGLineCapRound; @@ -81,35 +80,21 @@ -(void)applyThemeToAxisSet:(nonnull CPTAxisSet *)axisSet minorTickWhiteTextStyle.color = [CPTColor whiteColor]; minorTickWhiteTextStyle.fontSize = CPTFloat(12.0); - CPTXYAxis *x = xyAxisSet.xAxis; - x.labelingPolicy = CPTAxisLabelingPolicyFixedInterval; - x.majorIntervalLength = @0.5; - x.orthogonalPosition = @0.0; - x.tickDirection = CPTSignNone; - x.minorTicksPerInterval = 4; - x.majorTickLineStyle = majorLineStyle; - x.minorTickLineStyle = minorLineStyle; - x.axisLineStyle = majorLineStyle; - x.majorTickLength = CPTFloat(7.0); - x.minorTickLength = CPTFloat(5.0); - x.labelTextStyle = whiteTextStyle; - x.minorTickLabelTextStyle = minorTickWhiteTextStyle; - x.titleTextStyle = whiteTextStyle; - - CPTXYAxis *y = xyAxisSet.yAxis; - y.labelingPolicy = CPTAxisLabelingPolicyFixedInterval; - y.majorIntervalLength = @0.5; - y.minorTicksPerInterval = 4; - y.orthogonalPosition = @0.0; - y.tickDirection = CPTSignNone; - y.majorTickLineStyle = majorLineStyle; - y.minorTickLineStyle = minorLineStyle; - y.axisLineStyle = majorLineStyle; - y.majorTickLength = CPTFloat(7.0); - y.minorTickLength = CPTFloat(5.0); - y.labelTextStyle = whiteTextStyle; - y.minorTickLabelTextStyle = minorTickWhiteTextStyle; - y.titleTextStyle = whiteTextStyle; + for ( CPTXYAxis *axis in axisSet.axes ) { + axis.labelingPolicy = CPTAxisLabelingPolicyFixedInterval; + axis.majorIntervalLength = @0.5; + axis.orthogonalPosition = @0.0; + axis.tickDirection = CPTSignNone; + axis.minorTicksPerInterval = 4; + axis.majorTickLineStyle = majorLineStyle; + axis.minorTickLineStyle = minorLineStyle; + axis.axisLineStyle = majorLineStyle; + axis.majorTickLength = CPTFloat(7.0); + axis.minorTickLength = CPTFloat(5.0); + axis.labelTextStyle = whiteTextStyle; + axis.minorTickLabelTextStyle = minorTickWhiteTextStyle; + axis.titleTextStyle = whiteTextStyle; + } } #pragma mark - diff --git a/framework/Source/_CPTXYTheme.m b/framework/Source/_CPTXYTheme.m index 9bb2675ba..129d137aa 100644 --- a/framework/Source/_CPTXYTheme.m +++ b/framework/Source/_CPTXYTheme.m @@ -15,7 +15,7 @@ @implementation _CPTXYTheme -(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { self.graphClass = [CPTXYGraph class]; } return self; diff --git a/framework/Source/mainpage.h b/framework/Source/mainpage.h index 417135609..06ec0e648 100644 --- a/framework/Source/mainpage.h +++ b/framework/Source/mainpage.h @@ -2,7 +2,7 @@ * * @section intro Introduction * - * Core Plot is a 2D plotting framework for Mac OS X and iOS. + * Core Plot is a 2D Cocoa plotting framework for macOS, iOS, and tvOS. * It is highly customizable and capable of drawing many types of plots. * See the Example Graphs * wiki page and the example applications @@ -38,7 +38,6 @@ * @subsection socialnetworks Social Networks * * - Twitter - * - App.net; Subscribe to the Announcements broadcast. * * @section contributingtocoreplot Contributing to Core Plot * diff --git a/framework/TestResources/CorePlotProbes.d b/framework/TestResources/CorePlotProbes.d deleted file mode 100644 index 05e68c33e..000000000 --- a/framework/TestResources/CorePlotProbes.d +++ /dev/null @@ -1,3 +0,0 @@ -provider CorePlot { - probe layer_position_change(char *, int, int, int, int); -}; \ No newline at end of file diff --git a/framework/English.lproj/InfoPlist.strings b/framework/en.lproj/InfoPlist.strings similarity index 100% rename from framework/English.lproj/InfoPlist.strings rename to framework/en.lproj/InfoPlist.strings diff --git a/framework/iPhoneOnly/CPTGraphHostingView.m b/framework/iPhoneOnly/CPTGraphHostingView.m index 83a5586b1..0c9866702 100644 --- a/framework/iPhoneOnly/CPTGraphHostingView.m +++ b/framework/iPhoneOnly/CPTGraphHostingView.m @@ -79,17 +79,24 @@ -(void)commonInit self.allowPinchScaling = YES; // This undoes the normal coordinate space inversion that UIViews apply to their layers - self.layer.sublayerTransform = CATransform3DMakeScale( CPTFloat(1.0), CPTFloat(-1.0), CPTFloat(1.0) ); + self.layer.sublayerTransform = CATransform3DMakeScale(CPTFloat(1.0), CPTFloat(-1.0), CPTFloat(1.0)); } -(nonnull instancetype)initWithFrame:(CGRect)frame { - if ( (self = [super initWithFrame:frame]) ) { + if ((self = [super initWithFrame:frame])) { [self commonInit]; } return self; } +-(void)awakeFromNib +{ + [super awakeFromNib]; + + [self commonInit]; +} + -(void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self]; @@ -116,7 +123,7 @@ -(void)encodeWithCoder:(nonnull NSCoder *)coder -(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super initWithCoder:coder]) ) { + if ((self = [super initWithCoder:coder])) { [self commonInit]; collapsesLayers = [coder decodeBoolForKey:@"CPTGraphHostingView.collapsesLayers"]; @@ -230,7 +237,7 @@ -(void)touchesEnded:(nonnull NSSet *)touches withEvent:(nullable UIEv } } --(void)touchesCancelled:(nullable NSSet *)touches withEvent:(nullable UIEvent *)event +-(void)touchesCancelled:(nonnull NSSet *)touches withEvent:(nullable UIEvent *)event { BOOL handled = NO; @@ -301,6 +308,7 @@ -(void)handlePinchGesture:(nonnull UIPinchGestureRecognizer *)aPinchGestureRecog pinchRecognizer.scale = 1.0; } + #endif /// @endcond @@ -316,6 +324,7 @@ -(BOOL)canBecomeFocused { return YES; } + #endif /// @endcond @@ -325,7 +334,7 @@ -(BOOL)canBecomeFocused /// @cond --(void)drawRect:(CGRect)rect +-(void)drawRect:(CGRect __unused)rect { if ( self.collapsesLayers ) { CGContextRef context = UIGraphicsGetCurrentContext(); @@ -338,11 +347,18 @@ -(void)drawRect:(CGRect)rect } } --(void)graphNeedsRedraw:(nonnull NSNotification *)notification +-(void)graphNeedsRedraw:(nonnull NSNotification *__unused)notification { [self setNeedsDisplay]; } +-(void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection +{ + [super traitCollectionDidChange:previousTraitCollection]; + + [self.hostedGraph setNeedsDisplayAllLayers]; +} + /// @endcond #pragma mark - @@ -352,7 +368,7 @@ -(void)graphNeedsRedraw:(nonnull NSNotification *)notification -(void)setHostedGraph:(nullable CPTGraph *)newLayer { - NSParameterAssert( (newLayer == nil) || [newLayer isKindOfClass:[CPTGraph class]] ); + NSParameterAssert((newLayer == nil) || [newLayer isKindOfClass:[CPTGraph class]]); if ( newLayer == hostedGraph ) { return; diff --git a/framework/iPhoneOnly/CPTImagePlatformSpecific.m b/framework/iPhoneOnly/CPTImagePlatformSpecific.m index 21ad7a51e..20c73f03d 100644 --- a/framework/iPhoneOnly/CPTImagePlatformSpecific.m +++ b/framework/iPhoneOnly/CPTImagePlatformSpecific.m @@ -14,7 +14,7 @@ @implementation CPTImage(CPTPlatformSpecificImageExtensions) **/ -(nonnull instancetype)initWithNativeImage:(nullable CPTNativeImage *)anImage { - if ( (self = [self initWithCGImage:NULL scale:anImage.scale]) ) { + if ((self = [self initWithCGImage:NULL scale:anImage.scale])) { self.nativeImage = anImage; UIEdgeInsets insets = anImage.capInsets; @@ -45,7 +45,7 @@ -(nonnull instancetype)initForPNGFile:(nonnull NSString *)path imageScale = MAX(imageScale, screen.scale); } - if ( imageScale > CPTFloat(1.0) ) { + if ( imageScale > CPTFloat(1.0)) { NSMutableString *hiDpiPath = [path mutableCopy]; NSUInteger replaceCount = [hiDpiPath replaceOccurrencesOfString:@".png" withString:[NSString stringWithFormat:@"@%dx.png", (int)imageScale] diff --git a/framework/iPhoneOnly/CPTPlatformSpecificCategories.h b/framework/iPhoneOnly/CPTPlatformSpecificCategories.h index 06cd3ec67..efa9ffffc 100644 --- a/framework/iPhoneOnly/CPTPlatformSpecificCategories.h +++ b/framework/iPhoneOnly/CPTPlatformSpecificCategories.h @@ -2,17 +2,6 @@ #import "CPTLayer.h" #import "CPTPlatformSpecificDefines.h" -#pragma mark CPTColor - -/** @category CPTColor(CPTPlatformSpecificColorExtensions) - * @brief Platform-specific extensions to CPTColor. - **/ -@interface CPTColor(CPTPlatformSpecificColorExtensions) - -@property (nonatomic, readonly, nonnull) UIColor *uiColor; - -@end - #pragma mark - CPTLayer /** @category CPTLayer(CPTPlatformSpecificLayerExtensions) @@ -53,4 +42,9 @@ -(void)drawInRect:(CGRect)rect inContext:(nonnull CGContextRef)context; /// @} +/// @name Measurement +/// @{ +-(CGSize)sizeAsDrawn; +/// @} + @end diff --git a/framework/iPhoneOnly/CPTPlatformSpecificCategories.m b/framework/iPhoneOnly/CPTPlatformSpecificCategories.m index c3b42aace..cad04a6f3 100644 --- a/framework/iPhoneOnly/CPTPlatformSpecificCategories.m +++ b/framework/iPhoneOnly/CPTPlatformSpecificCategories.m @@ -1,22 +1,7 @@ #import "CPTPlatformSpecificCategories.h" #import "CPTPlatformSpecificFunctions.h" - -#pragma mark CPTColor - -@implementation CPTColor(CPTPlatformSpecificColorExtensions) - -/** @property uiColor - * @brief Gets the color value as a UIColor. - **/ -@dynamic uiColor; - --(nonnull UIColor *)uiColor -{ - return [UIColor colorWithCGColor:self.cgColor]; -} - -@end +#import "tgmath.h" #pragma mark - CPTLayer @@ -29,14 +14,14 @@ -(nullable CPTNativeImage *)imageOfLayer { CGSize boundsSize = self.bounds.size; - UIGraphicsBeginImageContextWithOptions( boundsSize, self.opaque, CPTFloat(0.0) ); + UIGraphicsBeginImageContextWithOptions(boundsSize, self.opaque, CPTFloat(0.0)); CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSaveGState(context); CGContextSetAllowsAntialiasing(context, true); CGContextTranslateCTM(context, CPTFloat(0.0), boundsSize.height); - CGContextScaleCTM( context, CPTFloat(1.0), CPTFloat(-1.0) ); + CGContextScaleCTM(context, CPTFloat(1.0), CPTFloat(-1.0)); [self layoutAndRenderInContext:context]; CPTNativeImage *layerImage = UIGraphicsGetImageFromCurrentImageContext(); @@ -107,11 +92,28 @@ -(void)drawInRect:(CGRect)rect inContext:(nonnull CGContextRef)context CPTPushCGContext(context); [self drawWithRect:rect - options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading | NSStringDrawingTruncatesLastVisibleLine + options:CPTStringDrawingOptions context:nil]; CPTPopCGContext(); } } +/** + * @brief Computes the size of the styled text when drawn rounded up to the nearest whole number in each dimension. + **/ +-(CGSize)sizeAsDrawn +{ + CGRect rect = [self boundingRectWithSize:CPTSizeMake(10000.0, 10000.0) + options:CPTStringDrawingOptions + context:nil]; + + CGSize textSize = rect.size; + + textSize.width = ceil(textSize.width); + textSize.height = ceil(textSize.height); + + return textSize; +} + @end diff --git a/framework/iPhoneOnly/CPTPlatformSpecificDefines.h b/framework/iPhoneOnly/CPTPlatformSpecificDefines.h index 9b84d0d86..471ca99d5 100644 --- a/framework/iPhoneOnly/CPTPlatformSpecificDefines.h +++ b/framework/iPhoneOnly/CPTPlatformSpecificDefines.h @@ -1,4 +1,6 @@ /// @file +typedef UIColor CPTNativeColor; ///< Platform-native color. typedef UIImage CPTNativeImage; ///< Platform-native image format. typedef UIEvent CPTNativeEvent; ///< Platform-native OS event. +typedef UIFont CPTNativeFont; ///< Platform-native font. diff --git a/framework/iPhoneOnly/CPTPlatformSpecificFunctions.m b/framework/iPhoneOnly/CPTPlatformSpecificFunctions.m index 922dc209d..737d400f5 100644 --- a/framework/iPhoneOnly/CPTPlatformSpecificFunctions.m +++ b/framework/iPhoneOnly/CPTPlatformSpecificFunctions.m @@ -18,7 +18,7 @@ void CPTPopCGContext(void) #pragma mark - #pragma mark Debugging -CPTNativeImage * __nonnull CPTQuickLookImage(CGRect rect, __nonnull CPTQuickLookImageBlock renderBlock) +CPTNativeImage *__nonnull CPTQuickLookImage(CGRect rect, __nonnull CPTQuickLookImageBlock renderBlock) { UIGraphicsBeginImageContextWithOptions(rect.size, YES, 1.0); CGContextRef context = UIGraphicsGetCurrentContext(); diff --git a/framework/iPhoneOnly/CPTTextStylePlatformSpecific.h b/framework/iPhoneOnly/CPTTextStylePlatformSpecific.h index b6f4e498f..b1e699720 100644 --- a/framework/iPhoneOnly/CPTTextStylePlatformSpecific.h +++ b/framework/iPhoneOnly/CPTTextStylePlatformSpecific.h @@ -10,18 +10,3 @@ typedef NS_ENUM (NSInteger, CPTTextAlignment) { CPTTextAlignmentJustified = NSTextAlignmentJustified, ///< Justified alignment. CPTTextAlignmentNatural = NSTextAlignmentNatural ///< Natural alignment of the text's script. }; - -// @cond -// for iOS SDK compatibility -#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE -#if __IPHONE_OS_VERSION_MAX_ALLOWED<70000 -@interface NSString(CPTTextStylePlatformSpecificExtensions) - --(CGSize)sizeWithAttributes:(nonnull CPTDictionary *)attrs; - -@end -#else -#endif -#endif - -/// @endcond diff --git a/framework/iPhoneOnly/CPTTextStylePlatformSpecific.m b/framework/iPhoneOnly/CPTTextStylePlatformSpecific.m index 4fdedfc01..c2602bbc6 100644 --- a/framework/iPhoneOnly/CPTTextStylePlatformSpecific.m +++ b/framework/iPhoneOnly/CPTTextStylePlatformSpecific.m @@ -42,6 +42,7 @@ +(nonnull instancetype)textStyleWithAttributes:(nullable CPTDictionary *)attribu UIFont *styleFont = attributes[NSFontAttributeName]; if ( styleFont ) { + newStyle.font = styleFont; newStyle.fontName = styleFont.fontName; newStyle.fontSize = styleFont.pointSize; } @@ -72,10 +73,10 @@ -(nonnull CPTDictionary *)attributes CPTMutableDictionary *myAttributes = [NSMutableDictionary dictionary]; // Font - UIFont *styleFont = nil; + UIFont *styleFont = self.font; NSString *fontName = self.fontName; - if ( fontName ) { + if ((styleFont == nil) && fontName ) { styleFont = [UIFont fontWithName:fontName size:self.fontSize]; } @@ -132,6 +133,7 @@ +(nonnull instancetype)textStyleWithAttributes:(nullable CPTDictionary *)attribu UIFont *styleFont = attributes[NSFontAttributeName]; if ( styleFont ) { + newStyle.font = styleFont; newStyle.fontName = styleFont.fontName; newStyle.fontSize = styleFont.pointSize; } @@ -169,41 +171,15 @@ @implementation NSString(CPTTextStyleExtensions) **/ -(CGSize)sizeWithTextStyle:(nullable CPTTextStyle *)style { - CGSize textSize; - -#if TARGET_OS_SIMULATOR || TARGET_OS_TV CGRect rect = [self boundingRectWithSize:CPTSizeMake(10000.0, 10000.0) - options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading | NSStringDrawingTruncatesLastVisibleLine + options:CPTStringDrawingOptions attributes:style.attributes context:nil]; - textSize = rect.size; - textSize.width = ceil(textSize.width); - textSize.height = ceil(textSize.height); -#else - // -boundingRectWithSize:options:attributes:context: is available in iOS 7.0 and later - if ( [self respondsToSelector:@selector(boundingRectWithSize:options:attributes:context:)] ) { - CGRect rect = [self boundingRectWithSize:CPTSizeMake(10000.0, 10000.0) - options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading | NSStringDrawingTruncatesLastVisibleLine - attributes:style.attributes - context:nil]; - textSize = rect.size; - textSize.width = ceil(textSize.width); - textSize.height = ceil(textSize.height); - } - else { - UIFont *theFont = nil; - NSString *fontName = style.fontName; - if ( fontName ) { - theFont = [UIFont fontWithName:fontName size:style.fontSize]; - } + CGSize textSize = rect.size; -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - textSize = [self sizeWithFont:theFont constrainedToSize:CPTSizeMake(10000.0, 10000.0)]; -#pragma clang diagnostic pop - } -#endif + textSize.width = ceil(textSize.width); + textSize.height = ceil(textSize.height); return textSize; } @@ -232,7 +208,7 @@ -(void)drawInRect:(CGRect)rect withTextStyle:(nullable CPTTextStyle *)style inCo #if TARGET_OS_SIMULATOR || TARGET_OS_TV [self drawWithRect:rect - options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading | NSStringDrawingTruncatesLastVisibleLine + options:CPTStringDrawingOptions attributes:style.attributes context:nil]; #else @@ -240,7 +216,7 @@ -(void)drawInRect:(CGRect)rect withTextStyle:(nullable CPTTextStyle *)style inCo // -drawWithRect:options:attributes:context: method is available in iOS 7.0 and later if ( [self respondsToSelector:@selector(drawWithRect:options:attributes:context:)] ) { [self drawWithRect:rect - options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading | NSStringDrawingTruncatesLastVisibleLine + options:CPTStringDrawingOptions attributes:style.attributes context:nil]; } @@ -248,10 +224,10 @@ -(void)drawInRect:(CGRect)rect withTextStyle:(nullable CPTTextStyle *)style inCo UIColor *styleColor = style.attributes[NSForegroundColorAttributeName]; [styleColor set]; - UIFont *theFont = nil; + UIFont *theFont = style.font; NSString *fontName = style.fontName; - if ( fontName ) { + if ((theFont == nil) && fontName ) { theFont = [UIFont fontWithName:fontName size:style.fontSize]; } @@ -267,7 +243,10 @@ -(void)drawInRect:(CGRect)rect withTextStyle:(nullable CPTTextStyle *)style inCo UIColor *styleColor = style.attributes[NSForegroundColorAttributeName]; [styleColor set]; - UIFont *theFont = [UIFont fontWithName:style.fontName size:style.fontSize]; + UIFont *theFont = self.font; + if ( theFont == nil ) { + theFont = [UIFont fontWithName:style.fontName size:style.fontSize]; + } [self drawInRect:rect withFont:theFont diff --git a/framework/xcconfig/CorePlot.xcconfig b/framework/xcconfig/CorePlot.xcconfig index faddc888b..e7f5cc5f7 100644 --- a/framework/xcconfig/CorePlot.xcconfig +++ b/framework/xcconfig/CorePlot.xcconfig @@ -1,27 +1,36 @@ #include "CorePlotWarnings.xcconfig" ARCHS = $(ARCHS_STANDARD) -VALID_ARCHS[sdk=iphoneos*] = arm64 armv7 armv7s +VALID_ARCHS[sdk=iphoneos*] = arm64 arm64e armv7 armv7s VALID_ARCHS[sdk=iphonesimulator*] = i386 x86_64 -VALID_ARCHS[sdk=macosx*] = i386 x86_64 +VALID_ARCHS[sdk=macosx*] = i386 x86_64 arm64 VALID_ARCHS[sdk=appletvos*] = arm64 VALID_ARCHS[sdk=appletvsimulator*] = i386 x86_64 +IPHONEOS_DEPLOYMENT_TARGET = 8.0 +MACOSX_DEPLOYMENT_TARGET = 10.8 +TVOS_DEPLOYMENT_TARGET = 9.0 + SYMROOT = $(PROJECT_DIR)/../build -DEBUG_INFORMATION_FORMAT = dwarf-with-dsym + +ALWAYS_SEARCH_USER_PATHS = NO +CLANG_ENABLE_OBJC_ARC = YES +CLANG_STATIC_ANALYZER_MODE = shallow +CLANG_STATIC_ANALYZER_MODE_ON_ANALYZE_ACTION = deep COMBINE_HIDPI_IMAGES = YES COPY_PHASE_STRIP = YES -STRIP_STYLE = debugging -SEPARATE_STRIP = YES -SKIP_INSTALL = YES +DEAD_CODE_STRIPPING = YES +DEBUG_INFORMATION_FORMAT = dwarf-with-dsym GCC_C_LANGUAGE_STANDARD = c99 GCC_DYNAMIC_NO_PIC = NO GCC_PRECOMPILE_PREFIX_HEADER = YES GCC_PREFIX_HEADER = CorePlot_Prefix.pch -DEAD_CODE_STRIPPING = YES -CLANG_ENABLE_OBJC_ARC = YES LINKER_DISPLAYS_MANGLED_NAMES = NO -RUN_CLANG_STATIC_ANALYZER = YES -CLANG_STATIC_ANALYZER_MODE_ON_ANALYZE_ACTION = deep -CLANG_STATIC_ANALYZER_MODE = shallow OTHER_LDFLAGS = -ObjC +RUN_CLANG_STATIC_ANALYZER = YES +SEPARATE_STRIP = YES +SKIP_INSTALL = YES +STRIP_STYLE = debugging +STRIP_SWIFT_SYMBOLS = YES +SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule" +USE_HEADERMAP = NO diff --git a/framework/xcconfig/CorePlotWarnings.xcconfig b/framework/xcconfig/CorePlotWarnings.xcconfig index 599c13467..8c11ec296 100644 --- a/framework/xcconfig/CorePlotWarnings.xcconfig +++ b/framework/xcconfig/CorePlotWarnings.xcconfig @@ -1,74 +1,103 @@ -GCC_TREAT_WARNINGS_AS_ERRORS = YES -GCC_WARN_CHECK_SWITCH_STATEMENTS = YES -CLANG_WARN_DOCUMENTATION_COMMENTS = YES -GCC_WARN_SHADOW = YES -GCC_WARN_64_TO_32_BIT_CONVERSION = YES -CLANG_WARN_IMPLICIT_SIGN_CONVERSION = YES -GCC_WARN_ABOUT_POINTER_SIGNEDNESS = YES -GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES -GCC_WARN_ABOUT_RETURN_TYPE = YES -GCC_WARN_MISSING_PARENTHESES = YES -GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES -GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES -GCC_WARN_ABOUT_MISSING_NEWLINE = YES -GCC_WARN_SIGN_COMPARE = YES -CLANG_WARN_EMPTY_BODY = YES -CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES -GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE -GCC_WARN_UNUSED_FUNCTION = YES -GCC_WARN_UNUSED_LABEL = YES -GCC_WARN_UNUSED_VALUE = YES -GCC_WARN_UNUSED_VARIABLE = YES -CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE -GCC_WARN_UNUSED_PARAMETER = YES -GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = YES -CLANG_WARN_ASSIGN_ENUM = YES -CLANG_WARN__DUPLICATE_METHOD_MATCH = YES -CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = YES -GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = NO -CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES -GCC_WARN_UNDECLARED_SELECTOR = YES -CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = YES -CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES -CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES -CLANG_WARN_OBJC_RECEIVER_WEAK = YES -GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = YES -GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES -CLANG_WARN_BOOL_CONVERSION = YES -CLANG_WARN_CONSTANT_CONVERSION = YES -CLANG_WARN_ENUM_CONVERSION = YES -CLANG_WARN_INT_CONVERSION = YES -CLANG_WARN_NULLABLE_TO_NONNULL_CONVERSION = YES -GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = YES -GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES -GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = YES -GCC_WARN_UNKNOWN_PRAGMAS = YES -CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES -CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = NO -GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = YES -GCC_WARN_STRICT_SELECTOR_MATCH = NO -CLANG_WARN_OBJC_ROOT_CLASS = YES -CLANG_WARN__ARC_BRIDGE_CAST_NONARC = YES - -ENABLE_STRICT_OBJC_MSGSEND = YES +ASSETCATALOG_WARNINGS = YES CLANG_ANALYZER_DEADCODE_DEADSTORES = YES -CLANG_ANALYZER_MEMORY_MANAGEMENT = YES CLANG_ANALYZER_GCD = YES +CLANG_ANALYZER_LOCALIZABILITY_EMPTY_CONTEXT = YES +CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES +CLANG_ANALYZER_MEMORY_MANAGEMENT = YES +CLANG_ANALYZER_NONNULL = YES CLANG_ANALYZER_OBJC_ATSYNC = YES -CLANG_ANALYZER_OBJC_NSCFERROR = YES -CLANG_ANALYZER_OBJC_INCOMP_METHOD_TYPES = YES CLANG_ANALYZER_OBJC_COLLECTIONS = YES -CLANG_ANALYZER_OBJC_UNUSED_IVARS = YES -CLANG_ANALYZER_OBJC_SELF_INIT = YES +CLANG_ANALYZER_OBJC_DEALLOC = YES +CLANG_ANALYZER_OBJC_GENERICS = YES +CLANG_ANALYZER_OBJC_INCOMP_METHOD_TYPES = YES +CLANG_ANALYZER_OBJC_NSCFERROR = YES CLANG_ANALYZER_OBJC_RETAIN_COUNT = YES +CLANG_ANALYZER_OBJC_SELF_INIT = YES +CLANG_ANALYZER_OBJC_UNUSED_IVARS = YES CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES -CLANG_ANALYZER_SECURITY_KEYCHAIN_API = YES -CLANG_ANALYZER_SECURITY_INSECUREAPI_UNCHECKEDRETURN = YES CLANG_ANALYZER_SECURITY_INSECUREAPI_GETPW_GETS = YES CLANG_ANALYZER_SECURITY_INSECUREAPI_MKSTEMP = YES CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = YES CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = YES +CLANG_ANALYZER_SECURITY_INSECUREAPI_UNCHECKEDRETURN = YES CLANG_ANALYZER_SECURITY_INSECUREAPI_VFORK = YES +CLANG_ANALYZER_SECURITY_KEYCHAIN_API = YES + +CLANG_WARN__ARC_BRIDGE_CAST_NONARC = YES +CLANG_WARN__DUPLICATE_METHOD_MATCH = YES +CLANG_WARN_ASSIGN_ENUM = YES +CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES +CLANG_WARN_BOOL_CONVERSION = YES +CLANG_WARN_COMMA = YES +CLANG_WARN_CONSTANT_CONVERSION = YES +CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES +CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES +CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES +CLANG_WARN_DOCUMENTATION_COMMENTS = YES +CLANG_WARN_EMPTY_BODY = YES +CLANG_WARN_ENUM_CONVERSION = YES +CLANG_WARN_FLOAT_CONVERSION = YES +CLANG_WARN_IMPLICIT_SIGN_CONVERSION = YES +CLANG_WARN_INFINITE_RECURSION = YES +CLANG_WARN_INT_CONVERSION = YES +CLANG_WARN_MISSING_NOESCAPE = YES +CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES +CLANG_WARN_NULLABLE_TO_NONNULL_CONVERSION = YES +CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = YES +CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = NO +CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES +CLANG_WARN_OBJC_INTERFACE_IVARS = YES +CLANG_WARN_OBJC_LITERAL_CONVERSION = YES +CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = YES +CLANG_WARN_OBJC_RECEIVER_WEAK = YES +CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES +CLANG_WARN_OBJC_ROOT_CLASS = YES +CLANG_WARN_PRAGMA_PACK = YES +CLANG_WARN_PRIVATE_MODULE = YES +CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO +CLANG_WARN_RANGE_LOOP_ANALYSIS = YES +CLANG_WARN_SEMICOLON_BEFORE_METHOD_BODY =YES +CLANG_WARN_STRICT_PROTOTYPES = YES +CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES +CLANG_WARN_SUSPICIOUS_MOVE = YES +CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE +CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE + +ENABLE_STRICT_OBJC_MSGSEND = YES + +GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES +GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = YES +GCC_TREAT_WARNINGS_AS_ERRORS = YES + +GCC_WARN_64_TO_32_BIT_CONVERSION = YES +GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = YES +GCC_WARN_ABOUT_INVALID_OFFSETOF_MACRO = YES +GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES +GCC_WARN_ABOUT_MISSING_NEWLINE = YES +GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES +GCC_WARN_ABOUT_POINTER_SIGNEDNESS = YES +GCC_WARN_ABOUT_RETURN_TYPE = YES +GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = YES +GCC_WARN_CHECK_SWITCH_STATEMENTS = YES +GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES +GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = YES +GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES +GCC_WARN_MISSING_PARENTHESES = YES +GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = NO +GCC_WARN_SHADOW = YES +GCC_WARN_SIGN_COMPARE = YES +GCC_WARN_STRICT_SELECTOR_MATCH = NO +GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = YES +GCC_WARN_UNDECLARED_SELECTOR = YES +GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE +GCC_WARN_UNKNOWN_PRAGMAS = YES +GCC_WARN_UNUSED_FUNCTION = YES +GCC_WARN_UNUSED_LABEL = YES +GCC_WARN_UNUSED_PARAMETER = YES +GCC_WARN_UNUSED_VALUE = YES +GCC_WARN_UNUSED_VARIABLE = YES + +IBC_WARNINGS = YES -OTHER_CFLAGS = -Weverything -Wno-unused-parameter -Wno-undef -Wno-switch-enum -Wno-float-equal -Wno-padded -Wno-dollar-in-identifier-extension -Wno-custom-atomic-properties -Wno-gnu -Wno-assign-enum -Wno-pedantic -Wno-documentation -Wno-unknown-warning-option -Wno-cstring-format-directive -Wno-documentation-unknown-command -Wno-reserved-id-macro -Wno-incompatible-pointer-types-discards-qualifiers -Wno-partial-availability +WARNING_CFLAGS = -Weverything -Wno-undef -Wno-switch-enum -Wno-float-equal -Wno-custom-atomic-properties -Wno-pedantic -Wno-documentation -Wno-documentation-unknown-command -Wno-partial-availability -Wno-objc-messaging-id diff --git a/scripts/README Creating a release package.md b/scripts/README Creating a release package.md index 3bd752bed..bcfb6724c 100644 --- a/scripts/README Creating a release package.md +++ b/scripts/README Creating a release package.md @@ -5,8 +5,8 @@ Follow these steps to create a Core Plot release and post it to GitHub: 1. Ensure the following tools are installed on your development machine:
    -
  • Xcode 7
  • -
  • [Doxygen](http://www.stack.nl/~dimitri/doxygen/download.html#latestsrc), version 1.8.11 or later, installed in /Applications
  • +
  • Xcode 11
  • +
  • [Doxygen](http://www.stack.nl/~dimitri/doxygen/download.html#latestsrc), version 1.8.12 or later, installed in /Applications
  • [Graphviz](http://www.graphviz.org/Download_macos.php), version 2.36.0 or later
@@ -39,6 +39,7 @@ Follow these steps to create a Core Plot release and post it to GitHub:
  • Binaries/iOS/
  • Binaries/MacOS/
  • +
  • Binaries/tvOS/
  • Documentation/
  • READMEs/
  • Source/
  • @@ -98,5 +99,4 @@ Follow these steps to create a Core Plot release and post it to GitHub:
    • The Core Plot [discussion board](https://groups.google.com/forum/#!forum/coreplot-discuss)
    • [Twitter](https://twitter.com/CorePlot)
    • -
    • [App.net](https://alpha.app.net/coreplot)
    diff --git a/scripts/createrelease.py b/scripts/createrelease.py index 7a1e13076..9375881c2 100644 --- a/scripts/createrelease.py +++ b/scripts/createrelease.py @@ -96,7 +96,3 @@ def RunXcode(project, target): # Copy Docs docDir = join(releaseRootDir, 'Documentation') copytree(join(projectRoot, 'documentation'), docDir, ignore=ignore_patterns('*.orig','*.git')) -homeDir = environ['HOME'] -docsetsDir = join(homeDir, 'Library/Developer/Shared/Documentation/DocSets') -copytree(join(docsetsDir, 'com.CorePlot.Framework.docset'), join(docDir, 'com.CorePlot.Framework.docset')) -copytree(join(docsetsDir, 'com.CorePlotTouch.Framework.docset'), join(docDir, 'com.CorePlotTouch.Framework.docset')) diff --git a/scripts/uncrustify.cfg b/scripts/uncrustify.cfg index 9a72e033e..adf13c0dd 100644 --- a/scripts/uncrustify.cfg +++ b/scripts/uncrustify.cfg @@ -1,516 +1,713 @@ -# Uncrustify 0.63 -newlines = auto -input_tab_size = 4 -output_tab_size = 4 -string_escape_char = 92 -string_escape_char2 = 0 -string_replace_tab_chars = false -tok_split_gte = false -disable_processing_cmt = "" -enable_processing_cmt = "" -enable_digraphs = false -utf8_bom = remove -utf8_byte = false -utf8_force = false -indent_columns = 4 -indent_continue = 0 -indent_with_tabs = 0 -indent_cmt_with_tabs = false -indent_align_string = true -indent_xml_string = 4 -indent_brace = 0 -indent_braces = false -indent_braces_no_func = false -indent_braces_no_class = false -indent_braces_no_struct = false -indent_brace_parent = false -indent_paren_open_brace = false -indent_namespace = false -indent_namespace_single_indent = false -indent_namespace_level = 0 -indent_namespace_limit = 0 -indent_extern = false -indent_class = true -indent_class_colon = false -indent_class_on_colon = false -indent_constr_colon = false -indent_ctor_init_leading = 2 -indent_ctor_init = 0 -indent_else_if = false -indent_var_def_blk = 0 -indent_var_def_cont = false -indent_shift = false -indent_func_def_force_col1 = false -indent_func_call_param = false -indent_func_def_param = false -indent_func_proto_param = false -indent_func_class_param = false -indent_func_ctor_var_param = false -indent_template_param = false -indent_func_param_double = false -indent_func_const = 1 -indent_func_throw = 1 -indent_member = 1 -indent_sing_line_comments = 0 -indent_relative_single_line_comments = true -indent_switch_case = 4 -indent_case_shift = 0 -indent_case_brace = 0 -indent_col1_comment = false -indent_label = 1 -indent_access_spec = 1 -indent_access_spec_body = false -indent_paren_nl = false -indent_paren_close = 1 -indent_comma_paren = false -indent_bool_paren = false -indent_first_bool_expr = false -indent_square_nl = false -indent_preserve_sql = true -indent_align_assign = true -indent_oc_block = true -indent_oc_block_msg = 0 -indent_oc_msg_colon = 0 -indent_oc_msg_prioritize_first_colon = true -indent_oc_block_msg_xcode_style = false -indent_oc_block_msg_from_keyword = false -indent_oc_block_msg_from_colon = false -indent_oc_block_msg_from_caret = false -indent_oc_block_msg_from_brace = false -indent_min_vbrace_open = 0 -indent_vbrace_open_on_tabstop = false -sp_arith = force -sp_assign = force -sp_cpp_lambda_assign = ignore -sp_cpp_lambda_paren = ignore -sp_assign_default = force -sp_before_assign = ignore -sp_after_assign = ignore -sp_enum_paren = force -sp_enum_assign = force -sp_enum_before_assign = ignore -sp_enum_after_assign = ignore -sp_pp_concat = force -sp_pp_stringify = remove -sp_before_pp_stringify = ignore -sp_bool = force -sp_compare = force -sp_inside_paren = remove -sp_paren_paren = remove -sp_cparen_oparen = remove -sp_balance_nested_parens = true -sp_paren_brace = force -sp_before_ptr_star = force -sp_before_unnamed_ptr_star = force -sp_between_ptr_star = remove -sp_after_ptr_star = remove -sp_after_ptr_star_qualifier = remove -sp_after_ptr_star_func = remove -sp_ptr_star_paren = remove -sp_before_ptr_star_func = force -sp_before_byref = force -sp_before_unnamed_byref = force -sp_after_byref = remove -sp_after_byref_func = remove -sp_before_byref_func = force -sp_after_type = force -sp_before_template_paren = ignore -sp_template_angle = force -sp_before_angle = remove -sp_inside_angle = remove -sp_after_angle = remove -sp_angle_paren = remove -sp_angle_word = force -sp_angle_shift = add -sp_permit_cpp11_shift = false -sp_before_sparen = force -sp_inside_sparen = force -sp_inside_sparen_close = ignore -sp_inside_sparen_open = ignore -sp_after_sparen = force -sp_sparen_brace = force -sp_invariant_paren = ignore -sp_after_invariant_paren = ignore -sp_special_semi = force -sp_before_semi = remove -sp_before_semi_for = remove -sp_before_semi_for_empty = remove -sp_after_semi = force -sp_after_semi_for = force -sp_after_semi_for_empty = force -sp_before_square = remove -sp_before_squares = remove -sp_inside_square = remove -sp_after_comma = force -sp_before_comma = remove -sp_after_mdatype_commas = remove -sp_before_mdatype_commas = remove -sp_between_mdatype_commas = remove -sp_paren_comma = force -sp_before_ellipsis = remove -sp_after_class_colon = force -sp_before_class_colon = force -sp_after_constr_colon = remove -sp_before_constr_colon = remove -sp_before_case_colon = remove -sp_after_operator = remove -sp_after_operator_sym = force -sp_after_cast = remove -sp_inside_paren_cast = remove -sp_cpp_cast_paren = remove -sp_sizeof_paren = remove -sp_after_tag = ignore -sp_inside_braces_enum = remove -sp_inside_braces_struct = remove -sp_inside_braces = force -sp_inside_braces_empty = remove -sp_type_func = force -sp_func_proto_paren = remove -sp_func_def_paren = remove -sp_inside_fparens = remove -sp_inside_fparen = remove -sp_inside_tparen = remove -sp_after_tparen_close = remove -sp_square_fparen = remove -sp_fparen_brace = force -sp_fparen_dbrace = ignore -sp_func_call_paren = remove -sp_func_call_paren_empty = ignore -sp_func_call_user_paren = remove -sp_func_class_paren = remove -sp_return_paren = force -sp_attribute_paren = remove -sp_defined_paren = remove -sp_throw_paren = force -sp_after_throw = force -sp_catch_paren = force -sp_version_paren = ignore -sp_scope_paren = ignore -sp_macro = force -sp_macro_func = force -sp_else_brace = force -sp_brace_else = force -sp_brace_typedef = force -sp_catch_brace = force -sp_brace_catch = force -sp_finally_brace = force -sp_brace_finally = force -sp_try_brace = force -sp_getset_brace = force -sp_word_brace = add -sp_word_brace_ns = add -sp_before_dc = remove -sp_after_dc = remove -sp_d_array_colon = remove -sp_not = remove -sp_inv = remove -sp_addr = remove -sp_member = remove -sp_deref = remove -sp_sign = remove -sp_incdec = remove -sp_before_nl_cont = force -sp_after_oc_scope = remove -sp_after_oc_colon = remove -sp_before_oc_colon = remove -sp_after_oc_dict_colon = force -sp_before_oc_dict_colon = remove -sp_after_send_oc_colon = remove -sp_before_send_oc_colon = remove -sp_after_oc_type = remove -sp_after_oc_return_type = remove -sp_after_oc_at_sel = remove -sp_after_oc_at_sel_parens = force -sp_inside_oc_at_sel_parens = remove -sp_before_oc_block_caret = force -sp_after_oc_block_caret = remove -sp_after_oc_msg_receiver = force -sp_after_oc_property = force -sp_cond_colon = force -sp_cond_colon_before = ignore -sp_cond_colon_after = ignore -sp_cond_question = force -sp_cond_question_before = ignore -sp_cond_question_after = ignore -sp_cond_ternary_short = ignore -sp_case_label = force -sp_range = ignore -sp_after_for_colon = ignore -sp_before_for_colon = ignore -sp_extern_paren = remove -sp_cmt_cpp_start = force -sp_cmt_cpp_doxygen = true -sp_cmt_cpp_qttr = false -sp_endif_cmt = force -sp_after_new = force -sp_between_new_paren = ignore -sp_before_tr_emb_cmt = force -sp_num_before_tr_emb_cmt = 1 -sp_annotation_paren = ignore -align_keep_tabs = false -align_with_tabs = false -align_on_tabstop = false -align_number_left = false -align_keep_extra_space = false -align_func_params = true -align_same_func_call_params = false -align_var_def_span = 0 -align_var_def_star_style = 1 -align_var_def_amp_style = 1 -align_var_def_thresh = 0 -align_var_def_gap = 0 -align_var_def_colon = true -align_var_def_attribute = true -align_var_def_inline = true -align_assign_span = 1 -align_assign_thresh = 0 -align_enum_equ_span = 1 -align_enum_equ_thresh = 0 -align_var_struct_span = 1 -align_var_struct_thresh = 0 -align_var_struct_gap = 1 -align_struct_init_span = 2 -align_typedef_gap = 1 -align_typedef_span = 2 -align_typedef_func = 0 -align_typedef_star_style = 1 -align_typedef_amp_style = 1 -align_right_cmt_span = 2 -align_right_cmt_mix = false -align_right_cmt_gap = 1 -align_right_cmt_at_col = 1 -align_func_proto_span = 2 -align_func_proto_gap = 1 -align_on_operator = true -align_mix_var_proto = true -align_single_line_func = true -align_single_line_brace = true -align_single_line_brace_gap = 1 -align_oc_msg_spec_span = 0 -align_nl_cont = false -align_pp_define_together = false -align_pp_define_gap = 1 -align_pp_define_span = 2 -align_left_shift = true -align_asm_colon = false -align_oc_msg_colon_span = 16 -align_oc_msg_colon_first = false -align_oc_decl_colon = true -nl_collapse_empty_body = false -nl_assign_leave_one_liners = true -nl_class_leave_one_liners = false -nl_enum_leave_one_liners = true -nl_getset_leave_one_liners = false -nl_func_leave_one_liners = true -nl_cpp_lambda_leave_one_liners = false -nl_if_leave_one_liners = false -nl_while_leave_one_liners = false -nl_oc_msg_leave_one_liner = false -nl_start_of_file = remove -nl_start_of_file_min = 0 -nl_end_of_file = force -nl_end_of_file_min = 1 -nl_assign_brace = remove -nl_assign_square = ignore -nl_after_square_assign = ignore -nl_func_var_def_blk = 1 -nl_typedef_blk_start = 0 -nl_typedef_blk_end = 0 -nl_typedef_blk_in = 0 -nl_var_def_blk_start = 0 -nl_var_def_blk_end = 0 -nl_var_def_blk_in = 0 -nl_fcall_brace = force -nl_enum_brace = remove -nl_struct_brace = remove -nl_union_brace = remove -nl_if_brace = remove -nl_brace_else = force -nl_elseif_brace = remove -nl_else_brace = remove -nl_else_if = remove -nl_brace_finally = force -nl_finally_brace = remove -nl_try_brace = remove -nl_getset_brace = force -nl_for_brace = remove -nl_catch_brace = remove -nl_brace_catch = force -nl_brace_square = ignore -nl_brace_fparen = ignore -nl_while_brace = remove -nl_scope_brace = ignore -nl_unittest_brace = ignore -nl_version_brace = ignore -nl_using_brace = ignore -nl_brace_brace = force -nl_do_brace = remove -nl_brace_while = force -nl_switch_brace = remove -nl_synchronized_brace = remove -nl_multi_line_cond = false -nl_multi_line_define = false -nl_before_case = true -nl_before_throw = force -nl_after_case = true -nl_case_colon_brace = force -nl_namespace_brace = force -nl_template_class = force -nl_class_brace = force -nl_class_init_args = force -nl_constr_init_args = ignore -nl_func_type_name = remove -nl_func_type_name_class = ignore -nl_func_scope_name = remove -nl_func_proto_type_name = remove -nl_func_paren = remove -nl_func_def_paren = remove -nl_func_decl_start = remove -nl_func_def_start = remove -nl_func_decl_start_single = ignore -nl_func_def_start_single = ignore -nl_func_decl_args = ignore -nl_func_def_args = ignore -nl_func_decl_end = remove -nl_func_def_end = remove -nl_func_decl_end_single = ignore -nl_func_def_end_single = ignore -nl_func_decl_empty = remove -nl_func_def_empty = remove -nl_oc_msg_args = false -nl_fdef_brace = force -nl_cpp_ldef_brace = ignore -nl_return_expr = remove -nl_after_semicolon = true -nl_paren_dbrace_open = ignore -nl_after_brace_open = true -nl_after_brace_open_cmt = false -nl_after_vbrace_open = true -nl_after_vbrace_open_empty = false -nl_after_brace_close = false -nl_after_vbrace_close = false -nl_brace_struct_var = force -nl_define_macro = false -nl_squeeze_ifdef = true -nl_before_if = ignore -nl_after_if = ignore -nl_before_for = ignore -nl_after_for = ignore -nl_before_while = ignore -nl_after_while = ignore -nl_before_switch = ignore -nl_after_switch = ignore -nl_before_synchronized = ignore -nl_after_synchronized = ignore -nl_before_do = ignore -nl_after_do = ignore -nl_ds_struct_enum_cmt = false -nl_ds_struct_enum_close_brace = false -nl_before_func_class_def = 0 -nl_before_func_class_proto = 0 -nl_class_colon = remove -nl_constr_colon = ignore -nl_create_if_one_liner = true -nl_create_for_one_liner = false -nl_create_while_one_liner = false -pos_arith = trail -pos_assign = trail -pos_bool = trail -pos_compare = trail -pos_conditional = trail -pos_comma = trail -pos_class_comma = trail -pos_constr_comma = ignore -pos_class_colon = trail -pos_constr_colon = ignore -code_width = 0 -ls_for_split_full = true -ls_func_split_full = true -ls_code_width = false -nl_max = 2 -nl_after_func_proto = 1 -nl_after_func_proto_group = 2 -nl_before_func_body_def = 0 -nl_before_func_body_proto = 0 -nl_after_func_body = 2 -nl_after_func_body_class = 0 -nl_after_func_body_one_liner = 1 -nl_before_block_comment = 2 -nl_before_c_comment = 2 -nl_before_cpp_comment = 1 -nl_after_multiline_comment = false -nl_after_label_colon = false -nl_after_struct = 0 -nl_after_class = 0 -nl_before_access_spec = 2 -nl_after_access_spec = 1 -nl_comment_func_def = 1 -nl_after_try_catch_finally = 1 -nl_around_cs_property = 1 -nl_between_get_set = 1 -nl_property_brace = ignore -eat_blanks_after_open_brace = true -eat_blanks_before_close_brace = true -nl_remove_extra_newlines = 0 -nl_before_return = false -nl_after_return = true -nl_after_annotation = ignore -nl_between_annotation = ignore -mod_full_brace_do = force -mod_full_brace_for = force -mod_full_brace_function = force -mod_full_brace_if = force -mod_full_brace_if_chain = false -mod_full_brace_nl = 1 -mod_full_brace_while = force -mod_full_brace_using = ignore -mod_paren_on_return = remove -mod_pawn_semicolon = true -mod_full_paren_if_bool = true -mod_remove_extra_semicolon = true -mod_add_long_function_closebrace_comment = 0 +# Uncrustify_d-0.70.1 +newlines = auto +input_tab_size = 4 +output_tab_size = 4 +string_escape_char = 92 +string_escape_char2 = 0 +string_replace_tab_chars = false +tok_split_gte = false +disable_processing_cmt = "" +enable_processing_cmt = "" +enable_digraphs = false +utf8_bom = remove +utf8_byte = false +utf8_force = false +sp_do_brace_open = ignore +sp_brace_close_while = ignore +sp_while_paren_open = ignore +sp_arith = force +sp_arith_additive = ignore +sp_assign = force +sp_cpp_lambda_assign = ignore +sp_cpp_lambda_square_paren = ignore +sp_cpp_lambda_square_brace = ignore +sp_cpp_lambda_paren_brace = ignore +sp_cpp_lambda_fparen = ignore +sp_assign_default = force +sp_before_assign = ignore +sp_after_assign = ignore +sp_enum_paren = force +sp_enum_assign = force +sp_enum_before_assign = ignore +sp_enum_after_assign = ignore +sp_enum_colon = ignore +sp_pp_concat = force +sp_pp_stringify = remove +sp_before_pp_stringify = ignore +sp_bool = force +sp_compare = force +sp_inside_paren = remove +sp_paren_paren = remove +sp_cparen_oparen = remove +sp_balance_nested_parens = false +sp_paren_brace = force +sp_brace_brace = force +sp_before_ptr_star = force +sp_before_unnamed_ptr_star = force +sp_between_ptr_star = remove +sp_after_ptr_star = remove +sp_after_ptr_block_caret = remove +sp_after_ptr_star_qualifier = remove +sp_after_ptr_star_func = remove +sp_ptr_star_paren = remove +sp_before_ptr_star_func = force +sp_before_byref = force +sp_before_unnamed_byref = force +sp_after_byref = remove +sp_after_byref_func = remove +sp_before_byref_func = force +sp_after_type = force +sp_after_decltype = ignore +sp_before_template_paren = ignore +sp_template_angle = force +sp_before_angle = remove +sp_inside_angle = remove +sp_inside_angle_empty = remove +sp_angle_colon = ignore +sp_after_angle = remove +sp_angle_paren = remove +sp_angle_paren_empty = remove +sp_angle_word = force +sp_angle_shift = add +sp_permit_cpp11_shift = false +sp_before_sparen = force +sp_inside_sparen = force +sp_inside_sparen_open = ignore +sp_inside_sparen_close = ignore +sp_after_sparen = force +sp_sparen_brace = force +sp_invariant_paren = ignore +sp_after_invariant_paren = ignore +sp_special_semi = force +sp_before_semi = remove +sp_before_semi_for = remove +sp_before_semi_for_empty = remove +sp_after_semi = force +sp_after_semi_for = force +sp_after_semi_for_empty = force +sp_before_square = remove +sp_before_vardef_square = remove +sp_before_square_asm_block = ignore +sp_before_squares = remove +sp_cpp_before_struct_binding = remove +sp_inside_square = remove +sp_inside_square_oc_array = remove +sp_after_comma = force +sp_before_comma = remove +sp_after_mdatype_commas = remove +sp_before_mdatype_commas = remove +sp_between_mdatype_commas = remove +sp_paren_comma = force +sp_before_ellipsis = remove +sp_type_ellipsis = remove +sp_type_question = remove +sp_paren_ellipsis = remove +sp_paren_qualifier = remove +sp_paren_noexcept = remove +sp_after_class_colon = force +sp_before_class_colon = force +sp_after_constr_colon = remove +sp_before_constr_colon = remove +sp_before_case_colon = remove +sp_after_operator = remove +sp_after_operator_sym = force +sp_after_operator_sym_empty = ignore +sp_after_cast = remove +sp_inside_paren_cast = remove +sp_cpp_cast_paren = remove +sp_sizeof_paren = remove +sp_sizeof_ellipsis = remove +sp_sizeof_ellipsis_paren = remove +sp_decltype_paren = remove +sp_after_tag = remove +sp_inside_braces_enum = remove +sp_inside_braces_struct = remove +sp_inside_braces_oc_dict = force +sp_after_type_brace_init_lst_open = ignore +sp_before_type_brace_init_lst_close = ignore +sp_inside_type_brace_init_lst = ignore +sp_inside_braces = force +sp_inside_braces_empty = remove +sp_trailing_return = remove +sp_type_func = force +sp_type_brace_init_lst = ignore +sp_func_proto_paren = remove +sp_func_proto_paren_empty = remove +sp_func_type_paren = remove +sp_func_def_paren = remove +sp_func_def_paren_empty = remove +sp_inside_fparens = remove +sp_inside_fparen = remove +sp_inside_tparen = remove +sp_after_tparen_close = remove +sp_square_fparen = remove +sp_fparen_brace = force +sp_fparen_brace_initializer = force +sp_fparen_dbrace = force +sp_func_call_paren = remove +sp_func_call_paren_empty = remove +sp_func_call_user_paren = remove +sp_func_call_user_inside_fparen = remove +sp_func_call_user_paren_paren = remove +sp_func_class_paren = remove +sp_func_class_paren_empty = remove +sp_return_paren = force +sp_return_brace = force +sp_attribute_paren = remove +sp_defined_paren = remove +sp_throw_paren = force +sp_after_throw = force +sp_catch_paren = force +sp_oc_catch_paren = force +sp_oc_classname_paren = force +sp_version_paren = ignore +sp_scope_paren = ignore +sp_super_paren = remove +sp_this_paren = remove +sp_macro = force +sp_macro_func = force +sp_else_brace = force +sp_brace_else = force +sp_brace_typedef = force +sp_catch_brace = force +sp_oc_catch_brace = force +sp_brace_catch = force +sp_oc_brace_catch = force +sp_finally_brace = force +sp_brace_finally = force +sp_try_brace = force +sp_getset_brace = force +sp_word_brace = add +sp_word_brace_ns = add +sp_before_dc = remove +sp_after_dc = remove +sp_d_array_colon = remove +sp_not = remove +sp_inv = remove +sp_addr = remove +sp_member = remove +sp_deref = remove +sp_sign = remove +sp_incdec = remove +sp_before_nl_cont = force +sp_after_oc_scope = remove +sp_after_oc_colon = remove +sp_before_oc_colon = remove +sp_after_oc_dict_colon = force +sp_before_oc_dict_colon = remove +sp_after_send_oc_colon = remove +sp_before_send_oc_colon = remove +sp_after_oc_type = remove +sp_after_oc_return_type = remove +sp_after_oc_at_sel = remove +sp_after_oc_at_sel_parens = force +sp_inside_oc_at_sel_parens = remove +sp_before_oc_block_caret = force +sp_after_oc_block_caret = remove +sp_after_oc_msg_receiver = force +sp_after_oc_property = force +sp_after_oc_synchronized = force +sp_cond_colon = force +sp_cond_colon_before = ignore +sp_cond_colon_after = ignore +sp_cond_question = force +sp_cond_question_before = ignore +sp_cond_question_after = ignore +sp_cond_ternary_short = ignore +sp_case_label = force +sp_range = ignore +sp_after_for_colon = ignore +sp_before_for_colon = ignore +sp_extern_paren = remove +sp_cmt_cpp_start = force +sp_cmt_cpp_doxygen = true +sp_cmt_cpp_qttr = false +sp_endif_cmt = force +sp_after_new = force +sp_between_new_paren = ignore +sp_after_newop_paren = ignore +sp_inside_newop_paren = ignore +sp_inside_newop_paren_open = ignore +sp_inside_newop_paren_close = ignore +sp_before_tr_emb_cmt = force +sp_num_before_tr_emb_cmt = 1 +sp_annotation_paren = ignore +sp_skip_vbrace_tokens = false +sp_after_noexcept = ignore +sp_vala_after_translation = ignore +force_tab_after_define = false +indent_columns = 4 +indent_continue = 0 +indent_continue_class_head = 0 +indent_single_newlines = false +indent_param = 0 +indent_with_tabs = 0 +indent_cmt_with_tabs = false +indent_align_string = true +indent_xml_string = 4 +indent_brace = 0 +indent_braces = false +indent_braces_no_func = false +indent_braces_no_class = false +indent_braces_no_struct = false +indent_brace_parent = false +indent_paren_open_brace = false +indent_cs_delegate_brace = false +indent_cs_delegate_body = false +indent_namespace = false +indent_namespace_single_indent = false +indent_namespace_level = 0 +indent_namespace_limit = 0 +indent_extern = false +indent_class = true +indent_class_colon = false +indent_class_on_colon = false +indent_constr_colon = false +indent_ctor_init_leading = 2 +indent_ctor_init = 0 +indent_else_if = false +indent_var_def_blk = 0 +indent_var_def_cont = false +indent_shift = false +indent_func_def_force_col1 = false +indent_func_call_param = false +indent_func_def_param = false +indent_func_def_param_paren_pos_threshold = 0 +indent_func_proto_param = false +indent_func_class_param = false +indent_func_ctor_var_param = false +indent_template_param = false +indent_func_param_double = false +indent_func_const = 1 +indent_func_throw = 1 +indent_macro_brace = true +indent_member = 1 +indent_member_single = false +indent_sing_line_comments = 0 +indent_relative_single_line_comments = true +indent_switch_case = 4 +indent_switch_break_with_case = false +indent_switch_pp = true +indent_case_shift = 0 +indent_case_brace = 0 +indent_col1_comment = false +indent_col1_multi_string_literal = false +indent_label = 1 +indent_access_spec = 1 +indent_access_spec_body = false +indent_paren_nl = false +indent_paren_close = 1 +indent_paren_after_func_def = false +indent_paren_after_func_decl = false +indent_paren_after_func_call = false +indent_comma_paren = false +indent_bool_paren = false +indent_semicolon_for_paren = false +indent_first_bool_expr = false +indent_first_for_expr = false +indent_square_nl = false +indent_preserve_sql = true +indent_align_assign = true +indent_align_paren = true +indent_oc_block = true +indent_oc_block_msg = 0 +indent_oc_msg_colon = 0 +indent_oc_msg_prioritize_first_colon = true +indent_oc_block_msg_xcode_style = false +indent_oc_block_msg_from_keyword = false +indent_oc_block_msg_from_colon = false +indent_oc_block_msg_from_caret = false +indent_oc_block_msg_from_brace = false +indent_min_vbrace_open = 0 +indent_vbrace_open_on_tabstop = false +indent_token_after_brace = true +indent_cpp_lambda_body = false +indent_using_block = true +indent_ternary_operator = 0 +indent_off_after_return_new = false +indent_single_after_return = false +indent_ignore_asm_block = false +nl_collapse_empty_body = false +nl_assign_leave_one_liners = true +nl_class_leave_one_liners = false +nl_enum_leave_one_liners = true +nl_getset_leave_one_liners = false +nl_cs_property_leave_one_liners = true +nl_func_leave_one_liners = true +nl_cpp_lambda_leave_one_liners = false +nl_if_leave_one_liners = false +nl_while_leave_one_liners = false +nl_for_leave_one_liners = false +nl_oc_msg_leave_one_liner = false +nl_oc_mdef_brace = force +nl_oc_block_brace = remove +nl_oc_before_interface = force +nl_oc_before_implementation = force +nl_oc_before_end = force +nl_oc_interface_brace = force +nl_oc_implementation_brace = force +nl_start_of_file = remove +nl_start_of_file_min = 0 +nl_end_of_file = force +nl_end_of_file_min = 1 +nl_assign_brace = remove +nl_assign_square = ignore +nl_tsquare_brace = ignore +nl_after_square_assign = ignore +nl_fcall_brace = force +nl_enum_brace = remove +nl_enum_class = ignore +nl_enum_class_identifier = ignore +nl_enum_identifier_colon = ignore +nl_enum_colon_type = ignore +nl_struct_brace = remove +nl_union_brace = remove +nl_if_brace = remove +nl_brace_else = force +nl_elseif_brace = remove +nl_else_brace = remove +nl_else_if = remove +nl_before_if_closing_paren = ignore +nl_brace_finally = force +nl_finally_brace = remove +nl_try_brace = remove +nl_getset_brace = force +nl_for_brace = remove +nl_catch_brace = remove +nl_oc_catch_brace = remove +nl_brace_catch = force +nl_oc_brace_catch = force +nl_brace_square = remove +nl_brace_fparen = remove +nl_while_brace = remove +nl_scope_brace = ignore +nl_unittest_brace = ignore +nl_version_brace = ignore +nl_using_brace = ignore +nl_brace_brace = force +nl_do_brace = remove +nl_brace_while = force +nl_switch_brace = remove +nl_synchronized_brace = remove +nl_multi_line_cond = false +nl_multi_line_sparen_open = ignore +nl_multi_line_sparen_close = ignore +nl_multi_line_define = false +nl_before_case = true +nl_after_case = true +nl_case_colon_brace = force +nl_before_throw = force +nl_namespace_brace = force +nl_template_class = force +nl_template_class_decl = force +nl_template_class_decl_special = force +nl_template_class_def = force +nl_template_class_def_special = force +nl_template_func = force +nl_template_func_decl = ignore +nl_template_func_decl_special = ignore +nl_template_func_def = force +nl_template_func_def_special = force +nl_template_var = ignore +nl_template_using = ignore +nl_class_brace = force +nl_class_init_args = force +nl_constr_init_args = ignore +nl_enum_own_lines = ignore +nl_func_type_name = remove +nl_func_type_name_class = ignore +nl_func_class_scope = ignore +nl_func_scope_name = remove +nl_func_proto_type_name = remove +nl_func_paren = remove +nl_func_paren_empty = ignore +nl_func_def_paren = remove +nl_func_def_paren_empty = ignore +nl_func_call_paren = ignore +nl_func_call_paren_empty = ignore +nl_func_decl_start = remove +nl_func_def_start = remove +nl_func_decl_start_single = ignore +nl_func_def_start_single = ignore +nl_func_decl_start_multi_line = false +nl_func_def_start_multi_line = false +nl_func_decl_args = ignore +nl_func_def_args = ignore +nl_func_decl_args_multi_line = false +nl_func_def_args_multi_line = false +nl_func_decl_end = remove +nl_func_def_end = remove +nl_func_decl_end_single = ignore +nl_func_def_end_single = ignore +nl_func_decl_end_multi_line = false +nl_func_def_end_multi_line = false +nl_func_decl_empty = remove +nl_func_def_empty = remove +nl_func_call_empty = ignore +nl_func_call_start = ignore +nl_func_call_start_multi_line = false +nl_func_call_args_multi_line = false +nl_func_call_end_multi_line = false +nl_template_start = false +nl_template_args = false +nl_template_end = false +nl_oc_msg_args = false +nl_fdef_brace = force +nl_fdef_brace_cond = force +nl_cpp_ldef_brace = ignore +nl_return_expr = remove +nl_after_semicolon = true +nl_paren_dbrace_open = ignore +nl_type_brace_init_lst = ignore +nl_type_brace_init_lst_open = ignore +nl_type_brace_init_lst_close = ignore +nl_after_brace_open = true +nl_after_brace_open_cmt = false +nl_after_vbrace_open = true +nl_after_vbrace_open_empty = false +nl_after_brace_close = false +nl_after_vbrace_close = false +nl_brace_struct_var = force +nl_define_macro = false +nl_squeeze_paren_close = false +nl_squeeze_ifdef = true +nl_squeeze_ifdef_top_level = false +nl_before_if = ignore +nl_after_if = ignore +nl_before_for = ignore +nl_after_for = ignore +nl_before_while = ignore +nl_after_while = ignore +nl_before_switch = ignore +nl_after_switch = ignore +nl_before_synchronized = ignore +nl_after_synchronized = ignore +nl_before_do = ignore +nl_after_do = ignore +nl_before_return = false +nl_after_return = true +nl_before_member = ignore +nl_after_member = ignore +nl_ds_struct_enum_cmt = false +nl_ds_struct_enum_close_brace = false +nl_class_colon = remove +nl_constr_colon = ignore +nl_namespace_two_to_one_liner = false +nl_create_if_one_liner = true +nl_create_for_one_liner = false +nl_create_while_one_liner = false +nl_create_func_def_one_liner = false +nl_create_list_one_liner = false +nl_split_if_one_liner = false +nl_split_for_one_liner = false +nl_split_while_one_liner = false +nl_max = 2 +nl_max_blank_in_func = 0 +nl_before_func_body_proto = 0 +nl_before_func_body_def = 0 +nl_before_func_class_proto = 0 +nl_before_func_class_def = 0 +nl_after_func_proto = 1 +nl_after_func_proto_group = 2 +nl_after_func_class_proto = 0 +nl_after_func_class_proto_group = 0 +nl_class_leave_one_liner_groups = false +nl_after_func_body = 2 +nl_after_func_body_class = 0 +nl_after_func_body_one_liner = 1 +nl_func_var_def_blk = 1 +nl_typedef_blk_start = 0 +nl_typedef_blk_end = 0 +nl_typedef_blk_in = 0 +nl_var_def_blk_start = 0 +nl_var_def_blk_end = 0 +nl_var_def_blk_in = 0 +nl_before_block_comment = 2 +nl_before_c_comment = 2 +nl_before_cpp_comment = 1 +nl_after_multiline_comment = false +nl_after_label_colon = false +nl_after_struct = 0 +nl_before_class = 0 +nl_after_class = 0 +nl_before_namespace = 0 +nl_inside_namespace = 0 +nl_after_namespace = 0 +nl_before_access_spec = 2 +nl_after_access_spec = 1 +nl_comment_func_def = 1 +nl_after_try_catch_finally = 1 +nl_around_cs_property = 1 +nl_between_get_set = 1 +nl_property_brace = ignore +eat_blanks_after_open_brace = true +eat_blanks_before_close_brace = true +nl_remove_extra_newlines = 0 +nl_after_annotation = ignore +nl_between_annotation = ignore +pos_arith = trail +pos_assign = trail +pos_bool = trail +pos_compare = trail +pos_conditional = trail +pos_comma = trail +pos_enum_comma = ignore +pos_class_comma = trail +pos_constr_comma = ignore +pos_class_colon = trail +pos_constr_colon = ignore +code_width = 0 +ls_for_split_full = true +ls_func_split_full = true +ls_code_width = false +align_keep_tabs = false +align_with_tabs = false +align_on_tabstop = false +align_number_right = false +align_keep_extra_space = false +align_func_params = true +align_func_params_span = 0 +align_func_params_thresh = 0 +align_func_params_gap = 0 +align_constr_value_span = 0 +align_constr_value_thresh = 0 +align_constr_value_gap = 0 +align_same_func_call_params = false +align_same_func_call_params_span = 0 +align_same_func_call_params_thresh = 0 +align_var_def_span = 0 +align_var_def_star_style = 1 +align_var_def_amp_style = 1 +align_var_def_thresh = 0 +align_var_def_gap = 0 +align_var_def_colon = true +align_var_def_colon_gap = 0 +align_var_def_attribute = true +align_var_def_inline = true +align_assign_span = 1 +align_assign_func_proto_span = 0 +align_assign_thresh = 0 +align_assign_decl_func = 0 +align_enum_equ_span = 1 +align_enum_equ_thresh = 0 +align_var_class_span = 0 +align_var_class_thresh = 0 +align_var_class_gap = 0 +align_var_struct_span = 1 +align_var_struct_thresh = 0 +align_var_struct_gap = 1 +align_struct_init_span = 2 +align_typedef_span = 2 +align_typedef_gap = 1 +align_typedef_func = 0 +align_typedef_star_style = 1 +align_typedef_amp_style = 1 +align_right_cmt_span = 2 +align_right_cmt_gap = 1 +align_right_cmt_mix = false +align_right_cmt_same_level = false +align_right_cmt_at_col = 1 +align_func_proto_span = 2 +align_func_proto_thresh = 0 +align_func_proto_gap = 1 +align_on_operator = true +align_mix_var_proto = true +align_single_line_func = true +align_single_line_brace = true +align_single_line_brace_gap = 1 +align_oc_msg_spec_span = 0 +align_nl_cont = false +align_pp_define_together = false +align_pp_define_span = 2 +align_pp_define_gap = 1 +align_left_shift = true +align_asm_colon = false +align_oc_msg_colon_span = 16 +align_oc_msg_colon_first = false +align_oc_decl_colon = true +cmt_width = 0 +cmt_reflow_mode = 0 +cmt_convert_tab_to_spaces = true +cmt_indent_multi = true +cmt_c_group = true +cmt_c_nl_start = true +cmt_c_nl_end = true +cmt_cpp_to_c = false +cmt_cpp_group = true +cmt_cpp_nl_start = true +cmt_cpp_nl_end = true +cmt_star_cont = true +cmt_sp_before_star_cont = 0 +cmt_sp_after_star_cont = 0 +cmt_multi_check_last = true +cmt_multi_first_len_minimum = 4 +cmt_insert_file_header = "" +cmt_insert_file_footer = "" +cmt_insert_func_header = "" +cmt_insert_class_header = "" +cmt_insert_oc_msg_header = "" +cmt_insert_before_preproc = false +cmt_insert_before_inlines = true +cmt_insert_before_ctor_dtor = false +mod_full_brace_do = force +mod_full_brace_for = force +mod_full_brace_function = force +mod_full_brace_if = force +mod_full_brace_if_chain = false +mod_full_brace_if_chain_only = false +mod_full_brace_while = force +mod_full_brace_using = ignore +mod_full_brace_nl = 1 +mod_full_brace_nl_block_rem_mlcond = false +mod_paren_on_return = remove +mod_pawn_semicolon = true +mod_full_paren_if_bool = true +mod_remove_extra_semicolon = true +mod_add_long_function_closebrace_comment = 0 mod_add_long_namespace_closebrace_comment = 0 -mod_add_long_switch_closebrace_comment = 0 -mod_add_long_ifdef_endif_comment = 0 -mod_add_long_ifdef_else_comment = 0 -mod_sort_import = true -mod_sort_using = false -mod_sort_include = true -mod_move_case_break = false -mod_case_brace = remove -mod_remove_empty_return = true -cmt_width = 0 -cmt_reflow_mode = 0 -cmt_convert_tab_to_spaces = true -cmt_indent_multi = true -cmt_c_group = true -cmt_c_nl_start = true -cmt_c_nl_end = true -cmt_cpp_group = true -cmt_cpp_nl_start = true -cmt_cpp_nl_end = true -cmt_cpp_to_c = false -cmt_star_cont = true -cmt_sp_before_star_cont = 0 -cmt_sp_after_star_cont = 0 -cmt_multi_check_last = true -cmt_insert_file_header = "" -cmt_insert_file_footer = "" -cmt_insert_func_header = "" -cmt_insert_class_header = "" -cmt_insert_oc_msg_header = "" -cmt_insert_before_preproc = false -pp_indent = force -pp_indent_at_level = false -pp_indent_count = 0 -pp_space = remove -pp_space_count = 0 -pp_indent_region = 0 -pp_region_indent_code = false -pp_indent_if = 0 -pp_if_indent_code = false -pp_define_at_level = false -use_indent_func_call_param = true -use_indent_continue_only_once = false -# option(s) with 'not default' value: 0 +mod_add_long_class_closebrace_comment = 0 +mod_add_long_switch_closebrace_comment = 0 +mod_add_long_ifdef_endif_comment = 0 +mod_add_long_ifdef_else_comment = 0 +mod_sort_case_sensitive = false +mod_sort_import = true +mod_sort_using = false +mod_sort_include = true +mod_move_case_break = false +mod_case_brace = remove +mod_remove_empty_return = true +mod_enum_last_comma = remove +mod_sort_oc_properties = false +mod_sort_oc_property_class_weight = 0 +mod_sort_oc_property_thread_safe_weight = 0 +mod_sort_oc_property_readwrite_weight = 0 +mod_sort_oc_property_reference_weight = 0 +mod_sort_oc_property_getter_weight = 0 +mod_sort_oc_property_setter_weight = 0 +mod_sort_oc_property_nullability_weight = 0 +pp_indent = force +pp_indent_at_level = false +pp_indent_count = 0 +pp_space = remove +pp_space_count = 0 +pp_indent_region = 0 +pp_region_indent_code = false +pp_indent_if = 0 +pp_if_indent_code = false +pp_define_at_level = false +pp_ignore_define_body = false +pp_indent_case = true +pp_indent_func_def = true +pp_indent_extern = true +pp_indent_brace = true +include_category_0 = "" +include_category_1 = "" +include_category_2 = "" +use_indent_func_call_param = true +use_indent_continue_only_once = false +indent_cpp_lambda_only_once = false +use_sp_after_angle_always = false +use_options_overriding_for_qt_macros = true +warn_level_tabs_found_in_verbatim_string_literals = 2 +# option(s) with 'not default' value: 332 #