KiCad PCB EDA Suite
dialog_mask_clearance.cpp
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, you may find one here:
18  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19  * or you may search the http://www.gnu.org website for the version 2 license,
20  * or you may write to the Free Software Foundation, Inc.,
21  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22  */
27 #include <fctsys.h>
28 #include <pcbnew.h>
29 #include <wxPcbStruct.h>
31 #include <base_units.h>
32 
33 #include <class_board.h>
34 
35 #include <dialog_mask_clearance.h>
36 
45 {
46  m_parent = aParent;
48 
49  myInit();
50  m_sdbButtonsSizerOK->SetDefault();
51  GetSizer()->SetSizeHints( this );
52  Centre();
53 }
54 
55 
57 {
58  SetFocus();
59 
63 
66 
67  // These 2 parameters are usually < 0, so prepare entering a negative
68  // value, if current is 0
70 
72  m_SolderPasteMarginCtrl->SetValue( wxT( "-" ) +
73  m_SolderPasteMarginCtrl->GetValue() );
74 
75  wxString msg;
76  msg.Printf( wxT( "%f" ), m_brdSettings.m_SolderPasteMarginRatio * 100.0 );
77 
78  // Sometimes Printf adds a sign if the value is small
79  if( m_brdSettings.m_SolderPasteMarginRatio == 0.0 && msg[0] == '0' )
80  m_SolderPasteMarginRatioCtrl->SetValue( wxT( "-" ) + msg );
81  else
82  m_SolderPasteMarginRatioCtrl->SetValue( msg );
83 }
84 
85 
86 void DIALOG_PADS_MASK_CLEARANCE::OnButtonOkClick( wxCommandEvent& event )
87 {
90 
92 
93  double dtmp = 0;
94  wxString msg = m_SolderPasteMarginRatioCtrl->GetValue();
95 
96  msg.ToDouble( &dtmp );
97 
98  // A margin ratio de -50% means no paste on a pad, the ratio must be >= 50 %
99  if( dtmp < -50 )
100  dtmp = -50;
101 
102  if( dtmp > +100 )
103  dtmp = +100;
104 
106 
107  m_parent->OnModify();
108 
110 
111  EndModal( 1 );
112 }
113 
114 
116 {
117  EndModal( 0 );
118 }
int m_SolderMaskMargin
Solder mask margin.
virtual void OnModify() override
Function OnModify must be called after a board change to set the modified flag.
Definition: pcbframe.cpp:994
int m_SolderPasteMargin
Solder paste margin absolute value.
Implementation of conversion functions that require both schematic and board internal units...
Class BOARD to handle a board.
wxString GetUnitsLabel(EDA_UNITS_T aUnit)
Get a human readable units string.
Definition: base_units.cpp:457
BOARD * GetBoard() const
BOARD_DESIGN_SETTINGS m_brdSettings
virtual void OnButtonCancelClick(wxCommandEvent &event) override
DIALOG_PADS_MASK_CLEARANCE(PCB_EDIT_FRAME *parent)
Class DIALOG_PADS_MASK_CLEARANCE is derived from DIALOG_PADS_MASK_CLEARANCE_BASE. ...
virtual void OnButtonOkClick(wxCommandEvent &event) override
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:532
void SetDesignSettings(const BOARD_DESIGN_SETTINGS &aDesignSettings)
Function SetDesignSettings.
Definition: class_board.h:542
int ValueFromTextCtrl(const wxTextCtrl &aTextCtr)
Convert the number Value in a string according to the internal units and the selected unit (g_UserUni...
Definition: base_units.cpp:385
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:56
void PutValueInLocalUnits(wxTextCtrl &aTextCtr, int aValue)
Function PutValueInLocalUnits converts aValue from internal units to user units and append the units ...
Definition: base_units.cpp:266
double m_SolderPasteMarginRatio
Solder pask margin ratio value of pad size The final margin is the sum of these 2 values...
Class DIALOG_PADS_MASK_CLEARANCE_BASE.
int m_SolderMaskMinWidth
Solder mask min width.