fix: own split resizing and verify unclipped native layer controls
这个提交包含在:
1 父节点
a9cf2eda29
当前提交
226b7e1e93
8 个文件已更改
+90
-14
没有与搜索条件相匹配的文件
@@ -16,6 +16,12 @@ static BOOL DYWorkspaceEnabled(DYUniforms u,NSString *type){if([type isEqual:@"b
|
||||
@implementation DYWorkspaceList
|
||||
- (BOOL)isFlipped{return YES;}
|
||||
@end
|
||||
@interface DYWorkspaceCell:NSTableCellView
|
||||
@property(nonatomic,assign) NSButton *bypass;
|
||||
@end
|
||||
@implementation DYWorkspaceCell
|
||||
- (void)resizeSubviewsWithOldSize:(NSSize)old{[super resizeSubviewsWithOldSize:old];CGFloat w=self.bounds.size.width;self.textField.frame=NSMakeRect(8,5,MAX(1,w-46),20);_bypass.frame=NSMakeRect(MAX(0,w-32),2,26,26);}
|
||||
@end
|
||||
|
||||
@class DYWorkspaceRoot;
|
||||
@interface DYColorWorkspace (Internal)
|
||||
|
||||
@@ -87,9 +87,9 @@
|
||||
[curveEditor graphicGesture:YES title:@"测试外部改值"];[stackHost startAction:stack];NSMutableDictionary *externalCurve=DYMutablePlist(DYReadTools(stackHost,kCMTimeZero).document);((NSMutableDictionary*)DYToolWithID(externalCurve,curveID))[@"values"][@"curveY0"]=@22;DYWriteTools(stackHost,externalCurve,kCMTimeZero);[stackHost endAction:stack];[curveEditor writeGraphicValues:@{@"curveY0":@44}];[curveEditor graphicGesture:NO title:nil];
|
||||
run.record(@"workspace-curve-gesture-preserves-an-external-parameter-edit",[DYToolWithID(DYReadTools(stackHost,kCMTimeZero).document,curveID)[@"values"][@"curveY0"]doubleValue]==22);
|
||||
NSView *workspaceRoot=[stack valueForKey:@"root"];[workspaceRoot layoutSubtreeIfNeeded];NSBitmapImageRep *workspaceImage=[workspaceRoot bitmapImageRepForCachingDisplayInRect:workspaceRoot.bounds];[workspaceRoot cacheDisplayInRect:workspaceRoot.bounds toBitmapImageRep:workspaceImage];[[workspaceImage representationUsingType:NSBitmapImageFileTypePNG properties:@{}]writeToFile:[runtime stringByAppendingPathComponent:@"workspace-adjustments.png"]atomically:YES];
|
||||
[stackHost->_parent setFrameSize:NSMakeSize(720,300)];[workspaceRoot layoutSubtreeIfNeeded];[table layoutSubtreeIfNeeded];BOOL eyesInside=YES;NSUInteger eyes=0;
|
||||
for(NSInteger row=0;row<table.numberOfRows;row++){NSTableCellView *cell=[table viewAtColumn:0 row:row makeIfNecessary:YES];[cell layoutSubtreeIfNeeded];for(NSView *view in cell.subviews)if([view isKindOfClass:NSButton.class]){NSRect frame=[table convertRect:view.bounds fromView:view];eyesInside&=NSContainsRect(table.visibleRect,frame)&&NSContainsRect(cell.bounds,view.frame);eyes++;}}
|
||||
run.record(@"workspace-native-row-bypass-buttons-remain-visible-at-minimum-width",eyesInside&&eyes==table.numberOfRows,@{@"buttons":@(eyes),@"rows":@(table.numberOfRows)});[stackHost->_parent setFrameSize:NSMakeSize(1120,360)];[workspaceRoot layoutSubtreeIfNeeded];
|
||||
[stackHost->_parent setFrameSize:NSMakeSize(720,300)];[workspaceRoot layoutSubtreeIfNeeded];[table layoutSubtreeIfNeeded];BOOL eyesInside=YES;NSUInteger eyes=0;NSMutableArray *buttonFrames=[NSMutableArray array];
|
||||
for(NSInteger row=0;row<table.numberOfRows;row++){NSTableCellView *cell=[table viewAtColumn:0 row:row makeIfNecessary:YES];[cell layoutSubtreeIfNeeded];for(NSView *view in cell.subviews)if([view isKindOfClass:NSButton.class]){NSRect frame=[table convertRect:view.bounds fromView:view];eyesInside&=NSContainsRect(table.visibleRect,frame)&&NSContainsRect(cell.bounds,view.frame);eyes++;[buttonFrames addObject:@{@"cell":NSStringFromRect(cell.bounds),@"button":NSStringFromRect(view.frame),@"table":NSStringFromRect(frame),@"visible":NSStringFromRect(table.visibleRect)}];}}
|
||||
run.record(@"workspace-native-row-bypass-buttons-remain-visible-at-minimum-width",eyesInside&&eyes==table.numberOfRows,@{@"buttons":@(eyes),@"rows":@(table.numberOfRows),@"frames":buttonFrames});[stackHost->_parent setFrameSize:NSMakeSize(1120,360)];[workspaceRoot layoutSubtreeIfNeeded];
|
||||
[stack addWorkspaceTool:toolbarButton(@"look")];workspaceDrain();NSString *lookA=[[[stack valueForKey:@"selectedNode"]copy]autorelease];[stack addWorkspaceTool:toolbarButton(@"look")];workspaceDrain();NSString *lookB=[[[stack valueForKey:@"selectedNode"]copy]autorelease];
|
||||
run.need(@"workspace-two-independent-lut-layer-fixtures-exist",lookA&&lookB&&![lookA isEqual:lookB]&&DYToolWithID(DYReadTools(stackHost,kCMTimeZero).document,lookA)&&DYToolWithID(DYReadTools(stackHost,kCMTimeZero).document,lookB));
|
||||
NSString *pathA=[runtime stringByAppendingPathComponent:@"workspace-A.cube"],*pathB=[runtime stringByAppendingPathComponent:@"workspace-B.cube"],*late=[runtime stringByAppendingPathComponent:@"workspace-late.cube"];NSDictionary *basePaths=[[DYReadAssets(stackHost,kCMTimeZero).paths copy]autorelease];NSError *failure=nil;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
CGFloat x=0;for(NSString *type in DYToolTypes()) {NSString *title=DYToolSection(type)[@"title"]?:type;NSButton *button=DYWorkspaceButton(title,self,@selector(addWorkspaceTool:));button.identifier=type;button.toolTip=[@"添加独立模块:" stringByAppendingString:title];NSDictionary *icons=@{@"primary":@"slider.horizontal.3",@"spider":@"circle.hexagongrid",@"base":@"sun.max",@"skin":@"person.crop.circle",@"look":@"square.stack.3d.up",@"hsl":@"paintpalette",@"curve":@"point.topleft.down.to.point.bottomright.curvepath",@"grading":@"circle.lefthalf.filled",@"primaries":@"circle.grid.2x2",@"levels":@"chart.bar",@"blackwhite":@"circle.righthalf.filled",@"balance":@"dial.low",@"mixer":@"slider.vertical.3",@"film":@"film",@"lens":@"camera.aperture"};button.image=[NSImage imageWithSystemSymbolName:icons[type] accessibilityDescription:title];button.imagePosition=NSImageOnly;button.contentTintColor=DYThemeColor(@"text");CGFloat width=34;button.frame=NSMakeRect(x,0,width,28);[_toolbar addSubview:button];x+=width+4;}_toolbar.frame=NSMakeRect(0,0,x,30);
|
||||
_split=[[NSSplitView alloc]init];_split.vertical=YES;_split.dividerStyle=NSSplitViewDividerStyleThin;_split.delegate=self;_split.accessibilityLabel=@"调整图层与参数宽度";[_root addSubview:_split];
|
||||
_toolPane=[[DYWorkspaceList alloc]init];_editorHost=[[DYWorkspaceList alloc]init];_editorHost.clipsToBounds=YES;[_split addSubview:_toolPane];[_split addSubview:_editorHost];
|
||||
_layerScroll=[[NSScrollView alloc]init];_layerScroll.hasVerticalScroller=YES;_layerScroll.autohidesScrollers=YES;_layerScroll.drawsBackground=NO;[_toolPane addSubview:_layerScroll];
|
||||
_layerScroll=[[NSScrollView alloc]init];_layerScroll.hasVerticalScroller=YES;_layerScroll.autohidesScrollers=YES;_layerScroll.scrollerStyle=NSScrollerStyleOverlay;_layerScroll.automaticallyAdjustsContentInsets=NO;_layerScroll.contentInsets=NSEdgeInsetsZero;_layerScroll.drawsBackground=NO;[_toolPane addSubview:_layerScroll];
|
||||
_layerTable=[[NSTableView alloc]init];_layerTable.style=NSTableViewStylePlain;_layerTable.intercellSpacing=NSZeroSize;NSTableColumn *column=[[[NSTableColumn alloc]initWithIdentifier:@"layer"]autorelease];column.title=@"模块与蒙版";[_layerTable addTableColumn:column];_layerTable.headerView=nil;_layerTable.rowHeight=30;_layerTable.dataSource=self;_layerTable.delegate=self;_layerTable.backgroundColor=DYThemeColor(@"background");_layerTable.columnAutoresizingStyle=NSTableViewLastColumnOnlyAutoresizingStyle;_layerTable.accessibilityLabel=@"模块与共享蒙版";_layerScroll.documentView=_layerTable;
|
||||
_addMask=[DYWorkspaceButton(@"+ 蒙版",self,@selector(addWorkspaceMask:))retain];[_toolPane addSubview:_addMask];
|
||||
_deleteLayer=[DYWorkspaceButton(@"删除",self,@selector(deleteWorkspaceSelection:))retain];[_toolPane addSubview:_deleteLayer];
|
||||
@@ -26,13 +26,14 @@
|
||||
if(!_split||_sizingSplit)return;_sizingSplit=YES;
|
||||
CGFloat w=_split.bounds.size.width,h=_split.bounds.size.height,left=MAX(174,MIN(w-320,w*_splitFraction));
|
||||
_toolPane.frame=NSMakeRect(0,0,left,h);_editorHost.frame=NSMakeRect(left+_split.dividerThickness,0,MAX(1,w-left-_split.dividerThickness),h);
|
||||
_layerScroll.frame=NSMakeRect(0,0,left,MAX(1,h-35));_layerTable.frame=NSMakeRect(0,0,_layerScroll.contentSize.width,MAX(_layerScroll.contentSize.height,_layerRows.count*30));[_layerTable.tableColumns.firstObject setWidth:_layerScroll.contentSize.width];_addMask.frame=NSMakeRect(6,MAX(0,h-32),MAX(80,left-76),28);_deleteLayer.frame=NSMakeRect(MAX(92,left-66),MAX(0,h-32),60,28);
|
||||
_layerScroll.frame=NSMakeRect(0,0,left,MAX(1,h-35));[_layerScroll layoutSubtreeIfNeeded];NSSize layerViewport=_layerScroll.contentView.bounds.size;_layerTable.frame=NSMakeRect(0,0,layerViewport.width,MAX(layerViewport.height,_layerRows.count*30));[_layerTable.tableColumns.firstObject setWidth:layerViewport.width];_addMask.frame=NSMakeRect(6,MAX(0,h-32),MAX(80,left-76),28);_deleteLayer.frame=NSMakeRect(MAX(92,left-66),MAX(0,h-32),60,28);
|
||||
CGFloat ew=_editorHost.bounds.size.width;_selectionTitle.frame=NSMakeRect(12,5,MAX(1,ew-24),22);_toolEditor.frame=NSMakeRect(0,29,ew,MAX(1,h-29));
|
||||
_maskPane.frame=NSMakeRect(0,29,ew,MAX(1,h-29));CGFloat aw=MIN(230,MAX(160,ew*.25));_assignmentScroll.frame=NSMakeRect(ew-aw,0,aw,_maskPane.bounds.size.height);_maskScroll.frame=NSMakeRect(0,0,MAX(1,ew-aw-8),_maskPane.bounds.size.height);
|
||||
if(_maskEditor){_maskEditor.frame=NSMakeRect(0,0,_maskScroll.contentSize.width,MAX(_maskScroll.contentSize.height,_maskEditor.contentHeight));[_maskEditor layoutSubtreeIfNeeded];_maskEditor.frame=NSMakeRect(0,0,_maskScroll.contentSize.width,MAX(_maskScroll.contentSize.height,_maskEditor.contentHeight));}
|
||||
_sizingSplit=NO;
|
||||
}
|
||||
- (CGFloat)splitView:(NSSplitView*)split constrainSplitPosition:(CGFloat)position ofSubviewAt:(NSInteger)index {return MAX(174,MIN(split.bounds.size.width-320,position));}
|
||||
- (void)splitView:(NSSplitView*)split resizeSubviewsWithOldSize:(NSSize)old{[self layoutToolWorkspace];}
|
||||
- (void)splitViewDidResizeSubviews:(NSNotification*)notification {if(_sizingSplit)return;if(NSApp.currentEvent.type!=NSEventTypeLeftMouseDragged&&NSApp.currentEvent.type!=NSEventTypeLeftMouseUp)return;_splitFraction=MAX(.12,MIN(.45,_toolPane.frame.size.width/MAX(1,_split.bounds.size.width)));[NSUserDefaults.standardUserDefaults setDouble:_splitFraction forKey:@"com.dayu.color.workspace.layerFraction.v2"];[self layoutWorkspace];}
|
||||
- (BOOL)workspaceBaseVisible:(NSString*)type document:(NSDictionary*)document time:(CMTime)time {
|
||||
if(DYBaseToolRemoved(document,type))return NO;
|
||||
@@ -71,9 +72,8 @@
|
||||
}
|
||||
- (NSInteger)numberOfRowsInTableView:(NSTableView*)table {return _layerRows.count;}
|
||||
- (NSView*)tableView:(NSTableView*)table viewForTableColumn:(NSTableColumn*)column row:(NSInteger)row {
|
||||
NSDictionary*item=_layerRows[row];NSTableCellView*cell=[[[NSTableCellView alloc]initWithFrame:NSMakeRect(0,0,column.width,table.rowHeight)]autorelease];NSTextField*label=[DYThemeLabel labelWithString:item[@"title"]];label.font=[NSFont systemFontOfSize:item[@"mask"]?11:12];label.lineBreakMode=NSLineBreakByTruncatingTail;label.translatesAutoresizingMaskIntoConstraints=NO;[cell addSubview:label];cell.textField=label;
|
||||
NSButton*eye=DYWorkspaceButton(@"",self,@selector(toggleWorkspaceRow:));eye.image=[NSImage imageWithSystemSymbolName:[item[@"enabled"]boolValue]?@"eye":@"eye.slash" accessibilityDescription:@"启用或旁路"];eye.bordered=NO;eye.imagePosition=NSImageOnly;eye.tag=row;eye.translatesAutoresizingMaskIntoConstraints=NO;eye.accessibilityLabel=[item[@"title"]stringByAppendingString:@"启用或旁路"];[cell addSubview:eye];
|
||||
[NSLayoutConstraint activateConstraints:@[[eye.trailingAnchor constraintEqualToAnchor:cell.trailingAnchor constant:-6],[eye.centerYAnchor constraintEqualToAnchor:cell.centerYAnchor],[eye.widthAnchor constraintEqualToConstant:26],[eye.heightAnchor constraintEqualToConstant:26],[label.leadingAnchor constraintEqualToAnchor:cell.leadingAnchor constant:8],[label.trailingAnchor constraintEqualToAnchor:eye.leadingAnchor constant:-4],[label.centerYAnchor constraintEqualToAnchor:cell.centerYAnchor],[label.heightAnchor constraintEqualToConstant:20]]];return cell;
|
||||
NSDictionary*item=_layerRows[row];DYWorkspaceCell*cell=[[[DYWorkspaceCell alloc]initWithFrame:NSMakeRect(0,0,column.width,table.rowHeight)]autorelease];NSTextField*label=[DYThemeLabel labelWithString:item[@"title"]];label.font=[NSFont systemFontOfSize:item[@"mask"]?11:12];label.lineBreakMode=NSLineBreakByTruncatingTail;[cell addSubview:label];cell.textField=label;
|
||||
NSButton*eye=DYWorkspaceButton(@"",self,@selector(toggleWorkspaceRow:));eye.bezelStyle=NSBezelStyleRegularSquare;eye.focusRingType=NSFocusRingTypeNone;eye.image=[NSImage imageWithSystemSymbolName:[item[@"enabled"]boolValue]?@"eye":@"eye.slash" accessibilityDescription:@"启用或旁路"];eye.bordered=NO;eye.imagePosition=NSImageOnly;eye.tag=row;eye.accessibilityLabel=[item[@"title"]stringByAppendingString:@"启用或旁路"];[cell addSubview:eye];cell.bypass=eye;[cell resizeSubviewsWithOldSize:cell.bounds.size];return cell;
|
||||
}
|
||||
- (void)tableViewSelectionDidChange:(NSNotification*)note {
|
||||
if(_refreshingStack)return;NSInteger row=_layerTable.selectedRow;if(row<0||row>=_layerRows.count)return;_hasUserSelection=YES;NSDictionary*item=_layerRows[row];[_selectedNode release];_selectedNode=[item[@"node"]copy];[_selectedMask release];_selectedMask=[item[@"mask"]copy];_pages.selectedSegment=_selectedMask?1:0;[self rebuildWorkspaceEditor];[self pageChanged:nil];
|
||||
|
||||
在新工单中引用
屏蔽一个用户