KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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_SYMBOL_EDITOR_CONTEXT_H
21#define KICAD_SYMBOL_EDITOR_CONTEXT_H
22
23#include <memory>
24
25#include <lib_id.h>
26#include <wx/string.h>
27
28class KIWAY;
29class LIB_SYMBOL;
30class PROJECT;
31class SCH_SCREEN;
33class TOOL_MANAGER;
34
35
37{
38public:
39 virtual ~SYMBOL_EDITOR_CONTEXT() = default;
40
41 virtual LIB_SYMBOL* GetCurSymbol() const = 0;
42
43 virtual SCH_SCREEN* GetScreen() const = 0;
44
45 virtual LIB_ID GetLoadedLibId() const = 0;
46
47 virtual bool IsContentModified() const = 0;
48
49 virtual void SetContentModified( bool aModified = true ) = 0;
50
51 virtual PROJECT& Prj() const = 0;
52
53 virtual TOOL_MANAGER* GetToolManager() const = 0;
54
55 virtual KIWAY* GetKiway() const = 0;
56
57 virtual bool CanAcceptApiCommands() const = 0;
58
63 virtual bool SaveSymbol() = 0;
64
66 virtual bool SaveSymbolCopy( const wxString& aFileName, bool aOverwrite ) = 0;
67
69 virtual bool RevertSymbol() = 0;
70
72 virtual bool LoadSymbol( const LIB_ID& aLibId ) = 0;
73};
74
75
76std::shared_ptr<SYMBOL_EDITOR_CONTEXT> CreateSymbolEditorFrameContext( SYMBOL_EDIT_FRAME* aFrame );
77
82bool SaveSymbolCopyToFile( const LIB_SYMBOL& aSymbol, const wxString& aFileName, bool aOverwrite );
83
84#endif // KICAD_SYMBOL_EDITOR_CONTEXT_H
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
virtual ~SYMBOL_EDITOR_CONTEXT()=default
virtual bool IsContentModified() const =0
virtual LIB_ID GetLoadedLibId() const =0
virtual LIB_SYMBOL * GetCurSymbol() const =0
virtual bool CanAcceptApiCommands() const =0
virtual SCH_SCREEN * GetScreen() const =0
virtual bool RevertSymbol()=0
Reload the current symbol from its library, discarding unsaved changes.
virtual bool SaveSymbol()=0
Save the current symbol to its library, without any user interaction.
virtual void SetContentModified(bool aModified=true)=0
virtual PROJECT & Prj() const =0
virtual KIWAY * GetKiway() const =0
virtual TOOL_MANAGER * GetToolManager() const =0
virtual bool LoadSymbol(const LIB_ID &aLibId)=0
Load a symbol into the editor (activating it for editing); false if not found.
virtual bool SaveSymbolCopy(const wxString &aFileName, bool aOverwrite)=0
Save a copy of the current symbol to the given library file, without user interaction.
The symbol library editor main window.
Master controller class:
std::shared_ptr< SYMBOL_EDITOR_CONTEXT > CreateSymbolEditorFrameContext(SYMBOL_EDIT_FRAME *aFrame)
bool SaveSymbolCopyToFile(const LIB_SYMBOL &aSymbol, const wxString &aFileName, bool aOverwrite)
Shared implementation of SaveSymbolCopy for all contexts; writes the given symbol to a new library fi...