eeschema: Modify all units at the same time
When editing symbol library reference, this ensures that all units are
modified by the same action and the component is not represented by its
subunits.
Fixes: lp:1834509
* https://bugs.launchpad.net/kicad/+bug/1834509
(cherry picked from commit 80e0d848f2
)
This commit is contained in:
parent
48d68f55d7
commit
85eed87b28
|
@ -456,20 +456,8 @@ void DIALOG_EDIT_COMPONENTS_LIBID::initDlg()
|
||||||
candidate.m_Screen = item.GetSheetPath().LastScreen();
|
candidate.m_Screen = item.GetSheetPath().LastScreen();
|
||||||
SCH_SHEET_PATH sheetpath = item.GetSheetPath();
|
SCH_SHEET_PATH sheetpath = item.GetSheetPath();
|
||||||
candidate.m_Reference = candidate.m_Component->GetRef( &sheetpath );
|
candidate.m_Reference = candidate.m_Component->GetRef( &sheetpath );
|
||||||
// For multi units per package , add unit id.
|
|
||||||
// however, there is a problem: the unit id stored is always >= 1
|
|
||||||
// and 1 for no multi units.
|
|
||||||
// so add unit id only if unit > 1 if the unit count is > 1
|
|
||||||
// (can be 0 if the symbol is not found)
|
|
||||||
int unit = candidate.m_Component->GetUnitSelection( &sheetpath );
|
|
||||||
int unitcount = candidate.m_Component->GetUnitCount();
|
int unitcount = candidate.m_Component->GetUnitCount();
|
||||||
candidate.m_IsOrphan = ( unitcount == 0 );
|
candidate.m_IsOrphan = ( unitcount == 0 );
|
||||||
|
|
||||||
if( unitcount > 1 || unit > 1 )
|
|
||||||
{
|
|
||||||
candidate.m_Reference << wxChar( ('A' + unit -1) );
|
|
||||||
}
|
|
||||||
|
|
||||||
m_components.push_back( candidate );
|
m_components.push_back( candidate );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -484,14 +472,12 @@ void DIALOG_EDIT_COMPONENTS_LIBID::initDlg()
|
||||||
wxString last_str_libid = m_components.front().GetStringLibId();
|
wxString last_str_libid = m_components.front().GetStringLibId();
|
||||||
int row = 0;
|
int row = 0;
|
||||||
wxString refs;
|
wxString refs;
|
||||||
|
wxString last_ref;
|
||||||
bool mark_cell = m_components.front().m_IsOrphan;
|
bool mark_cell = m_components.front().m_IsOrphan;
|
||||||
CMP_CANDIDATE* cmp = nullptr;
|
|
||||||
|
|
||||||
for( unsigned ii = 0; ii < m_components.size(); ii++ )
|
for( auto& cmp : m_components )
|
||||||
{
|
{
|
||||||
cmp = &m_components[ii];
|
wxString str_libid = cmp.GetStringLibId();
|
||||||
|
|
||||||
wxString str_libid = cmp->GetStringLibId();
|
|
||||||
|
|
||||||
if( last_str_libid != str_libid )
|
if( last_str_libid != str_libid )
|
||||||
{
|
{
|
||||||
|
@ -499,17 +485,24 @@ void DIALOG_EDIT_COMPONENTS_LIBID::initDlg()
|
||||||
AddRowToGrid( mark_cell, refs, last_str_libid );
|
AddRowToGrid( mark_cell, refs, last_str_libid );
|
||||||
|
|
||||||
// prepare next entry
|
// prepare next entry
|
||||||
mark_cell = cmp->m_IsOrphan;
|
mark_cell = cmp.m_IsOrphan;
|
||||||
last_str_libid = str_libid;
|
last_str_libid = str_libid;
|
||||||
refs.Empty();
|
refs.Empty();
|
||||||
row++;
|
row++;
|
||||||
}
|
}
|
||||||
|
else if( cmp.GetSchematicReference() == last_ref )
|
||||||
|
{
|
||||||
|
cmp.m_Row = row;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
last_ref = cmp.GetSchematicReference();
|
||||||
|
|
||||||
if( !refs.IsEmpty() )
|
if( !refs.IsEmpty() )
|
||||||
refs += wxT( ", " );
|
refs += wxT( ", " );
|
||||||
|
|
||||||
refs += cmp->GetSchematicReference();
|
refs += cmp.GetSchematicReference();
|
||||||
cmp->m_Row = row;
|
cmp.m_Row = row;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add last component group:
|
// Add last component group:
|
||||||
|
|
Loading…
Reference in New Issue