KiCad PCB EDA Suite
Loading...
Searching...
No Matches
symbol_library_common.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 (C) 2022 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 along
17 * with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef _SYMBOL_LIBRARY_COMMON_H_
21#define _SYMBOL_LIBRARY_COMMON_H_
22
23#include <map>
24
25#include <wx/arrstr.h>
26
27
28class LIB_SYMBOL;
29class SCH_BASE_FRAME;
31
32
33enum class SCH_LIB_TYPE
34{
37};
38
39
44{
45 bool operator() ( const wxString& aItem1, const wxString& aItem2 ) const
46 {
47 return aItem1 < aItem2;
48 }
49};
50
51
53typedef std::map< wxString, LIB_SYMBOL*, LibSymbolMapSort > LIB_SYMBOL_MAP;
54
55
60{
61public:
63 {
65 m_forceLoad = false;
66 }
67
71 void AddLib( const wxString& aLibName )
72 {
73 m_allowedLibs.Add( aLibName );
74 m_forceLoad = false;
75 }
76
77
81 void LoadFrom( const wxString& aLibName )
82 {
83 m_allowedLibs.Clear();
84 m_allowedLibs.Add( aLibName );
85 m_forceLoad = true;
86 }
87
92 {
93 m_allowedLibs.Clear();
94 m_forceLoad = false;
95 }
96
100 void FilterPowerSymbols( bool aFilterEnable )
101 {
102 m_filterPowerSymbols = aFilterEnable;
103 }
104
109
110
114 const wxArrayString& GetAllowedLibList() const { return m_allowedLibs; }
115
120 const wxString& GetLibSource() const
121 {
122 static wxString dummy;
123
124 if( m_forceLoad && m_allowedLibs.GetCount() > 0 )
125 return m_allowedLibs[0];
126 else
127 return dummy;
128 }
129
130private:
131 wxArrayString m_allowedLibs;
134};
135
136
137#endif // _SYMBOL_LIBRARY_COMMON_H_
Define a library symbol object.
Definition: lib_symbol.h:77
A shim class between EDA_DRAW_FRAME and several derived classes: SYMBOL_EDIT_FRAME,...
Helper object to filter a list of libraries.
bool m_forceLoad
Force loading symbol from library m_allowedLibs[0].
void FilterPowerSymbols(bool aFilterEnable)
Enable or disable the filtering of power symbols.
wxArrayString m_allowedLibs
List of filtered library names.
void ClearLibList()
Clear the allowed libraries list (allows all libraries).
void AddLib(const wxString &aLibName)
Add aLibName to the allowed libraries list.
void LoadFrom(const wxString &aLibName)
Add aLibName to the allowed libraries list.
const wxArrayString & GetAllowedLibList() const
bool m_filterPowerSymbols
Enable or disable power symbol filtering.
const wxString & GetLibSource() const
std::vector< FAB_LAYER_COLOR > dummy
Symbol library map sorting helper.Symbol library map sorted by the symbol name.
bool operator()(const wxString &aItem1, const wxString &aItem2) const
std::map< wxString, LIB_SYMBOL *, LibSymbolMapSort > LIB_SYMBOL_MAP