KiCad PCB EDA Suite
Loading...
Searching...
No Matches
panel_edit_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 Jean-Pierre Charras, [email protected]
5 * Copyright (C) 1992-2022 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 <string_utils.h>
28#include <pcbnew_settings.h>
30#include <panel_edit_options.h>
31
32
33PANEL_EDIT_OPTIONS::PANEL_EDIT_OPTIONS( wxWindow* aParent, UNITS_PROVIDER* aUnitsProvider,
34 wxWindow* aEventSource, bool isFootprintEditor ) :
35 PANEL_EDIT_OPTIONS_BASE( aParent ),
36 m_isFootprintEditor( isFootprintEditor ),
37 m_rotationAngle( aUnitsProvider, aEventSource, m_rotationAngleLabel, m_rotationAngleCtrl,
38 m_rotationAngleUnits )
39{
43
44 m_rotationAngle.SetUnits( EDA_UNITS::DEGREES );
45
46#ifdef __WXOSX_MAC__
47 m_mouseCmdsOSX->Show( true );
48 m_mouseCmdsWinLin->Show( false );
49 // Disable highlight net option for footprint editor
51#else
52 m_mouseCmdsWinLin->Show( true );
53 m_mouseCmdsOSX->Show( false );
54 // Disable highlight net option for footprint editor
56#endif
57
58 m_optionsBook->SetSelection( isFootprintEditor ? 0 : 1 );
59}
60
61
63{
66 m_arcEditMode->SetSelection( (int) aCfg->m_ArcEditMode );
67 m_trackMouseDragCtrl->SetSelection( (int) aCfg->m_TrackDragAction );
68 m_boardItemsFlip->SetSelection( static_cast<int>( aCfg->m_FlipDirection ) );
69 m_allowFreePads->SetValue( aCfg->m_AllowFreePads );
71 m_autoRefillZones->SetValue( aCfg->m_AutoRefillZones );
72
73 m_magneticPadChoice->SetSelection( static_cast<int>( aCfg->m_MagneticItems.pads ) );
74 m_magneticTrackChoice->SetSelection( static_cast<int>( aCfg->m_MagneticItems.tracks ) );
76
77 /* Set display options */
81
82#ifdef __WXOSX_MAC__
83 m_rbCtrlClickActionMac->SetSelection( aCfg->m_CtrlClickHighlight );
84#else
85 m_rbCtrlClickAction->SetSelection( aCfg->m_CtrlClickHighlight );
86#endif
87
89 m_showPageLimits->SetValue( aCfg->m_ShowPageLimits );
91}
92
93
95{
97 m_magneticPads->SetValue( aCfg->m_MagneticItems.pads == MAGNETIC_OPTIONS::CAPTURE_ALWAYS );
99 m_cbConstrainHV45Mode->SetValue( aCfg->m_Use45Limit );
100 m_arcEditMode->SetSelection(
101 aCfg->m_ArcEditMode == ARC_EDIT_MODE::KEEP_CENTER_ADJUST_ANGLE_RADIUS ? 0 : 1 );
102}
103
104
106{
108
110 {
112
113 loadFPSettings( cfg );
114 }
115 else
116 {
118
119 loadPCBSettings( cfg );
120 }
121
122 return true;
123}
124
125
127{
129
131 {
133
135
136 cfg->m_MagneticItems.pads = m_magneticPads->GetValue() ? MAGNETIC_OPTIONS::CAPTURE_ALWAYS
137 : MAGNETIC_OPTIONS::NO_EFFECT;
139
140 cfg->m_Use45Limit = m_cbConstrainHV45Mode->GetValue();
141 cfg->m_ArcEditMode = (ARC_EDIT_MODE) m_arcEditMode->GetSelection();
142 }
143 else
144 {
146
150
151 cfg->m_Use45DegreeLimit = m_cbConstrainHV45Mode->GetValue();
153 cfg->m_ArcEditMode = (ARC_EDIT_MODE) m_arcEditMode->GetSelection();
155 cfg->m_FlipDirection = static_cast<FLIP_DIRECTION>( m_boardItemsFlip->GetSelection() );
156 cfg->m_AllowFreePads = m_allowFreePads->GetValue();
158 cfg->m_AutoRefillZones = m_autoRefillZones->GetValue();
159
160 cfg->m_MagneticItems.pads = static_cast<MAGNETIC_OPTIONS>( m_magneticPadChoice->GetSelection() );
161 cfg->m_MagneticItems.tracks = static_cast<MAGNETIC_OPTIONS>( m_magneticTrackChoice->GetSelection() );
162 cfg->m_MagneticItems.graphics = !m_magneticGraphicsChoice->GetSelection();
163
165 cfg->m_ShowPageLimits = m_showPageLimits->GetValue();
167
168
169#ifdef __WXOSX_MAC__
170 cfg->m_CtrlClickHighlight = m_rbCtrlClickActionMac->GetSelection();
171#else
172 cfg->m_CtrlClickHighlight = m_rbCtrlClickAction->GetSelection();
173#endif
174 }
175
176 return true;
177}
178
179
181{
183 {
185 cfg.Load(); // Loading without a file will init to defaults
186
187 loadFPSettings( &cfg );
188 }
189 else
190 {
191 PCBNEW_SETTINGS cfg;
192 cfg.Load(); // Loading without a file will init to defaults
193
194 loadPCBSettings( &cfg );
195 }
196}
197
198
ARC_EDIT_MODE
Settings for arc editing.
Definition: app_settings.h:52
virtual void Load()
Updates the parameters of this object based on the current JSON document contents.
Class PANEL_EDIT_OPTIONS_BASE.
wxStaticBoxSizer * m_mouseCmdsWinLin
wxCheckBox * m_OptDisplayCurvedRatsnestLines
wxStaticBoxSizer * m_mouseCmdsOSX
wxSpinCtrlDouble * m_ratsnestThickness
void loadFPSettings(FOOTPRINT_EDITOR_SETTINGS *aCfg)
PANEL_EDIT_OPTIONS(wxWindow *aParent, UNITS_PROVIDER *aUnitsProvider, wxWindow *aEventSource, bool isFootprintEditor)
bool TransferDataToWindow() override
void ResetPanel() override
Reset the contents of this panel.
void loadPCBSettings(PCBNEW_SETTINGS *aCfg)
bool TransferDataFromWindow() override
UNIT_BINDER m_rotationAngle
DISPLAY_OPTIONS m_Display
EDA_ANGLE m_RotationAngle
ARC_EDIT_MODE m_ArcEditMode
TRACK_DRAG_ACTION m_TrackDragAction
LOCKING_OPTIONS m_LockingOptions
bool m_ShowCourtyardCollisions
MAGNETIC_SETTINGS m_MagneticItems
FLIP_DIRECTION m_FlipDirection
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,...
virtual void SetUnits(EDA_UNITS aUnits)
Normally not needed (as the UNIT_BINDER inherits from the parent frame), but can be used to set to DE...
virtual EDA_ANGLE GetAngleValue()
virtual void SetAngleValue(const EDA_ANGLE &aValue)
FLIP_DIRECTION
Definition: mirror.h:27
MAGNETIC_OPTIONS
TRACK_DRAG_ACTION
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: pgm_base.cpp:1060
see class PGM_BASE
MAGNETIC_OPTIONS tracks
MAGNETIC_OPTIONS pads