![]() |
KiCad PCB EDA Suite
|
#include <fp_tree_model_adapter.h>
Public Types | |
enum | SYM_FILTER_TYPE { SYM_FILTER_NONE, SYM_FILTER_POWER } |
This enum allows a selective filtering of symbols to list. More... | |
enum | TREE_COLS { PART_COL = 0, DESC_COL, NUM_COLS } |
This enum defines the order of the columns in the tree view. More... | |
Public Member Functions | |
void | AddLibraries () |
wxString | GenerateInfo (LIB_ID const &aLibId, int aUnit) override |
void | SaveColWidths () |
Save the column widths to the config file. More... | |
void | SavePinnedItems () |
void | SetFilter (SYM_FILTER_TYPE aFilter) |
Set the symbol filter type. More... | |
SYM_FILTER_TYPE | GetFilter () const |
Return the active filter. More... | |
void | ShowUnits (bool aShow) |
Whether or not to show units. More... | |
void | SetPreselectNode (const LIB_ID &aLibId, int aUnit) |
Set the symbol name to be selected if there are no search results. More... | |
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. More... | |
void | AssignIntrinsicRanks () |
Sort the tree and assign ranks after adding libraries. More... | |
void | UpdateSearchString (const wxString &aSearch, bool aState) |
Set the search string provided by the user. More... | |
void | AttachTo (wxDataViewCtrl *aDataViewCtrl) |
Attach to a wxDataViewCtrl and initialize it. More... | |
void | FinishTreeInitialization () |
A final-stage initialization to be called after the window hierarchy has been realized and the window sizes set. More... | |
LIB_ID | GetAliasFor (const wxDataViewItem &aSelection) const |
Return the alias for the given item. More... | |
int | GetUnitFor (const wxDataViewItem &aSelection) const |
Return the unit for the given item. More... | |
LIB_TREE_NODE::TYPE | GetTypeFor (const wxDataViewItem &aSelection) const |
Return node type for the given item. More... | |
LIB_TREE_NODE * | GetTreeNodeFor (const wxDataViewItem &aSelection) const |
int | GetItemCount () const |
Return the number of symbols loaded in the tree. More... | |
virtual int | GetLibrariesCount () const |
Return the number of libraries loaded in the tree. More... | |
wxDataViewItem | FindItem (const LIB_ID &aLibId) |
Returns tree item corresponding to part. More... | |
unsigned int | GetChildren (const wxDataViewItem &aItem, wxDataViewItemArray &aChildren) const override |
Populate a list of all the children of an item. More... | |
void | Freeze () |
void | Thaw () |
bool | IsFrozen () const |
void | RefreshTree () |
virtual TOOL_INTERACTIVE * | GetContextMenuTool () |
Static Public Member Functions | |
static wxObjectDataPtr< LIB_TREE_MODEL_ADAPTER > | Create (EDA_BASE_FRAME *aParent, LIB_TABLE *aLibs) |
Factory function: create a model adapter in a reference-counting container. More... | |
Protected Member Functions | |
FP_TREE_MODEL_ADAPTER (EDA_BASE_FRAME *aParent, LIB_TABLE *aLibs) | |
Constructor; takes a set of libraries to be included in the search. More... | |
std::vector< LIB_TREE_ITEM * > | getFootprints (const wxString &aLibName) |
LIB_TREE_NODE_LIB & | DoAddLibraryNode (const wxString &aNodeName, const wxString &aDesc) |
bool | HasContainerColumns (const wxDataViewItem &aItem) const override |
Check whether a container has columns too. More... | |
bool | IsContainer (const wxDataViewItem &aItem) const override |
Check whether an item can have children. More... | |
wxDataViewItem | GetParent (const wxDataViewItem &aItem) const override |
Get the parent of an item. More... | |
unsigned int | GetColumnCount () const override |
wxString | GetColumnType (unsigned int aCol) const override |
Return the type of data stored in the column as indicated by wxVariant::GetType() More... | |
void | GetValue (wxVariant &aVariant, const wxDataViewItem &aItem, unsigned int aCol) const override |
Get the value of an item. More... | |
bool | SetValue (const wxVariant &aVariant, const wxDataViewItem &aItem, unsigned int aCol) override |
Set the value of an item. More... | |
bool | GetAttr (const wxDataViewItem &aItem, unsigned int aCol, wxDataViewItemAttr &aAttr) const override |
Get any formatting for an item. More... | |
const wxString | GetPinningSymbol () const |
Static Protected Member Functions | |
static wxDataViewItem | ToItem (const LIB_TREE_NODE *aNode) |
Convert #SYM_TREE_NODE -> wxDataViewItem. More... | |
static LIB_TREE_NODE * | ToNode (wxDataViewItem aItem) |
Convert wxDataViewItem -> #SYM_TREE_NODE. More... | |
static unsigned int | IntoArray (const LIB_TREE_NODE &aNode, wxDataViewItemArray &aChildren) |
Convert SYM_TREE_NODE's children to wxDataViewItemArray. More... | |
Protected Attributes | |
FP_LIB_TABLE * | m_libs |
LIB_TREE_NODE_ROOT | m_tree |
Definition at line 31 of file fp_tree_model_adapter.h.
|
inherited |
This enum allows a selective filtering of symbols to list.
Enumerator | |
---|---|
SYM_FILTER_NONE | no filtering |
SYM_FILTER_POWER | list symbols flagged PWR |
Definition at line 109 of file lib_tree_model_adapter.h.
|
inherited |
This enum defines the order of the columns in the tree view.
Enumerator | |
---|---|
PART_COL | Part name column. |
DESC_COL | Part description column. |
NUM_COLS | The number of tree columns. |
Definition at line 118 of file lib_tree_model_adapter.h.
|
protected |
Constructor; takes a set of libraries to be included in the search.
Definition at line 39 of file fp_tree_model_adapter.cpp.
Referenced by Create().
void FP_TREE_MODEL_ADAPTER::AddLibraries | ( | ) |
Definition at line 45 of file fp_tree_model_adapter.cpp.
References LIB_TREE_NODE::AssignIntrinsicRanks(), LIB_TREE_MODEL_ADAPTER::DoAddLibrary(), FP_LIB_TABLE::FindRow(), getFootprints(), LIB_TABLE::GetLogicalLibs(), library, m_libs, and LIB_TREE_MODEL_ADAPTER::m_tree.
Referenced by PCB_BASE_FRAME::SelectFootprintFromLibTree().
|
inlineinherited |
Sort the tree and assign ranks after adding libraries.
Definition at line 176 of file lib_tree_model_adapter.h.
References LIB_TREE_NODE::AssignIntrinsicRanks(), and LIB_TREE_MODEL_ADAPTER::m_tree.
Referenced by SCH_BASE_FRAME::PickSymbolFromLibTree().
|
inherited |
Attach to a wxDataViewCtrl and initialize it.
This will set up columns and associate the model via the adapter.
aDataViewCtrl | the view symbol in the dialog |
Definition at line 279 of file lib_tree_model_adapter.cpp.
References _, LIB_TREE_MODEL_ADAPTER::DESC_COL, KIUI::GetTextSize(), kDataViewIndent, LIB_TREE_MODEL_ADAPTER::m_col_desc, LIB_TREE_MODEL_ADAPTER::m_col_part, LIB_TREE_MODEL_ADAPTER::m_colWidths, LIB_TREE_MODEL_ADAPTER::m_widget, and LIB_TREE_MODEL_ADAPTER::PART_COL.
|
static |
Factory function: create a model adapter in a reference-counting container.
aLibs | library set from which parts will be loaded |
Definition at line 32 of file fp_tree_model_adapter.cpp.
References FP_TREE_MODEL_ADAPTER().
Referenced by PCB_BASE_FRAME::SelectFootprintFromLibTree().
|
inherited |
Add the given list of symbols by alias.
To be called in the setup phase.
aNodeName | the parent node the symbols will appear under |
aDesc | the description field of the parent node |
aItemList | list of symbols |
Definition at line 170 of file lib_tree_model_adapter.cpp.
References LIB_TREE_NODE_LIB::AddItem(), LIB_TREE_NODE::AssignIntrinsicRanks(), and LIB_TREE_MODEL_ADAPTER::DoAddLibraryNode().
Referenced by AddLibraries(), SYMBOL_TREE_MODEL_ADAPTER::AddLibraries(), SYMBOL_TREE_MODEL_ADAPTER::AddLibrary(), SCH_BASE_FRAME::PickSymbolFromLibTree(), PCB_BASE_FRAME::SelectFootprintFromLibTree(), and FP_TREE_SYNCHRONIZING_ADAPTER::Sync().
|
protectedinherited |
Definition at line 159 of file lib_tree_model_adapter.cpp.
References LIB_TREE_NODE_ROOT::AddLib(), LIB_ID::GetLibNickname(), LIB_TREE_NODE::m_LibId, LIB_TREE_NODE::m_Pinned, LIB_TREE_MODEL_ADAPTER::m_pinnedLibs, and LIB_TREE_MODEL_ADAPTER::m_tree.
Referenced by LIB_TREE_MODEL_ADAPTER::DoAddLibrary(), and SYMBOL_TREE_SYNCHRONIZING_ADAPTER::Sync().
|
inherited |
Returns tree item corresponding to part.
aLibId | specifies the part and library name to be searched for. |
Definition at line 350 of file lib_tree_model_adapter.cpp.
References LIB_ID::GetLibItemName(), LIB_ID::GetLibNickname(), LIB_TREE_NODE::m_Children, LIB_TREE_MODEL_ADAPTER::m_tree, and LIB_TREE_MODEL_ADAPTER::ToItem().
|
inherited |
A final-stage initialization to be called after the window hierarchy has been realized and the window sizes set.
Definition at line 393 of file lib_tree_model_adapter.cpp.
References LIB_TREE_MODEL_ADAPTER::DESC_COL, LIB_TREE_MODEL_ADAPTER::m_col_desc, LIB_TREE_MODEL_ADAPTER::m_col_part, LIB_TREE_MODEL_ADAPTER::m_colWidths, and LIB_TREE_MODEL_ADAPTER::PART_COL.
|
inlineinherited |
Definition at line 267 of file lib_tree_model_adapter.h.
References LIB_TREE_MODEL_ADAPTER::m_freeze.
Referenced by LIB_TREE_MODEL_ADAPTER::UpdateSearchString().
|
overridevirtual |
Reimplemented from LIB_TREE_MODEL_ADAPTER.
Definition at line 81 of file fp_tree_model_adapter.cpp.
References GenerateFootprintInfo(), and m_libs.
|
inherited |
Return the alias for the given item.
aSelection | item from the wxDataViewCtrl (see wxDataViewCtrl::GetSelection()) |
Definition at line 306 of file lib_tree_model_adapter.cpp.
References LIB_TREE_NODE::m_LibId, and LIB_TREE_MODEL_ADAPTER::ToNode().
|
overrideprotectedinherited |
Get any formatting for an item.
aItem | item to get formatting for |
aCol | column number of interest |
aAttr | receiver for attributes |
Definition at line 483 of file lib_tree_model_adapter.cpp.
References LIB_TREE_MODEL_ADAPTER::IsFrozen(), LIB_TREE_NODE::LIBID, LIB_TREE_NODE::m_IsRoot, LIB_TREE_NODE::m_Type, and LIB_TREE_MODEL_ADAPTER::ToNode().
|
overrideinherited |
Populate a list of all the children of an item.
Definition at line 374 of file lib_tree_model_adapter.cpp.
References LIB_TREE_MODEL_ADAPTER::IntoArray(), LIB_TREE_NODE::LIB, LIB_TREE_MODEL_ADAPTER::m_show_units, LIB_TREE_MODEL_ADAPTER::m_tree, LIB_TREE_NODE::m_Type, and LIB_TREE_MODEL_ADAPTER::ToNode().
|
inlineoverrideprotectedinherited |
Definition at line 319 of file lib_tree_model_adapter.h.
References LIB_TREE_MODEL_ADAPTER::NUM_COLS.
|
inlineoverrideprotectedinherited |
Return the type of data stored in the column as indicated by wxVariant::GetType()
Definition at line 324 of file lib_tree_model_adapter.h.
|
inlinevirtualinherited |
Reimplemented in SYMBOL_TREE_SYNCHRONIZING_ADAPTER, and FP_TREE_SYNCHRONIZING_ADAPTER.
Definition at line 274 of file lib_tree_model_adapter.h.
|
inlineinherited |
Return the active filter.
Definition at line 142 of file lib_tree_model_adapter.h.
References LIB_TREE_MODEL_ADAPTER::m_filter.
Referenced by SYMBOL_TREE_MODEL_ADAPTER::AddLibraries(), SYMBOL_TREE_MODEL_ADAPTER::AddLibrary(), and SCH_BASE_FRAME::PickSymbolFromLibTree().
|
protected |
Definition at line 58 of file fp_tree_model_adapter.cpp.
References dummy(), FOOTPRINT_LIST::GetList(), GFootprintList, and StrNumCmp().
Referenced by AddLibraries(), FP_TREE_SYNCHRONIZING_ADAPTER::Sync(), and FP_TREE_SYNCHRONIZING_ADAPTER::updateLibrary().
|
inherited |
Return the number of symbols loaded in the tree.
Definition at line 339 of file lib_tree_model_adapter.cpp.
References LIB_TREE_NODE::m_Children, and LIB_TREE_MODEL_ADAPTER::m_tree.
Referenced by SYMBOL_VIEWER_FRAME::OnSelectSymbol(), and PCB_BASE_FRAME::SelectFootprintFromLibTree().
|
inlinevirtualinherited |
Return the number of libraries loaded in the tree.
Reimplemented in SYMBOL_TREE_SYNCHRONIZING_ADAPTER, and FP_TREE_SYNCHRONIZING_ADAPTER.
Definition at line 243 of file lib_tree_model_adapter.h.
References LIB_TREE_NODE::m_Children, and LIB_TREE_MODEL_ADAPTER::m_tree.
Referenced by SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetLibrariesCount().
|
overrideprotectedinherited |
Get the parent of an item.
Definition at line 440 of file lib_tree_model_adapter.cpp.
References LIB_TREE_MODEL_ADAPTER::m_freeze, LIB_TREE_NODE::m_Parent, LIB_TREE_NODE::m_Type, LIB_TREE_MODEL_ADAPTER::ToItem(), and LIB_TREE_MODEL_ADAPTER::ToNode().
Referenced by LIB_TREE_MODEL_ADAPTER::UpdateSearchString().
|
inlineprotectedinherited |
Definition at line 362 of file lib_tree_model_adapter.h.
Referenced by FP_TREE_SYNCHRONIZING_ADAPTER::GetValue(), and SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetValue().
|
inherited |
Definition at line 333 of file lib_tree_model_adapter.cpp.
References LIB_TREE_MODEL_ADAPTER::ToNode().
|
inherited |
Return node type for the given item.
aSelection | item from the wxDataViewCtrl (see wxDataViewCtrl::GetSelection()) |
Definition at line 326 of file lib_tree_model_adapter.cpp.
References LIB_TREE_NODE::INVALID, LIB_TREE_NODE::m_Type, and LIB_TREE_MODEL_ADAPTER::ToNode().
|
inherited |
Return the unit for the given item.
aSelection | item from the wxDataViewCtrl (see wxDataViewCtrl::GetSelection()) |
Definition at line 319 of file lib_tree_model_adapter.cpp.
References LIB_TREE_NODE::m_Unit, and LIB_TREE_MODEL_ADAPTER::ToNode().
|
overrideprotectedinherited |
Get the value of an item.
aVariant | wxVariant to receive the data |
aItem | item whose data will be placed into aVariant |
aCol | column number of the data |
Definition at line 457 of file lib_tree_model_adapter.cpp.
References LIB_TREE_MODEL_ADAPTER::IsFrozen(), LIB_TREE_NODE::m_Desc, LIB_TREE_NODE::m_Name, LIB_TREE_MODEL_ADAPTER::ToNode(), and UnescapeString().
|
overrideprotectedinherited |
Check whether a container has columns too.
Definition at line 427 of file lib_tree_model_adapter.cpp.
References LIB_TREE_MODEL_ADAPTER::IsContainer().
|
staticprotectedinherited |
Convert SYM_TREE_NODE's children to wxDataViewItemArray.
Definition at line 52 of file lib_tree_model_adapter.cpp.
References LIB_TREE_NODE::m_Children, and LIB_TREE_MODEL_ADAPTER::ToItem().
Referenced by LIB_TREE_MODEL_ADAPTER::GetChildren().
|
overrideprotectedinherited |
Check whether an item can have children.
Definition at line 433 of file lib_tree_model_adapter.cpp.
References LIB_TREE_NODE::m_Children, and LIB_TREE_MODEL_ADAPTER::ToNode().
Referenced by LIB_TREE_MODEL_ADAPTER::HasContainerColumns().
|
inlineinherited |
Definition at line 269 of file lib_tree_model_adapter.h.
References LIB_TREE_MODEL_ADAPTER::m_freeze.
Referenced by FP_TREE_SYNCHRONIZING_ADAPTER::GetAttr(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetAttr(), LIB_TREE_MODEL_ADAPTER::GetAttr(), FP_TREE_SYNCHRONIZING_ADAPTER::GetValue(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetValue(), and LIB_TREE_MODEL_ADAPTER::GetValue().
|
inherited |
Definition at line 400 of file lib_tree_model_adapter.cpp.
References LIB_TREE_MODEL_ADAPTER::DESC_COL, LIB_TREE_MODEL_ADAPTER::m_col_desc, LIB_TREE_MODEL_ADAPTER::m_col_part, LIB_TREE_MODEL_ADAPTER::m_colWidths, and LIB_TREE_MODEL_ADAPTER::PART_COL.
|
inherited |
Save the column widths to the config file.
This requires the tree view to still be valid.
Definition at line 106 of file lib_tree_model_adapter.cpp.
References APP_SETTINGS_BASE::LIB_TREE::column_width, Kiface(), KIFACE_BASE::KifaceSettings(), APP_SETTINGS_BASE::m_LibTree, LIB_TREE_MODEL_ADAPTER::m_widget, and LIB_TREE_MODEL_ADAPTER::PART_COL.
|
inherited |
Definition at line 116 of file lib_tree_model_adapter.cpp.
References PROJECT::GetProjectFile(), KIWAY_HOLDER::Kiway(), LIB_TREE_NODE::m_Children, LIB_TREE_MODEL_ADAPTER::m_parent, LIB_TREE_MODEL_ADAPTER::m_pinnedKey, LIB_TREE_MODEL_ADAPTER::m_pinnedLibs, LIB_TREE_MODEL_ADAPTER::m_tree, KIWAY::Prj(), and project.
|
inherited |
Set the symbol filter type.
Must be set before adding libraries
aFilter | if SYM_FILTER_POWER, only power parts are loaded |
Definition at line 140 of file lib_tree_model_adapter.cpp.
References LIB_TREE_MODEL_ADAPTER::m_filter.
Referenced by SCH_BASE_FRAME::PickSymbolFromLibTree().
|
inherited |
Set the symbol name to be selected if there are no search results.
May be set at any time; updates at the next UpdateSearchString().
aLibId | symbol LIB_ID to be selected |
aUnit | unit to be selected, if > 0 (0 selects the alias itself) |
Definition at line 152 of file lib_tree_model_adapter.cpp.
References LIB_TREE_MODEL_ADAPTER::m_preselect_lib_id, and LIB_TREE_MODEL_ADAPTER::m_preselect_unit.
Referenced by SYMBOL_VIEWER_FRAME::OnSelectSymbol(), SCH_BASE_FRAME::PickSymbolFromLibTree(), and PCB_BASE_FRAME::SelectFootprintFromLibTree().
|
inlineoverrideprotectedinherited |
Set the value of an item.
Does nothing - this model doesn't support editing.
Definition at line 341 of file lib_tree_model_adapter.h.
|
inherited |
Whether or not to show units.
May be set at any time; updates at the next UpdateSearchString()
aShow | if true, units are displayed |
Definition at line 146 of file lib_tree_model_adapter.cpp.
References LIB_TREE_MODEL_ADAPTER::m_show_units.
|
inlineinherited |
Definition at line 268 of file lib_tree_model_adapter.h.
References LIB_TREE_MODEL_ADAPTER::m_freeze.
Referenced by LIB_TREE_MODEL_ADAPTER::UpdateSearchString().
|
staticprotectedinherited |
Convert #SYM_TREE_NODE -> wxDataViewItem.
Definition at line 40 of file lib_tree_model_adapter.cpp.
Referenced by LIB_TREE_MODEL_ADAPTER::FindItem(), LIB_TREE_MODEL_ADAPTER::GetParent(), and LIB_TREE_MODEL_ADAPTER::IntoArray().
|
staticprotectedinherited |
Convert wxDataViewItem -> #SYM_TREE_NODE.
Definition at line 46 of file lib_tree_model_adapter.cpp.
Referenced by LIB_TREE_MODEL_ADAPTER::GetAliasFor(), FP_TREE_SYNCHRONIZING_ADAPTER::GetAttr(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetAttr(), LIB_TREE_MODEL_ADAPTER::GetAttr(), LIB_TREE_MODEL_ADAPTER::GetChildren(), LIB_TREE_MODEL_ADAPTER::GetParent(), LIB_TREE_MODEL_ADAPTER::GetTreeNodeFor(), LIB_TREE_MODEL_ADAPTER::GetTypeFor(), LIB_TREE_MODEL_ADAPTER::GetUnitFor(), FP_TREE_SYNCHRONIZING_ADAPTER::GetValue(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetValue(), LIB_TREE_MODEL_ADAPTER::GetValue(), FP_TREE_SYNCHRONIZING_ADAPTER::IsContainer(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::IsContainer(), and LIB_TREE_MODEL_ADAPTER::IsContainer().
|
inherited |
Set the search string provided by the user.
aSearch | full, unprocessed search text |
aState | if true, we are keeping the state and so we shouldn't collapse the tree |
Definition at line 183 of file lib_tree_model_adapter.cpp.
References LIB_TREE_MODEL_ADAPTER::Freeze(), LIB_TREE_MODEL_ADAPTER::GetParent(), LIB_TREE_NODE::m_Children, LIB_TREE_MODEL_ADAPTER::m_tree, LIB_TREE_MODEL_ADAPTER::m_widget, LIB_TREE_NODE::ResetScore(), LIB_TREE_MODEL_ADAPTER::ShowPreselect(), LIB_TREE_MODEL_ADAPTER::ShowResults(), LIB_TREE_MODEL_ADAPTER::ShowSingleLibrary(), LIB_TREE_NODE::SortNodes(), LIB_TREE_MODEL_ADAPTER::Thaw(), and LIB_TREE_NODE_ROOT::UpdateScore().
|
protected |
Definition at line 54 of file fp_tree_model_adapter.h.
Referenced by AddLibraries(), GenerateInfo(), and FP_TREE_SYNCHRONIZING_ADAPTER::Sync().
|
protectedinherited |
Definition at line 391 of file lib_tree_model_adapter.h.
Referenced by AddLibraries(), SYMBOL_TREE_MODEL_ADAPTER::AddLibraries(), LIB_TREE_MODEL_ADAPTER::AssignIntrinsicRanks(), FP_TREE_SYNCHRONIZING_ADAPTER::deleteLibrary(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::deleteLibrary(), LIB_TREE_MODEL_ADAPTER::DoAddLibraryNode(), LIB_TREE_MODEL_ADAPTER::FindItem(), LIB_TREE_MODEL_ADAPTER::GetChildren(), LIB_TREE_MODEL_ADAPTER::GetItemCount(), LIB_TREE_MODEL_ADAPTER::GetLibrariesCount(), LIB_TREE_MODEL_ADAPTER::SavePinnedItems(), LIB_TREE_MODEL_ADAPTER::ShowPreselect(), LIB_TREE_MODEL_ADAPTER::ShowResults(), LIB_TREE_MODEL_ADAPTER::ShowSingleLibrary(), FP_TREE_SYNCHRONIZING_ADAPTER::Sync(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::Sync(), and LIB_TREE_MODEL_ADAPTER::UpdateSearchString().