Revision: 28786
http://sourceforge.net/p/bibdesk/svn/28786
Author: hofman
Date: 2024-02-21 10:05:50 +0000 (Wed, 21 Feb 2024)
Log Message:
-----------
Set FVContentView delegate in initializer. Always rebuild subviews of fileview
in initWithoder:.
Modified Paths:
--------------
trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m
Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m
===================================================================
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m 2024-02-21
09:53:42 UTC (rev 28785)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m 2024-02-21
10:05:50 UTC (rev 28786)
@@ -157,7 +157,7 @@
@interface FVContentView : NSView {
__weak id<FVContentViewDelegate> _delegate;
}
-@property (nonatomic, weak) id<FVContentViewDelegate> delegate;
+- (id)initWithFrame:(NSRect)frameRect
delegate:(id<FVContentViewDelegate>)delegate;
@end
#pragma mark -
@@ -334,12 +334,9 @@
+ (BOOL)accessInstanceVariablesDirectly { return NO; }
- (void)_commonInit {
- if (_contentView == nil) {
- _contentView = [[FVContentView alloc] initWithFrame:[self bounds]];
- [_contentView setAutoresizingMask:NSViewWidthSizable |
NSViewHeightSizable];
- [self addSubview:_contentView];
- }
- [(FVContentView *)_contentView setDelegate:self];
+ _contentView = [[FVContentView alloc] initWithFrame:[self bounds]
delegate:self];
+ [_contentView setAutoresizingMask:NSViewWidthSizable |
NSViewHeightSizable];
+ [self addSubview:_contentView];
// Icons keyed by URL; may contain icons that are no longer displayed.
Keeping this as primary storage means that
// rearranging/reloading is relatively cheap, since we don't recreate all
FVIcon instances every time -reload is called.
@@ -464,12 +461,8 @@
- (id)initWithCoder:(NSCoder *)coder {
self = [super initWithCoder:coder];
if (self) {
- for (NSView *view in [self subviews]) {
- if ([view isMemberOfClass:[FVContentView self]]) {
- _contentView = view;
- break;
- }
- }
+ for (NSView *view in [[self subviews] copy])
+ [view removeFromSuperview];
[self _commonInit];
}
return self;
@@ -2840,8 +2833,7 @@
}
if (_dropHighlightView == nil) {
- _dropHighlightView = [[FVDropHighlightView alloc]
initWithFrame:[_contentView bounds]];
- [_dropHighlightView setDelegate:self];
+ _dropHighlightView = [[FVDropHighlightView alloc]
initWithFrame:[_contentView bounds] delegate:self];
[_contentView addSubview:_dropHighlightView];
}
[_dropHighlightView setDropIndex:dropIndex];
@@ -5037,7 +5029,13 @@
@implementation FVContentView
-@synthesize delegate=_delegate;
+- (id)initWithFrame:(NSRect)frameRect
delegate:(id<FVContentViewDelegate>)delegate {
+ self = [self initWithFrame:frameRect];
+ if (self) {
+ _delegate = delegate;
+ }
+ return self;
+}
- (BOOL)isFlipped { return YES; }
@@ -5055,7 +5053,7 @@
}
- (void)drawRect:(NSRect)dirtyRect {
- [[self delegate] drawRect:dirtyRect inView:self];
+ [_delegate drawRect:dirtyRect inView:self];
}
@end
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit