Revision: 15036
http://sourceforge.net/p/skim-app/code/15036
Author: hofman
Date: 2025-03-28 16:43:46 +0000 (Fri, 28 Mar 2025)
Log Message:
-----------
explicit KVO notifications instead of setter
Modified Paths:
--------------
trunk/SKColorSwatch.m
Modified: trunk/SKColorSwatch.m
===================================================================
--- trunk/SKColorSwatch.m 2025-03-28 16:27:11 UTC (rev 15035)
+++ trunk/SKColorSwatch.m 2025-03-28 16:43:46 UTC (rev 15036)
@@ -108,7 +108,6 @@
@end
@interface SKColorSwatch ()
-@property (nonatomic) NSInteger selectedColorIndex;
@property (nonatomic, readonly) CGFloat contentWidth;
@property (nonatomic) CGFloat bezelWidth;
- (NSRect)frameForItemViewAtIndex:(NSInteger)anIndex;
@@ -529,7 +528,9 @@
[[[NSApp keyWindow] contentView] deactivateColorWellSubcontrols];
if (selectedIndex != -1)
[[itemViews objectAtIndex:selectedIndex] setSelected:NO];
- [self setSelectedColorIndex:idx];
+ [self willChangeValueForKey:SELECTEDCOLORINDEX_KEY];
+ selectedIndex = idx;
+ [self didChangeValueForKey:SELECTEDCOLORINDEX_KEY];
[[itemViews objectAtIndex:selectedIndex] setSelected:YES];
[colorPanel setColor:[[itemViews objectAtIndex:selectedIndex] color]];
[colorPanel orderFront:nil];
@@ -544,7 +545,9 @@
[nc removeObserver:self
name:SKColorSwatchOrWellWillActivateNotification object:nil];
if (selectedIndex != -1)
[[itemViews objectAtIndex:selectedIndex] setSelected:NO];
- [self setSelectedColorIndex:-1];
+ [self willChangeValueForKey:SELECTEDCOLORINDEX_KEY];
+ selectedIndex = -1;
+ [self didChangeValueForKey:SELECTEDCOLORINDEX_KEY];
}
}
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