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 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 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;
30
31
37
38
43{
44 bool operator() ( const wxString& aItem1, const wxString& aItem2 ) const
45 {
46 return aItem1 < aItem2;
47 }
48};
49
50
52typedef std::map< wxString, LIB_SYMBOL*, LibSymbolMapSort > LIB_SYMBOL_MAP;
53
54
59{
60public:
62 {
64 m_forceLoad = false;
65 }
66
70 void AddLib( const wxString& aLibName )
71 {
72 m_allowedLibs.Add( aLibName );
73 m_forceLoad = false;
74 }
75
76
80 void LoadFrom( const wxString& aLibName )
81 {
82 m_allowedLibs.Clear();
83 m_allowedLibs.Add( aLibName );
84 m_forceLoad = true;
85 }
86
91 {
92 m_allowedLibs.Clear();
93 m_forceLoad = false;
94 }
95
99 void FilterPowerSymbols( bool aFilterEnable )
100 {
101 m_filterPowerSymbols = aFilterEnable;
102 }
103
108
109
113 const wxArrayString& GetAllowedLibList() const { return m_allowedLibs; }
114
119 const wxString& GetLibSource() const
120 {
121 static wxString dummy;
122
123 if( m_forceLoad && m_allowedLibs.GetCount() > 0 )
124 return m_allowedLibs[0];
125 else
126 return dummy;
127 }
128
129private:
130 wxArrayString m_allowedLibs;
133};
134
135
136#endif // _SYMBOL_LIBRARY_COMMON_H_
Define a library symbol object.
Definition lib_symbol.h:85
A shim class between EDA_DRAW_FRAME and several derived classes: SYMBOL_EDIT_FRAME,...
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