KiCad PCB EDA Suite
Loading...
Searching...
No Matches
panel_board_class.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) 2011 jean-pierre.charras
5 * Copyright (C) 1992-2023 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 3
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 along
18 * with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
24#include <units_scales.h>
25
26PANEL_BOARD_CLASS::PANEL_BOARD_CLASS( wxWindow* parent, wxWindowID id, const wxPoint& pos,
27 const wxSize& size, long style, const wxString& name ) :
28 PANEL_BOARD_CLASS_BASE( parent, id, pos, size, style, name )
29{
30 // Autosize the row label column to be sure label are not truncated
31 m_gridClassesValuesDisplay->SetRowLabelSize( wxGRID_AUTOSIZE );
32
33 // Needed on wxWidgets 3.0 to ensure sizers are correctly set
34 GetSizer()->SetSizeHints( this );
35}
36
37
39{
40}
41
42
44{
45 // TODO: Only the grid needs updating, but it isn't done automatically (https://trac.wxwidgets.org/ticket/19279)
46}
47
48
50{
51 aCfg->m_BoardClassUnits = m_BoardClassesUnitsSelector->GetSelection();
52}
53
54
56{
59}
60
61
62// A helper class to handle min values
63// Values are in meters.
64// Note : use -1.0 when a value is irrelevant in a class
66{
67public:
68 int m_Class; // Class Id
69 double m_Lines; // min copper lines width
70 double m_Clearance; // min dist between copper lines
71 double m_ViaDiamDiff; // Min value for diff between Via diameter
72 // and its hole diameter
73 double m_PadDiamDiffPlated; // Min value for diff between Pad diameter
74 // and its hole diameter (plated)
75 double m_PadDiamDiffNotPlated; // Min value for diff between Pad diameter
76 // and its hole diameter (not plated)
77public:
78 BOARD_MIN_SIZE_VALUES( int aClass, double aLines, double aClearance, double aViaDiffPlated,
79 double aPadDiffPlated , double aPadDiffNotPlated ) :
80 m_Class( aClass ),
81 m_Lines( aLines ),
82 m_Clearance( aClearance ),
83 m_ViaDiamDiff( aViaDiffPlated ),
84 m_PadDiamDiffPlated( aPadDiffPlated ),
85 m_PadDiamDiffNotPlated( aPadDiffNotPlated )
86 {
87 }
88};
89
90#define BRDCLASS_COUNT 6
92{
93 // class 1
95 -1.0,
96 1.19*UNIT_MM, 1.57*UNIT_MM ),
97 // class 2
99 -1.0,
100 0.78*UNIT_MM, 1.13*UNIT_MM ),
101 // class 3
103 0.45*UNIT_MM,
104 0.6*UNIT_MM, 0.90*UNIT_MM ),
105 // class 4
107 0.34*UNIT_MM,
108 0.49*UNIT_MM, -1.0 ),
109 // class 5
111 0.24*UNIT_MM,
112 0.39*UNIT_MM, -1.0 ),
113 // class 6
115 0.20*UNIT_MM,
116 0.35*UNIT_MM, -1.0 )
117};
118
119
121{
123}
124
125
127{
128 wxString txt;
129 #define FMT wxT("%g")
130 #define NO_VALUE wxT("--")
131
132 for( int ii = 0; ii < BRDCLASS_COUNT; ii ++ )
133 {
134 // Display min tracks width
135 if( clist[ii].m_Lines > -1.0 )
136 txt.Printf( FMT, clist[ii].m_Lines / aUnitScale);
137 else
138 txt = NO_VALUE;
139 m_gridClassesValuesDisplay->SetCellValue(0, ii, txt );
140
141 // Display min clearance
142 if( clist[ii].m_Clearance > -1.0 )
143 txt.Printf( FMT, clist[ii].m_Clearance / aUnitScale);
144 else
145 txt = NO_VALUE;
146
147 m_gridClassesValuesDisplay->SetCellValue(1, ii, txt );
148
149 // Display min Via diam diff
150 if( clist[ii].m_ViaDiamDiff > -1.0 )
151 txt.Printf( FMT, clist[ii].m_ViaDiamDiff / aUnitScale);
152 else
153 txt = NO_VALUE;
154
155 m_gridClassesValuesDisplay->SetCellValue(2, ii, txt );
156
157 // Display min Pad diam diff (plated)
158 if( clist[ii].m_PadDiamDiffPlated > -1.0 )
159 txt.Printf( FMT, clist[ii].m_PadDiamDiffPlated / aUnitScale);
160 else
161 txt = NO_VALUE;
162
163 m_gridClassesValuesDisplay->SetCellValue(3, ii, txt );
164
165 // Display min Pad diam diff (non plated)
166 if( clist[ii].m_PadDiamDiffNotPlated > -1.0 )
167 txt.Printf( FMT, clist[ii].m_PadDiamDiffNotPlated / aUnitScale);
168 else
169 txt = NO_VALUE;
170
171 m_gridClassesValuesDisplay->SetCellValue(4, ii, txt );
172 }
173}
const char * name
Definition: DXF_plotter.cpp:57
BOARD_MIN_SIZE_VALUES(int aClass, double aLines, double aClearance, double aViaDiffPlated, double aPadDiffPlated, double aPadDiffNotPlated)
Class PANEL_BOARD_CLASS_BASE.
UNIT_SELECTOR_LEN * m_BoardClassesUnitsSelector
PANEL_BOARD_CLASS(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL, const wxString &name=wxEmptyString)
void OnBoardClassesUnitsSelection(wxCommandEvent &event) override
void BoardClassesUpdateData(double aUnitScale)
void SaveSettings(PCB_CALCULATOR_SETTINGS *aCfg) override
Save the settings from the panel.
void ThemeChanged() override
Update UI elements of the panel when the theme changes to ensure the images and fonts/colors are appr...
void LoadSettings(PCB_CALCULATOR_SETTINGS *aCfg) override
Load the settings into the panel.
double GetUnitScale() override
Function GetUnitScale.
#define NO_VALUE
#define BRDCLASS_COUNT
#define FMT
static BOARD_MIN_SIZE_VALUES clist[BRDCLASS_COUNT]
#define UNIT_MM
Definition: units_scales.h:34