KiCad PCB EDA Suite
dialog_track_via_size.cpp
Go to the documentation of this file.
1/*
2 * KiRouter - a push-and-(sometimes-)shove PCB router
3 *
4 * Copyright (C) 2014 CERN
5 * Copyright (C) 2014-2022 KiCad Developers, see AUTHORS.txt for contributors.
6 * Author: Maciej Suminski <[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.or/licenses/>.
20 */
21
27#include <base_units.h>
28#include <confirm.h>
30#include <optional>
31#include <eda_draw_frame.h>
32
34
35const int minSize = (int) ( 0.01 * pcbIUScale.IU_PER_MM );
36
38 BOARD_DESIGN_SETTINGS& aSettings ) :
40 m_trackWidth( aParent, m_trackWidthLabel, m_trackWidthText, m_trackWidthUnits, minSize ),
41 m_viaDiameter( aParent, m_viaDiameterLabel, m_viaDiameterText, m_viaDiameterUnits, minSize ),
42 m_viaDrill( aParent, m_viaDrillLabel, m_viaDrillText, m_viaDrillUnits, minSize ),
43 m_settings( aSettings )
44{
46
47 // Now all widgets have the size fixed, call FinishDialogSettings
49}
50
51
53{
54 if( !wxDialog::TransferDataFromWindow() )
55 return false;
56
58 {
59 DisplayError( GetParent(), _( "Via hole size must be smaller than via diameter" ) );
60 m_viaDrillText->SetFocus();
61 return false;
62 }
63
64 // Store dialog values to the router settings
68
69 return true;
70}
71
72
74{
75 if( !wxDialog::TransferDataToWindow() )
76 return false;
77
78 // Load router settings to dialog fields
82
83 return true;
84}
85
constexpr EDA_IU_SCALE pcbIUScale
Definition: base_units.h:109
Container for design settings for a BOARD object.
void SetCustomTrackWidth(int aWidth)
Sets custom width for track (i.e.
void SetCustomViaSize(int aSize)
Set custom size for via diameter (i.e.
void SetCustomViaDrill(int aDrill)
Sets custom size for via drill (i.e.
void SetupStandardButtons(std::map< int, wxString > aLabels={})
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
Class DIALOG_TRACK_VIA_SIZE_BASE.
DIALOG_TRACK_VIA_SIZE(EDA_DRAW_FRAME *aParent, BOARD_DESIGN_SETTINGS &aSettings)
Constructor.
bool TransferDataToWindow() override
BOARD_DESIGN_SETTINGS & m_settings
bool TransferDataFromWindow() override
The base class for create windows for drawing purpose.
virtual long long int GetValue()
Return the current value in Internal Units.
virtual void SetValue(long long int aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion.
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:280
This file is part of the common library.
const int minSize
Push and Shove router track width and via size dialog.
#define _(s)
const double IU_PER_MM
Definition: base_units.h:77