Revision: 15934
          http://sourceforge.net/p/skim-app/code/15934
Author:   hofman
Date:     2025-12-27 17:43:33 +0000 (Sat, 27 Dec 2025)
Log Message:
-----------
revert previous commit and includ notification in redisplay method

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

Modified: trunk/SKMainWindowController_UI.m
===================================================================
--- trunk/SKMainWindowController_UI.m   2025-12-27 17:28:14 UTC (rev 15933)
+++ trunk/SKMainWindowController_UI.m   2025-12-27 17:43:33 UTC (rev 15934)
@@ -2115,11 +2115,8 @@
 - (void)handleReadingBarDidChangeNotification:(NSNotification *)notification {
     NSDictionary *userInfo = [notification userInfo];
     PDFPage *page = [userInfo objectForKey:SKPDFViewPageKey];
-    PDFPage *oldPage = [userInfo objectForKey:SKPDFViewOldPageKey];
     if (page)
         [self updateThumbnailAtPageIndex:[page pageIndex]];
-    if (oldPage)
-        [self updateThumbnailAtPageIndex:[oldPage pageIndex]];
 }
 
 - (void)handleWillRemoveDocumentNotification:(NSNotification *)notification {

Modified: trunk/SKPDFView.h
===================================================================
--- trunk/SKPDFView.h   2025-12-27 17:28:14 UTC (rev 15933)
+++ trunk/SKPDFView.h   2025-12-27 17:43:33 UTC (rev 15934)
@@ -60,7 +60,6 @@
 extern NSNotificationName const SKPDFViewPacerStartedOrStoppedNotification;
 
 extern NSString * const SKPDFViewAnnotationKey;
-extern NSString * const SKPDFViewOldPageKey;
 extern NSString * const SKPDFViewPageKey;
 
 typedef NS_ENUM(NSInteger, SKToolMode) {

Modified: trunk/SKPDFView.m
===================================================================
--- trunk/SKPDFView.m   2025-12-27 17:28:14 UTC (rev 15933)
+++ trunk/SKPDFView.m   2025-12-27 17:43:33 UTC (rev 15934)
@@ -121,7 +121,6 @@
 
 NSString * const SKPDFViewAnnotationKey = @"annotation";
 NSString * const SKPDFViewPageKey = @"page";
-NSString * const SKPDFViewOldPageKey = @"oldPage";
 
 #define SKMoveReadingBarModifiersKey @"SKMoveReadingBarModifiers"
 #define SKResizeReadingBarModifiersKey @"SKResizeReadingBarModifiers"
@@ -205,8 +204,7 @@
 - (void)stopPacer;
 - (void)updatePacer;
 
-- (void)setNeedsDisplayForReadingBarBounds:(NSRect)rect onPage:(PDFPage *)page;
-- (void)setNeedsDisplayForInvertedReadingBar;
+- (void)setNeedsDisplay:(BOOL)needsDisplay forReadingBarBounds:(NSRect)rect 
onPage:(PDFPage *)page notify:(BOOL)notify;
 
 - (void)doMoveCurrentAnnotationForKey:(unichar)eventChar 
byAmount:(CGFloat)delta;
 - (void)doResizeCurrentAnnotationForKey:(unichar)eventChar 
byAmount:(CGFloat)delta;
@@ -938,12 +936,10 @@
 - (void)toggleReadingBar {
     PDFPage *page = nil;
     NSRect bounds = NSZeroRect;
-    NSDictionary *userInfo = nil;
     if (readingBar) {
         page = [readingBar page];
         bounds = [readingBar currentBounds];
         [self setReadingBar:nil];
-        userInfo = page ? @{SKPDFViewPageKey: page} : nil;
     } else {
         page = [self currentPage];
         NSInteger line = 0;
@@ -964,14 +960,9 @@
         rect = ([page lineDirectionAngle] % 180) ? NSInsetRect(rect, 0.0, 
-20.0) : NSInsetRect(rect, -20.0, 0.0);
         [self goToRect:rect onPage:page];
         [self setReadingBar:aReadingBar];
-        userInfo = page ? @{SKPDFViewPageKey: page} : nil;
     }
     [self updatePacer];
-    if ([[NSUserDefaults standardUserDefaults] 
boolForKey:SKReadingBarInvertKey])
-        [self setNeedsDisplayForInvertedReadingBar];
-    else
-        [self setNeedsDisplayForReadingBarBounds:bounds onPage:page];
-    [[NSNotificationCenter defaultCenter] 
postNotificationName:SKPDFViewReadingBarDidChangeNotification object:self 
userInfo:userInfo];
+    [self setNeedsDisplay:[[NSUserDefaults standardUserDefaults] 
boolForKey:SKReadingBarInvertKey] forReadingBarBounds:bounds onPage:page 
notify:YES];
 }
 
 - (void)readingBarDidChangeBounds:(NSRect)oldBounds onPage:(PDFPage *)oldPage 
toBounds:(NSRect)newBounds onPage:(PDFPage *)newPage scroll:(BOOL)shouldScroll {
@@ -1011,12 +1002,9 @@
     }
     
     if (oldPage)
-        [self setNeedsDisplayForReadingBarBounds:oldBounds onPage:oldPage];
+        [self setNeedsDisplay:NO forReadingBarBounds:oldBounds onPage:oldPage 
notify:YES];
     if (newPage)
-        [self setNeedsDisplayForReadingBarBounds:newBounds onPage:newPage];
-    
-    NSDictionary *userInfo = (newPage && oldPage && newPage != oldPage) ? 
@{SKPDFViewPageKey: newPage, SKPDFViewOldPageKey: oldPage} : (newPage || 
oldPage) ? @{SKPDFViewPageKey: newPage ?: oldPage} : nil;
-    [[NSNotificationCenter defaultCenter] 
postNotificationName:SKPDFViewReadingBarDidChangeNotification object:self 
userInfo:userInfo];
+        [self setNeedsDisplay:NO forReadingBarBounds:newBounds onPage:newPage 
notify:newPage != oldPage];
 }
 
 #pragma mark Pacer
@@ -2912,13 +2900,16 @@
     [self updatedAnnotation:annotation forKey:nil fromValue:nil];
 }
 
-- (void)setNeedsDisplayForReadingBarBounds:(NSRect)rect onPage:(PDFPage *)page 
{
-    [self setNeedsDisplayInRect:[SKReadingBar bounds:rect forBox:[self 
displayBox] onPage:page] ofPage:page];
-}
+- (void)setNeedsDisplay:(BOOL)needsDisplay forReadingBarBounds:(NSRect)rect 
onPage:(PDFPage *)page notify:(BOOL)notify {
+    if (needsDisplay) {
+        [self setNeedsDisplay:YES];
+        [loupeController updateContents];
+    } else {
+        [self setNeedsDisplayInRect:[SKReadingBar bounds:rect forBox:[self 
displayBox] onPage:page] ofPage:page];
+    }
+    if (notify)
+        [[NSNotificationCenter defaultCenter] 
postNotificationName:SKPDFViewReadingBarDidChangeNotification object:self 
userInfo:page ? @{SKPDFViewPageKey: page} : nil];
 
-- (void)setNeedsDisplayForInvertedReadingBar {
-    [self setNeedsDisplay:YES];
-    [loupeController updateContents];
 }
 
 - (void)setNeedsDisplayInRect:(NSRect)rect ofPage:(PDFPage *)page {
@@ -2958,12 +2949,7 @@
             if ([self hasReadingBar] == NO) {
                 SKReadingBar *aReadingBar = [[SKReadingBar alloc] 
initWithPage:page line:line delegate:self];
                 [self setReadingBar:aReadingBar];
-                if (invert)
-                    [self setNeedsDisplayForInvertedReadingBar];
-                else
-                    [self setNeedsDisplayForReadingBarBounds:[readingBar 
currentBounds] onPage:[readingBar page]];
-                page = [readingBar page];
-                [[NSNotificationCenter defaultCenter] 
postNotificationName:SKPDFViewReadingBarDidChangeNotification object:self 
userInfo:page ? @{SKPDFViewPageKey: page} : nil];
+                [self setNeedsDisplay:invert forReadingBarBounds:[readingBar 
currentBounds] onPage:[readingBar page] notify:YES];
             } else {
                 [readingBar goToLine:line onPage:page];
             }
@@ -3311,12 +3297,7 @@
     if (context == &SKPDFViewDefaultsObservationContext) {
         if (readingBar) {
             PDFPage *page = [readingBar page];
-            if ([keyPath isEqualToString:SKReadingBarInvertKey] || 
[[NSUserDefaults standardUserDefaults] boolForKey:SKReadingBarInvertKey])
-                [self setNeedsDisplayForInvertedReadingBar];
-            else
-                [self setNeedsDisplayForReadingBarBounds:[readingBar 
currentBounds] onPage:page];
-            [[NSNotificationCenter defaultCenter] 
postNotificationName:SKPDFViewReadingBarDidChangeNotification
-                                                                object:self 
userInfo:page ? @{SKPDFViewPageKey: page} : nil];
+            [self setNeedsDisplay:([keyPath 
isEqualToString:SKReadingBarInvertKey] || [[NSUserDefaults 
standardUserDefaults] boolForKey:SKReadingBarInvertKey]) 
forReadingBarBounds:[readingBar currentBounds] onPage:page notify:YES];
         }
     } else {
         [super observeValueForKeyPath:keyPath ofObject:object change:change 
context:context];

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