Revision: 3946
http://skim-app.svn.sourceforge.net/skim-app/?rev=3946&view=rev
Author: hofman
Date: 2008-06-01 05:10:26 -0700 (Sun, 01 Jun 2008)
Log Message:
-----------
Use build in search highlight animation on Leopard. Hide search highlight pref
UI on Leopard.
Modified Paths:
--------------
trunk/English.lproj/PreferenceWindow.nib/info.nib
trunk/English.lproj/PreferenceWindow.nib/keyedobjects.nib
trunk/SKMainWindowController.m
trunk/SKPreferenceController.h
trunk/SKPreferenceController.m
Modified: trunk/English.lproj/PreferenceWindow.nib/info.nib
===================================================================
--- trunk/English.lproj/PreferenceWindow.nib/info.nib 2008-05-31 16:54:59 UTC
(rev 3945)
+++ trunk/English.lproj/PreferenceWindow.nib/info.nib 2008-06-01 12:10:26 UTC
(rev 3946)
@@ -13,6 +13,6 @@
<integer>5</integer>
</array>
<key>IBSystem Version</key>
- <string>9C7010</string>
+ <string>9D34</string>
</dict>
</plist>
Modified: trunk/English.lproj/PreferenceWindow.nib/keyedobjects.nib
===================================================================
(Binary files differ)
Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m 2008-05-31 16:54:59 UTC (rev 3945)
+++ trunk/SKMainWindowController.m 2008-06-01 12:10:26 UTC (rev 3946)
@@ -2863,6 +2863,8 @@
}
- (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) {
@@ -2873,11 +2875,14 @@
if (selection == nil && [sel string])
selection = [self findString:string fromSelection:nil
withOptions:options];
if (selection) {
- [pdfView setCurrentSelection:selection];
+ if (canAnimate)
+ [pdfView setCurrentSelection:selection animate:YES];
+ else
+ [pdfView setCurrentSelection:selection];
[pdfView scrollSelectionToVisible:self];
[findTableView deselectAll:self];
[groupedFindTableView deselectAll:self];
- if ([[NSUserDefaults standardUserDefaults]
boolForKey:SKShouldHighlightSearchResultsKey]) {
+ if (highlight) {
[self removeTemporaryAnnotations];
[self addAnnotationsForSelection:selection];
temporaryAnnotationTimer = [[NSTimer
scheduledTimerWithTimeInterval:10 target:self
selector:@selector(temporaryAnnotationTimerFired:) userInfo:NULL repeats:NO]
retain];
@@ -2888,7 +2893,8 @@
}
- (void)goToFindResults:(NSArray *)findResults scrollToVisible:(BOOL)scroll {
- BOOL highlight = [[NSUserDefaults standardUserDefaults]
boolForKey:SKShouldHighlightSearchResultsKey];
+ BOOL canAnimate = [pdfView
respondsToSelector:@selector(setCurrentSelection:animate:)];
+ BOOL highlight = canAnimate == NO && [[NSUserDefaults
standardUserDefaults] boolForKey:SKShouldHighlightSearchResultsKey];
// union all selected objects
NSEnumerator *selE = [findResults objectEnumerator];
PDFSelection *sel;
@@ -2896,7 +2902,10 @@
// 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];
- [pdfView setCurrentSelection:currentSel];
+ if (canAnimate)
+ [pdfView setCurrentSelection:currentSel animate:YES];
+ else
+ [pdfView setCurrentSelection:currentSel];
if (scroll && [findResults count])
[pdfView scrollSelectionToVisible:self];
Modified: trunk/SKPreferenceController.h
===================================================================
--- trunk/SKPreferenceController.h 2008-05-31 16:54:59 UTC (rev 3945)
+++ trunk/SKPreferenceController.h 2008-06-01 12:10:26 UTC (rev 3946)
@@ -67,6 +67,8 @@
- (BOOL)isCustomTeXEditor;
- (void)setCustomTeXEditor:(BOOL)flag;
+- (BOOL)isLeopard;
+
- (IBAction)changeDiscreteThumbnailSizes:(id)sender;
- (IBAction)changeUpdateInterval:(id)sender;
- (IBAction)changeTeXEditorPreset:(id)sender;
Modified: trunk/SKPreferenceController.m
===================================================================
--- trunk/SKPreferenceController.m 2008-05-31 16:54:59 UTC (rev 3945)
+++ trunk/SKPreferenceController.m 2008-06-01 12:10:26 UTC (rev 3946)
@@ -172,6 +172,10 @@
isCustomTeXEditor = flag;
}
+- (BOOL)isLeopard {
+ return floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_4;
+}
+
- (IBAction)changeDiscreteThumbnailSizes:(id)sender {
if ([sender state] == NSOnState) {
[thumbnailSizeSlider setNumberOfTickMarks:8];
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