KiCad PCB EDA Suite
Loading...
Searching...
No Matches
panel_project_defaults.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 The KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software: you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation, either version 3 of the License, or (at your
9 * option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
21#include <pgm_base.h>
23#include <math/util.h>
24
25
30
31
33{
34 m_OptTrackOpacity->SetValue( KiROUND( aOpacities.m_TrackOpacity * 100.0 ) );
35 m_OptViaOpacity->SetValue( KiROUND( aOpacities.m_ViaOpacity * 100.0 ) );
36 m_OptPadOpacity->SetValue( KiROUND( aOpacities.m_PadOpacity * 100.0 ) );
37 m_OptZoneOpacity->SetValue( KiROUND( aOpacities.m_ZoneOpacity * 100.0 ) );
38 m_OptFilledShapeOpacity->SetValue( KiROUND( aOpacities.m_ShapeOpacity * 100.0 ) );
39 m_OptImageOpacity->SetValue( KiROUND( aOpacities.m_ImageOpacity * 100.0 ) );
40 m_OptOutsideGroupOpacity->SetValue( KiROUND( aOpacities.m_OutsideGroupOpacity * 100.0 ) );
41}
42
43
45{
46 if( COMMON_SETTINGS* cfg = Pgm().GetCommonSettings() )
47 applyOpacities( cfg->m_BoardOpacityDefaults );
48
49 return true;
50}
51
52
54{
55 if( COMMON_SETTINGS* cfg = Pgm().GetCommonSettings() )
56 {
57 BOARD_OPACITY_DEFAULTS& opacities = cfg->m_BoardOpacityDefaults;
58
59 opacities.m_TrackOpacity = m_OptTrackOpacity->GetValue() / 100.0;
60 opacities.m_ViaOpacity = m_OptViaOpacity->GetValue() / 100.0;
61 opacities.m_PadOpacity = m_OptPadOpacity->GetValue() / 100.0;
62 opacities.m_ZoneOpacity = m_OptZoneOpacity->GetValue() / 100.0;
63 opacities.m_ShapeOpacity = m_OptFilledShapeOpacity->GetValue() / 100.0;
64 opacities.m_ImageOpacity = m_OptImageOpacity->GetValue() / 100.0;
65 opacities.m_OutsideGroupOpacity = m_OptOutsideGroupOpacity->GetValue() / 100.0;
66 }
67
68 return true;
69}
70
71
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
Definition box2.h:985
PANEL_PROJECT_DEFAULTS_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 applyOpacities(const BOARD_OPACITY_DEFAULTS &aOpacities)
void ResetPanel() override
Reset the contents of this panel.
PANEL_PROJECT_DEFAULTS(wxWindow *aParent)
PGM_BASE & Pgm()
The global program "get" accessor.
see class PGM_BASE
Board object opacities used when a project's local settings file does not set them.