Revision: 29182
          http://sourceforge.net/p/bibdesk/svn/29182
Author:   hofman
Date:     2025-04-24 08:33:41 +0000 (Thu, 24 Apr 2025)
Log Message:
-----------
Always set highlight style of highlight view for consistency. Do some cleanup 
of views in initWithCoder and dealloc.

Modified Paths:
--------------
    trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m

Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m
===================================================================
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m      2025-04-24 
08:25:52 UTC (rev 29181)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m      2025-04-24 
08:33:41 UTC (rev 29182)
@@ -372,10 +372,10 @@
     
     if (_highlightView == nil) {
         _highlightView = [[FVHighlightView alloc] initWithFrame:frame];
-        [_highlightView setHighlightStyleFromBackgroundColor:[_backgroundView 
backgroundColor]];
         [_highlightView setAutoresizingMask:NSViewWidthSizable | 
NSViewHeightSizable];
         [self addSubview:_highlightView];
     }
+    [_highlightView setHighlightStyleFromBackgroundColor:[_backgroundView 
backgroundColor]];
     
     if (_contentView == nil) {
         _contentView = [[FVDisplayView alloc] initWithFrame:frame];
@@ -5132,41 +5132,19 @@
 @synthesize highlightRects=_highlightRects;
 @synthesize highlightStyle=_highlightStyle;
 
-- (void)_updateMaskImage {
-    if ([[self subviews] count]) {
-        NSImage *image = nil;
-        NSRect bounds = [self bounds];
-        if (NSIsEmptyRect(bounds) == NO) {
-            image = [[NSImage alloc] initWithSize:bounds.size];
-            if ([_highlightRects count]) {
-                [image lockFocusFlipped:YES];
-                [[NSColor blackColor] setFill];
-                for (NSValue *value in _highlightRects) {
-                    NSRect highlightRect = [value rectValue];
-                    [[NSBezierPath bezierPathWithRoundedRect:highlightRect 
xRadius:6.0 yRadius:6.0] fill];
-                }
-                [image unlockFocus];
-            }
-            [image setTemplate:YES];
-        }
-        [[[self subviews] objectAtIndex:0] setValue:image forKey:@"maskImage"];
-    }
-}
-
 - (id)initWithCoder:(NSCoder *)coder
 {
     self = [super initWithCoder:coder];
     if (self) {
-        _highlightStyle = [coder decodeIntegerForKey:@"highlightStyle"];
-        [self _updateMaskImage];
+        if ([[self subviews] count])
+            [[[self subviews] objectAtIndex:0] removeFromSuperview];
     }
     return self;
 }
 
-- (void)encodeWithCoder:(NSCoder *)coder
-{
-    [super encodeWithCoder:coder];
-    [coder encodeInteger:_highlightStyle forKey:@"highlightStyle"];
+- (void)dealloc {
+    CGLayerRelease(_layer);
+    _layer = NULL;
 }
 
 - (BOOL)isFlipped { return YES; }
@@ -5182,6 +5160,27 @@
     _layer = NULL;
 }
 
+- (void)_updateMaskImage {
+    if ([[self subviews] count]) {
+        NSImage *image = nil;
+        NSRect bounds = [self bounds];
+        if (NSIsEmptyRect(bounds) == NO) {
+            image = [[NSImage alloc] initWithSize:bounds.size];
+            if ([_highlightRects count]) {
+                [image lockFocusFlipped:YES];
+                [[NSColor blackColor] setFill];
+                for (NSValue *value in _highlightRects) {
+                    NSRect highlightRect = [value rectValue];
+                    [[NSBezierPath bezierPathWithRoundedRect:highlightRect 
xRadius:6.0 yRadius:6.0] fill];
+                }
+                [image unlockFocus];
+            }
+            [image setTemplate:YES];
+        }
+        [[[self subviews] objectAtIndex:0] setValue:image forKey:@"maskImage"];
+    }
+}
+
 - (void)setHighlightRects:(NSArray *)highlightRects
 {
     _highlightRects = [highlightRects copy];
@@ -5331,6 +5330,15 @@
 
 @synthesize delegate=_delegate;
 
+- (id)initWithCoder:(NSCoder *)coder {
+    self = [super initWithCoder:coder];
+    if (self) {
+        for (NSView *view in [[self subviews] copy])
+            [view removeFromSuperview];
+    }
+    return self;
+}
+
 - (BOOL)isFlipped { return YES; }
 
 - (NSView *)hitTest:(NSPoint)point { return nil; }

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

Reply via email to