From ce7e0a3371693c84c97267af12ca0f078b0db981 Mon Sep 17 00:00:00 2001 From: mac Date: Sat, 31 Oct 2026 01:29:57 +0800 Subject: [PATCH] fix: expose scrolling inspector controls to host accessibility and constrain drawing --- research/ANALYSIS.md | 26 ++ tools/create_host_fixture.py | 27 ++ tools/deliver.py | 11 +- verification/Delivery.json | 15 + verification/InstalledSelfTest.json | 448 ++++++++++++++++++++++++ 大鱼调色/Plugin/DYInspector.mm | 72 +++- 大鱼调色/Plugin/Info.plist | 2 +- 大鱼调色/Wrapper Application/Info.plist | 2 +- 8 files changed, 597 insertions(+), 6 deletions(-) create mode 100644 research/ANALYSIS.md create mode 100644 tools/create_host_fixture.py create mode 100644 verification/Delivery.json create mode 100644 verification/InstalledSelfTest.json diff --git a/research/ANALYSIS.md b/research/ANALYSIS.md new file mode 100644 index 0000000..c300db0 --- /dev/null +++ b/research/ANALYSIS.md @@ -0,0 +1,26 @@ +# LumiGrade → 大鱼调色 + +参考:/Library/Plug-Ins/FxPlug/LumiGrade.app,3.0 build56,主ID com.quliang.LumiGrade。 +XPC universal SHA256 33c273d6a58314f5068959fcda911d741884a1937077b41a969a990dd40d0b6d;用于静态分析的arm64切片SHA c04e911e449e888eb0d8c10f7bcf2b6bc2c4153b9ba86c1952ddf210c96c5e97。 + +## 已确认与实现 + +- 原生Wrapper/XPC/FxPlug4,944字节102字段GPU状态,Metal滤镜、全帧白场统计、LUT导出。 +- 输入17种相机曲线、可自选3D Cube;白平衡、曝光/对比度/高光/阴影/白/黑、纹理/清晰度/去雾、鲜艳/饱和、独立肤色保护。 +- 最多五层顺序风格LUT;主/R/G/B可加删点的单调Hermite曲线;8色+自定义RGB选区HSL;阴影/中间调/高光/全局色轮及明亮度、混合、平衡;三原色、RGB/单通道色阶、黑白混色、三向色彩平衡。 +- 自动调色与自动白平衡、复制时自动分析、系统白平衡/自定义色吸管、预设保存加载、33³Cube导出。 +- 所有调色浮点均由FxPlug原生参数保存,控件按宿主action读写;实例通知以manager对象隔离。资产独立secure coding,渲染状态使用带版本不可变plist。 + +## 证据 + +LumiGrade-analysis.json包含REA/Ghidra返回的20条证据及分析限制;关键CPU行为与地址见ColorTableNotes.md,GPU来源见tools/kernels/PROVENANCE.json及README。CameraRaw数据与MIT的Compositor源码逐字节一致,原许可保留在正式资源中。17张输入LUT由指定参考应用的一次性提取生成,原始和压缩数据SHA见Resources/InputLUTs/manifest.json。构建不依赖原厂应用。 + +35项GPU检查与5,342,405个分量对照通过;CPU查表、83项自动分析边界、70项完整模型/IOSurface/Metal/LUT集成分别验证。正式安装及宿主结果见verification。 + +## 适配与边界 + +重建的是调色行为与可编辑控件,界面使用大鱼标识;白平衡与颜色归同组、肤色保护独立旁路以对应实际数学依赖。未接原厂许可、售后或联网服务。吸管使用系统取色器,未复用原厂Viewer OSC。用户LUT采用文件选择,未照搬原厂缩略图浏览库和主题切换。 + +自动分析同为320×180 RGB8,转换前后量化并先应用输入LUT;Metal双线性缩图与原CoreGraphics缩图可能在边缘产生微小差异。原GPU使用half纹理和输出;32位宿主也遵循这一原精度边界。局部增强/全帧统计需要完整源帧,超大图受GPU纹理/内存限制。Cube仅保存逐像素颜色,无法承载邻域纹理、清晰度或逐画面分析。 + +有限状态对照不等于对所有参数/GPU/素材的穷尽证明。自定义LUT绝对路径随预设保存,跨机器需搬移用户LUT并重新选择;用户媒体与预设不在源码备份范围内。 \ No newline at end of file diff --git a/tools/create_host_fixture.py b/tools/create_host_fixture.py new file mode 100644 index 0000000..2c0353c --- /dev/null +++ b/tools/create_host_fixture.py @@ -0,0 +1,27 @@ +#!/usr/bin/env python3 +"""Generate a synthetic QA source and a separate FCPXML acceptance timeline.""" +from pathlib import Path +import struct,zlib,xml.etree.ElementTree as E +out=Path('/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/fcp-qa');out.mkdir(parents=True,exist_ok=True) +w,h=1920,1080 +colors=[(190,110,85),(125,80,65),(242,205,170),(210,180,130),(40,130,190),(60,170,90),(240,55,45),(35,45,85)] +pixels=bytearray() +for y in range(h): + pixels.append(0) + for x in range(w): + t=x/(w-1) + if yI',len(b))+k+b+struct.pack('>I',zlib.crc32(k+b)&0xffffffff) +png=b'\x89PNG\r\n\x1a\n'+chunk(b'IHDR',struct.pack('>IIBBBBB',w,h,8,6,0,0,0))+chunk(b'sRGB',b'\x00')+chunk(b'IDAT',zlib.compress(pixels,7))+chunk(b'IEND',b'') +media=out/'大鱼调色验收图.png';media.write_bytes(png) +root=E.Element('fcpxml',version='1.12');res=E.SubElement(root,'resources');E.SubElement(res,'format',id='f1',width=str(w),height=str(h),frameDuration='1/25s',colorSpace='1-1-1 (Rec. 709)');E.SubElement(res,'format',id='f2',width=str(w),height=str(h),name='FFVideoFormatRateUndefined');a=E.SubElement(res,'asset',id='a1',name='大鱼调色验收图',start='0s',duration='0s',format='f2',hasVideo='1',videoSources='1');E.SubElement(a,'media-rep',kind='original-media',src=media.as_uri()) +template=Path('/Users/mac/Movies/Motion Templates.localized/Effects.localized/大鱼调色/大鱼调色/大鱼调色.moef');E.SubElement(res,'effect',id='fx',name='大鱼调色',uid='~/Effects.localized/大鱼调色/大鱼调色/大鱼调色.moef',src=template.as_uri()) +lib=E.SubElement(root,'library');event=E.SubElement(lib,'event',name='大鱼调色_独立验收');project=E.SubElement(event,'project',name='大鱼调色_正式版验收');seq=E.SubElement(project,'sequence',format='f1',tcStart='0s',tcFormat='NDF',audioLayout='stereo',audioRate='48k',duration='4s');spine=E.SubElement(seq,'spine') +for i,name in enumerate(['原图','大鱼调色']): + v=E.SubElement(spine,'video',ref='a1',name=name,offset=f'{i*2}s',start='0s',duration='2s') + if i:E.SubElement(v,'filter-video',ref='fx',name='大鱼调色',enabled='1') +xml=out/'大鱼调色_正式版验收.fcpxml';E.indent(root);xml.write_text('\n\n'+E.tostring(root,encoding='unicode')+'\n');print(xml) diff --git a/tools/deliver.py b/tools/deliver.py index af800c8..a336a43 100644 --- a/tools/deliver.py +++ b/tools/deliver.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 """Single-install Release delivery; keeps a product lock through host acceptance.""" from pathlib import Path -import subprocess,os,json,shutil,plistlib,uuid,sys,datetime,hashlib +import subprocess,os,json,shutil,plistlib,uuid,sys,datetime,hashlib,time ROOT=Path(__file__).resolve().parent.parent CACHE=Path('/Users/mac/Library/Caches/CodexBuilds/com.dayu.color') LOCK=Path('/Users/mac/.codex/app-delivery-locks/com.dayu.color.lock') @@ -36,6 +36,7 @@ def main(): try: ids=run('security','find-identity','-v','-p','codesigning') if IDENTITY not in ids:raise RuntimeError('有效发布证书或私钥不可用') + if any(l.endswith('/Contents/MacOS/大鱼调色') for l in run('ps','-axo','comm=').splitlines()):raise RuntimeError('请先正常退出当前大鱼调色窗口') print('Building final Release',flush=True) run('xcodebuild','-project','大鱼调色.xcodeproj','-scheme','Wrapper Application','-configuration','Release','-derivedDataPath',str(CACHE/'DerivedData'),'build',log=CACHE/'release-build.log') b=APP/'Contents/Resources/FCP Templates/大鱼调色.moef';b.parent.mkdir(parents=True,exist_ok=True);shutil.copy2(ROOT/'template/大鱼调色.moef',b) @@ -60,6 +61,14 @@ def main(): os.replace(stage,DEST);stage=None try: identity(DEST,'com.dayu.color');run('codesign','--verify','--deep','--strict',str(DEST));run('xcrun','stapler','validate',str(DEST));gate=run('spctl','--assess','--type','execute','--verbose=2',str(DEST)) + installedTest=json.loads(run(str(DEST/PLUGIN/'Contents/MacOS/大鱼调色 XPC Service'),'--self-test')) + if not installedTest.get('pass'):raise RuntimeError('正式安装版原生集成自检失败') + (ROOT/'verification/InstalledSelfTest.json').write_text(json.dumps(installedTest,ensure_ascii=False,indent=2)+'\n') + run('open',str(DEST)) + for attempt in range(20): + if str(DEST/'Contents/MacOS/大鱼调色') in run('ps','-axo','comm=').splitlines():break + time.sleep(.25) + else:raise RuntimeError('未从正式安装路径启动') except Exception: failed=DEST.parent/('.dayu-color-failed-'+uuid.uuid4().hex+'.app');os.replace(DEST,failed) if old:os.replace(old,DEST);old=None diff --git a/verification/Delivery.json b/verification/Delivery.json new file mode 100644 index 0000000..2be9965 --- /dev/null +++ b/verification/Delivery.json @@ -0,0 +1,15 @@ +{ + "status": "installed-awaiting-host-verification", + "path": "/Library/Plug-Ins/FxPlug/大鱼调色.app", + "bundleID": "com.dayu.color", + "version": "1.0.0", + "build": "1", + "team": "B3W25FX5H5", + "notaryID": "70149a45-3fac-407a-8954-65624c49e514", + "notaryStatus": "Accepted", + "gatekeeper": "/Library/Plug-Ins/FxPlug/大鱼调色.app: accepted\nsource=Notarized Developer ID", + "sourceCommit": "2330eb737e3aac17d93c219fba458cd106d095fc", + "templatePath": "/Users/mac/Movies/Motion Templates.localized/Effects.localized/大鱼调色/大鱼调色/大鱼调色.moef", + "templateSHA256": "46b613b2b9d799ce6b55902f973a5fd901b289c6105b39c0b4f6a018949cc81b", + "shaderSHA256": "9d89ed3197cf987a37ad7320911d23b8510b5461ffca2bd16397c8b963e02132" +} diff --git a/verification/InstalledSelfTest.json b/verification/InstalledSelfTest.json new file mode 100644 index 0000000..69cb1f2 --- /dev/null +++ b/verification/InstalledSelfTest.json @@ -0,0 +1,448 @@ +{ + "bundlePath" : "\/Library\/Plug-Ins\/FxPlug\/大鱼调色.app\/Contents\/PlugIns\/大鱼调色 XPC Service.pluginkit", + "checks" : 70, + "gpu" : "Apple M4", + "limitations" : [ + "Finite states and a 64x48 frame; live FCP discovery, inspector interaction, timeline persistence and real host export require separate acceptance.", + "Input profiles checked for load\/render\/finite output; independent color accuracy is covered by separate LUT\/kernel evidence." + ], + "pass" : true, + "results" : [ + { + "error" : "未提供错误信息", + "name" : "runtime-directory", + "pass" : true, + "path" : "\/Users\/mac\/Library\/Caches\/CodexBuilds\/com.dayu.color\/verification-runtime\/5B495F85-EDE3-4CA0-AD02-A51E205AB5F7" + }, + { + "descriptors" : 196, + "name" : "descriptor-unique-id-offset-key", + "pass" : true, + "sections" : 12, + "uniformBytes" : 944 + }, + { + "name" : "finite-real-model-defaults", + "pass" : true + }, + { + "error" : "未提供错误信息", + "name" : "native-parameter-creation", + "pass" : true + }, + { + "name" : "native-get-set-model-roundtrip", + "pass" : true + }, + { + "name" : "model-clamps-host-out-of-range", + "pass" : true + }, + { + "name" : "model-rejects-host-nonfinite", + "pass" : true + }, + { + "archiveBytes" : 620, + "error" : "未提供错误信息", + "name" : "secure-asset-archive-roundtrip", + "pass" : true + }, + { + "name" : "native-custom-asset-get-set", + "pass" : true + }, + { + "name" : "asset-copy-is-independent", + "pass" : true + }, + { + "name" : "metal-device", + "pass" : true + }, + { + "name" : "real-iosurface-image-tiles", + "pass" : true + }, + { + "error" : "", + "name" : "renderer-default-pass", + "pass" : true + }, + { + "changedComponents" : 251, + "maxAbsoluteError" : 0.000244140625, + "name" : "transparent-premultiplied-neutral", + "nonfiniteComponents" : 0, + "nonzeroComponents" : 9832, + "pass" : true + }, + { + "invalidComponents" : 0, + "name" : "renderer-alpha-contract", + "pass" : true + }, + { + "bytes" : 921600, + "name" : "renderer-analysis-320x180", + "pass" : true + }, + { + "blacks" : -36, + "contrast" : 16, + "exposure" : -0.28999999999999998, + "highlights" : 0, + "name" : "renderer-auto-grade-integration", + "pass" : true, + "saturation" : -5, + "shadows" : -22, + "temperature" : -1, + "tint" : 1, + "vibrance" : -6, + "whites" : 6 + }, + { + "error" : "", + "name" : "renderer-exposure-pass", + "pass" : true + }, + { + "changedComponents" : 7374, + "maxAbsoluteError" : 0.39453125, + "name" : "exposure-affects-actual-frame", + "nonfiniteComponents" : 0, + "nonzeroComponents" : 9832, + "pass" : true + }, + { + "error" : "", + "name" : "renderer-base-bypass-pass", + "pass" : true + }, + { + "changedComponents" : 0, + "maxAbsoluteError" : 0, + "name" : "base-group-bypass", + "nonfiniteComponents" : 0, + "nonzeroComponents" : 9832, + "pass" : true + }, + { + "error" : "", + "name" : "renderer-white-balance-pass", + "pass" : true + }, + { + "changedComponents" : 7362, + "maxAbsoluteError" : 0.3515625, + "name" : "white-balance-real-table-frame", + "nonfiniteComponents" : 0, + "nonzeroComponents" : 9832, + "pass" : true + }, + { + "error" : "", + "name" : "renderer-color-bypass-pass", + "pass" : true + }, + { + "changedComponents" : 0, + "maxAbsoluteError" : 0, + "name" : "color-group-bypass", + "nonfiniteComponents" : 0, + "nonzeroComponents" : 9832, + "pass" : true + }, + { + "error" : "", + "name" : "renderer-hsl-pass", + "pass" : true + }, + { + "changedComponents" : 7354, + "maxAbsoluteError" : 0.13134765625, + "name" : "hsl-real-table-frame", + "nonfiniteComponents" : 0, + "nonzeroComponents" : 9832, + "pass" : true + }, + { + "error" : "", + "name" : "renderer-grading-pass", + "pass" : true + }, + { + "changedComponents" : 7357, + "maxAbsoluteError" : 0.094482421875, + "name" : "grading-real-table-frame", + "nonfiniteComponents" : 0, + "nonzeroComponents" : 9832, + "pass" : true + }, + { + "error" : "", + "name" : "input-profile-01-load-render", + "pass" : true + }, + { + "changedComponents" : 7373, + "maxAbsoluteError" : 0.604736328125, + "name" : "input-profile-01-finite-nonzero", + "nonfiniteComponents" : 0, + "nonzeroComponents" : 8570, + "pass" : true + }, + { + "error" : "", + "name" : "input-profile-02-load-render", + "pass" : true + }, + { + "changedComponents" : 7374, + "maxAbsoluteError" : 0.610595703125, + "name" : "input-profile-02-finite-nonzero", + "nonfiniteComponents" : 0, + "nonzeroComponents" : 9311, + "pass" : true + }, + { + "error" : "", + "name" : "input-profile-03-load-render", + "pass" : true + }, + { + "changedComponents" : 7374, + "maxAbsoluteError" : 0.92999267578125, + "name" : "input-profile-03-finite-nonzero", + "nonfiniteComponents" : 0, + "nonzeroComponents" : 9832, + "pass" : true + }, + { + "error" : "", + "name" : "input-profile-04-load-render", + "pass" : true + }, + { + "changedComponents" : 7373, + "maxAbsoluteError" : 0.668701171875, + "name" : "input-profile-04-finite-nonzero", + "nonfiniteComponents" : 0, + "nonzeroComponents" : 9785, + "pass" : true + }, + { + "error" : "", + "name" : "input-profile-05-load-render", + "pass" : true + }, + { + "changedComponents" : 7374, + "maxAbsoluteError" : 0.330078125, + "name" : "input-profile-05-finite-nonzero", + "nonfiniteComponents" : 0, + "nonzeroComponents" : 9832, + "pass" : true + }, + { + "error" : "", + "name" : "input-profile-06-load-render", + "pass" : true + }, + { + "changedComponents" : 7372, + "maxAbsoluteError" : 0.9000244140625, + "name" : "input-profile-06-finite-nonzero", + "nonfiniteComponents" : 0, + "nonzeroComponents" : 9790, + "pass" : true + }, + { + "error" : "", + "name" : "input-profile-07-load-render", + "pass" : true + }, + { + "changedComponents" : 7372, + "maxAbsoluteError" : 0.88970947265625, + "name" : "input-profile-07-finite-nonzero", + "nonfiniteComponents" : 0, + "nonzeroComponents" : 9798, + "pass" : true + }, + { + "error" : "", + "name" : "input-profile-08-load-render", + "pass" : true + }, + { + "changedComponents" : 7372, + "maxAbsoluteError" : 0.599365234375, + "name" : "input-profile-08-finite-nonzero", + "nonfiniteComponents" : 0, + "nonzeroComponents" : 9827, + "pass" : true + }, + { + "error" : "", + "name" : "input-profile-09-load-render", + "pass" : true + }, + { + "changedComponents" : 7372, + "maxAbsoluteError" : 0.413330078125, + "name" : "input-profile-09-finite-nonzero", + "nonfiniteComponents" : 0, + "nonzeroComponents" : 9508, + "pass" : true + }, + { + "error" : "", + "name" : "input-profile-10-load-render", + "pass" : true + }, + { + "changedComponents" : 7369, + "maxAbsoluteError" : 0.47119140625, + "name" : "input-profile-10-finite-nonzero", + "nonfiniteComponents" : 0, + "nonzeroComponents" : 9419, + "pass" : true + }, + { + "error" : "", + "name" : "input-profile-11-load-render", + "pass" : true + }, + { + "changedComponents" : 7369, + "maxAbsoluteError" : 0.47119140625, + "name" : "input-profile-11-finite-nonzero", + "nonfiniteComponents" : 0, + "nonzeroComponents" : 9419, + "pass" : true + }, + { + "error" : "", + "name" : "input-profile-12-load-render", + "pass" : true + }, + { + "changedComponents" : 7372, + "maxAbsoluteError" : 0.5775146484375, + "name" : "input-profile-12-finite-nonzero", + "nonfiniteComponents" : 0, + "nonzeroComponents" : 9832, + "pass" : true + }, + { + "error" : "", + "name" : "input-profile-13-load-render", + "pass" : true + }, + { + "changedComponents" : 7373, + "maxAbsoluteError" : 0.595947265625, + "name" : "input-profile-13-finite-nonzero", + "nonfiniteComponents" : 0, + "nonzeroComponents" : 9774, + "pass" : true + }, + { + "error" : "", + "name" : "input-profile-14-load-render", + "pass" : true + }, + { + "changedComponents" : 7372, + "maxAbsoluteError" : 0.645263671875, + "name" : "input-profile-14-finite-nonzero", + "nonfiniteComponents" : 0, + "nonzeroComponents" : 9832, + "pass" : true + }, + { + "error" : "", + "name" : "input-profile-15-load-render", + "pass" : true + }, + { + "changedComponents" : 7373, + "maxAbsoluteError" : 0.66650390625, + "name" : "input-profile-15-finite-nonzero", + "nonfiniteComponents" : 0, + "nonzeroComponents" : 8959, + "pass" : true + }, + { + "error" : "", + "name" : "input-profile-16-load-render", + "pass" : true + }, + { + "changedComponents" : 7366, + "maxAbsoluteError" : 0.586669921875, + "name" : "input-profile-16-finite-nonzero", + "nonfiniteComponents" : 0, + "nonzeroComponents" : 9832, + "pass" : true + }, + { + "error" : "", + "name" : "input-profile-17-load-render", + "pass" : true + }, + { + "changedComponents" : 7374, + "maxAbsoluteError" : 0.7840576171875, + "name" : "input-profile-17-finite-nonzero", + "nonfiniteComponents" : 0, + "nonzeroComponents" : 9832, + "pass" : true + }, + { + "error" : "", + "name" : "renderer-input-analysis-pass", + "pass" : true + }, + { + "changedComponents" : 172094, + "maxAbsoluteError" : 0.76862752391025424, + "name" : "analysis-applies-selected-input-LUT", + "pass" : true + }, + { + "error" : "未提供错误信息", + "name" : "temporary-look-file", + "pass" : true + }, + { + "error" : "", + "name" : "renderer-five-look-pass", + "pass" : true + }, + { + "changedComponents" : 7364, + "maxAbsoluteError" : 0.52490234375, + "name" : "five-look-mixes-affect-frame", + "nonfiniteComponents" : 0, + "nonzeroComponents" : 9832, + "pass" : true + }, + { + "error" : "未提供错误信息", + "name" : "renderer-export-33cube", + "pass" : true, + "path" : "\/Users\/mac\/Library\/Caches\/CodexBuilds\/com.dayu.color\/verification-runtime\/5B495F85-EDE3-4CA0-AD02-A51E205AB5F7\/diagnostic-export.cube" + }, + { + "bytes" : 1186070, + "name" : "export-33cube-data-contract", + "nonzeroRows" : 35937, + "pass" : true, + "rows" : 35937 + } + ], + "runtimePath" : "\/Users\/mac\/Library\/Caches\/CodexBuilds\/com.dayu.color\/verification-runtime\/5B495F85-EDE3-4CA0-AD02-A51E205AB5F7", + "scope" : "Native model and renderer integration with real Metal\/IOSurface textures and fake FxPlug host selectors; no GUI or live host document." +} diff --git a/大鱼调色/Plugin/DYInspector.mm b/大鱼调色/Plugin/DYInspector.mm index edef602..46ef223 100644 --- a/大鱼调色/Plugin/DYInspector.mm +++ b/大鱼调色/Plugin/DYInspector.mm @@ -39,9 +39,54 @@ static NSString *DYNumber(double value,NSDictionary *d) { } @end +// FxPlug's remote view bridge needs an explicit container tree; an ignored +// NSView document can otherwise make a populated NSScrollView appear empty. +static NSArray *DYAccessibleSubviews(NSView *view, BOOL visibleOnly) { + NSMutableArray *children=[NSMutableArray array]; + NSRect visible=view.visibleRect; + for(NSView *child in view.subviews) { + if(child.hidden)continue; + if(visibleOnly&&!NSIntersectsRect(child.frame,visible))continue; + [children addObject:child]; + } + return NSAccessibilityUnignoredChildren(children); +} + @interface DYFlippedView : NSView @end @implementation DYFlippedView +- (instancetype)initWithFrame:(NSRect)frame { + if((self=[super initWithFrame:frame]))self.clipsToBounds=YES; + return self; +} - (BOOL)isFlipped { return YES; } +- (BOOL)isAccessibilityElement { return YES; } +- (NSAccessibilityRole)accessibilityRole { return NSAccessibilityGroupRole; } +- (NSArray *)accessibilityChildren { return DYAccessibleSubviews(self,NO); } +- (NSArray *)accessibilityVisibleChildren { return DYAccessibleSubviews(self,YES); } +- (NSArray *)accessibilityChildrenInNavigationOrder { return self.accessibilityChildren; } +- (void)viewDidMoveToWindow { + [super viewDidMoveToWindow]; + // The ancestor is layer backed. Keep AppKit's drawing clip and the layer + // clip aligned without creating a separate layer for every control row. + if(self.layer)self.layer.masksToBounds=YES; +} +@end + +@interface DYInspectorScrollView : NSScrollView @end +@implementation DYInspectorScrollView +- (BOOL)isAccessibilityElement { return YES; } +- (NSAccessibilityRole)accessibilityRole { return NSAccessibilityScrollAreaRole; } +- (NSArray *)accessibilityContents { return self.documentView?@[self.documentView]:@[]; } +- (NSArray *)accessibilityChildren { + NSMutableArray *children=[NSMutableArray arrayWithArray:self.accessibilityContents]; + NSScroller *vertical=self.verticalScroller,*horizontal=self.horizontalScroller; + if(self.hasVerticalScroller&&vertical&&!vertical.hidden)[children addObject:vertical]; + if(self.hasHorizontalScroller&&horizontal&&!horizontal.hidden)[children addObject:horizontal]; + return NSAccessibilityUnignoredChildren(children); +} +- (NSArray *)accessibilityVisibleChildren { return self.accessibilityChildren; } +- (NSArray *)accessibilityChildrenInNavigationOrder { return self.accessibilityChildren; } +- (id)accessibilityVerticalScrollBar { return self.hasVerticalScroller?self.verticalScroller:nil; } @end @interface DYCard : DYFlippedView @end @@ -281,7 +326,9 @@ static NSImage *DYWheelImage(void) { _cards=[[NSMutableArray alloc] init]; _controls=[[NSMutableDictionary alloc] init]; _assetButtons=[[NSMutableDictionary alloc] init]; _graphics=[[NSMutableArray alloc] init]; self.autoresizingMask=NSViewWidthSizable; - self.wantsLayer=YES; self.layer.backgroundColor=[[NSColor colorWithSRGBRed:.018 green:.074 blue:.12 alpha:1] CGColor]; + self.clipsToBounds=YES; + self.wantsLayer=YES; self.layer.masksToBounds=YES; + self.layer.backgroundColor=[[NSColor colorWithSRGBRed:.018 green:.074 blue:.12 alpha:1] CGColor]; _brand=[DYLabel(@"大鱼调色",20) retain]; _brand.font=[NSFont boldSystemFontOfSize:20]; _subtitle=[DYLabel(@"颜色 · 光影 · 风格",10) retain]; _subtitle.textColor=DYAccent(); _resetAll=[DYButton(@"全部还原",self,@selector(resetAll:)) retain]; _resetAll.toolTip=@"恢复全部调色参数与 LUT"; @@ -289,10 +336,15 @@ static NSImage *DYWheelImage(void) { _load=[DYButton(@"载入预设",self,@selector(loadPreset:)) retain]; _export=[DYButton(@"导出 LUT",self,@selector(exportLUT:)) retain]; for(NSView *v in @[_brand,_subtitle,_resetAll,_save,_load,_export]) [self addSubview:v]; - _scroll=[[NSScrollView alloc] initWithFrame:NSZeroRect]; + _scroll=[[DYInspectorScrollView alloc] initWithFrame:NSZeroRect]; _scroll.hasVerticalScroller=YES; _scroll.hasHorizontalScroller=NO; _scroll.drawsBackground=NO; _scroll.autohidesScrollers=YES; _scroll.borderType=NSNoBorder; + _scroll.clipsToBounds=YES;_scroll.wantsLayer=YES;_scroll.layer.masksToBounds=YES; + _scroll.contentView.clipsToBounds=YES; + _scroll.contentView.wantsLayer=YES;_scroll.contentView.layer.masksToBounds=YES; + _scroll.accessibilityLabel=@"调色参数滚动区"; _document=[[DYFlippedView alloc] initWithFrame:NSMakeRect(0,0,360,1000)]; + _document.accessibilityLabel=@"调色参数"; _scroll.documentView=_document; [self addSubview:_scroll]; [self buildCards]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(modelChanged:) name:@"DYModelChanged" object:_manager]; @@ -308,8 +360,19 @@ static NSImage *DYWheelImage(void) { [super dealloc]; } - (BOOL)isFlipped { return YES; } +- (BOOL)isAccessibilityElement { return YES; } +- (NSAccessibilityRole)accessibilityRole { return NSAccessibilityGroupRole; } +- (NSArray *)accessibilityChildren { return DYAccessibleSubviews(self,NO); } +- (NSArray *)accessibilityVisibleChildren { return DYAccessibleSubviews(self,YES); } +- (NSArray *)accessibilityChildrenInNavigationOrder { return self.accessibilityChildren; } - (NSSize)intrinsicContentSize { return NSMakeSize(360,780); } -- (void)viewDidMoveToWindow { [super viewDidMoveToWindow]; if(self.window) [self refresh]; } +- (void)viewDidMoveToWindow { + [super viewDidMoveToWindow]; + if(self.window) { + [self refresh]; + NSAccessibilityPostNotification(self,NSAccessibilityLayoutChangedNotification); + } +} - (void)modelChanged:(NSNotification *)n { if([NSThread isMainThread]) [self refresh]; else dispatch_async(dispatch_get_main_queue(),^{ [self refresh]; }); @@ -318,6 +381,7 @@ static NSImage *DYWheelImage(void) { NSInteger index=0; for(NSDictionary *section in _sections) { DYCard *card=[[[DYCard alloc] initWithFrame:NSZeroRect] autorelease]; + card.accessibilityLabel=section[@"title"]; [_document addSubview:card]; DYHeader *header=[[[DYHeader alloc] initWithFrame:NSZeroRect] autorelease]; header.title=[@"▾ " stringByAppendingString:section[@"title"]?:@""]; @@ -362,6 +426,7 @@ static NSImage *DYWheelImage(void) { } for(NSDictionary *d in section[@"rows"]) { DYFlippedView *row=[[[DYFlippedView alloc] initWithFrame:NSZeroRect] autorelease]; + row.accessibilityLabel=d[@"title"]; [card addSubview:row]; [body addObject:row]; NSNumber *pid=d[@"pid"]; if(!pid)continue; NSTextField *label=DYLabel(d[@"title"]?:d[@"key"],11); label.toolTip=d[@"title"]; @@ -558,6 +623,7 @@ static NSImage *DYWheelImage(void) { NSMutableDictionary *card=_cards[sender.tag];BOOL collapsed=![card[@"collapsed"] boolValue];card[@"collapsed"]=@(collapsed); sender.title=[(collapsed?@"▸ ":@"▾ ") stringByAppendingString:card[@"section"][@"title"]?:@""]; [self setNeedsLayout:YES]; + NSAccessibilityPostNotification(self,NSAccessibilityLayoutChangedNotification); } - (void)resetSection:(NSButton *)sender { if(sender.tag>=_cards.count)return; diff --git a/大鱼调色/Plugin/Info.plist b/大鱼调色/Plugin/Info.plist index b471517..0cdb50e 100644 --- a/大鱼调色/Plugin/Info.plist +++ b/大鱼调色/Plugin/Info.plist @@ -19,7 +19,7 @@ CFBundleShortVersionString 1.0.0 CFBundleVersion - 1 + 2 NSHumanReadableCopyright PlugInKit diff --git a/大鱼调色/Wrapper Application/Info.plist b/大鱼调色/Wrapper Application/Info.plist index 52a7272..17a4753 100644 --- a/大鱼调色/Wrapper Application/Info.plist +++ b/大鱼调色/Wrapper Application/Info.plist @@ -19,7 +19,7 @@ CFBundleShortVersionString 1.0.0 CFBundleVersion - 1 + 2 LSMinimumSystemVersion $(MACOSX_DEPLOYMENT_TARGET) NSHumanReadableCopyright