Revision: 10183
          http://sourceforge.net/p/skim-app/code/10183
Author:   hofman
Date:     2018-12-27 19:12:12 +0000 (Thu, 27 Dec 2018)
Log Message:
-----------
implement needs rewind as setter, rename getter

Modified Paths:
--------------
    trunk/SKMainWindowController.m
    trunk/SKMainWindowController_Actions.m
    trunk/SKMainWindowController_UI.m
    trunk/SKPDFView.h
    trunk/SKPDFView.m

Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m      2018-12-26 11:19:02 UTC (rev 10182)
+++ trunk/SKMainWindowController.m      2018-12-27 19:12:12 UTC (rev 10183)
@@ -1431,7 +1431,7 @@
     [savedNormalSetup setObject:[NSNumber numberWithBool:[scrollView 
hasVerticalScroller]] forKey:HASVERTICALSCROLLER_KEY];
     [savedNormalSetup setObject:[NSNumber numberWithBool:[scrollView 
autohidesScrollers]] forKey:AUTOHIDESSCROLLERS_KEY];
     // Set up presentation mode
-    [pdfView needsRewind];
+    [pdfView setNeedsRewind:YES];
     [pdfView setBackgroundColor:RUNNING(10_12) ? [NSColor blackColor] : 
[NSColor clearColor]];
     [pdfView setAutoScales:YES];
     [pdfView setDisplayMode:kPDFDisplaySinglePage];
@@ -1613,7 +1613,7 @@
         [[self window] setLevel:NSNormalWindowLevel];
         [pdfView setBackgroundColor:backgroundColor];
         [secondaryPdfView setBackgroundColor:backgroundColor];
-        [pdfView needsRewind];
+        [pdfView setNeedsRewind:YES];
         [self applyPDFSettings:[fullScreenSetup count] ? fullScreenSetup : 
savedNormalSetup];
         [pdfView layoutDocumentView];
         [pdfView requiresDisplay];
@@ -1622,7 +1622,7 @@
         
         [pdfView setBackgroundColor:backgroundColor];
         [secondaryPdfView setBackgroundColor:backgroundColor];
-        [pdfView needsRewind];
+        [pdfView setNeedsRewind:YES];
         [self applyPDFSettings:fullScreenSetup];
         
         [self fadeInFullScreenView:pdfSplitView inset:[SKSideWindow 
requiredMargin]];
@@ -1748,7 +1748,7 @@
     
     if (wasInteractionMode == SKPresentationMode)
         [self exitPresentationMode];
-    [pdfView needsRewind];
+    [pdfView setNeedsRewind:YES];
     [self applyPDFSettings:savedNormalSetup];
     [savedNormalSetup removeAllObjects];
     
@@ -1889,7 +1889,7 @@
     [pdfView setBackgroundColor:backgroundColor];
     [secondaryPdfView setBackgroundColor:backgroundColor];
     if ([[pdfView document] isLocked] == NO && [fullScreenSetup count]) {
-        [pdfView needsRewind];
+        [pdfView setNeedsRewind:YES];
         [self applyPDFSettings:fullScreenSetup];
     }
     if (collapseSidePanesInFullScreen) {
@@ -1915,7 +1915,7 @@
     [pdfView setBackgroundColor:backgroundColor];
     [secondaryPdfView setBackgroundColor:backgroundColor];
     if ([[[NSUserDefaults standardUserDefaults] 
dictionaryForKey:SKDefaultFullScreenPDFDisplaySettingsKey] count]) {
-        [pdfView needsRewind];
+        [pdfView setNeedsRewind:YES];
         [self applyPDFSettings:savedNormalSetup];
     }
     NSNumber *leftWidth = [savedNormalSetup 
objectForKey:LEFTSIDEPANEWIDTH_KEY];

Modified: trunk/SKMainWindowController_Actions.m
===================================================================
--- trunk/SKMainWindowController_Actions.m      2018-12-26 11:19:02 UTC (rev 
10182)
+++ trunk/SKMainWindowController_Actions.m      2018-12-27 19:12:12 UTC (rev 
10183)
@@ -450,7 +450,7 @@
     [undoManager setActionName:NSLocalizedString(@"Rotate", @"Undo action 
name")];
     [[self document] undoableActionIsDiscardable];
     
-    [pdfView needsRewind];
+    [pdfView setNeedsRewind:YES];
     
     NSInteger i, count = [[pdfView document] pageCount];
     for (i = 0; i < count; i++)
@@ -504,7 +504,7 @@
 }
 
 - (void)cropPagesToRects:(NSPointerArray *)rects {
-    [pdfView needsRewind];
+    [pdfView setNeedsRewind:YES];
     
     NSInteger i, count = [[pdfView document] pageCount];
     NSInteger rectCount = [rects count];

Modified: trunk/SKMainWindowController_UI.m
===================================================================
--- trunk/SKMainWindowController_UI.m   2018-12-26 11:19:02 UTC (rev 10182)
+++ trunk/SKMainWindowController_UI.m   2018-12-27 19:12:12 UTC (rev 10183)
@@ -1698,7 +1698,7 @@
     // When the PDFView is changing scale, or when view settings change when 
switching fullscreen modes, 
     // a lot of wrong page change notifications may be send, which we better 
ignore. 
     // Full screen switching and zooming should not change the current page 
anyway.
-    if ([pdfView isZooming] || mwcFlags.isSwitchingFullScreen || [pdfView 
wantsRewind])
+    if ([pdfView isZooming] || mwcFlags.isSwitchingFullScreen || [pdfView 
needsRewind])
         return;
     
     PDFPage *page = [pdfView currentPage];

Modified: trunk/SKPDFView.h
===================================================================
--- trunk/SKPDFView.h   2018-12-26 11:19:02 UTC (rev 10182)
+++ trunk/SKPDFView.h   2018-12-27 19:12:12 UTC (rev 10183)
@@ -149,10 +149,8 @@
 @property (nonatomic, readonly) SKTransitionController *transitionController;
 @property (nonatomic, retain) SKTypeSelectHelper *typeSelectHelper;
 
+@property (nonatomic) BOOL needsRewind;
 
-@property (nonatomic, readonly) BOOL wantsRewind;
-- (void)needsRewind;
-
 - (void)toggleReadingBar;
 
 - (IBAction)delete:(id)sender;

Modified: trunk/SKPDFView.m
===================================================================
--- trunk/SKPDFView.m   2018-12-26 11:19:02 UTC (rev 10182)
+++ trunk/SKPDFView.m   2018-12-27 19:12:12 UTC (rev 10183)
@@ -633,7 +633,7 @@
     
 - (void)setDisplayModeAndRewind:(PDFDisplayMode)mode {
     if (mode != [self displayMode]) {
-        [self needsRewind];
+        [self setNeedsRewind:YES];
         [self setDisplayMode:mode];
     }
 }
@@ -651,7 +651,7 @@
 
 - (void)setDisplayBoxAndRewind:(PDFDisplayBox)box {
     if (box != [self displayBox]) {
-        [self needsRewind];
+        [self setNeedsRewind:YES];
         [self setDisplayBox:box];
     }
 }
@@ -670,7 +670,7 @@
 
 - (void)setDisplaysAsBookAndRewind:(BOOL)asBook {
     if (asBook != [self displaysAsBook]) {
-        [self needsRewind];
+        [self setNeedsRewind:YES];
         [self setDisplaysAsBook:asBook];
     }
 }
@@ -1190,20 +1190,24 @@
 
 #pragma mark Rewind
 
-- (BOOL)wantsRewind {
+- (BOOL)needsRewind {
     return rewindPage != nil;
 }
 
-- (void)needsRewind {
-    [rewindPage release];
-    rewindPage = [[self currentPage] retain];
-    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.25 * 
NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
-        if (rewindPage) {
-            if ([[self currentPage] isEqual:rewindPage] == NO)
-                [self goToPage:rewindPage];
-            SKDESTROY(rewindPage);
-        }
-    });
+- (void)setNeedsRewind:(BOOL)flag {
+    if (flag) {
+        [rewindPage release];
+        rewindPage = [[self currentPage] retain];
+        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.25 * 
NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
+            if (rewindPage) {
+                if ([[self currentPage] isEqual:rewindPage] == NO)
+                    [self goToPage:rewindPage];
+                SKDESTROY(rewindPage);
+            }
+        });
+    } else {
+        SKDESTROY(rewindPage);
+    }
 }
 
 #pragma mark Event Handling

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



_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to