Revision: 7297
http://skim-app.svn.sourceforge.net/skim-app/?rev=7297&view=rev
Author: hofman
Date: 2011-06-20 17:26:13 +0000 (Mon, 20 Jun 2011)
Log Message:
-----------
implement findPanelAction: in note document and update search string from pboard
Modified Paths:
--------------
trunk/SKNotesDocument.h
trunk/SKNotesDocument.m
Modified: trunk/SKNotesDocument.h
===================================================================
--- trunk/SKNotesDocument.h 2011-06-20 13:26:33 UTC (rev 7296)
+++ trunk/SKNotesDocument.h 2011-06-20 17:26:13 UTC (rev 7297)
@@ -47,6 +47,7 @@
SKNoteOutlineView *outlineView;
NSArrayController *arrayController;
NSSearchField *searchField;
+ NSInteger lastFindChangeCount;
SKStatusBar *statusBar;
NSDictionary *toolbarItems;
NSArray *notes;
Modified: trunk/SKNotesDocument.m
===================================================================
--- trunk/SKNotesDocument.m 2011-06-20 13:26:33 UTC (rev 7296)
+++ trunk/SKNotesDocument.m 2011-06-20 17:26:13 UTC (rev 7297)
@@ -188,6 +188,14 @@
}
+- (void)windowDidBecomeKey:(NSNotification *)notification {
+ NSPasteboard *findPboard = [NSPasteboard pasteboardWithName:NSFindPboard];
+ if (lastFindChangeCount < [findPboard changeCount] && [findPboard
availableTypeFromArray:[NSArray arrayWithObject:NSStringPboardType]]) {
+ [searchField setStringValue:[findPboard
stringForType:NSStringPboardType]];
+ lastFindChangeCount = [findPboard changeCount];
+ }
+}
+
- (NSArray *)writableTypesForSaveOperation:(NSSaveOperationType)saveOperation {
NSArray *writableTypes = [super
writableTypesForSaveOperation:saveOperation];
if (saveOperation == NSSaveToOperation) {
@@ -454,6 +462,7 @@
NSPasteboard *findPboard = [NSPasteboard
pasteboardWithName:NSFindPboard];
[findPboard declareTypes:[NSArray arrayWithObject:NSStringPboardType]
owner:nil];
[findPboard setString:[sender stringValue] forType:NSStringPboardType];
+ lastFindChangeCount = [findPboard changeCount];
}
}
@@ -519,6 +528,15 @@
[self searchNotes:searchField];
}
+- (void)performFindPanelAction:(id)sender {
+ if ([sender tag] == NSFindPanelActionShowFindPanel) {
+ [[[[[self windowControllers] objectAtIndex:0] window] toolbar]
setVisible:YES];
+ [searchField selectText:nil];
+ } else {
+ NSBeep();
+ }
+}
+
- (BOOL)validateMenuItem:(NSMenuItem *)menuItem {
SEL action = [menuItem action];
if (action == @selector(toggleStatusBar:)) {
@@ -530,6 +548,13 @@
} else if (action == @selector(toggleCaseInsensitiveSearch:)) {
[menuItem setState:caseInsensitiveSearch ? NSOnState : NSOffState];
return YES;
+ } else if (action == @selector(performFindPanelAction:)) {
+ switch ([menuItem tag]) {
+ case NSFindPanelActionShowFindPanel:
+ return YES;
+ default:
+ return NO;
+ }
}
return YES;
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit