API: Add support for retrieving user names for all layers

(cherry picked from commit 3514d130cb)

Co-authored-by: Jon Evans <[email protected]>
This commit is contained in:
Jon Evans
2026-03-01 22:25:39 -05:00
parent 96d5de482a
commit f07f1083ac
3 changed files with 37 additions and 0 deletions
+20
View File
@@ -97,6 +97,7 @@ API_HANDLER_PCB::API_HANDLER_PCB( PCB_EDIT_FRAME* aFrame ) :
&API_HANDLER_PCB::handleExpandTextVariables );
registerHandler<GetBoardOrigin, types::Vector2>( &API_HANDLER_PCB::handleGetBoardOrigin );
registerHandler<SetBoardOrigin, Empty>( &API_HANDLER_PCB::handleSetBoardOrigin );
registerHandler<GetBoardLayerName, BoardLayerNameResponse>( &API_HANDLER_PCB::handleGetBoardLayerName );
registerHandler<InteractiveMoveItems, Empty>( &API_HANDLER_PCB::handleInteractiveMoveItems );
registerHandler<GetNets, NetsResponse>( &API_HANDLER_PCB::handleGetNets );
@@ -1172,6 +1173,25 @@ HANDLER_RESULT<Empty> API_HANDLER_PCB::handleSetBoardOrigin(
}
HANDLER_RESULT<BoardLayerNameResponse> API_HANDLER_PCB::handleGetBoardLayerName(
const HANDLER_CONTEXT<GetBoardLayerName>& aCtx )
{
if( HANDLER_RESULT<bool> documentValidation = validateDocument( aCtx.Request.board() );
!documentValidation )
{
return tl::unexpected( documentValidation.error() );
}
BoardLayerNameResponse response;
PCB_LAYER_ID id = FromProtoEnum<PCB_LAYER_ID>( aCtx.Request.layer() );
response.set_name( frame()->GetBoard()->GetLayerName( id ) );
return response;
}
HANDLER_RESULT<GetBoundingBoxResponse> API_HANDLER_PCB::handleGetBoundingBox(
const HANDLER_CONTEXT<GetBoundingBox>& aCtx )
{