mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-20 00:11:41 +00:00
API: Expose title block info
This commit is contained in:
parent
033fb4fc8f
commit
af71ea869e
api/proto/common
pcbnew/api
@ -309,3 +309,9 @@ message HitTestResponse
|
||||
{
|
||||
HitTestResult result = 1;
|
||||
}
|
||||
|
||||
// returns common.types.TitleBlockInfo
|
||||
message GetTitleBlockInfo
|
||||
{
|
||||
kiapi.common.types.DocumentSpecifier document = 1;
|
||||
}
|
||||
|
@ -338,3 +338,24 @@ message GraphicAttributes
|
||||
StrokeAttributes stroke = 1;
|
||||
GraphicFillAttributes fill = 2;
|
||||
}
|
||||
|
||||
// The text strings that can be set in a drawing sheet for the title block
|
||||
message TitleBlockInfo
|
||||
{
|
||||
string title = 1;
|
||||
string date = 2;
|
||||
string revision = 3;
|
||||
string company = 4;
|
||||
|
||||
// Note: not a repeated string; there can be gaps and the UI limits the count to 9
|
||||
|
||||
string comment1 = 5;
|
||||
string comment2 = 6;
|
||||
string comment3 = 7;
|
||||
string comment4 = 8;
|
||||
string comment5 = 9;
|
||||
string comment6 = 10;
|
||||
string comment7 = 11;
|
||||
string comment8 = 12;
|
||||
string comment9 = 13;
|
||||
}
|
||||
|
@ -69,6 +69,8 @@ API_HANDLER_PCB::API_HANDLER_PCB( PCB_EDIT_FRAME* aFrame ) :
|
||||
&API_HANDLER_PCB::handleGetTextExtents );
|
||||
registerHandler<GetPadShapeAsPolygon, PadShapeAsPolygonResponse>(
|
||||
&API_HANDLER_PCB::handleGetPadShapeAsPolygon );
|
||||
registerHandler<GetTitleBlockInfo, types::TitleBlockInfo>(
|
||||
&API_HANDLER_PCB::handleGetTitleBlockInfo );
|
||||
|
||||
registerHandler<InteractiveMoveItems, Empty>( &API_HANDLER_PCB::handleInteractiveMoveItems );
|
||||
registerHandler<GetNets, NetsResponse>( &API_HANDLER_PCB::handleGetNets );
|
||||
@ -683,6 +685,38 @@ HANDLER_RESULT<PadShapeAsPolygonResponse> API_HANDLER_PCB::handleGetPadShapeAsPo
|
||||
}
|
||||
|
||||
|
||||
HANDLER_RESULT<types::TitleBlockInfo> API_HANDLER_PCB::handleGetTitleBlockInfo(
|
||||
GetTitleBlockInfo& aMsg,
|
||||
const HANDLER_CONTEXT& aCtx )
|
||||
{
|
||||
HANDLER_RESULT<bool> documentValidation = validateDocument( aMsg.document() );
|
||||
|
||||
if( !documentValidation )
|
||||
return tl::unexpected( documentValidation.error() );
|
||||
|
||||
BOARD* board = frame()->GetBoard();
|
||||
const TITLE_BLOCK& block = board->GetTitleBlock();
|
||||
|
||||
types::TitleBlockInfo response;
|
||||
|
||||
response.set_title( block.GetTitle().ToUTF8() );
|
||||
response.set_date( block.GetDate().ToUTF8() );
|
||||
response.set_revision( block.GetRevision().ToUTF8() );
|
||||
response.set_company( block.GetCompany().ToUTF8() );
|
||||
response.set_comment1( block.GetComment( 0 ).ToUTF8() );
|
||||
response.set_comment2( block.GetComment( 1 ).ToUTF8() );
|
||||
response.set_comment3( block.GetComment( 2 ).ToUTF8() );
|
||||
response.set_comment4( block.GetComment( 3 ).ToUTF8() );
|
||||
response.set_comment5( block.GetComment( 4 ).ToUTF8() );
|
||||
response.set_comment6( block.GetComment( 5 ).ToUTF8() );
|
||||
response.set_comment7( block.GetComment( 6 ).ToUTF8() );
|
||||
response.set_comment8( block.GetComment( 7 ).ToUTF8() );
|
||||
response.set_comment9( block.GetComment( 8 ).ToUTF8() );
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
HANDLER_RESULT<Empty> API_HANDLER_PCB::handleInteractiveMoveItems( InteractiveMoveItems& aMsg,
|
||||
const HANDLER_CONTEXT& aCtx )
|
||||
{
|
||||
|
@ -81,6 +81,9 @@ private:
|
||||
HANDLER_RESULT<PadShapeAsPolygonResponse> handleGetPadShapeAsPolygon( GetPadShapeAsPolygon& aMsg,
|
||||
const HANDLER_CONTEXT& aCtx );
|
||||
|
||||
HANDLER_RESULT<types::TitleBlockInfo> handleGetTitleBlockInfo( commands::GetTitleBlockInfo& aMsg,
|
||||
const HANDLER_CONTEXT& aCtx );
|
||||
|
||||
HANDLER_RESULT<Empty> handleInteractiveMoveItems( InteractiveMoveItems& aMsg,
|
||||
const HANDLER_CONTEXT& aCtx );
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user