KiCad PCB EDA Suite
Loading...
Searching...
No Matches
drc_re_vias_under_smd_overlay_panel.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) 2026 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
#include "
drc_re_vias_under_smd_overlay_panel.h
"
21
#include "
drc_re_vias_under_smd_constraint_data.h
"
22
#include "
drc_rule_editor_utils.h
"
23
24
#include <wx/checkbox.h>
25
26
27
DRC_RE_VIAS_UNDER_SMD_OVERLAY_PANEL::DRC_RE_VIAS_UNDER_SMD_OVERLAY_PANEL
(
28
wxWindow* aParent,
DRC_RE_VIAS_UNDER_SMD_CONSTRAINT_DATA
* aData ) :
29
DRC_RE_BITMAP_OVERLAY_PANEL
( aParent ),
30
m_data
( aData ),
31
m_throughViasCheckbox
( nullptr ),
32
m_microViasCheckbox
( nullptr ),
33
m_blindViasCheckbox
( nullptr ),
34
m_buriedViasCheckbox
( nullptr )
35
{
36
SetBackgroundBitmap
(
m_data
->GetOverlayBitmap() );
37
38
std::vector<DRC_RE_FIELD_POSITION> positions =
m_data
->GetFieldPositions();
39
40
DRC_RE_OVERLAY_FIELD
* field;
41
42
field =
AddCheckbox
( wxS(
"through_vias"
), positions[0] );
43
m_throughViasCheckbox
=
static_cast<
wxCheckBox*
>
( field->
GetControl
() );
44
45
field =
AddCheckbox
( wxS(
"micro_vias"
), positions[1] );
46
m_microViasCheckbox
=
static_cast<
wxCheckBox*
>
( field->
GetControl
() );
47
48
field =
AddCheckbox
( wxS(
"blind_vias"
), positions[2] );
49
m_blindViasCheckbox
=
static_cast<
wxCheckBox*
>
( field->
GetControl
() );
50
51
field =
AddCheckbox
( wxS(
"buried_vias"
), positions[3] );
52
m_buriedViasCheckbox
=
static_cast<
wxCheckBox*
>
( field->
GetControl
() );
53
54
TransferDataToWindow
();
55
PositionFields
();
56
}
57
58
59
bool
DRC_RE_VIAS_UNDER_SMD_OVERLAY_PANEL::TransferDataToWindow
()
60
{
61
if
( !
m_data
|| !
m_throughViasCheckbox
|| !
m_microViasCheckbox
|| !
m_blindViasCheckbox
|| !
m_buriedViasCheckbox
)
62
{
63
return
false
;
64
}
65
66
m_throughViasCheckbox
->SetValue(
m_data
->GetDisallowThroughVias() );
67
m_microViasCheckbox
->SetValue(
m_data
->GetDisallowMicroVias() );
68
m_blindViasCheckbox
->SetValue(
m_data
->GetDisallowBlindVias() );
69
m_buriedViasCheckbox
->SetValue(
m_data
->GetDisallowBuriedVias() );
70
71
return
true
;
72
}
73
74
75
bool
DRC_RE_VIAS_UNDER_SMD_OVERLAY_PANEL::TransferDataFromWindow
()
76
{
77
if
( !
m_data
|| !
m_throughViasCheckbox
|| !
m_microViasCheckbox
|| !
m_blindViasCheckbox
|| !
m_buriedViasCheckbox
)
78
{
79
return
false
;
80
}
81
82
m_data
->SetDisallowThroughVias(
m_throughViasCheckbox
->GetValue() );
83
m_data
->SetDisallowMicroVias(
m_microViasCheckbox
->GetValue() );
84
m_data
->SetDisallowBlindVias(
m_blindViasCheckbox
->GetValue() );
85
m_data
->SetDisallowBuriedVias(
m_buriedViasCheckbox
->GetValue() );
86
87
return
true
;
88
}
89
90
91
bool
DRC_RE_VIAS_UNDER_SMD_OVERLAY_PANEL::ValidateInputs
(
int
* aErrorCount, wxString* aValidationMessage )
92
{
93
TransferDataFromWindow
();
94
95
VALIDATION_RESULT
result
=
m_data
->Validate();
96
97
if
( !
result
.isValid )
98
{
99
*aErrorCount =
result
.errors.size();
100
101
for
(
size_t
i = 0; i <
result
.errors.size(); i++ )
102
*aValidationMessage +=
DRC_RULE_EDITOR_UTILS::FormatErrorMessage
( i + 1,
result
.errors[i] );
103
104
return
false
;
105
}
106
107
return
true
;
108
}
109
110
111
wxString
DRC_RE_VIAS_UNDER_SMD_OVERLAY_PANEL::GenerateRule
(
const
RULE_GENERATION_CONTEXT
& aContext )
112
{
113
if
( !
m_data
)
114
return
wxEmptyString;
115
116
return
m_data
->GenerateRule( aContext );
117
}
DRC_RE_BITMAP_OVERLAY_PANEL::AddCheckbox
DRC_RE_OVERLAY_FIELD * AddCheckbox(const wxString &aId, const DRC_RE_FIELD_POSITION &aPosition)
Create and position a checkbox control on the bitmap overlay.
Definition
drc_re_bitmap_overlay_panel.cpp:365
DRC_RE_BITMAP_OVERLAY_PANEL::SetBackgroundBitmap
void SetBackgroundBitmap(BITMAPS aBitmap)
Set the background bitmap for this panel.
Definition
drc_re_bitmap_overlay_panel.cpp:152
DRC_RE_BITMAP_OVERLAY_PANEL::DRC_RE_BITMAP_OVERLAY_PANEL
DRC_RE_BITMAP_OVERLAY_PANEL(wxWindow *aParent, wxWindowID aId=wxID_ANY)
Definition
drc_re_bitmap_overlay_panel.cpp:41
DRC_RE_BITMAP_OVERLAY_PANEL::PositionFields
void PositionFields()
Position all fields based on the current scale factor.
Definition
drc_re_bitmap_overlay_panel.cpp:162
DRC_RE_OVERLAY_FIELD
Wraps a wxControl positioned over a bitmap overlay panel.
Definition
drc_re_overlay_field.h:43
DRC_RE_OVERLAY_FIELD::GetControl
wxControl * GetControl() const
Definition
drc_re_overlay_field.h:64
DRC_RE_VIAS_UNDER_SMD_CONSTRAINT_DATA
Definition
drc_re_vias_under_smd_constraint_data.h:28
DRC_RE_VIAS_UNDER_SMD_OVERLAY_PANEL::TransferDataToWindow
bool TransferDataToWindow() override
Definition
drc_re_vias_under_smd_overlay_panel.cpp:59
DRC_RE_VIAS_UNDER_SMD_OVERLAY_PANEL::DRC_RE_VIAS_UNDER_SMD_OVERLAY_PANEL
DRC_RE_VIAS_UNDER_SMD_OVERLAY_PANEL(wxWindow *aParent, DRC_RE_VIAS_UNDER_SMD_CONSTRAINT_DATA *aData)
Definition
drc_re_vias_under_smd_overlay_panel.cpp:27
DRC_RE_VIAS_UNDER_SMD_OVERLAY_PANEL::m_throughViasCheckbox
wxCheckBox * m_throughViasCheckbox
Definition
drc_re_vias_under_smd_overlay_panel.h:45
DRC_RE_VIAS_UNDER_SMD_OVERLAY_PANEL::m_blindViasCheckbox
wxCheckBox * m_blindViasCheckbox
Definition
drc_re_vias_under_smd_overlay_panel.h:47
DRC_RE_VIAS_UNDER_SMD_OVERLAY_PANEL::TransferDataFromWindow
bool TransferDataFromWindow() override
Definition
drc_re_vias_under_smd_overlay_panel.cpp:75
DRC_RE_VIAS_UNDER_SMD_OVERLAY_PANEL::m_buriedViasCheckbox
wxCheckBox * m_buriedViasCheckbox
Definition
drc_re_vias_under_smd_overlay_panel.h:48
DRC_RE_VIAS_UNDER_SMD_OVERLAY_PANEL::m_microViasCheckbox
wxCheckBox * m_microViasCheckbox
Definition
drc_re_vias_under_smd_overlay_panel.h:46
DRC_RE_VIAS_UNDER_SMD_OVERLAY_PANEL::GenerateRule
wxString GenerateRule(const RULE_GENERATION_CONTEXT &aContext) override
Definition
drc_re_vias_under_smd_overlay_panel.cpp:111
DRC_RE_VIAS_UNDER_SMD_OVERLAY_PANEL::ValidateInputs
bool ValidateInputs(int *aErrorCount, wxString *aValidationMessage) override
Definition
drc_re_vias_under_smd_overlay_panel.cpp:91
DRC_RE_VIAS_UNDER_SMD_OVERLAY_PANEL::m_data
DRC_RE_VIAS_UNDER_SMD_CONSTRAINT_DATA * m_data
Definition
drc_re_vias_under_smd_overlay_panel.h:43
DRC_RULE_EDITOR_UTILS::FormatErrorMessage
static wxString FormatErrorMessage(int aErrorCount, const wxString &aErrorMessage)
Definition
drc_rule_editor_utils.cpp:540
drc_re_vias_under_smd_constraint_data.h
drc_re_vias_under_smd_overlay_panel.h
drc_rule_editor_utils.h
RULE_GENERATION_CONTEXT
Definition
drc_rule_editor_enums.h:54
VALIDATION_RESULT
Result of a validation operation.
Definition
drc_rule_editor_enums.h:32
result
wxString result
Test unit parsing edge cases and error handling.
Definition
test_text_eval_numeric_compat.cpp:602
src
pcbnew
drc
rule_editor
drc_re_vias_under_smd_overlay_panel.cpp
Generated on Tue Nov 17 2026 00:06:21 for KiCad PCB EDA Suite by
1.13.2