KiCad PCB EDA Suite
panel_libedit_settings.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 <fctsys.h>
26 #include <lib_edit_frame.h>
27 #include <sch_painter.h>
28 #include <pgm_base.h>
31 
32 #include "panel_libedit_settings.h"
33 
34 
36  PANEL_LIBEDIT_SETTINGS_BASE( aWindow ),
37  m_frame( aFrame ),
38  m_lineWidth( aFrame, m_lineWidthLabel, m_lineWidthCtrl, m_lineWidthUnits, true ),
39  m_textSize( aFrame, m_textSizeLabel, m_textSizeCtrl, m_textSizeUnits, true ),
40  m_pinLength( aFrame, m_pinLengthLabel, m_pinLengthCtrl, m_pinLengthUnits, true ),
41  m_pinNameSize( aFrame, m_pinNameSizeLabel, m_pinNameSizeCtrl, m_pinNameSizeUnits, true ),
42  m_pinNumberSize( aFrame, m_pinNumSizeLabel, m_pinNumSizeCtrl, m_pinNumSizeUnits, true ),
43  m_hPitch( aFrame, m_hPitchLabel, m_hPitchCtrl, m_hPitchUnits, true ),
44  m_vPitch( aFrame, m_vPitchLabel, m_vPitchCtrl, m_vPitchUnits, true )
45 {}
46 
47 
49 {
50  LIBEDIT_SETTINGS* settings = Pgm().GetSettingsManager().GetAppSettings<LIBEDIT_SETTINGS>();
51 
52  m_lineWidth.SetValue( Mils2iu( settings->m_Defaults.line_width ) );
53  m_textSize.SetValue( Mils2iu( settings->m_Defaults.text_size ) );
54  m_pinLength.SetValue( Mils2iu( settings->m_Defaults.pin_length ) );
55  m_pinNumberSize.SetValue( Mils2iu( settings->m_Defaults.pin_num_size ) );
56  m_pinNameSize.SetValue( Mils2iu( settings->m_Defaults.pin_name_size ) );
57  m_hPitch.SetValue( Mils2iu( settings->m_Repeat.x_step ) );
58  m_vPitch.SetValue( Mils2iu( settings->m_Repeat.y_step ) );
59  m_choicePinDisplacement->SetSelection( settings->m_Repeat.pin_step == 50 ? 1 : 0 );
60  m_spinRepeatLabel->SetValue( settings->m_Repeat.label_delta );
61 
63 
64  return true;
65 }
66 
67 
69 {
70  LIBEDIT_SETTINGS* settings = Pgm().GetSettingsManager().GetAppSettings<LIBEDIT_SETTINGS>();
71 
72  settings->m_Defaults.line_width = Iu2Mils( (int) m_lineWidth.GetValue() );
73  settings->m_Defaults.text_size = Iu2Mils( (int) m_textSize.GetValue() );
74  settings->m_Defaults.pin_length = Iu2Mils( (int) m_pinLength.GetValue() );
75  settings->m_Defaults.pin_num_size = Iu2Mils( (int) m_pinNumberSize.GetValue() );
76  settings->m_Defaults.pin_name_size = Iu2Mils( (int) m_pinNameSize.GetValue() );
77  settings->m_Repeat.x_step = Iu2Mils( (int) m_hPitch.GetValue() );
78  settings->m_Repeat.y_step = Iu2Mils( (int) m_vPitch.GetValue() );
79  settings->m_Repeat.label_delta = m_spinRepeatLabel->GetValue();
80  settings->m_Repeat.pin_step = m_choicePinDisplacement->GetSelection() == 1 ? 50 : 100;
81 
84 
85  return true;
86 }
87 
88 
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:104
KIGFX::SCH_RENDER_SETTINGS * GetRenderSettings()
bool TransferDataFromWindow() override
Class PANEL_LIBEDIT_SETTINGS_BASE.
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
The symbol library editor main window.
see class PGM_BASE
virtual void SetValue(int aValue)
Function SetValue Sets new value (in Internal Units) for the text field, taking care of units convers...
PANEL_LIBEDIT_SETTINGS(LIB_EDIT_FRAME *aFrame, wxWindow *aWindow)
virtual long long int GetValue()
Function GetValue Returns the current value in Internal Units.