KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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 m_spinLabelRepeatStep->SetIncrement( 1 );
49
50#ifdef __WXOSX_MAC__
51 m_leftClickCmdsBook->SetSelection( 1 );
52#else
53 m_leftClickCmdsBook->SetSelection( 0 );
54#endif
55}
56
57
59{
63
64 SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
65 COLOR_SETTINGS* settings = mgr.GetColorSettings();
66 COLOR4D schematicBackground = settings->GetColor( LAYER_SCHEMATIC_BACKGROUND );
67
68 m_borderColorSwatch->SetSwatchBackground( schematicBackground );
71
72 m_backgroundColorSwatch->SetSwatchBackground( schematicBackground );
75
76 m_choiceLineMode->SetSelection( aCfg->m_Drawing.line_mode );
78 m_neverShowRescue->SetValue( aCfg->m_RescueNeverShow );
79
83
84 m_mouseDragIsDrag->SetValue( !aCfg->m_Input.drag_is_move );
86
89}
90
91
93{
94 SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
96
98
99 return true;
100}
101
102
104{
105 SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
107
110
114
115 cfg->m_Drawing.line_mode = m_choiceLineMode->GetSelection();
117 cfg->m_RescueNeverShow = m_neverShowRescue->GetValue();
118
122
123 cfg->m_Input.drag_is_move = !m_mouseDragIsDrag->GetValue();
125
128
129 return true;
130}
131
132
134{
136 cfg.Load(); // Loading without a file will init to defaults
137
138 loadEEschemaSettings( &cfg );
139}
140
141
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
COLOR4D GetDefaultColor(int aLayer)
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:104
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()
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.
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.
@ LAYER_SHEET_BACKGROUND
Definition: layer_ids.h:385
@ LAYER_SHEET
Definition: layer_ids.h:373
@ LAYER_SCHEMATIC_BACKGROUND
Definition: layer_ids.h:388
wxFont GetInfoFont(wxWindow *aWindow)
Definition: ui_common.cpp:151
see class PGM_BASE
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:119
constexpr int IUToMils(int iu) const
Definition: base_units.h:100
constexpr int MilsToIU(int mils) const
Definition: base_units.h:94