Revision: 7598 http://skim-app.svn.sourceforge.net/skim-app/?rev=7598&view=rev Author: hofman Date: 2011-12-24 00:26:44 +0000 (Sat, 24 Dec 2011) Log Message: ----------- only update find pboard when the find string was changed
Modified Paths: -------------- trunk/SKFindController.h trunk/SKFindController.m Modified: trunk/SKFindController.h =================================================================== --- trunk/SKFindController.h 2011-12-24 00:10:09 UTC (rev 7597) +++ trunk/SKFindController.h 2011-12-24 00:26:44 UTC (rev 7598) @@ -50,6 +50,7 @@ NSObjectController *ownerController; NSString *findString; NSInteger lastChangeCount; + BOOL didChange; NSTextView *fieldEditor; BOOL animating; } Modified: trunk/SKFindController.m =================================================================== --- trunk/SKFindController.m 2011-12-24 00:10:09 UTC (rev 7597) +++ trunk/SKFindController.m 2011-12-24 00:26:44 UTC (rev 7598) @@ -103,6 +103,7 @@ if (lastChangeCount < [findPboard changeCount] && [findPboard availableTypeFromArray:[NSArray arrayWithObject:NSStringPboardType]]) { [self setFindString:[findPboard stringForType:NSStringPboardType]]; lastChangeCount = [findPboard changeCount]; + didChange = NO; } } @@ -111,10 +112,13 @@ } - (void)updateFindPboard { - NSPasteboard *findPboard = [NSPasteboard pasteboardWithName:NSFindPboard]; - [findPboard declareTypes:[NSArray arrayWithObject:NSStringPboardType] owner:nil]; - [findPboard setString:findString ?: @"" forType:NSStringPboardType]; - lastChangeCount = [findPboard changeCount]; + if (didChange) { + NSPasteboard *findPboard = [NSPasteboard pasteboardWithName:NSFindPboard]; + [findPboard declareTypes:[NSArray arrayWithObject:NSStringPboardType] owner:nil]; + [findPboard setString:findString ?: @"" forType:NSStringPboardType]; + lastChangeCount = [findPboard changeCount]; + didChange = NO; + } } - (void)endAnimation:(NSNumber *)visible { @@ -207,6 +211,14 @@ delegate = newDelegate; } +- (void)setFindString:(NSString *)newFindString { + if (findString != newFindString) { + [findString release]; + findString = [newFindString retain]; + didChange = YES; + } +} + - (NSTextView *)fieldEditor { if (fieldEditor == nil) { fieldEditor = [[SKFindFieldEditor alloc] init]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Write once. Port to many. Get the SDK and tools to simplify cross-platform app development. Create new or port existing apps to sell to consumers worldwide. Explore the Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join http://p.sf.net/sfu/intel-appdev _______________________________________________ Skim-app-commit mailing list Skim-app-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/skim-app-commit