KiCad PCB EDA Suite
Loading...
Searching...
No Matches
panel_display_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) 2015 Jean-Pierre Charras, jean-pierre.charras at wanadoo.fr
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software: you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation, either version 3 of the License, or (at your
10 * option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#include <pgm_base.h>
23#include <pcbnew_settings.h>
24#include <config_map.h>
27
28
37
38
41 m_isPCBEdit( dynamic_cast<PCBNEW_SETTINGS*>( aAppSettings ) != nullptr )
42{
43 m_galOptsPanel = new PANEL_GAL_OPTIONS( this, aAppSettings );
44 m_galOptionsSizer->Add( m_galOptsPanel, 1, wxEXPAND|wxRIGHT, 5 );
45
46 m_optionsBook->SetSelection( m_isPCBEdit ? 1 : 0 );
47}
48
49
53
54
72
73
75{
76 if( m_isPCBEdit )
78
79 m_galOptsPanel->TransferDataToWindow();
80
81 return true;
82}
83
84
85/*
86 * Update variables with new options
87 */
89{
90 m_galOptsPanel->TransferDataFromWindow();
91
92 if( m_isPCBEdit )
93 {
95 {
96 int i = m_OptDisplayTracksClearance->GetSelection();
97 cfg->m_Display.m_TrackClearance = UTIL::GetValFromConfig( clearanceModeMap, i );
98
99 cfg->m_Display.m_PadClearance = m_OptDisplayPadClearence->GetValue();
100 cfg->m_Display.m_UseViaColorForNormalTHPadstacks = m_OptUseViaColorForNormalTHPadstacks->GetValue();
101 cfg->m_ViewersDisplay.m_DisplayPadNumbers = m_OptDisplayPadNumber->GetValue();
102 cfg->m_Display.m_NetNames = m_ShowNetNamesOption->GetSelection();
103 cfg->m_Display.m_ForceShowFieldsWhenFPSelected = m_checkForceShowFieldsWhenFPSelected->GetValue();
104 cfg->m_Display.m_Live3DRefresh = m_live3Drefresh->GetValue();
105 cfg->m_CrossProbing.on_selection = m_checkCrossProbeOnSelection->GetValue();
106 cfg->m_CrossProbing.center_on_items = m_checkCrossProbeCenter->GetValue();
107 cfg->m_CrossProbing.zoom_to_fit = m_checkCrossProbeZoom->GetValue();
108 cfg->m_CrossProbing.auto_highlight = m_checkCrossProbeAutoHighlight->GetValue();
109 cfg->m_CrossProbing.flash_selection = m_checkCrossProbeFlash->GetValue();
110 }
111 }
112
113 return true;
114}
115
116
118{
119 if( m_isPCBEdit )
120 {
121 PCBNEW_SETTINGS cfg;
122 cfg.Load(); // Loading without a file will init to defaults
123
124 loadPCBSettings( &cfg );
125 m_galOptsPanel->ResetPanel( &cfg );
126 }
127 else
128 {
129 m_galOptsPanel->ResetPanel( nullptr );
130 }
131}
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
CROSS_PROBING_SETTINGS m_CrossProbing
virtual void Load()
Updates the parameters of this object based on the current JSON document contents.
PANEL_DISPLAY_OPTIONS_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxTAB_TRAVERSAL, const wxString &name=wxEmptyString)
void loadPCBSettings(PCBNEW_SETTINGS *aCfg)
PANEL_DISPLAY_OPTIONS(wxWindow *aParent, APP_SETTINGS_BASE *aAppSettings)
PANEL_GAL_OPTIONS * m_galOptsPanel
void ResetPanel() override
Reset the contents of this panel.
bool TransferDataFromWindow() override
DISPLAY_OPTIONS m_Display
VIEWERS_DISPLAY_OPTIONS m_ViewersDisplay
std::vector< std::pair< T, long > > CFG_MAP
A config value table is a list of native values (usually enums) to a different set of values,...
Definition config_map.h:49
static long GetConfigForVal(const MAP &aMap, CFG_NATIVE_VAL< MAP > aVal)
Get the mapped config value (the one to write to file, or use in an index) from the given native (pro...
Definition config_map.h:69
static CFG_NATIVE_VAL< MAP > GetValFromConfig(const MAP &aMap, long aConf)
Get the native value corresponding to the config value (read from file or UI, probably) and find it i...
Definition config_map.h:96
static const UTIL::CFG_MAP< TRACK_CLEARANCE_MODE > clearanceModeMap
@ SHOW_WITH_VIA_WHILE_ROUTING_OR_DRAGGING
@ DO_NOT_SHOW_CLEARANCE
@ SHOW_WHILE_ROUTING
@ SHOW_WITH_VIA_ALWAYS
@ SHOW_WITH_VIA_WHILE_ROUTING
see class PGM_BASE
T * GetAppSettings(const char *aFilename)
bool flash_selection
Flash newly cross-probed selection (visual attention aid).
bool on_selection
Synchronize the selection for multiple items too.
bool zoom_to_fit
Zoom to fit items (ignored if center_on_items is off).
bool center_on_items
Automatically pan to cross-probed items.
bool auto_highlight
Automatically turn on highlight mode in the target frame.
TRACK_CLEARANCE_MODE m_TrackClearance