Revision: 3969
          http://skim-app.svn.sourceforge.net/skim-app/?rev=3969&view=rev
Author:   hofman
Date:     2008-06-04 13:39:31 -0700 (Wed, 04 Jun 2008)

Log Message:
-----------
Highlight multiple search results using selection highlights.

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

Modified: trunk/SKMainWindowController.h
===================================================================
--- trunk/SKMainWindowController.h      2008-06-04 20:15:39 UTC (rev 3968)
+++ trunk/SKMainWindowController.h      2008-06-04 20:39:31 UTC (rev 3969)
@@ -142,6 +142,7 @@
     BOOL                        wholeWordSearch;
     CFMutableSetRef             temporaryAnnotations;
     NSTimer                     *temporaryAnnotationTimer;
+    NSTimer                     *highlightTimer;
     
     IBOutlet NSArrayController  *groupedFindArrayController;
     IBOutlet NSTableView        *groupedFindTableView;

Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m      2008-06-04 20:15:39 UTC (rev 3968)
+++ trunk/SKMainWindowController.m      2008-06-04 20:39:31 UTC (rev 3969)
@@ -2874,6 +2874,13 @@
        }
 }
 
+- (void)removeHighlightedSelections:(NSTimer *)timer {
+    [highlightTimer invalidate];
+    [highlightTimer release];
+    highlightTimer = nil;
+    [pdfView setHighlightedSelections:nil];
+}
+
 - (void)goToFindResults:(NSArray *)findResults scrollToVisible:(BOOL)scroll {
     NSEnumerator *selE = [findResults objectEnumerator];
     PDFSelection *sel;
@@ -2899,6 +2906,15 @@
             [self addAnnotationsForSelection:sel];
     }
     
+    if (highlightTimer)
+        [self removeHighlightedSelections:highlightTimer];
+    if ([pdfView respondsToSelector:@selector(setHighlightedSelections:)] && 
[currentSel respondsToSelector:@selector(setColor:)] && [findResults count] > 
1) {
+        PDFSelection *tmpSel = [[currentSel copy] autorelease];
+        [tmpSel setColor:[NSColor yellowColor]];
+        [pdfView setHighlightedSelections:[NSArray arrayWithObject:tmpSel]];
+        highlightTimer = [[NSTimer scheduledTimerWithTimeInterval:1.0 
target:self selector:@selector(removeHighlightedSelections:) userInfo:nil 
repeats:NO] retain];
+    }
+    
     if ([pdfView respondsToSelector:@selector(setCurrentSelection:animate:)] 
&& firstSel)
         [pdfView setCurrentSelection:firstSel animate:YES];
     


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

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to