Revision: 16278
          http://sourceforge.net/p/skim-app/code/16278
Author:   hofman
Date:     2026-05-10 17:24:16 +0000 (Sun, 10 May 2026)
Log Message:
-----------
update all utility panels from updateUtilityPaneels directly, only update 
selected color when changing color property

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

Modified: trunk/SKMainWindowController_Actions.m
===================================================================
--- trunk/SKMainWindowController_Actions.m      2026-05-10 17:06:59 UTC (rev 
16277)
+++ trunk/SKMainWindowController_Actions.m      2026-05-10 17:24:16 UTC (rev 
16278)
@@ -91,7 +91,6 @@
 #define SKShowToolbarInFullScreenKey @"SKShowToolbarInFullScreen"
 
 @interface SKMainWindowController (SKPrivateUI)
-- (void)updateLineInspector;
 - (void)updateNoteFilterPredicate;
 - (void)updateSnapshotFilterPredicate;
 @end
@@ -189,9 +188,9 @@
             case SKNoLineChangeAction:
                 break;
         }
+        // in case one property changes another, e.g. when adding a 
dashPattern the borderStyle can change
+        [[SKLineInspector sharedLineInspector] setAnnotationStyle:annotation];
         mwcFlags.updatingLine = 0;
-        // in case one property changes another, e.g. when adding a 
dashPattern the borderStyle can change
-        [self updateLineInspector];
     }
 }
 

Modified: trunk/SKMainWindowController_UI.m
===================================================================
--- trunk/SKMainWindowController_UI.m   2026-05-10 17:06:59 UTC (rev 16277)
+++ trunk/SKMainWindowController_UI.m   2026-05-10 17:24:16 UTC (rev 16278)
@@ -134,7 +134,6 @@
 @end
 
 @interface SKMainWindowController (UIPrivate)
-- (void)changeColorProperty:(id)sender;
 - (void)handleNoteViewFrameDidChangeNotification:(NSNotification 
*)notification;
 - (void)handleNoteViewDidEndLiveResizeNotification:(NSNotification 
*)notification;
 @end
@@ -145,68 +144,42 @@
 
 #pragma mark Utility panel updating
 
-- (NSButton *)newColorAccessoryButtonWithTitle:(NSString *)title {
-    NSButton *button = [[NSButton alloc] init];
-    [button setButtonType:NSSwitchButton];
-    [button setTitle:title];
-    [[button cell] setControlSize:NSControlSizeSmall];
-    [button setTarget:self];
-    [button setAction:@selector(changeColorProperty:)];
-    [button sizeToFit];
-    return button;
-}
-
-- (void)updateColorPanel {
+- (void)updateColorPanel:(id)sender{
     PDFAnnotation *annotation = [pdfView currentAnnotation];
     NSColor *color = nil;
-    NSView *accessoryView = nil;
     
-    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) {
+    if ([annotation hasInteriorColor] && [colorAccessoryView state] == 
NSControlStateValueOn)
         color = [(id)annotation interiorColor] ?: [NSColor clearColor];
-    } else if ([annotation isText] && [textColorAccessoryView state] == 
NSControlStateValueOn) {
+    else if ([annotation isText] && [textColorAccessoryView state] == 
NSControlStateValueOn)
         color = [(id)annotation fontColor] ?: [NSColor blackColor];
-    } else {
+    else
         color = [annotation color];
-    }
+    
     if (color) {
         mwcFlags.updatingColor = 1;
         [[NSColorPanel sharedColorPanel] setColor:color];
         mwcFlags.updatingColor = 0;
     }
-    
-    if ([[NSColorPanel sharedColorPanel] accessoryView] != accessoryView) {
-        [[NSColorPanel sharedColorPanel] setAccessoryView:nil];
-        [[NSColorPanel sharedColorPanel] setAccessoryView:accessoryView];
-    }
 }
 
-- (void)changeColorProperty:(id)sender{
-   [self updateColorPanel];
+- (NSButton *)newColorAccessoryButtonWithTitle:(NSString *)title {
+    NSButton *button = [[NSButton alloc] init];
+    [button setButtonType:NSSwitchButton];
+    [button setTitle:title];
+    [[button cell] setControlSize:NSControlSizeSmall];
+    [button setTarget:self];
+    [button setAction:@selector(updateColorPanel:)];
+    [button sizeToFit];
+    return button;
 }
 
-- (void)updateLineInspector {
-    PDFAnnotation *annotation = [pdfView currentAnnotation];
-    
-    if ([annotation hasBorder]) {
-        mwcFlags.updatingLine = 1;
-        [[SKLineInspector sharedLineInspector] setAnnotationStyle:annotation];
-        mwcFlags.updatingLine = 0;
-    }
-}
-
 - (void)updateUtilityPanels {
     if ([[self window] isMainWindow]) {
         PDFAnnotation *annotation = [pdfView currentAnnotation];
+        NSView *accessoryView = nil;
+        
         if ([annotation isSkimNote]) {
+            
             if ([annotation isText]) {
                 mwcFlags.updatingFont = 1;
                 [[NSFontManager sharedFontManager] setSelectedFont:[annotation 
font] isMultiple:NO];
@@ -214,13 +187,31 @@
                 mwcFlags.updatingFontAttributes = 1;
                 [[NSFontManager sharedFontManager] 
setSelectedAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[annotation 
fontColor], NSForegroundColorAttributeName, nil] isMultiple:NO];
                 mwcFlags.updatingFontAttributes = 0;
+                
+                if (textColorAccessoryView == nil)
+                    textColorAccessoryView = [self 
newColorAccessoryButtonWithTitle:NSLocalizedString(@"Text color", @"Check 
button title")];
+                accessoryView = textColorAccessoryView;
+                
+            } else if ([annotation hasBorder]) {
+                
+                mwcFlags.updatingLine = 1;
+                [[SKLineInspector sharedLineInspector] 
setAnnotationStyle:annotation];
+                mwcFlags.updatingLine = 0;
+                
+                if ([annotation hasInteriorColor]) {
+                    if (colorAccessoryView == nil)
+                        colorAccessoryView = [self 
newColorAccessoryButtonWithTitle:NSLocalizedString(@"Fill color", @"Check 
button title")];
+                    accessoryView = colorAccessoryView;
+                }
             }
             
-            [self updateColorPanel];
-            [self updateLineInspector];
+            [self updateColorPanel:nil];
             
-        } else if ([[NSColorPanel sharedColorPanel] accessoryView]) {
+        }
+        
+        if ([[NSColorPanel sharedColorPanel] accessoryView] != accessoryView) {
             [[NSColorPanel sharedColorPanel] setAccessoryView:nil];
+            [[NSColorPanel sharedColorPanel] setAccessoryView:accessoryView];
         }
     }
 }

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