Revision: 28664
http://sourceforge.net/p/bibdesk/svn/28664
Author: hofman
Date: 2024-01-24 10:30:49 +0000 (Wed, 24 Jan 2024)
Log Message:
-----------
Animate alpha value of arrow buttons, make sure the view is layer backed
Modified Paths:
--------------
trunk/bibdesk_vendorsrc/amaxwell/FileView/FVArrowButton.h
trunk/bibdesk_vendorsrc/amaxwell/FileView/FVArrowButton.m
trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m
Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVArrowButton.h
===================================================================
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVArrowButton.h 2024-01-24
10:05:56 UTC (rev 28663)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVArrowButton.h 2024-01-24
10:30:49 UTC (rev 28664)
@@ -49,12 +49,6 @@
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
-
-/** The arrow direction.
-
- Cover method for the cell's property. This is animatable. Calls
setNeedsDisplay:. */
-@property (nonatomic) CGFloat arrowAlpha;
-
@end
/** @internal @brief Circular arrow button.
@@ -62,14 +56,7 @@
FVArrowButtonCell 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 FVArrowButtonCell : NSButtonCell {
FVArrowDirection _arrowDirection;
- CGFloat _arrowAlpha;
}
-
-/** The arrow alpha.
-
- Determines an overall alpha when drawing. */
-@property (nonatomic) CGFloat arrowAlpha;
-
@end
/** @typedef NSInteger FVArrowDirection
Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVArrowButton.m
===================================================================
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVArrowButton.m 2024-01-24
10:05:56 UTC (rev 28663)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVArrowButton.m 2024-01-24
10:30:49 UTC (rev 28664)
@@ -47,31 +47,12 @@
@implementation FVArrowButton
-@dynamic arrowAlpha;
-
-+ (id)defaultAnimationForKey:(NSAnimatablePropertyKey)key {
- if ([key isEqualToString:@"arrowAlpha"])
- return [CABasicAnimation animation];
- return [super defaultAnimationForKey:key];
-}
-
+ (Class)cellClass { return [FVArrowButtonCell self]; }
-- (CGFloat)arrowAlpha {
- return [(FVArrowButtonCell *)[self cell] arrowAlpha];
-}
-
-- (void)setArrowAlpha:(CGFloat)arrowAlpha {
- [(FVArrowButtonCell *)[self cell] setArrowAlpha:arrowAlpha];
- [self setNeedsDisplay:YES];
-}
-
@end
@implementation FVArrowButtonCell
-@synthesize arrowAlpha=_arrowAlpha;
-
- (id)initTextCell:(NSString *)string {
self = [super initTextCell:string];
if (self) {
@@ -80,7 +61,6 @@
[self setBezelStyle:NSRegularSquareBezelStyle];
[self setBordered:NO];
[self setContinuous:YES];
- _arrowAlpha = 1.0;
}
return self;
}
@@ -93,7 +73,6 @@
[self setBezelStyle:NSRegularSquareBezelStyle];
[self setBordered:NO];
[self setContinuous:YES];
- _arrowAlpha = 1.0;
}
return self;
}
@@ -147,7 +126,6 @@
CGContextRef ctxt = [[NSGraphicsContext currentContext] graphicsPort];
CGContextSaveGState(ctxt);
- 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-24
10:05:56 UTC (rev 28663)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m 2024-01-24
10:30:49 UTC (rev 28664)
@@ -417,7 +417,10 @@
_fvFlags.updatingFromSlider = NO;
_fvFlags.needsReload = NO;
-
+
+ // for the arrow animations
+ [self setWantsLayer:YES];
+
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(_handleFinderLabelChanged:)
name:FVFinderLabelDidChangeNotification object:nil];
}
@@ -3053,10 +3056,10 @@
if ([anIcon pageCount] > 1) {
- if ([_leftArrow arrowAlpha] > 0.0) {
+ if ([_leftArrow alphaValue] > 0.0) {
if (anIcon != [[_leftArrow cell] representedObject]) {
- [_leftArrow setArrowAlpha:0.0];
- [_rightArrow setArrowAlpha:0.0];
+ [_leftArrow setAlphaValue:0.0];
+ [_rightArrow setAlphaValue:0.0];
}
}
@@ -3082,12 +3085,12 @@
[self addSubview:_leftArrow];
[self addSubview:_rightArrow];
- if ([_leftArrow arrowAlpha] < 1.0) {
+ if ([_leftArrow alphaValue] < 1.0) {
[NSAnimationContext runAnimationGroup:^(NSAnimationContext
*context){
[context setTimingFunction:[CAMediaTimingFunction
functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
[context setDuration:0.3];
- [[_leftArrow animator] setArrowAlpha:1.0];
- [[_rightArrow animator] setArrowAlpha:1.0];
+ [[_leftArrow animator] setAlphaValue:1.0];
+ [[_rightArrow animator] setAlphaValue:1.0];
} completionHandler:^{}];
}
}
@@ -3102,8 +3105,8 @@
[NSAnimationContext runAnimationGroup:^(NSAnimationContext *context){
[context setTimingFunction:[CAMediaTimingFunction
functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
[context setDuration:0.3];
- [[_leftArrow animator] setArrowAlpha:0.0];
- [[_rightArrow animator] setArrowAlpha:0.0];
+ [[_leftArrow animator] setAlphaValue:0.0];
+ [[_rightArrow animator] setAlphaValue:0.0];
} completionHandler:^{
if ([[_leftArrow cell] representedObject] == nil) {
[_leftArrow removeFromSuperview];
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