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 (C) 1992-2023 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, m_lineWidthUnits ),
39 m_textSize( aUnitsProvider, aEventSource, m_textSizeLabel, m_textSizeCtrl, m_textSizeUnits ),
40 m_pinLength( aUnitsProvider, aEventSource, m_pinLengthLabel, m_pinLengthCtrl, m_pinLengthUnits ),
41 m_pinNameSize( aUnitsProvider, aEventSource ,m_pinNameSizeLabel, m_pinNameSizeCtrl, m_pinNameSizeUnits ),
42 m_pinNumberSize( aUnitsProvider, aEventSource, m_pinNumSizeLabel, m_pinNumSizeCtrl, m_pinNumSizeUnits ),
43 m_pinPitch( aUnitsProvider, aEventSource, m_pinPitchLabel, m_pinPitchCtrl, m_pinPitchUnits )
44{
45 m_widthHelpText->SetFont( KIUI::GetInfoFont( this ).Italic() );
46}
47
48
50{
57 m_spinRepeatLabel->SetValue( aCfg->m_Repeat.label_delta );
59}
60
61
63{
66
67 loadSymEditorSettings( settings );
68
69 return true;
70}
71
72
74{
77
83 settings->m_Repeat.label_delta = m_spinRepeatLabel->GetValue();
86
87 // Force pin_step to a grid multiple
88 settings->m_Repeat.pin_step = KiROUND( double( settings->m_Repeat.pin_step ) / MIN_GRID ) * MIN_GRID;
89
90 return true;
91}
92
93
95{
96 int pitch_mils = schIUScale.IUToMils( m_pinPitch.GetIntValue() );
97
98 // Force pin_step to a grid multiple
99 pitch_mils = KiROUND( double( pitch_mils ) / MIN_GRID ) * MIN_GRID;
100
101 m_pinPitch.SetValue( schIUScale.MilsToIU( pitch_mils ) );
102
103 aEvent.Skip();
104}
105
106
108{
110 cfg.Load(); // Loading without a file will init to defaults
111
112 loadSymEditorSettings( &cfg );
113}
114
115
constexpr EDA_IU_SCALE schIUScale
Definition: base_units.h:110
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:142
T * GetAppSettings()
Returns a handle to the a given settings by type If the settings have already been loaded,...
int GetIntValue()
Definition: unit_binder.h:127
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:151
#define MIN_GRID
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: pgm_base.cpp:1059
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.
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:85