KiCad PCB EDA Suite
dialog_lib_new_symbol.h
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 <[email protected]>
5 * Copyright (C) 2015-2021 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
25#ifndef __dialog_lib_new_symbol__
26#define __dialog_lib_new_symbol__
27
28#include <widgets/unit_binder.h>
29#include <string_utils.h>
31
32class EDA_DRAW_FRAME;
33class wxArrayString;
34
36{
37public:
39 const wxArrayString* aRootSymbolNames = nullptr );
40
41 void SetName( const wxString& name ) override
42 {
43 m_textName->SetValue( UnescapeString( name ) );
44 }
45
46 wxString GetName( void ) const override
47 {
48 return EscapeString( m_textName->GetValue(), CTX_LIBID );
49 }
50
51 wxString GetParentSymbolName() const
52 {
53 return EscapeString( m_comboInheritanceSelect->GetValue(), CTX_LIBID );
54 }
55
56 void SetReference( const wxString& reference ) { m_textReference->SetValue( reference ); }
57 wxString GetReference( void ) { return m_textReference->GetValue(); }
58
59 void SetPartCount( int count ) { m_spinPartCount->SetValue( count ); }
60 int GetUnitCount( void ) { return m_spinPartCount->GetValue(); }
61
62 void SetAlternateBodyStyle( bool enable ) { m_checkHasConversion->SetValue( enable ); }
63 bool GetAlternateBodyStyle( void ) { return m_checkHasConversion->GetValue(); }
64
65 void SetPowerSymbol( bool enable ) { m_checkIsPowerSymbol->SetValue( enable ); }
66 bool GetPowerSymbol( void ) { return m_checkIsPowerSymbol->GetValue(); }
67
68 void SetUnitsInterchangeable( bool enable ) { m_checkUnitsInterchangeable->SetValue( enable ); }
69 bool GetUnitsInterchangeable( void ) { return m_checkUnitsInterchangeable->GetValue(); }
70
71 void SetIncludeInBom( bool aInclude ) { m_excludeFromBomCheckBox->SetValue( !aInclude ); }
72 bool GetIncludeInBom() const { return !m_excludeFromBomCheckBox->GetValue(); }
73
74 void SetIncludeOnBoard( bool aInclude ) { m_excludeFromBoardCheckBox->SetValue( !aInclude ); }
75 bool GetIncludeOnBoard() const { return !m_excludeFromBoardCheckBox->GetValue(); }
76
77 void SetPinTextPosition( int position ) { m_pinTextPosition.SetValue( position ); }
79
80 void SetShowPinNumber( bool show ) { m_checkShowPinNumber->SetValue( show ); }
81 bool GetShowPinNumber( void ) { return m_checkShowPinNumber->GetValue(); }
82
83 void SetShowPinName( bool show ) { m_checkShowPinName->SetValue( show ); }
84 bool GetShowPinName( void ) { return m_checkShowPinName->GetValue(); }
85
86 void SetPinNameInside( bool show ) { m_checkShowPinNameInside->SetValue( show ); }
87 bool GetPinNameInside( void ) { return m_checkShowPinNameInside->GetValue(); }
88
89protected:
90 virtual void OnParentSymbolSelect( wxCommandEvent& aEvent ) override;
91 virtual void onPowerCheckBox( wxCommandEvent& aEvent ) override;
92
93private:
94 void syncControls( bool aIsDerivedPart );
95
97};
98
99#endif // __dialog_lib_new_symbol__
const char * name
Definition: DXF_plotter.cpp:56
Class DIALOG_LIB_NEW_SYMBOL_BASE.
void SetIncludeOnBoard(bool aInclude)
wxString GetParentSymbolName() const
void SetPinNameInside(bool show)
wxString GetName(void) const override
virtual void OnParentSymbolSelect(wxCommandEvent &aEvent) override
void SetName(const wxString &name) override
void syncControls(bool aIsDerivedPart)
DIALOG_LIB_NEW_SYMBOL(EDA_DRAW_FRAME *parent, const wxArrayString *aRootSymbolNames=nullptr)
void SetShowPinName(bool show)
void SetPinTextPosition(int position)
void SetIncludeInBom(bool aInclude)
virtual void onPowerCheckBox(wxCommandEvent &aEvent) override
void SetReference(const wxString &reference)
void SetAlternateBodyStyle(bool enable)
void SetShowPinNumber(bool show)
void SetUnitsInterchangeable(bool enable)
void SetPowerSymbol(bool enable)
The base class for create windows for drawing purpose.
virtual long long int GetValue()
Return the current value in Internal Units.
virtual void SetValue(long long int aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion.
wxString UnescapeString(const wxString &aSource)
wxString EscapeString(const wxString &aSource, ESCAPE_CONTEXT aContext)
The Escape/Unescape routines use HTML-entity-reference-style encoding to handle characters which are:...
@ CTX_LIBID
Definition: string_utils.h:55