KiCad PCB EDA Suite
panel_setup_feature_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 
24 #include <board_design_settings.h>
25 #include <class_board.h> // for BOARD
26 #include <convert_to_biu.h> // for IU_PER_MM
27 #include <math/util.h>
29 #include <panel_setup_feature_constraints_base.h> // for PANEL_SETUP_FEATUR...
30 #include <pcb_edit_frame.h>
31 #include <widgets/paged_dialog.h> // for PAGED_DIALOG
32 #include <wx/treebook.h>
33 #include <bitmaps.h>
34 
35 
37  PCB_EDIT_FRAME* aFrame ) :
38  PANEL_SETUP_FEATURE_CONSTRAINTS_BASE( aParent->GetTreebook() ),
39  m_minClearance( aFrame, m_clearanceTitle, m_clearanceCtrl, m_clearanceUnits, true ),
40  m_trackMinWidth( aFrame, m_TrackMinWidthTitle, m_TrackMinWidthCtrl, m_TrackMinWidthUnits, true ),
41  m_viaMinAnnulus( aFrame, m_ViaMinAnnulusTitle, m_ViaMinAnnulusCtrl, m_ViaMinAnnulusUnits, true ),
42  m_viaMinSize( aFrame, m_ViaMinTitle, m_SetViasMinSizeCtrl, m_ViaMinUnits, true ),
43  m_throughHoleMin( aFrame, m_MinDrillTitle, m_MinDrillCtrl, m_MinDrillUnits, true ),
44  m_uviaMinSize( aFrame, m_uviaMinSizeLabel, m_uviaMinSizeCtrl, m_uviaMinSizeUnits, true ),
45  m_uviaMinDrill( aFrame, m_uviaMinDrillLabel, m_uviaMinDrillCtrl, m_uviaMinDrillUnits, true ),
46  m_holeToHoleMin( aFrame, m_HoleToHoleTitle, m_SetHoleToHoleCtrl, m_HoleToHoleUnits, true ),
47  m_edgeClearance( aFrame, m_EdgeClearanceLabel, m_EdgeClearanceCtrl, m_EdgeClearanceUnits, true ),
48  m_silkClearance( aFrame, m_silkClearanceLabel, m_silkClearanceCtrl, m_silkClearanceUnits, true ),
49  m_maxError( aFrame, m_maxErrorTitle, m_maxErrorCtrl, m_maxErrorUnits, true )
50 {
51  m_Frame = aFrame;
53 }
54 
55 
57 {
58  wxString fmt = m_stCircleToPolyWarning->GetLabel();
61  ARC_HIGH_DEF, true ) ) );
62 
65 
67 
71 
77 
80 
83 
85 
86  return true;
87 }
88 
89 
91 {
93  return false;
94 
96  return false;
97 
99  return false;
100 
101  if( !m_viaMinSize.Validate( 0, 10, EDA_UNITS::INCHES ) )
102  return false;
103 
105  return false;
106 
107  if( !m_throughHoleMin.Validate( 2, 1000, EDA_UNITS::MILS ) ) // #107 to 1 inch
108  return false;
109 
111  return false;
112 
113  // These are all stored in project file, not board, so no need for OnModify()
114 
117 
121 
124 
130 
133 
136 
138 
139  return true;
140 }
141 
142 
144 {
145  bool retVal = wxPanel::Show( aShow );
146 
147  if( aShow )
148  {
149  // These *should* work in the constructor, and indeed they do if this panel is the
150  // first displayed. However, on OSX 3.0.5 (at least), if another panel is displayed
151  // first then the icons will be blank unless they're set here.
152  m_bitmapZoneFillOpt->SetBitmap( KiBitmap( show_zone_xpm ) );
153  m_filletBitmap->SetBitmap( KiBitmap( zone_fillet_xpm ) );
164  m_bitmap_uVia->SetBitmap( KiBitmap( via_microvia_xpm ) );
165 
166  Layout();
167  }
168 
169  return retVal;
170 }
171 
172 
174 {
175  BOARD_DESIGN_SETTINGS* savedSettings = m_BrdSettings;
176 
177  m_BrdSettings = &aBoard->GetDesignSettings();
179 
180  m_BrdSettings = savedSettings;
181 }
182 
183 
185 {
186  wxObject* item =event.GetEventObject();
187 
188  if( item == m_rbOutlinePolygonBestQ )
189  m_rbOutlinePolygonFastest->SetValue( not m_rbOutlinePolygonBestQ->GetValue() );
190  else
191  m_rbOutlinePolygonBestQ->SetValue( not m_rbOutlinePolygonFastest->GetValue() );
192 }
const BITMAP_OPAQUE via_annulus_xpm[1]
Definition: via_annulus.cpp:68
void SetCopperEdgeClearance(int aDistance)
Function SetCopperEdgeClearance.
static constexpr double IU_PER_MM
Mock up a conversion function.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: class_board.h:558
const BITMAP_OPAQUE via_hole_diameter_xpm[1]
const BITMAP_OPAQUE via_microvia_xpm[1]
const BITMAP_OPAQUE edge_to_copper_clearance_xpm[1]
#define MINIMUM_ERROR_SIZE_MM
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:82
void SetMinHoleSeparation(int aDistance)
Function SetMinHoleSeparation.
bool m_BlindBuriedViaAllowed
true to allow blind/buried vias
const BITMAP_OPAQUE via_buried_xpm[1]
Definition: via_buried.cpp:55
Class PANEL_SETUP_FEATURE_CONSTRAINTS_BASE.
void onChangeOutlineOpt(wxCommandEvent &event) override
const BITMAP_OPAQUE show_zone_xpm[1]
Definition: show_zone.cpp:56
virtual bool Validate(double aMin, double aMax, EDA_UNITS aUnits=EDA_UNITS::UNSCALED)
Function Validate Validates the control against the given range, informing the user of any errors fou...
const BITMAP_OPAQUE ps_diff_pair_gap_xpm[1]
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:201
const BITMAP_OPAQUE zone_fillet_xpm[1]
Definition: zone_fillet.cpp:39
Information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:186
#define MAXIMUM_ERROR_SIZE_MM
virtual void SetValue(int aValue)
Function SetValue Sets new value (in Internal Units) for the text field, taking care of units convers...
PCB_EDIT_FRAME is the main frame for Pcbnew.
const BITMAP_OPAQUE hole_to_hole_clearance_xpm[1]
virtual long long int GetValue()
Function GetValue Returns the current value in Internal Units.
wxString StringFromValue(EDA_UNITS aUnits, double aValue, bool aAddUnitSymbol, EDA_DATA_TYPE aType)
Function StringFromValue returns the string from aValue according to units (inch, mm ....
Definition: base_units.cpp:220
PANEL_SETUP_FEATURE_CONSTRAINTS(PAGED_DIALOG *aParent, PCB_EDIT_FRAME *aFrame)
bool m_MicroViasAllowed
true to allow micro vias
BOARD * GetBoard() const
const BITMAP_OPAQUE via_diameter_xpm[1]
const BITMAP_OPAQUE width_track_xpm[1]
Definition: width_track.cpp:39
EDA_UNITS GetUserUnits() const
Return the user units currently in use.
BOARD_DESIGN_SETTINGS contains design settings for a BOARD object.