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:
@@ -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 )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user