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, 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 <pcb_edit_frame.h>
25#include <pcb_painter.h>
26#include <board.h>
29
30
45
46
48{
49 TEARDROP_PARAMETERS_LIST* prmsList = m_BrdSettings->GetTeadropParamsList();
50
52 m_teardropMaxLenRound.SetValue( prms->m_TdMaxLen );
53 m_teardropMaxWidthRound.SetValue( prms->m_TdMaxWidth );
54 m_spLenPercent->SetValue( prms->m_BestLengthRatio *100.0 );
55 m_spWidthPercent->SetValue( prms->m_BestWidthRatio *100.0 );
56 m_spTeardropHDPercent->SetValue( prms->m_WidthtoSizeFilterRatio*100.0 );
59 m_cbCurvedEdges->SetValue( prms->m_CurvedEdges );
60
61 prms = prmsList->GetParameters( TARGET_RECT );
62 m_teardropMaxLenRect.SetValue( prms->m_TdMaxLen );
63 m_teardropMaxWidthRect.SetValue( prms->m_TdMaxWidth );
64 m_spLenPercent1->SetValue( prms->m_BestLengthRatio *100.0 );
65 m_spWidthPercent1->SetValue( prms->m_BestWidthRatio *100.0 );
66 m_spTeardropHDPercent1->SetValue( prms->m_WidthtoSizeFilterRatio*100.0 );
69 m_cbCurvedEdges1->SetValue( prms->m_CurvedEdges );
70
71 prms = prmsList->GetParameters( TARGET_TRACK );
72 m_teardropMaxLenT2T.SetValue( prms->m_TdMaxLen );
73 m_teardropMaxWidthT2T.SetValue( prms->m_TdMaxWidth );
74 m_spLenPercent2->SetValue( prms->m_BestLengthRatio *100.0 );
75 m_spWidthPercent2->SetValue( prms->m_BestWidthRatio *100.0 );
76 m_spTeardropHDPercent2->SetValue( prms->m_WidthtoSizeFilterRatio*100.0 );
78 m_cbCurvedEdges2->SetValue( prms->m_CurvedEdges );
79
80 return true;
81}
82
83
85{
86 TEARDROP_PARAMETERS_LIST* prmsList = m_BrdSettings->GetTeadropParamsList();
87
89 prms->m_BestLengthRatio = m_spLenPercent->GetValue() / 100.0;
90 prms->m_BestWidthRatio = m_spWidthPercent->GetValue() / 100.0;
91 prms->m_TdMaxLen = m_teardropMaxLenRound.GetIntValue();
92 prms->m_TdMaxWidth = m_teardropMaxWidthRound.GetIntValue();
93 prms->m_CurvedEdges = m_cbCurvedEdges->GetValue();
94 prms->m_WidthtoSizeFilterRatio = m_spTeardropHDPercent->GetValue() / 100.0;
97
98 prms = prmsList->GetParameters( TARGET_RECT );
99 prms->m_BestLengthRatio = m_spLenPercent1->GetValue() / 100.0;
100 prms->m_BestWidthRatio = m_spWidthPercent1->GetValue() / 100.0;
101 prms->m_TdMaxLen = m_teardropMaxLenRect.GetIntValue();
102 prms->m_TdMaxWidth = m_teardropMaxWidthRect.GetIntValue();
103 prms->m_CurvedEdges = m_cbCurvedEdges1->GetValue();
104 prms->m_WidthtoSizeFilterRatio = m_spTeardropHDPercent1->GetValue() / 100.0;
105 prms->m_TdOnPadsInZones = !m_cbPreferZoneConnection1->GetValue();
107
108 prms = prmsList->GetParameters( TARGET_TRACK );
109 prms->m_BestLengthRatio = m_spLenPercent2->GetValue() / 100.0;
110 prms->m_BestWidthRatio = m_spWidthPercent2->GetValue() / 100.0;
111 prms->m_TdMaxLen = m_teardropMaxLenT2T.GetIntValue();
112 prms->m_TdMaxWidth = m_teardropMaxWidthT2T.GetIntValue();
113 prms->m_CurvedEdges = m_cbCurvedEdges2->GetValue();
114 prms->m_WidthtoSizeFilterRatio = m_spTeardropHDPercent2->GetValue() / 100.0;
116
117 return true;
118}
119
120
122{
123 BOARD_DESIGN_SETTINGS* savedSettings = m_BrdSettings;
124
125 m_BrdSettings = &aBoard->GetDesignSettings();
127
128 m_BrdSettings = savedSettings;
129}
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap, int aMinHeight)
Definition bitmap.cpp:110
@ 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:317
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition board.cpp:1040
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.
BOARD * GetBoard()
@ TARGET_ROUND
@ TARGET_RECT
@ TARGET_TRACK