You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
(23) |
Apr
(254) |
May
(252) |
Jun
(209) |
Jul
(198) |
Aug
(192) |
Sep
(207) |
Oct
(120) |
Nov
(179) |
Dec
(52) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(48) |
Feb
(69) |
Mar
(129) |
Apr
(250) |
May
(113) |
Jun
(177) |
Jul
(228) |
Aug
(155) |
Sep
(218) |
Oct
(185) |
Nov
(109) |
Dec
(88) |
2009 |
Jan
(83) |
Feb
(39) |
Mar
(70) |
Apr
(47) |
May
(48) |
Jun
(67) |
Jul
(61) |
Aug
(97) |
Sep
(221) |
Oct
(141) |
Nov
(70) |
Dec
(61) |
2010 |
Jan
(45) |
Feb
(76) |
Mar
(178) |
Apr
(106) |
May
(57) |
Jun
(32) |
Jul
(64) |
Aug
(98) |
Sep
(96) |
Oct
(19) |
Nov
(34) |
Dec
(117) |
2011 |
Jan
(55) |
Feb
(48) |
Mar
(64) |
Apr
(21) |
May
(39) |
Jun
(53) |
Jul
(99) |
Aug
(56) |
Sep
(39) |
Oct
(26) |
Nov
(19) |
Dec
(69) |
2012 |
Jan
(17) |
Feb
(40) |
Mar
(17) |
Apr
|
May
(2) |
Jun
(8) |
Jul
(2) |
Aug
(10) |
Sep
(10) |
Oct
(38) |
Nov
(48) |
Dec
(70) |
2013 |
Jan
(43) |
Feb
(47) |
Mar
(39) |
Apr
(37) |
May
(25) |
Jun
(6) |
Jul
(20) |
Aug
(49) |
Sep
(33) |
Oct
(34) |
Nov
(75) |
Dec
(6) |
2014 |
Jan
(32) |
Feb
(10) |
Mar
(17) |
Apr
|
May
|
Jun
(26) |
Jul
(5) |
Aug
|
Sep
(4) |
Oct
(23) |
Nov
(80) |
Dec
(48) |
2015 |
Jan
(80) |
Feb
(50) |
Mar
(58) |
Apr
(20) |
May
(11) |
Jun
(16) |
Jul
(24) |
Aug
(27) |
Sep
(56) |
Oct
(30) |
Nov
(16) |
Dec
(6) |
2016 |
Jan
(31) |
Feb
(14) |
Mar
(23) |
Apr
(17) |
May
(40) |
Jun
(12) |
Jul
(17) |
Aug
(9) |
Sep
(32) |
Oct
(36) |
Nov
(23) |
Dec
(9) |
2017 |
Jan
(37) |
Feb
(23) |
Mar
(65) |
Apr
(22) |
May
(6) |
Jun
(3) |
Jul
|
Aug
|
Sep
(3) |
Oct
(22) |
Nov
(63) |
Dec
(71) |
2018 |
Jan
(83) |
Feb
(21) |
Mar
(35) |
Apr
(44) |
May
(14) |
Jun
(12) |
Jul
(8) |
Aug
(18) |
Sep
(10) |
Oct
(145) |
Nov
(144) |
Dec
(76) |
2019 |
Jan
(18) |
Feb
(28) |
Mar
(5) |
Apr
(208) |
May
(291) |
Jun
(158) |
Jul
(27) |
Aug
(8) |
Sep
(10) |
Oct
(83) |
Nov
(41) |
Dec
(31) |
2020 |
Jan
(16) |
Feb
(46) |
Mar
(100) |
Apr
(78) |
May
(69) |
Jun
(71) |
Jul
(28) |
Aug
(131) |
Sep
(176) |
Oct
(89) |
Nov
(147) |
Dec
(19) |
2021 |
Jan
(19) |
Feb
(25) |
Mar
(91) |
Apr
(98) |
May
(14) |
Jun
(44) |
Jul
(8) |
Aug
(3) |
Sep
(38) |
Oct
(57) |
Nov
(97) |
Dec
(74) |
2022 |
Jan
(89) |
Feb
(47) |
Mar
(15) |
Apr
(50) |
May
(54) |
Jun
(56) |
Jul
(80) |
Aug
(12) |
Sep
(11) |
Oct
(60) |
Nov
(48) |
Dec
(4) |
2023 |
Jan
(75) |
Feb
(49) |
Mar
(84) |
Apr
(24) |
May
(13) |
Jun
(74) |
Jul
(32) |
Aug
(66) |
Sep
(50) |
Oct
(38) |
Nov
(105) |
Dec
(181) |
2024 |
Jan
(21) |
Feb
(49) |
Mar
(77) |
Apr
(84) |
May
(20) |
Jun
(71) |
Jul
(53) |
Aug
(33) |
Sep
(54) |
Oct
(124) |
Nov
(151) |
Dec
(73) |
2025 |
Jan
(61) |
Feb
(17) |
Mar
(136) |
Apr
(72) |
May
(200) |
Jun
(238) |
Jul
(91) |
Aug
(8) |
Sep
|
Oct
|
Nov
|
Dec
|
From: <ho...@us...> - 2025-04-03 09:40:07
|
Revision: 15073 http://sourceforge.net/p/skim-app/code/15073 Author: hofman Date: 2025-04-03 09:39:48 +0000 (Thu, 03 Apr 2025) Log Message: ----------- declare draggingdestination, in header Modified Paths: -------------- trunk/SKColorSwatch.h trunk/SKFontWell.h trunk/SKFontWell.m trunk/SKLineWell.h Modified: trunk/SKColorSwatch.h =================================================================== --- trunk/SKColorSwatch.h 2025-04-03 09:31:54 UTC (rev 15072) +++ trunk/SKColorSwatch.h 2025-04-03 09:39:48 UTC (rev 15073) @@ -42,7 +42,7 @@ @class SKColorSwatchItemView; -@interface SKColorSwatch : NSControl <NSDraggingSource, NSAccessibilityGroup> { +@interface SKColorSwatch : NSControl <NSDraggingSource, NSDraggingDestination, NSAccessibilityGroup> { NSMutableArray<SKColorSwatchItemView *> *itemViews; NSControl *backgroundView; CGFloat bezelWidth; Modified: trunk/SKFontWell.h =================================================================== --- trunk/SKFontWell.h 2025-04-03 09:31:54 UTC (rev 15072) +++ trunk/SKFontWell.h 2025-04-03 09:39:48 UTC (rev 15073) @@ -40,7 +40,7 @@ NS_ASSUME_NONNULL_BEGIN -@interface SKFontWell : NSButton { +@interface SKFontWell : NSButton <NSDraggingSource, NSDraggingDestination> { id target; SEL action; NSString *updatedBinding; Modified: trunk/SKFontWell.m =================================================================== --- trunk/SKFontWell.m 2025-04-03 09:31:54 UTC (rev 15072) +++ trunk/SKFontWell.m 2025-04-03 09:39:48 UTC (rev 15073) @@ -56,7 +56,7 @@ #define TARGET_KEY @"target" -@interface SKFontWell () <NSDraggingSource, NSDraggingDestination> +@interface SKFontWell () - (void)changeActive:(id)sender; - (void)fontChanged; @end Modified: trunk/SKLineWell.h =================================================================== --- trunk/SKLineWell.h 2025-04-03 09:31:54 UTC (rev 15072) +++ trunk/SKLineWell.h 2025-04-03 09:39:48 UTC (rev 15073) @@ -56,7 +56,7 @@ SKLineWellDisplayStyleOval }; -@interface SKLineWell : NSControl <NSDraggingSource, NSAccessibilityButton> { +@interface SKLineWell : NSControl <NSDraggingSource, NSDraggingDestination, NSAccessibilityButton> { CGFloat lineWidth; PDFBorderStyle style; NSArray<NSNumber *> *dashPattern; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2025-04-03 09:32:12
|
Revision: 15072 http://sourceforge.net/p/skim-app/code/15072 Author: hofman Date: 2025-04-03 09:31:54 +0000 (Thu, 03 Apr 2025) Log Message: ----------- declare draggingsource and draggingdestination Modified Paths: -------------- trunk/SKFontWell.m Modified: trunk/SKFontWell.m =================================================================== --- trunk/SKFontWell.m 2025-04-02 16:37:46 UTC (rev 15071) +++ trunk/SKFontWell.m 2025-04-03 09:31:54 UTC (rev 15072) @@ -56,7 +56,7 @@ #define TARGET_KEY @"target" -@interface SKFontWell (SKPrivate) +@interface SKFontWell () <NSDraggingSource, NSDraggingDestination> - (void)changeActive:(id)sender; - (void)fontChanged; @end This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2025-04-02 16:38:03
|
Revision: 15071 http://sourceforge.net/p/skim-app/code/15071 Author: hofman Date: 2025-04-02 16:37:46 +0000 (Wed, 02 Apr 2025) Log Message: ----------- Support draging font from font well Modified Paths: -------------- trunk/SKFontWell.m Modified: trunk/SKFontWell.m =================================================================== --- trunk/SKFontWell.m 2025-04-02 14:34:27 UTC (rev 15070) +++ trunk/SKFontWell.m 2025-04-02 16:37:46 UTC (rev 15071) @@ -40,6 +40,7 @@ #import "NSGraphics_SKExtensions.h" #import "NSColor_SKExtensions.h" #import "NSObject_SKExtensions.h" +#import "NSImage_SKExtensions.h" #define SKNSFontPanelDescriptorsPboardType @"NSFontPanelDescriptorsPboardType" #define SKNSFontPanelFamiliesPboardType @"NSFontPanelFamiliesPboardType" @@ -257,6 +258,12 @@ } } +#pragma mark NSDraggingSource protocol + +- (NSDragOperation)draggingSession:(NSDraggingSession *)session sourceOperationMaskForDraggingContext:(NSDraggingContext)context { + return NSDragOperationGeneric; +} + #pragma mark NSDraggingDestination protocol - (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender { @@ -287,7 +294,7 @@ @try { if ([type isEqualToString:SKNSFontPanelDescriptorsPboardType]) { - NSData *data = [pboard dataForType:type]; + NSData *data = [pboard dataForType:type] ?: [pboard dataForType:CFBridgingRelease(UTTypeCreatePreferredIdentifierForTag(kUTTagClassNSPboardType, (__bridge CFStringRef)type, NULL))]; NSDictionary *dict = [data isKindOfClass:[NSData class]] ? [NSKeyedUnarchiver unarchiveObjectWithData:data] : nil; if ([dict isKindOfClass:[NSDictionary class]]) { NSArray *fontDescriptors = [dict objectForKey:SKNSFontCollectionFontDescriptors]; @@ -299,7 +306,7 @@ } } } else if ([type isEqualToString:SKNSFontPanelFamiliesPboardType]) { - NSArray *families = [pboard propertyListForType:type]; + NSArray *families = [pboard propertyListForType:type] ?: [pboard propertyListForType:CFBridgingRelease(UTTypeCreatePreferredIdentifierForTag(kUTTagClassNSPboardType, (__bridge CFStringRef)type, NULL))]; NSString *family = ([families isKindOfClass:[NSArray class]] && [families count]) ? [families objectAtIndex:0] : nil; if ([family isKindOfClass:[NSString class]]) droppedFont = [[NSFontManager sharedFontManager] convertFont:[self font] toFamily:family]; @@ -412,6 +419,28 @@ } } +- (BOOL)trackMouse:(NSEvent *)event inRect:(NSRect)cellFrame ofView:(NSView *)controlView untilMouseUp:(BOOL)flag { + BOOL didTrack = [super trackMouse:event inRect:cellFrame ofView:controlView untilMouseUp:flag]; + if (didTrack == NO) { + NSRect bounds = [controlView bounds]; + + NSImage *dragImage = [NSImage bitmapImageWithSize:bounds.size forView:controlView drawingHandler:^(NSRect rect){ + [self drawInteriorWithFrame:rect inView:controlView]; + }]; + + NSDictionary *dict = @{SKNSFontCollectionFontDescriptors: @[[[self font] fontDescriptor]], NSFontSizeAttribute: [NSNumber numberWithDouble:[[self font] pointSize]]}; + NSData *data = [NSKeyedArchiver archivedDataWithRootObject:dict]; + NSPasteboardItem *item = [[NSPasteboardItem alloc] init]; + [item setData:data forType:CFBridgingRelease(UTTypeCreatePreferredIdentifierForTag(kUTTagClassNSPboardType, (__bridge CFStringRef)SKNSFontPanelDescriptorsPboardType, NULL))]; + + NSDraggingItem *dragItem = [[NSDraggingItem alloc] initWithPasteboardWriter:item]; + [dragItem setDraggingFrame:bounds contents:dragImage]; + + [controlView beginDraggingSessionWithItems:@[dragItem] event:event source:(id<NSDraggingSource>)controlView]; + } + return YES; +} + - (NSString *)accessibilitySubrole { return @"AXFontWell"; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2025-04-02 14:34:45
|
Revision: 15070 http://sourceforge.net/p/skim-app/code/15070 Author: hofman Date: 2025-04-02 14:34:27 +0000 (Wed, 02 Apr 2025) Log Message: ----------- fix encoding of fontwellcell Modified Paths: -------------- trunk/SKFontWell.m Modified: trunk/SKFontWell.m =================================================================== --- trunk/SKFontWell.m 2025-04-02 09:35:29 UTC (rev 15069) +++ trunk/SKFontWell.m 2025-04-02 14:34:27 UTC (rev 15070) @@ -364,8 +364,8 @@ - (void)encodeWithCoder:(NSCoder *)coder { [super encodeWithCoder:coder]; - [coder encodeConditionalObject:textColor forKey:TEXTCOLOR_KEY]; - [coder encodeObject:textColor forKey:HASTEXTCOLOR_KEY]; + [coder encodeObject:textColor forKey:TEXTCOLOR_KEY]; + [coder encodeBool:hasTextColor forKey:HASTEXTCOLOR_KEY]; } - (void)drawBezelWithFrame:(NSRect)frame inView:(NSView *)controlView { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2025-04-02 09:35:46
|
Revision: 15069 http://sourceforge.net/p/skim-app/code/15069 Author: hofman Date: 2025-04-02 09:35:29 +0000 (Wed, 02 Apr 2025) Log Message: ----------- There is no need for fontName and fontSize properties. Modified Paths: -------------- trunk/SKFontWell.h trunk/SKFontWell.m Modified: trunk/SKFontWell.h =================================================================== --- trunk/SKFontWell.h 2025-04-01 09:05:47 UTC (rev 15068) +++ trunk/SKFontWell.h 2025-04-02 09:35:29 UTC (rev 15069) @@ -47,8 +47,6 @@ } @property (nonatomic, getter=isActive) BOOL active; -@property (nonatomic, copy) NSString *fontName; -@property (nonatomic) CGFloat fontSize; @property (nonatomic, nullable, copy) NSColor *textColor; @property (nonatomic) BOOL hasTextColor; Modified: trunk/SKFontWell.m =================================================================== --- trunk/SKFontWell.m 2025-04-01 09:05:47 UTC (rev 15068) +++ trunk/SKFontWell.m 2025-04-02 09:35:29 UTC (rev 15069) @@ -47,8 +47,6 @@ #define SKFontWellWillBecomeActiveNotification @"SKFontWellWillBecomeActiveNotification" -#define FONTNAME_KEY @"fontName" -#define FONTSIZE_KEY @"fontSize" #define TEXTCOLOR_KEY @"textColor" #define HASTEXTCOLOR_KEY @"hasTextColor" @@ -65,15 +63,8 @@ @implementation SKFontWell -@dynamic active, fontName, fontSize, textColor, hasTextColor; +@dynamic active, textColor, hasTextColor; -+ (NSSet *)keyPathsForValuesAffectingValueForKey:(NSString *)key { - NSSet *keyPaths = [super keyPathsForValuesAffectingValueForKey:key]; - if ([key isEqualToString:FONTNAME_KEY] || [key isEqualToString:FONTSIZE_KEY]) - keyPaths = [keyPaths setByAddingObjectsFromSet:[NSSet setWithObjects:FONT_KEY, nil]]; - return keyPaths; -} - + (Class)cellClass { return [SKFontWellCell class]; } @@ -206,7 +197,7 @@ - (void)fontChanged { if ([self isActive]) [[NSFontManager sharedFontManager] setSelectedFont:[self font] isMultiple:NO]; - [self setTitle:[NSString stringWithFormat:@"%@ %.0f", [[self font] displayName], [self fontSize]]]; + [self setTitle:[NSString stringWithFormat:@"%@ %.0f", [[self font] displayName], [[self font] pointSize]]]; [self setNeedsDisplay:YES]; NSAccessibilityPostNotification([self cell], NSAccessibilityValueChangedNotification); } @@ -242,26 +233,6 @@ [self fontChanged]; } -- (NSString *)fontName { - return [[self font] fontName]; -} - -- (void)setFontName:(NSString *)fontName { - NSFont *newFont = [NSFont fontWithName:fontName size:[[self font] pointSize]]; - if (newFont) - [self setFont:newFont]; -} - -- (CGFloat)fontSize { - return [[self font] pointSize]; -} - -- (void)setFontSize:(CGFloat)pointSize { - NSFont *newFont = [NSFont fontWithName:[[self font] fontName] size:pointSize]; - if (newFont) - [self setFont:newFont]; -} - - (NSColor *)textColor { return [[self cell] textColor]; } @@ -323,7 +294,7 @@ NSFontDescriptor *fontDescriptor = ([fontDescriptors isKindOfClass:[NSArray class]] && [fontDescriptors count]) ? [fontDescriptors objectAtIndex:0] : nil; if ([fontDescriptor isKindOfClass:[NSFontDescriptor class]]) { NSNumber *size = [[fontDescriptor fontAttributes] objectForKey:NSFontSizeAttribute] ?: [dict objectForKey:NSFontSizeAttribute]; - CGFloat fontSize = [size respondsToSelector:@selector(doubleValue)] ? [size doubleValue] : [self fontSize]; + CGFloat fontSize = [size respondsToSelector:@selector(doubleValue)] ? [size doubleValue] : [[self font] pointSize]; droppedFont = [NSFont fontWithDescriptor:fontDescriptor size:fontSize]; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2025-04-01 09:06:04
|
Revision: 15068 http://sourceforge.net/p/skim-app/code/15068 Author: hofman Date: 2025-04-01 09:05:47 +0000 (Tue, 01 Apr 2025) Log Message: ----------- modify format instead of type cast Modified Paths: -------------- trunk/SKFontWell.m Modified: trunk/SKFontWell.m =================================================================== --- trunk/SKFontWell.m 2025-04-01 09:00:29 UTC (rev 15067) +++ trunk/SKFontWell.m 2025-04-01 09:05:47 UTC (rev 15068) @@ -206,7 +206,7 @@ - (void)fontChanged { if ([self isActive]) [[NSFontManager sharedFontManager] setSelectedFont:[self font] isMultiple:NO]; - [self setTitle:[NSString stringWithFormat:@"%@ %li", [[self font] displayName], (long)[self fontSize]]]; + [self setTitle:[NSString stringWithFormat:@"%@ %.0f", [[self font] displayName], [self fontSize]]]; [self setNeedsDisplay:YES]; NSAccessibilityPostNotification([self cell], NSAccessibilityValueChangedNotification); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2025-04-01 09:00:46
|
Revision: 15067 http://sourceforge.net/p/skim-app/code/15067 Author: hofman Date: 2025-04-01 09:00:29 +0000 (Tue, 01 Apr 2025) Log Message: ----------- rename method Modified Paths: -------------- trunk/SKFontWell.m Modified: trunk/SKFontWell.m =================================================================== --- trunk/SKFontWell.m 2025-04-01 08:52:53 UTC (rev 15066) +++ trunk/SKFontWell.m 2025-04-01 09:00:29 UTC (rev 15067) @@ -140,7 +140,7 @@ [super viewWillMoveToWindow:newWindow]; } -- (void)fontPickerWillBecomeActive:(NSNotification *)notification { +- (void)fontWellWillBecomeActive:(NSNotification *)notification { id sender = [notification object]; if (sender != self && [self isActive]) { [self deactivate]; @@ -188,7 +188,7 @@ [fm setSelectedFont:[self font] isMultiple:NO]; [fm orderFrontFontPanel:self]; - [nc addObserver:self selector:@selector(fontPickerWillBecomeActive:) + [nc addObserver:self selector:@selector(fontWellWillBecomeActive:) name:SKFontWellWillBecomeActiveNotification object:nil]; [nc addObserver:self selector:@selector(fontPanelWillClose:) name:NSWindowWillCloseNotification object:[fm fontPanel:YES]]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2025-04-01 08:53:12
|
Revision: 15066 http://sourceforge.net/p/skim-app/code/15066 Author: hofman Date: 2025-04-01 08:52:53 +0000 (Tue, 01 Apr 2025) Log Message: ----------- single line Modified Paths: -------------- trunk/SKFontWell.m Modified: trunk/SKFontWell.m =================================================================== --- trunk/SKFontWell.m 2025-04-01 08:51:33 UTC (rev 15065) +++ trunk/SKFontWell.m 2025-04-01 08:52:53 UTC (rev 15066) @@ -130,9 +130,7 @@ - (void)dealloc { if ([self infoForBinding:NSTextColorBinding]) - SKENSURE_MAIN_THREAD( - [self unbind:NSTextColorBinding]; - ); + SKENSURE_MAIN_THREAD( [self unbind:NSTextColorBinding]; ); } - (BOOL)isOpaque{ return NO; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2025-04-01 08:51:50
|
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. |
From: <ho...@us...> - 2025-03-31 16:24:55
|
Revision: 15064 http://sourceforge.net/p/skim-app/code/15064 Author: hofman Date: 2025-03-31 16:24:48 +0000 (Mon, 31 Mar 2025) Log Message: ----------- No need to change the frame of the color swatch control Modified Paths: -------------- trunk/SKDisplayPreferences.m Modified: trunk/SKDisplayPreferences.m =================================================================== --- trunk/SKDisplayPreferences.m 2025-03-31 15:49:47 UTC (rev 15063) +++ trunk/SKDisplayPreferences.m 2025-03-31 16:24:48 UTC (rev 15064) @@ -86,9 +86,7 @@ NSValueTransformer *transformer = [NSValueTransformer valueTransformerForName:SKUnarchiveColorArrayTransformerName]; [colorSwatch bind:@"colors" toObject:[NSUserDefaultsController sharedUserDefaultsController] withKeyPath:[@"values." stringByAppendingString:SKSwatchColorsKey] options:@{NSValueTransformerBindingOption:transformer}]; - [colorSwatch sizeToFit]; [colorSwatch setSelects:YES]; - [colorSwatch setFrame:NSOffsetRect([colorSwatch frame], 0.0, 1.0)]; [colorSwatch addObserver:self forKeyPath:@"selectedColorIndex" options:0 context:&SKDisplayPreferencesColorSwatchObservationContext]; [colorSwatch addObserver:self forKeyPath:@"colors" options:0 context:&SKDisplayPreferencesColorSwatchObservationContext]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2025-03-31 15:49:48
|
Revision: 15063 http://sourceforge.net/p/skim-app/code/15063 Author: hofman Date: 2025-03-31 15:49:47 +0000 (Mon, 31 Mar 2025) Log Message: ----------- no need to seetNeedsDisplay twice Modified Paths: -------------- trunk/SKFontWell.m Modified: trunk/SKFontWell.m =================================================================== --- trunk/SKFontWell.m 2025-03-31 15:46:46 UTC (rev 15062) +++ trunk/SKFontWell.m 2025-03-31 15:49:47 UTC (rev 15063) @@ -153,10 +153,6 @@ [self deactivate]; } -- (void)dirty { - [self setNeedsDisplay:YES]; -} - - (void)changeFontFromFontManager:(id)sender { if ([self isActive]) { NSFont *font = [sender convertFont:[self font]]; @@ -200,7 +196,6 @@ name:NSWindowWillCloseNotification object:[fm fontPanel:YES]]; [self setState:NSControlStateValueOn]; - [self dirty]; [self setNeedsDisplay:YES]; } @@ -207,7 +202,6 @@ - (void)deactivate { [[NSNotificationCenter defaultCenter] removeObserver:self]; [self setState:NSControlStateValueOff]; - [self dirty]; [self setNeedsDisplay:YES]; } @@ -299,7 +293,6 @@ - (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender { if ([self isEnabled] && [sender draggingSource] != self && [[sender draggingPasteboard] availableTypeFromArray:[NSArray arrayWithObjects:SKNSFontPanelDescriptorsPboardType, SKNSFontPanelFamiliesPboardType, ([self hasTextColor] ? NSPasteboardTypeColor : nil), nil]]) { [[self cell] setHighlighted:YES]; - [self dirty]; [self setNeedsDisplay:YES]; return NSDragOperationGeneric; } else @@ -309,7 +302,6 @@ - (void)draggingExited:(id <NSDraggingInfo>)sender { if ([self isEnabled] && [sender draggingSource] != self && [[sender draggingPasteboard] availableTypeFromArray:[NSArray arrayWithObjects:SKNSFontPanelDescriptorsPboardType, SKNSFontPanelFamiliesPboardType, ([self hasTextColor] ? NSPasteboardTypeColor : nil), nil]]) { [[self cell] setHighlighted:NO]; - [self dirty]; [self setNeedsDisplay:YES]; } } @@ -363,7 +355,6 @@ } [[self cell] setHighlighted:NO]; - [self dirty]; [self setNeedsDisplay:YES]; return droppedFont != nil || droppedColor != nil; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2025-03-31 15:46:55
|
Revision: 15062 http://sourceforge.net/p/skim-app/code/15062 Author: hofman Date: 2025-03-31 15:46:46 +0000 (Mon, 31 Mar 2025) Log Message: ----------- default to userFont instead of systemFont Modified Paths: -------------- trunk/SKFontWell.m Modified: trunk/SKFontWell.m =================================================================== --- trunk/SKFontWell.m 2025-03-31 15:45:57 UTC (rev 15061) +++ trunk/SKFontWell.m 2025-03-31 15:46:46 UTC (rev 15062) @@ -87,7 +87,7 @@ - (void)commonInit { if ([self font] == nil) - [self setFont:[NSFont systemFontOfSize:0.0]]; + [self setFont:[NSFont userFontOfSize:0.0]]; [self fontChanged]; [[self cell] setShowsStateBy:NSNoCellMask]; [super setAction:@selector(changeActive:)]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2025-03-31 15:46:04
|
Revision: 15061 http://sourceforge.net/p/skim-app/code/15061 Author: hofman Date: 2025-03-31 15:45:57 +0000 (Mon, 31 Mar 2025) Log Message: ----------- no need to override valueClassForBinding for fontName and fontSize Modified Paths: -------------- trunk/SKFontWell.m Modified: trunk/SKFontWell.m =================================================================== --- trunk/SKFontWell.m 2025-03-31 15:39:25 UTC (rev 15060) +++ trunk/SKFontWell.m 2025-03-31 15:45:57 UTC (rev 15061) @@ -79,11 +79,7 @@ } - (Class)valueClassForBinding:(NSString *)binding { - if ([binding isEqualToString:FONTNAME_KEY]) - return [NSString class]; - else if ([binding isEqualToString:FONTNAME_KEY]) - return [NSNumber class]; - else if ([binding isEqualToString:TEXTCOLOR_KEY]) + if ([binding isEqualToString:TEXTCOLOR_KEY]) return [NSColor class]; else return [super valueClassForBinding:binding]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2025-03-31 15:39:39
|
Revision: 15060 http://sourceforge.net/p/skim-app/code/15060 Author: hofman Date: 2025-03-31 15:39:25 +0000 (Mon, 31 Mar 2025) Log Message: ----------- use convenience method to update binding Modified Paths: -------------- trunk/SKDragImageView.m Modified: trunk/SKDragImageView.m =================================================================== --- trunk/SKDragImageView.m 2025-03-31 15:24:55 UTC (rev 15059) +++ trunk/SKDragImageView.m 2025-03-31 15:39:25 UTC (rev 15060) @@ -41,6 +41,7 @@ #import "NSEvent_SKExtensions.h" #import "NSImage_SKExtensions.h" #import "NSBitmapImageRep_SKExtensions.h" +#import "NSObject_SKExtensions.h" @implementation SKDragImageView @@ -69,24 +70,7 @@ NSImage *image = [[NSImage alloc] initWithContentsOfURL:fileURL]; if (image) { [self setImage:image]; - NSDictionary *info = [self infoForBinding:NSValueBinding]; - if (info) { - id observedObject = [info objectForKey:NSObservedObjectKey]; - NSString *observedKeyPath = [info objectForKey:NSObservedKeyPathKey]; - if (observedObject && observedKeyPath) { - id value = image; - NSValueTransformer *valueTransformer = [[info objectForKey:NSOptionsKey] objectForKey:NSValueTransformerBindingOption]; - if (valueTransformer == nil || [valueTransformer isEqual:[NSNull null]]) { - NSString *transformerName = [[info objectForKey:NSOptionsKey] objectForKey:NSValueTransformerNameBindingOption]; - if (transformerName && [transformerName isEqual:[NSNull null]] == NO) - valueTransformer = [NSValueTransformer valueTransformerForName:transformerName]; - } - if (valueTransformer && [valueTransformer isEqual:[NSNull null]] == NO && - [[valueTransformer class] allowsReverseTransformation]) - value = [valueTransformer reverseTransformedValue:value]; - [observedObject setValue:value forKeyPath:observedKeyPath]; - } - } + [self propagateValue:image forBinding:NSValueBinding]; } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2025-03-31 15:25:02
|
Revision: 15059 http://sourceforge.net/p/skim-app/code/15059 Author: hofman Date: 2025-03-31 15:24:55 +0000 (Mon, 31 Mar 2025) Log Message: ----------- Don't override binding of fontName and fontSizein SKFontWell. Instead, ignore result of KVO while updating these bindings, to avoid resetting partially updated fonts. Modified Paths: -------------- trunk/SKFontWell.h trunk/SKFontWell.m Modified: trunk/SKFontWell.h =================================================================== --- trunk/SKFontWell.h 2025-03-31 14:52:02 UTC (rev 15058) +++ trunk/SKFontWell.h 2025-03-31 15:24:55 UTC (rev 15059) @@ -43,8 +43,7 @@ @interface SKFontWell : NSButton { id target; SEL action; - - NSMutableDictionary *bindingInfo; + NSString *updatedBinding; } @property (nonatomic, getter=isActive) BOOL active; Modified: trunk/SKFontWell.m =================================================================== --- trunk/SKFontWell.m 2025-03-31 14:52:02 UTC (rev 15058) +++ trunk/SKFontWell.m 2025-03-31 15:24:55 UTC (rev 15059) @@ -56,10 +56,7 @@ #define ACTION_KEY @"action" #define TARGET_KEY @"target" -static char SKFontWellFontNameObservationContext; -static char SKFontWellFontSizeObservationContext; - @interface SKFontWell (SKPrivate) - (void)changeActive:(id)sender; - (void)fontChanged; @@ -99,7 +96,6 @@ [[self cell] setShowsStateBy:NSNoCellMask]; [super setAction:@selector(changeActive:)]; [super setTarget:self]; - bindingInfo = [[NSMutableDictionary alloc] init]; [self registerForDraggedTypes:@[SKNSFontPanelDescriptorsPboardType, SKNSFontPanelFamiliesPboardType, NSPasteboardTypeColor]]; } @@ -227,6 +223,12 @@ NSAccessibilityPostNotification([self cell], NSAccessibilityValueChangedNotification); } +- (void)propagateValue:(id)value forBinding:(NSString *)binding { + updatedBinding = binding; + [super propagateValue:value forBinding:binding]; + updatedBinding = nil; +} + #pragma mark Accessors - (SEL)action { return action; } @@ -242,6 +244,10 @@ } - (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]) + return; BOOL didChange = [[self font] isEqual:newFont] == NO; [super setFont:newFont]; if (didChange) @@ -273,6 +279,8 @@ } - (void)setTextColor:(NSColor *)newTextColor { + if ([updatedBinding isEqualToString:TEXTCOLOR_KEY]) + return; BOOL didChange = [[self textColor] isEqual:newTextColor] == NO; [[self cell] setTextColor:newTextColor]; if (didChange) @@ -290,63 +298,6 @@ } } -#pragma mark Binding support - -- (void)bind:(NSString *)bindingName toObject:(id)observableController withKeyPath:(NSString *)keyPath options:(NSDictionary *)options { - if ([bindingName isEqualToString:FONTNAME_KEY] || [bindingName isEqualToString:FONTSIZE_KEY]) { - - if ([bindingInfo objectForKey:bindingName]) - [self unbind:bindingName]; - - NSDictionary *bindingsData = [NSDictionary dictionaryWithObjectsAndKeys:observableController, NSObservedObjectKey, [keyPath copy], NSObservedKeyPathKey, [options copy], NSOptionsKey, nil]; - [bindingInfo setObject:bindingsData forKey:bindingName]; - - void *context = NULL; - if ([bindingName isEqualToString:FONTNAME_KEY]) - context = &SKFontWellFontNameObservationContext; - else if ([bindingName isEqualToString:FONTSIZE_KEY]) - context = &SKFontWellFontSizeObservationContext; - - [observableController addObserver:self forKeyPath:keyPath options:NSKeyValueObservingOptionInitial context:context]; - } else { - [super bind:bindingName toObject:observableController withKeyPath:keyPath options:options]; - } - [self setNeedsDisplay:YES]; -} - -- (void)unbind:(NSString *)bindingName { - if ([bindingName isEqualToString:FONTNAME_KEY] || [bindingName isEqualToString:FONTSIZE_KEY]) { - - NSDictionary *info = [self infoForBinding:bindingName]; - [[info objectForKey:NSObservedObjectKey] removeObserver:self forKeyPath:[info objectForKey:NSObservedKeyPathKey] context:[bindingName isEqualToString:FONTNAME_KEY] ? &SKFontWellFontNameObservationContext : &SKFontWellFontSizeObservationContext]; - [bindingInfo removeObjectForKey:bindingName]; - } else { - [super unbind:bindingName]; - } - [self setNeedsDisplay:YES]; -} - -- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { - NSString *key = nil; - if (context == &SKFontWellFontNameObservationContext) - key = FONTNAME_KEY; - else if (context == &SKFontWellFontSizeObservationContext) - key = FONTSIZE_KEY; - - if (key) { - NSDictionary *info = [self infoForBinding:key]; - id value = [[info objectForKey:NSObservedObjectKey] valueForKeyPath:[info objectForKey:NSObservedKeyPathKey]]; - if (NSIsControllerMarker(value) == NO) - [self setValue:value forKey:key]; - } else { - [super observeValueForKeyPath:keyPath ofObject:object change:change context:context]; - } -} - -- (NSDictionary *)infoForBinding:(NSString *)bindingName { - return [bindingInfo objectForKey:bindingName] ?: [super infoForBinding:bindingName]; -} - #pragma mark NSDraggingDestination protocol - (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2025-03-31 14:52:04
|
Revision: 15058 http://sourceforge.net/p/skim-app/code/15058 Author: hofman Date: 2025-03-31 14:52:02 +0000 (Mon, 31 Mar 2025) Log Message: ----------- Convenience method to do KVC part of binding for custom cuntrols. Set the actual values we have set rather then retrieving it back using valueForKey, it may have been changed due to KVO. Modified Paths: -------------- trunk/NSObject_SKExtensions.h trunk/NSObject_SKExtensions.m trunk/SKColorSwatch.m trunk/SKFontWell.m trunk/SKLineWell.m Modified: trunk/NSObject_SKExtensions.h =================================================================== --- trunk/NSObject_SKExtensions.h 2025-03-30 14:59:44 UTC (rev 15057) +++ trunk/NSObject_SKExtensions.h 2025-03-31 14:52:02 UTC (rev 15058) @@ -50,6 +50,8 @@ - (nullable id)handleFormatScriptCommand:(NSScriptCommand *)command; +- (void)propagateValue:(nullable id)value forBinding:(NSString *)binding; + @end NS_ASSUME_NONNULL_END Modified: trunk/NSObject_SKExtensions.m =================================================================== --- trunk/NSObject_SKExtensions.m 2025-03-30 14:59:44 UTC (rev 15057) +++ trunk/NSObject_SKExtensions.m 2025-03-31 14:52:02 UTC (rev 15058) @@ -116,4 +116,22 @@ return text; } +- (void)propagateValue:(id)value forBinding:(NSString *)binding { + NSDictionary *info = [self infoForBinding:binding]; + id observedObject = [info objectForKey:NSObservedObjectKey]; + NSString *observedKeyPath = [info objectForKey:NSObservedKeyPathKey]; + if (observedObject && observedKeyPath) { + NSValueTransformer *valueTransformer = [[info objectForKey:NSOptionsKey] objectForKey:NSValueTransformerBindingOption]; + if (valueTransformer == nil || [valueTransformer isEqual:[NSNull null]]) { + NSString *transformerName = [[info objectForKey:NSOptionsKey] objectForKey:NSValueTransformerNameBindingOption]; + if (transformerName && [transformerName isEqual:[NSNull null]] == NO) + valueTransformer = [NSValueTransformer valueTransformerForName:transformerName]; + } + if (valueTransformer && [valueTransformer isEqual:[NSNull null]] == NO && + [[valueTransformer class] allowsReverseTransformation]) + value = [valueTransformer reverseTransformedValue:value]; + [observedObject setValue:value forKeyPath:observedKeyPath]; + } +} + @end Modified: trunk/SKColorSwatch.m =================================================================== --- trunk/SKColorSwatch.m 2025-03-30 14:59:44 UTC (rev 15057) +++ trunk/SKColorSwatch.m 2025-03-31 14:52:02 UTC (rev 15058) @@ -44,6 +44,7 @@ #import "NSView_SKExtensions.h" #import "NSGraphics_SKExtensions.h" #import "NSShadow_SKExtensions.h" +#import "NSObject_SKExtensions.h" NSString *SKColorSwatchOrWellWillActivateNotification = @"SKColorSwatchOrWellWillActivateNotification"; @@ -571,23 +572,7 @@ - (void)didChangeColors { [self didChangeValueForKey:COLORS_KEY]; - - NSDictionary *info = [self infoForBinding:COLORS_KEY]; - id observedObject = [info objectForKey:NSObservedObjectKey]; - NSString *observedKeyPath = [info objectForKey:NSObservedKeyPathKey]; - if (observedObject && observedKeyPath) { - id value = [self colors]; - NSValueTransformer *valueTransformer = [[info objectForKey:NSOptionsKey] objectForKey:NSValueTransformerBindingOption]; - if (valueTransformer == nil || [valueTransformer isEqual:[NSNull null]]) { - NSString *transformerName = [[info objectForKey:NSOptionsKey] objectForKey:NSValueTransformerNameBindingOption]; - if (transformerName && [transformerName isEqual:[NSNull null]] == NO) - valueTransformer = [NSValueTransformer valueTransformerForName:transformerName]; - } - if (valueTransformer && [valueTransformer isEqual:[NSNull null]] == NO && - [[valueTransformer class] allowsReverseTransformation]) - value = [valueTransformer reverseTransformedValue:value]; - [observedObject setValue:value forKeyPath:observedKeyPath]; - } + [self propagateValue:[self colors] forBinding:COLORS_KEY]; } - (void)_setColor:(NSColor *)color atIndex:(NSInteger)i { Modified: trunk/SKFontWell.m =================================================================== --- trunk/SKFontWell.m 2025-03-30 14:59:44 UTC (rev 15057) +++ trunk/SKFontWell.m 2025-03-31 14:52:02 UTC (rev 15058) @@ -39,6 +39,7 @@ #import "SKFontWell.h" #import "NSGraphics_SKExtensions.h" #import "NSColor_SKExtensions.h" +#import "NSObject_SKExtensions.h" #define SKNSFontPanelDescriptorsPboardType @"NSFontPanelDescriptorsPboardType" #define SKNSFontPanelFamiliesPboardType @"NSFontPanelFamiliesPboardType" @@ -164,28 +165,12 @@ [self setNeedsDisplay:YES]; } -- (void)notifyBinding:(NSString *)binding { - NSDictionary *info = [self infoForBinding:binding]; - if (info) { - id value = [self valueForKey:binding]; - NSValueTransformer *valueTransformer = [[info objectForKey:NSOptionsKey] objectForKey:NSValueTransformerBindingOption]; - if (valueTransformer == nil || [valueTransformer isEqual:[NSNull null]]) { - NSString *transformerName = [[info objectForKey:NSOptionsKey] objectForKey:NSValueTransformerNameBindingOption]; - if (transformerName && [transformerName isEqual:[NSNull null]] == NO) - valueTransformer = [NSValueTransformer valueTransformerForName:transformerName]; - } - if (valueTransformer && [valueTransformer isEqual:[NSNull null]] == NO && - [[valueTransformer class] allowsReverseTransformation]) - value = [valueTransformer reverseTransformedValue:value]; - [[info objectForKey:NSObservedObjectKey] setValue:value forKeyPath:[info objectForKey:NSObservedKeyPathKey]]; - } -} - - (void)changeFontFromFontManager:(id)sender { if ([self isActive]) { - [self setFont:[sender convertFont:[self font]]]; - [self notifyBinding:FONTNAME_KEY]; - [self notifyBinding:FONTSIZE_KEY]; + 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 sendAction:[self action] to:[self target]]; } } @@ -192,8 +177,9 @@ - (void)changeAttributesFromFontManager:(id)sender { if ([self isActive] && [self hasTextColor]) { - [self setTextColor:[[sender convertAttributes:@{NSForegroundColorAttributeName:[self textColor] ?: [NSColor blackColor]}] valueForKey:NSForegroundColorAttributeName]]; - [self notifyBinding:TEXTCOLOR_KEY]; + NSColor *color = [[sender convertAttributes:@{NSForegroundColorAttributeName:[self textColor] ?: [NSColor blackColor]}] valueForKey:NSForegroundColorAttributeName]; + [self setTextColor:color]; + [self propagateValue:color forBinding:TEXTCOLOR_KEY]; [self sendAction:[self action] to:[self target]]; } } @@ -419,13 +405,13 @@ if (droppedFont) { [self setFont:droppedFont]; - [self notifyBinding:FONTNAME_KEY]; - [self notifyBinding:FONTSIZE_KEY]; + [self propagateValue:[droppedFont fontName] forBinding:FONTNAME_KEY]; + [self propagateValue:[NSNumber numberWithDouble:[droppedFont pointSize]] forBinding:FONTSIZE_KEY]; [self sendAction:[self action] to:[self target]]; } if (droppedColor) { [self setTextColor:droppedColor]; - [self notifyBinding:TEXTCOLOR_KEY]; + [self propagateValue:droppedColor forBinding:TEXTCOLOR_KEY]; [self sendAction:[self action] to:[self target]]; } Modified: trunk/SKLineWell.m =================================================================== --- trunk/SKLineWell.m 2025-03-30 14:59:44 UTC (rev 15057) +++ trunk/SKLineWell.m 2025-03-31 14:52:02 UTC (rev 15058) @@ -41,6 +41,7 @@ #import "NSGraphics_SKExtensions.h" #import "NSBezierPath_SKExtensions.h" #import "NSView_SKExtensions.h" +#import "NSObject_SKExtensions.h" NSString *SKPasteboardTypeLineStyle = @"net.sourceforge.skim-app.pasteboard.line-style"; @@ -312,9 +313,9 @@ } - (void)takeValueForKey:(NSString *)key from:(id)object { - [self setValue:[object valueForKey:key] forKey:key]; - NSDictionary *info = [self infoForBinding:key]; - [[info objectForKey:NSObservedObjectKey] setValue:[self valueForKey:key] forKeyPath:[info objectForKey:NSObservedKeyPathKey]]; + id value = [object valueForKey:key]; + [self setValue:value forKey:key]; + [self propagateValue:value forBinding:key]; } - (void)mouseDown:(NSEvent *)theEvent { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2025-03-30 14:59:50
|
Revision: 15057 http://sourceforge.net/p/skim-app/code/15057 Author: hofman Date: 2025-03-30 14:59:44 +0000 (Sun, 30 Mar 2025) Log Message: ----------- fix checks Modified Paths: -------------- trunk/SKColorSwatch.m Modified: trunk/SKColorSwatch.m =================================================================== --- trunk/SKColorSwatch.m 2025-03-30 14:39:44 UTC (rev 15056) +++ trunk/SKColorSwatch.m 2025-03-30 14:59:44 UTC (rev 15057) @@ -602,7 +602,7 @@ - (void)setColor:(NSColor *)color atIndex:(NSInteger)i { [self _setColor:color atIndex:i]; - if (VALID_INDEX(i, <=) && selectedIndex == i) { + if (VALID_INDEX(i, <) && selectedIndex == i) { NSColorPanel *colorPanel = [NSColorPanel sharedColorPanel]; NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; [nc removeObserver:self name:NSColorPanelColorDidChangeNotification object:colorPanel]; @@ -612,7 +612,7 @@ } - (void)insertColor:(NSColor *)color atIndex:(NSInteger)i { - if (VALID_INDEX(i, <)) { + if (VALID_INDEX(i, <=)) { [self willChangeColors]; bezelWidth = [self contentWidth]; SKColorSwatchItemView *itemView = [[SKColorSwatchItemView alloc] initWithFrame:[self frameForCollapsedItemViewAtIndex:i]]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2025-03-30 14:39:56
|
Revision: 15056 http://sourceforge.net/p/skim-app/code/15056 Author: hofman Date: 2025-03-30 14:39:44 +0000 (Sun, 30 Mar 2025) Log Message: ----------- Fix some validation checks Modified Paths: -------------- trunk/SKColorSwatch.m Modified: trunk/SKColorSwatch.m =================================================================== --- trunk/SKColorSwatch.m 2025-03-30 09:31:38 UTC (rev 15055) +++ trunk/SKColorSwatch.m 2025-03-30 14:39:44 UTC (rev 15056) @@ -516,10 +516,12 @@ #pragma mark Modification +#define VALID_INDEX(i, op) (i >= 0 && i op (NSInteger)[itemViews count]) + - (void)selectColorAtIndex:(NSInteger)idx { if (idx == -1) { [self deactivate]; - } else if ([self selects] && idx != selectedIndex && [self isEnabled] && [[self window] isMainWindow]) { + } else if ([self selects] && VALID_INDEX(idx, <) && idx != selectedIndex && [self isEnabled] && [[self window] isMainWindow]) { NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; NSColorPanel *colorPanel = [NSColorPanel sharedColorPanel]; if (selectedIndex != -1) { @@ -548,8 +550,7 @@ NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; [nc removeObserver:self name:NSColorPanelColorDidChangeNotification object:[NSColorPanel sharedColorPanel]]; [nc removeObserver:self name:SKColorSwatchOrWellWillActivateNotification object:nil]; - if (selectedIndex != -1) - [[itemViews objectAtIndex:selectedIndex] setSelected:NO]; + [[itemViews objectAtIndex:selectedIndex] setSelected:NO]; [self willChangeValueForKey:SELECTEDCOLORINDEX_KEY]; selectedIndex = -1; [self didChangeValueForKey:SELECTEDCOLORINDEX_KEY]; @@ -589,10 +590,8 @@ } } -#define VALID_INDEX(i) (i >= 0 && i <= (NSInteger)[itemViews count]) - - (void)_setColor:(NSColor *)color atIndex:(NSInteger)i { - if (VALID_INDEX(i)) { + if (VALID_INDEX(i, <)) { [self willChangeColors]; SKColorSwatchItemView *itemView = [itemViews objectAtIndex:i]; [itemView setColor:color]; @@ -603,7 +602,7 @@ - (void)setColor:(NSColor *)color atIndex:(NSInteger)i { [self _setColor:color atIndex:i]; - if (VALID_INDEX(i) && selectedIndex == i) { + if (VALID_INDEX(i, <=) && selectedIndex == i) { NSColorPanel *colorPanel = [NSColorPanel sharedColorPanel]; NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; [nc removeObserver:self name:NSColorPanelColorDidChangeNotification object:colorPanel]; @@ -613,7 +612,7 @@ } - (void)insertColor:(NSColor *)color atIndex:(NSInteger)i { - if (VALID_INDEX(i)) { + if (VALID_INDEX(i, <)) { [self willChangeColors]; bezelWidth = [self contentWidth]; SKColorSwatchItemView *itemView = [[SKColorSwatchItemView alloc] initWithFrame:[self frameForCollapsedItemViewAtIndex:i]]; @@ -644,7 +643,7 @@ } - (void)removeColorAtIndex:(NSInteger)i { - if (VALID_INDEX(i)) { + if (VALID_INDEX(i, <) && [itemViews count] > 1) { if (selectedIndex == i) [self deactivate]; [self willChangeColors]; @@ -675,7 +674,7 @@ } - (void)moveColorAtIndex:(NSInteger)from toIndex:(NSInteger)to { - if (VALID_INDEX(from) && VALID_INDEX(from) && from != to) { + if (VALID_INDEX(from, <) && VALID_INDEX(to, <) && from != to) { [self willChangeColors]; SKColorSwatchItemView *itemView = [itemViews objectAtIndex:from]; [itemViews removeObjectAtIndex:from]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2025-03-30 09:31:45
|
Revision: 15055 http://sourceforge.net/p/skim-app/code/15055 Author: hofman Date: 2025-03-30 09:31:38 +0000 (Sun, 30 Mar 2025) Log Message: ----------- use local variable Modified Paths: -------------- trunk/SKColorSwatch.m Modified: trunk/SKColorSwatch.m =================================================================== --- trunk/SKColorSwatch.m 2025-03-30 09:22:26 UTC (rev 15054) +++ trunk/SKColorSwatch.m 2025-03-30 09:31:38 UTC (rev 15055) @@ -594,8 +594,9 @@ - (void)_setColor:(NSColor *)color atIndex:(NSInteger)i { if (VALID_INDEX(i)) { [self willChangeColors]; - [[itemViews objectAtIndex:i] setColor:color]; - NSAccessibilityPostNotification([itemViews objectAtIndex:i], NSAccessibilityValueChangedNotification); + SKColorSwatchItemView *itemView = [itemViews objectAtIndex:i]; + [itemView setColor:color]; + NSAccessibilityPostNotification(itemView, NSAccessibilityValueChangedNotification); [self didChangeColors]; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2025-03-30 09:22:34
|
Revision: 15054 http://sourceforge.net/p/skim-app/code/15054 Author: hofman Date: 2025-03-30 09:22:26 +0000 (Sun, 30 Mar 2025) Log Message: ----------- checkks on one line Modified Paths: -------------- trunk/SKColorSwatch.m Modified: trunk/SKColorSwatch.m =================================================================== --- trunk/SKColorSwatch.m 2025-03-30 09:21:59 UTC (rev 15053) +++ trunk/SKColorSwatch.m 2025-03-30 09:22:26 UTC (rev 15054) @@ -655,8 +655,7 @@ selectedIndex--; [self didChangeValueForKey:SELECTEDCOLORINDEX_KEY]; } - if (focusedIndex > i || - focusedIndex == (NSInteger)[itemViews count]) { + if (focusedIndex > i || focusedIndex == (NSInteger)[itemViews count]) { focusedIndex--; [self noteFocusRingMaskChanged]; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2025-03-30 09:22:01
|
Revision: 15053 http://sourceforge.net/p/skim-app/code/15053 Author: hofman Date: 2025-03-30 09:21:59 +0000 (Sun, 30 Mar 2025) Log Message: ----------- Fix check, array was already changed Modified Paths: -------------- trunk/SKColorSwatch.m Modified: trunk/SKColorSwatch.m =================================================================== --- trunk/SKColorSwatch.m 2025-03-30 09:10:20 UTC (rev 15052) +++ trunk/SKColorSwatch.m 2025-03-30 09:21:59 UTC (rev 15053) @@ -656,7 +656,7 @@ [self didChangeValueForKey:SELECTEDCOLORINDEX_KEY]; } if (focusedIndex > i || - focusedIndex == (NSInteger)[itemViews count] - 1) { + focusedIndex == (NSInteger)[itemViews count]) { focusedIndex--; [self noteFocusRingMaskChanged]; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2025-03-30 09:10:32
|
Revision: 15052 http://sourceforge.net/p/skim-app/code/15052 Author: hofman Date: 2025-03-30 09:10:20 +0000 (Sun, 30 Mar 2025) Log Message: ----------- macro for ecurring check Modified Paths: -------------- trunk/SKColorSwatch.m Modified: trunk/SKColorSwatch.m =================================================================== --- trunk/SKColorSwatch.m 2025-03-30 09:07:04 UTC (rev 15051) +++ trunk/SKColorSwatch.m 2025-03-30 09:10:20 UTC (rev 15052) @@ -589,8 +589,10 @@ } } +#define VALID_INDEX(i) (i >= 0 && i <= (NSInteger)[itemViews count]) + - (void)_setColor:(NSColor *)color atIndex:(NSInteger)i { - if (i >= 0 && i <= (NSInteger)[itemViews count]) { + if (VALID_INDEX(i)) { [self willChangeColors]; [[itemViews objectAtIndex:i] setColor:color]; NSAccessibilityPostNotification([itemViews objectAtIndex:i], NSAccessibilityValueChangedNotification); @@ -600,7 +602,7 @@ - (void)setColor:(NSColor *)color atIndex:(NSInteger)i { [self _setColor:color atIndex:i]; - if (i >= 0 && i < (NSInteger)[itemViews count] && selectedIndex == i) { + if (VALID_INDEX(i) && selectedIndex == i) { NSColorPanel *colorPanel = [NSColorPanel sharedColorPanel]; NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; [nc removeObserver:self name:NSColorPanelColorDidChangeNotification object:colorPanel]; @@ -610,7 +612,7 @@ } - (void)insertColor:(NSColor *)color atIndex:(NSInteger)i { - if (i >= 0 && i <= (NSInteger)[itemViews count]) { + if (VALID_INDEX(i)) { [self willChangeColors]; bezelWidth = [self contentWidth]; SKColorSwatchItemView *itemView = [[SKColorSwatchItemView alloc] initWithFrame:[self frameForCollapsedItemViewAtIndex:i]]; @@ -641,7 +643,7 @@ } - (void)removeColorAtIndex:(NSInteger)i { - if (i >= 0 && i < (NSInteger)[itemViews count]) { + if (VALID_INDEX(i)) { if (selectedIndex == i) [self deactivate]; [self willChangeColors]; @@ -673,7 +675,7 @@ } - (void)moveColorAtIndex:(NSInteger)from toIndex:(NSInteger)to { - if (from >= 0 && to >= 0 && from != to) { + if (VALID_INDEX(from) && VALID_INDEX(from) && from != to) { [self willChangeColors]; SKColorSwatchItemView *itemView = [itemViews objectAtIndex:from]; [itemViews removeObjectAtIndex:from]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2025-03-30 09:07:07
|
Revision: 15051 http://sourceforge.net/p/skim-app/code/15051 Author: hofman Date: 2025-03-30 09:07:04 +0000 (Sun, 30 Mar 2025) Log Message: ----------- Remove condition already implied by previous ones Modified Paths: -------------- trunk/SKColorSwatch.m Modified: trunk/SKColorSwatch.m =================================================================== --- trunk/SKColorSwatch.m 2025-03-30 09:03:40 UTC (rev 15050) +++ trunk/SKColorSwatch.m 2025-03-30 09:07:04 UTC (rev 15051) @@ -641,7 +641,7 @@ } - (void)removeColorAtIndex:(NSInteger)i { - if (i >= 0 && i < (NSInteger)[itemViews count] && [itemViews count] > 1) { + if (i >= 0 && i < (NSInteger)[itemViews count]) { if (selectedIndex == i) [self deactivate]; [self willChangeColors]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2025-03-30 09:03:41
|
Revision: 15050 http://sourceforge.net/p/skim-app/code/15050 Author: hofman Date: 2025-03-30 09:03:40 +0000 (Sun, 30 Mar 2025) Log Message: ----------- Update color in panel in method that may do it Modified Paths: -------------- trunk/SKColorSwatch.m Modified: trunk/SKColorSwatch.m =================================================================== --- trunk/SKColorSwatch.m 2025-03-29 22:38:53 UTC (rev 15049) +++ trunk/SKColorSwatch.m 2025-03-30 09:03:40 UTC (rev 15050) @@ -110,7 +110,7 @@ @property (nonatomic, readonly) CGFloat contentWidth; @property (nonatomic) CGFloat bezelWidth; - (NSRect)frameForItemViewAtIndex:(NSInteger)anIndex; -- (void)setColor:(NSColor *)color atIndex:(NSInteger)i updatePanel:(BOOL)updatePanel; +- (void)_setColor:(NSColor *)color atIndex:(NSInteger)i; @end @implementation SKColorSwatch @@ -337,7 +337,7 @@ - (void)handleColorPanelColorChanged:(NSNotification *)note { if (selectedIndex != -1) { NSColor *color = [[NSColorPanel sharedColorPanel] color]; - [self setColor:color atIndex:selectedIndex updatePanel:NO]; + [self _setColor:color atIndex:selectedIndex]; } } @@ -589,28 +589,28 @@ } } -- (void)setColor:(NSColor *)color atIndex:(NSInteger)i updatePanel:(BOOL)updatePanel { - if (color && i >= 0 && i < (NSInteger)[itemViews count]) { +- (void)_setColor:(NSColor *)color atIndex:(NSInteger)i { + if (i >= 0 && i <= (NSInteger)[itemViews count]) { [self willChangeColors]; [[itemViews objectAtIndex:i] setColor:color]; NSAccessibilityPostNotification([itemViews objectAtIndex:i], NSAccessibilityValueChangedNotification); [self didChangeColors]; - if (updatePanel) { - NSColorPanel *colorPanel = [NSColorPanel sharedColorPanel]; - NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; - [nc removeObserver:self name:NSColorPanelColorDidChangeNotification object:colorPanel]; - [colorPanel setColor:color]; - [nc addObserver:self selector:@selector(handleColorPanelColorChanged:) name:NSColorPanelColorDidChangeNotification object:colorPanel]; - } } } - (void)setColor:(NSColor *)color atIndex:(NSInteger)i { - [self setColor:color atIndex:i updatePanel:selectedIndex == i]; + [self _setColor:color atIndex:i]; + if (i >= 0 && i < (NSInteger)[itemViews count] && selectedIndex == i) { + NSColorPanel *colorPanel = [NSColorPanel sharedColorPanel]; + NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; + [nc removeObserver:self name:NSColorPanelColorDidChangeNotification object:colorPanel]; + [colorPanel setColor:color]; + [nc addObserver:self selector:@selector(handleColorPanelColorChanged:) name:NSColorPanelColorDidChangeNotification object:colorPanel]; + } } - (void)insertColor:(NSColor *)color atIndex:(NSInteger)i { - if (color && i >= 0 && i <= (NSInteger)[itemViews count]) { + if (i >= 0 && i <= (NSInteger)[itemViews count]) { [self willChangeColors]; bezelWidth = [self contentWidth]; SKColorSwatchItemView *itemView = [[SKColorSwatchItemView alloc] initWithFrame:[self frameForCollapsedItemViewAtIndex:i]]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ho...@us...> - 2025-03-29 22:38:55
|
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. |