KiCad PCB EDA Suite
dialog_pns_length_tuning_settings.cpp
Go to the documentation of this file.
1 /*
2  * KiRouter - a push-and-(sometimes-)shove PCB router
3  *
4  * Copyright (C) 2014-2018 CERN
5  * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
6  * Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
7  *
8  * This program is free software: you can redistribute it and/or modify it
9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation, either version 3 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
28 #include <widgets/text_ctrl_eval.h>
29 #include <bitmaps.h>
30 #include <draw_frame.h>
31 
32 // TODO validators
33 
35  PNS::MEANDER_SETTINGS& aSettings, PNS::ROUTER_MODE aMode )
36  :
38  m_minAmpl( aParent, m_minAmplLabel, m_minAmplText, m_minAmplUnit ),
39  m_maxAmpl( aParent, m_maxAmplLabel, m_maxAmplText, m_maxAmplUnit ),
40  m_spacing( aParent, m_spacingLabel, m_spacingText, m_spacingUnit ),
41  m_targetLength( aParent, m_targetLengthLabel, m_targetLengthText, m_targetLengthUnit ),
42  m_settings( aSettings ),
43  m_mode( aMode )
44 {
45  m_stdButtonsOK->SetDefault();
46  m_targetLengthText->SetSelection( -1, -1 );
47  m_targetLengthText->SetFocus();
48 
49  GetSizer()->SetSizeHints(this);
50  Centre();
51 }
52 
53 
55 {
56  if( !wxDialog::TransferDataToWindow() )
57  return false;
58 
60  {
61  // TODO: fix diff-pair meandering so we can use non-100% radii
62  m_radiusText->SetValue( wxT( "100" ) );
63  m_radiusText->Enable( false );
64  }
65  else
66  {
68  }
69 
74 
75  switch( m_mode )
76  {
78  SetTitle( _( "Single Track Length Tuning" ) );
79  m_legend->SetBitmap( KiBitmap( tune_single_track_length_legend_xpm ) );
81  break;
82 
84  SetTitle( _( "Differential Pair Length Tuning" ) );
85  m_legend->SetBitmap( KiBitmap( tune_diff_pair_length_legend_xpm ) );
87  break;
88 
90  SetTitle( _( "Differential Pair Skew Tuning" ) );
91  m_legend->SetBitmap( KiBitmap( tune_diff_pair_skew_legend_xpm ) );
92  m_targetLengthLabel->SetLabel( _( "Target skew: " ) );
94  break;
95 
96  default:
97  break;
98  }
99 
100  // Bitmap has a new size, so recalculate sizes
101  GetSizer()->SetSizeHints(this);
102 
103  return true;
104 }
105 
106 
108 {
109  if( !wxDialog::TransferDataToWindow() )
110  return false;
111 
112  // fixme: use validators and TransferDataFromWindow
116  m_settings.m_cornerRadiusPercentage = wxAtoi( m_radiusText->GetValue() );
117 
120  else
122 
125 
126  m_settings.m_cornerStyle = m_miterStyle->GetSelection() ?
128 
129  return true;
130 }
int m_minAmplitude
minimum meandering amplitude
Definition: pns_meander.h:76
int m_targetSkew
target skew value for diff pair de-skewing
Definition: pns_meander.h:94
Class MEANDER_SETTINGS.
Definition: pns_meander.h:57
The base class for create windows for drawing purpose.
Definition: draw_frame.h:78
MEANDER_STYLE m_cornerStyle
type of corners for the meandered line
Definition: pns_meander.h:86
void SetValue(const wxString &aValue) override
Set a new value in evaluator buffer, and display it in the wxTextCtrl.
DIALOG_PNS_LENGTH_TUNING_SETTINGS(EDA_DRAW_FRAME *aParent, PNS::MEANDER_SETTINGS &aSettings, PNS::ROUTER_MODE aMode)
Length tuner settings dialog.
virtual int GetValue()
Function GetValue Returns the current value in Internal Units.
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:79
int m_cornerRadiusPercentage
rounding percentage (0 - 100)
Definition: pns_meander.h:88
ROUTER_MODE
Definition: pns_router.h:64
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
virtual void SetValue(int aValue)
Function SetValue Sets new value (in Internal Units) for the text field, taking care of units convers...
int m_targetLength
desired length of the tuned line/diff pair
Definition: pns_meander.h:84
int m_spacing
meandering period/spacing (see dialog picture for explanation)
Definition: pns_meander.h:80
int m_maxAmplitude
maximum meandering amplitude
Definition: pns_meander.h:78
Class DIALOG_PNS_LENGTH_TUNING_SETTINGS_BASE.