Revision: 14196
          http://sourceforge.net/p/skim-app/code/14196
Author:   hofman
Date:     2024-04-08 14:55:37 +0000 (Mon, 08 Apr 2024)
Log Message:
-----------
reorganize changing background color

Modified Paths:
--------------
    trunk/SKMainWindowController.m

Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m      2024-04-08 14:33:27 UTC (rev 14195)
+++ trunk/SKMainWindowController.m      2024-04-08 14:55:37 UTC (rev 14196)
@@ -2531,14 +2531,14 @@
         // A default value that we are observing has changed
         NSString *key = [keyPath substringFromIndex:7];
         if ([key isEqualToString:SKBackgroundColorKey] || [key 
isEqualToString:SKDarkBackgroundColorKey]) {
-            if ([self interactionMode] == SKNormalMode) {
-                NSColor *color = [PDFView defaultBackgroundColor];
-                [pdfView setBackgroundColor:color];
-                [secondaryPdfView setBackgroundColor:color];
-            } else if ([self interactionMode] == SKFullScreenMode) {
-                NSColor *color = [PDFView defaultFullScreenBackgroundColor];
-                [pdfView setBackgroundColor:color];
-                [secondaryPdfView setBackgroundColor:color];
+            NSColor *backgroundColor = nil;
+            if (interactionMode == SKNormalMode)
+                backgroundColor = [PDFView defaultBackgroundColor];
+            else if (interactionMode == SKFullScreenMode)
+                backgroundColor = [PDFView defaultFullScreenBackgroundColor];
+            if (backgroundColor) {
+                [pdfView setBackgroundColor:backgroundColor];
+                [secondaryPdfView setBackgroundColor:backgroundColor];
             }
         } else if ([key isEqualToString:SKFullScreenBackgroundColorKey] || 
[key isEqualToString:SKDarkFullScreenBackgroundColorKey]) {
             if ([self interactionMode] == SKFullScreenMode) {
@@ -2566,18 +2566,14 @@
     } else if (context == &SKMainWindowAppObservationContext) {
         
         NSColor *backgroundColor = nil;
-        switch (interactionMode) {
-            case SKNormalMode:
-                backgroundColor = [PDFView defaultBackgroundColor];
-                break;
-            case SKFullScreenMode:
-                backgroundColor = [PDFView defaultFullScreenBackgroundColor];
-                break;
-            default:
-                return;
+        if (interactionMode == SKNormalMode)
+            backgroundColor = [PDFView defaultBackgroundColor];
+        else if (interactionMode == SKFullScreenMode)
+            backgroundColor = [PDFView defaultFullScreenBackgroundColor];
+        if (backgroundColor) {
+            [pdfView setBackgroundColor:backgroundColor];
+            [secondaryPdfView setBackgroundColor:backgroundColor];
         }
-        [pdfView setBackgroundColor:backgroundColor];
-        [secondaryPdfView setBackgroundColor:backgroundColor];
         
     } else if (context == &SKMainWindowContentLayoutObservationContext) {
         

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