47 const LIB_ID& aPreselectedLibId,
48 int aUnit,
int aConvert )
61 if( aPreselectedLibId.
IsValid() )
74 if( viewer->
ShowModal( &symbol, aParent ) )
78 if(
id.Parse( symbol ) == -1 )
92 std::vector<PICKED_SYMBOL>& aHistoryList,
93 bool aUseLibBrowser,
int aUnit,
int aConvert,
94 bool aShowFootprints,
const LIB_ID* aHighlight,
101 if( !dialogLock.try_lock() )
108 wxObjectDataPtr<LIB_TREE_MODEL_ADAPTER> dataPtr
111 = static_cast<SYMBOL_TREE_MODEL_ADAPTER*>( dataPtr.get() );
118 for(
unsigned ii = 0; ii < liblist.GetCount(); ii++ )
133 std::vector< LIB_TREE_ITEM* > history_list;
141 history_list.push_back( symbol );
144 modelAdapter->
DoAddLibrary( wxT(
"-- " ) +
_(
"Recently Used" ) + wxT(
" --" ), wxEmptyString,
145 history_list,
true );
147 if( !aHistoryList.empty() )
148 modelAdapter->
SetPreselectNode( aHistoryList[0].LibId, aHistoryList[0].Unit );
150 const std::vector< wxString > libNicknames = libs->
GetLogicalLibs();
161 if( aHighlight && aHighlight->
IsValid() )
164 wxString dialogTitle;
167 dialogTitle.Printf(
_(
"Choose Power Symbol (%d items loaded)" ), dataPtr->GetItemCount() );
169 dialogTitle.Printf(
_(
"Choose Symbol (%d items loaded)" ), dataPtr->GetItemCount() );
174 if( dlg.ShowModal() == wxID_CANCEL )
204 aHistoryList.insert( aHistoryList.begin(), sel );
220 if( unitCount <= 1 || aSymbol->GetUnit() == aUnit )
223 if( aUnit > unitCount )
261 msg.Printf(
_(
"No alternate body style found for symbol '%s' in library '%s'." ),
262 id.GetLibItemName().wx_str(),
263 id.GetLibNickname().wx_str() );
277 if( aSymbol->
GetConvert() > LIB_ITEM::LIB_CONVERT::DEMORGAN )
278 aSymbol->
SetConvert( LIB_ITEM::LIB_CONVERT::BASE );
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
void AssignIntrinsicRanks()
Sort the tree and assign ranks after adding libraries.
const UTF8 & GetLibItemName() const
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
bool HasLibrary(const wxString &aNickname, bool aCheckEnabled=false) const
Test for the existence of aNickname in the library table.
std::vector< std::pair< int, wxString > > GetFields() const
Get a list of fields edited by the user.
void SetFilter(SYM_FILTER_TYPE aFilter)
Set the symbol filter type.
void SetUnit(int aUnit)
Change the unit number to aUnit.
This file is part of the common library.
void ConvertPart(SCH_SYMBOL *aSymbol)
void AddLibrary(wxString const &aLibNickname)
void AutoAutoplaceFields(SCH_SCREEN *aScreen)
Autoplace fields only if correct to do so automatically.
void SetPreselectNode(const LIB_ID &aLibId, int aUnit)
Set the symbol name to be selected if there are no search results.
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.
void SetFlags(EDA_ITEM_FLAGS aMask)
Symbol library viewer main window.
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
SYM_FILTER_TYPE GetFilter() const
Return the active filter.
std::uint32_t EDA_ITEM_FLAGS
void SelectUnit(SCH_SYMBOL *aSymbol, int aUnit)
A logical library item identifier and consists of various portions much like a URI.
bool IsValid() const
Check if this LID_ID is valid.
Define a library symbol object.
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
static std::mutex g_Mutex
void SetUnitSelection(const SCH_SHEET_PATH *aSheet, int aUnitSelection)
Set the selected unit of this symbol on one sheet.
Dialog class to select a symbol from the libraries.
std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef()
EESCHEMA_SETTINGS * eeconfig() const
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
AUTOPLACE_FIELDS m_AutoplaceFields
static TOOL_ACTION addItemToSel
Selects an item (specified as the event parameter).
void TestDanglingEnds()
Test all of the connectable objects in the schematic for unused connection points.
PICKED_SYMBOL PickSymbolFromLibTree(const SCHLIB_FILTER *aFilter, std::vector< PICKED_SYMBOL > &aHistoryList, bool aUseLibBrowser, int aUnit, int aConvert, bool aShowFootprints, const LIB_ID *aHighlight=nullptr, bool aAllowFields=true)
Call the library viewer to select symbol to import into schematic.
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
int GetUnitCount() const override
For items with units, return the number of units.
void SetSelectedSymbol(const wxString &aSymbolName)
Set the selected symbol.
Definition for symbol library class.
void UpdateItem(EDA_ITEM *aItem, bool isAddOrDelete=false, bool aUpdateRtree=false)
Mark an item for refresh.
void SetUnitAndConvert(int aUnit, int aConvert)
Set unit and convert, and set flag preventing them from automatically resetting to 1.
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
EDA_ITEM_FLAGS GetEditFlags() const
LIB_ID GetSelectedLibId(int *aUnit=nullptr) const
To be called after this dialog returns from ShowModal().
bool IsExternalBrowserSelected() const
PICKED_SYMBOL PickSymbolFromLibBrowser(wxTopLevelWindow *aParent, const SCHLIB_FILTER *aFilter, const LIB_ID &aPreselectedLibId, int aUnit, int aConvert)
Call the library viewer to select symbol to import into schematic.
EDA_ITEM_FLAGS GetFlags() const
void SetConvert(int aConvert)
void SetFilter(const SCHLIB_FILTER *aFilter)
Set a filter to display only libraries and/or symbols which match the filter.
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 SetSelectedLibrary(const wxString &aLibName)
Set the selected library in the library window.
void SaveCopyInUndoList(SCH_SCREEN *aScreen, SCH_ITEM *aItemToCopy, UNDO_REDO aTypeCommand, bool aAppend)
Create a copy of the current schematic item, and put it in the undo list.
const wxArrayString & GetAllowedLibList() const
bool Destroy() override
Our version of Destroy() which is virtual from wxWidgets.
SCH_SHEET_PATH & GetCurrentSheet() const
LIB_SYMBOL * GetLibSymbol(const LIB_ID &aLibId, bool aUseCacheLib=false, bool aShowErrorMsg=false)
Load symbol from symbol library table.
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current screen and u...
bool ShowModal(wxString *aSymbol, wxWindow *aParent) override
Runs the symbol viewer as a modal dialog.
std::vector< std::pair< int, wxString > > Fields
void delete_if(_Container &__c, _Function &&__f)
Deletes all values from __c for which __f returns true.
bool AddLibraries(const std::vector< wxString > &aNicknames, wxWindow *aParent)
Add all the libraries in a SYMBOL_LIB_TABLE to the model.
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 GetFilterPowerSymbols() const
const LIB_ID & GetLibId() const