KiCad PCB EDA Suite
panel_eeschema_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>
28#include <eeschema_settings.h>
30
31
33 UNITS_PROVIDER* aUnitsProvider,
34 wxWindow* aEventSource ) :
36 m_hPitch( aUnitsProvider, aEventSource, m_hPitchLabel, m_hPitchCtrl, m_hPitchUnits ),
37 m_vPitch( aUnitsProvider, aEventSource, m_vPitchLabel, m_vPitchCtrl, m_vPitchUnits )
38{
39 // Make the color swatch show "Clear Color" instead
40 m_borderColorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
41 m_backgroundColorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
42
43 wxFont helpFont = KIUI::GetInfoFont( this ).Italic();
44 m_hint1->SetFont( helpFont );
45 m_hint2->SetFont( helpFont );
46
47 m_spinLabelRepeatStep->SetRange( -100000, 100000 );
48#if wxCHECK_VERSION( 3, 1, 6 )
49 m_spinLabelRepeatStep->SetIncrement( 1 );
50#endif
51
52#ifdef __WXOSX_MAC__
53 m_leftClickCmdsBook->SetSelection( 1 );
54#else
55 m_leftClickCmdsBook->SetSelection( 0 );
56#endif
57}
58
59
61{
65
66 SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
67 COLOR_SETTINGS* settings = mgr.GetColorSettings();
68 COLOR4D schematicBackground = settings->GetColor( LAYER_SCHEMATIC_BACKGROUND );
69
70 m_borderColorSwatch->SetSwatchBackground( schematicBackground );
72
73 m_backgroundColorSwatch->SetSwatchBackground( schematicBackground );
75
76 m_choiceLineMode->SetSelection( aCfg->m_Drawing.line_mode );
78
82
83 m_mouseDragIsDrag->SetValue( !aCfg->m_Input.drag_is_move );
85
88}
89
90
92{
93 SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
95
97
98 return true;
99}
100
101
103{
104 SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
106
109
113
114 cfg->m_Drawing.line_mode = m_choiceLineMode->GetSelection();
116
120
121 cfg->m_Input.drag_is_move = !m_mouseDragIsDrag->GetValue();
123
126
127 return true;
128}
129
130
132{
134 cfg.Load(); // Loading without a file will init to defaults
135
136 loadEEschemaSettings( &cfg );
137}
138
139
constexpr EDA_IU_SCALE schIUScale
Definition: base_units.h:111
Color settings are a bit different than most of the settings objects in that there can be more than o...
COLOR4D GetColor(int aLayer) const
void SetSwatchColor(const KIGFX::COLOR4D &aColor, bool aSendEvent)
Set the current swatch color directly.
KIGFX::COLOR4D GetSwatchColor() const
void SetDefaultColor(const KIGFX::COLOR4D &aColor)
Sets the color that will be chosen with the "Reset to Default" button in the chooser.
void SetSwatchBackground(const KIGFX::COLOR4D &aBackground)
Set the swatch background color.
AUTOPLACE_FIELDS m_AutoplaceFields
virtual void Load()
Updates the parameters of this object based on the current JSON document contents.
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:102
Class PANEL_EESCHEMA_EDITING_OPTIONS_BASE.
void loadEEschemaSettings(EESCHEMA_SETTINGS *aCfg)
PANEL_EESCHEMA_EDITING_OPTIONS(wxWindow *aWindow, UNITS_PROVIDER *aUnitsProvider, wxWindow *aEventSource)
void ResetPanel() override
Reset the contents of this panel.
T * GetAppSettings(bool aLoadNow=true)
Returns a handle to the a given settings by type If the settings have already been loaded,...
COLOR_SETTINGS * GetColorSettings(const wxString &aName="user")
Retrieves a color settings object that applications can read colors from.
virtual long long int GetValue()
Return the current value in Internal Units.
virtual void SetValue(long long int aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion.
@ LAYER_SCHEMATIC_BACKGROUND
Definition: layer_ids.h:376
wxFont GetInfoFont(wxWindow *aWindow)
Definition: ui_common.cpp:156
see class PGM_BASE
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:111
constexpr int IUToMils(int iu) const
Definition: base_units.h:100
constexpr int MilsToIU(int mils) const
Definition: base_units.h:94