39#include <wx/settings.h>
42wxObjectDataPtr<LIB_TREE_MODEL_ADAPTER>
46 return wxObjectDataPtr<LIB_TREE_MODEL_ADAPTER>( adapter );
67 return node ? node->
m_Type == LIB_TREE_NODE::TYPE::LIBRARY :
true;
71#define PROGRESS_INTERVAL_MILLIS 33
80 const wxString&
name = it->get()->m_Name;
102 if(
m_libMap.count( libName ) == 0 )
141 auto footprintIt = std::lower_bound( footprints.begin(), footprints.end(), &
dummy,
144 return StrNumCmp( a->GetName(), b->GetName(), false ) < 0;
147 if( footprintIt != footprints.end() &&
dummy.GetName() == (*footprintIt)->GetName() )
152 footprints.erase( footprintIt );
171LIB_TREE_NODE::PTR_VECTOR::iterator
188 unsigned int aCol )
const
192 aVariant = wxEmptyString;
210 aVariant = node->
m_Name + wxT(
" *" );
232 else if( node->
m_Type == LIB_TREE_NODE::TYPE::LIBRARY )
248 descStr.Replace( wxS(
"\n" ), wxS(
" " ) );
262 wxDataViewItemAttr& aAttr )
const
276 wxCHECK( node,
false );
280 case LIB_TREE_NODE::TYPE::LIBRARY:
286 aAttr.SetStrikethrough(
true );
292 aAttr.SetBold(
true );
296 case LIB_TREE_NODE::TYPE::ITEM:
300 aAttr.SetStrikethrough(
true );
305 aAttr.SetBold(
true );
320 wxCHECK( node,
false );
328 static const wxString c_previewName = wxS(
"fpHoverPreview" );
333 wxWindow* previewWindow = wxWindow::FindWindowByName( c_previewName, aParent );
338 wxBoxSizer* mainSizer =
new wxBoxSizer( wxVERTICAL );
339 aParent->SetSizer( mainSizer );
343 preview->SetName( c_previewName );
346 mainSizer->Add( preview, 1, wxEXPAND | wxALL, 1 );
bool IsContentModified() const
FOOTPRINT * GetFirstFootprint() const
Get the first footprint on the board or nullptr.
KIGFX::GAL * GetGAL() const
Return a pointer to the GAL instance used in the panel.
Hold a record identifying a library accessed by the appropriate footprint library #PLUGIN object in t...
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...
std::vector< LIB_TREE_ITEM * > getFootprints(const wxString &aLibName)
virtual bool HasPreview(const wxDataViewItem &aItem) override
FP_TREE_SYNCHRONIZING_ADAPTER(FOOTPRINT_EDIT_FRAME *aFrame, FP_LIB_TABLE *aLibs)
bool GetAttr(wxDataViewItem const &aItem, unsigned int aCol, wxDataViewItemAttr &aAttr) const override
FOOTPRINT_EDIT_FRAME * m_frame
void updateLibrary(LIB_TREE_NODE_LIBRARY &aLibNode)
wxDataViewItem GetCurrentDataViewItem() override
int GetLibrariesCount() const override
Return the number of libraries loaded in the tree.
bool IsContainer(const wxDataViewItem &aItem) const override
static wxObjectDataPtr< LIB_TREE_MODEL_ADAPTER > Create(FOOTPRINT_EDIT_FRAME *aFrame, FP_LIB_TABLE *aLibs)
LIB_TREE_NODE::PTR_VECTOR::iterator deleteLibrary(LIB_TREE_NODE::PTR_VECTOR::iterator &aLibNodeIt)
std::set< wxString > m_libMap
TOOL_INTERACTIVE * GetContextMenuTool() override
void Sync(FP_LIB_TABLE *aLibs)
virtual void ShowPreview(wxWindow *aParent, const wxDataViewItem &aItem) override
void GetValue(wxVariant &aVariant, wxDataViewItem const &aItem, unsigned int aCol) const override
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
void SetAxesEnabled(bool aAxesEnabled)
Enable drawing the axes.
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
const wxString GetUniStringLibItemName() const
Get strings for display messages in dialogs.
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
const wxString & GetDescr() const
Return the description of the library referenced by this row.
std::vector< wxString > GetLogicalLibs()
Return the logical library names, all of them that are pertinent to a look up done on this LIB_TABLE.
bool HasLibrary(const wxString &aNickname, bool aCheckEnabled=false) const
Test for the existence of aNickname in the library table.
unsigned GetCount() const
Get the number of rows contained in the table.
A mix-in to provide polymorphism between items stored in libraries (symbols, aliases and footprints).
LIB_TREE_NODE_ROOT m_tree
static LIB_TREE_NODE * ToNode(wxDataViewItem aItem)
Convert wxDataViewItem -> #SYM_TREE_NODE.
void DoAddLibrary(const wxString &aNodeName, const wxString &aDesc, const std::vector< LIB_TREE_ITEM * > &aItemList, bool pinned, bool presorted)
Add the given list of symbols by alias.
static wxDataViewItem ToItem(const LIB_TREE_NODE *aNode)
Convert #SYM_TREE_NODE -> wxDataViewItem.
static const wxString GetPinningSymbol()
@ NAME_COL
Library or library item name column.
@ DESC_COL
Library or library description column.
wxDataViewCtrl * m_widget
wxDataViewItem FindItem(const LIB_ID &aLibId)
Returns tree item corresponding to part.
LIB_TREE_NODE_ITEM & AddItem(LIB_TREE_ITEM *aItem)
Construct a new alias node, add it to this library, and return it.
Model class in the component selector Model-View-Adapter (mediated MVC) architecture.
void AssignIntrinsicRanks(bool presorted=false)
Store intrinsic ranks on all children of this node.
PCB_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
virtual COMMON_SETTINGS * GetCommonSettings() const
The backing store for a PROJECT, in JSON format.
virtual PROJECT_FILE & GetProjectFile() const
FP_LIB_TABLE GFootprintTable
The global footprint library table.
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
PGM_BASE & Pgm()
The global Program "get" accessor.
std::vector< FAB_LAYER_COLOR > dummy
wxString UnescapeString(const wxString &aSource)
std::vector< wxString > pinned_fp_libs