2009-10-30 17:58:15 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2009-11-04 19:08:08 +00:00
|
|
|
|
2009-10-30 17:58:15 +00:00
|
|
|
// Name: dialog_mask_clearance.cpp
|
|
|
|
// Author: jean-pierre Charras
|
|
|
|
// Modified by:
|
|
|
|
// Created: 17 feb 2009
|
|
|
|
// Licence: GPL
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include "fctsys.h"
|
|
|
|
#include "common.h"
|
|
|
|
#include "confirm.h"
|
|
|
|
#include "pcbnew.h"
|
|
|
|
#include "wxPcbStruct.h"
|
|
|
|
#include "class_board_design_settings.h"
|
|
|
|
|
|
|
|
#include "dialog_mask_clearance.h"
|
|
|
|
|
|
|
|
/**
|
|
|
|
* DIALOG_PADS_MASK_CLEARANCE_BASE, derived from DIALOG_PADS_MASK_CLEARANCE_BASE_BASE
|
|
|
|
* @see dialog_dialog_mask_clearance_base.h and dialog_mask_clearance.cpp,
|
|
|
|
* automatically created by wxFormBuilder
|
|
|
|
*/
|
|
|
|
|
|
|
|
DIALOG_PADS_MASK_CLEARANCE::DIALOG_PADS_MASK_CLEARANCE( WinEDA_PcbFrame* parent ) :
|
|
|
|
DIALOG_PADS_MASK_CLEARANCE_BASE( parent )
|
|
|
|
{
|
|
|
|
m_Parent = parent;
|
2010-01-31 20:01:46 +00:00
|
|
|
m_BrdSettings = m_Parent->GetBoard()->GetBoardDesignSettings();
|
|
|
|
|
2009-10-30 17:58:15 +00:00
|
|
|
MyInit();
|
|
|
|
GetSizer()->SetSizeHints( this );
|
2010-01-20 12:43:05 +00:00
|
|
|
Centre();
|
2009-10-30 17:58:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void DIALOG_PADS_MASK_CLEARANCE::MyInit()
|
|
|
|
{
|
|
|
|
SetFocus();
|
|
|
|
|
2010-07-12 14:07:09 +00:00
|
|
|
m_SolderMaskMarginUnits->SetLabel( GetUnitsLabel( g_UserUnit ) );
|
|
|
|
m_SolderPasteMarginUnits->SetLabel( GetUnitsLabel( g_UserUnit ) );
|
2009-10-30 17:58:15 +00:00
|
|
|
|
|
|
|
int Internal_Unit = m_Parent->m_InternalUnits;
|
2009-11-04 19:08:08 +00:00
|
|
|
PutValueInLocalUnits( *m_SolderMaskMarginCtrl,
|
2010-01-31 20:01:46 +00:00
|
|
|
m_BrdSettings->m_SolderMaskMargin,
|
2009-11-04 19:08:08 +00:00
|
|
|
Internal_Unit );
|
2009-12-08 13:41:20 +00:00
|
|
|
|
|
|
|
// These 2 parameters are usually < 0, so prepare entering a negative
|
|
|
|
// value, if current is 0
|
2009-11-04 19:08:08 +00:00
|
|
|
PutValueInLocalUnits( *m_SolderPasteMarginCtrl,
|
2010-01-31 20:01:46 +00:00
|
|
|
m_BrdSettings->m_SolderPasteMargin,
|
2009-11-04 19:08:08 +00:00
|
|
|
Internal_Unit );
|
2010-01-31 20:01:46 +00:00
|
|
|
if( m_BrdSettings->m_SolderPasteMargin == 0 )
|
2009-12-08 13:41:20 +00:00
|
|
|
m_SolderPasteMarginCtrl->SetValue( wxT( "-" ) +
|
|
|
|
m_SolderPasteMarginCtrl->GetValue() );
|
2009-11-04 19:08:08 +00:00
|
|
|
wxString msg;
|
2010-01-31 20:01:46 +00:00
|
|
|
msg.Printf( wxT( "%f" ), m_BrdSettings->m_SolderPasteMarginRatio * 100.0 );
|
|
|
|
if( m_BrdSettings->m_SolderPasteMarginRatio == 0.0 &&
|
|
|
|
msg[0] == '0') // Sometimes Printf add a sign if the value is small
|
|
|
|
m_SolderPasteMarginRatioCtrl->SetValue( wxT( "-" ) + msg );
|
2009-12-08 13:41:20 +00:00
|
|
|
else
|
2010-01-31 20:01:46 +00:00
|
|
|
m_SolderPasteMarginRatioCtrl->SetValue( msg );
|
2009-10-30 17:58:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*******************************************************************/
|
|
|
|
void DIALOG_PADS_MASK_CLEARANCE::OnButtonOkClick( wxCommandEvent& event )
|
|
|
|
/*******************************************************************/
|
|
|
|
{
|
2010-01-31 20:01:46 +00:00
|
|
|
m_BrdSettings->m_SolderMaskMargin =
|
2009-11-04 19:08:08 +00:00
|
|
|
ReturnValueFromTextCtrl( *m_SolderMaskMarginCtrl, m_Parent->m_InternalUnits );
|
2010-01-31 20:01:46 +00:00
|
|
|
m_BrdSettings->m_SolderPasteMargin =
|
2009-11-04 19:08:08 +00:00
|
|
|
ReturnValueFromTextCtrl( *m_SolderPasteMarginCtrl, m_Parent->m_InternalUnits );
|
2010-01-31 20:01:46 +00:00
|
|
|
double dtmp = 0;
|
2009-11-04 19:08:08 +00:00
|
|
|
wxString msg = m_SolderPasteMarginRatioCtrl->GetValue();
|
|
|
|
msg.ToDouble( &dtmp );
|
|
|
|
|
|
|
|
// A margin ratio de -50% means no paste on a pad, the ratio must be >= 50 %
|
|
|
|
if( dtmp < -50 )
|
|
|
|
dtmp = -50;
|
2010-01-31 20:01:46 +00:00
|
|
|
if( dtmp > +100 )
|
|
|
|
dtmp = +100;
|
|
|
|
m_BrdSettings->m_SolderPasteMarginRatio = dtmp / 100;
|
2009-10-30 17:58:15 +00:00
|
|
|
|
|
|
|
EndModal( 1 );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
|
|
|
|
*/
|
|
|
|
|
|
|
|
void DIALOG_PADS_MASK_CLEARANCE::OnButtonCancelClick( wxCommandEvent& event )
|
|
|
|
{
|
|
|
|
EndModal( 0 );
|
|
|
|
}
|