Remove no-longer-used RSTextDrawing.framework.
This commit is contained in:
parent
660afb04fa
commit
a1374d5420
@ -1,28 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>$(CURRENT_PROJECT_VERSION)</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>Copyright © 2016 Ranchero Software, LLC. All rights reserved.</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string></string>
|
||||
</dict>
|
||||
</plist>
|
@ -1,28 +0,0 @@
|
||||
//
|
||||
// RSMultiLineRenderer.h
|
||||
// RSTextDrawing
|
||||
//
|
||||
// Created by Brent Simmons on 3/3/16.
|
||||
// Copyright © 2016 Ranchero Software, LLC. All rights reserved.
|
||||
//
|
||||
|
||||
@import AppKit;
|
||||
#import <RSTextDrawing/RSTextRendererProtocol.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@class RSMultiLineRendererMeasurements;
|
||||
|
||||
|
||||
@interface RSMultiLineRenderer : NSObject <RSTextRenderer>
|
||||
|
||||
+ (instancetype)rendererWithAttributedTitle:(NSAttributedString *)title;
|
||||
|
||||
- (RSMultiLineRendererMeasurements *)measurementsForWidth:(CGFloat)width;
|
||||
|
||||
@property (nonatomic, strong) NSColor *backgroundColor; // Default is white.
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@ -1,315 +0,0 @@
|
||||
//
|
||||
// RSMultiLineRenderer.m
|
||||
// RSTextDrawing
|
||||
//
|
||||
// Created by Brent Simmons on 3/3/16.
|
||||
// Copyright © 2016 Ranchero Software, LLC. All rights reserved.
|
||||
//
|
||||
|
||||
#import "RSMultiLineRenderer.h"
|
||||
#import "RSMultiLineRendererMeasurements.h"
|
||||
|
||||
|
||||
@interface RSMultiLineRenderer ()
|
||||
|
||||
@property (nonatomic, readonly) NSAttributedString *title;
|
||||
@property (nonatomic) NSRect rect;
|
||||
@property (nonatomic, readonly) CTFramesetterRef framesetter;
|
||||
@property (nonatomic) CTFrameRef frameref;
|
||||
@property (nonatomic, readonly) NSMutableDictionary *measurementCache;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
static NSMutableDictionary *rendererCache = nil;
|
||||
static NSUInteger kMaximumNumberOfLines = 2;
|
||||
|
||||
|
||||
@implementation RSMultiLineRenderer
|
||||
|
||||
|
||||
#pragma mark - Class Methods
|
||||
|
||||
+ (instancetype)rendererWithAttributedTitle:(NSAttributedString *)title {
|
||||
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
rendererCache = [NSMutableDictionary new];
|
||||
});
|
||||
|
||||
RSMultiLineRenderer *cachedRenderer = rendererCache[title];
|
||||
if (cachedRenderer != nil) {
|
||||
return cachedRenderer;
|
||||
}
|
||||
|
||||
RSMultiLineRenderer *renderer = [[RSMultiLineRenderer alloc] initWithAttributedTitle:title];
|
||||
rendererCache[title] = renderer;
|
||||
return renderer;
|
||||
}
|
||||
|
||||
|
||||
+ (void)emptyCache {
|
||||
|
||||
for (RSMultiLineRenderer *oneRenderer in rendererCache.allValues) {
|
||||
[oneRenderer emptyCache];
|
||||
[oneRenderer releaseFrameref];
|
||||
}
|
||||
|
||||
rendererCache = [NSMutableDictionary new];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark Init
|
||||
|
||||
- (instancetype)initWithAttributedTitle:(NSAttributedString *)title {
|
||||
|
||||
self = [super init];
|
||||
if (self == nil) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
_title = title;
|
||||
_measurementCache = [NSMutableDictionary new];
|
||||
_framesetter = CTFramesetterCreateWithAttributedString((__bridge CFAttributedStringRef)title);
|
||||
_backgroundColor = NSColor.whiteColor;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark Dealloc
|
||||
|
||||
- (void)dealloc {
|
||||
|
||||
if (_framesetter) {
|
||||
CFRelease(_framesetter);
|
||||
_framesetter = nil;
|
||||
}
|
||||
|
||||
if (_frameref) {
|
||||
CFRelease(_frameref);
|
||||
_frameref = nil;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#pragma mark Accessors
|
||||
|
||||
- (void)setRect:(NSRect)r {
|
||||
|
||||
r.origin.y = floor(r.origin.y);
|
||||
r.origin.x = floor(r.origin.x);
|
||||
r.size.height = floor(r.size.height);
|
||||
r.size.width = floor(r.size.width);
|
||||
|
||||
if (!NSEqualRects(r, _rect)) {
|
||||
_rect = r;
|
||||
[self releaseFrameref];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)releaseFrameref {
|
||||
|
||||
if (_frameref) {
|
||||
CFRelease(_frameref);
|
||||
_frameref = nil;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Measurements
|
||||
|
||||
- (NSInteger)integerForWidth:(CGFloat)width {
|
||||
|
||||
return (NSInteger)(floor(width));
|
||||
}
|
||||
|
||||
|
||||
- (NSNumber *)keyForWidth:(CGFloat)width {
|
||||
|
||||
return @([self integerForWidth:width]);
|
||||
}
|
||||
|
||||
- (RSMultiLineRendererMeasurements *)measurementsByRegardingNarrowerNeighborsInCache:(CGFloat)width {
|
||||
|
||||
/*If width==30, and cached measurements for width==15 indicate that it's a single line of text, then return those measurements.*/
|
||||
|
||||
NSInteger w = [self integerForWidth:width];
|
||||
static const NSInteger kSingleLineHeightWithSlop = 20;
|
||||
|
||||
for (NSNumber *oneKey in self.measurementCache.allKeys) {
|
||||
|
||||
NSInteger oneWidth = oneKey.integerValue;
|
||||
|
||||
if (oneWidth < w) {
|
||||
RSMultiLineRendererMeasurements *oneMeasurements = self.measurementCache[oneKey];
|
||||
if (oneMeasurements.height <= kSingleLineHeightWithSlop) {
|
||||
return oneMeasurements;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
||||
- (RSMultiLineRendererMeasurements *)measurementsByRegardingNeighborsInCache:(CGFloat)width {
|
||||
|
||||
/*If width==30, and the cached measurements for width==15 and width==42 are equal, then we can use one of those for width==30.*/
|
||||
|
||||
if (self.measurementCache.count < 2) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
NSInteger w = [self integerForWidth:width];
|
||||
NSInteger lessThanNeighbor = NSNotFound;
|
||||
NSInteger greaterThanNeighbor = NSNotFound;
|
||||
|
||||
for (NSNumber *oneKey in self.measurementCache.allKeys) {
|
||||
|
||||
NSInteger oneWidth = oneKey.integerValue;
|
||||
if (oneWidth < w) {
|
||||
if (lessThanNeighbor == NSNotFound) {
|
||||
lessThanNeighbor = oneWidth;
|
||||
}
|
||||
else if (lessThanNeighbor < oneWidth) {
|
||||
lessThanNeighbor = oneWidth;
|
||||
}
|
||||
}
|
||||
if (oneWidth > w) {
|
||||
if (greaterThanNeighbor == NSNotFound) {
|
||||
greaterThanNeighbor = oneWidth;
|
||||
}
|
||||
else if (greaterThanNeighbor > oneWidth) {
|
||||
greaterThanNeighbor = oneWidth;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (lessThanNeighbor == NSNotFound || greaterThanNeighbor == NSNotFound) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
RSMultiLineRendererMeasurements *lessThanMeasurements = self.measurementCache[@(lessThanNeighbor)];
|
||||
RSMultiLineRendererMeasurements *greaterThanMeasurements = self.measurementCache[@(greaterThanNeighbor)];
|
||||
|
||||
if ([lessThanMeasurements isEqual:greaterThanMeasurements]) {
|
||||
return lessThanMeasurements;
|
||||
}
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (RSMultiLineRendererMeasurements *)measurementsForWidth:(CGFloat)width {
|
||||
|
||||
NSNumber *key = [self keyForWidth:width];
|
||||
RSMultiLineRendererMeasurements *cachedMeasurements = self.measurementCache[key];
|
||||
if (cachedMeasurements) {
|
||||
return cachedMeasurements;
|
||||
}
|
||||
|
||||
RSMultiLineRendererMeasurements *measurements = [self measurementsByRegardingNarrowerNeighborsInCache:width];
|
||||
if (measurements) {
|
||||
return measurements;
|
||||
}
|
||||
measurements = [self measurementsByRegardingNeighborsInCache:width];
|
||||
if (measurements) {
|
||||
return measurements;
|
||||
}
|
||||
|
||||
measurements = [self calculatedMeasurementsForWidth:width];
|
||||
self.measurementCache[key] = measurements;
|
||||
return measurements;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - Cache
|
||||
|
||||
- (void)emptyCache {
|
||||
|
||||
[self.measurementCache removeAllObjects];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark Rendering
|
||||
|
||||
static const CGFloat kMaxHeight = 10000.0;
|
||||
|
||||
- (RSMultiLineRendererMeasurements *)calculatedMeasurementsForWidth:(CGFloat)width {
|
||||
|
||||
NSInteger height = 0;
|
||||
NSInteger heightOfFirstLine = 0;
|
||||
|
||||
width = floor(width);
|
||||
|
||||
@autoreleasepool {
|
||||
|
||||
CGRect r = CGRectMake(0.0f, 0.0f, width, kMaxHeight);
|
||||
CGPathRef path = CGPathCreateWithRect(r, NULL);
|
||||
|
||||
CTFrameRef frameref = CTFramesetterCreateFrame(self.framesetter, CFRangeMake(0, (CFIndex)(self.title.length)), path, NULL);
|
||||
|
||||
NSArray *lines = (__bridge NSArray *)CTFrameGetLines(frameref);
|
||||
|
||||
if (lines.count > 0) {
|
||||
|
||||
NSUInteger indexOfLastLine = MIN(kMaximumNumberOfLines - 1, lines.count - 1);
|
||||
|
||||
CGPoint origins[indexOfLastLine + 1];
|
||||
CTFrameGetLineOrigins(frameref, CFRangeMake(0, (CFIndex)indexOfLastLine + 1), origins);
|
||||
|
||||
CTLineRef lastLine = (__bridge CTLineRef)lines[indexOfLastLine];
|
||||
CGPoint lastOrigin = origins[indexOfLastLine];
|
||||
CGFloat descent;
|
||||
CTLineGetTypographicBounds(lastLine, NULL, &descent, NULL);
|
||||
height = r.size.height - (ceil(lastOrigin.y) - ceil(descent));
|
||||
height = (NSInteger)ceil(height);
|
||||
|
||||
CTLineRef firstLine = (__bridge CTLineRef)lines[0];
|
||||
CGRect firstLineRect = CTLineGetBoundsWithOptions(firstLine, 0);
|
||||
heightOfFirstLine = (NSInteger)ceil(NSHeight(firstLineRect));
|
||||
|
||||
}
|
||||
|
||||
CFRelease(path);
|
||||
CFRelease(frameref);
|
||||
}
|
||||
|
||||
RSMultiLineRendererMeasurements *measurements = [RSMultiLineRendererMeasurements measurementsWithHeight:height heightOfFirstLine:heightOfFirstLine];
|
||||
return measurements;
|
||||
}
|
||||
|
||||
|
||||
- (void)renderTextInRect:(CGRect)r {
|
||||
|
||||
self.rect = r;
|
||||
|
||||
CGContextRef context = [NSGraphicsContext currentContext].CGContext;
|
||||
CGContextSaveGState(context);
|
||||
|
||||
CGContextSetFillColorWithColor(context, self.backgroundColor.CGColor);
|
||||
CGContextFillRect(context, r);
|
||||
|
||||
CGContextSetShouldSmoothFonts(context, true);
|
||||
|
||||
CTFrameDraw(self.frameref, context);
|
||||
|
||||
CGContextRestoreGState(context);
|
||||
}
|
||||
|
||||
|
||||
- (CTFrameRef)frameref {
|
||||
|
||||
if (_frameref) {
|
||||
return _frameref;
|
||||
}
|
||||
|
||||
CGPathRef path = CGPathCreateWithRect(self.rect, NULL);
|
||||
|
||||
_frameref = CTFramesetterCreateFrame(self.framesetter, CFRangeMake(0, (CFIndex)(self.title.length)), path, NULL);
|
||||
|
||||
CFRelease(path);
|
||||
|
||||
return _frameref;
|
||||
}
|
||||
|
||||
@end
|
@ -1,18 +0,0 @@
|
||||
//
|
||||
// RSMultiLineRendererMeasurements.h
|
||||
// RSTextDrawing
|
||||
//
|
||||
// Created by Brent Simmons on 3/4/16.
|
||||
// Copyright © 2016 Ranchero Software, LLC. All rights reserved.
|
||||
//
|
||||
|
||||
@import Foundation;
|
||||
|
||||
@interface RSMultiLineRendererMeasurements : NSObject
|
||||
|
||||
+ (instancetype)measurementsWithHeight:(NSInteger)height heightOfFirstLine:(NSInteger)heightOfFirstLine;
|
||||
|
||||
@property (nonatomic, readonly) NSInteger height;
|
||||
@property (nonatomic, readonly) NSInteger heightOfFirstLine;
|
||||
|
||||
@end
|
@ -1,59 +0,0 @@
|
||||
//
|
||||
// RSMultiLineRendererMeasurements.m
|
||||
// RSTextDrawing
|
||||
//
|
||||
// Created by Brent Simmons on 3/4/16.
|
||||
// Copyright © 2016 Ranchero Software, LLC. All rights reserved.
|
||||
//
|
||||
|
||||
#import "RSMultiLineRendererMeasurements.h"
|
||||
|
||||
@implementation RSMultiLineRendererMeasurements
|
||||
|
||||
#pragma mark - Class Methods
|
||||
|
||||
+ (instancetype)measurementsWithHeight:(NSInteger)height heightOfFirstLine:(NSInteger)heightOfFirstLine {
|
||||
|
||||
return [[self alloc] initWithHeight:height heightOfFirstLine:heightOfFirstLine];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - Init
|
||||
|
||||
- (instancetype)initWithHeight:(NSInteger)height heightOfFirstLine:(NSInteger)heightOfFirstLine {
|
||||
|
||||
self = [super init];
|
||||
if (!self) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
_height = height;
|
||||
_heightOfFirstLine = heightOfFirstLine;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (BOOL)isEqualToMultiLineRendererMeasurements:(RSMultiLineRendererMeasurements *)otherMeasurements {
|
||||
|
||||
return self.height == otherMeasurements.height && self.heightOfFirstLine == otherMeasurements.heightOfFirstLine;
|
||||
}
|
||||
|
||||
- (BOOL)isEqual:(id)object {
|
||||
|
||||
if (self == object) {
|
||||
return YES;
|
||||
}
|
||||
if (![object isKindOfClass:[self class]]) {
|
||||
return NO;
|
||||
}
|
||||
|
||||
return [self isEqualToMultiLineRendererMeasurements:(RSMultiLineRendererMeasurements *)object];
|
||||
}
|
||||
|
||||
- (NSUInteger)hash {
|
||||
|
||||
return (NSUInteger)(self.height + (self.heightOfFirstLine * 100000));
|
||||
}
|
||||
|
||||
|
||||
@end
|
@ -1,26 +0,0 @@
|
||||
//
|
||||
// RSMultiLineView.h
|
||||
// RSTextDrawing
|
||||
//
|
||||
// Created by Brent Simmons on 5/27/16.
|
||||
// Copyright © 2016 Ranchero Software, LLC. All rights reserved.
|
||||
//
|
||||
|
||||
@import AppKit;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@class RSMultiLineRendererMeasurements;
|
||||
|
||||
@interface RSMultiLineView : NSView
|
||||
|
||||
@property (nonatomic) NSAttributedString *attributedStringValue;
|
||||
|
||||
@property (nonatomic, readonly) RSMultiLineRendererMeasurements *measurements;
|
||||
|
||||
@property (nonatomic) BOOL selected;
|
||||
@property (nonatomic) BOOL emphasized;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@ -1,171 +0,0 @@
|
||||
//
|
||||
// RSMultiLineView.m
|
||||
// RSTextDrawing
|
||||
//
|
||||
// Created by Brent Simmons on 5/27/16.
|
||||
// Copyright © 2016 Ranchero Software, LLC. All rights reserved.
|
||||
//
|
||||
|
||||
@import RSCore;
|
||||
#import "RSMultiLineView.h"
|
||||
#import "RSMultiLineRenderer.h"
|
||||
#import "RSMultiLineRendererMeasurements.h"
|
||||
|
||||
|
||||
@interface RSMultiLineView ()
|
||||
|
||||
@property (nonatomic) RSMultiLineRenderer *renderer;
|
||||
@property (nonatomic) NSSize intrinsicSize;
|
||||
@property (nonatomic) BOOL intrinsicSizeIsValid;
|
||||
@property (nonatomic) RSMultiLineRenderer *selectedRenderer;
|
||||
@property (nonatomic) NSAttributedString *selectedAttributedStringValue;
|
||||
|
||||
@end
|
||||
|
||||
static NSAttributedString *emptyAttributedString = nil;
|
||||
|
||||
@implementation RSMultiLineView
|
||||
|
||||
|
||||
- (instancetype)initWithFrame:(NSRect)frame {
|
||||
|
||||
self = [super initWithFrame:frame];
|
||||
if (!self) {
|
||||
return nil;
|
||||
}
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
emptyAttributedString = [[NSAttributedString alloc] initWithString:@""];
|
||||
});
|
||||
|
||||
_renderer = [RSMultiLineRenderer rendererWithAttributedTitle:emptyAttributedString];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
- (void)setRenderer:(RSMultiLineRenderer *)renderer {
|
||||
|
||||
if (_renderer == renderer) {
|
||||
return;
|
||||
}
|
||||
_renderer = renderer;
|
||||
|
||||
[self invalidateIntrinsicContentSize];
|
||||
self.needsDisplay = YES;
|
||||
}
|
||||
|
||||
- (RSMultiLineRenderer *)selectedRenderer {
|
||||
|
||||
if (_selectedRenderer) {
|
||||
return _selectedRenderer;
|
||||
}
|
||||
|
||||
_selectedRenderer = [RSMultiLineRenderer rendererWithAttributedTitle:self.selectedAttributedStringValue];
|
||||
_selectedRenderer.backgroundColor = NSColor.alternateSelectedControlColor;
|
||||
return _selectedRenderer;
|
||||
}
|
||||
|
||||
|
||||
- (void)setSelected:(BOOL)selected {
|
||||
|
||||
_selected = selected;
|
||||
self.needsDisplay = YES;
|
||||
}
|
||||
|
||||
|
||||
- (void)setEmphasized:(BOOL)emphasized {
|
||||
|
||||
_emphasized = emphasized;
|
||||
self.needsDisplay = YES;
|
||||
}
|
||||
|
||||
|
||||
- (NSAttributedString *)selectedAttributedStringValue {
|
||||
|
||||
if (!self.attributedStringValue) {
|
||||
return emptyAttributedString;
|
||||
}
|
||||
|
||||
NSMutableAttributedString *s = [self.attributedStringValue mutableCopy];
|
||||
[s addAttribute:NSForegroundColorAttributeName value:NSColor.alternateSelectedControlTextColor range:NSMakeRange(0, s.string.length)];
|
||||
_selectedAttributedStringValue = s;
|
||||
|
||||
return _selectedAttributedStringValue;
|
||||
}
|
||||
|
||||
|
||||
- (void)setAttributedStringValue:(NSAttributedString *)attributedStringValue {
|
||||
|
||||
if (_attributedStringValue == attributedStringValue) {
|
||||
return;
|
||||
}
|
||||
_attributedStringValue = attributedStringValue;
|
||||
|
||||
self.selectedAttributedStringValue = nil;
|
||||
self.selectedRenderer = nil;
|
||||
|
||||
self.renderer = [RSMultiLineRenderer rendererWithAttributedTitle:attributedStringValue];
|
||||
}
|
||||
|
||||
|
||||
- (RSMultiLineRendererMeasurements *)measurements {
|
||||
|
||||
return [self.renderer measurementsForWidth:NSWidth(self.frame)];
|
||||
}
|
||||
|
||||
|
||||
- (void)invalidateIntrinsicContentSize {
|
||||
|
||||
self.intrinsicSizeIsValid = NO;
|
||||
}
|
||||
|
||||
|
||||
- (NSSize)intrinsicContentSize {
|
||||
|
||||
if (!self.intrinsicSizeIsValid) {
|
||||
self.intrinsicSize = NSMakeSize(NSWidth(self.frame), self.measurements.height);
|
||||
self.intrinsicSizeIsValid = YES;
|
||||
}
|
||||
return self.intrinsicSize;
|
||||
}
|
||||
|
||||
|
||||
- (void)setFrameSize:(NSSize)newSize {
|
||||
|
||||
[self invalidateIntrinsicContentSize];
|
||||
[super setFrameSize:newSize];
|
||||
}
|
||||
|
||||
|
||||
- (NSMenu *)menuForEvent:(NSEvent *)event {
|
||||
|
||||
NSTableView *tableView = [self rs_enclosingTableView];
|
||||
if (tableView) {
|
||||
return [tableView menuForEvent:event];
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
||||
- (void)drawRect:(NSRect)r {
|
||||
|
||||
if (self.selected) {
|
||||
|
||||
if (self.emphasized) {
|
||||
[self.selectedRenderer renderTextInRect:self.bounds];
|
||||
}
|
||||
else {
|
||||
NSColor *savedBackgroundColor = self.renderer.backgroundColor;
|
||||
self.renderer.backgroundColor = NSColor.secondarySelectedControlColor;
|
||||
[self.renderer renderTextInRect:self.bounds];
|
||||
self.renderer.backgroundColor = savedBackgroundColor;
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
[self.renderer renderTextInRect:self.bounds];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
@ -1,16 +0,0 @@
|
||||
//
|
||||
// RSTextDrawing.h
|
||||
// RSTextDrawing
|
||||
//
|
||||
// Created by Brent Simmons on 3/3/16.
|
||||
// Copyright © 2016 Ranchero Software, LLC. All rights reserved.
|
||||
//
|
||||
|
||||
@import AppKit;
|
||||
|
||||
#import <RSTextDrawing/RSMultiLineView.h>
|
||||
|
||||
#import <RSTextDrawing/RSMultiLineRenderer.h>
|
||||
#import <RSTextDrawing/RSMultiLineRendererMeasurements.h>
|
||||
#import <RSTextDrawing/RSTextRendererProtocol.h>
|
||||
|
@ -1,17 +0,0 @@
|
||||
//
|
||||
// RSTextRendererProtocol.h
|
||||
// RSTextDrawing
|
||||
//
|
||||
// Created by Brent Simmons on 3/6/16.
|
||||
// Copyright © 2016 Ranchero Software, LLC. All rights reserved.
|
||||
//
|
||||
|
||||
@import AppKit;
|
||||
|
||||
@protocol RSTextRenderer <NSObject>
|
||||
|
||||
- (void)renderTextInRect:(NSRect)r;
|
||||
|
||||
+ (void)emptyCache;
|
||||
|
||||
@end
|
@ -1,24 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>BNDL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
</dict>
|
||||
</plist>
|
@ -1,39 +0,0 @@
|
||||
//
|
||||
// RSTextDrawingTests.m
|
||||
// RSTextDrawingTests
|
||||
//
|
||||
// Created by Brent Simmons on 3/3/16.
|
||||
// Copyright © 2016 Ranchero Software, LLC. All rights reserved.
|
||||
//
|
||||
|
||||
#import <XCTest/XCTest.h>
|
||||
|
||||
@interface RSTextDrawingTests : XCTestCase
|
||||
|
||||
@end
|
||||
|
||||
@implementation RSTextDrawingTests
|
||||
|
||||
- (void)setUp {
|
||||
[super setUp];
|
||||
// Put setup code here. This method is called before the invocation of each test method in the class.
|
||||
}
|
||||
|
||||
- (void)tearDown {
|
||||
// Put teardown code here. This method is called after the invocation of each test method in the class.
|
||||
[super tearDown];
|
||||
}
|
||||
|
||||
- (void)testExample {
|
||||
// This is an example of a functional test case.
|
||||
// Use XCTAssert and related functions to verify your tests produce the correct results.
|
||||
}
|
||||
|
||||
- (void)testPerformanceExample {
|
||||
// This is an example of a performance test case.
|
||||
[self measureBlock:^{
|
||||
// Put the code you want to measure the time of here.
|
||||
}];
|
||||
}
|
||||
|
||||
@end
|
@ -1,18 +0,0 @@
|
||||
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES
|
||||
LD_RUNPATH_SEARCH_PATHS = $(inherited) @executable_path/../Frameworks @loader_path/../Frameworks
|
||||
INFOPLIST_FILE = RSTextDrawingTests/Info.plist
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.ranchero.RSTextDrawingTests
|
||||
PRODUCT_NAME = $(TARGET_NAME)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,55 +0,0 @@
|
||||
CODE_SIGN_IDENTITY =
|
||||
//CODE_SIGN_STYLE = Automatic
|
||||
//DEVELOPMENT_TEAM = M8L2WTLA8W
|
||||
|
||||
// See the notes in Evergreen_target.xcconfig on why the
|
||||
// DeveloperSettings.xcconfig is #included here
|
||||
|
||||
#include? "../../../SharedXcodeSettings/DeveloperSettings.xcconfig"
|
||||
|
||||
SDKROOT = macosx
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.13
|
||||
CLANG_ENABLE_OBJC_WEAK = YES
|
||||
SWIFT_VERSION = 3.0
|
||||
COMBINE_HIDPI_IMAGES = YES
|
||||
|
||||
COPY_PHASE_STRIP = NO
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.13
|
||||
ALWAYS_SEARCH_USER_PATHS = NO
|
||||
CURRENT_PROJECT_VERSION = 1
|
||||
VERSION_INFO_PREFIX =
|
||||
VERSIONING_SYSTEM = apple-generic
|
||||
GCC_NO_COMMON_BLOCKS = YES
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99
|
||||
CLANG_CXX_LANGUAGE_STANDARD = gnu++0x
|
||||
CLANG_CXX_LIBRARY = libc++
|
||||
CLANG_ENABLE_MODULES = YES
|
||||
CLANG_ENABLE_OBJC_ARC = YES
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES
|
||||
CLANG_WARN_EMPTY_BODY = YES
|
||||
CLANG_WARN_BOOL_CONVERSION = YES
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES
|
||||
CLANG_WARN_ENUM_CONVERSION = YES
|
||||
CLANG_WARN_INT_CONVERSION = YES
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES
|
||||
CLANG_WARN_INFINITE_RECURSION = YES
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES
|
||||
CLANG_WARN_COMMA = YES
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES
|
||||
GCC_WARN_UNUSED_FUNCTION = YES
|
||||
GCC_WARN_UNUSED_VARIABLE = YES
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES
|
||||
|
@ -1,15 +0,0 @@
|
||||
#include "./RSTextDrawing_project.xcconfig"
|
||||
|
||||
DEBUG_INFORMATION_FORMAT = dwarf
|
||||
ENABLE_TESTABILITY = YES
|
||||
GCC_DYNAMIC_NO_PIC = NO
|
||||
GCC_OPTIMIZATION_LEVEL = 0
|
||||
GCC_PREPROCESSOR_DEFINITIONS = DEBUG=1 $(inherited)
|
||||
|
||||
MTL_ENABLE_DEBUG_INFO = YES
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG
|
||||
SWIFT_COMPILATION_MODE = singlefile
|
||||
SWIFT_OPTIMIZATION_LEVEL = -Onone
|
||||
ONLY_ACTIVE_ARCH = YES
|
||||
|
||||
|
@ -1,9 +0,0 @@
|
||||
#include "./RSTextDrawing_project.xcconfig"
|
||||
|
||||
DEBUG_INFORMATION_FORMAT = dwarf-with-dsym
|
||||
ENABLE_NS_ASSERTIONS = NO
|
||||
|
||||
MTL_ENABLE_DEBUG_INFO = NO
|
||||
SWIFT_OPTIMIZATION_LEVEL = -O
|
||||
|
||||
SWIFT_COMPILATION_MODE = wholemodule
|
@ -1,14 +0,0 @@
|
||||
|
||||
INSTALL_PATH = $(LOCAL_LIBRARY_DIR)/Frameworks
|
||||
SKIP_INSTALL = YES
|
||||
DYLIB_COMPATIBILITY_VERSION = 1
|
||||
DYLIB_CURRENT_VERSION = 1
|
||||
DYLIB_INSTALL_NAME_BASE = @rpath
|
||||
LD_RUNPATH_SEARCH_PATHS = $(inherited) @executable_path/../Frameworks @loader_path/Frameworks
|
||||
DEFINES_MODULE = YES
|
||||
FRAMEWORK_VERSION = A
|
||||
INFOPLIST_FILE = RSTextDrawing/Info.plist
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.ranchero.RSTextDrawing
|
||||
PRODUCT_NAME = $(TARGET_NAME)
|
||||
CLANG_ENABLE_MODULES = YES
|
||||
|
Loading…
x
Reference in New Issue
Block a user