KiCad PCB EDA Suite
dialog_pns_diff_pair_dimensions.cpp
Go to the documentation of this file.
1 /*
2  * KiRouter - a push-and-(sometimes-)shove PCB router
3  *
4  * Copyright (C) 2014-2015 CERN
5  * Copyright (C) 2016-2018 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 
27 #include <widgets/text_ctrl_eval.h>
29 #include <draw_frame.h>
30 #include <confirm.h>
31 
33  PNS::SIZES_SETTINGS& aSizes ) :
35  m_traceWidth( aParent, m_traceWidthLabel, m_traceWidthText, m_traceWidthUnit, true, 0 ),
36  m_traceGap( aParent, m_traceGapLabel, m_traceGapText, m_traceGapUnit, true, 0 ),
37  m_viaGap( aParent, m_viaGapLabel, m_viaGapText, m_viaGapUnit, true ),
38  m_sizes( aSizes )
39 {
40  Layout();
41  GetSizer()->SetSizeHints( this );
42  Centre();
43 
44  m_stdButtonsOK->SetDefault();
45 }
46 
47 
49 {
50  if( !wxDialog::TransferDataFromWindow() )
51  return false;
52 
53  if( m_traceGap.GetValue() <= 0 )
54  {
55  DisplayErrorMessage( this, _( "Trace gap must be greater than 0." ) );
56  m_traceGapText->SetFocus();
57  return false;
58  }
59 
60  // Save widgets' values to settings
64 
65  return true;
66 }
67 
68 
70 {
71  if( !wxDialog::TransferDataToWindow() )
72  return false;
73 
79 
80  return true;
81 }
82 
83 
85 {
87  m_viaGapText->Enable( !m_viaTraceGapEqual->GetValue() );
88  m_viaGapLabel->Enable( !m_viaTraceGapEqual->GetValue() );
89  m_viaGapUnit->Enable( !m_viaTraceGapEqual->GetValue() );
90 }
91 
92 
94 {
96 }
void SetDiffPairViaGapSameAsTraceGap(bool aEnable)
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Function DisplayErrorMessage displays an error message with aMessage.
Definition: confirm.cpp:259
This file is part of the common library.
The base class for create windows for drawing purpose.
Definition: draw_frame.h:78
virtual int GetValue()
Function GetValue Returns the current value in Internal Units.
DIALOG_PNS_DIFF_PAIR_DIMENSIONS(EDA_DRAW_FRAME *aParent, PNS::SIZES_SETTINGS &aSizes)
Push and Shove diff pair dimensions (gap) settings dialog.
void SetDiffPairViaGap(int aGap)
int DiffPairViaGap() const
virtual void OnViaTraceGapEqualCheck(wxCommandEvent &event) override
Class DIALOG_PNS_DIFF_PAIR_DIMENSIONS_BASE.
bool DiffPairViaGapSameAsTraceGap() const
void SetDiffPairGap(int aGap)
virtual void SetValue(int aValue)
Function SetValue Sets new value (in Internal Units) for the text field, taking care of units convers...
int DiffPairWidth() const
void SetDiffPairWidth(int aWidth)