KiCad PCB EDA Suite
Loading...
Searching...
No Matches
dialog_tuning_pattern_properties.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 modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation, either version 3 of the License, or (at your
9 * option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
21#include <bitmaps.h>
22#include <pcb_base_edit_frame.h>
24#include <drc/drc_engine.h>
25
26
29
30
32 PNS::MEANDER_SETTINGS& aSettings,
33 PNS::ROUTER_MODE aMeanderType,
34 const DRC_CONSTRAINT& aConstraint ) :
36 m_constraint( aConstraint ),
37 m_targetLength( aFrame, m_targetLengthLabel, m_targetLengthCtrl, m_targetLengthUnits ),
38 m_minA( aFrame, m_track_minALabel, m_minACtrl, m_minAUnits ),
39 m_maxA( aFrame, m_maxALabel, m_maxACtrl, m_maxAUnits ),
40 m_spacing( aFrame, m_spacingLabel, m_spacingCtrl, m_spacingUnits ),
41 m_r( aFrame, m_rLabel, m_rCtrl, m_rUnits ),
42 m_settings( aSettings ),
43 m_mode( aMeanderType )
44{
45 m_r.SetUnits( EDA_UNITS::PERCENT );
46
47 switch( m_mode )
48 {
50 m_legend->SetBitmap( KiBitmapBundle( BITMAPS::tune_single_track_length_legend ) );
51 break;
52
54 m_legend->SetBitmap( KiBitmapBundle( BITMAPS::tune_diff_pair_length_legend ) );
55 break;
56
58 m_legend->SetBitmap( KiBitmapBundle( BITMAPS::tune_diff_pair_skew_legend ) );
59 m_targetLengthLabel->SetLabel( _( "Target skew: ") );
60 break;
61
62 default:
63 break;
64 }
65
66 // Bitmap has a new size, so recalculate sizes
67 GetSizer()->SetSizeHints( this );
69
71
72 GetSizer()->SetSizeHints( this );
73 Centre();
74}
75
76
78{
80 {
82
85
87 m_targetLengthCtrl->SetValue( wxEmptyString );
88 }
89 else
90 {
92
95
97 m_targetLength.SetValue( wxEmptyString );
98 }
99
101
103
104 if( !m_constraint.IsNull() )
105 m_sourceInfo->SetLabel( wxString::Format( _( "(from %s)" ), m_constraint.GetName() ) );
106
108
115
116 return true;
117}
118
119
121{
123 {
124 if( m_targetLengthCtrl->GetValue().IsEmpty() )
126 else
128
131 else
133 }
134 else
135 {
136 if( m_targetLengthCtrl->GetValue().IsEmpty() )
138 else
140
143 else
145 }
146
148
156
157 return true;
158}
159
160
162{
163 m_targetLength.Enable( event.IsChecked() || m_constraint.IsNull() );
164
165 if( !event.IsChecked() && !m_constraint.IsNull() )
166 {
168 m_sourceInfo->Show( true );
169 }
170 else
171 {
172 m_sourceInfo->Show( false );
173 }
174}
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap)
Definition: bitmap.cpp:110
void SetInitialFocus(wxWindow *aWindow)
Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown.
Definition: dialog_shim.h:102
void SetupStandardButtons(std::map< int, wxString > aLabels={})
Class DIALOG_TUNING_PATTERN_PROPERTIES_BASE.
DIALOG_TUNING_PATTERN_PROPERTIES(PCB_BASE_EDIT_FRAME *aParent, PNS::MEANDER_SETTINGS &aSettings, PNS::ROUTER_MODE aMeanderType, const DRC_CONSTRAINT &aConstraint)
void onOverrideCustomRules(wxCommandEvent &event) override
wxString GetName() const
Definition: drc_rule.h:159
const MINOPTMAX< int > & GetValue() const
Definition: drc_rule.h:151
bool IsNull() const
Definition: drc_rule.h:146
T Opt() const
Definition: minoptmax.h:35
Common, abstract interface for edit frames.
Dimensions for the meandering algorithm.
Definition: pns_meander.h:68
int m_minAmplitude
Maximum meandering amplitude.
Definition: pns_meander.h:83
void SetTargetLength(long long int aOpt)
Definition: pns_meander.cpp:55
static const long long int LENGTH_UNCONSTRAINED
Definition: pns_meander.h:71
int m_cornerRadiusPercentage
Place meanders on one side.
Definition: pns_meander.h:109
bool m_singleSided
Initial side when placing meanders at segment.
Definition: pns_meander.h:112
static const int SKEW_UNCONSTRAINED
Definition: pns_meander.h:72
MINOPTMAX< long long int > m_targetLength
Target skew value for diff pair de-skewing.
Definition: pns_meander.h:98
void SetTargetSkew(int aOpt)
Definition: pns_meander.cpp:84
MINOPTMAX< int > m_targetSkew
Definition: pns_meander.h:101
MEANDER_STYLE m_cornerStyle
Rounding percentage (0 - 100).
Definition: pns_meander.h:106
int m_maxAmplitude
Meandering period/spacing (see dialog picture for explanation).
Definition: pns_meander.h:86
bool m_overrideCustomRules
Type of corners for the meandered line.
Definition: pns_meander.h:103
int m_spacing
Amplitude/spacing adjustment step.
Definition: pns_meander.h:89
int GetIntValue()
Definition: unit_binder.h:129
virtual long long int GetValue()
Return the current value in Internal Units.
void Enable(bool aEnable)
Enable/disable the label, widget and units label.
virtual void SetUnits(EDA_UNITS aUnits)
Normally not needed (as the UNIT_BINDER inherits from the parent frame), but can be used to set to DE...
virtual void SetValue(long long int aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion.
long long int g_lastTargetLength
#define _(s)
@ MEANDER_STYLE_ROUND
Definition: pns_meander.h:52
@ MEANDER_STYLE_CHAMFER
Definition: pns_meander.h:53
ROUTER_MODE
Definition: pns_router.h:62
@ PNS_MODE_TUNE_DIFF_PAIR
Definition: pns_router.h:66
@ PNS_MODE_TUNE_SINGLE
Definition: pns_router.h:65
@ PNS_MODE_TUNE_DIFF_PAIR_SKEW
Definition: pns_router.h:67