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  * Author: Maciej Suminski <maciej.suminski@cern.ch>
6  *
7  * This program is free software: you can redistribute it and/or modify it
8  * under the terms of the GNU General Public License as published by the
9  * Free Software Foundation, either version 3 of the License, or (at your
10  * option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License along
18  * with this program. If not, see <http://www.gnu.or/licenses/>.
19  */
20 
25 #include "dialog_track_via_size.h"
26 #include <base_units.h>
27 #include <confirm.h>
28 #include <widgets/text_ctrl_eval.h>
29 #include <core/optional.h>
30 #include <draw_frame.h>
31 
32 #include "board_design_settings.h"
33 
34 const int minSize = (int)( 0.01 * IU_PER_MM );
35 
37  BOARD_DESIGN_SETTINGS& aSettings ) :
38  DIALOG_TRACK_VIA_SIZE_BASE( aParent ),
39  m_trackWidth( aParent, m_trackWidthLabel, m_trackWidthText, m_trackWidthLabel, false, minSize ),
40  m_viaDiameter( aParent, m_viaDiameterLabel, m_viaDiameterText, m_viaDiameterLabel, false, minSize ),
41  m_viaDrill( aParent, m_viaDrillLabel, m_viaDrillText, m_viaDrillLabel, false, minSize ),
42  m_settings( aSettings )
43 {
44  m_stdButtonsOK->SetDefault();
45 
46  // Now all widgets have the size fixed, call FinishDialogSettings
48 }
49 
50 
52 {
53  if( !wxDialog::TransferDataFromWindow() )
54  return false;
55 
57  {
58  DisplayError( GetParent(), _( "Via drill size has to be smaller than via diameter" ) );
59  m_viaDrillText->SetFocus();
60  return false;
61  }
62 
63  // Store dialog values to the router settings
67 
68  return true;
69 }
70 
71 
73 {
74  if( !wxDialog::TransferDataToWindow() )
75  return false;
76 
77  // Load router settings to dialog fields
81 
82  return true;
83 }
84 
DIALOG_TRACK_VIA_SIZE(EDA_DRAW_FRAME *aParent, BOARD_DESIGN_SETTINGS &aSettings)
Constructor.
Implementation of conversion functions that require both schematic and board internal units...
This file is part of the common library.
void SetCustomViaDrill(int aDrill)
Function SetCustomViaDrill Sets custom size for via drill (i.e.
void FinishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
bool TransferDataFromWindow() override
const int minSize
Push and Shove router track width and via size dialog.
The base class for create windows for drawing purpose.
Definition: draw_frame.h:78
void SetCustomViaSize(int aSize)
Function SetCustomViaSize Sets custom size for via diameter (i.e.
virtual int GetValue()
Function GetValue Returns the current value in Internal Units.
int GetCustomViaSize() const
Function GetCustomViaSize.
int GetCustomViaDrill() const
Function GetCustomViaDrill.
int GetCustomTrackWidth() const
Function GetCustomTrackWidth.
void SetCustomTrackWidth(int aWidth)
Function SetCustomTrackWidth Sets custom width for track (i.e.
bool TransferDataToWindow() override
BOARD_DESIGN_SETTINGS & m_settings
virtual void SetValue(int aValue)
Function SetValue Sets new value (in Internal Units) for the text field, taking care of units convers...
Class DIALOG_TRACK_VIA_SIZE_BASE.
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:245
Class BOARD_DESIGN_SETTINGS contains design settings for a BOARD object.