KiCad PCB EDA Suite
panel_setup_constraints.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-2020 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
25#include <board.h>
26#include <math/util.h>
29#include <pcb_edit_frame.h>
31#include <wx/treebook.h>
32#include <bitmaps.h>
33
34
36 PANEL_SETUP_CONSTRAINTS_BASE( aParent->GetTreebook() ),
37 m_minClearance( aFrame, m_clearanceTitle, m_clearanceCtrl, m_clearanceUnits ),
38 m_minConn( aFrame, m_MinConnTitle, m_MinConnCtrl, m_MinConnUnits ),
39 m_trackMinWidth( aFrame, m_TrackMinWidthTitle, m_TrackMinWidthCtrl, m_TrackMinWidthUnits ),
40 m_viaMinAnnulus( aFrame, m_ViaMinAnnulusTitle, m_ViaMinAnnulusCtrl, m_ViaMinAnnulusUnits ),
41 m_viaMinSize( aFrame, m_ViaMinTitle, m_SetViasMinSizeCtrl, m_ViaMinUnits ),
42 m_throughHoleMin( aFrame, m_MinDrillTitle, m_MinDrillCtrl, m_MinDrillUnits ),
43 m_uviaMinSize( aFrame, m_uviaMinSizeLabel, m_uviaMinSizeCtrl, m_uviaMinSizeUnits ),
44 m_uviaMinDrill( aFrame, m_uviaMinDrillLabel, m_uviaMinDrillCtrl, m_uviaMinDrillUnits ),
45 m_holeToHoleMin( aFrame, m_HoleToHoleTitle, m_SetHoleToHoleCtrl, m_HoleToHoleUnits ),
46 m_holeClearance( aFrame, m_HoleClearanceLabel, m_HoleClearanceCtrl, m_HoleClearanceUnits ),
47 m_edgeClearance( aFrame, m_EdgeClearanceLabel, m_EdgeClearanceCtrl, m_EdgeClearanceUnits ),
48 m_silkClearance( aFrame, m_silkClearanceLabel, m_silkClearanceCtrl, m_silkClearanceUnits ),
49 m_minTextHeight( aFrame, m_textHeightLabel, m_textHeightCtrl, m_textHeightUnits ),
50 m_minTextThickness( aFrame, m_textThicknessLabel, m_textThicknessCtrl, m_textThicknessUnits ),
51 m_maxError( aFrame, m_maxErrorTitle, m_maxErrorCtrl, m_maxErrorUnits )
52{
53 m_Frame = aFrame;
55
57
58 wxSize ctrlSize = m_minResolvedSpokeCountCtrl->GetSize();
59 ctrlSize.x = KIUI::GetTextSize( wxT( "XXX" ), m_minResolvedSpokeCountCtrl ).x;
60 m_minResolvedSpokeCountCtrl->SetSize( ctrlSize );
61}
62
63
65{
66 wxString msg;
67 msg.Printf( m_stCircleToPolyWarning->GetLabel(), m_Frame->StringFromValue( ARC_HIGH_DEF, true ) );
68 m_stCircleToPolyWarning->SetLabel( msg );
69
71
73
76
84
87
90
94
95 return true;
96}
97
98
100{
102 return false;
103
104 if( !m_minConn.Validate( 0, 10, EDA_UNITS::INCHES ) )
105 return false;
106
108 return false;
109
111 return false;
112
114 return false;
115
117 return false;
118
120 return false;
121
122 if( !m_throughHoleMin.Validate( 2, 1000, EDA_UNITS::MILS ) ) // #107 to 1 inch
123 return false;
124
126 return false;
127
128 // These are all stored in project file, not board, so no need for OnModify()
129
131
135
138
146
149
152
156
157 return true;
158}
159
160
162{
163 bool retVal = wxPanel::Show( aShow );
164
165 if( aShow )
166 {
167 // These *should* work in the constructor, and indeed they do if this panel is the
168 // first displayed. However, on OSX 3.0.5 (at least), if another panel is displayed
169 // first then the icons will be blank unless they're set here.
183
184 Layout();
185 }
186
187 return retVal;
188}
189
190
192{
193 BOARD_DESIGN_SETTINGS* savedSettings = m_BrdSettings;
194
195 m_BrdSettings = &aBoard->GetDesignSettings();
197
198 m_BrdSettings = savedSettings;
199}
constexpr int ARC_HIGH_DEF
Definition: base_units.h:121
constexpr EDA_IU_SCALE pcbIUScale
Definition: base_units.h:109
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
Definition: bitmap.cpp:105
@ via_diameter
@ via_hole_diameter
@ thermal_spokes
@ hole_to_hole_clearance
@ edge_to_copper_clearance
@ hole_to_copper_clearance
@ ps_diff_pair_gap
#define MAXIMUM_ERROR_SIZE_MM
#define MINIMUM_ERROR_SIZE_MM
Container for design settings for a BOARD object.
bool m_UseHeightForLengthCalcs
Enable inclusion of stackup height in track length measurements and length tuning.
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:265
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:628
Class PANEL_SETUP_CONSTRAINTS_BASE.
PANEL_SETUP_CONSTRAINTS(PAGED_DIALOG *aParent, PCB_EDIT_FRAME *aFrame)
bool Show(bool aShow) override
BOARD_DESIGN_SETTINGS * m_BrdSettings
void ImportSettingsFrom(BOARD *aBoard)
BOARD * GetBoard() const
The main frame for Pcbnew.
wxString StringFromValue(double aValue, bool aAddUnitLabel=false, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Converts aValue in internal units into a united string.
virtual long long int GetValue()
Return the current value in Internal Units.
virtual bool Validate(double aMin, double aMax, EDA_UNITS aUnits=EDA_UNITS::UNSCALED)
Validate the control against the given range, informing the user of any errors found.
virtual void SetValue(long long int aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion.
wxFont GetInfoFont(wxWindow *aWindow)
Definition: ui_common.cpp:144
wxSize GetTextSize(const wxString &aSingleLine, wxWindow *aWindow)
Return the size of aSingleLine of text when it is rendered in aWindow using whatever font is currentl...
Definition: ui_common.cpp:70
const double IU_PER_MM
Definition: base_units.h:77