KiCad PCB EDA Suite
Loading...
Searching...
No Matches
panel_board_finish.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) 2019 Jean-Pierre Charras, jp.charras at wanadoo.fr
5 * Copyright (C) 2019-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 <pcb_edit_frame.h>
28#include "panel_board_finish.h"
29
30
32 PCB_EDIT_FRAME* aFrame ) :
33 PANEL_SETUP_BOARD_FINISH_BASE( aParentWindow )
34{
35 m_frame = aFrame;
38
39 // Get the translated list of choices and init m_choiceFinish
40 wxArrayString finish_list = GetStandardCopperFinishes( true );
41 m_choiceFinish->Append( finish_list );
42 m_choiceFinish->SetSelection( 0 ); // Will be correctly set later
43
45}
46
47
49{
50}
51
52
54{
55 const BOARD_STACKUP& brd_stackup = m_brdSettings->GetStackupDescriptor();
56
57 m_choiceEdgeConn->SetSelection( brd_stackup.m_EdgeConnectorConstraints );
58 m_cbCastellatedPads->SetValue( brd_stackup.m_CastellatedPads );
59 m_cbEgdesPlated->SetValue( brd_stackup.m_EdgePlating );
60
61 // find the choice depending on the initial finish setting
62 wxArrayString initial_finish_list = GetStandardCopperFinishes( false );
63 unsigned idx;
64
65 for( idx = 0; idx < initial_finish_list.GetCount(); idx++ )
66 {
67 if( initial_finish_list[idx] == brd_stackup.m_FinishType )
68 break;
69 }
70
71 // Now init the choice (use last choice: "User defined" if not found )
72 if( idx >= initial_finish_list.GetCount() )
73 idx = initial_finish_list.GetCount()-1;
74
75 m_choiceFinish->SetSelection( idx );
76}
77
78
80{
82
83 if( TransferDataFromWindow( brd_stackup ) )
85
86 return true;
87}
88
89
91{
92 wxArrayString finish_list = GetStandardCopperFinishes( false );
93 int finish = m_choiceFinish->GetSelection() >= 0 ? m_choiceFinish->GetSelection() : 0;
94 bool modified = aStackup.m_FinishType != finish_list[finish];
95 aStackup.m_FinishType = finish_list[finish];
96
97 int edge = m_choiceEdgeConn->GetSelection();
98 modified |= aStackup.m_EdgeConnectorConstraints != (BS_EDGE_CONNECTOR_CONSTRAINTS) edge;
100
101 modified |= aStackup.m_CastellatedPads != m_cbCastellatedPads->GetValue();
102 aStackup.m_CastellatedPads = m_cbCastellatedPads->GetValue();
103
104 modified |= aStackup.m_EdgePlating != m_cbEgdesPlated->GetValue();
105 aStackup.m_EdgePlating = m_cbEgdesPlated->GetValue();
106
107 return modified;
108}
109
110
112{
113 BOARD* savedBrd = m_board;
114 BOARD_DESIGN_SETTINGS* savedSettings = m_brdSettings;
115 m_brdSettings = &aBoard->GetDesignSettings();
116
118
119 m_brdSettings = savedSettings;
120 m_board = savedBrd;
121}
BS_EDGE_CONNECTOR_CONSTRAINTS
Definition: board_stackup.h:56
Container for design settings for a BOARD object.
BOARD_STACKUP & GetStackupDescriptor()
Manage layers needed to make a physical board.
bool m_CastellatedPads
True if castellated pads exist.
bool m_EdgePlating
True if the edge board is plated.
BS_EDGE_CONNECTOR_CONSTRAINTS m_EdgeConnectorConstraints
If the board has edge connector cards, some constrains can be specified in job file: BS_EDGE_CONNECTO...
wxString m_FinishType
The name of external copper finish.
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:290
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:895
Class PANEL_SETUP_BOARD_FINISH_BASE.
bool TransferDataFromWindow() override
BOARD_DESIGN_SETTINGS * m_brdSettings
void ImportSettingsFrom(BOARD *aBoard)
PANEL_SETUP_BOARD_FINISH(wxWindow *aParentWindow, PCB_EDIT_FRAME *aFrame)
BOARD * GetBoard() const
The main frame for Pcbnew.
void OnModify() override
Must be called after a board change to set the modified flag.
wxArrayString GetStandardCopperFinishes(bool aTranslate)