KiCad PCB EDA Suite
Loading...
Searching...
No Matches
headless_symbol_editor_context.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software: you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation, either version 3 of the License, or (at your
9 * option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
20#ifndef KICAD_HEADLESS_SYMBOL_EDITOR_CONTEXT_H
21#define KICAD_HEADLESS_SYMBOL_EDITOR_CONTEXT_H
22
23#include <memory>
24
26#include <lib_id.h>
27
29class KIWAY;
30class LIB_SYMBOL;
31class PROJECT;
32class SCH_SCREEN;
33class TOOL_MANAGER;
34
35
37{
38public:
39 HEADLESS_SYMBOL_EDITOR_CONTEXT( std::unique_ptr<LIB_SYMBOL> aSymbol, const LIB_ID& aLibId,
40 PROJECT* aProject, APP_SETTINGS_BASE* aSettings,
41 KIWAY* aKiway = nullptr );
42
44
45 LIB_SYMBOL* GetCurSymbol() const override { return m_symbol.get(); }
46
47 SCH_SCREEN* GetScreen() const override { return m_screen.get(); }
48
49 LIB_ID GetLoadedLibId() const override { return m_libId; }
50
51 bool IsContentModified() const override { return m_contentModified; }
52
53 void SetContentModified( bool aModified = true ) override { m_contentModified = aModified; }
54
55 PROJECT& Prj() const override;
56
57 TOOL_MANAGER* GetToolManager() const override;
58
59 KIWAY* GetKiway() const override { return m_kiway; }
60
61 bool CanAcceptApiCommands() const override { return true; }
62
63 bool SaveSymbol() override;
64
65 bool SaveSymbolCopy( const wxString& aFileName, bool aOverwrite ) override;
66
67 bool RevertSymbol() override;
68
69 bool LoadSymbol( const LIB_ID& aLibId ) override;
70
71private:
72 std::unique_ptr<LIB_SYMBOL> m_symbol;
73 std::unique_ptr<SCH_SCREEN> m_screen;
77 bool m_contentModified = false;
78 std::unique_ptr<TOOL_MANAGER> m_toolManager;
79};
80
81#endif // KICAD_HEADLESS_SYMBOL_EDITOR_CONTEXT_H
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
HEADLESS_SYMBOL_EDITOR_CONTEXT(std::unique_ptr< LIB_SYMBOL > aSymbol, const LIB_ID &aLibId, PROJECT *aProject, APP_SETTINGS_BASE *aSettings, KIWAY *aKiway=nullptr)
std::unique_ptr< TOOL_MANAGER > m_toolManager
void SetContentModified(bool aModified=true) override
bool SaveSymbol() override
Save the current symbol to its library, without any user interaction.
bool LoadSymbol(const LIB_ID &aLibId) override
Load a symbol into the editor (activating it for editing); false if not found.
LIB_SYMBOL * GetCurSymbol() const override
~HEADLESS_SYMBOL_EDITOR_CONTEXT() override
bool SaveSymbolCopy(const wxString &aFileName, bool aOverwrite) override
Save a copy of the current symbol to the given library file, without user interaction.
TOOL_MANAGER * GetToolManager() const override
bool RevertSymbol() override
Reload the current symbol from its library, discarding unsaved changes.
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition kiway.h:348
A logical library item identifier and consists of various portions much like a URI.
Definition lib_id.h:45
Define a library symbol object.
Definition lib_symbol.h:114
Container for project specific data.
Definition project.h:63
Master controller class: