From 1eacf595fc00660de2b7c4e4b53ad98342cdc8e6 Mon Sep 17 00:00:00 2001 From: mac Date: Wed, 4 Nov 2026 10:44:57 +0800 Subject: [PATCH] feat: collapse advanced color settings and add default black-gold theme (1.8.2) --- 大鱼调色/Plugin/DYCompactUIDiagnostics.inc.h | 32 ++++++++++ 大鱼调色/Plugin/DYDiagnostics.mm | 2 + 大鱼调色/Plugin/DYInspector.mm | 60 +++++++++++-------- 大鱼调色/Plugin/DYManagedColorPanel.mm | 21 +++---- 大鱼调色/Plugin/DYTheme.h | 8 +++ 大鱼调色/Plugin/DYTheme.mm | 63 +++++++++++++++++--- 大鱼调色/Plugin/Info.plist | 6 +- 大鱼调色/Wrapper Application/Info.plist | 4 +- 8 files changed, 147 insertions(+), 49 deletions(-) create mode 100644 大鱼调色/Plugin/DYCompactUIDiagnostics.inc.h diff --git a/大鱼调色/Plugin/DYCompactUIDiagnostics.inc.h b/大鱼调色/Plugin/DYCompactUIDiagnostics.inc.h new file mode 100644 index 0000000..7de5cfe --- /dev/null +++ b/大鱼调色/Plugin/DYCompactUIDiagnostics.inc.h @@ -0,0 +1,32 @@ +// Presentation-only changes must never rewrite a host's grading parameters. +{ + DYDiagnosticManager *host=[[[DYDiagnosticManager alloc]init]autorelease];DYCreateParameters(host,nil); + DYInspector *view=[[[DYInspector alloc]initWithAPIManager:host]autorelease];[view refresh];[view setFrameSize:NSMakeSize(400,780)];[view layoutSubtreeIfNeeded]; + NSButton *settings=[view valueForKey:@"colorSettings"];NSView *panel=[view valueForKey:@"managedPanel"];NSArray *cards=[view valueForKey:@"cards"];NSView *first=cards.firstObject[@"view"]; + run.record(@"compact-color-settings-hidden-without-gap",panel.hidden&&first.frame.origin.y==8&&[settings.accessibilityLabel isEqual:@"颜色设置"]); + NSDictionary *values=[[host->_values copy]autorelease],*custom=[[host->_custom copy]autorelease];int starts=host->_undoStarts,ends=host->_undoEnds; + [settings performClick:nil];[view layoutSubtreeIfNeeded];run.record(@"compact-color-settings-button-expands-panel",!panel.hidden&&first.frame.origin.y>=NSMaxY(panel.frame)+12&&settings.state==NSControlStateValueOn); + for(int i=0;i<9;i++){[settings performClick:nil];[view layoutSubtreeIfNeeded];} + run.record(@"compact-color-settings-repeated-toggle-does-not-edit-grade",panel.hidden&&first.frame.origin.y==8&&[values isEqual:host->_values]&&[custom isEqual:host->_custom]&&starts==host->_undoStarts&&ends==host->_undoEnds); + for(NSDictionary *state in @[@{},DYManagedColorDefaults(),DYPrimaryColorDefaults()]){ + DYAssetState *assets=[[[DYAssetState alloc]init]autorelease];assets.colorManagement=state.count?state:nil;DYWriteAssets(host,assets,kCMTimeZero);[view refresh];NSDictionary *snapshot=[view presetSnapshot];[settings performClick:nil];[settings performClick:nil]; + run.record([NSString stringWithFormat:@"compact-settings-preserve-CMS-version-%@",state[@"version"]?:@1],[[view presetSnapshot]isEqual:snapshot]); + } + for(NSNumber *width in @[@280,@320,@400]){ + [view setFrameSize:NSMakeSize(width.doubleValue,780)];[view layoutSubtreeIfNeeded];NSArray *buttons=@[[view valueForKey:@"save"],[view valueForKey:@"load"],[view valueForKey:@"export"],settings];BOOL fit=YES; + for(NSView *button in buttons){fit&=NSMinX(button.frame)>=0&&NSMaxX(button.frame)<=width.doubleValue&&button.frame.size.width>=66;for(NSView *other in buttons)if(button!=other)fit&=!NSIntersectsRect(button.frame,other.frame);} + NSArray *themes=[view valueForKey:@"themeButtons"];NSView *brand=[view valueForKey:@"brand"];fit&=themes.count==6&&NSMaxX(brand.frame)<=NSMinX([themes.firstObject frame]); + run.record([NSString stringWithFormat:@"compact-header-controls-fit-%@",width],fit); + } + DYDiagnosticManager *fresh=[[[DYDiagnosticManager alloc]init]autorelease];DYCreateParameters(fresh,nil);run.record(@"compact-new-host-stays-original-flow",!DYReadAssets(fresh,kCMTimeZero).colorManagement); + NSInteger previous=DYThemeIndex();@try{ + BOOL colors=DYThemeNames().count==6&&[DYThemeNames()[5]isEqual:@"黑金渐变"]; + for(NSInteger i=0;i<6;i++){DYSetThemeIndex(i);colors&=DYThemeIndex()==i&&DYThemePalette()[@"background"]&&DYThemePalette()[@"text"];} + run.record(@"compact-six-stable-theme-choices",colors); + DYSetThemeIndex(5);auto luminance=[](NSColor *color){NSColor *c=[color colorUsingColorSpace:NSColorSpace.sRGBColorSpace];auto linear=[](double x){return x<=.04045?x/12.92:pow((x+.055)/1.055,2.4);};return .2126*linear(c.redComponent)+.7152*linear(c.greenComponent)+.0722*linear(c.blueComponent);}; + double minimum=100;for(NSString *text in @[@"text",@"secondary"])for(NSString *surface in @[@"background",@"backgroundEnd",@"card",@"cardEnd",@"field",@"headerTop"])minimum=std::min(minimum,(luminance(DYThemePalette()[text])+.05)/(luminance(DYThemePalette()[surface])+.05)); + run.record(@"compact-gold-labels-have-readable-contrast",minimum>=4.5,@{@"minimumContrast":@(minimum)}); + BOOL reduced=NSWorkspace.sharedWorkspace.accessibilityDisplayShouldIncreaseContrast||NSWorkspace.sharedWorkspace.accessibilityDisplayShouldReduceTransparency; + run.record(@"compact-gold-glow-respects-system-display-options",reduced?DYThemeTextShadow()==nil:DYThemeTextShadow().shadowBlurRadius<=2); + }@finally{DYSetThemeIndex(previous);} +} diff --git a/大鱼调色/Plugin/DYDiagnostics.mm b/大鱼调色/Plugin/DYDiagnostics.mm index 9a3c420..0997968 100644 --- a/大鱼调色/Plugin/DYDiagnostics.mm +++ b/大鱼调色/Plugin/DYDiagnostics.mm @@ -9,6 +9,7 @@ #import "DYLUTLibrary.h" #import "DYLUTBrowser.h" #import "DYInspector.h" +#import "DYTheme.h" #include "DYSpiderState.h" #include #import @@ -501,6 +502,7 @@ extern "C" int DYRunDiagnostics(void) { @autoreleasepool { #include "DYMaskPanelDiagnostics.inc.h" #include "DYManagedDiagnostics.inc.h" #include "DYPrimaryDiagnostics.inc.h" + #include "DYCompactUIDiagnostics.inc.h" [gpu release]; } @catch(NSException *exception) { run.record(@"diagnostic-exception",false,@{@"exception":exception.name?:@"unknown",@"message":exception.reason?:@"unknown"}); diff --git a/大鱼调色/Plugin/DYInspector.mm b/大鱼调色/Plugin/DYInspector.mm index 882a671..a9f73e7 100644 --- a/大鱼调色/Plugin/DYInspector.mm +++ b/大鱼调色/Plugin/DYInspector.mm @@ -19,17 +19,17 @@ static NSColor *DYAccent(void) { return DYThemeColor(@"accent"); } static NSColor *DYInk(void) { return DYThemeColor(@"text"); } static NSTextField *DYLabel(NSString *text, CGFloat size) { - NSTextField *v=[NSTextField labelWithString:text?:@""]; + NSTextField *v=[DYThemeLabel labelWithString:text?:@""]; v.font=[NSFont systemFontOfSize:size weight:size==11?NSFontWeightMedium:NSFontWeightRegular]; v.textColor=DYThemeColor(@"slot15"); v.lineBreakMode=NSLineBreakByTruncatingTail; return v; } static NSButton *DYButton(NSString *title,id target,SEL action) { - NSButton *b=[NSButton buttonWithTitle:title target:target action:action]; + NSButton *b=[DYThemeButton buttonWithTitle:title target:target action:action]; b.bezelStyle=NSBezelStyleRounded; b.font=[NSFont systemFontOfSize:11]; b.contentTintColor=DYAccent(); return b; } -@interface DYWebsiteLink : NSButton @end +@interface DYWebsiteLink : DYThemeButton @end @implementation DYWebsiteLink - (NSAccessibilityRole)accessibilityRole {return NSAccessibilityLinkRole;} - (void)resetCursorRects {[self addCursorRect:self.bounds cursor:NSCursor.pointingHandCursor];} @@ -100,7 +100,7 @@ static NSString *DYNumber(double value,NSDictionary *d) { - (void)drawWithFrame:(NSRect)frame inView:(NSView *)view { NSRect rect=NSInsetRect(frame,.5,.5);NSBezierPath *p=[NSBezierPath bezierPathWithRoundedRect:rect xRadius:2.5 yRadius:2.5]; NSGradient *gradient=[[[NSGradient alloc]initWithStartingColor:DYThemePalette()[@"slot5"] endingColor:DYThemePalette()[@"slot4"]]autorelease];[gradient drawInBezierPath:p angle:90];[[DYThemePalette()[@"accent"]colorWithAlphaComponent:.65]setStroke];p.lineWidth=.9;[p stroke]; - [self drawInteriorWithFrame:NSInsetRect(frame,4,3) inView:view]; + [NSGraphicsContext saveGraphicsState];[DYThemeTextShadow()set];[self drawInteriorWithFrame:NSInsetRect(frame,4,3) inView:view];[NSGraphicsContext restoreGraphicsState]; } @end @@ -125,6 +125,7 @@ static NSArray *DYAccessibleSubviews(NSView *view, BOOL visibleOnly) { return self; } - (BOOL)isFlipped { return YES; } +- (void)drawRect:(NSRect)rect {if([self.identifier isEqual:@"inspectorBackground"])DYDrawThemeSurface([NSBezierPath bezierPathWithRect:self.bounds],NO);} - (BOOL)isAccessibilityElement { return YES; } - (NSAccessibilityRole)accessibilityRole { return NSAccessibilityGroupRole; } - (NSArray *)accessibilityChildren { return DYAccessibleSubviews(self,NO); } @@ -159,9 +160,8 @@ static NSArray *DYAccessibleSubviews(NSView *view, BOOL visibleOnly) { @interface DYCard : DYFlippedView @end @implementation DYCard - (void)drawRect:(NSRect)rect { - [DYThemeColor(@"card") setFill]; NSBezierPath *path=[NSBezierPath bezierPathWithRoundedRect:NSInsetRect(self.bounds,.5,.5) xRadius:11 yRadius:11]; - [path fill]; [DYThemeColor(@"border") setStroke]; + DYDrawThemeSurface(path,YES); [DYThemeColor(@"border") setStroke]; path.lineWidth=1; [path stroke]; [[NSColor colorWithWhite:.52 alpha:1]setFill];[[NSBezierPath bezierPathWithOvalInRect:NSMakeRect(32,19,5,5)]fill]; } @@ -175,7 +175,7 @@ static NSArray *DYAccessibleSubviews(NSView *view, BOOL visibleOnly) { NSRect r=NSInsetRect(self.bounds,.5,2); NSGradient *g=[[[NSGradient alloc]initWithStartingColor:DYThemePalette()[@"headerTop"] endingColor:DYThemePalette()[@"headerBottom"]]autorelease]; [g drawInBezierPath:[NSBezierPath bezierPathWithRoundedRect:r xRadius:8 yRadius:8] angle:90]; - NSDictionary *attributes=@{NSFontAttributeName:self.font,NSForegroundColorAttributeName:DYInk()}; + NSDictionary *attributes=DYThemeTextAttributes(self.font,DYInk()); [(self.state==NSControlStateValueOn?@"▾":@"▸") drawInRect:NSMakeRect(8,7,12,16) withAttributes:attributes]; [self.title drawInRect:NSMakeRect(23,7,MAX(0,r.size.width-31),16) withAttributes:attributes]; } @@ -192,6 +192,7 @@ static NSArray *DYAccessibleSubviews(NSView *view, BOOL visibleOnly) { - (void)dealloc {[_swatch release];[super dealloc];} - (void)drawRect:(NSRect)dirtyRect { NSRect r=NSInsetRect(self.bounds,3,3);[_swatch setFill];NSBezierPath *p=[NSBezierPath bezierPathWithRoundedRect:r xRadius:5 yRadius:5];[p fill]; + if([self.identifier isEqual:@"themeSwatch"]&&self.tag==5){NSGradient *g=[[[NSGradient alloc]initWithStartingColor:NSColor.blackColor endingColor:DYThemeSwatch(5)]autorelease];[g drawInBezierPath:p angle:45];} if([self.identifier isEqual:@"customColorSwatch"]){NSGradient *g=[[[NSGradient alloc]initWithColors:@[NSColor.systemRedColor,NSColor.systemYellowColor,NSColor.systemGreenColor,NSColor.systemCyanColor,NSColor.systemBlueColor,NSColor.systemPurpleColor]]autorelease];[g drawInBezierPath:p angle:45];[@"⌾" drawInRect:NSInsetRect(r,3,1) withAttributes:@{NSFontAttributeName:[NSFont boldSystemFontOfSize:16],NSForegroundColorAttributeName:NSColor.whiteColor}];} if(self.state==NSControlStateValueOn){[DYInk() setStroke];p.lineWidth=2;[p stroke];} } @@ -281,7 +282,7 @@ static NSArray *DYPresentationSections(void) { } - (void)drawRect:(NSRect)dirtyRect { NSRect r=[self plotRect]; - [[NSColor colorWithSRGBRed:.025 green:.085 blue:.13 alpha:1] setFill];[[NSBezierPath bezierPathWithRoundedRect:r xRadius:4 yRadius:4] fill]; + [(DYThemeIndex()==5?DYThemeColor(@"card"):[NSColor colorWithSRGBRed:.025 green:.085 blue:.13 alpha:1]) setFill];[[NSBezierPath bezierPathWithRoundedRect:r xRadius:4 yRadius:4] fill]; [[NSColor colorWithWhite:1 alpha:.1] setStroke];NSBezierPath *grid=[NSBezierPath bezierPath];grid.lineWidth=.5; for(int i=0;i<5;i++){CGFloat x=r.origin.x+r.size.width*i/4,y=r.origin.y+r.size.height*i/4;[grid moveToPoint:NSMakePoint(x,NSMinY(r))];[grid lineToPoint:NSMakePoint(x,NSMaxY(r))];[grid moveToPoint:NSMakePoint(NSMinX(r),y)];[grid lineToPoint:NSMakePoint(NSMaxX(r),y)];}[grid stroke]; std::vector p; p.push_back(NSMakePoint(0,0)); @@ -434,6 +435,7 @@ static NSImage *DYWheelImage(void) { NSArray *_themeButtons; NSMutableDictionary *_tabs; NSInteger _visibleLooks; + NSButton *_colorSettings;BOOL _colorSettingsExpanded; BOOL _refreshing,_graphicUndoOpen; BOOL _embedded;NSMutableDictionary *_stackViews;NSArray *_stackOrder;NSDictionary *_stackRoots;CGFloat _stackHeight; DYSpiderPanel *_spiderPanel; @@ -474,11 +476,12 @@ static NSImage *DYWheelImage(void) { _save=[DYButton(@"保存预设",self,@selector(savePreset:)) retain]; _load=[DYButton(@"载入预设",self,@selector(loadPreset:)) retain]; _export=[DYButton(@"导出 LUT",self,@selector(exportLUT:)) retain]; - _addModule=[[NSPopUpButton alloc]initWithFrame:NSZeroRect pullsDown:YES];_addModule.font=[NSFont systemFontOfSize:11];_addModule.accessibilityLabel=@"添加模块";[_addModule addItemWithTitle:@"+ 添加模块"]; + _colorSettings=[DYButton(@"颜色设置",self,@selector(toggleColorSettings:))retain];[_colorSettings setButtonType:NSButtonTypePushOnPushOff];_colorSettings.toolTip=@"展开或收起高级颜色设置;默认使用原有流程";_colorSettings.accessibilityLabel=@"颜色设置";_colorSettings.accessibilityValue=@"已收起"; + _addModule=[[DYThemePopUpButton alloc]initWithFrame:NSZeroRect pullsDown:YES];_addModule.font=[NSFont systemFontOfSize:11];_addModule.accessibilityLabel=@"添加模块";[_addModule addItemWithTitle:@"+ 添加模块"]; for(NSDictionary *section in DYPresentationSections()){NSMenuItem *item=[[[NSMenuItem alloc]initWithTitle:section[@"title"] action:@selector(addModule:) keyEquivalent:@""]autorelease];item.target=self;item.representedObject=section[@"key"];[_addModule.menu addItem:item];} - for(NSView *v in @[_brand,_subtitle,_websiteLink,_resetAll,_save,_load,_export,_addModule]){[self addSubview:v];v.hidden=_embedded;} - NSMutableArray *themes=[NSMutableArray array];for(NSInteger i=0;i<5;i++){ - DYSwatchButton *b=[[[DYSwatchButton alloc]initWithFrame:NSZeroRect]autorelease];[b setButtonType:NSButtonTypePushOnPushOff];b.swatch=DYThemeSwatch(i);b.tag=i;b.target=self;b.action=@selector(selectTheme:);b.title=@"";b.bordered=NO; + for(NSView *v in @[_brand,_subtitle,_websiteLink,_resetAll,_save,_load,_export,_colorSettings,_addModule]){[self addSubview:v];v.hidden=_embedded;} + NSMutableArray *themes=[NSMutableArray array];for(NSInteger i=0;i)m renderer:(DYRenderer*)r assetTarget:(id)target { if((self=[super initWithFrame:NSZeroRect])){_manager=m;_renderer=[r retain];_assetTarget=target;self.identifier=@"managedColor"; - _mode=[[NSPopUpButton alloc]initWithFrame:NSZeroRect];[_mode addItemsWithTitles:@[@"一级 CST · 原有流程",@"1.8 兼容 · 跟随 FCP",@"1.8 兼容 · 相机 → ACES",@"1.8 兼容 · LUT → ACES",@"一级 CST · 延后输出(推荐)"]];_mode.target=self;_mode.action=@selector(modeChanged:);_mode.accessibilityLabel=@"色彩管理方式"; + _mode=[[DYThemePopUpButton alloc]initWithFrame:NSZeroRect];[_mode addItemsWithTitles:@[@"原有流程(默认)",@"1.8 兼容 · 跟随 FCP",@"1.8 兼容 · 相机 → ACES",@"1.8 兼容 · LUT → ACES",@"一级 CST · 延后输出"]];_mode.target=self;_mode.action=@selector(modeChanged:);_mode.accessibilityLabel=@"色彩管理方式"; _inputLabel=[cmsLabel(@"输入空间")retain];_outputLabel=[cmsLabel(@"输出目标")retain]; - _input=[[NSPopUpButton alloc]initWithFrame:NSZeroRect];for(NSDictionary*s in DYManagedInputSpaces()){[_input addItemWithTitle:s[@"name"]];_input.lastItem.representedObject=s[@"id"];} _input.target=self;_input.action=@selector(settingsChanged:);_input.accessibilityLabel=@"新版输入空间"; - _output=[[NSPopUpButton alloc]initWithFrame:NSZeroRect];for(NSDictionary*s in DYManagedOutputSpaces()){[_output addItemWithTitle:s[@"name"]];_output.lastItem.representedObject=s[@"id"];} _output.target=self;_output.action=@selector(settingsChanged:);_output.accessibilityLabel=@"新版输出目标"; - _gamut=[[NSButton checkboxWithTitle:@"ACES 参考色域压缩" target:self action:@selector(settingsChanged:)]retain];_gamut.font=[NSFont systemFontOfSize:11]; - _lut=[[NSButton buttonWithTitle:@"选择输入 LUT…" target:self action:@selector(chooseLUT:)]retain];_lut.bezelStyle=NSBezelStyleRounded; + _input=[[DYThemePopUpButton alloc]initWithFrame:NSZeroRect];for(NSDictionary*s in DYManagedInputSpaces()){[_input addItemWithTitle:s[@"name"]];_input.lastItem.representedObject=s[@"id"];} _input.target=self;_input.action=@selector(settingsChanged:);_input.accessibilityLabel=@"新版输入空间"; + _output=[[DYThemePopUpButton alloc]initWithFrame:NSZeroRect];for(NSDictionary*s in DYManagedOutputSpaces()){[_output addItemWithTitle:s[@"name"]];_output.lastItem.representedObject=s[@"id"];} _output.target=self;_output.action=@selector(settingsChanged:);_output.accessibilityLabel=@"新版输出目标"; + _gamut=[[DYThemeButton checkboxWithTitle:@"ACES 参考色域压缩" target:self action:@selector(settingsChanged:)]retain];_gamut.font=[NSFont systemFontOfSize:11];_gamut.contentTintColor=DYThemeColor(@"accent"); + _lut=[[DYThemeButton buttonWithTitle:@"选择输入 LUT…" target:self action:@selector(chooseLUT:)]retain];_lut.bezelStyle=NSBezelStyleRounded; _help=[cmsLabel(@"")retain];_help.textColor=DYThemeColor(@"secondary");_context=[cmsLabel(@"宿主颜色信息将在渲染后显示。")retain];_context.textColor=DYThemeColor(@"secondary");_context.accessibilityLabel=@"当前颜色链路"; for(NSView*v in @[_mode,_inputLabel,_input,_outputLabel,_output,_gamut,_lut,_help,_context])[self addSubview:v];[self refreshWithState:nil context:nil]; }return self; } - (void)dealloc{[_renderer release];[_state release];[_inputLUTPath release];for(id v in @[_mode,_input,_output,_gamut,_lut,_inputLabel,_outputLabel,_help,_context])[v release];[super dealloc];} -- (void)layout{[super layout];CGFloat w=self.bounds.size.width;_mode.frame=NSMakeRect(0,3,w,26);_inputLabel.frame=NSMakeRect(2,36,70,22);_input.frame=NSMakeRect(72,32,w-72,26);_outputLabel.frame=NSMakeRect(2,67,70,22);_output.frame=NSMakeRect(72,63,w-72,26);_gamut.frame=NSMakeRect(0,94,w,22);_lut.frame=NSMakeRect(0,120,w,25);_help.frame=NSMakeRect(2,152,w-4,96);_context.frame=NSMakeRect(2,252,w-4,47);if([_state[@"mode"]integerValue]<2||DYPrimaryColorState(_state)){_help.frame=NSMakeRect(2,36,w-4,104);_context.frame=NSMakeRect(2,144,w-4,54);}} +- (void)layout{[super layout];CGFloat w=self.bounds.size.width;_mode.frame=NSMakeRect(0,3,w,26);_inputLabel.frame=NSMakeRect(2,36,62,22);_input.frame=NSMakeRect(64,32,w-64,26);_outputLabel.frame=NSMakeRect(2,67,62,22);_output.frame=NSMakeRect(64,63,w-64,26);_gamut.frame=NSMakeRect(0,94,w,22);_lut.frame=NSMakeRect(0,120,w,25);_help.frame=NSMakeRect(2,152,w-4,42);_context.frame=NSMakeRect(2,198,w-4,36);if([_state[@"mode"]integerValue]<2||DYPrimaryColorState(_state)){_help.frame=NSMakeRect(2,36,w-4,42);_context.frame=NSMakeRect(2,80,w-4,28);}} - (void)refreshWithState:(NSDictionary*)s context:(NSDictionary*)context { _refreshing=YES;NSDictionary *saved=[s copy];[_state release];_state=saved;NSInteger mode=s.count?[s[@"mode"]integerValue]:0;[_mode selectItemAtIndex:mode]; NSDictionary *values=s.count&&!DYPrimaryColorState(s)?s:DYManagedColorDefaults();for(NSMenuItem*i in _input.itemArray)if([i.representedObject isEqual:values[@"input"]])[_input selectItem:i];for(NSMenuItem*i in _output.itemArray)if([i.representedObject isEqual:values[@"output"]])[_output selectItem:i]; _input.hidden=_inputLabel.hidden=_output.hidden=_outputLabel.hidden=_gamut.hidden=mode<2||mode==4;_context.hidden=mode==0;_input.enabled=mode==2||mode==3;_output.enabled=mode==2||mode==3;_gamut.enabled=mode==2||mode==3;_gamut.state=[values[@"gamutCompression"]boolValue];_lut.hidden=mode!=3;_inputLabel.stringValue=mode==3?@"LUT 输出":@"输入空间";_outputLabel.stringValue=mode==1?@"跟随宿主":@"输出目标"; - _help.stringValue=mode==4?@"输入、工作空间及输出均使用下面的一级 CST 设置。一级与印片完成后才执行主输出;其余工具为输出后的 SDR 修饰。请核对上游相机 LUT 与颜色符合,插件无法恢复上游已裁切的信息。":mode==0?@"保留原有处理顺序。选择“延后输出”后,使用一级 CST 的输入和工作空间,在一级与印片之后执行主输出。":mode==1?@"保留 1.8.0 的固定 ACEScct 流程,一级 CST 转换由全局管理接管。宿主已还原的画面无法重新获得原始 Log 信息。":mode==2?@"按所选相机编码解释兼容码值。请确认上游未还原、未自动符合;选择准确输入与输出目标。PQ/HLG 仅支持一级与印片,其他工具用于 SDR。":@"使用输入 LUT,并按“LUT 输出”解释其结果;再进入 ACEScct 和所选输出变换。"; - _context.stringValue=mode==4?@"素材编码 → 一级输入 CST → 所选工作域调色与印片 → 一级输出 CST → 宿主":context.count?[NSString stringWithFormat:@"%@ → ACEScct → %@",context[@"source"]?:@"未知",context[@"destination"]?:@"未知"]:@"宿主颜色信息将在渲染后显示。";_refreshing=NO;[self setNeedsLayout:YES]; + _help.toolTip=mode==4?@"输入、工作空间及输出均使用下面的一级 CST 设置。一级与印片完成后才执行主输出;其余工具为输出后的 SDR 修饰。请核对上游相机 LUT 与颜色符合,插件无法恢复上游已裁切的信息。":mode==0?@"保留原有处理顺序。选择“延后输出”后,使用一级 CST 的输入和工作空间,在一级与印片之后执行主输出。":mode==1?@"保留 1.8.0 的固定 ACEScct 流程,一级 CST 转换由全局管理接管。宿主已还原的画面无法重新获得原始 Log 信息。":mode==2?@"按所选相机编码解释兼容码值。请确认上游未还原、未自动符合;选择准确输入与输出目标。PQ/HLG 仅支持一级与印片,其他工具用于 SDR。":@"使用输入 LUT,并按“LUT 输出”解释其结果;再进入 ACEScct 和所选输出变换。"; + _help.stringValue=mode==0?@"保留原有调色顺序。高级流程按需选择。":mode==4?@"使用一级 CST 设置,在一级与印片之后输出。":mode==1?@"保留 1.8 兼容流程,输入跟随 FCP。":mode==2?@"按所选相机编码解释输入;请核对上游转换。":@"按所选编码解释输入 LUT 的输出。"; + _context.stringValue=mode==4?@"输入 CST → 工作域调色与印片 → 输出 CST":context.count?[NSString stringWithFormat:@"%@ → ACEScct → %@",context[@"source"]?:@"未知",context[@"destination"]?:@"未知"]:@"宿主颜色信息将在渲染后显示。";_context.toolTip=mode==4?@"素材编码 → 一级输入 CST → 所选工作域调色与印片 → 一级输出 CST → 宿主。请核对上游相机 LUT 与颜色符合;已裁切信息无法恢复。":_context.stringValue;_refreshing=NO;[self setNeedsLayout:YES]; } - (void)setInputLUTPath:(NSString*)path{NSString *saved=[path copy];[_inputLUTPath release];_inputLUTPath=saved;_lut.title=path.length?path.lastPathComponent:@"选择输入 LUT…";_lut.toolTip=path.length?path:@"选择 LUT,并准确指定其输出编码";_lut.accessibilityLabel=path.length?[@"输入 LUT:" stringByAppendingString:path.lastPathComponent]:@"选择输入 LUT";} - (void)refreshContext{[self refreshWithState:_state context:[_renderer colorContext]];} diff --git a/大鱼调色/Plugin/DYTheme.h b/大鱼调色/Plugin/DYTheme.h index b546d16..1640999 100644 --- a/大鱼调色/Plugin/DYTheme.h +++ b/大鱼调色/Plugin/DYTheme.h @@ -7,3 +7,11 @@ FOUNDATION_EXPORT void DYSetThemeIndex(NSInteger index); FOUNDATION_EXPORT NSDictionary *DYThemePalette(void); FOUNDATION_EXPORT NSColor *DYThemeColor(NSString *role); FOUNDATION_EXPORT NSColor *DYThemeSwatch(NSInteger index); + +// Shared AppKit controls keep native actions, focus, and accessibility. +FOUNDATION_EXPORT NSShadow *DYThemeTextShadow(void); +FOUNDATION_EXPORT NSDictionary *DYThemeTextAttributes(NSFont *font, NSColor *color); +FOUNDATION_EXPORT void DYDrawThemeSurface(NSBezierPath *path, BOOL card); +@interface DYThemeLabel : NSTextField @end +@interface DYThemeButton : NSButton @end +@interface DYThemePopUpButton : NSPopUpButton @end diff --git a/大鱼调色/Plugin/DYTheme.mm b/大鱼调色/Plugin/DYTheme.mm index 3303b63..3507ba2 100644 --- a/大鱼调色/Plugin/DYTheme.mm +++ b/大鱼调色/Plugin/DYTheme.mm @@ -11,7 +11,7 @@ static NSColor *rgb(double r,double g,double b){return [NSColor colorWithCalibra - (instancetype)init { if((self=[super init])) { _defaults=[[NSUserDefaults alloc]initWithSuiteName:preferenceDomain]; - [_defaults registerDefaults:@{@"themeIndex":@1}]; + [_defaults registerDefaults:@{@"themeIndex":@5}]; [[NSDistributedNotificationCenter defaultCenter]addObserver:self selector:@selector(externalChange:) name:distributedChange object:preferenceDomain suspensionBehavior:NSNotificationSuspensionBehaviorDeliverImmediately]; } return self; @@ -23,25 +23,26 @@ static NSColor *rgb(double r,double g,double b){return [NSColor colorWithCalibra } @end static DYThemeStore *store(void){static DYThemeStore *s;static dispatch_once_t once;dispatch_once(&once,^{s=[DYThemeStore new];});return s;} -NSArray *DYThemeNames(void){return @[@"深空灰",@"冰川蓝",@"薰衣草紫",@"翡翠绿",@"琥珀橙"];} -NSInteger DYThemeIndex(void){NSInteger i=[store().defaults integerForKey:@"themeIndex"];return i>=0&&i<5?i:1;} -static const double paletteRGB[5][17][3]={ +NSArray *DYThemeNames(void){return @[@"深空灰",@"冰川蓝",@"薰衣草紫",@"翡翠绿",@"琥珀橙",@"黑金渐变"];} +NSInteger DYThemeIndex(void){NSInteger i=[store().defaults integerForKey:@"themeIndex"];return i>=0&&i<6?i:5;} +static const double paletteRGB[6][17][3]={ {{0.11,0.12,0.14},{0.075,0.08,0.095},{0.17,0.18,0.21},{0.12,0.13,0.15},{0.27,0.29,0.33},{0.2,0.22,0.25},{0.36,0.39,0.44},{0.25,0.28,0.32},{0.21,0.23,0.26},{0.15,0.17,0.2},{0.78,0.83,0.9},{0.55,0.61,0.7},{1.0,1.0,1.0},{0.78,0.82,0.88},{0.96,0.97,0.98},{0.86,0.89,0.92},{0.67,0.72,0.77}}, {{0.031,0.086,0.148},{0.025,0.075,0.13},{0.07,0.155,0.235},{0.045,0.12,0.19},{0.115,0.22,0.33},{0.07,0.15,0.24},{0.15,0.33,0.5},{0.08,0.24,0.36},{0.23,0.32,0.41},{0.18,0.26,0.35},{0.38,0.76,1.0},{0.23,0.64,0.97},{0.96,0.98,1.0},{0.62,0.7,0.76},{0.88,0.96,1.0},{0.82,0.9,0.96},{0.58,0.7,0.78}}, {{0.11,0.09,0.17},{0.07,0.06,0.12},{0.18,0.14,0.28},{0.13,0.1,0.21},{0.27,0.22,0.42},{0.2,0.16,0.31},{0.43,0.34,0.68},{0.31,0.23,0.52},{0.22,0.18,0.31},{0.15,0.12,0.23},{0.78,0.71,1.0},{0.5,0.42,0.93},{0.95,0.9,1.0},{0.63,0.5,0.95},{0.98,0.95,1.0},{0.9,0.86,0.97},{0.7,0.66,0.82}}, {{0.08,0.17,0.1},{0.05,0.12,0.07},{0.12,0.27,0.15},{0.09,0.2,0.11},{0.16,0.35,0.2},{0.12,0.27,0.15},{0.21,0.57,0.31},{0.14,0.4,0.21},{0.14,0.27,0.16},{0.1,0.2,0.11},{0.54,0.96,0.64},{0.22,0.75,0.35},{0.91,1.0,0.93},{0.28,0.8,0.42},{0.95,1.0,0.96},{0.86,0.96,0.88},{0.66,0.8,0.68}}, - {{0.23,0.15,0.08},{0.16,0.1,0.05},{0.35,0.22,0.11},{0.26,0.16,0.08},{0.45,0.28,0.14},{0.36,0.22,0.1},{0.72,0.44,0.18},{0.56,0.32,0.12},{0.29,0.18,0.09},{0.2,0.12,0.06},{0.98,0.67,0.31},{0.86,0.47,0.17},{1.0,0.86,0.57},{0.93,0.59,0.22},{1.0,0.96,0.9},{0.97,0.9,0.82},{0.8,0.7,0.58}} + {{0.23,0.15,0.08},{0.16,0.1,0.05},{0.35,0.22,0.11},{0.26,0.16,0.08},{0.45,0.28,0.14},{0.36,0.22,0.1},{0.72,0.44,0.18},{0.56,0.32,0.12},{0.29,0.18,0.09},{0.2,0.12,0.06},{0.98,0.67,0.31},{0.86,0.47,0.17},{1.0,0.86,0.57},{0.93,0.59,0.22},{1.0,0.96,0.9},{0.97,0.9,0.82},{0.8,0.7,0.58}}, + {{.065,.060,.050},{.012,.012,.012},{.12,.105,.075},{.045,.042,.035},{.105,.092,.065},{.15,.125,.075},{.17,.14,.085},{.075,.065,.045},{.23,.20,.14},{.10,.09,.065},{.98,.82,.42},{.72,.51,.18},{1,.90,.65},{.88,.74,.43},{1,.86,.48},{.96,.82,.49},{.79,.70,.48}} }; -NSColor *DYThemeSwatch(NSInteger index){static const double values[5][3]={{.30,.33,.38},{.28,.72,1},{.58,.52,1},{.30,.86,.52},{1,.61,.28}};index=MAX(0,MIN(4,index));return rgb(values[index][0],values[index][1],values[index][2]);} -void DYSetThemeIndex(NSInteger index){if(index<0||index>4)return;[store().defaults setInteger:index forKey:@"themeIndex"];[store().defaults synchronize];[[NSNotificationCenter defaultCenter]postNotificationName:DYThemeDidChange object:nil];[[NSDistributedNotificationCenter defaultCenter]postNotificationName:distributedChange object:preferenceDomain userInfo:nil deliverImmediately:YES];} +NSColor *DYThemeSwatch(NSInteger index){static const double values[6][3]={{.30,.33,.38},{.28,.72,1},{.58,.52,1},{.30,.86,.52},{1,.61,.28},{.96,.77,.36}};index=MAX(0,MIN(5,index));return rgb(values[index][0],values[index][1],values[index][2]);} +void DYSetThemeIndex(NSInteger index){if(index<0||index>5)return;[store().defaults setInteger:index forKey:@"themeIndex"];[store().defaults synchronize];[[NSNotificationCenter defaultCenter]postNotificationName:DYThemeDidChange object:nil];[[NSDistributedNotificationCenter defaultCenter]postNotificationName:distributedChange object:preferenceDomain userInfo:nil deliverImmediately:YES];} NSDictionary *DYThemePalette(void){ static NSArray *palettes;static dispatch_once_t once;dispatch_once(&once,^{ NSMutableArray *all=[NSMutableArray array]; - for(NSInteger index=0;index<5;index++){ + for(NSInteger index=0;index<6;index++){ const double (*p)[3]=paletteRGB[index];NSMutableDictionary *d=[NSMutableDictionary dictionary]; for(int i=0;i<17;i++)d[[NSString stringWithFormat:@"slot%d",i]]=rgb(p[i][0],p[i][1],p[i][2]); NSColor *accent=index==0?rgb(.72,.77,.84):index==1?rgb(.22,.67,1):DYThemeSwatch(index); - [d addEntriesFromDictionary:@{@"background":d[@"slot1"],@"card":d[@"slot3"],@"border":[accent colorWithAlphaComponent:.38],@"text":d[@"slot14"],@"secondary":d[@"slot16"],@"accent":accent,@"field":d[@"slot4"],@"headerTop":d[@"slot6"],@"headerBottom":d[@"slot7"],@"track":d[@"slot8"],@"activeTop":d[@"slot10"],@"activeBottom":d[@"slot11"],@"knob":d[@"slot12"]}];[all addObject:[[d copy]autorelease]]; + [d addEntriesFromDictionary:@{@"background":d[@"slot1"],@"card":d[@"slot3"],@"border":[accent colorWithAlphaComponent:.38],@"text":d[@"slot14"],@"secondary":d[@"slot16"],@"accent":accent,@"field":d[@"slot4"],@"headerTop":d[@"slot6"],@"headerBottom":d[@"slot7"],@"track":d[@"slot8"],@"activeTop":d[@"slot10"],@"activeBottom":d[@"slot11"],@"knob":d[@"slot12"]}];d[@"backgroundEnd"]=index==5?rgb(.085,.078,.060):d[@"background"];d[@"cardEnd"]=index==5?rgb(.085,.075,.052):d[@"card"];[all addObject:[[d copy]autorelease]]; }palettes=[all copy]; });return palettes[DYThemeIndex()]; } @@ -50,3 +51,47 @@ NSColor *DYThemeColor(NSString *role){ NSMutableDictionary *all=[NSMutableDictionary dictionary];for(NSString *key in DYThemePalette())all[key]=[NSColor colorWithName:[@"Dayu." stringByAppendingString:key] dynamicProvider:^NSColor *(NSAppearance *appearance){return DYThemePalette()[key];}];colors=[all copy]; });return colors[role]?:NSColor.whiteColor; } + +NSShadow *DYThemeTextShadow(void) { + NSWorkspace *workspace=NSWorkspace.sharedWorkspace; + if(DYThemeIndex()!=5||workspace.accessibilityDisplayShouldIncreaseContrast||workspace.accessibilityDisplayShouldReduceTransparency)return nil; + NSShadow *shadow=[[[NSShadow alloc]init]autorelease];shadow.shadowColor=[DYThemeColor(@"accent")colorWithAlphaComponent:.30];shadow.shadowBlurRadius=1.8;shadow.shadowOffset=NSZeroSize;return shadow; +} +NSDictionary *DYThemeTextAttributes(NSFont *font,NSColor *color) { + NSMutableDictionary *attributes=[NSMutableDictionary dictionaryWithDictionary:@{NSFontAttributeName:font,NSForegroundColorAttributeName:color}]; + NSShadow *shadow=DYThemeTextShadow();if(shadow)attributes[NSShadowAttributeName]=shadow;return attributes; +} +void DYDrawThemeSurface(NSBezierPath *path,BOOL card) { + NSDictionary *palette=DYThemePalette();NSString *role=card?@"card":@"background"; + if(DYThemeIndex()==5){NSGradient *gradient=[[[NSGradient alloc]initWithStartingColor:palette[role] endingColor:palette[card?@"cardEnd":@"backgroundEnd"]]autorelease];[gradient drawInBezierPath:path angle:35];} + else {[palette[role]setFill];[path fill];} +} +@implementation DYThemeLabel +- (void)drawRect:(NSRect)rect {[NSGraphicsContext saveGraphicsState];[DYThemeTextShadow()set];[super drawRect:rect];[NSGraphicsContext restoreGraphicsState];} +@end +@interface DYThemeButtonCell : NSButtonCell @end +@implementation DYThemeButtonCell +- (NSRect)drawTitle:(NSAttributedString*)title withFrame:(NSRect)frame inView:(NSView*)view { + if(DYThemeIndex()!=5)return [super drawTitle:title withFrame:frame inView:view]; + NSMutableAttributedString *gold=[[title mutableCopy]autorelease];[gold addAttributes:DYThemeTextAttributes(self.font?:[NSFont systemFontOfSize:11],[DYThemeColor(@"text")colorWithAlphaComponent:self.enabled?1:.45]) range:NSMakeRange(0,gold.length)];return [super drawTitle:gold withFrame:frame inView:view]; +} +- (void)drawBezelWithFrame:(NSRect)frame inView:(NSView*)view { + if(DYThemeIndex()!=5||!self.bordered){[super drawBezelWithFrame:frame inView:view];return;} + NSBezierPath *path=[NSBezierPath bezierPathWithRoundedRect:NSInsetRect(frame,1,2) xRadius:6 yRadius:6];DYDrawThemeSurface(path,YES);[[DYThemeColor(@"accent")colorWithAlphaComponent:self.highlighted?.8:.32]setStroke];path.lineWidth=self.highlighted?1.5:1;[path stroke]; +} +@end +@implementation DYThemeButton ++ (Class)cellClass {return DYThemeButtonCell.class;} +@end +@implementation DYThemePopUpButton +- (void)drawRect:(NSRect)rect { + if(DYThemeIndex()!=5){[super drawRect:rect];return;} + NSRect bounds=NSInsetRect(self.bounds,1,2);NSBezierPath *path=[NSBezierPath bezierPathWithRoundedRect:bounds xRadius:6 yRadius:6];DYDrawThemeSurface(path,YES); + [[DYThemeColor(@"accent")colorWithAlphaComponent:self.enabled?.38:.18]setStroke];path.lineWidth=1;[path stroke]; + NSMutableDictionary *attributes=[NSMutableDictionary dictionaryWithDictionary:DYThemeTextAttributes(self.font?:[NSFont systemFontOfSize:11],[DYThemeColor(@"text")colorWithAlphaComponent:self.enabled?1:.45])];NSMutableParagraphStyle *paragraph=[[[NSMutableParagraphStyle alloc]init]autorelease];paragraph.lineBreakMode=NSLineBreakByTruncatingTail;attributes[NSParagraphStyleAttributeName]=paragraph; + CGFloat y=NSMidY(self.bounds)-(self.font?:[NSFont systemFontOfSize:11]).pointSize*.62; + [(self.selectedItem.title?:@"")drawInRect:NSMakeRect(9,y,MAX(0,self.bounds.size.width-29),18) withAttributes:attributes]; + [@"⌄"drawInRect:NSMakeRect(self.bounds.size.width-20,y,13,18) withAttributes:attributes]; + if(self.window.firstResponder==self){[DYThemeColor(@"accent")setStroke];path.lineWidth=2;[path stroke];} +} +@end diff --git a/大鱼调色/Plugin/Info.plist b/大鱼调色/Plugin/Info.plist index 3f2b74a..dbe40e5 100644 --- a/大鱼调色/Plugin/Info.plist +++ b/大鱼调色/Plugin/Info.plist @@ -17,9 +17,9 @@ CFBundlePackageType XPC! CFBundleShortVersionString - 1.8.1 + 1.8.2 CFBundleVersion - 57 + 58 NSHumanReadableCopyright PlugInKit @@ -71,7 +71,7 @@ uuid 1C17B73B-F229-4C09-A434-EAF6DFF5F22A version - 1.8.1 + 1.8.2 className diff --git a/大鱼调色/Wrapper Application/Info.plist b/大鱼调色/Wrapper Application/Info.plist index e11bef7..727e815 100644 --- a/大鱼调色/Wrapper Application/Info.plist +++ b/大鱼调色/Wrapper Application/Info.plist @@ -17,9 +17,9 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.8.1 + 1.8.2 CFBundleVersion - 57 + 58 LSMinimumSystemVersion $(MACOSX_DEPLOYMENT_TARGET) NSHumanReadableCopyright