KiCad PCB EDA Suite
Loading...
Searching...
No Matches
API_HANDLER_FOOTPRINT Class Reference

#include <api_handler_footprint.h>

Inheritance diagram for API_HANDLER_FOOTPRINT:
API_HANDLER_BOARD API_HANDLER_EDITOR API_HANDLER

Public Member Functions

 API_HANDLER_FOOTPRINT (FOOTPRINT_EDIT_FRAME *aFrame)
 
 API_HANDLER_FOOTPRINT (std::shared_ptr< FOOTPRINT_CONTEXT > aContext, FOOTPRINT_EDIT_FRAME *aFrame=nullptr)
 
API_RESULT Handle (ApiRequest &aMsg)
 Attempt to handle the given API request, if a handler exists in this class for the message.
 
virtual void onNetSettingsChanged ()
 Called on all registered handlers after project net settings (netclasses or netclass assignments) have been changed via the API.
 
void requestNetSettingsNotification ()
 
bool clearNetSettingsNotification ()
 Returns true if the notification had been requested at the time of the call.
 
void setApiServer (KICAD_API_SERVER *aServer)
 Set by KICAD_API_SERVER::RegisterHandler; null when the handler is not registered.
 
KICAD_API_SERVER * apiServer () const
 

Protected Types

typedef std::function< HANDLER_RESULT< ApiResponse >(ApiRequest &)> REQUEST_HANDLER
 A handler for outer messages (envelopes) that will unpack to inner messages and call a specific handler function.
 

Protected Member Functions

kiapi::common::types::DocumentType thisDocumentType () const override
 Override this to specify which document type this editor handles.
 
tl::expected< bool, ApiResponseStatus > validateDocumentInternal (const DocumentSpecifier &aDocument) const override
 
BOARD_ITEM_CONTAINER * getDefaultContainer () override
 
std::unique_ptr< COMMIT > createCommit () override
 Override this to create an appropriate COMMIT subclass for the frame in question.
 
void deleteItemsInternal (std::map< KIID, ItemDeletionStatus > &aItemsToDelete, const std::string &aClientName) override
 
std::optional< EDA_ITEM * > getItemFromDocument (const DocumentSpecifier &aDocument, const KIID &aId) override
 
void pushCurrentCommit (const std::string &aClientName, const wxString &aMessage) override
 
HANDLER_RESULT< types::ItemRequestStatus > handleCreateUpdateItemsInternal (bool aCreate, const std::string &aClientName, const types::ItemHeader &aHeader, const google::protobuf::RepeatedPtrField< google::protobuf::Any > &aItems, std::function< void(commands::ItemStatus, google::protobuf::Any)> aItemHandler) override
 
BOARD_CONTEXT * context () const
 
BOARD * board () const
 
PROJECT & project () const
 
TOOL_MANAGER * toolManager () const
 
std::optional< BOARD_ITEM * > getItemById (const KIID &aId) const
 
std::optional< ApiResponseStatus > checkForHeadless (const std::string &aCommandName) const
 
GENERATOR_TOOL * ensureGeneratorTool () const
 Creates the generator tool if needed (e.g. in headless mode); returns it if available.
 
void regenerateGenerators (GENERATOR_TOOL *aTool, BOARD_COMMIT *aCommit, const std::vector< PCB_GENERATOR * > &aGenerators, std::function< void(const KIID &, commands::ItemStatus)> aResultHandler) const
 
std::vector< KICAD_T > parseRequestedItemTypes (const google::protobuf::RepeatedField< int > &aTypes)
 
HANDLER_RESULT< std::optional< KIID > > validateItemHeaderDocument (const kiapi::common::types::ItemHeader &aHeader)
 If the header is valid, returns the item container.
 
HANDLER_RESULT< bool > validateDocument (const DocumentSpecifier &aDocument)
 
virtual std::optional< ApiResponseStatus > checkForBusy ()
 Checks if the editor can accept commands.
 
HANDLER_RESULT< commands::BeginCommitResponse > handleBeginCommit (const HANDLER_CONTEXT< commands::BeginCommit > &aCtx)
 
HANDLER_RESULT< commands::EndCommitResponse > handleEndCommit (const HANDLER_CONTEXT< commands::EndCommit > &aCtx)
 
COMMIT * getCurrentCommit (const std::string &aClientName)
 
HANDLER_RESULT< commands::CreateItemsResponse > handleCreateItems (const HANDLER_CONTEXT< commands::CreateItems > &aCtx)
 
HANDLER_RESULT< commands::UpdateItemsResponse > handleUpdateItems (const HANDLER_CONTEXT< commands::UpdateItems > &aCtx)
 
HANDLER_RESULT< commands::DeleteItemsResponse > handleDeleteItems (const HANDLER_CONTEXT< commands::DeleteItems > &aCtx)
 
HANDLER_RESULT< commands::HitTestResponse > handleHitTest (const HANDLER_CONTEXT< commands::HitTest > &aCtx)
 
virtual HANDLER_RESULT< commands::GetDocumentModifiedStateResponse > handleGetDocumentModifiedState (const HANDLER_CONTEXT< commands::GetDocumentModifiedState > &aCtx)
 
HANDLER_RESULT< types::TitleBlockInfo > handleGetTitleBlockInfo (const HANDLER_CONTEXT< commands::GetTitleBlockInfo > &aCtx)
 
HANDLER_RESULT< google::protobuf::Empty > handleSetTitleBlockInfo (const HANDLER_CONTEXT< commands::SetTitleBlockInfo > &aCtx)
 
HANDLER_RESULT< types::PageSettings > handleGetPageSettings (const HANDLER_CONTEXT< commands::GetPageSettings > &aCtx)
 
HANDLER_RESULT< types::PageSettings > handleSetPageSettings (const HANDLER_CONTEXT< commands::SetPageSettings > &aCtx)
 
virtual const EDA_IU_SCALE & getIuScale () const
 Returns the internal-unit scale that the concrete editor uses.
 
virtual std::optional< TITLE_BLOCK * > getTitleBlock (const DocumentSpecifier &aDocument)
 
virtual std::optional< PAGE_INFO > getPageSettings (const DocumentSpecifier &aDocument)
 
virtual bool setPageSettings (const DocumentSpecifier &aDocument, const PAGE_INFO &aPageInfo)
 
virtual wxString getDrawingSheetFileName ()
 
virtual void setDrawingSheetFileName (const wxString &aFileName)
 
virtual void onModified ()
 
template<class RequestType, class ResponseType, class HandlerType>
void registerHandler (HANDLER_RESULT< ResponseType >(HandlerType::*aHandler)(const HANDLER_CONTEXT< RequestType > &))
 Registers an API command handler for the given message types.
 

Static Protected Member Functions

static HANDLER_RESULT< std::unique_ptr< BOARD_ITEM > > createItemForType (KICAD_T aType, BOARD_ITEM_CONTAINER *aContainer)
 

Protected Attributes

std::map< std::string, std::pair< KIID, std::unique_ptr< COMMIT > > > m_commits
 
std::set< std::string > m_activeClients
 
EDA_BASE_FRAME * m_frame
 
std::map< std::string, REQUEST_HANDLER > m_handlers
 Maps type name (without the URL prefix) to a handler method.
 
bool m_notifyNetSettings = false
 
KICAD_API_SERVER * m_apiServer = nullptr
 

Static Protected Attributes

static const wxString m_defaultCommitMessage = _( "Modification from API" )
 

Private Member Functions

HANDLER_RESULT< Empty > handleOpenLibraryItem (const HANDLER_CONTEXT< commands::OpenLibraryItem > &aCtx)
 
HANDLER_RESULT< commands::GetOpenDocumentsResponse > handleGetOpenDocuments (const HANDLER_CONTEXT< commands::GetOpenDocuments > &aCtx)
 
HANDLER_RESULT< Empty > handleSaveDocument (const HANDLER_CONTEXT< commands::SaveDocument > &aCtx)
 
HANDLER_RESULT< Empty > handleSaveCopyOfDocument (const HANDLER_CONTEXT< commands::SaveCopyOfDocument > &aCtx)
 
HANDLER_RESULT< Empty > handleRevertDocument (const HANDLER_CONTEXT< commands::RevertDocument > &aCtx)
 
HANDLER_RESULT< commands::GetItemsResponse > handleGetItems (const HANDLER_CONTEXT< commands::GetItems > &aCtx)
 
FOOTPRINT_CONTEXT * footprintContext () const
 
FOOTPRINT_EDIT_FRAME * frame () const
 
HANDLER_RESULT< FOOTPRINT * > validateAndGetFootprint (const DocumentSpecifier &aDocument)
 
HANDLER_RESULT< commands::RunActionResponse > handleRunAction (const HANDLER_CONTEXT< commands::RunAction > &aCtx)
 
HANDLER_RESULT< commands::GetItemsResponse > handleGetItemsById (const HANDLER_CONTEXT< commands::GetItemsById > &aCtx)
 
HANDLER_RESULT< commands::SelectionResponse > handleGetSelection (const HANDLER_CONTEXT< commands::GetSelection > &aCtx)
 
HANDLER_RESULT< Empty > handleClearSelection (const HANDLER_CONTEXT< commands::ClearSelection > &aCtx)
 
HANDLER_RESULT< commands::SelectionResponse > handleAddToSelection (const HANDLER_CONTEXT< commands::AddToSelection > &aCtx)
 
HANDLER_RESULT< commands::SelectionResponse > handleRemoveFromSelection (const HANDLER_CONTEXT< commands::RemoveFromSelection > &aCtx)
 
HANDLER_RESULT< Empty > handleFocusOnItems (const HANDLER_CONTEXT< commands::FocusOnItems > &aCtx)
 
HANDLER_RESULT< BoardStackupResponse > handleGetStackup (const HANDLER_CONTEXT< GetBoardStackup > &aCtx)
 
HANDLER_RESULT< BoardEnabledLayersResponse > handleGetBoardEnabledLayers (const HANDLER_CONTEXT< GetBoardEnabledLayers > &aCtx)
 
HANDLER_RESULT< GraphicsDefaultsResponse > handleGetGraphicsDefaults (const HANDLER_CONTEXT< GetGraphicsDefaults > &aCtx)
 
HANDLER_RESULT< commands::GetBoundingBoxResponse > handleGetBoundingBox (const HANDLER_CONTEXT< commands::GetBoundingBox > &aCtx)
 
HANDLER_RESULT< BoardBoundingBoxResponse > handleGetBoardBoundingBox (const HANDLER_CONTEXT< GetBoardBoundingBox > &aCtx)
 
HANDLER_RESULT< PadShapeAsPolygonResponse > handleGetPadShapeAsPolygon (const HANDLER_CONTEXT< GetPadShapeAsPolygon > &aCtx)
 
HANDLER_RESULT< PadstackPresenceResponse > handleCheckPadstackPresenceOnLayers (const HANDLER_CONTEXT< CheckPadstackPresenceOnLayers > &aCtx)
 
HANDLER_RESULT< commands::ExpandTextVariablesResponse > handleExpandTextVariables (const HANDLER_CONTEXT< commands::ExpandTextVariables > &aCtx)
 
HANDLER_RESULT< Empty > handleInteractiveMoveItems (const HANDLER_CONTEXT< InteractiveMoveItems > &aCtx)
 
HANDLER_RESULT< FlipItemsResponse > handleFlipItems (const HANDLER_CONTEXT< FlipItems > &aCtx)
 
HANDLER_RESULT< commands::SavedDocumentResponse > handleSaveDocumentToString (const HANDLER_CONTEXT< commands::SaveDocumentToString > &aCtx)
 
HANDLER_RESULT< commands::SavedSelectionResponse > handleSaveSelectionToString (const HANDLER_CONTEXT< commands::SaveSelectionToString > &aCtx)
 
HANDLER_RESULT< commands::CreateItemsResponse > handleParseAndCreateItemsFromString (const HANDLER_CONTEXT< commands::ParseAndCreateItemsFromString > &aCtx)
 
HANDLER_RESULT< BoardLayers > handleGetVisibleLayers (const HANDLER_CONTEXT< GetVisibleLayers > &aCtx)
 
HANDLER_RESULT< Empty > handleSetVisibleLayers (const HANDLER_CONTEXT< SetVisibleLayers > &aCtx)
 
HANDLER_RESULT< BoardLayerResponse > handleGetActiveLayer (const HANDLER_CONTEXT< GetActiveLayer > &aCtx)
 
HANDLER_RESULT< Empty > handleSetActiveLayer (const HANDLER_CONTEXT< SetActiveLayer > &aCtx)
 
template<typename MessageType>
bool tryUnpack (ApiRequest &aRequest, ApiResponse &aReply, MessageType &aDest)
 

Private Attributes

std::shared_ptr< BOARD_CONTEXT > m_context
 

Detailed Description

Definition at line 33 of file api_handler_footprint.h.

Member Typedef Documentation

◆ REQUEST_HANDLER

typedef std::function<HANDLER_RESULT<ApiResponse>( ApiRequest& )> API_HANDLER::REQUEST_HANDLER
protectedinherited

A handler for outer messages (envelopes) that will unpack to inner messages and call a specific handler function.

See also
registerHandler.

Definition at line 97 of file api_handler.h.

Constructor & Destructor Documentation

◆ API_HANDLER_FOOTPRINT() [1/2]

API_HANDLER_FOOTPRINT::API_HANDLER_FOOTPRINT ( FOOTPRINT_EDIT_FRAME * aFrame)

◆ API_HANDLER_FOOTPRINT() [2/2]

Member Function Documentation

◆ apiServer()

KICAD_API_SERVER * API_HANDLER::apiServer ( ) const
inlineinherited

◆ board()

BOARD * API_HANDLER_BOARD::board ( ) const
inlineprotectedinherited

Definition at line 79 of file api_handler_board.h.

References context(), and BOARD_CONTEXT::GetBoard().

Referenced by deleteItemsInternal(), getDefaultContainer(), API_HANDLER_FOOTPRINT::getDefaultContainer(), getItemById(), API_HANDLER_PCB::handleAddEmbeddedFiles(), API_HANDLER_PCB::handleAddVariant(), API_HANDLER_PCB::handleCopyVariant(), handleCreateUpdateItemsInternal(), API_HANDLER_PCB::handleDeleteVariant(), handleExpandTextVariables(), handleGetBoardBoundingBox(), API_HANDLER_PCB::handleGetBoardDesignRules(), handleGetBoardEnabledLayers(), API_HANDLER_PCB::handleGetBoardLayerByName(), API_HANDLER_PCB::handleGetBoardLayerName(), API_HANDLER_PCB::handleGetBoardOrigin(), API_HANDLER_PCB::handleGetBoardPlotSettings(), API_HANDLER_PCB::handleGetConnectedItems(), API_HANDLER_PCB::handleGetCustomDesignRules(), API_HANDLER_PCB::handleGetEmbeddedFiles(), handleGetGraphicsDefaults(), API_HANDLER_FOOTPRINT::handleGetItems(), API_HANDLER_PCB::handleGetItems(), API_HANDLER_PCB::handleGetItemsByNet(), API_HANDLER_PCB::handleGetItemsByNetClass(), API_HANDLER_PCB::handleGetNetClassForNets(), API_HANDLER_PCB::handleGetNets(), API_HANDLER_FOOTPRINT::handleGetOpenDocuments(), handleGetStackup(), API_HANDLER_PCB::handleGetVariants(), handleGetVisibleLayers(), API_HANDLER_PCB::handlePlaceFootprintFromLibrary(), API_HANDLER_PCB::handleRefillZones(), API_HANDLER_PCB::handleRenameVariant(), API_HANDLER_PCB::handleSaveCopyOfDocument(), API_HANDLER_PCB::handleSaveDocument(), handleSaveDocumentToString(), handleSaveSelectionToString(), handleSetActiveLayer(), API_HANDLER_PCB::handleSetBoardDesignRules(), API_HANDLER_PCB::handleSetBoardEnabledLayers(), API_HANDLER_PCB::handleSetBoardOrigin(), API_HANDLER_PCB::handleSetBoardPlotSettings(), API_HANDLER_PCB::handleSetCurrentVariant(), API_HANDLER_PCB::handleSetCustomDesignRules(), API_HANDLER_PCB::handleSetEmbeddedFiles(), API_HANDLER_PCB::handleSetVariantDescription(), handleSetVisibleLayers(), API_HANDLER_PCB::handleSyncSelection(), API_HANDLER_PCB::onNetSettingsChanged(), regenerateGenerators(), API_HANDLER_FOOTPRINT::validateAndGetFootprint(), and API_HANDLER_FOOTPRINT::validateDocumentInternal().

◆ checkForBusy()

std::optional< ApiResponseStatus > API_HANDLER_EDITOR::checkForBusy ( )
protectedvirtualinherited

Checks if the editor can accept commands.

Returns
an error status if busy, std::nullopt if not busy

Definition at line 218 of file api_handler_editor.cpp.

References m_frame.

Referenced by API_HANDLER_PCB::handleAddEmbeddedFiles(), API_HANDLER_BOARD::handleAddToSelection(), API_HANDLER_SCH::handleAddToSelection(), API_HANDLER_PCB::handleAddVariant(), API_HANDLER_SCH::handleAddVariant(), handleBeginCommit(), API_HANDLER_BOARD::handleClearSelection(), API_HANDLER_SCH::handleClearSelection(), API_HANDLER_PCB::handleCopyVariant(), API_HANDLER_SCH::handleCopyVariant(), handleCreateItems(), handleDeleteItems(), API_HANDLER_PCB::handleDeleteVariant(), API_HANDLER_SCH::handleDeleteVariant(), handleEndCommit(), API_HANDLER_BOARD::handleFlipItems(), API_HANDLER_BOARD::handleFocusOnItems(), API_HANDLER_SCH::handleFocusOnItems(), API_HANDLER_BOARD::handleGetBoardBoundingBox(), API_HANDLER_BOARD::handleGetBoundingBox(), API_HANDLER_PCB::handleGetConnectedItems(), API_HANDLER_FOOTPRINT::handleGetItems(), API_HANDLER_PCB::handleGetItems(), API_HANDLER_SCH::handleGetItems(), API_HANDLER_SYMBOL::handleGetItems(), API_HANDLER_BOARD::handleGetItemsById(), API_HANDLER_SCH::handleGetItemsById(), API_HANDLER_SYMBOL::handleGetItemsById(), API_HANDLER_PCB::handleGetItemsByNet(), API_HANDLER_PCB::handleGetItemsByNetClass(), API_HANDLER_SCH::handleGetSchematicNetlist(), API_HANDLER_PCB::handleGetVariants(), API_HANDLER_SCH::handleGetVariants(), handleHitTest(), API_HANDLER_PCB::handleImportNetlist(), API_HANDLER_PCB::handleInjectDrcError(), API_HANDLER_BOARD::handleInteractiveMoveItems(), API_HANDLER_BOARD::handleParseAndCreateItemsFromString(), API_HANDLER_PCB::handlePlaceFootprintFromLibrary(), API_HANDLER_SCH::handlePlaceSymbolFromLibrary(), API_HANDLER_PCB::handleRefillZones(), API_HANDLER_BOARD::handleRemoveFromSelection(), API_HANDLER_SCH::handleRemoveFromSelection(), API_HANDLER_PCB::handleRenameVariant(), API_HANDLER_SCH::handleRenameVariant(), API_HANDLER_FOOTPRINT::handleRevertDocument(), API_HANDLER_PCB::handleRevertDocument(), API_HANDLER_SCH::handleRevertDocument(), API_HANDLER_SYMBOL::handleRevertDocument(), API_HANDLER_BOARD::handleRunAction(), API_HANDLER_PCB::handleRunBoardJobExport3D(), API_HANDLER_PCB::handleRunBoardJobExportDrill(), API_HANDLER_PCB::handleRunBoardJobExportDxf(), API_HANDLER_PCB::handleRunBoardJobExportGencad(), API_HANDLER_PCB::handleRunBoardJobExportGerbers(), API_HANDLER_PCB::handleRunBoardJobExportIdf(), API_HANDLER_PCB::handleRunBoardJobExportIpc2581(), API_HANDLER_PCB::handleRunBoardJobExportIpcD356(), API_HANDLER_PCB::handleRunBoardJobExportODB(), API_HANDLER_PCB::handleRunBoardJobExportPdf(), API_HANDLER_PCB::handleRunBoardJobExportPng(), API_HANDLER_PCB::handleRunBoardJobExportPosition(), API_HANDLER_PCB::handleRunBoardJobExportPs(), API_HANDLER_PCB::handleRunBoardJobExportRender(), API_HANDLER_PCB::handleRunBoardJobExportStats(), API_HANDLER_PCB::handleRunBoardJobExportSvg(), API_HANDLER_SCH::handleRunSchematicJobExportBOM(), API_HANDLER_SCH::handleRunSchematicJobExportDxf(), API_HANDLER_SCH::handleRunSchematicJobExportNetlist(), API_HANDLER_SCH::handleRunSchematicJobExportPdf(), API_HANDLER_SCH::handleRunSchematicJobExportPng(), API_HANDLER_SCH::handleRunSchematicJobExportPs(), API_HANDLER_SCH::handleRunSchematicJobExportSvg(), API_HANDLER_PCB::handleSaveCopyOfDocument(), API_HANDLER_SCH::handleSaveCopyOfDocument(), API_HANDLER_SYMBOL::handleSaveCopyOfDocument(), API_HANDLER_PCB::handleSaveDocument(), API_HANDLER_SCH::handleSaveDocument(), API_HANDLER_SYMBOL::handleSaveDocument(), API_HANDLER_PCB::handleSaveDocumentAs(), API_HANDLER_SCH::handleSaveDocumentAs(), API_HANDLER_BOARD::handleSetActiveLayer(), API_HANDLER_PCB::handleSetBoardEditorAppearanceSettings(), API_HANDLER_PCB::handleSetBoardOrigin(), API_HANDLER_PCB::handleSetBoardPlotSettings(), API_HANDLER_PCB::handleSetCurrentVariant(), API_HANDLER_SCH::handleSetCurrentVariant(), API_HANDLER_PCB::handleSetEmbeddedFiles(), API_HANDLER_PCB::handleSetVariantDescription(), API_HANDLER_SCH::handleSetVariantDescription(), API_HANDLER_BOARD::handleSetVisibleLayers(), handleUpdateItems(), and API_HANDLER_FOOTPRINT::validateAndGetFootprint().

◆ checkForHeadless()

◆ clearNetSettingsNotification()

bool API_HANDLER::clearNetSettingsNotification ( )
inlineinherited

Returns true if the notification had been requested at the time of the call.

Definition at line 81 of file api_handler.h.

References m_notifyNetSettings.

◆ context()

◆ createCommit()

std::unique_ptr< COMMIT > API_HANDLER_BOARD::createCommit ( )
overrideprotectedvirtualinherited

Override this to create an appropriate COMMIT subclass for the frame in question.

Returns
a new COMMIT, bound to the editor frame

Implements API_HANDLER_EDITOR.

Definition at line 137 of file api_handler_board.cpp.

References API_HANDLER_EDITOR::m_frame, API_HANDLER_EDITOR::thisDocumentType(), and toolManager().

Referenced by API_HANDLER_PCB::handleRefillZones().

◆ createItemForType()

◆ deleteItemsInternal()

void API_HANDLER_BOARD::deleteItemsInternal ( std::map< KIID, ItemDeletionStatus > & aItemsToDelete,
const std::string & aClientName )
overrideprotectedvirtualinherited

◆ ensureGeneratorTool()

GENERATOR_TOOL * API_HANDLER_BOARD::ensureGeneratorTool ( ) const
protectedinherited

Creates the generator tool if needed (e.g. in headless mode); returns it if available.

Definition at line 286 of file api_handler_board.cpp.

References TOOL_MANAGER::FindTool(), GENERATOR_TOOL_NAME, TOOL_MANAGER::GetTool(), TOOL_MANAGER::RegisterTool(), TOOL_MANAGER::ResetTools(), TOOL_BASE::RUN, and toolManager().

Referenced by deleteItemsInternal(), and handleCreateUpdateItemsInternal().

◆ footprintContext()

FOOTPRINT_CONTEXT * API_HANDLER_FOOTPRINT::footprintContext ( ) const
inlineprivate

◆ frame()

FOOTPRINT_EDIT_FRAME * API_HANDLER_FOOTPRINT::frame ( ) const
private

Definition at line 68 of file api_handler_footprint.cpp.

References API_HANDLER_EDITOR::m_frame.

Referenced by handleOpenLibraryItem(), and handleRevertDocument().

◆ getCurrentCommit()

◆ getDefaultContainer()

BOARD_ITEM_CONTAINER * API_HANDLER_FOOTPRINT::getDefaultContainer ( )
overrideprotectedvirtual

Reimplemented from API_HANDLER_BOARD.

Definition at line 530 of file api_handler_footprint.cpp.

References API_HANDLER_BOARD::board(), and BOARD::GetFirstFootprint().

◆ getDrawingSheetFileName()

virtual wxString API_HANDLER_EDITOR::getDrawingSheetFileName ( )
inlineprotectedvirtualinherited

Reimplemented in API_HANDLER_PCB, and API_HANDLER_SCH.

Definition at line 141 of file api_handler_editor.h.

Referenced by handleGetPageSettings(), and handleSetPageSettings().

◆ getItemById()

◆ getItemFromDocument()

std::optional< EDA_ITEM * > API_HANDLER_BOARD::getItemFromDocument ( const DocumentSpecifier & aDocument,
const KIID & aId )
overrideprotectedvirtualinherited

Implements API_HANDLER_EDITOR.

Definition at line 333 of file api_handler_board.cpp.

References getItemById(), and API_HANDLER_EDITOR::validateDocument().

◆ getIuScale()

virtual const EDA_IU_SCALE & API_HANDLER_EDITOR::getIuScale ( ) const
inlineprotectedvirtualinherited

Returns the internal-unit scale that the concrete editor uses.

API wire coordinates are always in nanometers, so this scale drives conversion to the editor's native IU. Defaults to pcbIUScale; schematic-like editors must override.

Reimplemented in API_HANDLER_SCH, and API_HANDLER_SYMBOL.

Definition at line 119 of file api_handler_editor.h.

References pcbIUScale.

Referenced by handleHitTest().

◆ getPageSettings()

virtual std::optional< PAGE_INFO > API_HANDLER_EDITOR::getPageSettings ( const DocumentSpecifier & aDocument)
inlineprotectedvirtualinherited

Reimplemented in API_HANDLER_PCB, and API_HANDLER_SCH.

Definition at line 137 of file api_handler_editor.h.

Referenced by handleGetPageSettings(), and handleSetPageSettings().

◆ getTitleBlock()

virtual std::optional< TITLE_BLOCK * > API_HANDLER_EDITOR::getTitleBlock ( const DocumentSpecifier & aDocument)
inlineprotectedvirtualinherited

Reimplemented in API_HANDLER_PCB, and API_HANDLER_SCH.

Definition at line 135 of file api_handler_editor.h.

Referenced by handleGetTitleBlockInfo(), and handleSetTitleBlockInfo().

◆ Handle()

API_RESULT API_HANDLER::Handle ( ApiRequest & aMsg)
inherited

Attempt to handle the given API request, if a handler exists in this class for the message.

Parameters
aMsgis a request to attempt to handle
Returns
a response to send to the client, or an appropriate error

Definition at line 30 of file api_handler.cpp.

References m_handlers.

Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().

◆ handleAddToSelection()

◆ handleBeginCommit()

HANDLER_RESULT< BeginCommitResponse > API_HANDLER_EDITOR::handleBeginCommit ( const HANDLER_CONTEXT< commands::BeginCommit > & aCtx)
protectedinherited

◆ handleCheckPadstackPresenceOnLayers()

HANDLER_RESULT< PadstackPresenceResponse > API_HANDLER_BOARD::handleCheckPadstackPresenceOnLayers ( const HANDLER_CONTEXT< CheckPadstackPresenceOnLayers > & aCtx)
privateinherited

◆ handleClearSelection()

◆ handleCreateItems()

HANDLER_RESULT< CreateItemsResponse > API_HANDLER_EDITOR::handleCreateItems ( const HANDLER_CONTEXT< commands::CreateItems > & aCtx)
protectedinherited

◆ handleCreateUpdateItemsInternal()

HANDLER_RESULT< ItemRequestStatus > API_HANDLER_BOARD::handleCreateUpdateItemsInternal ( bool aCreate,
const std::string & aClientName,
const types::ItemHeader & aHeader,
const google::protobuf::RepeatedPtrField< google::protobuf::Any > & aItems,
std::function< void(commands::ItemStatus, google::protobuf::Any)> aItemHandler )
overrideprotectedvirtualinherited

◆ handleDeleteItems()

HANDLER_RESULT< DeleteItemsResponse > API_HANDLER_EDITOR::handleDeleteItems ( const HANDLER_CONTEXT< commands::DeleteItems > & aCtx)
protectedinherited

◆ handleEndCommit()

HANDLER_RESULT< EndCommitResponse > API_HANDLER_EDITOR::handleEndCommit ( const HANDLER_CONTEXT< commands::EndCommit > & aCtx)
protectedinherited

◆ handleExpandTextVariables()

HANDLER_RESULT< ExpandTextVariablesResponse > API_HANDLER_BOARD::handleExpandTextVariables ( const HANDLER_CONTEXT< commands::ExpandTextVariables > & aCtx)
privateinherited

◆ handleFlipItems()

◆ handleFocusOnItems()

◆ handleGetActiveLayer()

HANDLER_RESULT< BoardLayerResponse > API_HANDLER_BOARD::handleGetActiveLayer ( const HANDLER_CONTEXT< GetActiveLayer > & aCtx)
privateinherited

◆ handleGetBoardBoundingBox()

◆ handleGetBoardEnabledLayers()

HANDLER_RESULT< BoardEnabledLayersResponse > API_HANDLER_BOARD::handleGetBoardEnabledLayers ( const HANDLER_CONTEXT< GetBoardEnabledLayers > & aCtx)
privateinherited

◆ handleGetBoundingBox()

HANDLER_RESULT< GetBoundingBoxResponse > API_HANDLER_BOARD::handleGetBoundingBox ( const HANDLER_CONTEXT< commands::GetBoundingBox > & aCtx)
privateinherited

◆ handleGetDocumentModifiedState()

HANDLER_RESULT< GetDocumentModifiedStateResponse > API_HANDLER_EDITOR::handleGetDocumentModifiedState ( const HANDLER_CONTEXT< commands::GetDocumentModifiedState > & aCtx)
protectedvirtualinherited

◆ handleGetGraphicsDefaults()

◆ handleGetItems()

◆ handleGetItemsById()

HANDLER_RESULT< GetItemsResponse > API_HANDLER_BOARD::handleGetItemsById ( const HANDLER_CONTEXT< commands::GetItemsById > & aCtx)
privateinherited

◆ handleGetOpenDocuments()

HANDLER_RESULT< GetOpenDocumentsResponse > API_HANDLER_FOOTPRINT::handleGetOpenDocuments ( const HANDLER_CONTEXT< commands::GetOpenDocuments > & aCtx)
private

◆ handleGetPadShapeAsPolygon()

HANDLER_RESULT< PadShapeAsPolygonResponse > API_HANDLER_BOARD::handleGetPadShapeAsPolygon ( const HANDLER_CONTEXT< GetPadShapeAsPolygon > & aCtx)
privateinherited

◆ handleGetPageSettings()

◆ handleGetSelection()

◆ handleGetStackup()

HANDLER_RESULT< BoardStackupResponse > API_HANDLER_BOARD::handleGetStackup ( const HANDLER_CONTEXT< GetBoardStackup > & aCtx)
privateinherited

◆ handleGetTitleBlockInfo()

HANDLER_RESULT< types::TitleBlockInfo > API_HANDLER_EDITOR::handleGetTitleBlockInfo ( const HANDLER_CONTEXT< commands::GetTitleBlockInfo > & aCtx)
protectedinherited

◆ handleGetVisibleLayers()

HANDLER_RESULT< BoardLayers > API_HANDLER_BOARD::handleGetVisibleLayers ( const HANDLER_CONTEXT< GetVisibleLayers > & aCtx)
privateinherited

◆ handleHitTest()

HANDLER_RESULT< HitTestResponse > API_HANDLER_EDITOR::handleHitTest ( const HANDLER_CONTEXT< commands::HitTest > & aCtx)
protectedinherited

◆ handleInteractiveMoveItems()

◆ handleOpenLibraryItem()

◆ handleParseAndCreateItemsFromString()

HANDLER_RESULT< CreateItemsResponse > API_HANDLER_BOARD::handleParseAndCreateItemsFromString ( const HANDLER_CONTEXT< commands::ParseAndCreateItemsFromString > & aCtx)
privateinherited

◆ handleRemoveFromSelection()

◆ handleRevertDocument()

◆ handleRunAction()

HANDLER_RESULT< RunActionResponse > API_HANDLER_BOARD::handleRunAction ( const HANDLER_CONTEXT< commands::RunAction > & aCtx)
privateinherited

◆ handleSaveCopyOfDocument()

◆ handleSaveDocument()

HANDLER_RESULT< Empty > API_HANDLER_FOOTPRINT::handleSaveDocument ( const HANDLER_CONTEXT< commands::SaveDocument > & aCtx)
private

◆ handleSaveDocumentToString()

HANDLER_RESULT< SavedDocumentResponse > API_HANDLER_BOARD::handleSaveDocumentToString ( const HANDLER_CONTEXT< commands::SaveDocumentToString > & aCtx)
privateinherited

◆ handleSaveSelectionToString()

HANDLER_RESULT< SavedSelectionResponse > API_HANDLER_BOARD::handleSaveSelectionToString ( const HANDLER_CONTEXT< commands::SaveSelectionToString > & aCtx)
privateinherited

◆ handleSetActiveLayer()

◆ handleSetPageSettings()

◆ handleSetTitleBlockInfo()

HANDLER_RESULT< google::protobuf::Empty > API_HANDLER_EDITOR::handleSetTitleBlockInfo ( const HANDLER_CONTEXT< commands::SetTitleBlockInfo > & aCtx)
protectedinherited

◆ handleSetVisibleLayers()

◆ handleUpdateItems()

HANDLER_RESULT< UpdateItemsResponse > API_HANDLER_EDITOR::handleUpdateItems ( const HANDLER_CONTEXT< commands::UpdateItems > & aCtx)
protectedinherited

◆ onModified()

virtual void API_HANDLER_EDITOR::onModified ( )
inlineprotectedvirtualinherited

◆ onNetSettingsChanged()

virtual void API_HANDLER::onNetSettingsChanged ( )
inlinevirtualinherited

Called on all registered handlers after project net settings (netclasses or netclass assignments) have been changed via the API.

Reimplemented in API_HANDLER_PCB, and API_HANDLER_SCH.

Definition at line 76 of file api_handler.h.

◆ parseRequestedItemTypes()

std::vector< KICAD_T > API_HANDLER_BOARD::parseRequestedItemTypes ( const google::protobuf::RepeatedField< int > & aTypes)
protectedinherited

◆ project()

◆ pushCurrentCommit()

void API_HANDLER_BOARD::pushCurrentCommit ( const std::string & aClientName,
const wxString & aMessage )
overrideprotectedvirtualinherited

◆ regenerateGenerators()

void API_HANDLER_BOARD::regenerateGenerators ( GENERATOR_TOOL * aTool,
BOARD_COMMIT * aCommit,
const std::vector< PCB_GENERATOR * > & aGenerators,
std::function< void(const KIID &, commands::ItemStatus)> aResultHandler ) const
protectedinherited

Definition at line 300 of file api_handler_board.cpp.

References board().

Referenced by handleCreateUpdateItemsInternal().

◆ registerHandler()

template<class RequestType, class ResponseType, class HandlerType>
void API_HANDLER::registerHandler ( HANDLER_RESULT< ResponseType >(HandlerType::* aHandler )(const HANDLER_CONTEXT< RequestType > &))
inlineprotectedinherited

Registers an API command handler for the given message types.

When an API request matching the given type comes in, the handler will be called and its response will be packed into an envelope for sending back to the API client.

If the given message does not unpack into the request type, an envelope is returned with status AS_BAD_REQUEST, which probably indicates corruption in the message.

Template Parameters
RequestTypeis a protobuf message type containing a command
ResponseTypeis a protobuf message type containing a command response
HandlerTypeis the implied type of the API_HANDLER subclass
Parameters
aHandleris the handler function for the given request and response types

Definition at line 114 of file api_handler.h.

References HANDLER_CONTEXT< RequestMessageType >::ClientName, m_handlers, HANDLER_CONTEXT< RequestMessageType >::Request, and tryUnpack().

Referenced by API_HANDLER_BOARD::API_HANDLER_BOARD(), API_HANDLER_COMMON::API_HANDLER_COMMON(), API_HANDLER_EDITOR::API_HANDLER_EDITOR(), API_HANDLER_FOOTPRINT::API_HANDLER_FOOTPRINT(), API_HANDLER_LIBRARIES::API_HANDLER_LIBRARIES(), API_HANDLER_PCB::API_HANDLER_PCB(), API_HANDLER_SCH::API_HANDLER_SCH(), and API_HANDLER_SYMBOL::API_HANDLER_SYMBOL().

◆ requestNetSettingsNotification()

void API_HANDLER::requestNetSettingsNotification ( )
inlineinherited

◆ setApiServer()

void API_HANDLER::setApiServer ( KICAD_API_SERVER * aServer)
inlineinherited

Set by KICAD_API_SERVER::RegisterHandler; null when the handler is not registered.

Definition at line 89 of file api_handler.h.

References m_apiServer.

Referenced by KICAD_API_SERVER::DeregisterHandler(), and KICAD_API_SERVER::RegisterHandler().

◆ setDrawingSheetFileName()

virtual void API_HANDLER_EDITOR::setDrawingSheetFileName ( const wxString & aFileName)
inlineprotectedvirtualinherited

Reimplemented in API_HANDLER_PCB, and API_HANDLER_SCH.

Definition at line 143 of file api_handler_editor.h.

Referenced by handleSetPageSettings().

◆ setPageSettings()

virtual bool API_HANDLER_EDITOR::setPageSettings ( const DocumentSpecifier & aDocument,
const PAGE_INFO & aPageInfo )
inlineprotectedvirtualinherited

Reimplemented in API_HANDLER_PCB, and API_HANDLER_SCH.

Definition at line 139 of file api_handler_editor.h.

Referenced by handleSetPageSettings().

◆ thisDocumentType()

kiapi::common::types::DocumentType API_HANDLER_FOOTPRINT::thisDocumentType ( ) const
inlineoverrideprotectedvirtual

Override this to specify which document type this editor handles.

Implements API_HANDLER_EDITOR.

Definition at line 58 of file api_handler_footprint.h.

◆ toolManager()

◆ tryUnpack()

template<typename MessageType>
bool API_HANDLER::tryUnpack ( ApiRequest & aRequest,
ApiResponse & aReply,
MessageType & aDest )
inlineprivateinherited

Definition at line 161 of file api_handler.h.

Referenced by registerHandler().

◆ validateAndGetFootprint()

HANDLER_RESULT< FOOTPRINT * > API_HANDLER_FOOTPRINT::validateAndGetFootprint ( const DocumentSpecifier & aDocument)
private

◆ validateDocument()

HANDLER_RESULT< bool > API_HANDLER_EDITOR::validateDocument ( const DocumentSpecifier & aDocument)
protectedinherited

Definition at line 180 of file api_handler_editor.cpp.

References validateDocumentInternal().

Referenced by API_HANDLER_BOARD::getItemFromDocument(), API_HANDLER_SCH::getItemFromDocument(), API_HANDLER_SYMBOL::getItemFromDocument(), API_HANDLER_PCB::handleAddEmbeddedFiles(), API_HANDLER_PCB::handleAddVariant(), API_HANDLER_SCH::handleAddVariant(), API_HANDLER_BOARD::handleCheckPadstackPresenceOnLayers(), API_HANDLER_PCB::handleCopyVariant(), API_HANDLER_SCH::handleCopyVariant(), API_HANDLER_PCB::handleDeleteVariant(), API_HANDLER_SCH::handleDeleteVariant(), API_HANDLER_BOARD::handleExpandTextVariables(), API_HANDLER_SCH::handleExpandTextVariables(), API_HANDLER_BOARD::handleFocusOnItems(), API_HANDLER_SCH::handleFocusOnItems(), API_HANDLER_BOARD::handleGetActiveLayer(), API_HANDLER_BOARD::handleGetBoardBoundingBox(), API_HANDLER_PCB::handleGetBoardDesignRules(), API_HANDLER_BOARD::handleGetBoardEnabledLayers(), API_HANDLER_PCB::handleGetBoardLayerByName(), API_HANDLER_PCB::handleGetBoardLayerName(), API_HANDLER_PCB::handleGetBoardOrigin(), API_HANDLER_PCB::handleGetBoardPlotSettings(), API_HANDLER_PCB::handleGetCurrentVariant(), API_HANDLER_SCH::handleGetCurrentVariant(), API_HANDLER_PCB::handleGetCustomDesignRules(), handleGetDocumentModifiedState(), API_HANDLER_PCB::handleGetDocumentModifiedState(), API_HANDLER_SCH::handleGetDocumentModifiedState(), API_HANDLER_SYMBOL::handleGetDocumentModifiedState(), API_HANDLER_PCB::handleGetEmbeddedFiles(), API_HANDLER_BOARD::handleGetGraphicsDefaults(), API_HANDLER_PCB::handleGetNets(), API_HANDLER_BOARD::handleGetPadShapeAsPolygon(), handleGetPageSettings(), API_HANDLER_SCH::handleGetSchematicHierarchy(), API_HANDLER_SCH::handleGetSchematicNetlist(), API_HANDLER_BOARD::handleGetStackup(), handleGetTitleBlockInfo(), API_HANDLER_PCB::handleGetVariants(), API_HANDLER_SCH::handleGetVariants(), API_HANDLER_BOARD::handleGetVisibleLayers(), API_HANDLER_PCB::handleImportNetlist(), API_HANDLER_PCB::handleInjectDrcError(), API_HANDLER_BOARD::handleInteractiveMoveItems(), API_HANDLER_BOARD::handleParseAndCreateItemsFromString(), API_HANDLER_PCB::handleRefillZones(), API_HANDLER_PCB::handleRenameVariant(), API_HANDLER_SCH::handleRenameVariant(), API_HANDLER_FOOTPRINT::handleRevertDocument(), API_HANDLER_PCB::handleRevertDocument(), API_HANDLER_SCH::handleRevertDocument(), API_HANDLER_SYMBOL::handleRevertDocument(), API_HANDLER_PCB::handleRunBoardJobExport3D(), API_HANDLER_PCB::handleRunBoardJobExportDrill(), API_HANDLER_PCB::handleRunBoardJobExportDxf(), API_HANDLER_PCB::handleRunBoardJobExportGencad(), API_HANDLER_PCB::handleRunBoardJobExportGerbers(), API_HANDLER_PCB::handleRunBoardJobExportIdf(), API_HANDLER_PCB::handleRunBoardJobExportIpc2581(), API_HANDLER_PCB::handleRunBoardJobExportIpcD356(), API_HANDLER_PCB::handleRunBoardJobExportODB(), API_HANDLER_PCB::handleRunBoardJobExportPdf(), API_HANDLER_PCB::handleRunBoardJobExportPng(), API_HANDLER_PCB::handleRunBoardJobExportPosition(), API_HANDLER_PCB::handleRunBoardJobExportPs(), API_HANDLER_PCB::handleRunBoardJobExportRender(), API_HANDLER_PCB::handleRunBoardJobExportStats(), API_HANDLER_PCB::handleRunBoardJobExportSvg(), API_HANDLER_SCH::handleRunSchematicJobExportBOM(), API_HANDLER_SCH::handleRunSchematicJobExportDxf(), API_HANDLER_SCH::handleRunSchematicJobExportNetlist(), API_HANDLER_SCH::handleRunSchematicJobExportPdf(), API_HANDLER_SCH::handleRunSchematicJobExportPng(), API_HANDLER_SCH::handleRunSchematicJobExportPs(), API_HANDLER_SCH::handleRunSchematicJobExportSvg(), API_HANDLER_PCB::handleSaveCopyOfDocument(), API_HANDLER_SCH::handleSaveCopyOfDocument(), API_HANDLER_SYMBOL::handleSaveCopyOfDocument(), API_HANDLER_PCB::handleSaveDocument(), API_HANDLER_SCH::handleSaveDocument(), API_HANDLER_SYMBOL::handleSaveDocument(), API_HANDLER_PCB::handleSaveDocumentAs(), API_HANDLER_SCH::handleSaveDocumentAs(), API_HANDLER_BOARD::handleSaveDocumentToString(), API_HANDLER_SCH::handleSaveDocumentToString(), API_HANDLER_BOARD::handleSetActiveLayer(), API_HANDLER_PCB::handleSetBoardDesignRules(), API_HANDLER_PCB::handleSetBoardEnabledLayers(), API_HANDLER_PCB::handleSetBoardOrigin(), API_HANDLER_PCB::handleSetBoardPlotSettings(), API_HANDLER_PCB::handleSetCurrentVariant(), API_HANDLER_SCH::handleSetCurrentVariant(), API_HANDLER_PCB::handleSetCustomDesignRules(), API_HANDLER_PCB::handleSetEmbeddedFiles(), handleSetPageSettings(), handleSetTitleBlockInfo(), API_HANDLER_PCB::handleSetVariantDescription(), API_HANDLER_SCH::handleSetVariantDescription(), API_HANDLER_BOARD::handleSetVisibleLayers(), API_HANDLER_FOOTPRINT::validateAndGetFootprint(), and validateItemHeaderDocument().

◆ validateDocumentInternal()

tl::expected< bool, ApiResponseStatus > API_HANDLER_FOOTPRINT::validateDocumentInternal ( const DocumentSpecifier & aDocument) const
overrideprotectedvirtual
Returns
true if the given document is valid for this editor and is currently open

Implements API_HANDLER_EDITOR.

Definition at line 74 of file api_handler_footprint.cpp.

References API_HANDLER_BOARD::board(), footprintContext(), FOOTPRINT_CONTEXT::GetLoadedFPID(), LIB_ID::GetUniStringLibItemName(), LIB_ID::GetUniStringLibNickname(), and LIB_ID::IsValid().

◆ validateItemHeaderDocument()

HANDLER_RESULT< std::optional< KIID > > API_HANDLER_EDITOR::validateItemHeaderDocument ( const kiapi::common::types::ItemHeader & aHeader)
protectedinherited

Member Data Documentation

◆ m_activeClients

◆ m_apiServer

KICAD_API_SERVER* API_HANDLER::m_apiServer = nullptr
protectedinherited

Definition at line 154 of file api_handler.h.

Referenced by apiServer(), and setApiServer().

◆ m_commits

std::map<std::string, std::pair<KIID, std::unique_ptr<COMMIT> > > API_HANDLER_EDITOR::m_commits
protectedinherited

◆ m_context

std::shared_ptr<BOARD_CONTEXT> API_HANDLER_BOARD::m_context
privateinherited

Definition at line 176 of file api_handler_board.h.

Referenced by API_HANDLER_BOARD(), and context().

◆ m_defaultCommitMessage

const wxString API_HANDLER::m_defaultCommitMessage = _( "Modification from API" )
staticprotectedinherited

Definition at line 156 of file api_handler.h.

Referenced by API_HANDLER_EDITOR::pushCurrentCommit().

◆ m_frame

◆ m_handlers

std::map<std::string, REQUEST_HANDLER> API_HANDLER::m_handlers
protectedinherited

Maps type name (without the URL prefix) to a handler method.

Definition at line 150 of file api_handler.h.

Referenced by Handle(), and registerHandler().

◆ m_notifyNetSettings

bool API_HANDLER::m_notifyNetSettings = false
protectedinherited

Definition at line 152 of file api_handler.h.

Referenced by clearNetSettingsNotification(), and requestNetSettingsNotification().


The documentation for this class was generated from the following files: