Revision: 15065 http://sourceforge.net/p/skim-app/code/15065 Author: hofman Date: 2025-04-01 08:51:33 +0000 (Tue, 01 Apr 2025) Log Message: ----------- we don't need to unbind standard bindings
Modified Paths: -------------- trunk/SKFontWell.m Modified: trunk/SKFontWell.m =================================================================== --- trunk/SKFontWell.m 2025-03-31 16:24:48 UTC (rev 15064) +++ trunk/SKFontWell.m 2025-04-01 08:51:33 UTC (rev 15065) @@ -79,7 +79,7 @@ } - (Class)valueClassForBinding:(NSString *)binding { - if ([binding isEqualToString:TEXTCOLOR_KEY]) + if ([binding isEqualToString:NSTextColorBinding]) return [NSColor class]; else return [super valueClassForBinding:binding]; @@ -129,10 +129,10 @@ } - (void)dealloc { - SKENSURE_MAIN_THREAD( - [self unbind:FONTNAME_KEY]; - [self unbind:FONTSIZE_KEY]; - ); + if ([self infoForBinding:NSTextColorBinding]) + SKENSURE_MAIN_THREAD( + [self unbind:NSTextColorBinding]; + ); } - (BOOL)isOpaque{ return NO; } @@ -157,8 +157,8 @@ if ([self isActive]) { NSFont *font = [sender convertFont:[self font]]; [self setFont:font]; - [self propagateValue:[font fontName] forBinding:FONTNAME_KEY]; - [self propagateValue:[NSNumber numberWithDouble:[font pointSize]] forBinding:FONTSIZE_KEY]; + [self propagateValue:[font fontName] forBinding:NSFontNameBinding]; + [self propagateValue:[NSNumber numberWithDouble:[font pointSize]] forBinding:NSFontSizeBinding]; [self sendAction:[self action] to:[self target]]; } } @@ -167,7 +167,7 @@ if ([self isActive] && [self hasTextColor]) { NSColor *color = [[sender convertAttributes:@{NSForegroundColorAttributeName:[self textColor] ?: [NSColor blackColor]}] valueForKey:NSForegroundColorAttributeName]; [self setTextColor:color]; - [self propagateValue:color forBinding:TEXTCOLOR_KEY]; + [self propagateValue:color forBinding:NSTextColorBinding]; [self sendAction:[self action] to:[self target]]; } } @@ -236,7 +236,7 @@ - (void)setFont:(NSFont *)newFont { // updating the fontName or fontSize binding triggers setFont: from KVO // which can set a partially updated font as it uses both bindings to build the font - if ([updatedBinding isEqualToString:FONTNAME_KEY] || [updatedBinding isEqualToString:FONTSIZE_KEY]) + if ([updatedBinding isEqualToString:NSFontNameBinding] || [updatedBinding isEqualToString:NSFontSizeBinding]) return; BOOL didChange = [[self font] isEqual:newFont] == NO; [super setFont:newFont]; @@ -269,7 +269,7 @@ } - (void)setTextColor:(NSColor *)newTextColor { - if ([updatedBinding isEqualToString:TEXTCOLOR_KEY]) + if ([updatedBinding isEqualToString:NSTextColorBinding]) return; BOOL didChange = [[self textColor] isEqual:newTextColor] == NO; [[self cell] setTextColor:newTextColor]; @@ -344,13 +344,13 @@ if (droppedFont) { [self setFont:droppedFont]; - [self propagateValue:[droppedFont fontName] forBinding:FONTNAME_KEY]; - [self propagateValue:[NSNumber numberWithDouble:[droppedFont pointSize]] forBinding:FONTSIZE_KEY]; + [self propagateValue:[droppedFont fontName] forBinding:NSFontNameBinding]; + [self propagateValue:[NSNumber numberWithDouble:[droppedFont pointSize]] forBinding:NSFontSizeBinding]; [self sendAction:[self action] to:[self target]]; } if (droppedColor) { [self setTextColor:droppedColor]; - [self propagateValue:droppedColor forBinding:TEXTCOLOR_KEY]; + [self propagateValue:droppedColor forBinding:NSTextColorBinding]; [self sendAction:[self action] to:[self target]]; } 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