KiCad PCB EDA Suite
dialog_lib_new_component.cpp
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2009 Wayne Stambaugh <stambaughw@verizon.net>
5  * Copyright (C) 2016-2019 KiCad Developers, see AUTHORS.txt for contributors.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, you may find one here:
19  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20  * or you may search the http://www.gnu.org website for the version 2 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 
26 #include <sch_validators.h>
27 #include <template_fieldnames.h>
28 
30  const wxArrayString* aRootSymbolNames ) :
32 {
33  if( aRootSymbolNames && aRootSymbolNames->GetCount() )
34  m_comboInheritanceSelect->Append( *aRootSymbolNames );
35 
36  m_textName->SetValidator( SCH_FIELD_VALIDATOR( true, VALUE ) );
37  m_textReference->SetValidator( SCH_FIELD_VALIDATOR( true, REFERENCE ) );
38 
39  // initial focus should be on first editable field.
40  m_textName->SetFocus();
41 
42  // What happens when user presses "Enter"? OK button! OK?
43  m_sdbSizerOK->SetDefault();
44 
45  // Now all widgets have the size fixed, call FinishDialogSettings
47 }
48 
49 
51 {
52  syncControls( !m_comboInheritanceSelect->GetValue().IsEmpty() );
53 }
54 
55 
56 void DIALOG_LIB_NEW_COMPONENT::syncControls( bool aIsDerivedPart )
57 {
58  m_staticTextDes->Enable( !aIsDerivedPart );
59  m_textReference->Enable( !aIsDerivedPart );
60  m_staticTextUnits->Enable( !aIsDerivedPart );
61  m_spinPartCount->Enable( !aIsDerivedPart );
62  m_checkLockItems->Enable( !aIsDerivedPart );
63  m_checkHasConversion->Enable( !aIsDerivedPart );
64  m_checkIsPowerSymbol->Enable( !aIsDerivedPart );
65  m_staticText12->Enable( !aIsDerivedPart );
66  m_spinPinTextPosition->Enable( !aIsDerivedPart );
67  m_checkShowPinNumber->Enable( !aIsDerivedPart );
68  m_checkShowPinName->Enable( !aIsDerivedPart );
69  m_checkShowPinNameInside->Enable( !aIsDerivedPart );
70 }
void FinishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
virtual void OnParentSymbolSelect(wxCommandEvent &event) override
Class DIALOG_LIB_NEW_COMPONENT_BASE.
Field Reference of part, i.e. "IC21".
#define VALUE
Subclass of DIALOG_LIB_NEW_COMPONENT, which is generated by wxFormBuilder.
Definitions of control validators for schematic dialogs.
void syncControls(bool aIsDerivedPart)
A text control validator used for validating the text allowed in library and schematic component fiel...
DIALOG_LIB_NEW_COMPONENT(wxWindow *parent, const wxArrayString *aRootSymbolNames=nullptr)
Constructor.