KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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 <[email protected]>
5 * Copyright The 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 <pgm_base.h>
26#include <widgets/ui_common.h>
30
31
32#define MIN_GRID 25
33
35 UNITS_PROVIDER* aUnitsProvider,
36 wxWindow* aEventSource ) :
38 m_lineWidth( aUnitsProvider, aEventSource, m_lineWidthLabel, m_lineWidthCtrl,
39 m_lineWidthUnits ),
40 m_textSize( aUnitsProvider, aEventSource, m_textSizeLabel, m_textSizeCtrl,
41 m_textSizeUnits ),
42 m_pinLength( aUnitsProvider, aEventSource, m_pinLengthLabel, m_pinLengthCtrl,
43 m_pinLengthUnits ),
44 m_pinNameSize( aUnitsProvider, aEventSource ,m_pinNameSizeLabel, m_pinNameSizeCtrl,
45 m_pinNameSizeUnits ),
46 m_pinNumberSize( aUnitsProvider, aEventSource, m_pinNumSizeLabel, m_pinNumSizeCtrl,
47 m_pinNumSizeUnits ),
48 m_pinPitch( aUnitsProvider, aEventSource, m_pinPitchLabel, m_pinPitchCtrl, m_pinPitchUnits )
49{
50 m_widthHelpText->SetFont( KIUI::GetInfoFont( this ).Italic() );
51}
52
53
55{
62 m_spinRepeatLabel->SetValue( aCfg->m_Repeat.label_delta );
64}
65
66
68{
71
73
74 return true;
75}
76
77
79{
82
88 cfg->m_Repeat.label_delta = m_spinRepeatLabel->GetValue();
91
92 // Force pin_step to a grid multiple
93 cfg->m_Repeat.pin_step = KiROUND( double( cfg->m_Repeat.pin_step ) / MIN_GRID ) * MIN_GRID;
94
95 return true;
96}
97
98
100{
101 int pitch_mils = schIUScale.IUToMils( m_pinPitch.GetIntValue() );
102
103 // Force pin_step to a grid multiple
104 pitch_mils = KiROUND( double( pitch_mils ) / MIN_GRID ) * MIN_GRID;
105
106 m_pinPitch.SetValue( schIUScale.MilsToIU( pitch_mils ) );
107
108 aEvent.Skip();
109}
110
111
113{
115 cfg.Load(); // Loading without a file will init to defaults
116
117 loadSymEditorSettings( &cfg );
118}
119
120
constexpr EDA_IU_SCALE schIUScale
Definition: base_units.h:110
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
Definition: box2.h:990
virtual void Load()
Updates the parameters of this object based on the current JSON document contents.
Class PANEL_SYM_EDITING_OPTIONS_BASE.
PANEL_SYM_EDITING_OPTIONS(wxWindow *aWindow, UNITS_PROVIDER *aUnitsProvider, wxWindow *aEventSource)
void onKillFocusPinPitch(wxFocusEvent &aEvent) override
void ResetPanel() override
Reset the contents of this panel.
void loadSymEditorSettings(SYMBOL_EDITOR_SETTINGS *aCfg)
virtual SETTINGS_MANAGER & GetSettingsManager() const
Definition: pgm_base.h:125
T * GetAppSettings(const wxString &aFilename)
Return a handle to the a given settings by type.
int GetIntValue()
Definition: unit_binder.h:129
virtual void SetValue(long long int aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion.
KICOMMON_API wxFont GetInfoFont(wxWindow *aWindow)
Definition: ui_common.cpp:155
#define MIN_GRID
PGM_BASE & Pgm()
The global program "get" accessor.
Definition: pgm_base.cpp:1073
see class PGM_BASE
constexpr int IUToMils(int iu) const
Definition: base_units.h:99
constexpr int MilsToIU(int mils) const
Definition: base_units.h:93
Functions to provide common constants and other functions to assist in making a consistent UI.