KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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 The KiCad Developers, see AUTHORS.txt for contributors.
6 * Author: Tomasz Wlostowski <[email protected]>
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
25
29#include <eda_draw_frame.h>
30#include <confirm.h>
31
46
47
49{
50 if( !wxDialog::TransferDataFromWindow() )
51 return false;
52
53 if( m_traceGap.GetValue() <= 0 )
54 {
55 DisplayErrorMessage( this, _( "Track gap must be greater than 0." ) );
56 m_traceGapText->SetFocus();
57 return false;
58 }
59
60 // Save widgets' values to settings
61 m_sizes.SetDiffPairGap( m_traceGap.GetValue() );
62 m_sizes.SetDiffPairViaGap( m_viaGap.GetValue() );
63 m_sizes.SetDiffPairWidth( m_traceWidth.GetValue() );
64
65 m_sizes.SetDiffPairGapSource( _( "user choice" ) );
66 m_sizes.SetDiffPairWidthSource( _( "user choice" ) );
67
68 return true;
69}
70
71
73{
74 if( !wxDialog::TransferDataToWindow() )
75 return false;
76
77 m_traceWidth.SetValue( m_sizes.DiffPairWidth() );
78 m_traceGap.SetValue( m_sizes.DiffPairGap() );
79 m_viaGap.SetValue( m_sizes.DiffPairViaGap() );
80 m_viaTraceGapEqual->SetValue( m_sizes.DiffPairViaGapSameAsTraceGap() );
82
83 return true;
84}
85
86
88{
89 m_sizes.SetDiffPairViaGapSameAsTraceGap( m_viaTraceGapEqual->GetValue() );
90 m_viaGapText->Enable( !m_viaTraceGapEqual->GetValue() );
91 m_viaGapLabel->Enable( !m_viaTraceGapEqual->GetValue() );
92 m_viaGapUnit->Enable( !m_viaTraceGapEqual->GetValue() );
93}
94
95
DIALOG_PNS_DIFF_PAIR_DIMENSIONS_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=_("Differential Pair Dimensions"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
DIALOG_PNS_DIFF_PAIR_DIMENSIONS(EDA_DRAW_FRAME *aParent, PNS::SIZES_SETTINGS &aSizes)
Push and Shove diff pair dimensions (gap) settings dialog.
virtual void OnViaTraceGapEqualCheck(wxCommandEvent &event) override
void SetupStandardButtons(std::map< int, wxString > aLabels={})
The base class for create windows for drawing purpose.
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition confirm.cpp:194
This file is part of the common library.
#define _(s)