Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Classes/OMColorFrameView.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
NSColor *_color;
}

@property (nonatomic, retain) NSColor *color;
@property (nonatomic, strong) NSColor *color;

@end
8 changes: 1 addition & 7 deletions Classes/OMColorFrameView.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,10 @@ - (void)drawRect:(NSRect)dirtyRect
- (void)setColor:(NSColor *)color
{
if (color != _color) {
[_color release];
_color = [color retain];
_color = color;
[self setNeedsDisplay:YES];
}
}

- (void)dealloc
{
[_color release];
[super dealloc];
}

@end
6 changes: 3 additions & 3 deletions Classes/OMColorHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ BOOL OMColorTypeIsNSColor(OMColorType colorType) { return colorType >= OMColorTy
NSRegularExpression *_constantColorRegex;
}

@property (nonatomic, retain) OMPlainColorWell *colorWell;
@property (nonatomic, retain) OMColorFrameView *colorFrameView;
@property (nonatomic, retain) NSTextView *textView;
@property (nonatomic, strong) OMPlainColorWell *colorWell;
@property (nonatomic, strong) OMColorFrameView *colorFrameView;
@property (nonatomic, strong) NSTextView *textView;
@property (nonatomic, assign) NSRange selectedColorRange;
@property (nonatomic, assign) OMColorType selectedColorType;

Expand Down
32 changes: 11 additions & 21 deletions Classes/OMColorHelper.m
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ - (id)init
[NSColor brownColor], @"brown",
[[NSColor clearColor] colorUsingColorSpace:[NSColorSpace genericRGBColorSpace]], @"clear", nil];

_rgbaUIColorRegex = [[NSRegularExpression regularExpressionWithPattern:@"(\\[\\s*UIColor\\s+colorWith|\\[\\s*\\[\\s*UIColor\\s+alloc\\]\\s*initWith)Red:\\s*([0-9]*\\.?[0-9]*f?)\\s*(\\/\\s*[0-9]*\\.?[0-9]*f?)?\\s+green:\\s*([0-9]*\\.?[0-9]*f?)\\s*(\\/\\s*[0-9]*\\.?[0-9]*f?)?\\s+blue:\\s*([0-9]*\\.?[0-9]*f?)\\s*(\\/\\s*[0-9]*\\.?[0-9]*f?)?\\s*alpha:\\s*([0-9]*\\.?[0-9]*f?)\\s*(\\/\\s*[0-9]*\\.?[0-9]*f?)?\\s*\\]" options:0 error:NULL] retain];
_whiteUIColorRegex = [[NSRegularExpression regularExpressionWithPattern:@"(\\[\\s*UIColor\\s+colorWith|\\[\\s*\\[\\s*UIColor\\s+alloc\\]\\s*initWith)White:\\s*([0-9]*\\.?[0-9]*f?)\\s*(\\/\\s*[0-9]*\\.?[0-9]*f?)?\\s+alpha:\\s*([0-9]*\\.?[0-9]*f?)\\s*(\\/\\s*[0-9]*\\.?[0-9]*f?)?\\s*\\]" options:0 error:NULL] retain];
_rgbaNSColorRegex = [[NSRegularExpression regularExpressionWithPattern:@"\\[\\s*NSColor\\s+colorWith(Calibrated|Device)Red:\\s*([0-9]*\\.?[0-9]*f?)\\s*(\\/\\s*[0-9]*\\.?[0-9]*f?)?\\s+green:\\s*([0-9]*\\.?[0-9]*f?)\\s*(\\/\\s*[0-9]*\\.?[0-9]*f?)?\\s+blue:\\s*([0-9]*\\.?[0-9]*f?)\\s*(\\/\\s*[0-9]*\\.?[0-9]*f?)?\\s+alpha:\\s*([0-9]*\\.?[0-9]*f?)\\s*(\\/\\s*[0-9]*\\.?[0-9]*f?)?\\s*\\]" options:0 error:NULL] retain];
_whiteNSColorRegex = [[NSRegularExpression regularExpressionWithPattern:@"\\[\\s*NSColor\\s+colorWith(Calibrated|Device)White:\\s*([0-9]*\\.?[0-9]*f?)\\s*(\\/\\s*[0-9]*\\.?[0-9]*f?)?\\s+alpha:\\s*([0-9]*\\.?[0-9]*f?)\\s*(\\/\\s*[0-9]*\\.?[0-9]*f?)?\\s*\\]" options:0 error:NULL] retain];
_constantColorRegex = [[NSRegularExpression regularExpressionWithPattern:@"\\[\\s*(UI|NS)Color\\s+(black|darkGray|lightGray|white|gray|red|green|blue|cyan|yellow|magenta|orange|purple|brown|clear)Color\\s*\\]" options:0 error:NULL] retain];
_rgbaUIColorRegex = [NSRegularExpression regularExpressionWithPattern:@"(\\[\\s*UIColor\\s+colorWith|\\[\\s*\\[\\s*UIColor\\s+alloc\\]\\s*initWith)Red:\\s*([0-9]*\\.?[0-9]*f?)\\s*(\\/\\s*[0-9]*\\.?[0-9]*f?)?\\s+green:\\s*([0-9]*\\.?[0-9]*f?)\\s*(\\/\\s*[0-9]*\\.?[0-9]*f?)?\\s+blue:\\s*([0-9]*\\.?[0-9]*f?)\\s*(\\/\\s*[0-9]*\\.?[0-9]*f?)?\\s*alpha:\\s*([0-9]*\\.?[0-9]*f?)\\s*(\\/\\s*[0-9]*\\.?[0-9]*f?)?\\s*\\]" options:0 error:NULL];
_whiteUIColorRegex = [NSRegularExpression regularExpressionWithPattern:@"(\\[\\s*UIColor\\s+colorWith|\\[\\s*\\[\\s*UIColor\\s+alloc\\]\\s*initWith)White:\\s*([0-9]*\\.?[0-9]*f?)\\s*(\\/\\s*[0-9]*\\.?[0-9]*f?)?\\s+alpha:\\s*([0-9]*\\.?[0-9]*f?)\\s*(\\/\\s*[0-9]*\\.?[0-9]*f?)?\\s*\\]" options:0 error:NULL];
_rgbaNSColorRegex = [NSRegularExpression regularExpressionWithPattern:@"\\[\\s*NSColor\\s+colorWith(Calibrated|Device)Red:\\s*([0-9]*\\.?[0-9]*f?)\\s*(\\/\\s*[0-9]*\\.?[0-9]*f?)?\\s+green:\\s*([0-9]*\\.?[0-9]*f?)\\s*(\\/\\s*[0-9]*\\.?[0-9]*f?)?\\s+blue:\\s*([0-9]*\\.?[0-9]*f?)\\s*(\\/\\s*[0-9]*\\.?[0-9]*f?)?\\s+alpha:\\s*([0-9]*\\.?[0-9]*f?)\\s*(\\/\\s*[0-9]*\\.?[0-9]*f?)?\\s*\\]" options:0 error:NULL];
_whiteNSColorRegex = [NSRegularExpression regularExpressionWithPattern:@"\\[\\s*NSColor\\s+colorWith(Calibrated|Device)White:\\s*([0-9]*\\.?[0-9]*f?)\\s*(\\/\\s*[0-9]*\\.?[0-9]*f?)?\\s+alpha:\\s*([0-9]*\\.?[0-9]*f?)\\s*(\\/\\s*[0-9]*\\.?[0-9]*f?)?\\s*\\]" options:0 error:NULL];
_constantColorRegex = [NSRegularExpression regularExpressionWithPattern:@"\\[\\s*(UI|NS)Color\\s+(black|darkGray|lightGray|white|gray|red|green|blue|cyan|yellow|magenta|orange|purple|brown|clear)Color\\s*\\]" options:0 error:NULL];
}
return self;
}
Expand All @@ -65,23 +65,23 @@ - (void)applicationDidFinishLaunching:(NSNotification *)notification
if (editMenuItem) {
[[editMenuItem submenu] addItem:[NSMenuItem separatorItem]];

NSMenuItem *toggleColorHighlightingMenuItem = [[[NSMenuItem alloc] initWithTitle:@"Show Colors Under Caret" action:@selector(toggleColorHighlightingEnabled:) keyEquivalent:@""] autorelease];
NSMenuItem *toggleColorHighlightingMenuItem = [[NSMenuItem alloc] initWithTitle:@"Show Colors Under Caret" action:@selector(toggleColorHighlightingEnabled:) keyEquivalent:@""];
[toggleColorHighlightingMenuItem setTarget:self];
[[editMenuItem submenu] addItem:toggleColorHighlightingMenuItem];

NSMenuItem *colorInsertionModeItem = [[[NSMenuItem alloc] initWithTitle:@"Color Insertion Mode" action:nil keyEquivalent:@""] autorelease];
NSMenuItem *colorInsertionModeNSItem = [[[NSMenuItem alloc] initWithTitle:@"NSColor" action:@selector(selectNSColorInsertionMode:) keyEquivalent:@""] autorelease];
NSMenuItem *colorInsertionModeItem = [[NSMenuItem alloc] initWithTitle:@"Color Insertion Mode" action:nil keyEquivalent:@""];
NSMenuItem *colorInsertionModeNSItem = [[NSMenuItem alloc] initWithTitle:@"NSColor" action:@selector(selectNSColorInsertionMode:) keyEquivalent:@""];
[colorInsertionModeNSItem setTarget:self];
NSMenuItem *colorInsertionModeUIItem = [[[NSMenuItem alloc] initWithTitle:@"UIColor" action:@selector(selectUIColorInsertionMode:) keyEquivalent:@""] autorelease];
NSMenuItem *colorInsertionModeUIItem = [[NSMenuItem alloc] initWithTitle:@"UIColor" action:@selector(selectUIColorInsertionMode:) keyEquivalent:@""];
[colorInsertionModeUIItem setTarget:self];

NSMenu *colorInsertionModeMenu = [[[NSMenu alloc] initWithTitle:@"Color Insertion Mode"] autorelease];
NSMenu *colorInsertionModeMenu = [[NSMenu alloc] initWithTitle:@"Color Insertion Mode"];
[colorInsertionModeItem setSubmenu:colorInsertionModeMenu];
[[colorInsertionModeItem submenu] addItem:colorInsertionModeUIItem];
[[colorInsertionModeItem submenu] addItem:colorInsertionModeNSItem];
[[editMenuItem submenu] addItem:colorInsertionModeItem];

NSMenuItem *insertColorMenuItem = [[[NSMenuItem alloc] initWithTitle:@"Insert Color..." action:@selector(insertColor:) keyEquivalent:@""] autorelease];
NSMenuItem *insertColorMenuItem = [[NSMenuItem alloc] initWithTitle:@"Insert Color..." action:@selector(insertColor:) keyEquivalent:@""];
[insertColorMenuItem setTarget:self];
[[editMenuItem submenu] addItem:insertColorMenuItem];
}
Expand Down Expand Up @@ -502,16 +502,6 @@ - (NSString *)colorStringForColor:(NSColor *)color withType:(OMColorType)colorTy
- (void)dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver:self];
[_colorWell release];
[_colorFrameView release];
[_textView release];
[_constantColorsByName release];
[_rgbaUIColorRegex release];
[_whiteUIColorRegex release];
[_constantColorsByName release];
[_whiteNSColorRegex release];
[_rgbaNSColorRegex release];
[super dealloc];
}

@end
2 changes: 1 addition & 1 deletion Classes/OMPlainColorWell.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
NSColor *_strokeColor;
}

@property (nonatomic, retain) NSColor *strokeColor;
@property (nonatomic, strong) NSColor *strokeColor;

@end
8 changes: 1 addition & 7 deletions Classes/OMPlainColorWell.m
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,10 @@ - (void)deactivate
- (void)setStrokeColor:(NSColor *)strokeColor
{
if (strokeColor != _strokeColor) {
[_strokeColor release];
_strokeColor = [strokeColor retain];
_strokeColor = strokeColor;
[self setNeedsDisplay:YES];
}
}

- (void)dealloc
{
[_strokeColor release];
[super dealloc];
}

@end
1 change: 1 addition & 0 deletions Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<false/>
<key>DVTPlugInCompatibilityUUIDs</key>
<array>
<string>A2E4D43F-41F4-4FB9-BB94-7177011C9AED</string>
<string>640F884E-CE55-4B40-87C0-8869546CAB7A</string>
<string>63FC1C47-140D-42B0-BB4D-A10B2D225574</string>
<string>37B30044-3B14-46BA-ABAA-F01000C27B63</string>
Expand Down
4 changes: 3 additions & 1 deletion OMColorSense.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,15 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CLANG_ENABLE_OBJC_ARC = YES;
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO;
DEPLOYMENT_LOCATION = YES;
DEPLOYMENT_POSTPROCESSING = YES;
DSTROOT = "$(HOME)";
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_OBJC_GC = supported;
GCC_ENABLE_OBJC_GC = unsupported;
GCC_MODEL_TUNING = G5;
GCC_OPTIMIZATION_LEVEL = 0;
INFOPLIST_FILE = Info.plist;
Expand Down