Revision: 26174 http://sourceforge.net/p/bibdesk/svn/26174 Author: hofman Date: 2021-06-08 16:05:11 +0000 (Tue, 08 Jun 2021) Log Message: ----------- Declare view and cell generically
Modified Paths: -------------- trunk/bibdesk/BDSKComplexStringEditor.h trunk/bibdesk/BDSKComplexStringEditor.m Modified: trunk/bibdesk/BDSKComplexStringEditor.h =================================================================== --- trunk/bibdesk/BDSKComplexStringEditor.h 2021-06-08 15:06:59 UTC (rev 26173) +++ trunk/bibdesk/BDSKComplexStringEditor.h 2021-06-08 16:05:11 UTC (rev 26174) @@ -45,7 +45,7 @@ NSTextField *expandedValueTextField; BDSKBackgroundView *backgroundView; BDSKMacroResolver *macroResolver; - NSControl *control; + NSView *control; NSInteger row; NSInteger column; } @@ -52,7 +52,7 @@ - (id)initWithMacroResolver:(BDSKMacroResolver *)aMacroResolver; -- (void)attachToCell:(NSTextFieldCell *)cell; +- (void)attachToCell:(NSCell *)cell; - (void)remove; Modified: trunk/bibdesk/BDSKComplexStringEditor.m =================================================================== --- trunk/bibdesk/BDSKComplexStringEditor.m 2021-06-08 15:06:59 UTC (rev 26173) +++ trunk/bibdesk/BDSKComplexStringEditor.m 2021-06-08 16:05:11 UTC (rev 26174) @@ -78,11 +78,11 @@ [super dealloc]; } -- (void)attachToCell:(NSTextFieldCell *)cell { +- (void)attachToCell:(NSCell *)cell { if ([self isAttached]) return; // we are already busy editing - control = [(NSControl *)[cell controlView] retain]; + control = [[cell controlView] retain]; row = -1; column = -1; @@ -105,7 +105,7 @@ // track changes in the text, the frame and the window's key status of the control NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; - NSView *contentView = (NSView *)[[control enclosingScrollView] contentView] ?: (NSView *)control; + NSView *contentView = [[control enclosingScrollView] contentView]; NSWindow *controlWindow = [control window]; [nc addObserver:self selector:@selector(controlTextDidChange:) @@ -117,24 +117,20 @@ object:control]; // observe future changes in the frame and the key status of the window // if the target tableView has a scrollview, we should observe its content view, or we won't notice scrolling + if (contentView) + [nc addObserver:self + selector:@selector(controlFrameDidChange:) + name:NSViewBoundsDidChangeNotification + object:contentView]; [nc addObserver:self selector:@selector(controlFrameDidChange:) name:NSViewFrameDidChangeNotification - object:contentView]; - [nc addObserver:self - selector:@selector(controlFrameDidChange:) - name:NSViewBoundsDidChangeNotification - object:contentView]; + object:control]; if ([control isKindOfClass:[NSTableView class]]) [nc addObserver:self selector:@selector(controlFrameDidChange:) name:NSTableViewColumnDidResizeNotification object:control]; - else if (contentView != control) - [nc addObserver:self - selector:@selector(controlFrameDidChange:) - name:NSViewFrameDidChangeNotification - object:control]; if (isEnabled) { [nc addObserver:self selector:@selector(controlWindowDidChangeKey:) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. _______________________________________________ Bibdesk-commit mailing list Bibdesk-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bibdesk-commit