2014-10-21 15:48:00 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2020-01-23 20:45:51 +00:00
|
|
|
* Copyright (C) 2009 Wayne Stambaugh <stambaughw@gmail.com>
|
2019-11-06 19:15:42 +00:00
|
|
|
* Copyright (C) 2016-2019 KiCad Developers, see AUTHORS.txt for contributors.
|
2014-10-21 15:48:00 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
2020-01-23 20:45:51 +00:00
|
|
|
#include <eda_draw_frame.h>
|
|
|
|
|
2013-05-26 04:36:44 +00:00
|
|
|
#include <dialog_lib_new_component.h>
|
2016-08-19 16:42:39 +00:00
|
|
|
#include <sch_validators.h>
|
|
|
|
#include <template_fieldnames.h>
|
2013-05-26 04:36:44 +00:00
|
|
|
|
2020-01-23 20:45:51 +00:00
|
|
|
DIALOG_LIB_NEW_COMPONENT::DIALOG_LIB_NEW_COMPONENT( EDA_DRAW_FRAME* aParent,
|
2019-11-06 19:15:42 +00:00
|
|
|
const wxArrayString* aRootSymbolNames ) :
|
2020-01-23 20:45:51 +00:00
|
|
|
DIALOG_LIB_NEW_COMPONENT_BASE( dynamic_cast<wxWindow*>( aParent ) ),
|
|
|
|
m_pinTextPosition( aParent, m_staticPinTextPositionLabel, m_textPinTextPosition,
|
|
|
|
m_staticPinTextPositionUnits, true )
|
2013-05-26 04:36:44 +00:00
|
|
|
{
|
2019-11-06 19:15:42 +00:00
|
|
|
if( aRootSymbolNames && aRootSymbolNames->GetCount() )
|
|
|
|
m_comboInheritanceSelect->Append( *aRootSymbolNames );
|
|
|
|
|
2016-08-19 16:42:39 +00:00
|
|
|
m_textName->SetValidator( SCH_FIELD_VALIDATOR( true, VALUE ) );
|
|
|
|
m_textReference->SetValidator( SCH_FIELD_VALIDATOR( true, REFERENCE ) );
|
|
|
|
|
2020-01-23 20:45:51 +00:00
|
|
|
m_pinTextPosition.SetValue( Mils2iu( 40 ) );
|
|
|
|
|
2013-12-08 04:46:25 +00:00
|
|
|
// initial focus should be on first editable field.
|
|
|
|
m_textName->SetFocus();
|
|
|
|
|
|
|
|
// What happens when user presses "Enter"? OK button! OK?
|
2013-05-26 04:36:44 +00:00
|
|
|
m_sdbSizerOK->SetDefault();
|
2016-07-18 07:04:13 +00:00
|
|
|
|
|
|
|
// Now all widgets have the size fixed, call FinishDialogSettings
|
|
|
|
FinishDialogSettings();
|
2013-05-26 04:36:44 +00:00
|
|
|
}
|
2019-11-06 19:15:42 +00:00
|
|
|
|
|
|
|
|
|
|
|
void DIALOG_LIB_NEW_COMPONENT::OnParentSymbolSelect( wxCommandEvent& event )
|
|
|
|
{
|
|
|
|
syncControls( !m_comboInheritanceSelect->GetValue().IsEmpty() );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void DIALOG_LIB_NEW_COMPONENT::syncControls( bool aIsDerivedPart )
|
|
|
|
{
|
|
|
|
m_staticTextDes->Enable( !aIsDerivedPart );
|
|
|
|
m_textReference->Enable( !aIsDerivedPart );
|
|
|
|
m_staticTextUnits->Enable( !aIsDerivedPart );
|
|
|
|
m_spinPartCount->Enable( !aIsDerivedPart );
|
|
|
|
m_checkLockItems->Enable( !aIsDerivedPart );
|
|
|
|
m_checkHasConversion->Enable( !aIsDerivedPart );
|
|
|
|
m_checkIsPowerSymbol->Enable( !aIsDerivedPart );
|
2020-01-23 20:45:51 +00:00
|
|
|
m_staticPinTextPositionLabel->Enable( !aIsDerivedPart );
|
|
|
|
m_textPinTextPosition->Enable( !aIsDerivedPart );
|
|
|
|
m_staticPinTextPositionUnits->Enable( !aIsDerivedPart );
|
2019-11-06 19:15:42 +00:00
|
|
|
m_checkShowPinNumber->Enable( !aIsDerivedPart );
|
|
|
|
m_checkShowPinName->Enable( !aIsDerivedPart );
|
|
|
|
m_checkShowPinNameInside->Enable( !aIsDerivedPart );
|
|
|
|
}
|