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_maxError( aFrame, m_maxErrorTitle, m_maxErrorCtrl, m_maxErrorUnits, true )
49 {
50  m_Frame = aFrame;
52 }
53 
54 
56 {
59 
61 
64 
70 
73 
76 
77  return true;
78 }
79 
80 
82 {
84  return false;
85 
87  return false;
88 
90  return false;
91 
92  if( !m_viaMinSize.Validate( 0, 10, EDA_UNITS::INCHES ) )
93  return false;
94 
96  return false;
97 
98  if( !m_throughHoleMin.Validate( 2, 1000, EDA_UNITS::INCHES, true ) ) // #107 to 1 inch
99  return false;
100 
102  return false;
103 
106 
107  m_BrdSettings->m_MaxError = Clamp<int>( IU_PER_MM * MINIMUM_ERROR_SIZE_MM,
108  m_maxError.GetValue(), IU_PER_MM * MAXIMUM_ERROR_SIZE_MM );
109 
111 
117 
120 
123 
124  return true;
125 }
126 
127 
129 {
130  bool retVal = wxPanel::Show( aShow );
131 
132  if( aShow )
133  {
134  // These *should* work in the constructor, and indeed they do if this panel is the
135  // first displayed. However, on OSX 3.0.5 (at least), if another panel is displayed
136  // first then the icons will be blank unless they're set here.
137  m_bitmapZoneFillOpt->SetBitmap( KiBitmap( show_zone_xpm ) );
148  m_bitmap_uVia->SetBitmap( KiBitmap( via_microvia_xpm ) );
149 
150  Layout();
151  }
152 
153  return retVal;
154 }
155 
156 
158 {
159  BOARD_DESIGN_SETTINGS* savedSettings = m_BrdSettings;
160 
161  m_BrdSettings = &aBoard->GetDesignSettings();
163 
164  m_BrdSettings = savedSettings;
165 }
166 
167 
169 {
170  wxObject* item =event.GetEventObject();
171 
172  if( item == m_rbOutlinePolygonBestQ )
173  m_rbOutlinePolygonFastest->SetValue( not m_rbOutlinePolygonBestQ->GetValue() );
174  else
175  m_rbOutlinePolygonBestQ->SetValue( not m_rbOutlinePolygonFastest->GetValue() );
176 }
const BITMAP_OPAQUE via_annulus_xpm[1]
Definition: via_annulus.cpp:92
void SetCopperEdgeClearance(int aDistance)
Function SetCopperEdgeClearance.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:551
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:80
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, bool aUseMils=false)
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]
BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:180
bool m_ZoneUseNoOutlineInFill
Option to handle filled polygons in zones: the "legacy" option is using thick outlines around filled ...
#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.
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
BOARD_DESIGN_SETTINGS contains design settings for a BOARD object.