35 #include <wx/settings.h> 38 wxObjectDataPtr<LIB_TREE_MODEL_ADAPTER>
42 return wxObjectDataPtr<LIB_TREE_MODEL_ADAPTER>( adapter );
67 #define PROGRESS_INTERVAL_MILLIS 33 // 30 FPS refresh rate 74 const wxString&
name = it->get()->m_Name;
124 auto footprintIt = std::lower_bound( footprints.begin(), footprints.end(), &
dummy,
127 return StrNumCmp( a->GetName(), b->GetName(), false ) < 0;
130 if( footprintIt != footprints.end() &&
dummy.
GetName() == (*footprintIt)->GetName() )
134 static_cast<LIB_TREE_NODE_LIB_ID*>( nodeIt->get() )->Update( *footprintIt );
135 footprints.erase( footprintIt );
146 for(
auto footprint : footprints )
155 LIB_TREE_NODE::PTR_VECTOR::iterator& aLibNodeIt )
165 unsigned int aCol )
const 169 aVariant = wxEmptyString;
173 auto node =
ToNode( aItem );
184 aVariant = node->m_Name + wxT(
" *" );
186 aVariant = node->m_Name;
188 else if( node->m_Pinned )
191 aVariant = node->m_Name;
214 aVariant = node->m_Desc;
218 aVariant = node->m_Name;
225 wxDataViewItemAttr& aAttr )
const 238 auto node =
ToNode( aItem );
239 wxCHECK( node,
false );
241 switch( node->m_Type )
249 aAttr.SetColour( wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHT ) );
251 aAttr.SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHT ) );
252 aAttr.SetColour( wxSystemSettings::GetColour( wxSYS_COLOUR_LISTBOXHIGHLIGHTTEXT ) );
257 aAttr.SetBold(
true );
267 aAttr.SetColour( wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHT ) );
269 aAttr.SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHT ) );
270 aAttr.SetColour( wxSystemSettings::GetColour( wxSYS_COLOUR_LISTBOXHIGHLIGHTTEXT ) );
275 aAttr.SetBold(
true );
void GetValue(wxVariant &aVariant, wxDataViewItem const &aItem, unsigned int aCol) const override
const UTF8 & GetLibItemName() const
bool HasLibrary(const wxString &aNickname, bool aCheckEnabled=false) const
Test for the existence of aNickname in the library table.
bool IsContentModified() const
FP_LIB_TABLE GFootprintTable
The global footprint library table.
Hold a record identifying a library accessed by the appropriate footprint library PLUGIN object in th...
bool IsContainer(const wxDataViewItem &aItem) const override
wxString GetName() const override
FOOTPRINT_EDIT_FRAME * m_frame
A mix-in to provide polymorphism between items stored in libraries (symbols, aliases and footprints).
unsigned GetCount() const
Get the number of rows contained in the table.
static wxObjectDataPtr< LIB_TREE_MODEL_ADAPTER > Create(FOOTPRINT_EDIT_FRAME *aFrame, FP_LIB_TABLE *aLibs)
int GetLibrariesCount() const override
Return the number of libraries loaded in the tree.
TOOL_INTERACTIVE * GetContextMenuTool() override
const wxString & GetDescr() const
Return the description of the library referenced by this row.
static LIB_SYMBOL * dummy()
Used to draw a dummy shape when a LIB_SYMBOL is not found in library.
std::vector< LIB_TREE_ITEM * > getFootprints(const wxString &aLibName)
LIB_TREE_NODE::PTR_VECTOR::iterator deleteLibrary(LIB_TREE_NODE::PTR_VECTOR::iterator &aLibNodeIt)
FOOTPRINT * GetFirstFootprint() const
Get the first footprint on the board or nullptr.
LIB_TREE_NODE_LIB_ID & AddItem(LIB_TREE_ITEM *aItem)
Construct a new alias node, add it to this library, and return it.
static LIB_TREE_NODE * ToNode(wxDataViewItem aItem)
Convert wxDataViewItem -> #SYM_TREE_NODE.
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Model class in the component selector Model-View-Adapter (mediated MVC) architecture.
std::set< wxString > m_libMap
FP_TREE_SYNCHRONIZING_ADAPTER(FOOTPRINT_EDIT_FRAME *aFrame, FP_LIB_TABLE *aLibs)
void updateLibrary(LIB_TREE_NODE_LIB &aLibNode)
const wxString GetPinningSymbol() const
void DoAddLibrary(const wxString &aNodeName, const wxString &aDesc, const std::vector< LIB_TREE_ITEM * > &aItemList, bool presorted)
Add the given list of symbols by alias.
void AssignIntrinsicRanks(bool presorted=false)
Store intrinsic ranks on all children of this node.
const FP_LIB_TABLE_ROW * FindRow(const wxString &aNickName, bool aCheckIfEnabled=false)
Return an FP_LIB_TABLE_ROW if aNickName is found in this table or in any chained fall back table frag...
PCB_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
bool GetAttr(wxDataViewItem const &aItem, unsigned int aCol, wxDataViewItemAttr &aAttr) const override
int StrNumCmp(const wxString &aString1, const wxString &aString2, bool aIgnoreCase)
Compare two strings with alphanumerical content.
LIB_TREE_NODE_ROOT m_tree
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
std::vector< wxString > GetLogicalLibs()
Return the logical library names, all of them that are pertinent to a look up done on this LIB_TABLE.