Revision: 12422 http://sourceforge.net/p/skim-app/code/12422 Author: hofman Date: 2021-09-28 23:44:14 +0000 (Tue, 28 Sep 2021) Log Message: ----------- Invert colors in page thumbnails when needed
Modified Paths: -------------- trunk/SKMainWindowController_UI.m trunk/SKThumbnailView.m Modified: trunk/SKMainWindowController_UI.m =================================================================== --- trunk/SKMainWindowController_UI.m 2021-09-28 17:04:57 UTC (rev 12421) +++ trunk/SKMainWindowController_UI.m 2021-09-28 23:44:14 UTC (rev 12422) @@ -90,6 +90,7 @@ #import "SKOverviewView.h" #import "NSView_SKExtensions.h" #import "SKThumbnailPageView.h" +#import "NSGraphics_SKExtensions.h" #define NOTES_KEY @"notes" #define SNAPSHOTS_KEY @"snapshots" @@ -439,6 +440,8 @@ NSTableCellView *view = [tv makeViewWithIdentifier:[tableColumn identifier] owner:self]; if ([[tableColumn identifier] isEqualToString:PAGE_COLUMNID]) [(SKThumbnailPageView *)[view textField] setMarked:(NSUInteger)row == markedPageIndex]; + else if ([[NSUserDefaults standardUserDefaults] boolForKey:SKInvertColorsInDarkModeKey]) + [[view imageView] setContentFilters:SKColorInvertFilters()]; return view; } else if ([tv isEqual:rightSideController.snapshotTableView] || [tv isEqual:leftSideController.findTableView]) { @@ -1902,6 +1905,12 @@ } [pdfView setBackgroundColor:backgroundColor]; [secondaryPdfView setBackgroundColor:backgroundColor]; + + if ([[NSUserDefaults standardUserDefaults] boolForKey:SKInvertColorsInDarkModeKey]) { + [leftSideController.thumbnailTableView enumerateAvailableRowViewsUsingBlock:^(NSTableRowView *rowView, NSInteger row){ + [[[rowView viewAtColumn:0] imageView] setContentFilters:SKColorInvertFilters()]; + }]; + } } - (void)handleApplicationWillTerminateNotification:(NSNotification *)notification { Modified: trunk/SKThumbnailView.m =================================================================== --- trunk/SKThumbnailView.m 2021-09-28 17:04:57 UTC (rev 12421) +++ trunk/SKThumbnailView.m 2021-09-28 23:44:14 UTC (rev 12422) @@ -46,6 +46,9 @@ #import "NSMenu_SKExtensions.h" #import <Quartz/Quartz.h> #import "PDFPage_SKExtensions.h" +#import "NSColor_SKExtensions.h" +#import "NSGraphics_SKExtensions.h" +#import "SKStringConstants.h" #define MARGIN 8.0 #define TEXT_MARGIN 4.0 @@ -75,6 +78,9 @@ [imageView setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable]; [self addSubview:imageView]; + if ([[NSUserDefaults standardUserDefaults] boolForKey:SKInvertColorsInDarkModeKey]) + [imageView setContentFilters:SKColorInvertFilters()]; + labelView = [[NSTextField alloc] init]; [labelView setBezeled:NO]; [labelView setBordered:NO]; @@ -401,6 +407,12 @@ [super viewDidMoveToWindow]; } +- (void)viewDidChangeEffectiveAppearance { + [super viewDidChangeEffectiveAppearance]; + if ([[NSUserDefaults standardUserDefaults] boolForKey:SKInvertColorsInDarkModeKey]) + [imageView setContentFilters:SKColorInvertFilters()]; +} + #pragma mark Event handling - (void)mouseDown:(NSEvent *)theEvent { 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