/* Initialize state of check boxes and texts */ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::initDlg() { m_AliasLocation = -1; LIB_COMPONENT* component = m_Parent->GetComponent(); if( component == NULL ) { SetTitle( _( "Library Component Properties" ) ); return; } wxString title; bool isRoot = m_Parent->GetAliasName().CmpNoCase( component->GetName() ) == 0; if( !isRoot ) { title.Printf( _( "Properties for %s (alias of %s)" ), GetChars( m_Parent->GetAliasName() ), GetChars( component->GetName() ) ); } else title.Printf( _( "Properties for %s" ), GetChars( component->GetName() ) ); SetTitle( title ); InitPanelDoc(); InitBasicPanel(); if( isRoot && component->GetAliasCount() == 1 ) m_ButtonDeleteAllAlias->Enable( false ); /* Place list of alias names in listbox */ m_PartAliasListCtrl->Append( component->GetAliasNames( false ) ); if( component->GetAliasCount() <= 1 ) { m_ButtonDeleteAllAlias->Enable( false ); m_ButtonDeleteOneAlias->Enable( false ); } /* Read the Footprint Filter list */ m_FootprintFilterListBox->Append( component->GetFootPrints() ); if( component->GetFootPrints().GetCount() == 0 ) { m_ButtonDeleteAllFootprintFilter->Enable( false ); m_ButtonDeleteOneFootprintFilter->Enable( false ); } m_NoteBook->SetSelection( m_lastOpenedPage ); m_stdSizerButtonOK->SetDefault(); }
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnOkClick( wxCommandEvent& event ) { /* Update the doc, keyword and doc filename strings */ int index; LIB_ALIAS* alias; LIB_COMPONENT* component = m_Parent->GetComponent(); if( component == NULL ) { EndModal( wxID_CANCEL ); return; } m_Parent->SaveCopyInUndoList( component ); alias = component->GetAlias( m_Parent->GetAliasName() ); wxCHECK_RET( alias != NULL, wxT( "Alias \"" ) + m_Parent->GetAliasName() + wxT( "\" of component \"" ) + component->GetName() + wxT( "\" does not exist." ) ); alias->SetDescription( m_DocCtrl->GetValue() ); alias->SetKeyWords( m_KeywordsCtrl->GetValue() ); alias->SetDocFileName( m_DocfileCtrl->GetValue() ); component->SetAliases( m_PartAliasListCtrl->GetStrings() ); index = m_SelNumberOfUnits->GetValue(); ChangeNbUnitsPerPackage( index ); if( m_AsConvertButt->GetValue() ) { if( !m_Parent->GetShowDeMorgan() ) { m_Parent->SetShowDeMorgan( true ); SetUnsetConvert(); } } else { if( m_Parent->GetShowDeMorgan() ) { m_Parent->SetShowDeMorgan( false ); SetUnsetConvert(); } } component->SetShowPinNumbers( m_ShowPinNumButt->GetValue() ); component->SetShowPinNames( m_ShowPinNameButt->GetValue() ); if( m_PinsNameInsideButt->GetValue() == false ) component->SetPinNameOffset( 0 ); // pin text outside the body (name is on the pin) else { component->SetPinNameOffset( m_SetSkew->GetValue() ); // Ensure component->m_TextInside != 0, because the meaning is "text outside". if( component->GetPinNameOffset() == 0 ) component->SetPinNameOffset( 20 ); // give a reasonnable value } if( m_OptionPower->GetValue() == true ) component->SetPower(); else component->SetNormal(); /* Set the option "Units locked". * Obviously, cannot be true if there is only one part */ component->LockUnits( m_OptionPartsLocked->GetValue() ); if( component->GetPartCount() <= 1 ) component->LockUnits( false ); /* Update the footprint filter list */ component->GetFootPrints().Clear(); component->GetFootPrints() = m_FootprintFilterListBox->GetStrings(); EndModal( wxID_OK ); }