Revision: 14890 http://sourceforge.net/p/skim-app/code/14890 Author: hofman Date: 2025-01-27 16:33:20 +0000 (Mon, 27 Jan 2025) Log Message: ----------- Declare private methods locally. Try historyIndex ivar when currentHistoryIndex is not implemented, this happens on 10.15+.
Modified Paths: -------------- trunk/PDFView_SKExtensions.h trunk/SKBasePDFView.m trunk/SKPDFView.m trunk/SKSecondaryPDFView.m Modified: trunk/PDFView_SKExtensions.h =================================================================== --- trunk/PDFView_SKExtensions.h 2025-01-27 10:46:30 UTC (rev 14889) +++ trunk/PDFView_SKExtensions.h 2025-01-27 16:33:20 UTC (rev 14890) @@ -78,12 +78,4 @@ @end - -@interface PDFView (SKPrivateDeclarations) -- (NSInteger)currentHistoryIndex; -- (BOOL)writeSelectionToPasteboard:(NSPasteboard *)pboard types:(NSArray *)types; -- (BOOL)hasEnabledSwipeGestures; -- (void)enableSwipeGestures:(BOOL)flag; -@end - NS_ASSUME_NONNULL_END Modified: trunk/SKBasePDFView.m =================================================================== --- trunk/SKBasePDFView.m 2025-01-27 10:46:30 UTC (rev 14889) +++ trunk/SKBasePDFView.m 2025-01-27 16:33:20 UTC (rev 14890) @@ -54,6 +54,10 @@ @end #endif +@interface PDFView (SKPrivateDeclarations1) +- (NSInteger)currentHistoryIndex; +@end + @interface SKBasePDFView (BDSKPrivate) - (void)handleScrollerStyleChangedNotification:(NSNotification *)notification; @@ -161,15 +165,29 @@ } - (BOOL)canGoBack { - if ([self respondsToSelector:@selector(currentHistoryIndex)] && minHistoryIndex > 0) - return minHistoryIndex < [self currentHistoryIndex]; - else - return [super canGoBack]; + BOOL canGoBack = [super canGoBack]; + if (minHistoryIndex > 0) { + if ([self respondsToSelector:@selector(currentHistoryIndex)]) { + canGoBack = minHistoryIndex < [self currentHistoryIndex]; + } else { + @try { + canGoBack = minHistoryIndex < [[self valueForKeyPath:@"_private.historyIndex"] integerValue]; + } + @catch (id e) {} + } + } + return canGoBack; } - (void)resetHistory { - if ([self respondsToSelector:@selector(currentHistoryIndex)]) + if ([self respondsToSelector:@selector(currentHistoryIndex)]) { minHistoryIndex = [self currentHistoryIndex]; + } else { + @try { + minHistoryIndex = [[self valueForKeyPath:@"_private.historyIndex"] integerValue]; + } + @catch (id e) {} + } } #pragma mark Bug fixes Modified: trunk/SKPDFView.m =================================================================== --- trunk/SKPDFView.m 2025-01-27 10:46:30 UTC (rev 14889) +++ trunk/SKPDFView.m 2025-01-27 16:33:20 UTC (rev 14890) @@ -180,6 +180,12 @@ #pragma mark - +@interface PDFView (SKPrivateDeclarations) +- (BOOL)writeSelectionToPasteboard:(NSPasteboard *)pboard types:(NSArray *)types; +- (BOOL)hasEnabledSwipeGestures; +- (void)enableSwipeGestures:(BOOL)flag; +@end + @interface SKPDFView () <SKReadingBarDelegate, SKLayerDelegate> @property (strong) SKReadingBar *readingBar; @property (strong) SKSyncDot *syncDot; Modified: trunk/SKSecondaryPDFView.m =================================================================== --- trunk/SKSecondaryPDFView.m 2025-01-27 10:46:30 UTC (rev 14889) +++ trunk/SKSecondaryPDFView.m 2025-01-27 16:33:20 UTC (rev 14890) @@ -53,6 +53,9 @@ #import "SKPDFView.h" #import "SKTopBarView.h" +@interface PDFView (SKPrivateDeclarations2) +- (BOOL)writeSelectionToPasteboard:(NSPasteboard *)pboard types:(NSArray *)types; +@end @interface SKSecondaryPDFView (SKPrivate) 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