Revision: 28658
          http://sourceforge.net/p/bibdesk/svn/28658
Author:   hofman
Date:     2024-01-23 22:30:22 +0000 (Tue, 23 Jan 2024)
Log Message:
-----------
No custom initializer for arrow button classes. Set diection when creating as 
property.

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

Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVArrowButtonCell.h
===================================================================
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVArrowButtonCell.h       
2024-01-23 17:45:32 UTC (rev 28657)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVArrowButtonCell.h       
2024-01-23 22:30:22 UTC (rev 28658)
@@ -45,11 +45,19 @@
     FVArrowLeft  = 1
 };
 
-@interface FVArrowButton : NSButton {
-}
+/** @internal @brief Circular arrow button.
+ 
+ FVArrowButton is a circle with an arrow inside, used as a page change button. 
 Modeled after the page change button that Finder shows for PDF files on 10.5 
in column mode preview.  */
+@interface FVArrowButton : NSButton
 
-- (id)initWithArrowDirection:(FVArrowDirection)anArrowDirection;
+/** The arrow direction.
+ 
+ Cover method for the cell's property. Calls setNeedsDisplay:. */
+@property (nonatomic) FVArrowDirection arrowDirection;
 
+/** The arrow direction.
+ 
+ Cover method for the cell's property. This is animatable. Calls 
setNeedsDisplay:. */
 @property (nonatomic) CGFloat arrowAlpha;
 
 @end
@@ -62,21 +70,14 @@
     CGFloat _arrowAlpha;
 }
 
-/** Designated initializer.
+/** The arrow direction.
  
- @param anArrowDirection Whether the arrow points left or right.
- @return An initialized cell. */
-- (id)initWithArrowDirection:(FVArrowDirection)anArrowDirection;
+ Determines which way the arrow points. */
+@property (nonatomic) FVArrowDirection arrowDirection;
 
-/** @brief Draw with alpha blending.
+/** The arrow alpha.
  
- Draws the cell in a view with transparency; useful for animating.
- 
- @param frame Passed to drawWithFrame:inView:
- @param controlView Passed to drawWithFrame:inView:
- @param alpha 1.0 for opaque, 0.0 for transparent. */
-- (void)drawWithFrame:(NSRect)frame inView:(NSView *)controlView 
alpha:(CGFloat)alpha;
-
+ Determines an overall alpha when drawing. */
 @property (nonatomic) CGFloat arrowAlpha;
 
 @end

Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVArrowButtonCell.m
===================================================================
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVArrowButtonCell.m       
2024-01-23 17:45:32 UTC (rev 28657)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVArrowButtonCell.m       
2024-01-23 22:30:22 UTC (rev 28658)
@@ -47,7 +47,7 @@
 
 @implementation FVArrowButton
 
-@dynamic arrowAlpha;
+@dynamic arrowDirection, arrowAlpha;
 
 + (id)defaultAnimationForKey:(NSAnimatablePropertyKey)key {
     if ([key isEqualToString:@"arrowAlpha"])
@@ -57,14 +57,14 @@
 
 + (Class)cellClass { return [FVArrowButtonCell self]; }
 
-- (id)initWithArrowDirection:(FVArrowDirection)anArrowDirection {
-    self = [super initWithFrame:NSZeroRect];
-    if (self) {
-        [self setCell:[[FVArrowButtonCell alloc] 
initWithArrowDirection:anArrowDirection]];
-    }
-    return self;
+- (FVArrowDirection)arrowDirection {
+    return [(FVArrowButtonCell *)[self cell] arrowDirection];
 }
 
+- (void)setArrowDirection:(FVArrowDirection)arrowDirection {
+    [(FVArrowButtonCell *)[self cell] setArrowDirection:arrowDirection];
+}
+
 - (CGFloat)arrowAlpha {
     return [(FVArrowButtonCell *)[self cell] arrowAlpha];
 }
@@ -78,14 +78,25 @@
 
 @implementation FVArrowButtonCell
 
+@synthesize arrowDirection=_arrowDirection;
 @synthesize arrowAlpha=_arrowAlpha;
 
-- (id)initTextCell:(NSString *)aString {
-    return [self initWithArrowDirection:FVArrowRight];
+- (id)initTextCell:(NSString *)string {
+    self = [super initTextCell:string];
+    if (self) {
+        [self setHighlightsBy:NSNoCellMask];
+        [self setImagePosition:NSImageOnly];
+        [self setBezelStyle:NSRegularSquareBezelStyle];
+        [self setBordered:NO];
+        [self setContinuous:YES];
+        _arrowDirection = FVArrowRight;
+        _arrowAlpha = 1.0;
+    }
+    return self;
 }
 
-- (id)initWithArrowDirection:(FVArrowDirection)anArrowDirection {
-    self = [super initImageCell:nil];
+- (id)initImageCell:(NSImage *)image {
+    self = [super initImageCell:image];
     if (self) {
         [self setHighlightsBy:NSNoCellMask];
         [self setImagePosition:NSImageOnly];
@@ -92,7 +103,7 @@
         [self setBezelStyle:NSRegularSquareBezelStyle];
         [self setBordered:NO];
         [self setContinuous:YES];
-        _arrowDirection = anArrowDirection;
+        _arrowDirection = FVArrowRight;
         _arrowAlpha = 1.0;
     }
     return self;
@@ -124,11 +135,6 @@
 
 - (void)drawWithFrame:(NSRect)frame inView:(NSView *)controlView;
 {
-    [self drawWithFrame:frame inView:controlView alpha:_arrowAlpha];
-}
-
-- (void)drawWithFrame:(NSRect)frame inView:(NSView *)controlView 
alpha:(CGFloat)alpha;
-{
     // @@ Dark mode
     
     // NSCell's highlight drawing does not look correct against a dark 
background, so override it completely
@@ -152,7 +158,7 @@
     CGContextRef ctxt = [[NSGraphicsContext currentContext] graphicsPort];
     CGContextSaveGState(ctxt);
 
-    CGContextSetAlpha(ctxt, alpha);
+    CGContextSetAlpha(ctxt, _arrowAlpha);
     NSRectClip(frame);
     [bgColor setFill];
     [strokeColor setStroke];

Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m
===================================================================
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m      2024-01-23 
17:45:32 UTC (rev 28657)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m      2024-01-23 
22:30:22 UTC (rev 28658)
@@ -387,11 +387,13 @@
     [_subtitleCell setLineBreakMode:NSLineBreakByTruncatingTail];
     [_subtitleCell setAlignment:NSTextAlignmentCenter];
     
-    _leftArrow = [[FVArrowButton alloc] initWithArrowDirection:FVArrowLeft];
+    _leftArrow = [[FVArrowButton alloc] init];
+    [_leftArrow setArrowDirection:FVArrowLeft];
     [_leftArrow setTarget:self];
     [_leftArrow setAction:@selector(leftArrowAction:)];
     
-    _rightArrow = [[FVArrowButton alloc] initWithArrowDirection:FVArrowRight];
+    _rightArrow = [[FVArrowButton alloc] init];
+    [_rightArrow setArrowDirection:FVArrowRight];
     [_rightArrow setTarget:self];
     [_rightArrow setAction:@selector(rightArrowAction:)];
     

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

Reply via email to