Revision: 5333
          http://skim-app.svn.sourceforge.net/skim-app/?rev=5333&view=rev
Author:   hofman
Date:     2009-04-26 12:33:31 +0000 (Sun, 26 Apr 2009)

Log Message:
-----------
use more generic method to get the find string for the find panel, leave 
PDFView details to the responder

Modified Paths:
--------------
    trunk/SKFindController.h
    trunk/SKFindController.m
    trunk/SKMainWindowController.m
    trunk/SKPDFDocument.m

Modified: trunk/SKFindController.h
===================================================================
--- trunk/SKFindController.h    2009-04-26 11:59:43 UTC (rev 5332)
+++ trunk/SKFindController.h    2009-04-26 12:33:31 UTC (rev 5333)
@@ -77,6 +77,6 @@
 @end
 
 @interface NSObject (SKFindPanelSelectionSource)
-- (PDFView *)pdfView;
+- (NSString *)findString;
 @end
 

Modified: trunk/SKFindController.m
===================================================================
--- trunk/SKFindController.m    2009-04-26 11:59:43 UTC (rev 5332)
+++ trunk/SKFindController.m    2009-04-26 12:33:31 UTC (rev 5333)
@@ -38,8 +38,6 @@
 
 #import "SKFindController.h"
 #import "BDSKFindFieldEditor.h"
-#import "SKPDFDocument.h"
-#import <Quartz/Quartz.h>
 
 #define SKFindPanelFrameAutosaveName @"SKFindPanel"
 
@@ -147,13 +145,10 @@
 }
 
 - (IBAction)pickFindString:(id)sender {
-    id source = [self selectionSource];
-    if (source) {
-        PDFSelection *selection = [[source pdfView] currentSelection];
-        if (selection) {
-            [self setFindString:[selection string]];
-            [self updateFindPboard];
-        }
+    NSString *string = [[self selectionSource] findString];
+    if (string) {
+        [self setFindString:string];
+        [self updateFindPboard];
     }
 }
 
@@ -187,7 +182,7 @@
        return options;
 }
 
-- (id)responderForSelector:(SEL)selector {
+static id responderForSelector(SEL selector) {
     id responder = [[NSApp mainWindow] windowController];
     if (responder == nil)
         return nil;
@@ -200,11 +195,11 @@
 }
 
 - (id)target {
-    return [self responderForSelector:@selector(findString:options:)];
+    return responderForSelector(@selector(findString:options:));
 }
 
 - (id)selectionSource {
-    return [self responderForSelector:@selector(pdfView)];
+    return responderForSelector(@selector(findString));
 }
 
 - (BOOL)validateUserInterfaceItem:(id <NSValidatedUserInterfaceItem>)anItem {

Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m      2009-04-26 11:59:43 UTC (rev 5332)
+++ trunk/SKMainWindowController.m      2009-04-26 12:33:31 UTC (rev 5333)
@@ -1822,6 +1822,10 @@
        }
 }
 
+- (NSString *)findString {
+    return [[[self pdfView] currentSelection] string];
+}
+
 - (void)removeHighlightedSelections:(NSTimer *)timer {
     [highlightTimer invalidate];
     [highlightTimer release];

Modified: trunk/SKPDFDocument.m
===================================================================
--- trunk/SKPDFDocument.m       2009-04-26 11:59:43 UTC (rev 5332)
+++ trunk/SKPDFDocument.m       2009-04-26 12:33:31 UTC (rev 5333)
@@ -1638,6 +1638,10 @@
     [[self mainWindowController] findString:string options:options];
 }
 
+- (NSString *)findString {
+    return [[[self pdfView] currentSelection] string];
+}
+
 - (SKPDFView *)pdfView {
     return [[self mainWindowController] pdfView];
 }


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Crystal Reports &#45; New Free Runtime and 30 Day Trial
Check out the new simplified licensign option that enables unlimited
royalty&#45;free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to