KiCad PCB EDA Suite
panel_3D_colors.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) 2021 KiCad Developers, see AUTHORS.txt for contributors.
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU 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, you may find one here:
18  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19  * or you may search the http://www.gnu.org website for the version 2 license,
20  * or you may write to the Free Software Foundation, Inc.,
21  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22  */
23 
24 #include "panel_3D_colors.h"
25 #include <widgets/color_swatch.h>
27 #include <pgm_base.h>
28 
29 
31  PANEL_3D_COLORS_BASE( aParent ),
32  m_boardAdapter( aFrame->GetAdapter() )
33 {
36 
41 
46 
49 
52 
55 }
56 
57 
59 {
60  COLOR_SETTINGS* colors = Pgm().GetSettingsManager().GetColorSettings();
61 
66  m_solderMaskTop->SetBackgroundColour( *wxWHITE );
67  m_solderMaskBottom->SetBackgroundColour( *wxWHITE );
70  m_boardBody->SetBackgroundColour( *wxWHITE );
71 
80  m_boardBody->SetSwatchColor( colors->GetColor( LAYER_3D_BOARD ), false );
81 
82  if( colors->GetUseBoardStackupColors() )
83  m_boardStackupRB->SetValue( true );
84  else
85  m_specificColorsRB->SetValue( true );
86 
87  return true;
88 }
89 
90 
92 {
93  COLOR_SETTINGS* colors = Pgm().GetSettingsManager().GetColorSettings();
94 
104 
105  colors->SetUseBoardStackupColors( m_boardStackupRB->GetValue() );
106 
107  Pgm().GetSettingsManager().SaveColorSettings( colors, "3d_viewer" );
108 
109  return true;
110 }
void SetSwatchColor(const KIGFX::COLOR4D &aColor, bool aSendEvent)
Set the current swatch color directly.
Class PANEL_3D_COLORS_BASE.
KIGFX::COLOR4D GetSwatchColor() const
COLOR_SWATCH * m_silkscreenTop
bool GetUseBoardStackupColors() const
static KIGFX::COLOR4D g_DefaultSilkscreen
wxRadioButton * m_boardStackupRB
COLOR_SWATCH * m_silkscreenBottom
COLOR_SWATCH * m_backgroundBottom
static KIGFX::COLOR4D g_DefaultSurfaceFinish
PANEL_3D_COLORS(EDA_3D_VIEWER_FRAME *aFrame, wxWindow *aParent)
void SetColor(int aLayer, const COLOR4D &aColor)
COLOR_SWATCH * m_surfaceFinish
static CUSTOM_COLORS_LIST g_BoardColors
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:106
static KIGFX::COLOR4D g_DefaultBackgroundBot
static CUSTOM_COLORS_LIST g_FinishColors
bool TransferDataFromWindow() override
Automatically called when clicking on the OK button.
static CUSTOM_COLORS_LIST g_PasteColors
static KIGFX::COLOR4D g_DefaultSolderMask
void SetSupportsOpacity(bool aSupportsOpacity)
Definition: color_swatch.h:112
static KIGFX::COLOR4D g_DefaultBoardBody
Create and handle a window for the 3d viewer connected to a Kiway and a pcbboard.
COLOR_SWATCH * m_solderMaskTop
COLOR_SWATCH * m_backgroundTop
static KIGFX::COLOR4D g_DefaultBackgroundTop
void SetDefaultColor(const KIGFX::COLOR4D &aColor)
Sets the color that will be chosen with the "Reset to Default" button in the chooser.
wxRadioButton * m_specificColorsRB
COLOR4D GetColor(int aLayer) const
see class PGM_BASE
static KIGFX::COLOR4D g_DefaultSolderPaste
COLOR_SWATCH * m_solderMaskBottom
bool TransferDataToWindow() override
Automatically called after creating the dialog.
COLOR_SWATCH * m_solderPaste
BOARD_ADAPTER & m_boardAdapter
Color settings are a bit different than most of the settings objects in that there can be more than o...
static CUSTOM_COLORS_LIST g_MaskColors
static CUSTOM_COLORS_LIST g_SilkscreenColors
void SetUseBoardStackupColors(bool aFlag)
void SetUserColors(CUSTOM_COLORS_LIST *aUserColors)
Fetch a reference to the user colors list.
Definition: color_swatch.h:95