Revision: 12620 http://sourceforge.net/p/skim-app/code/12620 Author: hofman Date: 2021-12-12 10:30:54 +0000 (Sun, 12 Dec 2021) Log Message: ----------- Remove customization of page background color, it does not work anyway since 10.12
Modified Paths: -------------- trunk/PDFPage_SKExtensions.m trunk/PDFView_SKExtensions.h trunk/PDFView_SKExtensions.m trunk/SKApplicationController.h trunk/SKApplicationController.m trunk/SKMainWindowController.m trunk/SKMainWindowController_Actions.m trunk/SKPDFView.m trunk/SKSnapshotWindowController.m trunk/SKStringConstants.h trunk/SKStringConstants.m trunk/SKTextNoteEditor.m trunk/Skim.sdef Modified: trunk/PDFPage_SKExtensions.m =================================================================== --- trunk/PDFPage_SKExtensions.m 2021-12-12 10:07:20 UTC (rev 12619) +++ trunk/PDFPage_SKExtensions.m 2021-12-12 10:30:54 UTC (rev 12620) @@ -202,7 +202,7 @@ [[NSGraphicsContext currentContext] setImageInterpolation:[[NSUserDefaults standardUserDefaults] integerForKey:SKInterpolationQualityKey] + 1]; [NSGraphicsContext saveGraphicsState]; - [[PDFView defaultPageBackgroundColor] setFill]; + [[NSColor whiteColor] setFill]; if (shadowBlurRadius > 0.0) [NSShadow setShadowWithWhite:0.0 alpha:0.33333 blurRadius:shadowBlurRadius yOffset:shadowOffset]; NSRectFill(pageRect); Modified: trunk/PDFView_SKExtensions.h =================================================================== --- trunk/PDFView_SKExtensions.h 2021-12-12 10:07:20 UTC (rev 12619) +++ trunk/PDFView_SKExtensions.h 2021-12-12 10:30:54 UTC (rev 12620) @@ -47,8 +47,6 @@ @property (nonatomic, readonly) CGFloat minimumScaleFactor; @property (nonatomic, readonly) CGFloat maximumScaleFactor; -+ (NSColor *)defaultPageBackgroundColor; - - (BOOL)isPageAtIndexDisplayed:(NSUInteger)pageIndex; - (void)setNeedsDisplayInRect:(NSRect)rect ofPage:(PDFPage *)page; @@ -70,10 +68,7 @@ + (NSColor *)defaultBackgroundColor; + (NSColor *)defaultFullScreenBackgroundColor; -+ (NSColor *)defaultPageBackgroundColor; -- (void)applyDefaultPageBackgroundColor; - @end @@ -80,6 +75,4 @@ @interface PDFView (SKPrivateDeclarations) - (NSInteger)currentHistoryIndex; - (BOOL)writeSelectionToPasteboard:(NSPasteboard *)pboard types:(NSArray *)types; -- (NSColor *)pageColor; -- (void)setPageColor:(NSColor *)color; @end Modified: trunk/PDFView_SKExtensions.m =================================================================== --- trunk/PDFView_SKExtensions.m 2021-12-12 10:07:20 UTC (rev 12619) +++ trunk/PDFView_SKExtensions.m 2021-12-12 10:30:54 UTC (rev 12620) @@ -279,17 +279,6 @@ return RUNNING_AFTER(10_11) ? rect : [self convertRect:[self backingAlignedRect:[self convertRect:rect fromPage:page] options:NSAlignAllEdgesOutward] toPage:page]; } -+ (NSColor *)defaultPageBackgroundColor { - if ([self instancesRespondToSelector:@selector(setPageColor:)] && RUNNING_BEFORE(10_12)) - return [[NSUserDefaults standardUserDefaults] colorForKey:SKPageBackgroundColorKey] ?: [NSColor whiteColor]; - return [NSColor whiteColor]; -} - -- (void)applyDefaultPageBackgroundColor { - if ([self respondsToSelector:@selector(setPageColor:)] && RUNNING_BEFORE(10_12)) - [self setPageColor:[[self class] defaultPageBackgroundColor]]; -} - static NSColor *defaultBackgroundColor(NSString *backgroundColorKey, NSString *darkBackgroundColorKey) { NSColor *color = nil; if (SKHasDarkAppearance(NSApp)) Modified: trunk/SKApplicationController.h =================================================================== --- trunk/SKApplicationController.h 2021-12-12 10:07:20 UTC (rev 12619) +++ trunk/SKApplicationController.h 2021-12-12 10:30:54 UTC (rev 12620) @@ -64,7 +64,6 @@ @property (nonatomic, readonly) NSColorList *colorList; -@property (nonatomic, copy) NSColor *pageBackgroundColor; @property (nonatomic, copy) NSArray *favoriteColors; @property (nonatomic) PDFLineStyle defaultStartLineStyle, defaultEndLineStyle; @property (nonatomic) NSTextAlignment defaultAlignment; Modified: trunk/SKApplicationController.m =================================================================== --- trunk/SKApplicationController.m 2021-12-12 10:07:20 UTC (rev 12619) +++ trunk/SKApplicationController.m 2021-12-12 10:30:54 UTC (rev 12620) @@ -125,7 +125,7 @@ @implementation SKApplicationController @synthesize noteColumnsMenu, noteTypeMenu, colorList; -@dynamic pageBackgroundColor, favoriteColors; +@dynamic favoriteColors; + (void)initialize{ SKINITIALIZE; @@ -476,7 +476,7 @@ - (BOOL)application:(NSApplication *)sender delegateHandlesKey:(NSString *)key { static NSSet *applicationScriptingKeys = nil; if (applicationScriptingKeys == nil) - applicationScriptingKeys = [[NSSet alloc] initWithObjects:@"bookmarks", @"downloads", @"notePreferences", @"displayPreferences", @"richTextFormat", @"pageBackgroundColor", @"favoriteColors", nil]; + applicationScriptingKeys = [[NSSet alloc] initWithObjects:@"bookmarks", @"downloads", @"notePreferences", @"displayPreferences", @"richTextFormat", @"favoriteColors", nil]; return [applicationScriptingKeys containsObject:key]; } @@ -542,19 +542,6 @@ return data ? [[[NSAttributedString alloc] initWithData:data options:[NSDictionary dictionary] documentAttributes:NULL error:NULL] autorelease] : nil; } -- (NSColor *)pageBackgroundColor { - return [[NSUserDefaults standardUserDefaults] colorForKey:SKPageBackgroundColorKey] ?: [NSColor whiteColor]; -} - -- (void)setPageBackgroundColor:(NSColor *)color { - CGFloat c[4] = {1.0, 1.0, 1.0, 1.0}; - [[color colorUsingColorSpace:[NSColorSpace sRGBColorSpace]] getComponents:c]; - if (c[0] > 0.999 && c[1] > 0.999 && c[2] > 0.999 && c[3] >= 1.0) - [[NSUserDefaults standardUserDefaults] removeObjectForKey:SKPageBackgroundColorKey]; - else - [[NSUserDefaults standardUserDefaults] setColor:color forKey:SKPageBackgroundColorKey]; -} - - (NSArray *)favoriteColors { return [NSColor favoriteColors]; } Modified: trunk/SKMainWindowController.m =================================================================== --- trunk/SKMainWindowController.m 2021-12-12 10:07:20 UTC (rev 12619) +++ trunk/SKMainWindowController.m 2021-12-12 10:30:54 UTC (rev 12620) @@ -436,7 +436,6 @@ [pdfView setInterpolationQuality:[sud integerForKey:SKInterpolationQualityKey]]; [pdfView setGreekingThreshold:[sud floatForKey:SKGreekingThresholdKey]]; [pdfView setBackgroundColor:[PDFView defaultBackgroundColor]]; - [pdfView applyDefaultPageBackgroundColor]; [self applyPDFSettings:hasWindowSetup ? savedNormalSetup : [sud dictionaryForKey:SKDefaultPDFDisplaySettingsKey] rewind:NO]; @@ -2332,8 +2331,7 @@ [[NSUserDefaultsController sharedUserDefaultsController] addObserver:self forKeys: [NSArray arrayWithObjects:SKBackgroundColorKey, SKFullScreenBackgroundColorKey, SKDarkBackgroundColorKey, SKDarkFullScreenBackgroundColorKey, - SKPageBackgroundColorKey, - SKThumbnailSizeKey, SKSnapshotThumbnailSizeKey, + SKThumbnailSizeKey, SKSnapshotThumbnailSizeKey, SKShouldAntiAliasKey, SKInterpolationQualityKey, SKGreekingThresholdKey, SKTableFontSizeKey, nil] context:&SKMainWindowDefaultsObservationContext]; @@ -2346,7 +2344,6 @@ [[NSUserDefaultsController sharedUserDefaultsController] removeObserver:self forKeys: [NSArray arrayWithObjects:SKBackgroundColorKey, SKFullScreenBackgroundColorKey, SKDarkBackgroundColorKey, SKDarkFullScreenBackgroundColorKey, - SKPageBackgroundColorKey, SKThumbnailSizeKey, SKSnapshotThumbnailSizeKey, SKShouldAntiAliasKey, SKInterpolationQualityKey, SKGreekingThresholdKey, SKTableFontSizeKey, nil] context:&SKMainWindowDefaultsObservationContext]; @@ -2422,11 +2419,6 @@ [pdfView setBackgroundColor:color]; [secondaryPdfView setBackgroundColor:color]; } - } else if ([key isEqualToString:SKPageBackgroundColorKey]) { - [pdfView applyDefaultPageBackgroundColor]; - [secondaryPdfView applyDefaultPageBackgroundColor]; - [self allThumbnailsNeedUpdate]; - [self allSnapshotsNeedUpdate]; } else if ([key isEqualToString:SKThumbnailSizeKey]) { [self resetThumbnailSizeIfNeeded]; [leftSideController.thumbnailTableView noteHeightOfRowsChangedAnimating:YES]; Modified: trunk/SKMainWindowController_Actions.m =================================================================== --- trunk/SKMainWindowController_Actions.m 2021-12-12 10:07:20 UTC (rev 12619) +++ trunk/SKMainWindowController_Actions.m 2021-12-12 10:30:54 UTC (rev 12620) @@ -1115,7 +1115,6 @@ [secondaryPdfView setSynchronizedPDFView:pdfView]; [secondaryPdfView setBackgroundColor:[pdfView backgroundColor]]; [[secondaryPdfView scrollView] setDrawsBackground:[[pdfView scrollView] drawsBackground]]; - [secondaryPdfView applyDefaultPageBackgroundColor]; [secondaryPdfView setDisplaysPageBreaks:NO]; [secondaryPdfView setShouldAntiAlias:[[NSUserDefaults standardUserDefaults] boolForKey:SKShouldAntiAliasKey]]; [secondaryPdfView setInterpolationQuality:[[NSUserDefaults standardUserDefaults] integerForKey:SKInterpolationQualityKey]]; Modified: trunk/SKPDFView.m =================================================================== --- trunk/SKPDFView.m 2021-12-12 10:07:20 UTC (rev 12619) +++ trunk/SKPDFView.m 2021-12-12 10:30:54 UTC (rev 12620) @@ -4775,7 +4775,7 @@ // draw page background, simulate the private method -drawPagePre: [NSGraphicsContext saveGraphicsState]; - [[[self class] defaultPageBackgroundColor] set]; + [[NSColor whiteColor] set]; [NSShadow setShadowWithColor:[aShadow shadowColor] blurRadius:[aShadow shadowBlurRadius] offset:[aShadow shadowOffset]]; NSRectFill(SKIntegralRect(pageRect)); [NSGraphicsContext restoreGraphicsState]; Modified: trunk/SKSnapshotWindowController.m =================================================================== --- trunk/SKSnapshotWindowController.m 2021-12-12 10:07:20 UTC (rev 12619) +++ trunk/SKSnapshotWindowController.m 2021-12-12 10:30:54 UTC (rev 12620) @@ -121,7 +121,7 @@ [[self window] setTabbingMode:NSWindowTabbingModeDisallowed]; [[self window] setCollectionBehavior:[[self window] collectionBehavior] | NSWindowCollectionBehaviorFullScreenAuxiliary]; [self updateWindowLevel]; - [[NSUserDefaultsController sharedUserDefaultsController] addObserver:self forKeys:[NSArray arrayWithObjects:SKSnapshotsOnTopKey, SKShouldAntiAliasKey, SKInterpolationQualityKey, SKGreekingThresholdKey, SKBackgroundColorKey, SKDarkBackgroundColorKey, SKPageBackgroundColorKey, nil] context:&SKSnaphotWindowDefaultsObservationContext]; + [[NSUserDefaultsController sharedUserDefaultsController] addObserver:self forKeys:[NSArray arrayWithObjects:SKSnapshotsOnTopKey, SKShouldAntiAliasKey, SKInterpolationQualityKey, SKGreekingThresholdKey, SKBackgroundColorKey, SKDarkBackgroundColorKey, nil] context:&SKSnaphotWindowDefaultsObservationContext]; if (RUNNING_AFTER(10_13)) [NSApp addObserver:self forKeyPath:@"effectiveAppearance" options:0 context:&SKSnaphotWindowAppObservationContext]; // the window is initialially exposed. The windowDidExpose notification is useless, it has nothing to do with showing the window @@ -224,7 +224,7 @@ } - (void)windowWillClose:(NSNotification *)notification { - @try { [[NSUserDefaultsController sharedUserDefaultsController] removeObserver:self forKeys:[NSArray arrayWithObjects:SKSnapshotsOnTopKey, SKShouldAntiAliasKey, SKInterpolationQualityKey, SKGreekingThresholdKey, SKBackgroundColorKey, SKDarkBackgroundColorKey, SKPageBackgroundColorKey, nil] context:&SKSnaphotWindowDefaultsObservationContext]; } + @try { [[NSUserDefaultsController sharedUserDefaultsController] removeObserver:self forKeys:[NSArray arrayWithObjects:SKSnapshotsOnTopKey, SKShouldAntiAliasKey, SKInterpolationQualityKey, SKGreekingThresholdKey, SKBackgroundColorKey, SKDarkBackgroundColorKey, nil] context:&SKSnaphotWindowDefaultsObservationContext]; } @catch (id e) {} if (RUNNING_AFTER(10_13)) { @try { [NSApp removeObserver:self forKeyPath:@"effectiveAppearance" context:&SKSnaphotWindowAppObservationContext]; } @@ -298,7 +298,6 @@ [pdfView setInterpolationQuality:[[NSUserDefaults standardUserDefaults] integerForKey:SKInterpolationQualityKey]]; [pdfView setGreekingThreshold:[[NSUserDefaults standardUserDefaults] floatForKey:SKGreekingThresholdKey]]; [pdfView setBackgroundColor:[PDFView defaultBackgroundColor]]; - [pdfView applyDefaultPageBackgroundColor]; [pdfView setDocument:pdfDocument]; PDFPage *page = [pdfDocument pageAtIndex:pageNum]; @@ -510,7 +509,7 @@ [[NSGraphicsContext currentContext] setImageInterpolation:NSImageInterpolationHigh]; [transform concat]; [NSGraphicsContext saveGraphicsState]; - [[PDFView defaultPageBackgroundColor] set]; + [[NSColor whiteColor] set]; if (shadowBlurRadius > 0.0) [NSShadow setShadowWithWhite:0.0 alpha:0.5 blurRadius:shadowBlurRadius yOffset:shadowOffset]; NSRectFill(bounds); @@ -673,8 +672,6 @@ [pdfView setGreekingThreshold:[[NSUserDefaults standardUserDefaults] floatForKey:SKGreekingThresholdKey]]; } else if ([key isEqualToString:SKBackgroundColorKey] || [key isEqualToString:SKDarkBackgroundColorKey]) { [pdfView setBackgroundColor:[PDFView defaultBackgroundColor]]; - } else if ([key isEqualToString:SKPageBackgroundColorKey]) { - [pdfView applyDefaultPageBackgroundColor]; } } else if (context == &SKSnaphotWindowAppObservationContext) { [pdfView setBackgroundColor:[PDFView defaultBackgroundColor]]; Modified: trunk/SKStringConstants.h =================================================================== --- trunk/SKStringConstants.h 2021-12-12 10:07:20 UTC (rev 12619) +++ trunk/SKStringConstants.h 2021-12-12 10:30:54 UTC (rev 12620) @@ -46,7 +46,6 @@ extern NSString *SKFullScreenBackgroundColorKey; extern NSString *SKDarkBackgroundColorKey; extern NSString *SKDarkFullScreenBackgroundColorKey; -extern NSString *SKPageBackgroundColorKey; extern NSString *SKLastOpenFileNamesKey; extern NSString *SKOpenContentsPaneOnlyForTOCKey; extern NSString *SKInitialWindowSizeOptionKey; Modified: trunk/SKStringConstants.m =================================================================== --- trunk/SKStringConstants.m 2021-12-12 10:07:20 UTC (rev 12619) +++ trunk/SKStringConstants.m 2021-12-12 10:30:54 UTC (rev 12620) @@ -47,7 +47,6 @@ NSString *SKFullScreenBackgroundColorKey = @"SKFullScreenBackgroundColor"; NSString *SKDarkBackgroundColorKey = @"SKDarkBackgroundColor"; NSString *SKDarkFullScreenBackgroundColorKey = @"SKDarkFullScreenBackgroundColor"; -NSString *SKPageBackgroundColorKey = @"SKPageBackgroundColor"; NSString *SKLastOpenFileNamesKey = @"SKLastOpenFileNames"; NSString *SKOpenContentsPaneOnlyForTOCKey = @"SKOpenContentsPaneOnlyForTOC"; NSString *SKInitialWindowSizeOptionKey = @"SKInitialWindowSizeOption"; Modified: trunk/SKTextNoteEditor.m =================================================================== --- trunk/SKTextNoteEditor.m 2021-12-12 10:07:20 UTC (rev 12619) +++ trunk/SKTextNoteEditor.m 2021-12-12 10:30:54 UTC (rev 12620) @@ -282,7 +282,7 @@ [NSGraphicsContext saveGraphicsState]; if ((RUNNING(10_13) || RUNNING(10_14)) && (color == nil || [color alphaComponent] < 1.0)) { - [[PDFView defaultPageBackgroundColor] setFill]; + [[NSColor whiteColor] setFill]; [NSBezierPath fillRect:bounds]; } Modified: trunk/Skim.sdef =================================================================== --- trunk/Skim.sdef 2021-12-12 10:07:20 UTC (rev 12619) +++ trunk/Skim.sdef 2021-12-12 10:30:54 UTC (rev 12620) @@ -719,10 +719,6 @@ description="Rich text formats."> <cocoa key="richTextFormat"/> </element> - <property name="page background color" type="RGBA color" code="PBgC" hidden="yes" - description="The default page background color."> - <cocoa key="pageBackgroundColor"/> - </property> <property name="favorite colors" code="FavC" description="List of favorite colors."> <type type="RGBA color" list="yes"/> 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