Revision: 3947
http://skim-app.svn.sourceforge.net/skim-app/?rev=3947&view=rev
Author: hofman
Date: 2008-06-01 05:27:48 -0700 (Sun, 01 Jun 2008)
Log Message:
-----------
Animate search highlight after scrolling if needed.
Modified Paths:
--------------
trunk/SKMainWindowController.m
Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m 2008-06-01 12:10:26 UTC (rev 3946)
+++ trunk/SKMainWindowController.m 2008-06-01 12:27:48 UTC (rev 3947)
@@ -2863,8 +2863,6 @@
}
- (void)findString:(NSString *)string options:(int)options{
- BOOL canAnimate = [pdfView
respondsToSelector:@selector(setCurrentSelection:animate:)];
- BOOL highlight = canAnimate == NO && [[NSUserDefaults
standardUserDefaults] boolForKey:SKShouldHighlightSearchResultsKey];
PDFSelection *sel = [pdfView currentSelection];
unsigned pageIndex = [[pdfView currentPage] pageIndex];
while ([sel string] == nil && pageIndex-- > 0) {
@@ -2875,14 +2873,13 @@
if (selection == nil && [sel string])
selection = [self findString:string fromSelection:nil
withOptions:options];
if (selection) {
- if (canAnimate)
- [pdfView setCurrentSelection:selection animate:YES];
- else
- [pdfView setCurrentSelection:selection];
+ [pdfView setCurrentSelection:selection];
[pdfView scrollSelectionToVisible:self];
[findTableView deselectAll:self];
[groupedFindTableView deselectAll:self];
- if (highlight) {
+ if ([pdfView
respondsToSelector:@selector(setCurrentSelection:animate:)]) {
+ [pdfView setCurrentSelection:selection animate:YES];
+ } else if ([[NSUserDefaults standardUserDefaults]
boolForKey:SKShouldHighlightSearchResultsKey]) {
[self removeTemporaryAnnotations];
[self addAnnotationsForSelection:selection];
temporaryAnnotationTimer = [[NSTimer
scheduledTimerWithTimeInterval:10 target:self
selector:@selector(temporaryAnnotationTimerFired:) userInfo:NULL repeats:NO]
retain];
@@ -2902,10 +2899,7 @@
// arm: PDFSelection is mutable, and using -addSelection on an object
from selectedObjects will actually mutate the object in searchResults, which
does bad things. MagicHat indicates that PDFSelection implements copyWithZone:
even though it doesn't conform to <NSCopying>, so we'll use that since -init
doesn't work (-initWithDocument: does, but it's not listed in the header
either). I filed rdar://problem/4888251 and also noticed that PDFKitViewer
sample code uses -[PDFSelection copy].
PDFSelection *currentSel = [[[selE nextObject] copy] autorelease];
- if (canAnimate)
- [pdfView setCurrentSelection:currentSel animate:YES];
- else
- [pdfView setCurrentSelection:currentSel];
+ [pdfView setCurrentSelection:currentSel];
if (scroll && [findResults count])
[pdfView scrollSelectionToVisible:self];
@@ -2922,7 +2916,10 @@
[self addAnnotationsForSelection:sel];
}
- [pdfView setCurrentSelection:currentSel];
+ if (canAnimate)
+ [pdfView setCurrentSelection:currentSel animate:YES];
+ else
+ [pdfView setCurrentSelection:currentSel];
}
- (void)goToFindResults:(NSArray *)findResults {
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