/* * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2024 Jon Evans * Copyright (C) 2024 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation, either version 3 of the License, or (at your * option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program. If not, see . */ #ifndef KICAD_API_HANDLER_SCH_H #define KICAD_API_HANDLER_SCH_H #include #include #include using namespace kiapi; using namespace kiapi::common; class SCH_EDIT_FRAME; class SCH_ITEM; class API_HANDLER_SCH : public API_HANDLER_EDITOR { public: API_HANDLER_SCH( SCH_EDIT_FRAME* aFrame ); protected: std::unique_ptr createCommit() override; kiapi::common::types::DocumentType thisDocumentType() const override { return kiapi::common::types::DOCTYPE_SCHEMATIC; } bool validateDocumentInternal( const DocumentSpecifier& aDocument ) const override; HANDLER_RESULT> createItemForType( KICAD_T aType, EDA_ITEM* aContainer ); HANDLER_RESULT handleCreateUpdateItemsInternal( bool aCreate, const HANDLER_CONTEXT& aCtx, const types::ItemHeader &aHeader, const google::protobuf::RepeatedPtrField& aItems, std::function aItemHandler ) override; void deleteItemsInternal( std::map& aItemsToDelete, const HANDLER_CONTEXT& aCtx ) override; std::optional getItemFromDocument( const DocumentSpecifier& aDocument, const KIID& aId ) override; private: HANDLER_RESULT handleGetOpenDocuments( commands::GetOpenDocuments& aMsg, const HANDLER_CONTEXT& aCtx ); SCH_EDIT_FRAME* m_frame; }; #endif //KICAD_API_HANDLER_SCH_H