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
28 PNS::MEANDER_SETTINGS& aSettings,
29 PNS::ROUTER_MODE aMeanderType,
30 const DRC_CONSTRAINT& aConstraint ) :
32 m_constraint( aConstraint ),
33 m_targetLength( aFrame, m_targetLengthLabel, m_targetLengthCtrl, m_targetLengthUnits ),
34 m_minA( aFrame, m_track_minALabel, m_minACtrl, m_minAUnits ),
35 m_maxA( aFrame, m_maxALabel, m_maxACtrl, m_maxAUnits ),
36 m_spacing( aFrame, m_spacingLabel, m_spacingCtrl, m_spacingUnits ),
37 m_r( aFrame, m_rLabel, m_rCtrl, m_rUnits ),
38 m_settings( aSettings ),
39 m_mode( aMeanderType )
40{
41 m_r.SetUnits( EDA_UNITS::PERCENT );
42
43 switch( m_mode )
44 {
46 m_legend->SetBitmap( KiBitmapBundle( BITMAPS::tune_single_track_length_legend ) );
47 break;
48
50 m_legend->SetBitmap( KiBitmapBundle( BITMAPS::tune_diff_pair_length_legend ) );
51 break;
52
54 m_legend->SetBitmap( KiBitmapBundle( BITMAPS::tune_diff_pair_skew_legend ) );
55 m_targetLengthLabel->SetLabel( _( "Target skew: ") );
56 break;
57
58 default:
59 break;
60 }
61
62 // Bitmap has a new size, so recalculate sizes
63 GetSizer()->SetSizeHints( this );
65
66 GetSizer()->SetSizeHints( this );
67 Centre();
68}
69
70
72{
75 else
77
78 if( m_targetLength.GetValue() == std::numeric_limits<int>::max() )
79 m_targetLengthCtrl->SetValue( wxEmptyString );
80
82
84
85 if( !m_constraint.IsNull() )
86 m_sourceInfo->SetLabel( wxString::Format( _( "(from %s)" ), m_constraint.GetName() ) );
87
89
96
97 return true;
98}
99
100
102{
103 if(! m_targetLengthCtrl->GetValue().IsEmpty() )
104 {
106 {
109 else
111 }
112 else
113 {
116 else
118 }
119 }
120
122
130
131 return true;
132}
133
134
136{
137 m_targetLength.Enable( event.IsChecked() || m_constraint.IsNull() );
138
139 if( !event.IsChecked() && !m_constraint.IsNull() )
140 {
142 m_sourceInfo->Show( true );
143 }
144 else
145 {
146 m_sourceInfo->Show( false );
147 }
148}
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap)
Definition: bitmap.cpp:110
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:149
const MINOPTMAX< int > & GetValue() const
Definition: drc_rule.h:141
bool IsNull() const
Definition: drc_rule.h:136
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:82
void SetTargetLength(long long int aOpt)
Definition: pns_meander.cpp:54
int m_cornerRadiusPercentage
Place meanders on one side.
Definition: pns_meander.h:108
bool m_singleSided
Initial side when placing meanders at segment.
Definition: pns_meander.h:111
MINOPTMAX< long long int > m_targetLength
Target skew value for diff pair de-skewing.
Definition: pns_meander.h:97
void SetTargetSkew(int aOpt)
Definition: pns_meander.cpp:83
MINOPTMAX< int > m_targetSkew
Definition: pns_meander.h:100
MEANDER_STYLE m_cornerStyle
Rounding percentage (0 - 100).
Definition: pns_meander.h:105
int m_maxAmplitude
Meandering period/spacing (see dialog picture for explanation).
Definition: pns_meander.h:85
bool m_overrideCustomRules
Type of corners for the meandered line.
Definition: pns_meander.h:102
int m_spacing
Amplitude/spacing adjustment step.
Definition: pns_meander.h:88
int GetIntValue()
Definition: unit_binder.h:127
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.
#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