Fix bug #1364174 (Component Library Editor: Bug when decreasing "Number of Units")
This commit is contained in:
parent
06f59a94ed
commit
aff8c27942
|
@ -182,7 +182,6 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::InitBasicPanel()
|
|||
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnOkClick( wxCommandEvent& event )
|
||||
{
|
||||
/* Update the doc, keyword and doc filename strings */
|
||||
int index;
|
||||
LIB_ALIAS* alias;
|
||||
LIB_PART* component = m_Parent->GetCurPart();
|
||||
|
||||
|
@ -206,8 +205,8 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnOkClick( wxCommandEvent& event )
|
|||
|
||||
component->SetAliases( m_PartAliasListCtrl->GetStrings() );
|
||||
|
||||
index = m_SelNumberOfUnits->GetValue();
|
||||
ChangeNbUnitsPerPackage( index );
|
||||
int unitCount = m_SelNumberOfUnits->GetValue();
|
||||
ChangeNbUnitsPerPackage( unitCount );
|
||||
|
||||
if( m_AsConvertButt->GetValue() )
|
||||
{
|
||||
|
|
|
@ -419,6 +419,7 @@ void LIB_EDIT_FRAME::UpdatePartSelectList()
|
|||
|
||||
if( !part || part->GetUnitCount() <= 1 )
|
||||
{
|
||||
m_unit = 1;
|
||||
m_partSelectBox->Append( wxEmptyString );
|
||||
}
|
||||
else
|
||||
|
@ -431,6 +432,11 @@ void LIB_EDIT_FRAME::UpdatePartSelectList()
|
|||
}
|
||||
}
|
||||
|
||||
// Ensure the current selected unit is compatible with
|
||||
// the number of units of the current part:
|
||||
if( part && part->GetUnitCount() < m_unit )
|
||||
m_unit = 1;
|
||||
|
||||
m_partSelectBox->SetSelection( ( m_unit > 0 ) ? m_unit - 1 : 0 );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue