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-2020 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 EDA_BASE_FRAME* aUnitsProvider ) :
35 m_hPitch( aUnitsProvider, schIUScale, m_hPitchLabel, m_hPitchCtrl, m_hPitchUnits ),
36 m_vPitch( aUnitsProvider, schIUScale, m_vPitchLabel, m_vPitchCtrl, m_vPitchUnits )
37{
38 // Make the color swatch show "Clear Color" instead
39 m_borderColorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
40 m_backgroundColorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
41
42 m_spinLabelRepeatStep->SetRange( -100000, 100000 );
43#if wxCHECK_VERSION( 3, 1, 6 )
44 m_spinLabelRepeatStep->SetIncrement( 1 );
45#endif
46
47#ifdef __WXOSX_MAC__
48 m_leftClickCmdsBook->SetSelection( 1 );
49#else
50 m_leftClickCmdsBook->SetSelection( 0 );
51#endif
52}
53
54
56{
60
61 SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
62 COLOR_SETTINGS* settings = mgr.GetColorSettings();
63 COLOR4D schematicBackground = settings->GetColor( LAYER_SCHEMATIC_BACKGROUND );
64
65 m_borderColorSwatch->SetSwatchBackground( schematicBackground );
67
68 m_backgroundColorSwatch->SetSwatchBackground( schematicBackground );
70
71 m_choiceLineMode->SetSelection( aCfg->m_Drawing.line_mode );
73
77
78 m_mouseDragIsDrag->SetValue( !aCfg->m_Input.drag_is_move );
80
83}
84
85
87{
88 SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
90
92
93 return true;
94}
95
96
98{
99 SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
101
104
108
109 cfg->m_Drawing.line_mode = m_choiceLineMode->GetSelection();
111
115
116 cfg->m_Input.drag_is_move = !m_mouseDragIsDrag->GetValue();
118
121
122 return true;
123}
124
125
127{
129 cfg.Load(); // Loading without a file will init to defaults
130
131 loadEEschemaSettings( &cfg );
132}
133
134
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.
The base frame for deriving all KiCad main window classes.
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:104
Class PANEL_EESCHEMA_EDITING_OPTIONS_BASE.
void loadEEschemaSettings(EESCHEMA_SETTINGS *aCfg)
void ResetPanel() override
Reset the contents of this panel.
PANEL_EESCHEMA_EDITING_OPTIONS(wxWindow *aWindow, EDA_BASE_FRAME *aUnitsProvider)
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
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