WIP: visible primary balance reset, Sony input default, resizable LUT browser layout and recent history; host validation pending

这个提交包含在:
mac 于 2026-11-01 20:44:15 +08:00 提交
1 父节点 f8cc898546
当前提交 5e94042db9
10 个文件已更改
+178 -59

没有与搜索条件相匹配的文件

+8 -4
查看文件
@@ -47,12 +47,15 @@
@end
@implementation DYPrimaryBalanceWheel {
NSPoint _offset,_dragStartMouse,_dragStartOffset;BOOL _dragging,_gestureActive;
NSImage *_wheel;float _angle,_strength;
NSImage *_wheel;NSButton *_reset;float _angle,_strength;
}
- (instancetype)initWithFrame:(NSRect)frame{if((self=[super initWithFrame:frame])){NSString *path=[[NSBundle bundleForClass:self.class]pathForResource:@"Basis_balanceWheel" ofType:@"png"];if(path)_wheel=[[NSImage alloc]initWithContentsOfFile:path];self.accessibilityLabel=@"一级白平衡色轮";self.toolTip=@"拖动调整一级白平衡(精细移动);双击复位。方向键微调。";}return self;}
- (void)dealloc{[self finishGesture];[_wheel release];[super dealloc];}
- (instancetype)initWithFrame:(NSRect)frame{if((self=[super initWithFrame:frame])){NSString *path=[[NSBundle bundleForClass:self.class]pathForResource:@"Basis_balanceWheel" ofType:@"png"];if(path)_wheel=[[NSImage alloc]initWithContentsOfFile:path];self.accessibilityLabel=@"一级白平衡色轮";self.toolTip=@"拖动调整一级白平衡(精细移动);双击复位。方向键微调。";
_reset=[DYButton(@"复位",self,@selector(resetBalance:))retain];_reset.accessibilityLabel=@"复位一级白平衡";_reset.toolTip=@"仅复位一级白平衡的方向和强度";[self addSubview:_reset];}return self;}
- (void)dealloc{[self finishGesture];[_wheel release];[_reset release];[super dealloc];}
- (void)layout{[super layout];_reset.frame=NSMakeRect(MAX(0,self.bounds.size.width-62),0,60,24);}
- (BOOL)isAccessibilityElement{return YES;}
- (NSString *)accessibilityRole{return NSAccessibilityButtonRole;}
- (NSArray *)accessibilityChildren{return @[_reset];}
- (NSString *)accessibilityHelp{return self.toolTip;}
- (id)accessibilityValue{return [NSString stringWithFormat:@"方向 %.1f 度,强度 %.1f%%",_angle,_strength*100];}
- (BOOL)accessibilityPerformPress{[self.window makeFirstResponder:self];return YES;}
@@ -62,6 +65,7 @@
- (NSPoint)center{return NSMakePoint(NSMidX(self.bounds),NSMidY(self.bounds)+10);}
- (void)setValues:(NSDictionary *)values{_angle=[values[@"cmbalanceAngle"]floatValue];_strength=[values[@"cmbalanceStrength"]floatValue];double angle=(_angle+104)*M_PI/180;_offset=NSMakePoint(cos(angle)*_strength*self.maxDistance,sin(angle)*_strength*self.maxDistance);[self setNeedsDisplay:YES];}
- (void)finishGesture{if(_gestureActive){_gestureActive=NO;[_delegate graphicGesture:NO title:@"调整一级白平衡"];}}
- (void)resetBalance:(id)sender{[self finishGesture];_dragging=NO;[_delegate graphicGesture:YES title:@"复位一级白平衡"];_offset=NSZeroPoint;_angle=_strength=0;[_delegate writeGraphicValues:@{@"cmbalanceAngle":@0,@"cmbalanceStrength":@0}];[_delegate graphicGesture:NO title:@"复位一级白平衡"];[self setNeedsDisplay:YES];}
- (void)viewWillMoveToWindow:(NSWindow *)w{if(!w)[self finishGesture];[super viewWillMoveToWindow:w];}
- (void)pushValue{
_strength=(float)(hypot(_offset.x,_offset.y)/self.maxDistance);_angle=(float)fmod(atan2(_offset.y,_offset.x)*180/M_PI+360-104,360);
@@ -71,7 +75,7 @@
[NSColor.whiteColor setFill];[[NSBezierPath bezierPathWithOvalInRect:NSMakeRect(c.x+_offset.x-4,c.y+_offset.y-4,8,8)]fill];
NSString *text=[NSString stringWithFormat:@"一级白平衡 %.1f° · %.1f%%",_angle,_strength*100];[text drawAtPoint:NSMakePoint(8,3) withAttributes:@{NSFontAttributeName:[NSFont systemFontOfSize:10],NSForegroundColorAttributeName:DYInk()}];
}
- (void)mouseDown:(NSEvent *)e{[self.window makeFirstResponder:self];if(e.clickCount==2){[_delegate graphicGesture:YES title:@"还原一级白平衡"];_offset=NSZeroPoint;[self pushValue];[_delegate graphicGesture:NO title:@"还原一级白平衡"];return;}
- (void)mouseDown:(NSEvent *)e{[self.window makeFirstResponder:self];if(e.clickCount==2){[self resetBalance:nil];return;}
NSPoint p=[self convertPoint:e.locationInWindow fromView:nil],c=self.center;NSPoint knob=NSMakePoint(c.x+_offset.x,c.y+_offset.y);if(hypot(p.x-knob.x,p.y-knob.y)<self.maxDistance){_dragging=YES;_dragStartMouse=p;_dragStartOffset=_offset;}}
- (void)mouseDragged:(NSEvent *)e{if(!_dragging)return;if(!_gestureActive){_gestureActive=YES;[_delegate graphicGesture:YES title:@"调整一级白平衡"];}
NSPoint p=[self convertPoint:e.locationInWindow fromView:nil],v=NSMakePoint(_dragStartOffset.x+(p.x-_dragStartMouse.x)/5,_dragStartOffset.y+(p.y-_dragStartMouse.y)/5);double length=hypot(v.x,v.y);if(length>self.maxDistance){v.x=v.x/length*self.maxDistance;v.y=v.y/length*self.maxDistance;}_offset=v;[self pushValue];}