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 (C) 2023 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
32 PANEL_SETUP_TEARDROPS_BASE( aParentWindow ),
33 m_BrdSettings( &aFrame->GetBoard()->GetDesignSettings() ),
34 m_teardropMaxLenRound( aFrame, m_stMaxLen, m_tcTdMaxLen, m_stMaxLenUnits ),
35 m_teardropMaxWidthRound( aFrame, m_stMaxWidthLabel, m_tcMaxWidth, m_stMaxWidthUnits ),
36 m_teardropMaxLenRect( aFrame, m_stMaxLen1, m_tcTdMaxLen1, m_stMaxLen1Units ),
37 m_teardropMaxWidthRect( aFrame, m_stMaxWidth2Label, m_tcMaxWidth1, m_stMaxWidth1Units ),
38 m_teardropMaxLenT2T( aFrame, m_stMaxLen2, m_tcTdMaxLen2, m_stMaxLen2Units ),
39 m_teardropMaxWidthT2T( aFrame, m_stMaxWidth2Label, m_tcMaxWidth2, m_stMaxWidth2Units )
40{
41 m_bitmapTeardrop->SetBitmap( KiBitmapBundle( BITMAPS::teardrop_sizes ) );
42 m_bitmapTeardrop1->SetBitmap( KiBitmapBundle( BITMAPS::teardrop_rect_sizes ) );
43 m_bitmapTeardrop2->SetBitmap( KiBitmapBundle( BITMAPS::teardrop_track_sizes ) );
44
45 wxFont infoFont = KIUI::GetInfoFont( this ).Italic();
46}
47
48
50{
52
56 m_spLenPercent->SetValue( prms->m_BestLengthRatio *100.0 );
57 m_spWidthPercent->SetValue( prms->m_BestWidthRatio *100.0 );
58 m_spTeardropHDPercent->SetValue( prms->m_WidthtoSizeFilterRatio*100.0 );
61
62 if( prms->IsCurved() )
63 m_rbCurved->SetValue( true );
64 else
65 m_rbStraightLines->SetValue( true );
66
67 prms = prmsList->GetParameters( TARGET_RECT );
70 m_spLenPercent1->SetValue( prms->m_BestLengthRatio *100.0 );
71 m_spWidthPercent1->SetValue( prms->m_BestWidthRatio *100.0 );
72 m_spTeardropHDPercent1->SetValue( prms->m_WidthtoSizeFilterRatio*100.0 );
75
76 if( prms->IsCurved() )
77 m_rbCurved1->SetValue( true );
78 else
79 m_rbStraightLines1->SetValue( true );
80
81 prms = prmsList->GetParameters( TARGET_TRACK );
84 m_spLenPercent2->SetValue( prms->m_BestLengthRatio *100.0 );
85 m_spWidthPercent2->SetValue( prms->m_BestWidthRatio *100.0 );
86 m_spTeardropHDPercent2->SetValue( prms->m_WidthtoSizeFilterRatio*100.0 );
88
89 if( prms->IsCurved() )
90 m_rbCurved2->SetValue( true );
91 else
92 m_rbStraightLines2->SetValue( true );
93
94 return true;
95}
96
97
99{
101
103 prms->m_BestLengthRatio = m_spLenPercent->GetValue() / 100.0;
104 prms->m_BestWidthRatio = m_spWidthPercent->GetValue() / 100.0;
107 prms->m_CurveSegCount = m_rbStraightLines->GetValue() ? 0 : 1;
108 prms->m_WidthtoSizeFilterRatio = m_spTeardropHDPercent->GetValue() / 100.0;
109 prms->m_TdOnPadsInZones = !m_cbPreferZoneConnection->GetValue();
111
112 prms = prmsList->GetParameters( TARGET_RECT );
113 prms->m_BestLengthRatio = m_spLenPercent1->GetValue() / 100.0;
114 prms->m_BestWidthRatio = m_spWidthPercent1->GetValue() / 100.0;
117 prms->m_CurveSegCount = m_rbStraightLines1->GetValue() ? 0 : 1;
118 prms->m_WidthtoSizeFilterRatio = m_spTeardropHDPercent1->GetValue() / 100.0;
119 prms->m_TdOnPadsInZones = !m_cbPreferZoneConnection1->GetValue();
121
122 prms = prmsList->GetParameters( TARGET_TRACK );
123 prms->m_BestLengthRatio = m_spLenPercent2->GetValue() / 100.0;
124 prms->m_BestWidthRatio = m_spWidthPercent2->GetValue() / 100.0;
127 prms->m_CurveSegCount = m_rbStraightLines2->GetValue() ? 0 : 1;
128 prms->m_WidthtoSizeFilterRatio = m_spTeardropHDPercent2->GetValue() / 100.0;
130
131 return true;
132}
133
134
136{
137 BOARD_DESIGN_SETTINGS* savedSettings = m_BrdSettings;
138
139 m_BrdSettings = &aBoard->GetDesignSettings();
141
142 m_BrdSettings = savedSettings;
143}
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap)
Definition: bitmap.cpp:110
Container for design settings for a BOARD object.
TEARDROP_PARAMETERS_LIST * GetTeadropParamsList()
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:290
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:895
Class PANEL_SETUP_TEARDROPS_BASE.
BOARD_DESIGN_SETTINGS * m_BrdSettings
void ImportSettingsFrom(BOARD *aBoard)
PANEL_SETUP_TEARDROPS(wxWindow *aParentWindow, PCB_EDIT_FRAME *aFrame)
bool TransferDataFromWindow() override
bool TransferDataToWindow() 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...
int m_CurveSegCount
True if the teardrop should be curved.
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.
int GetIntValue()
Definition: unit_binder.h:129
virtual void SetValue(long long int aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion.
KICOMMON_API wxFont GetInfoFont(wxWindow *aWindow)
Definition: ui_common.cpp:154
BOARD * GetBoard()
@ TARGET_ROUND
@ TARGET_RECT
@ TARGET_TRACK