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 The 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, see <https://www.gnu.org/licenses/>.
19 */
20
21#include <pcb_edit_frame.h>
24#include "panel_board_finish.h"
25
26
28 PCB_EDIT_FRAME* aFrame ) :
29 PANEL_SETUP_BOARD_FINISH_BASE( aParentWindow )
30{
31 m_frame = aFrame;
32 m_board = m_frame->GetBoard();
33 m_brdSettings = &m_board->GetDesignSettings();
34
35 // Get the translated list of choices and init m_choiceFinish
36 wxArrayString finish_list = GetStandardCopperFinishes( true );
37 m_choiceFinish->Append( finish_list );
38 m_choiceFinish->SetSelection( 0 ); // Will be correctly set later
39
41}
42
43
47
48
50{
51 const BOARD_STACKUP& brd_stackup = m_brdSettings->GetStackupDescriptor();
52
53 m_choiceEdgeConn->SetSelection( brd_stackup.m_EdgeConnectorConstraints );
54 m_cbEgdesPlated->SetValue( brd_stackup.m_EdgePlating );
55
56 // find the choice depending on the initial finish setting
57 wxArrayString initial_finish_list = GetStandardCopperFinishes( false );
58 unsigned idx;
59
60 for( idx = 0; idx < initial_finish_list.GetCount(); idx++ )
61 {
62 if( initial_finish_list[idx] == brd_stackup.m_FinishType )
63 break;
64 }
65
66 // Now init the choice (use last choice: "User defined" if not found )
67 if( idx >= initial_finish_list.GetCount() )
68 idx = initial_finish_list.GetCount()-1;
69
70 m_choiceFinish->SetSelection( idx );
71}
72
73
75{
76 BOARD_STACKUP& brd_stackup = m_brdSettings->GetStackupDescriptor();
77
78 if( TransferDataFromWindow( brd_stackup ) )
79 m_frame->OnModify();
80
81 return true;
82}
83
84
86{
87 wxArrayString finish_list = GetStandardCopperFinishes( false );
88 int finish = m_choiceFinish->GetSelection() >= 0 ? m_choiceFinish->GetSelection() : 0;
89 bool modified = aStackup.m_FinishType != finish_list[finish];
90 aStackup.m_FinishType = finish_list[finish];
91
92 int edge = m_choiceEdgeConn->GetSelection();
93 modified |= aStackup.m_EdgeConnectorConstraints != (BS_EDGE_CONNECTOR_CONSTRAINTS) edge;
95
96 modified |= aStackup.m_EdgePlating != m_cbEgdesPlated->GetValue();
97 aStackup.m_EdgePlating = m_cbEgdesPlated->GetValue();
98
99 return modified;
100}
101
102
104{
105 BOARD* savedBrd = m_board;
106 BOARD_DESIGN_SETTINGS* savedSettings = m_brdSettings;
107 m_brdSettings = &aBoard->GetDesignSettings();
108
110
111 m_brdSettings = savedSettings;
112 m_board = savedBrd;
113}
BS_EDGE_CONNECTOR_CONSTRAINTS
Container for design settings for a BOARD object.
Manage layers needed to make a physical board.
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:372
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition board.cpp:1149
PANEL_SETUP_BOARD_FINISH_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)
bool TransferDataFromWindow() override
BOARD_DESIGN_SETTINGS * m_brdSettings
void ImportSettingsFrom(BOARD *aBoard)
PANEL_SETUP_BOARD_FINISH(wxWindow *aParentWindow, PCB_EDIT_FRAME *aFrame)
The main frame for Pcbnew.
wxArrayString GetStandardCopperFinishes(bool aTranslate)