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>
26#include <layer_ids.h>
29#include <eeschema_settings.h>
31#include <widgets/ui_common.h>
32
33
35 UNITS_PROVIDER* aUnitsProvider,
36 wxWindow* aEventSource ) :
38 m_hPitch( aUnitsProvider, aEventSource, m_hPitchLabel, m_hPitchCtrl, m_hPitchUnits ),
39 m_vPitch( aUnitsProvider, aEventSource, m_vPitchLabel, m_vPitchCtrl, m_vPitchUnits )
40{
41 // Make the color swatch show "Clear Color" instead
42 m_borderColorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
43 m_backgroundColorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
44
45 wxFont helpFont = KIUI::GetInfoFont( this ).Italic();
46 m_hint1->SetFont( helpFont );
47 m_hint2->SetFont( helpFont );
48
49 m_spinLabelRepeatStep->SetRange( -100000, 100000 );
50 m_spinLabelRepeatStep->SetIncrement( 1 );
51
52#ifdef __WXOSX_MAC__
53 m_leftClickCmdsBook->SetSelection( 1 );
54#else
55 m_leftClickCmdsBook->SetSelection( 0 );
56#endif
57}
58
59
61{
65
67 COLOR_SETTINGS* settings = mgr.GetColorSettings();
68 COLOR4D schematicBackground = settings->GetColor( LAYER_SCHEMATIC_BACKGROUND );
69
70 m_borderColorSwatch->SetSwatchBackground( schematicBackground );
73
74 m_backgroundColorSwatch->SetSwatchBackground( schematicBackground );
77
78 m_choiceLineMode->SetSelection( aCfg->m_Drawing.line_mode );
80 m_neverShowRescue->SetValue( aCfg->m_RescueNeverShow );
81
85
86 m_mouseDragIsDrag->SetValue( !aCfg->m_Input.drag_is_move );
87
90}
91
92
94{
97
99
100 return true;
101}
102
103
105{
108
111
115
116 cfg->m_Drawing.line_mode = m_choiceLineMode->GetSelection();
118 cfg->m_RescueNeverShow = m_neverShowRescue->GetValue();
119
123
124 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:110
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.
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,...
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:387
@ LAYER_SHEET
Definition: layer_ids.h:375
@ LAYER_SCHEMATIC_BACKGROUND
Definition: layer_ids.h:390
KICOMMON_API wxFont GetInfoFont(wxWindow *aWindow)
Definition: ui_common.cpp:154
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.