Revision: 14888 http://sourceforge.net/p/skim-app/code/14888 Author: hofman Date: 2025-01-27 10:42:05 +0000 (Mon, 27 Jan 2025) Log Message: ----------- Implement min history index override in base pdfview class
Modified Paths: -------------- trunk/SKBasePDFView.h trunk/SKBasePDFView.m trunk/SKPDFView.h trunk/SKPDFView.m trunk/SKSnapshotPDFView.h trunk/SKSnapshotPDFView.m Modified: trunk/SKBasePDFView.h =================================================================== --- trunk/SKBasePDFView.h 2025-01-27 10:41:29 UTC (rev 14887) +++ trunk/SKBasePDFView.h 2025-01-27 10:42:05 UTC (rev 14888) @@ -42,12 +42,16 @@ NS_ASSUME_NONNULL_BEGIN -@interface SKBasePDFView : PDFView +@interface SKBasePDFView : PDFView { + NSInteger minHistoryIndex; +} - (void)colorFiltersDidChange; - (void)scrollToDestination:(SKDestination)destination; +- (void)resetHistory; + @end NS_ASSUME_NONNULL_END Modified: trunk/SKBasePDFView.m =================================================================== --- trunk/SKBasePDFView.m 2025-01-27 10:41:29 UTC (rev 14887) +++ trunk/SKBasePDFView.m 2025-01-27 10:42:05 UTC (rev 14888) @@ -74,6 +74,7 @@ // make sure we don't use the same method name as a superclass or a subclass - (void)commonBaseInitialization { if (@available(macOS 10.14, *)) { + minHistoryIndex = 0; [self setAppearance:nil]; [[[self scrollView] contentView] setAppearance:[NSAppearance appearanceNamed:NSAppearanceNameAqua]]; if ([[NSUserDefaults standardUserDefaults] boolForKey:SKInvertColorsInDarkModeKey]) @@ -159,6 +160,18 @@ [self enablePageShadows:pageBreaks]; } +- (BOOL)canGoBack { + if ([self respondsToSelector:@selector(currentHistoryIndex)] && minHistoryIndex > 0) + return minHistoryIndex < [self currentHistoryIndex]; + else + return [super canGoBack]; +} + +- (void)resetHistory { + if ([self respondsToSelector:@selector(currentHistoryIndex)]) + minHistoryIndex = [self currentHistoryIndex]; +} + #pragma mark Bug fixes - (void)setDocument:(PDFDocument *)document { Modified: trunk/SKPDFView.h =================================================================== --- trunk/SKPDFView.h 2025-01-27 10:41:29 UTC (rev 14887) +++ trunk/SKPDFView.h 2025-01-27 10:42:05 UTC (rev 14888) @@ -172,8 +172,6 @@ CGFloat gestureRotation; NSUInteger gesturePageIndex; - NSInteger minHistoryIndex; - NSInteger spellingTag; _Atomic(BOOL) inKeyWindow; @@ -249,8 +247,6 @@ - (void)resetPDFToolTipRects; - (void)removePDFToolTipRects; -- (void)resetHistory; - @property (nonatomic, nullable, weak) id<SKPDFViewDelegate> delegate; - (nullable NSString *)currentColorDefaultKeyForAlternate:(BOOL)isAlt; Modified: trunk/SKPDFView.m =================================================================== --- trunk/SKPDFView.m 2025-01-27 10:41:29 UTC (rev 14887) +++ trunk/SKPDFView.m 2025-01-27 10:42:05 UTC (rev 14888) @@ -341,11 +341,6 @@ [self removeLoupeWindow]; } -- (void)resetHistory { - if ([self respondsToSelector:@selector(currentHistoryIndex)]) - minHistoryIndex = [self currentHistoryIndex]; -} - #pragma mark Tool Tips - (void)removePDFToolTipRects { @@ -1466,8 +1461,6 @@ - (BOOL)canGoBack { if ([[self document] isLocked]) return NO; - else if ([self respondsToSelector:@selector(currentHistoryIndex)] && minHistoryIndex > 0) - return minHistoryIndex < [self currentHistoryIndex]; else return [super canGoBack]; } Modified: trunk/SKSnapshotPDFView.h =================================================================== --- trunk/SKSnapshotPDFView.h 2025-01-27 10:41:29 UTC (rev 14887) +++ trunk/SKSnapshotPDFView.h 2025-01-27 10:42:05 UTC (rev 14888) @@ -58,14 +58,11 @@ BOOL switching; BOOL transientControlView; CGFloat startScale; - NSInteger minHistoryIndex; } @property (nonatomic) BOOL autoFits; @property (nonatomic) BOOL shouldAutoFit; -- (void)resetHistory; - @property (nonatomic, nullable, weak) id<SKSnapshotPDFViewDelegate> delegate; @end Modified: trunk/SKSnapshotPDFView.m =================================================================== --- trunk/SKSnapshotPDFView.m 2025-01-27 10:41:29 UTC (rev 14887) +++ trunk/SKSnapshotPDFView.m 2025-01-27 10:42:05 UTC (rev 14888) @@ -95,7 +95,6 @@ scalePopUpButton = nil; autoFitPage = nil; autoFitRect = NSZeroRect; - minHistoryIndex = 0; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handlePDFViewFrameChangedNotification:) name:NSViewFrameDidChangeNotification object:self]; @@ -454,18 +453,6 @@ return i > 1; } -- (BOOL)canGoBack { - if ([self respondsToSelector:@selector(currentHistoryIndex)] && minHistoryIndex > 0) - return minHistoryIndex < [self currentHistoryIndex]; - else - return [super canGoBack]; -} - -- (void)resetHistory { - if ([self respondsToSelector:@selector(currentHistoryIndex)]) - minHistoryIndex = [self currentHistoryIndex]; -} - - (void)goToPage:(PDFPage *)aPage { [super goToPage:aPage]; [self resetAutoFitRectIfNeeded]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. _______________________________________________ Skim-app-commit mailing list Skim-app-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/skim-app-commit