mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 02:03:12 +02:00
Separate initialization from data loading.
This commit is contained in:
parent
ac7ae87495
commit
92e139f64b
@ -44,6 +44,7 @@ DIALOG_LIB_NEW_SYMBOL::DIALOG_LIB_NEW_SYMBOL( EDA_DRAW_FRAME* aParent,
|
||||
m_pinTextPosition( aParent, m_staticPinTextPositionLabel, m_textPinTextPosition,
|
||||
m_staticPinTextPositionUnits, true ),
|
||||
m_validator( std::move( aValidator ) ),
|
||||
m_inheritFromSymbolName( aInheritFromSymbolName ),
|
||||
m_nameIsDefaulted( true )
|
||||
{
|
||||
if( aSymbolNames.GetCount() )
|
||||
@ -54,20 +55,11 @@ DIALOG_LIB_NEW_SYMBOL::DIALOG_LIB_NEW_SYMBOL( EDA_DRAW_FRAME* aParent,
|
||||
unescapedNames.Add( UnescapeString( name ) );
|
||||
|
||||
m_comboInheritanceSelect->SetStringList( unescapedNames );
|
||||
|
||||
if( !aInheritFromSymbolName.IsEmpty() )
|
||||
m_comboInheritanceSelect->SetSelectedString( UnescapeString( aInheritFromSymbolName ) );
|
||||
}
|
||||
|
||||
m_textName->SetValidator( FIELD_VALIDATOR( FIELD_T::VALUE ) );
|
||||
m_textReference->SetValidator( FIELD_VALIDATOR( FIELD_T::REFERENCE ) );
|
||||
|
||||
if( !aInheritFromSymbolName.IsEmpty() )
|
||||
{
|
||||
m_textName->ChangeValue( UnescapeString( getDerivativeName( aInheritFromSymbolName ) ) );
|
||||
m_nameIsDefaulted = true;
|
||||
}
|
||||
|
||||
m_pinTextPosition.SetValue( schIUScale.MilsToIU( DEFAULT_PIN_NAME_OFFSET ) );
|
||||
|
||||
m_comboInheritanceSelect->Connect( FILTERED_ITEM_SELECTED,
|
||||
@ -112,6 +104,19 @@ DIALOG_LIB_NEW_SYMBOL::~DIALOG_LIB_NEW_SYMBOL()
|
||||
nullptr, this );
|
||||
}
|
||||
|
||||
|
||||
bool DIALOG_LIB_NEW_SYMBOL::TransferDataToWindow()
|
||||
{
|
||||
if( !m_inheritFromSymbolName.IsEmpty() )
|
||||
{
|
||||
m_comboInheritanceSelect->SetSelectedString( UnescapeString( m_inheritFromSymbolName ) );
|
||||
m_textName->ChangeValue( UnescapeString( getDerivativeName( m_inheritFromSymbolName ) ) );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool DIALOG_LIB_NEW_SYMBOL::TransferDataFromWindow()
|
||||
{
|
||||
return m_validator( GetName() );
|
||||
|
@ -106,6 +106,7 @@ public:
|
||||
bool GetPinNameInside() { return m_checkShowPinNameInside->GetValue(); }
|
||||
|
||||
protected:
|
||||
bool TransferDataToWindow() override;
|
||||
bool TransferDataFromWindow() override;
|
||||
|
||||
virtual void onPowerCheckBox( wxCommandEvent& aEvent ) override;
|
||||
@ -119,5 +120,6 @@ private:
|
||||
private:
|
||||
UNIT_BINDER m_pinTextPosition;
|
||||
std::function<bool( wxString newName )> m_validator;
|
||||
wxString m_inheritFromSymbolName;
|
||||
bool m_nameIsDefaulted;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user