KiCad PCB EDA Suite
panel_sym_editing_options.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) 1992-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 
25 #include <symbol_edit_frame.h>
26 #include <sch_painter.h>
29 
31 
32 
34  wxWindow* aWindow ) :
36  m_frame( aFrame ),
37  m_lineWidth( aFrame, m_lineWidthLabel, m_lineWidthCtrl, m_lineWidthUnits ),
38  m_textSize( aFrame, m_textSizeLabel, m_textSizeCtrl, m_textSizeUnits ),
39  m_pinLength( aFrame, m_pinLengthLabel, m_pinLengthCtrl, m_pinLengthUnits ),
40  m_pinNameSize( aFrame, m_pinNameSizeLabel, m_pinNameSizeCtrl, m_pinNameSizeUnits ),
41  m_pinNumberSize( aFrame, m_pinNumSizeLabel, m_pinNumSizeCtrl, m_pinNumSizeUnits ),
42  m_hPitch( aFrame, m_hPitchLabel, m_hPitchCtrl, m_hPitchUnits ),
43  m_vPitch( aFrame, m_vPitchLabel, m_vPitchCtrl, m_vPitchUnits )
44 {}
45 
46 
48 {
50 
51  m_lineWidth.SetValue( Mils2iu( settings->m_Defaults.line_width ) );
52  m_textSize.SetValue( Mils2iu( settings->m_Defaults.text_size ) );
53  m_pinLength.SetValue( Mils2iu( settings->m_Defaults.pin_length ) );
54  m_pinNumberSize.SetValue( Mils2iu( settings->m_Defaults.pin_num_size ) );
55  m_pinNameSize.SetValue( Mils2iu( settings->m_Defaults.pin_name_size ) );
56  m_hPitch.SetValue( Mils2iu( settings->m_Repeat.x_step ) );
57  m_vPitch.SetValue( Mils2iu( settings->m_Repeat.y_step ) );
58  m_choicePinDisplacement->SetSelection( settings->m_Repeat.pin_step == 50 ? 1 : 0 );
59  m_spinRepeatLabel->SetValue( settings->m_Repeat.label_delta );
60 
62 
63  return true;
64 }
65 
66 
68 {
70 
71  settings->m_Defaults.line_width = Iu2Mils( (int) m_lineWidth.GetValue() );
72  settings->m_Defaults.text_size = Iu2Mils( (int) m_textSize.GetValue() );
73  settings->m_Defaults.pin_length = Iu2Mils( (int) m_pinLength.GetValue() );
74  settings->m_Defaults.pin_num_size = Iu2Mils( (int) m_pinNumberSize.GetValue() );
75  settings->m_Defaults.pin_name_size = Iu2Mils( (int) m_pinNameSize.GetValue() );
76  settings->m_Repeat.x_step = Iu2Mils( (int) m_hPitch.GetValue() );
77  settings->m_Repeat.y_step = Iu2Mils( (int) m_vPitch.GetValue() );
78  settings->m_Repeat.label_delta = m_spinRepeatLabel->GetValue();
79  settings->m_Repeat.pin_step = m_choicePinDisplacement->GetSelection() == 1 ? 50 : 100;
80 
83 
84  return true;
85 }
86 
87 
SYMBOL_EDITOR_SETTINGS * GetSettings() const
PANEL_SYM_EDITING_OPTIONS(SYMBOL_EDIT_FRAME *aFrame, wxWindow *aWindow)
KIGFX::SCH_RENDER_SETTINGS * GetRenderSettings()
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
Class PANEL_SYM_EDITING_OPTIONS_BASE.
virtual void SetValue(int aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion.
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
virtual long long int GetValue()
Return the current value in Internal Units.
The symbol library editor main window.