Commit aff8c279 authored by jean-pierre charras's avatar jean-pierre charras

Fix bug #1364174 (Component Library Editor: Bug when decreasing "Number of Units")

parent 06f59a94
......@@ -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 );
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment