Naming conventions.

This commit is contained in:
Jeff Young 2021-03-29 11:46:05 +01:00
parent 455e7dc3a8
commit 14e73d24dc
13 changed files with 176 additions and 176 deletions

View File

@ -306,5 +306,5 @@ void CVPCB_MAINFRAME::AutomaticFootprintMatching()
wxMessageBox( error_msg, _( "CvPcb Warning" ), wxOK | wxICON_WARNING, this ); wxMessageBox( error_msg, _( "CvPcb Warning" ), wxOK | wxICON_WARNING, this );
m_skipComponentSelect = false; m_skipComponentSelect = false;
m_compListBox->Refresh(); m_symbolsListBox->Refresh();
} }

View File

@ -60,9 +60,9 @@ CVPCB_MAINFRAME::CVPCB_MAINFRAME( KIWAY* aKiway, wxWindow* aParent ) :
KIWAY_PLAYER( aKiway, aParent, FRAME_CVPCB, _( "Assign Footprints" ), wxDefaultPosition, KIWAY_PLAYER( aKiway, aParent, FRAME_CVPCB, _( "Assign Footprints" ), wxDefaultPosition,
wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, CVPCB_MAINFRAME_NAME ) wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, CVPCB_MAINFRAME_NAME )
{ {
m_compListBox = NULL; m_symbolsListBox = NULL;
m_footprintListBox = NULL; m_footprintListBox = NULL;
m_libListBox = NULL; m_librariesListBox = NULL;
m_mainToolBar = NULL; m_mainToolBar = NULL;
m_modified = false; m_modified = false;
m_skipComponentSelect = false; m_skipComponentSelect = false;
@ -86,20 +86,20 @@ CVPCB_MAINFRAME::CVPCB_MAINFRAME( KIWAY* aKiway, wxWindow* aParent ) :
ReCreateMenuBar(); ReCreateMenuBar();
ReCreateHToolbar(); ReCreateHToolbar();
// Create list of available footprints and components of the schematic // Create list of available footprints and symbols of the schematic
BuildCmpListBox(); BuildSymbolsListBox();
BuildFOOTPRINTS_LISTBOX(); BuildFootprintsListBox();
BuildLIBRARY_LISTBOX(); BuildLibrariesListBox();
m_auimgr.SetManagedWindow( this ); m_auimgr.SetManagedWindow( this );
m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) ); m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) );
m_auimgr.AddPane( m_libListBox, EDA_PANE().Palette().Name( "Libraries" ).Left().Layer(1) m_auimgr.AddPane( m_librariesListBox, EDA_PANE().Palette().Name( "Libraries" ).Left().Layer(1)
.Caption( _( "Footprint Libraries" ) ) .Caption( _( "Footprint Libraries" ) )
.BestSize((int) ( m_frameSize.x * 0.20 ), m_frameSize.y ) ); .BestSize((int) ( m_frameSize.x * 0.20 ), m_frameSize.y ) );
m_auimgr.AddPane( m_compListBox, EDA_PANE().Palette().Name( "Components" ).Center().Layer(0) m_auimgr.AddPane( m_symbolsListBox, EDA_PANE().Palette().Name( "Symbols" ).Center().Layer(0)
.Caption( _( "Symbol : Footprint Assignments" ) ) ); .Caption( _( "Symbol : Footprint Assignments" ) ) );
m_auimgr.AddPane( m_footprintListBox, EDA_PANE().Palette().Name( "Footprints" ).Right().Layer(1) m_auimgr.AddPane( m_footprintListBox, EDA_PANE().Palette().Name( "Footprints" ).Right().Layer(1)
@ -246,15 +246,15 @@ void CVPCB_MAINFRAME::setupTools()
// menu instead of a context menu because we don't care about their position and want // menu instead of a context menu because we don't care about their position and want
// to be able to tell the difference between a menu click and a hotkey activation. // to be able to tell the difference between a menu click and a hotkey activation.
// Create the context menu for the component list box // Create the context menu for the symbols list box
m_componentContextMenu = new ACTION_MENU( false, tool ); m_symbolsContextMenu = new ACTION_MENU( false, tool );
m_componentContextMenu->Add( CVPCB_ACTIONS::showFootprintViewer ); m_symbolsContextMenu->Add( CVPCB_ACTIONS::showFootprintViewer );
m_componentContextMenu->AppendSeparator(); m_symbolsContextMenu->AppendSeparator();
m_componentContextMenu->Add( ACTIONS::cut ); m_symbolsContextMenu->Add( ACTIONS::cut );
m_componentContextMenu->Add( ACTIONS::copy ); m_symbolsContextMenu->Add( ACTIONS::copy );
m_componentContextMenu->Add( ACTIONS::paste ); m_symbolsContextMenu->Add( ACTIONS::paste );
m_componentContextMenu->AppendSeparator(); m_symbolsContextMenu->AppendSeparator();
m_componentContextMenu->Add( CVPCB_ACTIONS::deleteAssoc ); m_symbolsContextMenu->Add( CVPCB_ACTIONS::deleteAssoc );
// Create the context menu for the footprint list box // Create the context menu for the footprint list box
m_footprintContextMenu = new ACTION_MENU( false, tool ); m_footprintContextMenu = new ACTION_MENU( false, tool );
@ -314,10 +314,10 @@ void CVPCB_MAINFRAME::setupEventHandlers()
PopupMenu( m_footprintContextMenu ); PopupMenu( m_footprintContextMenu );
} ); } );
m_compListBox->Bind( wxEVT_RIGHT_DOWN, m_symbolsListBox->Bind( wxEVT_RIGHT_DOWN,
[this]( wxMouseEvent& ) [this]( wxMouseEvent& )
{ {
PopupMenu( m_componentContextMenu ); PopupMenu( m_symbolsContextMenu );
} ); } );
// Connect the handler for the save button // Connect the handler for the save button
@ -426,18 +426,18 @@ void CVPCB_MAINFRAME::OnSelectComponent( wxListEvent& event )
return; return;
wxString libraryName; wxString libraryName;
COMPONENT* component = GetSelectedComponent(); COMPONENT* symbol = GetSelectedComponent();
libraryName = m_libListBox->GetSelectedLibrary(); libraryName = m_librariesListBox->GetSelectedLibrary();
m_footprintListBox->SetFootprints( *m_FootprintsList, libraryName, component, m_footprintListBox->SetFootprints( *m_FootprintsList, libraryName, symbol,
m_tcFilterString->GetValue(), m_filteringOptions ); m_tcFilterString->GetValue(), m_filteringOptions );
if( component && component->GetFPID().IsValid() ) if( symbol && symbol->GetFPID().IsValid() )
m_footprintListBox->SetSelectedFootprint( component->GetFPID() ); m_footprintListBox->SetSelectedFootprint( symbol->GetFPID() );
else else
m_footprintListBox->SetSelection( m_footprintListBox->GetSelection(), false ); m_footprintListBox->SetSelection( m_footprintListBox->GetSelection(), false );
refreshAfterComponentSearch( component ); refreshAfterSymbolSearch( symbol );
} }
@ -458,7 +458,7 @@ void CVPCB_MAINFRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
CVPCB_SETTINGS* cfg = static_cast<CVPCB_SETTINGS*>( aCfg ); CVPCB_SETTINGS* cfg = static_cast<CVPCB_SETTINGS*>( aCfg );
cfg->m_FilterFootprint = m_filteringOptions; cfg->m_FilterFootprint = m_filteringOptions;
cfg->m_LibrariesWidth = m_libListBox->GetSize().x; cfg->m_LibrariesWidth = m_librariesListBox->GetSize().x;
cfg->m_FootprintsWidth = m_footprintListBox->GetSize().x; cfg->m_FootprintsWidth = m_footprintListBox->GetSize().x;
} }
@ -509,13 +509,13 @@ void CVPCB_MAINFRAME::AssociateFootprint( const CVPCB_ASSOCIATION& aAssociation,
if( m_netlist.IsEmpty() ) if( m_netlist.IsEmpty() )
return; return;
COMPONENT* component = m_netlist.GetComponent( aAssociation.GetComponentIndex() ); COMPONENT* symbol = m_netlist.GetComponent( aAssociation.GetComponentIndex() );
if( component == NULL ) if( symbol == NULL )
return; return;
LIB_ID fpid = aAssociation.GetNewFootprint(); LIB_ID fpid = aAssociation.GetNewFootprint();
LIB_ID oldFpid = component->GetFPID(); LIB_ID oldFpid = symbol->GetFPID();
// Test for validity of the requested footprint // Test for validity of the requested footprint
if( !fpid.empty() && !fpid.IsValid() ) if( !fpid.empty() && !fpid.IsValid() )
@ -526,9 +526,9 @@ void CVPCB_MAINFRAME::AssociateFootprint( const CVPCB_ASSOCIATION& aAssociation,
return; return;
} }
const KIID& id = component->GetKIIDs().front(); const KIID& id = symbol->GetKIIDs().front();
// Set new footprint to all instances of the selected component // Set new footprint to all instances of the selected symbol
for( unsigned int idx : GetComponentIndices() ) for( unsigned int idx : GetComponentIndices() )
{ {
COMPONENT* candidate = m_netlist.GetComponent( idx ); COMPONENT* candidate = m_netlist.GetComponent( idx );
@ -539,13 +539,13 @@ void CVPCB_MAINFRAME::AssociateFootprint( const CVPCB_ASSOCIATION& aAssociation,
// Set the new footprint // Set the new footprint
candidate->SetFPID( fpid ); candidate->SetFPID( fpid );
// create the new component description and set it // create the new symbol description and set it
wxString description = wxString::Format( CMP_FORMAT, wxString description = wxString::Format( CMP_FORMAT,
idx + 1, idx + 1,
candidate->GetReference(), candidate->GetReference(),
candidate->GetValue(), candidate->GetValue(),
candidate->GetFPID().Format().wx_str() ); candidate->GetFPID().Format().wx_str() );
m_compListBox->SetString( idx, description ); m_symbolsListBox->SetString( idx, description );
} }
} }
@ -554,7 +554,7 @@ void CVPCB_MAINFRAME::AssociateFootprint( const CVPCB_ASSOCIATION& aAssociation,
// Update the statusbar and refresh the list // Update the statusbar and refresh the list
DisplayStatus(); DisplayStatus();
m_compListBox->Refresh(); m_symbolsListBox->Refresh();
if( !aAddUndoItem ) if( !aAddUndoItem )
return; return;
@ -587,26 +587,26 @@ bool CVPCB_MAINFRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, i
} }
void CVPCB_MAINFRAME::refreshAfterComponentSearch( COMPONENT* component ) void CVPCB_MAINFRAME::refreshAfterSymbolSearch( COMPONENT* aSymbol )
{ {
// Tell AuiMgr that objects are changed ! // Tell AuiMgr that objects are changed !
if( m_auimgr.GetManagedWindow() ) // Be sure Aui Manager is initialized if( m_auimgr.GetManagedWindow() ) // Be sure Aui Manager is initialized
m_auimgr.Update(); // (could be not the case when starting CvPcb) m_auimgr.Update(); // (could be not the case when starting CvPcb)
if( component == NULL ) if( aSymbol == NULL )
{ {
DisplayStatus(); DisplayStatus();
return; return;
} }
// Preview of the already assigned footprint. // Preview of the already assigned footprint.
// Find the footprint that was already chosen for this component and select it, // Find the footprint that was already chosen for this aSymbol and select it,
// but only if the selection is made from the component list or the library list. // but only if the selection is made from the aSymbol list or the library list.
// If the selection is made from the footprint list, do not change the current // If the selection is made from the footprint list, do not change the current
// selected footprint. // selected footprint.
if( FindFocus() == m_compListBox || FindFocus() == m_libListBox ) if( FindFocus() == m_symbolsListBox || FindFocus() == m_librariesListBox )
{ {
wxString footprintName = FROM_UTF8( component->GetFPID().Format().c_str() ); wxString footprintName = FROM_UTF8( aSymbol->GetFPID().Format().c_str() );
m_footprintListBox->SetSelection( m_footprintListBox->GetSelection(), false ); m_footprintListBox->SetSelection( m_footprintListBox->GetSelection(), false );
@ -658,20 +658,20 @@ void CVPCB_MAINFRAME::DisplayStatus()
return; return;
wxString filters, msg; wxString filters, msg;
COMPONENT* component = GetSelectedComponent(); COMPONENT* symbol = GetSelectedComponent();
if( ( m_filteringOptions & FOOTPRINTS_LISTBOX::FILTERING_BY_COMPONENT_FP_FILTERS ) ) if( ( m_filteringOptions & FOOTPRINTS_LISTBOX::FILTERING_BY_COMPONENT_FP_FILTERS ) )
{ {
msg.Empty(); msg.Empty();
if( component ) if( symbol )
{ {
for( unsigned ii = 0; ii < component->GetFootprintFilters().GetCount(); ii++ ) for( unsigned ii = 0; ii < symbol->GetFootprintFilters().GetCount(); ii++ )
{ {
if( msg.IsEmpty() ) if( msg.IsEmpty() )
msg += component->GetFootprintFilters()[ii]; msg += symbol->GetFootprintFilters()[ii];
else else
msg += wxT( ", " ) + component->GetFootprintFilters()[ii]; msg += wxT( ", " ) + symbol->GetFootprintFilters()[ii];
} }
} }
@ -685,8 +685,8 @@ void CVPCB_MAINFRAME::DisplayStatus()
{ {
msg.Empty(); msg.Empty();
if( component ) if( symbol )
msg = wxString::Format( wxT( "%i" ), component->GetPinCount() ); msg = wxString::Format( wxT( "%i" ), symbol->GetPinCount() );
if( !filters.IsEmpty() ) if( !filters.IsEmpty() )
filters += wxT( ", " ); filters += wxT( ", " );
@ -699,7 +699,7 @@ void CVPCB_MAINFRAME::DisplayStatus()
if( ( m_filteringOptions & FOOTPRINTS_LISTBOX::FILTERING_BY_LIBRARY ) ) if( ( m_filteringOptions & FOOTPRINTS_LISTBOX::FILTERING_BY_LIBRARY ) )
{ {
msg = m_libListBox->GetSelectedLibrary(); msg = m_librariesListBox->GetSelectedLibrary();
if( !filters.IsEmpty() ) if( !filters.IsEmpty() )
filters += wxT( ", " ); filters += wxT( ", " );
@ -755,14 +755,14 @@ void CVPCB_MAINFRAME::DisplayStatus()
} }
else if( GetFocusedControl() == CVPCB_MAINFRAME::CONTROL_COMPONENT ) else if( GetFocusedControl() == CVPCB_MAINFRAME::CONTROL_COMPONENT )
{ {
// Use the footprint of the selected component // Use the footprint of the selected symbol
if( component ) if( symbol )
lib = component->GetFPID().GetLibNickname(); lib = symbol->GetFPID().GetLibNickname();
} }
else if( GetFocusedControl() == CVPCB_MAINFRAME::CONTROL_LIBRARY ) else if( GetFocusedControl() == CVPCB_MAINFRAME::CONTROL_LIBRARY )
{ {
// Use the library that is selected // Use the library that is selected
lib = m_libListBox->GetSelectedLibrary(); lib = m_librariesListBox->GetSelectedLibrary();
} }
// Extract the library information // Extract the library information
@ -807,7 +807,7 @@ void CVPCB_MAINFRAME::SendMessageToEESCHEMA( bool aClearHighligntOnly )
if( m_netlist.IsEmpty() ) if( m_netlist.IsEmpty() )
return; return;
// clear highlight of previously selected components (if any): // clear highlight of previously selected symbols (if any):
// Selecting a non existing symbol clears any previously highlighted symbols // Selecting a non existing symbol clears any previously highlighted symbols
std::string packet = "$CLEAR: \"HIGHLIGHTED\""; std::string packet = "$CLEAR: \"HIGHLIGHTED\"";
@ -819,7 +819,7 @@ void CVPCB_MAINFRAME::SendMessageToEESCHEMA( bool aClearHighligntOnly )
if( aClearHighligntOnly ) if( aClearHighligntOnly )
return; return;
int selection = m_compListBox->GetSelection(); int selection = m_symbolsListBox->GetSelection();
if ( selection < 0 ) // Nothing selected if ( selection < 0 ) // Nothing selected
return; return;
@ -827,10 +827,10 @@ void CVPCB_MAINFRAME::SendMessageToEESCHEMA( bool aClearHighligntOnly )
if( m_netlist.GetComponent( selection ) == NULL ) if( m_netlist.GetComponent( selection ) == NULL )
return; return;
// Now highlight the selected component: // Now highlight the selected symbol:
COMPONENT* component = m_netlist.GetComponent( selection ); COMPONENT* symbol = m_netlist.GetComponent( selection );
packet = StrPrintf( "$PART: \"%s\"", TO_UTF8( component->GetReference() ) ); packet = StrPrintf( "$PART: \"%s\"", TO_UTF8( symbol->GetReference() ) );
if( Kiface().IsSingle() ) if( Kiface().IsSingle() )
SendCommand( MSG_TO_SCH, packet ); SendCommand( MSG_TO_SCH, packet );
@ -866,14 +866,14 @@ int CVPCB_MAINFRAME::ReadSchematicNetlist( const std::string& aNetlist )
m_netlist.GetComponent( ii )->SetFPID( LIB_ID() ); m_netlist.GetComponent( ii )->SetFPID( LIB_ID() );
} }
// Sort components by reference: // Sort symbols by reference:
m_netlist.SortByReference(); m_netlist.SortByReference();
return 0; return 0;
} }
void CVPCB_MAINFRAME::BuildFOOTPRINTS_LISTBOX() void CVPCB_MAINFRAME::BuildFootprintsListBox()
{ {
wxFont guiFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ); wxFont guiFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
@ -890,52 +890,52 @@ void CVPCB_MAINFRAME::BuildFOOTPRINTS_LISTBOX()
} }
void CVPCB_MAINFRAME::BuildCmpListBox() void CVPCB_MAINFRAME::BuildSymbolsListBox()
{ {
wxString msg; wxString msg;
COMPONENT* component; COMPONENT* symbol;
wxFont guiFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ); wxFont guiFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
if( m_compListBox == NULL ) if( m_symbolsListBox == NULL )
{ {
m_compListBox = new COMPONENTS_LISTBOX( this, ID_CVPCB_COMPONENT_LIST ); m_symbolsListBox = new COMPONENTS_LISTBOX( this, ID_CVPCB_COMPONENT_LIST );
m_compListBox->SetFont( wxFont( guiFont.GetPointSize(), wxFONTFAMILY_MODERN, m_symbolsListBox->SetFont( wxFont( guiFont.GetPointSize(), wxFONTFAMILY_MODERN,
wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL ) ); wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL ) );
} }
m_compListBox->m_ComponentList.Clear(); m_symbolsListBox->m_ComponentList.Clear();
for( unsigned i = 0; i < m_netlist.GetCount(); i++ ) for( unsigned i = 0; i < m_netlist.GetCount(); i++ )
{ {
component = m_netlist.GetComponent( i ); symbol = m_netlist.GetComponent( i );
msg.Printf( CMP_FORMAT, msg.Printf( CMP_FORMAT,
m_compListBox->GetCount() + 1, m_symbolsListBox->GetCount() + 1,
component->GetReference(), symbol->GetReference(),
component->GetValue(), symbol->GetValue(),
component->GetFPID().Format().wx_str() ); symbol->GetFPID().Format().wx_str() );
m_compListBox->m_ComponentList.Add( msg ); m_symbolsListBox->m_ComponentList.Add( msg );
} }
if( m_compListBox->m_ComponentList.Count() ) if( m_symbolsListBox->m_ComponentList.Count() )
{ {
m_compListBox->SetItemCount( m_compListBox->m_ComponentList.Count() ); m_symbolsListBox->SetItemCount( m_symbolsListBox->m_ComponentList.Count() );
m_compListBox->SetSelection( 0, true ); m_symbolsListBox->SetSelection( 0, true );
m_compListBox->RefreshItems( 0L, m_compListBox->m_ComponentList.Count()-1 ); m_symbolsListBox->RefreshItems( 0L, m_symbolsListBox->m_ComponentList.Count() - 1 );
m_compListBox->UpdateWidth(); m_symbolsListBox->UpdateWidth();
} }
} }
void CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX() void CVPCB_MAINFRAME::BuildLibrariesListBox()
{ {
wxFont guiFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ); wxFont guiFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
if( m_libListBox == NULL ) if( m_librariesListBox == NULL )
{ {
m_libListBox = new LIBRARY_LISTBOX( this, ID_CVPCB_LIBRARY_LIST ); m_librariesListBox = new LIBRARY_LISTBOX( this, ID_CVPCB_LIBRARY_LIST );
m_libListBox->SetFont( wxFont( guiFont.GetPointSize(), wxFONTFAMILY_MODERN, m_librariesListBox->SetFont( wxFont( guiFont.GetPointSize(), wxFONTFAMILY_MODERN,
wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL ) ); wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL ) );
} }
FP_LIB_TABLE* tbl = Prj().PcbFootprintLibs( Kiway() ); FP_LIB_TABLE* tbl = Prj().PcbFootprintLibs( Kiway() );
@ -949,14 +949,14 @@ void CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX()
for( const wxString& libNickName : libNickNames ) for( const wxString& libNickName : libNickNames )
libNames.Add( libNickName ); libNames.Add( libNickName );
m_libListBox->SetLibraryList( libNames ); m_librariesListBox->SetLibraryList( libNames );
} }
} }
COMPONENT* CVPCB_MAINFRAME::GetSelectedComponent() COMPONENT* CVPCB_MAINFRAME::GetSelectedComponent()
{ {
int selection = m_compListBox->GetSelection(); int selection = m_symbolsListBox->GetSelection();
if( selection >= 0 && selection < (int) m_netlist.GetCount() ) if( selection >= 0 && selection < (int) m_netlist.GetCount() )
return m_netlist.GetComponent( selection ); return m_netlist.GetComponent( selection );
@ -971,12 +971,12 @@ void CVPCB_MAINFRAME::SetSelectedComponent( int aIndex, bool aSkipUpdate )
if( aIndex < 0 ) if( aIndex < 0 )
{ {
m_compListBox->DeselectAll(); m_symbolsListBox->DeselectAll();
} }
else if( aIndex < m_compListBox->GetCount() ) else if( aIndex < m_symbolsListBox->GetCount() )
{ {
m_compListBox->DeselectAll(); m_symbolsListBox->DeselectAll();
m_compListBox->SetSelection( aIndex ); m_symbolsListBox->SetSelection( aIndex );
SendMessageToEESCHEMA(); SendMessageToEESCHEMA();
} }
@ -991,7 +991,7 @@ std::vector<unsigned int> CVPCB_MAINFRAME::GetComponentIndices(
int lastIdx; int lastIdx;
// Make sure a netlist has been loaded and the box has contents // Make sure a netlist has been loaded and the box has contents
if( m_netlist.IsEmpty() || m_compListBox->GetCount() == 0 ) if( m_netlist.IsEmpty() || m_symbolsListBox->GetCount() == 0 )
return idx; return idx;
switch( aCriteria ) switch( aCriteria )
@ -1003,18 +1003,18 @@ std::vector<unsigned int> CVPCB_MAINFRAME::GetComponentIndices(
case CVPCB_MAINFRAME::SEL_COMPONENTS: case CVPCB_MAINFRAME::SEL_COMPONENTS:
// Check to see if anything is selected // Check to see if anything is selected
if( m_compListBox->GetSelectedItemCount() < 1 ) if( m_symbolsListBox->GetSelectedItemCount() < 1 )
break; break;
// Get the components // Get the symbols
lastIdx = m_compListBox->GetFirstSelected(); lastIdx = m_symbolsListBox->GetFirstSelected();
idx.emplace_back( lastIdx ); idx.emplace_back( lastIdx );
lastIdx = m_compListBox->GetNextSelected( lastIdx ); lastIdx = m_symbolsListBox->GetNextSelected( lastIdx );
while( lastIdx > 0 ) while( lastIdx > 0 )
{ {
idx.emplace_back( lastIdx ); idx.emplace_back( lastIdx );
lastIdx = m_compListBox->GetNextSelected( lastIdx ); lastIdx = m_symbolsListBox->GetNextSelected( lastIdx );
} }
break; break;
@ -1035,7 +1035,7 @@ std::vector<unsigned int> CVPCB_MAINFRAME::GetComponentIndices(
break; break;
default: default:
wxASSERT_MSG( false, "Invalid component selection criteria" ); wxASSERT_MSG( false, "Invalid symbol selection criteria" );
} }
return idx; return idx;
@ -1058,9 +1058,9 @@ wxWindow* CVPCB_MAINFRAME::GetToolCanvas() const
CVPCB_MAINFRAME::CONTROL_TYPE CVPCB_MAINFRAME::GetFocusedControl() const CVPCB_MAINFRAME::CONTROL_TYPE CVPCB_MAINFRAME::GetFocusedControl() const
{ {
if( m_libListBox->HasFocus() ) if( m_librariesListBox->HasFocus() )
return CVPCB_MAINFRAME::CONTROL_LIBRARY; return CVPCB_MAINFRAME::CONTROL_LIBRARY;
else if( m_compListBox->HasFocus() ) else if( m_symbolsListBox->HasFocus() )
return CVPCB_MAINFRAME::CONTROL_COMPONENT; return CVPCB_MAINFRAME::CONTROL_COMPONENT;
else if( m_footprintListBox->HasFocus() ) else if( m_footprintListBox->HasFocus() )
return CVPCB_MAINFRAME::CONTROL_FOOTPRINT; return CVPCB_MAINFRAME::CONTROL_FOOTPRINT;
@ -1071,10 +1071,10 @@ CVPCB_MAINFRAME::CONTROL_TYPE CVPCB_MAINFRAME::GetFocusedControl() const
wxControl* CVPCB_MAINFRAME::GetFocusedControlObject() const wxControl* CVPCB_MAINFRAME::GetFocusedControlObject() const
{ {
if( m_libListBox->HasFocus() ) if( m_librariesListBox->HasFocus() )
return m_libListBox; return m_librariesListBox;
else if( m_compListBox->HasFocus() ) else if( m_symbolsListBox->HasFocus() )
return m_compListBox; return m_symbolsListBox;
else if( m_footprintListBox->HasFocus() ) else if( m_footprintListBox->HasFocus() )
return m_footprintListBox; return m_footprintListBox;
@ -1086,8 +1086,8 @@ void CVPCB_MAINFRAME::SetFocusedControl( CVPCB_MAINFRAME::CONTROL_TYPE aLB )
{ {
switch( aLB ) switch( aLB )
{ {
case CVPCB_MAINFRAME::CONTROL_LIBRARY: m_libListBox->SetFocus(); break; case CVPCB_MAINFRAME::CONTROL_LIBRARY: m_librariesListBox->SetFocus(); break;
case CVPCB_MAINFRAME::CONTROL_COMPONENT: m_compListBox->SetFocus(); break; case CVPCB_MAINFRAME::CONTROL_COMPONENT: m_symbolsListBox->SetFocus(); break;
case CVPCB_MAINFRAME::CONTROL_FOOTPRINT: m_footprintListBox->SetFocus(); break; case CVPCB_MAINFRAME::CONTROL_FOOTPRINT: m_footprintListBox->SetFocus(); break;
default: break; default: break;
} }

View File

@ -65,8 +65,8 @@ class CVPCB_MAINFRAME : public KIWAY_PLAYER
int m_filteringOptions; int m_filteringOptions;
ACTION_TOOLBAR* m_mainToolBar; ACTION_TOOLBAR* m_mainToolBar;
FOOTPRINTS_LISTBOX* m_footprintListBox; FOOTPRINTS_LISTBOX* m_footprintListBox;
LIBRARY_LISTBOX* m_libListBox; LIBRARY_LISTBOX* m_librariesListBox;
COMPONENTS_LISTBOX* m_compListBox; COMPONENTS_LISTBOX* m_symbolsListBox;
wxTextCtrl* m_tcFilterString; wxTextCtrl* m_tcFilterString;
wxStaticText* m_statusLine1; wxStaticText* m_statusLine1;
wxStaticText* m_statusLine2; wxStaticText* m_statusLine2;
@ -256,9 +256,9 @@ public:
/* /*
* Functions to build the listboxes and their contents * Functions to build the listboxes and their contents
*/ */
void BuildCmpListBox(); void BuildSymbolsListBox();
void BuildFOOTPRINTS_LISTBOX(); void BuildFootprintsListBox();
void BuildLIBRARY_LISTBOX(); void BuildLibrariesListBox();
/** /**
* Function SaveFootprintAssociation * Function SaveFootprintAssociation
@ -390,14 +390,14 @@ private:
*/ */
int buildEquivalenceList( FOOTPRINT_EQUIVALENCE_LIST& aList, wxString * aErrorMessages = NULL ); int buildEquivalenceList( FOOTPRINT_EQUIVALENCE_LIST& aList, wxString * aErrorMessages = NULL );
void refreshAfterComponentSearch (COMPONENT* component); void refreshAfterSymbolSearch( COMPONENT* aSymbol );
// Tool dispatcher // Tool dispatcher
TOOL_DISPATCHER* m_toolDispatcher; TOOL_DISPATCHER* m_toolDispatcher;
// Context menus for the list boxes // Context menus for the list boxes
ACTION_MENU* m_footprintContextMenu; ACTION_MENU* m_footprintContextMenu;
ACTION_MENU* m_componentContextMenu; ACTION_MENU* m_symbolsContextMenu;
// Undo/Redo item lists // Undo/Redo item lists
CVPCB_UNDO_REDO_LIST m_undoList; CVPCB_UNDO_REDO_LIST m_undoList;

View File

@ -23,7 +23,7 @@
/** /**
* @file listboxes.cpp * @file listboxes.cpp
* @brief Implementation of class for displaying footprint list and component lists. * @brief Implementation of class for displaying footprint and symbol lists.
*/ */
#include <cvpcb_mainframe.h> #include <cvpcb_mainframe.h>
@ -31,7 +31,7 @@
/****************************************************************************** /******************************************************************************
* Basic class (from wxListView) to display component and footprint lists * Basic class (from wxListView) to display symbol and footprint lists
* Not directly used: the 2 list boxes actually used are derived from it * Not directly used: the 2 list boxes actually used are derived from it
******************************************************************************/ ******************************************************************************/

View File

@ -83,17 +83,17 @@ bool CVPCB_MAINFRAME::ReadNetListAndFpFiles( const std::string& aNetlist )
ReadSchematicNetlist( aNetlist ); ReadSchematicNetlist( aNetlist );
if( m_compListBox == NULL ) if( m_symbolsListBox == NULL )
return false; return false;
wxSafeYield(); wxSafeYield();
LoadFootprintFiles(); LoadFootprintFiles();
BuildFOOTPRINTS_LISTBOX(); BuildFootprintsListBox();
BuildLIBRARY_LISTBOX(); BuildLibrariesListBox();
m_compListBox->Clear(); m_symbolsListBox->Clear();
if( m_netlist.AnyFootprintsLinked() ) if( m_netlist.AnyFootprintsLinked() )
{ {
@ -260,16 +260,16 @@ bool CVPCB_MAINFRAME::ReadNetListAndFpFiles( const std::string& aNetlist )
{ {
COMPONENT* component = m_netlist.GetComponent( i ); COMPONENT* component = m_netlist.GetComponent( i );
msg.Printf( CMP_FORMAT, m_compListBox->GetCount() + 1, msg.Printf( CMP_FORMAT, m_symbolsListBox->GetCount() + 1,
component->GetReference(), component->GetReference(),
component->GetValue(), component->GetValue(),
FROM_UTF8( component->GetFPID().Format().c_str() ) ); FROM_UTF8( component->GetFPID().Format().c_str() ) );
m_compListBox->AppendLine( msg ); m_symbolsListBox->AppendLine( msg );
} }
if( !m_netlist.IsEmpty() ) if( !m_netlist.IsEmpty() )
m_compListBox->SetSelection( 0, true ); m_symbolsListBox->SetSelection( 0, true );
DisplayStatus(); DisplayStatus();

View File

@ -64,11 +64,11 @@ void SCH_EDIT_FRAME::DeleteAnnotation( bool aCurrentSheetOnly, bool* aAppendUndo
{ {
for( SCH_ITEM* item : aScreen->Items().OfType( SCH_COMPONENT_T ) ) for( SCH_ITEM* item : aScreen->Items().OfType( SCH_COMPONENT_T ) )
{ {
SCH_COMPONENT* component = static_cast<SCH_COMPONENT*>( item ); SCH_COMPONENT* symbol = static_cast<SCH_COMPONENT*>( item );
SaveCopyInUndoList( aScreen, component, UNDO_REDO::CHANGED, *aAppendUndo ); SaveCopyInUndoList( aScreen, symbol, UNDO_REDO::CHANGED, *aAppendUndo );
*aAppendUndo = true; *aAppendUndo = true;
component->ClearAnnotation( aSheet ); symbol->ClearAnnotation( aSheet );
} }
}; };
@ -108,13 +108,13 @@ void SCH_EDIT_FRAME::AnnotateSymbols( bool aAnnotateSchematic,
SCH_SHEET_LIST sheets = Schematic().GetSheets(); SCH_SHEET_LIST sheets = Schematic().GetSheets();
bool appendUndo = false; bool appendUndo = false;
// Map of locked components // Map of locked symbols
SCH_MULTI_UNIT_REFERENCE_MAP lockedComponents; SCH_MULTI_UNIT_REFERENCE_MAP lockedSymbols;
// Map of previous annotation for building info messages // Map of previous annotation for building info messages
std::map<wxString, wxString> previousAnnotation; std::map<wxString, wxString> previousAnnotation;
// Test for and replace duplicate time stamps in components and sheets. Duplicate // Test for and replace duplicate time stamps in symbols and sheets. Duplicate
// time stamps can happen with old schematics, schematic conversions, or manual // time stamps can happen with old schematics, schematic conversions, or manual
// editing of files. // editing of files.
if( aRepairTimestamps ) if( aRepairTimestamps )
@ -133,28 +133,28 @@ void SCH_EDIT_FRAME::AnnotateSymbols( bool aAnnotateSchematic,
if( aLockUnits ) if( aLockUnits )
{ {
if( aAnnotateSchematic ) if( aAnnotateSchematic )
sheets.GetMultiUnitSymbols( lockedComponents ); sheets.GetMultiUnitSymbols( lockedSymbols );
else else
GetCurrentSheet().GetMultiUnitSymbols( lockedComponents ); GetCurrentSheet().GetMultiUnitSymbols( lockedSymbols );
} }
// Store previous annotations for building info messages // Store previous annotations for building info messages
mapExistingAnnotation( previousAnnotation ); mapExistingAnnotation( previousAnnotation );
// If it is an annotation for all the components, reset previous annotation. // If it is an annotation for all the symbols, reset previous annotation.
if( aResetAnnotation ) if( aResetAnnotation )
DeleteAnnotation( !aAnnotateSchematic, &appendUndo ); DeleteAnnotation( !aAnnotateSchematic, &appendUndo );
// Set sheet number and number of sheets. // Set sheet number and number of sheets.
SetSheetNumberAndCount(); SetSheetNumberAndCount();
// Build component list // Build symbol list
if( aAnnotateSchematic ) if( aAnnotateSchematic )
sheets.GetSymbols( references ); sheets.GetSymbols( references );
else else
GetCurrentSheet().GetSymbols( references ); GetCurrentSheet().GetSymbols( references );
// Break full components reference in name (prefix) and number: // Break full symbol reference into name (prefix) and number:
// example: IC1 become IC, and 1 // example: IC1 become IC, and 1
references.SplitReferences(); references.SplitReferences();
@ -185,7 +185,7 @@ void SCH_EDIT_FRAME::AnnotateSymbols( bool aAnnotateSchematic,
} }
// Recalculate and update reference numbers in schematic // Recalculate and update reference numbers in schematic
references.Annotate( useSheetNum, idStep, aStartNumber, lockedComponents ); references.Annotate( useSheetNum, idStep, aStartNumber, lockedSymbols );
for( size_t i = 0; i < references.GetCount(); i++ ) for( size_t i = 0; i < references.GetCount(); i++ )
{ {

View File

@ -146,9 +146,9 @@ void EE_COLLECTOR::Collect( SCH_SCREEN* aScreen, const KICAD_T aFilterList[], co
if( aScreen ) if( aScreen )
{ {
// Components and sheets own their own children so have to be visited even if // Symbols and sheets own their own children so have to be visited even if
// they're not in the filter list // they're not in the filter list
bool componentsVisited = false; bool symbolsVisited = false;
bool sheetsVisited = false; bool sheetsVisited = false;
bool globalLabelsVisited = false; bool globalLabelsVisited = false;
@ -157,7 +157,7 @@ void EE_COLLECTOR::Collect( SCH_SCREEN* aScreen, const KICAD_T aFilterList[], co
for( SCH_ITEM* item : aScreen->Items().OfType( *filter ) ) for( SCH_ITEM* item : aScreen->Items().OfType( *filter ) )
{ {
if( *filter == SCH_COMPONENT_T || *filter == SCH_LOCATE_ANY_T ) if( *filter == SCH_COMPONENT_T || *filter == SCH_LOCATE_ANY_T )
componentsVisited = true; symbolsVisited = true;
if( *filter == SCH_SHEET_T || *filter == SCH_LOCATE_ANY_T ) if( *filter == SCH_SHEET_T || *filter == SCH_LOCATE_ANY_T )
sheetsVisited = true; sheetsVisited = true;
@ -169,7 +169,7 @@ void EE_COLLECTOR::Collect( SCH_SCREEN* aScreen, const KICAD_T aFilterList[], co
} }
} }
if( !componentsVisited ) if( !symbolsVisited )
{ {
for( SCH_ITEM* item : aScreen->Items().OfType( SCH_COMPONENT_T ) ) for( SCH_ITEM* item : aScreen->Items().OfType( SCH_COMPONENT_T ) )
item->Visit( m_inspector, nullptr, m_scanTypes ); item->Visit( m_inspector, nullptr, m_scanTypes );
@ -234,15 +234,15 @@ bool EE_COLLECTOR::IsCorner() const
void CollectOtherUnits( const wxString& aRef, int aUnit, SCH_SHEET_PATH& aSheet, void CollectOtherUnits( const wxString& aRef, int aUnit, SCH_SHEET_PATH& aSheet,
std::vector<SCH_COMPONENT*>* otherUnits ) std::vector<SCH_COMPONENT*>* otherUnits )
{ {
SCH_REFERENCE_LIST components; SCH_REFERENCE_LIST symbols;
aSheet.GetSymbols( components ); aSheet.GetSymbols( symbols );
for( unsigned i = 0; i < components.GetCount(); i++ ) for( unsigned i = 0; i < symbols.GetCount(); i++ )
{ {
SCH_REFERENCE component = components[i]; SCH_REFERENCE symbol = symbols[i];
if( component.GetRef() == aRef && component.GetUnit() != aUnit ) if( symbol.GetRef() == aRef && symbol.GetUnit() != aUnit )
otherUnits->push_back( component.GetSymbol() ); otherUnits->push_back( symbol.GetSymbol() );
} }
} }

View File

@ -55,8 +55,8 @@ enum class CONNECTION_TYPE
* more than once in a higher level sheet). Because of this, a single item may * more than once in a higher level sheet). Because of this, a single item may
* contain more than one SCH_CONNECTION -- each is specific to a sheet. * contain more than one SCH_CONNECTION -- each is specific to a sheet.
* *
* Components contain connections for each of their pins (and for each sheet * Symbols contain connections for each of their pins (and for each sheet they
* they exist on) but don't use their own connection object. * exist on) but don't use their own connection object.
*/ */
class SCH_CONNECTION class SCH_CONNECTION
{ {

View File

@ -398,12 +398,12 @@ public:
* Check for annotation errors. * Check for annotation errors.
* *
* The following list of items are checked: * The following list of items are checked:
* - Components that are not annotated. * - Symbols that are not annotated.
* - Duplicate component references. * - Duplicate symbol references.
* - Multiple part per package components where the part number is greater number of parts * - Multiple part per package symbols where the part number is greater number of parts in
* in the package. * the package.
* - Multiple part per package components where the reference designator is different * - Multiple part per package symbols where the reference designator is different between
* between parts. * parts.
* *
* @return Number of annotation errors found. * @return Number of annotation errors found.
* @param aReporter A handler for error reporting. * @param aReporter A handler for error reporting.

View File

@ -42,7 +42,7 @@
/** /**
* A text control validator used for validating the text allowed in library and * A text control validator used for validating the text allowed in library and
* schematic component fields. * schematic symbol fields.
* *
* - The reference field does not accept spaces. * - The reference field does not accept spaces.
* - The value field does not accept spaces in the symbol library editor because in symbol * - The value field does not accept spaces in the symbol library editor because in symbol

View File

@ -538,7 +538,7 @@ void SCH_EDITOR_CONTROL::doCrossProbeSchToPcb( const TOOL_EVENT& aEvent, bool aF
EE_SELECTION_TOOL* selTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>(); EE_SELECTION_TOOL* selTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
SCH_ITEM* item = nullptr; SCH_ITEM* item = nullptr;
SCH_COMPONENT* component = nullptr; SCH_COMPONENT* symbol = nullptr;
if( aForce ) if( aForce )
{ {
@ -570,19 +570,19 @@ void SCH_EDITOR_CONTROL::doCrossProbeSchToPcb( const TOOL_EVENT& aEvent, bool aF
case LIB_FIELD_T: case LIB_FIELD_T:
if( item->GetParent() && item->GetParent()->Type() == SCH_COMPONENT_T ) if( item->GetParent() && item->GetParent()->Type() == SCH_COMPONENT_T )
{ {
component = (SCH_COMPONENT*) item->GetParent(); symbol = (SCH_COMPONENT*) item->GetParent();
m_frame->SendMessageToPCBNEW( item, component ); m_frame->SendMessageToPCBNEW( item, symbol );
} }
break; break;
case SCH_COMPONENT_T: case SCH_COMPONENT_T:
component = (SCH_COMPONENT*) item; symbol = (SCH_COMPONENT*) item;
m_frame->SendMessageToPCBNEW( item, component ); m_frame->SendMessageToPCBNEW( item, symbol );
break; break;
case SCH_PIN_T: case SCH_PIN_T:
component = (SCH_COMPONENT*) item->GetParent(); symbol = (SCH_COMPONENT*) item->GetParent();
m_frame->SendMessageToPCBNEW( static_cast<SCH_PIN*>( item ), component ); m_frame->SendMessageToPCBNEW( static_cast<SCH_PIN*>( item ), symbol );
break; break;
case SCH_SHEET_T: case SCH_SHEET_T:
@ -1443,7 +1443,7 @@ int SCH_EDITOR_CONTROL::Paste( const TOOL_EVENT& aEvent )
if( item->Type() == SCH_COMPONENT_T ) if( item->Type() == SCH_COMPONENT_T )
{ {
SCH_COMPONENT* component = (SCH_COMPONENT*) item; SCH_COMPONENT* symbol = static_cast<SCH_COMPONENT*>( item );
// The library symbol gets set from the cached library symbols in the current // The library symbol gets set from the cached library symbols in the current
// schematic not the symbol libraries. The cached library symbol may have // schematic not the symbol libraries. The cached library symbol may have
@ -1453,17 +1453,17 @@ int SCH_EDITOR_CONTROL::Paste( const TOOL_EVENT& aEvent )
wxCHECK2( currentScreen, continue ); wxCHECK2( currentScreen, continue );
auto it = currentScreen->GetLibSymbols().find( component->GetSchSymbolLibraryName() ); auto it = currentScreen->GetLibSymbols().find( symbol->GetSchSymbolLibraryName() );
if( it != currentScreen->GetLibSymbols().end() ) if( it != currentScreen->GetLibSymbols().end() )
component->SetLibSymbol( new LIB_PART( *it->second ) ); symbol->SetLibSymbol( new LIB_PART( *it->second ) );
if( !forceKeepAnnotations ) if( !forceKeepAnnotations )
{ {
// clear the annotation, but preserve the selected unit // clear the annotation, but preserve the selected unit
int unit = component->GetUnit(); int unit = symbol->GetUnit();
component->ClearAnnotation( nullptr ); symbol->ClearAnnotation( nullptr );
component->SetUnit( unit ); symbol->SetUnit( unit );
} }
} }

View File

@ -920,14 +920,14 @@ void SCH_LINE_WIRE_BUS_TOOL::finishSegments()
// Correct and remove segments that need to be merged. // Correct and remove segments that need to be merged.
m_frame->SchematicCleanUp(); m_frame->SchematicCleanUp();
std::vector<SCH_ITEM*> components; std::vector<SCH_ITEM*> symbols;
for( SCH_ITEM* item : m_frame->GetScreen()->Items().OfType( SCH_COMPONENT_T ) ) for( SCH_ITEM* symbol : m_frame->GetScreen()->Items().OfType( SCH_COMPONENT_T ) )
components.push_back( item ); symbols.push_back( symbol );
for( SCH_ITEM* item : components ) for( SCH_ITEM* symbol : symbols )
{ {
std::vector<wxPoint> pts = item->GetConnectionPoints(); std::vector<wxPoint> pts = symbol->GetConnectionPoints();
if( pts.size() > 2 ) if( pts.size() > 2 )
continue; continue;

View File

@ -313,7 +313,7 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
m_anchorPos = m_cursor; m_anchorPos = m_cursor;
} }
// For some items, moving the cursor to anchor is not good (for instance large // For some items, moving the cursor to anchor is not good (for instance large
// hierarchical sheets or components can have the anchor outside the view) // hierarchical sheets or symbols can have the anchor outside the view)
else if( selection.Size() == 1 && !sch_item->IsMovableFromAnchorPoint() ) else if( selection.Size() == 1 && !sch_item->IsMovableFromAnchorPoint() )
{ {
m_cursor = getViewControls()->GetCursorPosition( true ); m_cursor = getViewControls()->GetCursorPosition( true );
@ -412,12 +412,12 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
if( evt->GetCommandId().get() >= ID_POPUP_SCH_SELECT_UNIT_CMP if( evt->GetCommandId().get() >= ID_POPUP_SCH_SELECT_UNIT_CMP
&& evt->GetCommandId().get() <= ID_POPUP_SCH_SELECT_UNIT_CMP_MAX ) && evt->GetCommandId().get() <= ID_POPUP_SCH_SELECT_UNIT_CMP_MAX )
{ {
SCH_COMPONENT* component = dynamic_cast<SCH_COMPONENT*>( selection.Front() ); SCH_COMPONENT* symbol = dynamic_cast<SCH_COMPONENT*>( selection.Front() );
int unit = evt->GetCommandId().get() - ID_POPUP_SCH_SELECT_UNIT_CMP; int unit = evt->GetCommandId().get() - ID_POPUP_SCH_SELECT_UNIT_CMP;
if( component ) if( symbol )
{ {
m_frame->SelectUnit( component, unit ); m_frame->SelectUnit( symbol, unit );
m_toolMgr->RunAction( ACTIONS::refreshPreview ); m_toolMgr->RunAction( ACTIONS::refreshPreview );
} }
} }
@ -592,7 +592,7 @@ void SCH_MOVE_TOOL::getConnectedDragItems( SCH_ITEM* aOriginalItem, wxPoint aPoi
case SCH_JUNCTION_T: case SCH_JUNCTION_T:
if( test->IsConnected( aPoint ) ) if( test->IsConnected( aPoint ) )
{ {
// Add a new wire between the component or junction and the selected item so // Add a new wire between the symbol or junction and the selected item so
// the selected item can be dragged. // the selected item can be dragged.
SCH_LINE* newWire = nullptr; SCH_LINE* newWire = nullptr;
@ -692,8 +692,8 @@ void SCH_MOVE_TOOL::moveItem( EDA_ITEM* aItem, const VECTOR2I& aDelta )
if( parent && parent->Type() == SCH_COMPONENT_T ) if( parent && parent->Type() == SCH_COMPONENT_T )
{ {
SCH_COMPONENT* component = (SCH_COMPONENT*) aItem->GetParent(); SCH_COMPONENT* symbol = (SCH_COMPONENT*) aItem->GetParent();
TRANSFORM transform = component->GetTransform().InverseTransform(); TRANSFORM transform = symbol->GetTransform().InverseTransform();
delta = transform.TransformCoordinate( delta ); delta = transform.TransformCoordinate( delta );
} }