KiCad PCB EDA Suite
Loading...
Searching...
No Matches
panel_setup_teardrops.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 The 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 <pcb_edit_frame.h>
21#include <pcb_painter.h>
22#include <board.h>
25
26
41
42
44{
45 TEARDROP_PARAMETERS_LIST* prmsList = m_BrdSettings->GetTeadropParamsList();
46
48 m_teardropMaxLenRound.SetValue( prms->m_TdMaxLen );
49 m_teardropMaxWidthRound.SetValue( prms->m_TdMaxWidth );
50 m_spLenPercent->SetValue( prms->m_BestLengthRatio *100.0 );
51 m_spWidthPercent->SetValue( prms->m_BestWidthRatio *100.0 );
52 m_spTeardropHDPercent->SetValue( prms->m_WidthtoSizeFilterRatio*100.0 );
55 m_cbCurvedEdges->SetValue( prms->m_CurvedEdges );
56
57 prms = prmsList->GetParameters( TARGET_RECT );
58 m_teardropMaxLenRect.SetValue( prms->m_TdMaxLen );
59 m_teardropMaxWidthRect.SetValue( prms->m_TdMaxWidth );
60 m_spLenPercent1->SetValue( prms->m_BestLengthRatio *100.0 );
61 m_spWidthPercent1->SetValue( prms->m_BestWidthRatio *100.0 );
62 m_spTeardropHDPercent1->SetValue( prms->m_WidthtoSizeFilterRatio*100.0 );
65 m_cbCurvedEdges1->SetValue( prms->m_CurvedEdges );
66
67 prms = prmsList->GetParameters( TARGET_TRACK );
68 m_teardropMaxLenT2T.SetValue( prms->m_TdMaxLen );
69 m_teardropMaxWidthT2T.SetValue( prms->m_TdMaxWidth );
70 m_spLenPercent2->SetValue( prms->m_BestLengthRatio *100.0 );
71 m_spWidthPercent2->SetValue( prms->m_BestWidthRatio *100.0 );
72 m_spTeardropHDPercent2->SetValue( prms->m_WidthtoSizeFilterRatio*100.0 );
74 m_cbCurvedEdges2->SetValue( prms->m_CurvedEdges );
75
76 return true;
77}
78
79
81{
82 TEARDROP_PARAMETERS_LIST* prmsList = m_BrdSettings->GetTeadropParamsList();
83
85 prms->m_BestLengthRatio = m_spLenPercent->GetValue() / 100.0;
86 prms->m_BestWidthRatio = m_spWidthPercent->GetValue() / 100.0;
87 prms->m_TdMaxLen = m_teardropMaxLenRound.GetIntValue();
88 prms->m_TdMaxWidth = m_teardropMaxWidthRound.GetIntValue();
89 prms->m_CurvedEdges = m_cbCurvedEdges->GetValue();
90 prms->m_WidthtoSizeFilterRatio = m_spTeardropHDPercent->GetValue() / 100.0;
93
94 prms = prmsList->GetParameters( TARGET_RECT );
95 prms->m_BestLengthRatio = m_spLenPercent1->GetValue() / 100.0;
96 prms->m_BestWidthRatio = m_spWidthPercent1->GetValue() / 100.0;
97 prms->m_TdMaxLen = m_teardropMaxLenRect.GetIntValue();
98 prms->m_TdMaxWidth = m_teardropMaxWidthRect.GetIntValue();
99 prms->m_CurvedEdges = m_cbCurvedEdges1->GetValue();
100 prms->m_WidthtoSizeFilterRatio = m_spTeardropHDPercent1->GetValue() / 100.0;
101 prms->m_TdOnPadsInZones = !m_cbPreferZoneConnection1->GetValue();
103
104 prms = prmsList->GetParameters( TARGET_TRACK );
105 prms->m_BestLengthRatio = m_spLenPercent2->GetValue() / 100.0;
106 prms->m_BestWidthRatio = m_spWidthPercent2->GetValue() / 100.0;
107 prms->m_TdMaxLen = m_teardropMaxLenT2T.GetIntValue();
108 prms->m_TdMaxWidth = m_teardropMaxWidthT2T.GetIntValue();
109 prms->m_CurvedEdges = m_cbCurvedEdges2->GetValue();
110 prms->m_WidthtoSizeFilterRatio = m_spTeardropHDPercent2->GetValue() / 100.0;
112
113 return true;
114}
115
116
118{
119 BOARD_DESIGN_SETTINGS* savedSettings = m_BrdSettings;
120
121 m_BrdSettings = &aBoard->GetDesignSettings();
123
124 m_BrdSettings = savedSettings;
125}
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap, int aMinHeight)
Definition bitmap.cpp:106
@ teardrop_track_sizes
@ teardrop_rect_sizes
Container for design settings for a BOARD object.
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:372
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition board.cpp:1149
PANEL_SETUP_TEARDROPS_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxTAB_TRAVERSAL, const wxString &name=wxEmptyString)
BOARD_DESIGN_SETTINGS * m_BrdSettings
void ImportSettingsFrom(BOARD *aBoard)
PANEL_SETUP_TEARDROPS(wxWindow *aParentWindow, PCB_EDIT_FRAME *aFrame)
bool TransferDataFromWindow() override
The main frame for Pcbnew.
TEARDROP_PARAMETERS_LIST is a helper class to handle the list of TEARDROP_PARAMETERS needed to build ...
TEARDROP_PARAMETERS * GetParameters(TARGET_TD aTdType)
TEARDROP_PARAMETARS is a helper class to handle parameters needed to build teardrops for a board thes...
double m_BestWidthRatio
The height of a teardrop as ratio between height and size of pad/via.
int m_TdMaxLen
max allowed length for teardrops in IU. <= 0 to disable
bool m_AllowUseTwoTracks
True to create teardrops using 2 track segments if the first in too small.
int m_TdMaxWidth
max allowed height for teardrops in IU. <= 0 to disable
double m_BestLengthRatio
The length of a teardrop as ratio between length and size of pad/via.
double m_WidthtoSizeFilterRatio
The ratio (H/D) between the via/pad size and the track width max value to create a teardrop 1....
bool m_TdOnPadsInZones
A filter to exclude pads inside zone fills.
bool m_CurvedEdges
True if the teardrop should be curved.
@ TARGET_ROUND
@ TARGET_RECT
@ TARGET_TRACK