From bc14ad6b9d673b2b3c4330c30511fafe7c55c7e3 Mon Sep 17 00:00:00 2001 From: Antoine Mercadal Date: Thu, 24 Nov 2011 17:59:09 +0100 Subject: [PATCH 1/4] small improvments in XcodeCapp, including handling quick remove/create existing files --- Tools/XcodeCapp/FSEventCallback.m | 27 +++++++++++++++------------ Tools/XcodeCapp/TNXCodeCapp.m | 5 ++++- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/Tools/XcodeCapp/FSEventCallback.m b/Tools/XcodeCapp/FSEventCallback.m index f457b6a85..c4af80093 100644 --- a/Tools/XcodeCapp/FSEventCallback.m +++ b/Tools/XcodeCapp/FSEventCallback.m @@ -44,13 +44,6 @@ void fsevents_callback(ConstFSEventStreamRef streamRef, if (useFileBasedListening) { - if (flags & kFSEventStreamEventFlagItemIsFile && - flags & kFSEventStreamEventFlagItemRemoved) - { - [xcc tidyShadowedFiles]; - continue; - } - if (!(flags & kFSEventStreamEventFlagItemIsFile) || [xcc isPathMatchingIgnoredPaths:path] || (![xcc isXIBFile:path] && ![xcc isObjJFile:path] && ![xcc isXCCIgnoreFile:path])) @@ -58,19 +51,29 @@ void fsevents_callback(ConstFSEventStreamRef streamRef, continue; } - else if (flags & kFSEventStreamEventFlagItemRemoved) + if (flags & kFSEventStreamEventFlagItemIsFile && + flags & kFSEventStreamEventFlagItemRemoved) + { + if ([xcc isObjJFile:path]) + { + [xcc tidyShadowedFiles]; + continue; + } + } + + if (flags & kFSEventStreamEventFlagItemRemoved) { DLog(@"event type: kFSEventStreamEventFlagItemRemoved for path %@", path); [xcc handleFileRemoval:path]; } - else if (flags & kFSEventStreamEventFlagItemCreated || + if (flags & kFSEventStreamEventFlagItemCreated || flags & kFSEventStreamEventFlagItemModified) { DLog(@"event type: kFSEventStreamEventFlagItemCreated or kFSEventStreamEventFlagItemModified for path %@", path); [xcc handleFileModification:path notify:YES]; } - + else if ([xcc reactToInodeModification] && (flags & kFSEventStreamEventFlagItemFinderInfoMod || flags & kFSEventStreamEventFlagItemXattrMod || @@ -79,14 +82,14 @@ void fsevents_callback(ConstFSEventStreamRef streamRef, DLog(@"event type: %@ for path %@", flags, path); [xcc handleFileModification:path notify:YES]; } - + else if ([xcc reactToInodeModification] && flags & kFSEventStreamEventFlagItemInodeMetaMod) { DLog(@"event type: kFSEventStreamEventFlagItemInodeMetaMod for path %@", path); [xcc handleFileModification:path notify:YES]; } - + else if (flags & kFSEventStreamEventFlagItemRenamed) { if (![[NSFileManager defaultManager] fileExistsAtPath:path]) diff --git a/Tools/XcodeCapp/TNXCodeCapp.m b/Tools/XcodeCapp/TNXCodeCapp.m index 22d40a7dd..bb1196b01 100644 --- a/Tools/XcodeCapp/TNXCodeCapp.m +++ b/Tools/XcodeCapp/TNXCodeCapp.m @@ -470,7 +470,7 @@ NSString * const XCCListeningStartNotification = @"XCCListeningStartNotification BOOL isDir = NO; [fm fileExistsAtPath:filePath isDirectory:&isDir]; - if (isDir || (![self isXIBFile:filePath] && ![self isObjJFile:filePath])) + if (isDir || ![self isObjJFile:filePath] || [self isPathMatchingIgnoredPaths:filePath]) continue; NSURL *eventualShadow = [self shadowURLForSourceURL:[NSURL fileURLWithPath:filePath]]; @@ -579,6 +579,9 @@ NSString * const XCCListeningStartNotification = @"XCCListeningStartNotification */ - (BOOL)isPathMatchingIgnoredPaths:(NSString*)aPath { + if ([ignoredFilePaths count] == 0) + return NO; + for (NSString *ignoredPath in ignoredFilePaths) { if ([ignoredPath length] == 0) From 50b447b05d3ee1ac7bf8eb215dfbb57b08393946 Mon Sep 17 00:00:00 2001 From: lowell Date: Thu, 24 Nov 2011 13:58:03 -0800 Subject: [PATCH 2/4] [XcodeCapp] App controller should conform to NSTableView data source and delegate protocols. Protocol methods don't need to be declared in the adopting class' interface because they will have already been declared in the protocol declaration. --- Tools/XcodeCapp/AppController.h | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/Tools/XcodeCapp/AppController.h b/Tools/XcodeCapp/AppController.h index 5982ed1f8..5f0eb52cc 100644 --- a/Tools/XcodeCapp/AppController.h +++ b/Tools/XcodeCapp/AppController.h @@ -21,7 +21,7 @@ #import "PRHEmptyGrowlDelegate.h" #import "TNXCodeCapp.h" -@interface AppController : NSObject +@interface AppController : NSObject { IBOutlet NSMenu *statusMenu; IBOutlet NSMenuItem *menuItemOpenXCode; @@ -66,10 +66,5 @@ - (IBAction)openAbout:(id)aSender; - (IBAction)updatePreferences:(id)aSender; -- (CGFloat)tableView:(NSTableView *)tableView heightOfRow:(int)aRow; -- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row; -- (NSInteger)numberOfRowsInTableView:(NSTableView *)aTableView; -- (NSInteger)numberOfRowsInTableView:(NSTableView *)aTableView; - @end From 2169ba35ad19fdd856abc963fd396c97ae48b180 Mon Sep 17 00:00:00 2001 From: lowell Date: Thu, 24 Nov 2011 13:59:39 -0800 Subject: [PATCH 3/4] [XcodeCapp] Silenced build warning: -[id tableView:heightOfRow:] expects an NSInteger for the second argument. --- Tools/XcodeCapp/AppController.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tools/XcodeCapp/AppController.m b/Tools/XcodeCapp/AppController.m index e03195c94..453bba7d2 100644 --- a/Tools/XcodeCapp/AppController.m +++ b/Tools/XcodeCapp/AppController.m @@ -360,7 +360,7 @@ AppController *SharedAppControllerInstance = nil; [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, [[xcc errorList] count])]]; } -- (CGFloat)tableView:(NSTableView *)tableView heightOfRow:(int)aRow +- (CGFloat)tableView:(NSTableView *)tableView heightOfRow:(NSInteger)aRow { // Get column you want - first in this case: NSTableColumn *tabCol = [[tableView tableColumns] objectAtIndex:0]; From ddc599486919250a6bee2f53094d8d91ebce2f8a Mon Sep 17 00:00:00 2001 From: Antoine Mercadal Date: Mon, 28 Nov 2011 12:05:43 +0100 Subject: [PATCH 4/4] tooltips are now themable. --- AppKit/CPWindow/_CPToolTipWindowView.j | 47 +++++++++++++------------ AppKit/Themes/Aristo/ThemeDescriptors.j | 18 ++++++++++ AppKit/_CPToolTip.j | 2 +- 3 files changed, 44 insertions(+), 23 deletions(-) diff --git a/AppKit/CPWindow/_CPToolTipWindowView.j b/AppKit/CPWindow/_CPToolTipWindowView.j index 19bbc01d0..1bc63ae62 100644 --- a/AppKit/CPWindow/_CPToolTipWindowView.j +++ b/AppKit/CPWindow/_CPToolTipWindowView.j @@ -27,15 +27,31 @@ { BOOL _mouseDownPressed @accessors(getter=isMouseDownPressed, setter=setMouseDownPressed:); unsigned _gravity @accessors(property=gravity); - - CPColor _backgroundColor; - CPColor _strokeColor; } #pragma mark - #pragma mark Class methods ++ (CPString)defaultThemeClass +{ + return @"tooltip"; +} + ++ (id)themeAttributes +{ + return [CPDictionary dictionaryWithObjects:[[CPColor colorWithHexString:@"E3E3E3"], + [CPColor colorWithHexString:@"FFFFCA"], + 2.0, + 1.0, + [CPColor blackColor]] + forKeys:[@"stroke-color", + @"background-color", + @"border-radius", + @"stroke-width", + @"color"]]; +} + /*! compute the contentView frame from a given window frame @param aFrameRect the window frame */ @@ -67,21 +83,6 @@ } -#pragma mark - -#pragma mark Initialization - -- (id)initWithFrame:(CPRect)aFrame styleMask:(unsigned)aStyleMask -{ - if (self = [super initWithFrame:aFrame styleMask:aStyleMask]) - { - _strokeColor = [CPColor colorWithHexString:@"E3E3E3"]; - _backgroundColor = [CPColor colorWithHexString:@"FFFFCA"]; - } - - return self; -} - - #pragma mark - #pragma mark drawing @@ -90,11 +91,13 @@ [super drawRect:aRect]; var context = [[CPGraphicsContext currentContext] graphicsPort], - radius = 2, - strokeWidth = 1; + radius = [self currentValueForThemeAttribute:@"border-radius"], + strokeWidth = [self currentValueForThemeAttribute:@"stroke-width"], + strokeColor = [self currentValueForThemeAttribute:@"stroke-color"], + bgColor = [self currentValueForThemeAttribute:@"background-color"]; - CGContextSetStrokeColor(context, _strokeColor); - CGContextSetFillColor(context, _backgroundColor); + CGContextSetStrokeColor(context, strokeColor); + CGContextSetFillColor(context, bgColor); CGContextSetLineWidth(context, strokeWidth); CGContextBeginPath(context); diff --git a/AppKit/Themes/Aristo/ThemeDescriptors.j b/AppKit/Themes/Aristo/ThemeDescriptors.j index 02f7c26db..d4166a9c5 100755 --- a/AppKit/Themes/Aristo/ThemeDescriptors.j +++ b/AppKit/Themes/Aristo/ThemeDescriptors.j @@ -1766,6 +1766,24 @@ var themedButtonValues = nil, return ruleEditor; } ++ (_CPToolTipWindowView)themedTooltip +{ + var toolTipView = [[_CPToolTipWindowView alloc] initWithFrame:CPRectMakeZero() styleMask:_CPToolTipWindowMask], + + themeValues = + [ + [@"stroke-color", [CPColor colorWithHexString:@"E3E3E3"]], + [@"stroke-width", 1.0], + [@"border-radius", 2.0], + [@"background-color", [CPColor colorWithHexString:@"FFFFCA"]], + [@"color", [CPColor blackColor]] + ]; + + [self registerThemeValues:themeValues forView:toolTipView]; + + return toolTipView; +} + @end @implementation AristoHUDThemeDescriptor : BKThemeDescriptor diff --git a/AppKit/_CPToolTip.j b/AppKit/_CPToolTip.j index 7dfe5363e..cc4591a16 100644 --- a/AppKit/_CPToolTip.j +++ b/AppKit/_CPToolTip.j @@ -134,7 +134,7 @@ var _CPToolTipHeight = 24.0, [_content setFrameOrigin:CPPointMake(0.0, 0.0)]; [_content setFrameSize:textFrameSize]; [_content setTextShadowOffset:CGSizeMake(0.0, 1.0)]; - [_content setTextColor:[CPColor blackColor]]; + [_content setTextColor:[[[CPTheme defaultTheme] attributeWithName:@"color" forClass:_CPToolTipWindowView] value]]; [[self contentView] addSubview:_content];