Revision: 7606
          http://skim-app.svn.sourceforge.net/skim-app/?rev=7606&view=rev
Author:   hofman
Date:     2011-12-27 18:35:34 +0000 (Tue, 27 Dec 2011)
Log Message:
-----------
collapse code

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

Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m      2011-12-27 15:56:57 UTC (rev 7605)
+++ trunk/SKMainWindowController.m      2011-12-27 18:35:34 UTC (rev 7606)
@@ -1708,22 +1708,16 @@
 - (BOOL)findString:(NSString *)string forward:(BOOL)forward {
     PDFSelection *sel = [pdfView currentSelection];
     NSUInteger pageIndex = [[pdfView currentPage] pageIndex];
-    NSInteger options = [[NSUserDefaults standardUserDefaults] 
boolForKey:SKCaseInsensitiveFindKey] ? NSCaseInsensitiveSearch : 0;
-    if (forward) {
-        while ([sel hasCharacters] == NO && pageIndex-- > 0) {
-            PDFPage *page = [[pdfView document] pageAtIndex:pageIndex];
-            NSUInteger length = [[page string] length];
-            if (length > 0)
-                sel = [page selectionForRange:NSMakeRange(0, length)];
-        }
-    } else {
+    NSInteger options = 0;
+    if ([[NSUserDefaults standardUserDefaults] 
boolForKey:SKCaseInsensitiveFindKey])
+        options |= NSCaseInsensitiveSearch;
+    if (forward == NO)
         options |= NSBackwardsSearch;
-        while ([sel hasCharacters] == NO && ++pageIndex < [[pdfView document] 
pageCount]) {
-            PDFPage *page = [[pdfView document] pageAtIndex:pageIndex];
-            NSUInteger length = [[page string] length];
-            if (length > 0)
-                sel = [page selectionForRange:NSMakeRange(0, length)];
-        }
+    while ([sel hasCharacters] == NO && (forward ? pageIndex-- > 0 : 
++pageIndex < [[pdfView document] pageCount])) {
+        PDFPage *page = [[pdfView document] pageAtIndex:pageIndex];
+        NSUInteger length = [[page string] length];
+        if (length > 0)
+            sel = [page selectionForRange:NSMakeRange(0, length)];
     }
     PDFSelection *selection = [self findString:string fromSelection:sel 
withOptions:options];
     if ([selection hasCharacters] == NO && [sel hasCharacters])

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