Revision: 16276
          http://sourceforge.net/p/skim-app/code/16276
Author:   hofman
Date:     2026-05-10 16:56:22 +0000 (Sun, 10 May 2026)
Log Message:
-----------
check for main window before calling utility panel update methods, or it will 
be called only when main

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

Modified: trunk/SKMainWindowController_UI.m
===================================================================
--- trunk/SKMainWindowController_UI.m   2026-05-10 16:49:15 UTC (rev 16275)
+++ trunk/SKMainWindowController_UI.m   2026-05-10 16:56:22 UTC (rev 16276)
@@ -157,34 +157,27 @@
 }
 
 - (void)updateColorPanel {
-    if ([[self window] isMainWindow]) {
-        PDFAnnotation *annotation = [pdfView currentAnnotation];
-        NSColor *color = nil;
-        NSView *accessoryView = nil;
-        
-        if ([annotation isSkimNote]) {
-            if ([annotation hasInteriorColor]) {
-                if (colorAccessoryView == nil)
-                    colorAccessoryView = [self 
newColorAccessoryButtonWithTitle:NSLocalizedString(@"Fill color", @"Check 
button title")];
-                accessoryView = colorAccessoryView;
-            } else if ([annotation isText]) {
-                if (textColorAccessoryView == nil)
-                    textColorAccessoryView = [self 
newColorAccessoryButtonWithTitle:NSLocalizedString(@"Text color", @"Check 
button title")];
-                accessoryView = textColorAccessoryView;
-            }
-            if ([annotation hasInteriorColor] && [colorAccessoryView state] == 
NSControlStateValueOn) {
-                color = [(id)annotation interiorColor] ?: [NSColor clearColor];
-            } else if ([annotation isText] && [textColorAccessoryView state] 
== NSControlStateValueOn) {
-                color = [(id)annotation fontColor] ?: [NSColor blackColor];
-            } else {
-                color = [annotation color];
-            }
+    PDFAnnotation *annotation = [pdfView currentAnnotation];
+    NSColor *color = nil;
+    NSView *accessoryView = nil;
+    
+    if ([annotation isSkimNote]) {
+        if ([annotation hasInteriorColor]) {
+            if (colorAccessoryView == nil)
+                colorAccessoryView = [self 
newColorAccessoryButtonWithTitle:NSLocalizedString(@"Fill color", @"Check 
button title")];
+            accessoryView = colorAccessoryView;
+        } else if ([annotation isText]) {
+            if (textColorAccessoryView == nil)
+                textColorAccessoryView = [self 
newColorAccessoryButtonWithTitle:NSLocalizedString(@"Text color", @"Check 
button title")];
+            accessoryView = textColorAccessoryView;
         }
-        if ([[NSColorPanel sharedColorPanel] accessoryView] != accessoryView) {
-            [[NSColorPanel sharedColorPanel] setAccessoryView:nil];
-            [[NSColorPanel sharedColorPanel] setAccessoryView:accessoryView];
+        if ([annotation hasInteriorColor] && [colorAccessoryView state] == 
NSControlStateValueOn) {
+            color = [(id)annotation interiorColor] ?: [NSColor clearColor];
+        } else if ([annotation isText] && [textColorAccessoryView state] == 
NSControlStateValueOn) {
+            color = [(id)annotation fontColor] ?: [NSColor blackColor];
+        } else {
+            color = [annotation color];
         }
-        
         if (color) {
             mwcFlags.updatingColor = 1;
             [[NSColorPanel sharedColorPanel] setColor:color];
@@ -191,6 +184,10 @@
             mwcFlags.updatingColor = 0;
         }
     }
+    if ([[NSColorPanel sharedColorPanel] accessoryView] != accessoryView) {
+        [[NSColorPanel sharedColorPanel] setAccessoryView:nil];
+        [[NSColorPanel sharedColorPanel] setAccessoryView:accessoryView];
+    }
 }
 
 - (void)changeColorProperty:(id)sender{
@@ -200,7 +197,7 @@
 - (void)updateLineInspector {
     PDFAnnotation *annotation = [pdfView currentAnnotation];
     
-    if ([[self window] isMainWindow] && [annotation hasBorder]) {
+    if ([annotation hasBorder]) {
         mwcFlags.updatingLine = 1;
         [[SKLineInspector sharedLineInspector] setAnnotationStyle:annotation];
         mwcFlags.updatingLine = 0;
@@ -220,10 +217,10 @@
                 mwcFlags.updatingFontAttributes = 0;
             }
         }
+        
+        [self updateColorPanel];
+        [self updateLineInspector];
     }
-    
-    [self updateColorPanel];
-    [self updateLineInspector];
 }
 
 #pragma mark NSWindow delegate protocol

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