Revision: 2592 http://skim-app.svn.sourceforge.net/skim-app/?rev=2592&view=rev Author: hofman Date: 2007-07-31 02:53:44 -0700 (Tue, 31 Jul 2007)
Log Message: ----------- Update find pboard and use it for the Find panel. Change the find panel string when the find pboard has changed. Invert check to use for getting find string from selection to enable that action. Modified Paths: -------------- trunk/Dutch.lproj/FindPanel.nib/info.nib trunk/Dutch.lproj/FindPanel.nib/keyedobjects.nib trunk/English.lproj/FindPanel.nib/info.nib trunk/English.lproj/FindPanel.nib/keyedobjects.nib trunk/French.lproj/FindPanel.nib/classes.nib trunk/French.lproj/FindPanel.nib/info.nib trunk/French.lproj/FindPanel.nib/keyedobjects.nib trunk/Italian.lproj/FindPanel.nib/info.nib trunk/Italian.lproj/FindPanel.nib/keyedobjects.nib trunk/SKFindController.h trunk/SKFindController.m trunk/SKMainWindowController.m Modified: trunk/Dutch.lproj/FindPanel.nib/info.nib =================================================================== --- trunk/Dutch.lproj/FindPanel.nib/info.nib 2007-07-30 19:20:12 UTC (rev 2591) +++ trunk/Dutch.lproj/FindPanel.nib/info.nib 2007-07-31 09:53:44 UTC (rev 2592) @@ -11,6 +11,6 @@ <integer>5</integer> </array> <key>IBSystem Version</key> - <string>8P135</string> + <string>8R218</string> </dict> </plist> Modified: trunk/Dutch.lproj/FindPanel.nib/keyedobjects.nib =================================================================== (Binary files differ) Modified: trunk/English.lproj/FindPanel.nib/info.nib =================================================================== --- trunk/English.lproj/FindPanel.nib/info.nib 2007-07-30 19:20:12 UTC (rev 2591) +++ trunk/English.lproj/FindPanel.nib/info.nib 2007-07-31 09:53:44 UTC (rev 2592) @@ -11,6 +11,6 @@ <integer>5</integer> </array> <key>IBSystem Version</key> - <string>8L127</string> + <string>8R218</string> </dict> </plist> Modified: trunk/English.lproj/FindPanel.nib/keyedobjects.nib =================================================================== (Binary files differ) Modified: trunk/French.lproj/FindPanel.nib/classes.nib =================================================================== --- trunk/French.lproj/FindPanel.nib/classes.nib 2007-07-30 19:20:12 UTC (rev 2591) +++ trunk/French.lproj/FindPanel.nib/classes.nib 2007-07-31 09:53:44 UTC (rev 2592) @@ -1,25 +1,18 @@ { - IBClasses = ( - { - CLASS = FirstResponder; - LANGUAGE = ObjC; - SUPERCLASS = NSObject; - }, - { - ACTIONS = { - findNext = id; - findNextAndOrderOutFindPanel = id; - findPrevious = id; - performFindPanelAction = id; - }; - CLASS = SKFindController; - LANGUAGE = ObjC; - OUTLETS = { - findField = NSTextField; - ignoreCaseCheckbox = NSButton; - }; - SUPERCLASS = NSWindowController; + IBClasses = ( + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + { + ACTIONS = { + findNext = id; + findNextAndOrderOutFindPanel = id; + findPrevious = id; + performFindPanelAction = id; + }; + CLASS = SKFindController; + LANGUAGE = ObjC; + OUTLETS = {findField = NSTextField; ignoreCaseCheckbox = NSButton; }; + SUPERCLASS = NSWindowController; } - ); - IBVersion = 1; + ); + IBVersion = 1; } \ No newline at end of file Modified: trunk/French.lproj/FindPanel.nib/info.nib =================================================================== --- trunk/French.lproj/FindPanel.nib/info.nib 2007-07-30 19:20:12 UTC (rev 2591) +++ trunk/French.lproj/FindPanel.nib/info.nib 2007-07-31 09:53:44 UTC (rev 2592) @@ -1,9 +1,9 @@ <?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"> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>IBDocumentLocation</key> - <string>79 78 356 240 0 0 1600 1178 </string> + <string>69 58 356 240 0 0 1440 938 </string> <key>IBFramework Version</key> <string>446.1</string> <key>IBOpenObjects</key> @@ -11,6 +11,6 @@ <integer>5</integer> </array> <key>IBSystem Version</key> - <string>9A466</string> + <string>8R218</string> </dict> </plist> Modified: trunk/French.lproj/FindPanel.nib/keyedobjects.nib =================================================================== (Binary files differ) Modified: trunk/Italian.lproj/FindPanel.nib/info.nib =================================================================== --- trunk/Italian.lproj/FindPanel.nib/info.nib 2007-07-30 19:20:12 UTC (rev 2591) +++ trunk/Italian.lproj/FindPanel.nib/info.nib 2007-07-31 09:53:44 UTC (rev 2592) @@ -3,7 +3,7 @@ <plist version="1.0"> <dict> <key>IBDocumentLocation</key> - <string>43 101 356 240 0 0 1024 746 </string> + <string>70 139 356 240 0 0 1440 938 </string> <key>IBFramework Version</key> <string>446.1</string> <key>IBOpenObjects</key> @@ -11,6 +11,6 @@ <integer>5</integer> </array> <key>IBSystem Version</key> - <string>8P135</string> + <string>8R218</string> </dict> </plist> Modified: trunk/Italian.lproj/FindPanel.nib/keyedobjects.nib =================================================================== (Binary files differ) Modified: trunk/SKFindController.h =================================================================== --- trunk/SKFindController.h 2007-07-30 19:20:12 UTC (rev 2591) +++ trunk/SKFindController.h 2007-07-31 09:53:44 UTC (rev 2592) @@ -43,6 +43,8 @@ @interface SKFindController : NSWindowController { IBOutlet NSTextField *findField; IBOutlet NSButton *ignoreCaseCheckbox; + NSString *findString; + int lastChangeCount; BOOL ignoreCase; BDSKFindFieldEditor *fieldEditor; } @@ -53,8 +55,11 @@ - (IBAction)findNext:(id)sender; - (IBAction)findNextAndOrderOutFindPanel:(id)sender; - (IBAction)findPrevious:(id)sender; -- (IBAction)setFindString:(id)sender; +- (IBAction)pickFindString:(id)sender; +- (NSString *)findString; +- (void)setFindString:(NSString *)newFindString; + - (BOOL)ignoreCase; - (void)setIgnoreCase:(BOOL)newIgnoreCase; Modified: trunk/SKFindController.m =================================================================== --- trunk/SKFindController.m 2007-07-30 19:20:12 UTC (rev 2591) +++ trunk/SKFindController.m 2007-07-31 09:53:44 UTC (rev 2592) @@ -91,6 +91,21 @@ [self setWindowFrameAutosaveName:SKFindPanelFrameAutosaveName]; } +- (void)windowDidBecomeKey:(NSNotification *)notification { + NSPasteboard *findPboard = [NSPasteboard pasteboardWithName:NSFindPboard]; + if (lastChangeCount < [findPboard changeCount] && [findPboard availableTypeFromArray:[NSArray arrayWithObject:NSStringPboardType]]) { + [self setFindString:[findPboard stringForType:NSStringPboardType]]; + lastChangeCount = [findPboard changeCount]; + } +} + +- (void)updateFindPboard { + NSPasteboard *findPboard = [NSPasteboard pasteboardWithName:NSFindPboard]; + [findPboard declareTypes:[NSArray arrayWithObject:NSStringPboardType] owner:nil]; + [findPboard setString:findString forType:NSStringPboardType]; + lastChangeCount = [findPboard changeCount]; +} + - (IBAction)performFindPanelAction:(id)sender { switch ([sender tag]) { case NSFindPanelActionShowFindPanel: @@ -109,7 +124,7 @@ NSBeep(); break; case NSFindPanelActionSetFindString: - [self setFindString:self]; + [self pickFindString:self]; break; case NSFindPanelActionSelectAll: case NSFindPanelActionSelectAllInSelection: @@ -119,7 +134,8 @@ } - (IBAction)findNext:(id)sender { - [[self target] findString:[findField stringValue] options:[self findOptions] & ~NSBackwardsSearch]; + [[self target] findString:findString options:[self findOptions] & ~NSBackwardsSearch]; + [self updateFindPboard]; } - (IBAction)findNextAndOrderOutFindPanel:(id)sender { @@ -128,23 +144,32 @@ } - (IBAction)findPrevious:(id)sender { - [[self target] findString:[findField stringValue] options:[self findOptions] | NSBackwardsSearch]; + [[self target] findString:findString options:[self findOptions] | NSBackwardsSearch]; + [self updateFindPboard]; } -- (IBAction)setFindString:(id)sender { +- (IBAction)pickFindString:(id)sender { id source = [self selectionSource]; if (source) { PDFSelection *selection = [[source pdfView] currentSelection]; - if (selection == nil) { - NSPasteboard *findPasteboard = [NSPasteboard pasteboardWithName:NSFindPboard]; - [findPasteboard declareTypes:[NSArray arrayWithObject:NSStringPboardType] owner:nil]; - [findPasteboard setString:[selection string] forType:NSStringPboardType]; - - [findField setStringValue:[selection string]]; + if (selection) { + [self setFindString:[selection string]]; + [self updateFindPboard]; } } } +- (NSString *)findString { + return findString; +} + +- (void)setFindString:(NSString *)newFindString { + if (findString != newFindString) { + [findString release]; + findString = [newFindString retain]; + } +} + - (BOOL)ignoreCase { return ignoreCase; } Modified: trunk/SKMainWindowController.m =================================================================== --- trunk/SKMainWindowController.m 2007-07-30 19:20:12 UTC (rev 2591) +++ trunk/SKMainWindowController.m 2007-07-31 09:53:44 UTC (rev 2592) @@ -2440,6 +2440,10 @@ } else { [self fadeInSearchView]; [[pdfView document] beginFindString:[sender stringValue] withOptions:NSCaseInsensitiveSearch]; + + NSPasteboard *findPboard = [NSPasteboard pasteboardWithName:NSFindPboard]; + [findPboard declareTypes:[NSArray arrayWithObject:NSStringPboardType] owner:nil]; + [findPboard setString:[sender stringValue] forType:NSStringPboardType]; } } @@ -2478,6 +2482,11 @@ if ([[sender stringValue] length] && rightSidePaneState != SKNoteSidePaneState) [self setRightSidePaneState:SKNoteSidePaneState]; [self updateNoteFilterPredicate]; + if ([[sender stringValue] length]) { + NSPasteboard *findPboard = [NSPasteboard pasteboardWithName:NSFindPboard]; + [findPboard declareTypes:[NSArray arrayWithObject:NSStringPboardType] owner:nil]; + [findPboard setString:[sender stringValue] forType:NSStringPboardType]; + } } #pragma mark Sub- and note- windows This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Skim-app-commit mailing list Skim-app-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/skim-app-commit