KiCad PCB EDA Suite
Loading...
Searching...
No Matches
panel_setup_mask_and_paste.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
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, see <https://www.gnu.org/licenses/>.
18 */
19
20
21#include <pcb_edit_frame.h>
26
27
29 BOARD_DESIGN_SETTINGS& aSettings ) :
30 PANEL_SETUP_MASK_AND_PASTE_BASE( aParentWindow ),
36{
37 m_Frame = aFrame;
38 m_BrdSettings = &aSettings;
39
40 m_staticTextInfoPaste->SetFont( KIUI::GetInfoFont( this ).Italic() );
41
42 // Update label text and tooltip for combined offset + ratio field
43 m_pasteMarginLabel->SetLabel( _( "Solder paste clearance:" ) );
44 m_pasteMarginLabel->SetToolTip( _( "Solder paste clearance relative to pad size.\n"
45 "Enter an absolute value (e.g., -0.1mm), a percentage "
46 "(e.g., -5%), or both (e.g., -0.1mm - 5%).\n"
47 "This value can be superseded by local values for a "
48 "footprint or a pad." ) );
49
50 // Hide the old ratio controls - they're no longer needed
51 m_pasteMarginRatioLabel->Show( false );
52 m_pasteMarginRatioCtrl->Show( false );
53 m_pasteMarginRatioUnits->Show( false );
54
55 // These two are the values the mask rules are read against, so they are set with those rules.
56 // The paste clearance stays here, because one control holds it and its ratio together.
59
60 if( !m_maskExpansionPage.IsEmpty() )
62
63 if( !m_maskMinWidthPage.IsEmpty() )
65
66 // Only the absolute part of this control is a constraint a rule page holds; the ratio is a
67 // constraint of its own with no page, so it is only ever set here
69
70 if( !m_pasteMarginPage.IsEmpty() )
72}
73
74
76{
77 // Also records the baselines for the values a rule page edits
79
80 m_maskToCopperClearance.SetValue( m_BrdSettings->m_SolderMaskToCopperClearance );
81 m_pasteMargin.SetRatioValue( m_BrdSettings->m_SolderPasteMarginRatio );
82
83 m_allowBridges->SetValue( m_BrdSettings->m_AllowSoldermaskBridgesInFPs );
84
85 return true;
86}
87
88
90{
91 // These are all stored in project file, not board, so no need for OnModify()
92
93 // These two can also be set with the rules read against them, so a field the user did not
94 // touch here must not write back over an edit made on that page
95 if( m_maskExpansion.GetIntValue() != m_maskExpansionLoaded )
96 {
98 m_BrdSettings->m_SolderMaskExpansion = m_maskExpansionLoaded;
99 }
100
101 if( m_maskMinWidth.GetIntValue() != m_maskMinWidthLoaded )
102 {
103 m_maskMinWidthLoaded = m_maskMinWidth.GetIntValue();
104 m_BrdSettings->m_SolderMaskMinWidth = m_maskMinWidthLoaded;
105 }
106
107 m_BrdSettings->m_SolderMaskToCopperClearance = m_maskToCopperClearance.GetIntValue();
108
109 if( m_pasteMargin.GetOffsetValue().value_or( 0 ) != m_pasteMarginLoaded )
110 {
111 m_pasteMarginLoaded = m_pasteMargin.GetOffsetValue().value_or( 0 );
112 m_BrdSettings->m_SolderPasteMargin = m_pasteMarginLoaded;
113 }
114
115 m_BrdSettings->m_SolderPasteMarginRatio = m_pasteMargin.GetRatioValue().value_or( 0.0 );
116
117 m_BrdSettings->m_AllowSoldermaskBridgesInFPs = m_allowBridges->GetValue();
118
119 return true;
120}
121
122
124{
125 m_maskExpansionLoaded = m_BrdSettings->m_SolderMaskExpansion;
127
128 m_maskMinWidthLoaded = m_BrdSettings->m_SolderMaskMinWidth;
130
131 m_pasteMarginLoaded = m_BrdSettings->m_SolderPasteMargin;
132 m_pasteMargin.SetOffsetValue( m_pasteMarginLoaded );
133}
134
135
Container for design settings for a BOARD object.
static wxString PageEditingDefault(const wxString &aSetting)
The title of the page that edits a board default, or empty where no rule page edits one.
static void LinkToPage(wxWindow *aField, const wxString &aPage, int aSlot=1)
Puts a link to another page holding the same value at the field's right edge.
PANEL_SETUP_MASK_AND_PASTE_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)
static void CopySettings(const BOARD_DESIGN_SETTINGS &aFrom, BOARD_DESIGN_SETTINGS &aTo)
Copies every value this page edits, which is what the Solder Mask/Paste import group carries.
int m_maskExpansionLoaded
The values as this page last read them, so an untouched field does not write back over an edit made o...
void RefreshDefaults()
Reads the values a rule page sets back into their fields.
PANEL_SETUP_MASK_AND_PASTE(wxWindow *aParentWindow, PCB_EDIT_FRAME *aFrame, BOARD_DESIGN_SETTINGS &aSettings)
BOARD_DESIGN_SETTINGS * m_BrdSettings
wxString m_maskExpansionPage
The rule pages that also hold these values, where they do.
The main frame for Pcbnew.
#define _(s)
KICOMMON_API wxFont GetInfoFont(wxWindow *aWindow)