Revision: 7591
          http://skim-app.svn.sourceforge.net/skim-app/?rev=7591&view=rev
Author:   hofman
Date:     2011-12-21 18:15:32 +0000 (Wed, 21 Dec 2011)
Log Message:
-----------
update find pboard when window with find field loses key or find field is 
removed, works like Xcode does

Modified Paths:
--------------
    trunk/SKFindController.m

Modified: trunk/SKFindController.m
===================================================================
--- trunk/SKFindController.m    2011-12-21 14:00:08 UTC (rev 7590)
+++ trunk/SKFindController.m    2011-12-21 18:15:32 UTC (rev 7591)
@@ -106,6 +106,11 @@
     }
 }
 
+- (void)windowDidResignKey:(NSNotification *)notification {
+    if ([findString length])
+        [self updateFindPboard];
+}
+
 - (void)updateFindPboard {
     NSPasteboard *findPboard = [NSPasteboard pasteboardWithName:NSFindPboard];
     [findPboard declareTypes:[NSArray arrayWithObject:NSStringPboardType] 
owner:nil];
@@ -159,6 +164,7 @@
         barHeight = -barHeight;
         
         [[NSNotificationCenter defaultCenter] addObserver:self 
selector:@selector(windowDidBecomeKey:) name:NSWindowDidBecomeKeyNotification 
object:[findBar window]];
+        [[NSNotificationCenter defaultCenter] addObserver:self 
selector:@selector(windowDidResignKey:) name:NSWindowDidResignKeyNotification 
object:[findBar window]];
         [self windowDidBecomeKey:nil];
     } else {
                if ([contentView isFlipped])
@@ -166,6 +172,8 @@
                else
                        barRect.origin.y = NSMaxY([contentView bounds]) - 
barHeight;
         [[NSNotificationCenter defaultCenter] removeObserver:self 
name:NSWindowDidBecomeKeyNotification object:[findBar window]];
+        [[NSNotificationCenter defaultCenter] removeObserver:self 
name:NSWindowDidResignKeyNotification object:[findBar window]];
+        [self windowDidResignKey:nil];
     }
     viewFrame.size.height += barHeight;
     if ([contentView isFlipped]) {
@@ -226,9 +234,6 @@
 }
 
 - (IBAction)remove:(id)sender {
-    [ownerController commitEditing];
-    if ([findString length])
-        [self updateFindPboard];
     [self toggleAboveView:nil animate:YES];
 }
 

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

Reply via email to