Revision: 15049
          http://sourceforge.net/p/skim-app/code/15049
Author:   hofman
Date:     2025-03-29 22:38:53 +0000 (Sat, 29 Mar 2025)
Log Message:
-----------
use local variable

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

Modified: trunk/SKColorSwatch.m
===================================================================
--- trunk/SKColorSwatch.m       2025-03-29 22:31:06 UTC (rev 15048)
+++ trunk/SKColorSwatch.m       2025-03-29 22:38:53 UTC (rev 15049)
@@ -110,7 +110,7 @@
 @property (nonatomic, readonly) CGFloat contentWidth;
 @property (nonatomic) CGFloat bezelWidth;
 - (NSRect)frameForItemViewAtIndex:(NSInteger)anIndex;
-- (void)setColor:(NSColor *)color atIndex:(NSInteger)i 
fromPanel:(BOOL)fromPanel;
+- (void)setColor:(NSColor *)color atIndex:(NSInteger)i 
updatePanel:(BOOL)updatePanel;
 @end
 
 @implementation SKColorSwatch
@@ -337,7 +337,7 @@
 - (void)handleColorPanelColorChanged:(NSNotification *)note {
     if (selectedIndex != -1) {
         NSColor *color = [[NSColorPanel sharedColorPanel] color];
-        [self setColor:color atIndex:selectedIndex fromPanel:YES];
+        [self setColor:color atIndex:selectedIndex updatePanel:NO];
     }
 }
 
@@ -527,7 +527,7 @@
         } else {
             [nc 
postNotificationName:SKColorSwatchOrWellWillActivateNotification object:self];
             [nc addObserver:self selector:@selector(deactivate:) 
name:SKColorSwatchOrWellWillActivateNotification object:nil];
-            [nc addObserver:self selector:@selector(deactivate:) 
name:NSWindowWillCloseNotification object:[NSColorPanel sharedColorPanel]];
+            [nc addObserver:self selector:@selector(deactivate:) 
name:NSWindowWillCloseNotification object:colorPanel];
         }
         [[[NSApp mainWindow] contentView] deactivateColorWellSubcontrols];
         [[[NSApp keyWindow] contentView] deactivateColorWellSubcontrols];
@@ -589,13 +589,13 @@
     }
 }
 
-- (void)setColor:(NSColor *)color atIndex:(NSInteger)i 
fromPanel:(BOOL)fromPanel {
+- (void)setColor:(NSColor *)color atIndex:(NSInteger)i 
updatePanel:(BOOL)updatePanel {
     if (color && i >= 0 && i < (NSInteger)[itemViews count]) {
         [self willChangeColors];
         [[itemViews objectAtIndex:i] setColor:color];
         NSAccessibilityPostNotification([itemViews objectAtIndex:i], 
NSAccessibilityValueChangedNotification);
         [self didChangeColors];
-        if (fromPanel == NO && selectedIndex == i) {
+        if (updatePanel) {
             NSColorPanel *colorPanel = [NSColorPanel sharedColorPanel];
             NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
             [nc removeObserver:self 
name:NSColorPanelColorDidChangeNotification object:colorPanel];
@@ -606,7 +606,7 @@
 }
 
 - (void)setColor:(NSColor *)color atIndex:(NSInteger)i {
-    [self setColor:color atIndex:i fromPanel:NO];
+    [self setColor:color atIndex:i updatePanel:selectedIndex == i];
 }
 
 - (void)insertColor:(NSColor *)color atIndex:(NSInteger)i {

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

Reply via email to