mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 02:03:12 +02:00
Symbol editor: allow to inject the symbol list into DIALOG_LIB_FIELDS
This will permit editing fields for subsets (e.g. only symbols in a certain inheritance hierarchy)
This commit is contained in:
parent
1f1f8699e0
commit
9b14434fc3
@ -235,13 +235,13 @@ protected:
|
||||
};
|
||||
|
||||
|
||||
DIALOG_LIB_FIELDS::DIALOG_LIB_FIELDS( SYMBOL_EDIT_FRAME* parent, wxString libId ) :
|
||||
DIALOG_LIB_FIELDS::DIALOG_LIB_FIELDS( SYMBOL_EDIT_FRAME* parent, wxString libId, const wxArrayString& aSymbolNames ) :
|
||||
DIALOG_LIB_FIELDS_BASE( parent, wxID_ANY, wxString::Format( _( "Symbol Library Fields: %s" ), libId ) ),
|
||||
m_libId( libId ),
|
||||
m_parent( parent )
|
||||
{
|
||||
// Get all symbols from the library
|
||||
loadSymbols();
|
||||
loadSymbols( aSymbolNames );
|
||||
|
||||
m_bRefresh->SetBitmap( KiBitmapBundle( BITMAPS::small_refresh ) );
|
||||
|
||||
@ -392,25 +392,21 @@ void DIALOG_LIB_FIELDS::OnInit()
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_LIB_FIELDS::loadSymbols()
|
||||
void DIALOG_LIB_FIELDS::loadSymbols( const wxArrayString& aSymbolNames )
|
||||
{
|
||||
// Clear any existing data
|
||||
m_symbolsList.clear();
|
||||
|
||||
try
|
||||
{
|
||||
// Get all symbol names from the library manager
|
||||
wxArrayString symbolNames;
|
||||
m_parent->GetLibManager().GetSymbolNames( m_libId, symbolNames );
|
||||
|
||||
if( symbolNames.IsEmpty() )
|
||||
if( aSymbolNames.IsEmpty() )
|
||||
{
|
||||
wxMessageBox( wxString::Format( _( "No symbols found in library %s." ), m_libId ) );
|
||||
return;
|
||||
}
|
||||
|
||||
// Load each symbol from the library manager and add it to our list
|
||||
for( const wxString& symbolName : symbolNames )
|
||||
for( const wxString& symbolName : aSymbolNames )
|
||||
{
|
||||
LIB_SYMBOL* symbol = nullptr;
|
||||
|
||||
@ -1154,4 +1150,3 @@ void DIALOG_LIB_FIELDS::SetupAllColumnProperties()
|
||||
m_dataModel->SetSorting( sortCol, sortAscending );
|
||||
m_grid->SetSortingColumn( sortCol, sortAscending );
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ class LIB_SYMBOL;
|
||||
class DIALOG_LIB_FIELDS : public DIALOG_LIB_FIELDS_BASE
|
||||
{
|
||||
public:
|
||||
DIALOG_LIB_FIELDS( SYMBOL_EDIT_FRAME* parent, wxString libId );
|
||||
DIALOG_LIB_FIELDS( SYMBOL_EDIT_FRAME* parent, wxString libId, const wxArrayString& aSymbolNames );
|
||||
~DIALOG_LIB_FIELDS() override;
|
||||
|
||||
void OnInit();
|
||||
@ -68,7 +68,7 @@ private:
|
||||
void SetupColumnProperties( int aCol );
|
||||
void SetupAllColumnProperties();
|
||||
|
||||
void loadSymbols();
|
||||
void loadSymbols( const wxArrayString& aSymbolNames );
|
||||
|
||||
wxString m_libId;
|
||||
SYMBOL_EDIT_FRAME* m_parent;
|
||||
|
@ -921,7 +921,11 @@ int SYMBOL_EDITOR_CONTROL::ShowLibraryTable( const TOOL_EVENT& aEvent )
|
||||
SYMBOL_EDIT_FRAME* editFrame = getEditFrame<SYMBOL_EDIT_FRAME>();
|
||||
wxString libName = editFrame->GetTreeLIBID().GetLibNickname();
|
||||
|
||||
DIALOG_LIB_FIELDS dlg( editFrame, libName );
|
||||
// Get all symbol names from the library manager
|
||||
wxArrayString symbolNames;
|
||||
editFrame->GetLibManager().GetSymbolNames( libName, symbolNames );
|
||||
|
||||
DIALOG_LIB_FIELDS dlg( editFrame, libName, symbolNames );
|
||||
dlg.SetTitle( _( "Library Fields" ) );
|
||||
dlg.ShowModal();
|
||||
return 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user