Revision: 3482
          http://skim-app.svn.sourceforge.net/skim-app/?rev=3482&view=rev
Author:   hofman
Date:     2008-03-14 11:00:09 -0700 (Fri, 14 Mar 2008)

Log Message:
-----------
Add a menu to the search field. Allows changing case sensitivity and whole 
words search (leopard only). 

Modified Paths:
--------------
    trunk/English.lproj/MainWindow.nib/classes.nib
    trunk/English.lproj/MainWindow.nib/info.nib
    trunk/English.lproj/MainWindow.nib/keyedobjects.nib
    trunk/SKMainWindowController.h
    trunk/SKMainWindowController.m

Modified: trunk/English.lproj/MainWindow.nib/classes.nib
===================================================================
--- trunk/English.lproj/MainWindow.nib/classes.nib      2008-03-14 15:57:03 UTC 
(rev 3481)
+++ trunk/English.lproj/MainWindow.nib/classes.nib      2008-03-14 18:00:09 UTC 
(rev 3482)
@@ -155,6 +155,7 @@
                 takeSnapshot = id;
                 toggleAutoActualSize = id;
                 toggleAutoScale = id;
+                toggleCaseInsensitiveSearch = id;
                 toggleDisplayAsBook = id;
                 toggleDisplayContinuous = id;
                 toggleDisplayPageBreaks = id;
@@ -164,6 +165,7 @@
                 togglePresentation = id;
                 toggleRightSidePane = id;
                 toggleStatusBar = id;
+                toggleWholeWordSearch = id;
                 zoomInActualOut = id;
             };
             CLASS = SKMainWindowController;

Modified: trunk/English.lproj/MainWindow.nib/info.nib
===================================================================
--- trunk/English.lproj/MainWindow.nib/info.nib 2008-03-14 15:57:03 UTC (rev 
3481)
+++ trunk/English.lproj/MainWindow.nib/info.nib 2008-03-14 18:00:09 UTC (rev 
3482)
@@ -28,6 +28,8 @@
                <string>662 641 115 102 0 0 1440 938 </string>
                <key>855</key>
                <string>626 560 188 210 0 0 1440 938 </string>
+               <key>942</key>
+               <string>68 455 75 76 0 0 1440 938 </string>
        </dict>
        <key>IBFramework Version</key>
        <string>489.0</string>
@@ -36,6 +38,8 @@
        <key>IBOpenObjects</key>
        <array>
                <integer>168</integer>
+               <integer>942</integer>
+               <integer>687</integer>
        </array>
        <key>IBSystem Version</key>
        <string>9C31</string>

Modified: trunk/English.lproj/MainWindow.nib/keyedobjects.nib
===================================================================
(Binary files differ)

Modified: trunk/SKMainWindowController.h
===================================================================
--- trunk/SKMainWindowController.h      2008-03-14 15:57:03 UTC (rev 3481)
+++ trunk/SKMainWindowController.h      2008-03-14 18:00:09 UTC (rev 3482)
@@ -126,6 +126,8 @@
     IBOutlet NSView             *findView;
     NSMutableArray              *searchResults;
     BOOL                        findPanelFind;
+    BOOL                        caseInsensitiveSearch;
+    BOOL                        wholeWordSearch;
     CFMutableSetRef             temporaryAnnotations;
     NSTimer                     *temporaryAnnotationTimer;
     
@@ -309,6 +311,8 @@
 - (IBAction)password:(id)sender;
 - (IBAction)savePDFSettingToDefaults:(id)sender;
 - (IBAction)chooseTransition:(id)sender;
+- (IBAction)toggleCaseInsensitiveSearch:(id)sender;
+- (IBAction)toggleWholeWordSearch:(id)sender;
 
 - (void)showSnapshotAtPageNumber:(int)pageNum forRect:(NSRect)rect 
scaleFactor:(float)scaleFactor autoFits:(BOOL)autoFits;
 - (void)showSnapshotWithSetups:(NSArray *)setups;

Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m      2008-03-14 15:57:03 UTC (rev 3481)
+++ trunk/SKMainWindowController.m      2008-03-14 18:00:09 UTC (rev 3482)
@@ -274,6 +274,9 @@
         [self setShouldCloseDocument:YES];
         isPresentation = NO;
         searchResults = [[NSMutableArray alloc] init];
+        findPanelFind = NO;
+        caseInsensitiveSearch = YES;
+        wholeWordSearch = NO;
         groupedSearchResults = [[NSMutableArray alloc] init];
         thumbnails = [[NSMutableArray alloc] init];
         notes = [[NSMutableArray alloc] init];
@@ -2097,6 +2100,14 @@
     [[[self pdfView] transitionController] 
chooseTransitionModalForWindow:[self window]];
 }
 
+- (IBAction)toggleCaseInsensitiveSearch:(id)sender {
+    caseInsensitiveSearch = NO == caseInsensitiveSearch;
+}
+
+- (IBAction)toggleWholeWordSearch:(id)sender {
+    wholeWordSearch = NO == wholeWordSearch;
+}
+
 - (IBAction)toggleLeftSidePane:(id)sender {
     if ([self isFullScreen]) {
         [[SKPDFHoverWindow sharedHoverWindow] fadeOut];
@@ -2919,7 +2930,19 @@
         else 
             [self fadeInOutlineView];
     } else {
-        [[pdfView document] beginFindString:[sender stringValue] 
withOptions:NSCaseInsensitiveSearch];
+        int options = caseInsensitiveSearch ? NSCaseInsensitiveSearch : 0;
+        if (wholeWordSearch && [[pdfView document] 
respondsToSelector:@selector(beginFindStrings:withOptions:)]) {
+            NSMutableArray *words = [NSMutableArray array];
+            NSEnumerator *wordEnum = [[[sender stringValue] 
componentsSeparatedByString:@" "] objectEnumerator];
+            NSString *word;
+            while (word = [wordEnum nextObject]) {
+                if ([word isEqualToString:@""] == NO)
+                    [words addObject:word];
+            }
+            [[pdfView document] beginFindStrings:words withOptions:options];
+        } else {
+            [[pdfView document] beginFindString:[sender stringValue] 
withOptions:options];
+        }
         if (findPaneState == SKSingularFindPaneState)
             [self fadeInSearchView];
         else
@@ -5530,6 +5553,12 @@
         else
             [menuItem setTitle:NSLocalizedString(@"Use Current View Settings 
as Default", @"Menu item title")];
         return [self isPresentation] == NO;
+    } else if (action == @selector(toggleCaseInsensitiveSearch:)) {
+        [menuItem setState:caseInsensitiveSearch ? NSOnState : NSOffState];
+        return YES;
+    } else if (action == @selector(toggleWholeWordSearch:)) {
+        [menuItem setState:wholeWordSearch ? NSOnState : NSOffState];
+        return floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_4;
     }
     return YES;
 }


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: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to