Revision: 5440
          http://skim-app.svn.sourceforge.net/skim-app/?rev=5440&view=rev
Author:   hofman
Date:     2009-06-19 19:31:19 +0000 (Fri, 19 Jun 2009)

Log Message:
-----------
show fullscreen navigation after a short delay when activating at bottom, so it 
won't show when quickly touching the bottom

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

Modified: trunk/SKPDFView.m
===================================================================
--- trunk/SKPDFView.m   2009-06-19 11:50:48 UTC (rev 5439)
+++ trunk/SKPDFView.m   2009-06-19 19:31:19 UTC (rev 5440)
@@ -146,6 +146,7 @@
 - (void)disableNavigation;
 
 - (void)doAutohide:(BOOL)flag;
+- (void)showNavWindow:(BOOL)flag;
 
 - (PDFDestination *)destinationForEvent:(NSEvent *)theEvent isLink:(BOOL 
*)isLink;
 
@@ -292,7 +293,8 @@
     [[NSUserDefaultsController sharedUserDefaultsController] 
removeObserver:self forKeys:
         [NSArray arrayWithObjects:SKReadingBarColorKey, SKReadingBarInvertKey, 
nil]];
     [[NSNotificationCenter defaultCenter] removeObserver:self];
-    [self doAutohide:NO]; // invalidates and releases the timer
+    [self showNavWindow:NO];
+    [self doAutohide:NO];
     [[SKPDFToolTipWindow sharedToolTipWindow] orderOut:self];
     [self removePDFToolTipRects];
     CFRelease(PDFToolTipRects);
@@ -1218,8 +1220,12 @@
         [self setActiveAnnotation:nil];
     }
     
-    if ([navWindow isVisible] == NO && ((navigationMode == 
SKNavigationEverywhere) || (navigationMode == SKNavigationBottom && [theEvent 
locationInWindow].y < 3.0)))
-        [navWindow orderFront:self];
+    if ([navWindow isVisible] == NO) {
+        if (navigationMode == SKNavigationEverywhere)
+            [navWindow orderFront:nil];
+        else if (navigationMode == SKNavigationBottom && [theEvent 
locationInWindow].y < 3.0)
+            [self showNavWindow:YES];
+    }
     if (navigationMode != SKNavigationNone || interactionMode == 
SKPresentationMode)
         [self doAutohide:YES];
 }
@@ -2506,11 +2512,12 @@
 - (void)disableNavigation {
     navigationMode = SKNavigationNone;
     
+    [self showNavWindow:NO];
     [self doAutohide:NO];
     [navWindow orderOut:self];
 }
 
-- (void)autohideTimerFired:(NSTimer *)aTimer {
+- (void)doAutohideDelayed {
     if (NSPointInRect([NSEvent mouseLocation], [navWindow frame]))
         return;
     if (interactionMode == SKPresentationMode)
@@ -2520,15 +2527,22 @@
 }
 
 - (void)doAutohide:(BOOL)flag {
-    if (autohideTimer) {
-        [autohideTimer invalidate];
-        [autohideTimer release];
-        autohideTimer = nil;
-    }
+    [[self class] cancelPreviousPerformRequestsWithTarget:self 
selector:@selector(doAutohideDelayed) object:nil];
     if (flag)
-        autohideTimer  = [[NSTimer scheduledTimerWithTimeInterval:3.0 
target:self selector:@selector(autohideTimerFired:) userInfo:nil repeats:NO] 
retain];
+        [self performSelector:@selector(doAutohideDelayed) withObject:nil 
afterDelay:3.0];
 }
 
+- (void)showNavWindowDelayed {
+    if ([navWindow isVisible] == NO && [[self window] 
mouseLocationOutsideOfEventStream].y < 3.0)
+        [navWindow orderFront:nil];
+}
+
+- (void)showNavWindow:(BOOL)flag {
+    [[self class] cancelPreviousPerformRequestsWithTarget:self 
selector:@selector(showNavWindowDelayed) object:nil];
+    if (flag)
+        [self performSelector:@selector(showNavWindowDelayed) withObject:nil 
afterDelay:0.3];
+}
+
 #pragma mark Event handling
 
 - (PDFDestination *)destinationForEvent:(NSEvent *)theEvent isLink:(BOOL 
*)isLink {


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

------------------------------------------------------------------------------
Are you an open source citizen? Join us for the Open Source Bridge conference!
Portland, OR, June 17-19. Two days of sessions, one day of unconference: $250.
Need another reason to go? 24-hour hacker lounge. Register today!
http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to