2013-03-30 09:28:59 +00:00
|
|
|
/**
|
2013-04-25 16:29:35 +00:00
|
|
|
* @file dialog_pad_properties.cpp
|
|
|
|
* @brief Pad editing functions and dialog pad editor.
|
2013-03-30 09:28:59 +00:00
|
|
|
*/
|
2008-11-22 11:10:40 +00:00
|
|
|
|
2012-03-20 20:22:38 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2013-03-30 09:28:59 +00:00
|
|
|
* Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
|
|
|
* Copyright (C) 2013 Dick Hollenbeck, dick@softplc.com
|
|
|
|
* Copyright (C) 2008-2013 Wayne Stambaugh <stambaughw@verizon.net>
|
|
|
|
* Copyright (C) 1992-2013 KiCad Developers, see AUTHORS.txt for contributors.
|
2012-03-20 20:22:38 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <fctsys.h>
|
|
|
|
#include <common.h>
|
|
|
|
#include <gr_basic.h>
|
|
|
|
#include <class_drawpanel.h>
|
|
|
|
#include <confirm.h>
|
|
|
|
#include <pcbnew.h>
|
|
|
|
#include <trigo.h>
|
|
|
|
#include <macros.h>
|
|
|
|
#include <wxBasePcbFrame.h>
|
|
|
|
#include <pcbcommon.h>
|
2012-04-13 18:51:24 +00:00
|
|
|
#include <base_units.h>
|
2011-09-23 13:57:12 +00:00
|
|
|
|
2010-09-11 16:33:43 +00:00
|
|
|
#include <wx/dcbuffer.h>
|
2012-02-19 04:02:19 +00:00
|
|
|
#include <protos.h>
|
2008-11-22 11:10:40 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <class_board.h>
|
|
|
|
#include <class_module.h>
|
2011-09-23 13:57:12 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <dialog_pad_properties_base.h>
|
2012-03-10 13:00:31 +00:00
|
|
|
#include <html_messagebox.h>
|
2011-09-23 13:57:12 +00:00
|
|
|
|
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
// list of pad shapes.
|
|
|
|
static PAD_SHAPE_T CodeShape[] = {
|
2008-11-22 11:10:40 +00:00
|
|
|
PAD_CIRCLE, PAD_OVAL, PAD_RECT, PAD_TRAPEZOID
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2012-03-17 02:11:44 +00:00
|
|
|
static PAD_ATTR_T CodeType[] = {
|
2008-11-22 11:10:40 +00:00
|
|
|
PAD_STANDARD, PAD_SMD, PAD_CONN, PAD_HOLE_NOT_PLATED
|
|
|
|
};
|
|
|
|
|
2012-03-17 02:11:44 +00:00
|
|
|
#define NBTYPES DIM(CodeType)
|
|
|
|
|
|
|
|
|
2010-09-11 16:33:43 +00:00
|
|
|
// Default mask layers setup for pads according to the pad type
|
2013-03-30 17:24:04 +00:00
|
|
|
static const LAYER_MSK Std_Pad_Layers[] = {
|
2012-03-17 02:11:44 +00:00
|
|
|
|
2008-11-22 11:10:40 +00:00
|
|
|
// PAD_STANDARD:
|
2009-09-23 06:02:37 +00:00
|
|
|
PAD_STANDARD_DEFAULT_LAYERS,
|
2008-11-22 11:10:40 +00:00
|
|
|
|
|
|
|
// PAD_CONN:
|
2009-09-23 06:02:37 +00:00
|
|
|
PAD_CONN_DEFAULT_LAYERS,
|
2008-11-22 11:10:40 +00:00
|
|
|
|
|
|
|
// PAD_SMD:
|
2009-09-23 06:02:37 +00:00
|
|
|
PAD_SMD_DEFAULT_LAYERS,
|
2008-11-22 11:10:40 +00:00
|
|
|
|
|
|
|
//PAD_HOLE_NOT_PLATED:
|
2009-09-23 06:02:37 +00:00
|
|
|
PAD_HOLE_NOT_PLATED_DEFAULT_LAYERS
|
2008-11-22 11:10:40 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2010-09-11 16:33:43 +00:00
|
|
|
/**
|
|
|
|
* class DIALOG_PAD_PROPERTIES, derived from DIALOG_PAD_PROPERTIES_BASE,
|
|
|
|
* created by wxFormBuilder
|
|
|
|
*/
|
2012-03-22 18:36:20 +00:00
|
|
|
class DIALOG_PAD_PROPERTIES : public DIALOG_PAD_PROPERTIES_BASE
|
2008-11-22 11:10:40 +00:00
|
|
|
{
|
|
|
|
public:
|
2012-02-19 04:02:19 +00:00
|
|
|
DIALOG_PAD_PROPERTIES( PCB_BASE_FRAME* aParent, D_PAD* aPad );
|
2010-09-11 16:33:43 +00:00
|
|
|
~DIALOG_PAD_PROPERTIES()
|
|
|
|
{
|
|
|
|
delete m_dummyPad;
|
|
|
|
}
|
|
|
|
|
2010-03-01 17:48:17 +00:00
|
|
|
private:
|
2013-03-30 09:28:59 +00:00
|
|
|
PCB_BASE_FRAME* m_parent;
|
|
|
|
D_PAD* m_currentPad; // pad currently being edited
|
2012-02-19 04:02:19 +00:00
|
|
|
D_PAD* m_dummyPad; // a working copy used to show changes
|
2013-03-30 09:28:59 +00:00
|
|
|
BOARD* m_board;
|
|
|
|
D_PAD& m_padMaster;
|
2012-02-19 04:02:19 +00:00
|
|
|
bool m_isFlipped; // true if the parent footprint (therefore pads) is flipped (mirrored)
|
|
|
|
// in this case, some Y coordinates values must be negated
|
|
|
|
bool m_canUpdate;
|
|
|
|
|
2013-03-30 09:28:59 +00:00
|
|
|
private:
|
2010-09-11 16:33:43 +00:00
|
|
|
void initValues();
|
2012-03-17 02:11:44 +00:00
|
|
|
|
2012-04-11 23:30:06 +00:00
|
|
|
bool padValuesOK(); ///< test if all values are acceptable for the pad
|
2012-03-17 02:11:44 +00:00
|
|
|
|
|
|
|
/**
|
2012-04-11 23:30:06 +00:00
|
|
|
* Function setPadLayersList
|
2012-03-17 02:11:44 +00:00
|
|
|
* updates the CheckBox states in pad layers list,
|
|
|
|
* @param layer_mask = pad layer mask (ORed layers bit mask)
|
|
|
|
*/
|
2013-03-30 17:24:04 +00:00
|
|
|
void setPadLayersList( LAYER_MSK layer_mask );
|
2012-04-11 23:30:06 +00:00
|
|
|
|
|
|
|
/// Copy values from dialog field to aPad's members
|
|
|
|
bool transferDataToPad( D_PAD* aPad );
|
|
|
|
|
|
|
|
// event handlers:
|
|
|
|
|
|
|
|
void OnPadShapeSelection( wxCommandEvent& event );
|
|
|
|
void OnDrillShapeSelected( wxCommandEvent& event );
|
|
|
|
|
|
|
|
void PadOrientEvent( wxCommandEvent& event );
|
|
|
|
void PadTypeSelected( wxCommandEvent& event );
|
2012-03-17 02:11:44 +00:00
|
|
|
|
2011-08-19 13:08:24 +00:00
|
|
|
void OnSetLayers( wxCommandEvent& event );
|
2010-09-11 16:33:43 +00:00
|
|
|
void OnCancelButtonClick( wxCommandEvent& event );
|
|
|
|
void OnPaintShowPanel( wxPaintEvent& event );
|
2012-03-17 02:11:44 +00:00
|
|
|
|
|
|
|
/// Called when a dimension has changed.
|
|
|
|
/// Update the graphical pad shown in the panel.
|
2010-09-11 16:33:43 +00:00
|
|
|
void OnValuesChanged( wxCommandEvent& event );
|
2012-04-11 23:30:06 +00:00
|
|
|
|
|
|
|
/// Updates the different parameters for the component being edited.
|
2012-04-11 23:51:16 +00:00
|
|
|
/// Fired from the OK button click.
|
2012-04-11 23:30:06 +00:00
|
|
|
void PadPropertiesAccept( wxCommandEvent& event );
|
2008-11-22 11:10:40 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES( PCB_BASE_FRAME* aParent, D_PAD* aPad ) :
|
2012-03-22 18:36:20 +00:00
|
|
|
DIALOG_PAD_PROPERTIES_BASE( aParent ),
|
2012-04-11 23:30:06 +00:00
|
|
|
// use aParent's parent, which is the original BOARD, not the dummy module editor BOARD,
|
2012-04-11 23:51:16 +00:00
|
|
|
// since FOOTPRINT_EDIT_FRAME::GetDesignSettings() is tricked out to use the PCB_EDIT_FRAME's
|
2012-04-11 23:30:06 +00:00
|
|
|
// BOARD, not its own BOARD.
|
2013-03-30 09:28:59 +00:00
|
|
|
m_padMaster( aParent->GetDesignSettings().m_Pad_Master )
|
2012-02-19 04:02:19 +00:00
|
|
|
{
|
|
|
|
m_canUpdate = false;
|
2013-03-30 09:28:59 +00:00
|
|
|
m_parent = aParent;
|
|
|
|
m_currentPad = aPad;
|
|
|
|
m_board = m_parent->GetBoard();
|
2012-02-19 04:02:19 +00:00
|
|
|
m_dummyPad = new D_PAD( (MODULE*) NULL );
|
|
|
|
|
|
|
|
if( aPad )
|
|
|
|
m_dummyPad->Copy( aPad );
|
|
|
|
else
|
2013-03-30 09:28:59 +00:00
|
|
|
m_dummyPad->Copy( &m_padMaster );
|
2012-02-19 04:02:19 +00:00
|
|
|
|
|
|
|
initValues();
|
|
|
|
|
|
|
|
m_sdbSizer1OK->SetDefault();
|
|
|
|
GetSizer()->SetSizeHints( this );
|
2012-03-08 20:44:03 +00:00
|
|
|
|
|
|
|
m_PadNumCtrl->SetFocus();
|
2012-02-19 04:02:19 +00:00
|
|
|
m_canUpdate = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-09-11 16:33:43 +00:00
|
|
|
void DIALOG_PAD_PROPERTIES::OnPaintShowPanel( wxPaintEvent& event )
|
|
|
|
{
|
|
|
|
wxPaintDC dc( m_panelShowPad );
|
|
|
|
PAD_DRAWINFO drawInfo;
|
|
|
|
|
2013-04-09 19:20:21 +00:00
|
|
|
EDA_COLOR_T color = BLACK;
|
2010-09-11 16:33:43 +00:00
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
if( m_dummyPad->GetLayerMask() & LAYER_FRONT )
|
2010-09-11 16:33:43 +00:00
|
|
|
{
|
2013-03-30 09:28:59 +00:00
|
|
|
color = m_board->GetVisibleElementColor( PAD_FR_VISIBLE );
|
2010-09-11 16:33:43 +00:00
|
|
|
}
|
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
if( m_dummyPad->GetLayerMask() & LAYER_BACK )
|
2010-09-11 16:33:43 +00:00
|
|
|
{
|
2013-04-09 19:20:21 +00:00
|
|
|
color = ColorMix( color, m_board->GetVisibleElementColor( PAD_BK_VISIBLE ) );
|
2010-09-11 16:33:43 +00:00
|
|
|
}
|
|
|
|
|
2013-04-09 19:20:21 +00:00
|
|
|
// What could happen: the pad color is *actually* black, or no
|
|
|
|
// copper was selected
|
|
|
|
if( color == BLACK )
|
2010-09-11 16:33:43 +00:00
|
|
|
color = LIGHTGRAY;
|
|
|
|
|
|
|
|
drawInfo.m_Color = color;
|
|
|
|
drawInfo.m_HoleColor = DARKGRAY;
|
2012-02-19 04:02:19 +00:00
|
|
|
drawInfo.m_Offset = m_dummyPad->GetPosition();
|
2010-09-11 16:33:43 +00:00
|
|
|
drawInfo.m_Display_padnum = true;
|
|
|
|
drawInfo.m_Display_netname = true;
|
2012-03-17 02:11:44 +00:00
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
if( m_dummyPad->GetAttribute() == PAD_HOLE_NOT_PLATED )
|
2011-08-19 13:08:24 +00:00
|
|
|
drawInfo.m_ShowNotPlatedHole = true;
|
2010-09-11 16:33:43 +00:00
|
|
|
|
|
|
|
// Shows the local pad clearance
|
2012-02-19 04:02:19 +00:00
|
|
|
drawInfo.m_PadClearance = m_dummyPad->GetLocalClearance();
|
2010-09-11 16:33:43 +00:00
|
|
|
|
|
|
|
wxSize dc_size = dc.GetSize();
|
|
|
|
dc.SetDeviceOrigin( dc_size.x / 2, dc_size.y / 2 );
|
|
|
|
|
|
|
|
// Calculate a suitable scale to fit the available draw area
|
2012-09-22 11:19:37 +00:00
|
|
|
int dim = m_dummyPad->GetSize().x + std::abs( m_dummyPad->GetDelta().y);
|
2012-02-19 04:02:19 +00:00
|
|
|
|
|
|
|
if( m_dummyPad->GetLocalClearance() > 0 )
|
|
|
|
dim += m_dummyPad->GetLocalClearance() * 2;
|
|
|
|
|
|
|
|
double scale = (double) dc_size.x / dim;
|
|
|
|
|
2012-09-22 11:19:37 +00:00
|
|
|
dim = m_dummyPad->GetSize().y + std::abs( m_dummyPad->GetDelta().x);
|
2012-02-19 04:02:19 +00:00
|
|
|
if( m_dummyPad->GetLocalClearance() > 0 )
|
|
|
|
dim += m_dummyPad->GetLocalClearance() * 2;
|
|
|
|
|
2010-09-11 19:15:24 +00:00
|
|
|
double altscale = (double) dc_size.y / dim;
|
2012-09-22 11:19:37 +00:00
|
|
|
scale = std::min( scale, altscale );
|
2010-09-11 16:33:43 +00:00
|
|
|
|
|
|
|
// Give a margin
|
|
|
|
scale *= 0.7;
|
|
|
|
dc.SetUserScale( scale, scale );
|
|
|
|
|
2011-04-18 20:22:17 +00:00
|
|
|
GRResetPenAndBrush( &dc );
|
2010-09-11 16:33:43 +00:00
|
|
|
m_dummyPad->DrawShape( NULL, &dc, drawInfo );
|
|
|
|
|
2012-03-20 20:22:38 +00:00
|
|
|
// Draw X and Y axis.
|
|
|
|
// this is particularly useful to show the reference position of pads
|
|
|
|
// with offset and no hole
|
2013-04-09 19:20:21 +00:00
|
|
|
GRLine( NULL, &dc, -dim, 0, dim, 0, 0, BLUE ); // X axis
|
|
|
|
GRLine( NULL, &dc, 0, -dim, 0, dim, 0, BLUE ); // Y axis
|
2012-03-20 20:22:38 +00:00
|
|
|
|
2010-09-11 16:33:43 +00:00
|
|
|
event.Skip();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-03-17 02:11:44 +00:00
|
|
|
void PCB_BASE_FRAME::InstallPadOptionsFrame( D_PAD* aPad )
|
2008-11-22 11:10:40 +00:00
|
|
|
{
|
2012-03-17 02:11:44 +00:00
|
|
|
DIALOG_PAD_PROPERTIES dlg( this, aPad );
|
2010-04-23 14:46:00 +00:00
|
|
|
|
2009-11-05 20:59:42 +00:00
|
|
|
dlg.ShowModal();
|
2008-11-22 11:10:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-09-11 16:33:43 +00:00
|
|
|
void DIALOG_PAD_PROPERTIES::initValues()
|
2008-11-22 11:10:40 +00:00
|
|
|
{
|
2012-02-19 04:02:19 +00:00
|
|
|
wxString msg;
|
|
|
|
double angle;
|
2010-09-11 16:33:43 +00:00
|
|
|
|
2012-03-10 13:00:31 +00:00
|
|
|
// Setup layers names from board
|
|
|
|
// Should be made first, before calling m_rbCopperLayersSel->SetSelection()
|
2013-03-30 09:28:59 +00:00
|
|
|
m_rbCopperLayersSel->SetString( 0, m_board->GetLayerName( LAYER_N_FRONT ) );
|
|
|
|
m_rbCopperLayersSel->SetString( 1, m_board->GetLayerName( LAYER_N_BACK ) );
|
|
|
|
|
|
|
|
m_PadLayerAdhCmp->SetLabel( m_board->GetLayerName( ADHESIVE_N_FRONT ) );
|
|
|
|
m_PadLayerAdhCu->SetLabel( m_board->GetLayerName( ADHESIVE_N_BACK ) );
|
|
|
|
m_PadLayerPateCmp->SetLabel( m_board->GetLayerName( SOLDERPASTE_N_FRONT ) );
|
|
|
|
m_PadLayerPateCu->SetLabel( m_board->GetLayerName( SOLDERPASTE_N_BACK ) );
|
|
|
|
m_PadLayerSilkCmp->SetLabel( m_board->GetLayerName( SILKSCREEN_N_FRONT ) );
|
|
|
|
m_PadLayerSilkCu->SetLabel( m_board->GetLayerName( SILKSCREEN_N_BACK ) );
|
|
|
|
m_PadLayerMaskCmp->SetLabel( m_board->GetLayerName( SOLDERMASK_N_FRONT ) );
|
|
|
|
m_PadLayerMaskCu->SetLabel( m_board->GetLayerName( SOLDERMASK_N_BACK ) );
|
|
|
|
m_PadLayerECO1->SetLabel( m_board->GetLayerName( ECO1_N ) );
|
|
|
|
m_PadLayerECO2->SetLabel( m_board->GetLayerName( ECO2_N ) );
|
|
|
|
m_PadLayerDraft->SetLabel( m_board->GetLayerName( DRAW_N ) );
|
2012-03-10 13:00:31 +00:00
|
|
|
|
2010-09-11 16:33:43 +00:00
|
|
|
m_isFlipped = false;
|
2012-02-19 04:02:19 +00:00
|
|
|
|
2013-03-30 09:28:59 +00:00
|
|
|
if( m_currentPad )
|
2010-09-11 16:33:43 +00:00
|
|
|
{
|
2013-03-30 09:28:59 +00:00
|
|
|
MODULE* module = m_currentPad->GetParent();
|
2012-02-19 04:02:19 +00:00
|
|
|
|
|
|
|
if( module->GetLayer() == LAYER_N_BACK )
|
2010-09-11 16:33:43 +00:00
|
|
|
{
|
|
|
|
m_isFlipped = true;
|
|
|
|
m_staticModuleSideValue->SetLabel( _( "Back side (footprint is mirrored)" ) );
|
|
|
|
}
|
2012-02-19 04:02:19 +00:00
|
|
|
|
|
|
|
msg.Printf( wxT( "%.1f" ), (double) module->GetOrientation() / 10 );
|
2010-09-11 16:33:43 +00:00
|
|
|
m_staticModuleRotValue->SetLabel( msg );
|
|
|
|
}
|
2008-11-22 11:10:40 +00:00
|
|
|
|
2010-09-11 16:33:43 +00:00
|
|
|
if( m_isFlipped )
|
|
|
|
{
|
2012-02-19 04:02:19 +00:00
|
|
|
wxPoint pt = m_dummyPad->GetOffset();
|
|
|
|
NEGATE( pt.y );
|
|
|
|
m_dummyPad->SetOffset( pt );
|
|
|
|
|
|
|
|
wxSize sz = m_dummyPad->GetDelta();
|
|
|
|
NEGATE( sz.y );
|
|
|
|
m_dummyPad->SetDelta( sz );
|
|
|
|
|
|
|
|
// flip pad's layers
|
2013-04-05 19:04:58 +00:00
|
|
|
m_dummyPad->SetLayerMask( FlipLayerMask( m_dummyPad->GetLayerMask() ) );
|
2010-09-11 16:33:43 +00:00
|
|
|
}
|
2012-02-19 04:02:19 +00:00
|
|
|
|
2010-09-11 19:15:24 +00:00
|
|
|
m_staticTextWarningPadFlipped->Show(m_isFlipped);
|
2008-11-22 11:10:40 +00:00
|
|
|
|
2011-12-12 08:37:05 +00:00
|
|
|
m_PadNumCtrl->SetValue( m_dummyPad->GetPadName() );
|
2010-09-11 16:33:43 +00:00
|
|
|
m_PadNetNameCtrl->SetValue( m_dummyPad->GetNetname() );
|
2008-11-22 11:10:40 +00:00
|
|
|
|
2009-11-05 20:59:42 +00:00
|
|
|
// Display current unit name in dialog:
|
2012-12-06 21:53:00 +00:00
|
|
|
m_PadPosX_Unit->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) );
|
|
|
|
m_PadPosY_Unit->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) );
|
|
|
|
m_PadDrill_X_Unit->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) );
|
|
|
|
m_PadDrill_Y_Unit->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) );
|
|
|
|
m_PadShapeSizeX_Unit->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) );
|
|
|
|
m_PadShapeSizeY_Unit->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) );
|
|
|
|
m_PadShapeOffsetX_Unit->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) );
|
|
|
|
m_PadShapeOffsetY_Unit->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) );
|
|
|
|
m_PadShapeDelta_Unit->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) );
|
|
|
|
m_PadLengthDie_Unit->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) );
|
2010-09-11 16:33:43 +00:00
|
|
|
|
2009-11-05 20:59:42 +00:00
|
|
|
// Display current pad masks clearances units
|
2012-12-06 21:53:00 +00:00
|
|
|
m_NetClearanceUnits->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) );
|
|
|
|
m_SolderMaskMarginUnits->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) );
|
|
|
|
m_SolderPasteMarginUnits->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) );
|
|
|
|
m_ThermalWidthUnits->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) );
|
|
|
|
m_ThermalGapUnits->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) );
|
2009-11-05 20:59:42 +00:00
|
|
|
|
|
|
|
// Display current pad parameters units:
|
2012-04-13 18:51:24 +00:00
|
|
|
PutValueInLocalUnits( *m_PadPosition_X_Ctrl, m_dummyPad->GetPosition().x );
|
|
|
|
PutValueInLocalUnits( *m_PadPosition_Y_Ctrl, m_dummyPad->GetPosition().y );
|
2010-09-11 16:33:43 +00:00
|
|
|
|
2012-04-13 18:51:24 +00:00
|
|
|
PutValueInLocalUnits( *m_PadDrill_X_Ctrl, m_dummyPad->GetDrillSize().x );
|
|
|
|
PutValueInLocalUnits( *m_PadDrill_Y_Ctrl, m_dummyPad->GetDrillSize().y );
|
2009-11-05 20:59:42 +00:00
|
|
|
|
2012-04-13 18:51:24 +00:00
|
|
|
PutValueInLocalUnits( *m_ShapeSize_X_Ctrl, m_dummyPad->GetSize().x );
|
|
|
|
PutValueInLocalUnits( *m_ShapeSize_Y_Ctrl, m_dummyPad->GetSize().y );
|
2009-11-05 20:59:42 +00:00
|
|
|
|
2012-04-13 18:51:24 +00:00
|
|
|
PutValueInLocalUnits( *m_ShapeOffset_X_Ctrl, m_dummyPad->GetOffset().x );
|
|
|
|
PutValueInLocalUnits( *m_ShapeOffset_Y_Ctrl, m_dummyPad->GetOffset().y );
|
2009-11-05 20:59:42 +00:00
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
if( m_dummyPad->GetDelta().x )
|
2010-09-15 14:53:33 +00:00
|
|
|
{
|
2012-04-13 18:51:24 +00:00
|
|
|
PutValueInLocalUnits( *m_ShapeDelta_Ctrl, m_dummyPad->GetDelta().x );
|
2012-03-08 20:44:03 +00:00
|
|
|
m_trapDeltaDirChoice->SetSelection( 0 );
|
2010-09-15 14:53:33 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-04-13 18:51:24 +00:00
|
|
|
PutValueInLocalUnits( *m_ShapeDelta_Ctrl, m_dummyPad->GetDelta().y );
|
2012-03-08 20:44:03 +00:00
|
|
|
m_trapDeltaDirChoice->SetSelection( 1 );
|
2010-09-15 14:53:33 +00:00
|
|
|
}
|
2009-11-05 20:59:42 +00:00
|
|
|
|
2012-12-12 11:57:17 +00:00
|
|
|
PutValueInLocalUnits( *m_LengthPadToDieCtrl, m_dummyPad->GetPadToDieLength() );
|
2011-08-19 13:08:24 +00:00
|
|
|
|
2012-04-13 18:51:24 +00:00
|
|
|
PutValueInLocalUnits( *m_NetClearanceValueCtrl, m_dummyPad->GetLocalClearance() );
|
|
|
|
PutValueInLocalUnits( *m_SolderMaskMarginCtrl, m_dummyPad->GetLocalSolderMaskMargin() );
|
|
|
|
PutValueInLocalUnits( *m_ThermalWidthCtrl, m_dummyPad->GetThermalWidth() );
|
|
|
|
PutValueInLocalUnits( *m_ThermalGapCtrl, m_dummyPad->GetThermalGap() );
|
2009-11-05 20:59:42 +00:00
|
|
|
|
2009-11-06 12:55:20 +00:00
|
|
|
// These 2 parameters are usually < 0, so prepare entering a negative value, if current is 0
|
2012-04-13 18:51:24 +00:00
|
|
|
PutValueInLocalUnits( *m_SolderPasteMarginCtrl, m_dummyPad->GetLocalSolderPasteMargin() );
|
2012-02-19 04:02:19 +00:00
|
|
|
|
|
|
|
if( m_dummyPad->GetLocalSolderPasteMargin() == 0 )
|
2010-09-11 16:33:43 +00:00
|
|
|
m_SolderPasteMarginCtrl->SetValue( wxT( "-" ) + m_SolderPasteMarginCtrl->GetValue() );
|
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
msg.Printf( wxT( "%.1f" ), m_dummyPad->GetLocalSolderPasteMarginRatio() * 100.0 );
|
|
|
|
|
|
|
|
if( m_dummyPad->GetLocalSolderPasteMarginRatio() == 0.0 && msg[0] == '0' )
|
|
|
|
// Sometimes Printf adds a sign if the value is small
|
2010-09-11 16:33:43 +00:00
|
|
|
m_SolderPasteMarginRatioCtrl->SetValue( wxT( "-" ) + msg );
|
2009-11-06 12:55:20 +00:00
|
|
|
else
|
2010-01-31 20:01:46 +00:00
|
|
|
m_SolderPasteMarginRatioCtrl->SetValue( msg );
|
2008-11-22 11:10:40 +00:00
|
|
|
|
2012-02-24 23:23:46 +00:00
|
|
|
switch( m_dummyPad->GetZoneConnection() )
|
|
|
|
{
|
|
|
|
default:
|
|
|
|
case UNDEFINED_CONNECTION:
|
|
|
|
m_ZoneConnectionChoice->SetSelection( 0 );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PAD_IN_ZONE:
|
|
|
|
m_ZoneConnectionChoice->SetSelection( 1 );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case THERMAL_PAD:
|
|
|
|
m_ZoneConnectionChoice->SetSelection( 2 );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PAD_NOT_IN_ZONE:
|
|
|
|
m_ZoneConnectionChoice->SetSelection( 3 );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2013-03-30 09:28:59 +00:00
|
|
|
if( m_currentPad )
|
2008-11-22 11:10:40 +00:00
|
|
|
{
|
2013-03-30 09:28:59 +00:00
|
|
|
MODULE* module = m_currentPad->GetParent();
|
2012-02-19 04:02:19 +00:00
|
|
|
|
2013-03-30 09:28:59 +00:00
|
|
|
angle = m_currentPad->GetOrientation() - module->GetOrientation();
|
2012-02-19 04:02:19 +00:00
|
|
|
|
2010-09-11 16:33:43 +00:00
|
|
|
if( m_isFlipped )
|
2012-02-19 04:02:19 +00:00
|
|
|
NEGATE( angle );
|
|
|
|
|
|
|
|
m_dummyPad->SetOrientation( angle );
|
2008-11-22 11:10:40 +00:00
|
|
|
}
|
2010-09-11 16:33:43 +00:00
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
angle = m_dummyPad->GetOrientation();
|
2010-09-11 16:33:43 +00:00
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
NORMALIZE_ANGLE_180( angle ); // ? normalizing is in D_PAD::SetOrientation()
|
2010-09-11 16:33:43 +00:00
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
// Set layers used by this pad: :
|
2012-04-11 23:30:06 +00:00
|
|
|
setPadLayersList( m_dummyPad->GetLayerMask() );
|
2008-11-22 11:10:40 +00:00
|
|
|
|
|
|
|
// Pad Orient
|
2012-02-19 04:02:19 +00:00
|
|
|
switch( int( angle ) )
|
2008-11-22 11:10:40 +00:00
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
m_PadOrient->SetSelection( 0 );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 900:
|
|
|
|
m_PadOrient->SetSelection( 1 );
|
|
|
|
break;
|
|
|
|
|
2012-03-08 20:44:03 +00:00
|
|
|
case -900:
|
2008-11-22 11:10:40 +00:00
|
|
|
m_PadOrient->SetSelection( 2 );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 1800:
|
2011-12-31 05:44:00 +00:00
|
|
|
case -1800:
|
2008-11-22 11:10:40 +00:00
|
|
|
m_PadOrient->SetSelection( 3 );
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
m_PadOrient->SetSelection( 4 );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
switch( m_dummyPad->GetShape() )
|
2008-11-22 11:10:40 +00:00
|
|
|
{
|
|
|
|
default:
|
|
|
|
case PAD_CIRCLE:
|
|
|
|
m_PadShape->SetSelection( 0 );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PAD_OVAL:
|
|
|
|
m_PadShape->SetSelection( 1 );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PAD_RECT:
|
|
|
|
m_PadShape->SetSelection( 2 );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PAD_TRAPEZOID:
|
|
|
|
m_PadShape->SetSelection( 3 );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
msg.Printf( wxT( "%g" ), angle );
|
2010-09-11 16:33:43 +00:00
|
|
|
m_PadOrientCtrl->SetValue( msg );
|
2008-11-22 11:10:40 +00:00
|
|
|
|
2011-08-19 13:08:24 +00:00
|
|
|
// Type of pad selection
|
2008-11-22 11:10:40 +00:00
|
|
|
m_PadType->SetSelection( 0 );
|
2012-02-19 04:02:19 +00:00
|
|
|
|
2012-03-19 16:29:24 +00:00
|
|
|
for( unsigned ii = 0; ii < NBTYPES; ii++ )
|
2008-11-22 11:10:40 +00:00
|
|
|
{
|
2012-02-19 04:02:19 +00:00
|
|
|
if( CodeType[ii] == m_dummyPad->GetAttribute() )
|
2008-11-22 11:10:40 +00:00
|
|
|
{
|
2010-09-11 16:33:43 +00:00
|
|
|
m_PadType->SetSelection( ii );
|
|
|
|
break;
|
2008-11-22 11:10:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-08-19 13:08:24 +00:00
|
|
|
// Enable/disable Pad name,and pad length die
|
|
|
|
// (disable for NPTH pads (mechanical pads)
|
2012-02-19 04:02:19 +00:00
|
|
|
bool enable = m_dummyPad->GetAttribute() != PAD_HOLE_NOT_PLATED;
|
|
|
|
|
2011-08-19 13:08:24 +00:00
|
|
|
m_PadNumCtrl->Enable( enable );
|
|
|
|
m_PadNetNameCtrl->Enable( enable );
|
2012-12-12 11:57:17 +00:00
|
|
|
m_LengthPadToDieCtrl->Enable( enable );
|
2011-08-19 13:08:24 +00:00
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
if( m_dummyPad->GetDrillShape() != PAD_OVAL )
|
2008-11-22 11:10:40 +00:00
|
|
|
m_DrillShapeCtrl->SetSelection( 0 );
|
|
|
|
else
|
|
|
|
m_DrillShapeCtrl->SetSelection( 1 );
|
2010-03-01 17:48:17 +00:00
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
// Update some dialog widgets state (Enable/disable options):
|
2010-09-11 16:33:43 +00:00
|
|
|
wxCommandEvent cmd_event;
|
2012-04-11 23:30:06 +00:00
|
|
|
setPadLayersList( m_dummyPad->GetLayerMask() );
|
2010-09-11 16:33:43 +00:00
|
|
|
OnDrillShapeSelected( cmd_event );
|
2012-06-25 20:59:19 +00:00
|
|
|
OnPadShapeSelection( cmd_event );
|
2008-11-22 11:10:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-05 20:59:42 +00:00
|
|
|
void DIALOG_PAD_PROPERTIES::OnPadShapeSelection( wxCommandEvent& event )
|
2008-11-22 11:10:40 +00:00
|
|
|
{
|
|
|
|
switch( m_PadShape->GetSelection() )
|
|
|
|
{
|
2012-04-11 23:30:06 +00:00
|
|
|
case 0: // CIRCLE:
|
2010-09-15 14:53:33 +00:00
|
|
|
m_ShapeDelta_Ctrl->Enable( false );
|
2012-03-08 20:44:03 +00:00
|
|
|
m_trapDeltaDirChoice->Enable( false );
|
2009-11-05 20:59:42 +00:00
|
|
|
m_ShapeSize_Y_Ctrl->Enable( false );
|
2012-03-08 20:44:03 +00:00
|
|
|
m_ShapeOffset_X_Ctrl->Enable( false );
|
|
|
|
m_ShapeOffset_Y_Ctrl->Enable( false );
|
2008-11-22 11:10:40 +00:00
|
|
|
break;
|
|
|
|
|
2012-04-11 23:30:06 +00:00
|
|
|
case 1: // OVAL:
|
2010-09-15 14:53:33 +00:00
|
|
|
m_ShapeDelta_Ctrl->Enable( false );
|
2012-03-08 20:44:03 +00:00
|
|
|
m_trapDeltaDirChoice->Enable( false );
|
2009-11-05 20:59:42 +00:00
|
|
|
m_ShapeSize_Y_Ctrl->Enable( true );
|
2012-03-08 20:44:03 +00:00
|
|
|
m_ShapeOffset_X_Ctrl->Enable( true );
|
|
|
|
m_ShapeOffset_Y_Ctrl->Enable( true );
|
2008-11-22 11:10:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 2: // PAD_RECT:
|
2010-09-15 14:53:33 +00:00
|
|
|
m_ShapeDelta_Ctrl->Enable( false );
|
2012-03-08 20:44:03 +00:00
|
|
|
m_trapDeltaDirChoice->Enable( false );
|
2009-11-05 20:59:42 +00:00
|
|
|
m_ShapeSize_Y_Ctrl->Enable( true );
|
2012-03-08 20:44:03 +00:00
|
|
|
m_ShapeOffset_X_Ctrl->Enable( true );
|
|
|
|
m_ShapeOffset_Y_Ctrl->Enable( true );
|
2008-11-22 11:10:40 +00:00
|
|
|
break;
|
|
|
|
|
2012-04-11 23:30:06 +00:00
|
|
|
case 3: // TRAPEZOID:
|
2010-09-15 14:53:33 +00:00
|
|
|
m_ShapeDelta_Ctrl->Enable( true );
|
2012-03-08 20:44:03 +00:00
|
|
|
m_trapDeltaDirChoice->Enable( true );
|
2009-11-05 20:59:42 +00:00
|
|
|
m_ShapeSize_Y_Ctrl->Enable( true );
|
2012-03-08 20:44:03 +00:00
|
|
|
m_ShapeOffset_X_Ctrl->Enable( true );
|
|
|
|
m_ShapeOffset_Y_Ctrl->Enable( true );
|
2008-11-22 11:10:40 +00:00
|
|
|
break;
|
|
|
|
}
|
2010-09-11 16:33:43 +00:00
|
|
|
|
2012-04-11 23:30:06 +00:00
|
|
|
transferDataToPad( m_dummyPad );
|
2010-09-11 16:33:43 +00:00
|
|
|
m_panelShowPad->Refresh();
|
2008-11-22 11:10:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-05 20:59:42 +00:00
|
|
|
void DIALOG_PAD_PROPERTIES::OnDrillShapeSelected( wxCommandEvent& event )
|
2008-11-22 11:10:40 +00:00
|
|
|
{
|
2012-02-19 04:02:19 +00:00
|
|
|
if( m_PadType->GetSelection() == 1 || m_PadType->GetSelection() == 2 )
|
2010-09-11 16:33:43 +00:00
|
|
|
{
|
|
|
|
// pad type = SMD or CONN: no hole allowed
|
2009-11-05 20:59:42 +00:00
|
|
|
m_PadDrill_X_Ctrl->Enable( false );
|
|
|
|
m_PadDrill_Y_Ctrl->Enable( false );
|
2008-11-22 11:10:40 +00:00
|
|
|
}
|
2010-09-11 16:33:43 +00:00
|
|
|
else
|
2008-11-22 11:10:40 +00:00
|
|
|
{
|
2010-09-11 16:33:43 +00:00
|
|
|
switch( m_DrillShapeCtrl->GetSelection() )
|
|
|
|
{
|
|
|
|
case 0: //CIRCLE:
|
|
|
|
m_PadDrill_X_Ctrl->Enable( true );
|
|
|
|
m_PadDrill_Y_Ctrl->Enable( false );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 1: //OVALE:
|
|
|
|
m_PadDrill_X_Ctrl->Enable( true );
|
|
|
|
m_PadDrill_Y_Ctrl->Enable( true );
|
|
|
|
break;
|
|
|
|
}
|
2008-11-22 11:10:40 +00:00
|
|
|
}
|
2010-09-11 16:33:43 +00:00
|
|
|
|
2012-04-11 23:30:06 +00:00
|
|
|
transferDataToPad( m_dummyPad );
|
2010-09-11 16:33:43 +00:00
|
|
|
m_panelShowPad->Refresh();
|
2008-11-22 11:10:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-05 20:59:42 +00:00
|
|
|
void DIALOG_PAD_PROPERTIES::PadOrientEvent( wxCommandEvent& event )
|
2008-11-22 11:10:40 +00:00
|
|
|
{
|
|
|
|
switch( m_PadOrient->GetSelection() )
|
|
|
|
{
|
|
|
|
case 0:
|
2012-02-19 04:02:19 +00:00
|
|
|
m_dummyPad->SetOrientation( 0 );
|
2008-11-22 11:10:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
2012-02-19 04:02:19 +00:00
|
|
|
m_dummyPad->SetOrientation( 900 );
|
2008-11-22 11:10:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
2012-02-19 04:02:19 +00:00
|
|
|
m_dummyPad->SetOrientation( -900 );
|
2008-11-22 11:10:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
2012-02-19 04:02:19 +00:00
|
|
|
m_dummyPad->SetOrientation( 1800 );
|
2008-11-22 11:10:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2010-09-11 16:33:43 +00:00
|
|
|
|
|
|
|
wxString msg;
|
2012-01-04 06:18:38 +00:00
|
|
|
msg.Printf( wxT( "%g" ), m_dummyPad->GetOrientation() );
|
2010-09-11 16:33:43 +00:00
|
|
|
m_PadOrientCtrl->SetValue( msg );
|
|
|
|
|
2012-04-11 23:30:06 +00:00
|
|
|
transferDataToPad( m_dummyPad );
|
2010-09-11 16:33:43 +00:00
|
|
|
m_panelShowPad->Refresh();
|
2008-11-22 11:10:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-05 20:59:42 +00:00
|
|
|
void DIALOG_PAD_PROPERTIES::PadTypeSelected( wxCommandEvent& event )
|
2008-11-22 11:10:40 +00:00
|
|
|
{
|
2012-03-19 16:29:24 +00:00
|
|
|
unsigned ii = m_PadType->GetSelection();
|
2008-11-22 11:10:40 +00:00
|
|
|
|
2012-03-19 16:29:24 +00:00
|
|
|
if( ii >= NBTYPES ) // catches < 0 also
|
2008-11-22 11:10:40 +00:00
|
|
|
ii = 0;
|
|
|
|
|
2013-03-30 17:24:04 +00:00
|
|
|
LAYER_MSK layer_mask = Std_Pad_Layers[ii];
|
2012-04-11 23:30:06 +00:00
|
|
|
setPadLayersList( layer_mask );
|
2008-11-22 11:10:40 +00:00
|
|
|
|
|
|
|
// Enable/disable drill dialog items:
|
2010-09-11 16:33:43 +00:00
|
|
|
event.SetId( m_DrillShapeCtrl->GetSelection() );
|
2008-11-22 11:10:40 +00:00
|
|
|
OnDrillShapeSelected( event );
|
2012-03-17 02:11:44 +00:00
|
|
|
|
2012-03-08 20:44:03 +00:00
|
|
|
if( ii == 0 || ii == NBTYPES-1 )
|
|
|
|
m_DrillShapeCtrl->Enable( true );
|
|
|
|
else
|
|
|
|
m_DrillShapeCtrl->Enable( false );
|
2011-08-19 13:08:24 +00:00
|
|
|
|
|
|
|
// Enable/disable Pad name,and pad length die
|
|
|
|
// (disable for NPTH pads (mechanical pads)
|
|
|
|
bool enable = ii != 3;
|
|
|
|
m_PadNumCtrl->Enable( enable );
|
|
|
|
m_PadNetNameCtrl->Enable( enable );
|
2012-12-12 11:57:17 +00:00
|
|
|
m_LengthPadToDieCtrl->Enable( enable );
|
2008-11-22 11:10:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-03-30 17:24:04 +00:00
|
|
|
void DIALOG_PAD_PROPERTIES::setPadLayersList( LAYER_MSK layer_mask )
|
2008-11-22 11:10:40 +00:00
|
|
|
{
|
2012-03-19 16:29:24 +00:00
|
|
|
if( ( layer_mask & ALL_CU_LAYERS ) == LAYER_FRONT )
|
2011-08-19 13:08:24 +00:00
|
|
|
m_rbCopperLayersSel->SetSelection(0);
|
|
|
|
else if( ( layer_mask & ALL_CU_LAYERS ) == LAYER_BACK)
|
|
|
|
m_rbCopperLayersSel->SetSelection(1);
|
2012-03-19 16:29:24 +00:00
|
|
|
else if( ( layer_mask & ALL_CU_LAYERS ) != 0 )
|
2011-08-19 13:08:24 +00:00
|
|
|
m_rbCopperLayersSel->SetSelection(2);
|
|
|
|
else
|
|
|
|
m_rbCopperLayersSel->SetSelection(3);
|
2008-11-22 11:10:40 +00:00
|
|
|
|
2012-03-17 02:11:44 +00:00
|
|
|
m_PadLayerAdhCmp->SetValue( bool( layer_mask & ADHESIVE_LAYER_FRONT ) );
|
|
|
|
m_PadLayerAdhCu->SetValue( bool( layer_mask & ADHESIVE_LAYER_BACK ) );
|
2008-11-22 11:10:40 +00:00
|
|
|
|
2012-03-17 02:11:44 +00:00
|
|
|
m_PadLayerPateCmp->SetValue( bool( layer_mask & SOLDERPASTE_LAYER_FRONT ) );
|
|
|
|
m_PadLayerPateCu->SetValue( bool( layer_mask & SOLDERPASTE_LAYER_BACK ) );
|
2008-11-22 11:10:40 +00:00
|
|
|
|
2012-03-17 02:11:44 +00:00
|
|
|
m_PadLayerSilkCmp->SetValue( bool( layer_mask & SILKSCREEN_LAYER_FRONT ) );
|
|
|
|
m_PadLayerSilkCu->SetValue( bool( layer_mask & SILKSCREEN_LAYER_BACK ) );
|
2008-11-22 11:10:40 +00:00
|
|
|
|
2012-03-17 02:11:44 +00:00
|
|
|
m_PadLayerMaskCmp->SetValue( bool( layer_mask & SOLDERMASK_LAYER_FRONT ) );
|
|
|
|
m_PadLayerMaskCu->SetValue( bool( layer_mask & SOLDERMASK_LAYER_BACK ) );
|
2008-11-22 11:10:40 +00:00
|
|
|
|
2012-03-17 02:11:44 +00:00
|
|
|
m_PadLayerECO1->SetValue( bool( layer_mask & ECO1_LAYER ) );
|
|
|
|
m_PadLayerECO2->SetValue( bool( layer_mask & ECO2_LAYER ) );
|
2008-11-22 11:10:40 +00:00
|
|
|
|
2012-03-17 02:11:44 +00:00
|
|
|
m_PadLayerDraft->SetValue( bool( layer_mask & DRAW_LAYER ) );
|
2008-11-22 11:10:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-09-11 16:33:43 +00:00
|
|
|
// Called when select/deselect a layer.
|
2011-08-19 13:08:24 +00:00
|
|
|
void DIALOG_PAD_PROPERTIES::OnSetLayers( wxCommandEvent& event )
|
2010-09-11 16:33:43 +00:00
|
|
|
{
|
2012-04-11 23:30:06 +00:00
|
|
|
transferDataToPad( m_dummyPad );
|
2010-09-11 16:33:43 +00:00
|
|
|
m_panelShowPad->Refresh();
|
|
|
|
}
|
|
|
|
|
2012-03-17 02:11:44 +00:00
|
|
|
|
2012-03-10 13:00:31 +00:00
|
|
|
// test if all values are acceptable for the pad
|
2012-04-11 23:30:06 +00:00
|
|
|
bool DIALOG_PAD_PROPERTIES::padValuesOK()
|
2012-03-10 13:00:31 +00:00
|
|
|
{
|
2012-04-11 23:30:06 +00:00
|
|
|
bool error = transferDataToPad( m_dummyPad );
|
2012-03-10 13:00:31 +00:00
|
|
|
|
|
|
|
wxArrayString error_msgs;
|
|
|
|
wxString msg;
|
|
|
|
|
|
|
|
// Test for incorrect values
|
|
|
|
if( (m_dummyPad->GetSize().x < m_dummyPad->GetDrillSize().x) ||
|
|
|
|
(m_dummyPad->GetSize().y < m_dummyPad->GetDrillSize().y) )
|
|
|
|
{
|
|
|
|
error_msgs.Add( _( "Incorrect value for pad drill: pad drill bigger than pad size" ) );
|
|
|
|
}
|
|
|
|
|
2013-03-30 17:24:04 +00:00
|
|
|
LAYER_MSK padlayers_mask = m_dummyPad->GetLayerMask();
|
2012-03-10 13:00:31 +00:00
|
|
|
if( ( padlayers_mask == 0 ) && ( m_dummyPad->GetAttribute() != PAD_HOLE_NOT_PLATED ) )
|
|
|
|
error_msgs.Add( _( "Error: pad has no layer and is not a mechanical pad" ) );
|
|
|
|
|
|
|
|
padlayers_mask &= (LAYER_BACK | LAYER_FRONT);
|
|
|
|
if( padlayers_mask == 0 )
|
|
|
|
{
|
|
|
|
if( m_dummyPad->GetDrillSize().x || m_dummyPad->GetDrillSize().y )
|
|
|
|
{
|
|
|
|
msg = _( "Error: pad is not on a copper layer and has a hole" );
|
|
|
|
if( m_dummyPad->GetAttribute() == PAD_HOLE_NOT_PLATED )
|
|
|
|
{
|
|
|
|
msg += wxT("\n");
|
|
|
|
msg += _( "For NPTH pad, set pad drill value to pad size value,\n\
|
|
|
|
if you do not want this pad plotted in gerber files");
|
|
|
|
}
|
|
|
|
error_msgs.Add( msg );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-03-20 20:22:38 +00:00
|
|
|
wxPoint max_size;
|
2012-09-22 11:19:37 +00:00
|
|
|
max_size.x = std::abs( m_dummyPad->GetOffset().x );
|
|
|
|
max_size.y = std::abs( m_dummyPad->GetOffset().y );
|
2012-03-20 20:22:38 +00:00
|
|
|
max_size.x += m_dummyPad->GetDrillSize().x / 2;
|
|
|
|
max_size.y += m_dummyPad->GetDrillSize().y / 2;
|
2012-03-24 14:25:30 +00:00
|
|
|
if( ( m_dummyPad->GetSize().x / 2 < max_size.x ) ||
|
|
|
|
( m_dummyPad->GetSize().y / 2 < max_size.y ) )
|
2012-03-10 13:00:31 +00:00
|
|
|
{
|
|
|
|
error_msgs.Add( _( "Incorrect value for pad offset" ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
if( error )
|
|
|
|
{
|
|
|
|
error_msgs.Add( _( "Too large value for pad delta size" ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
switch( m_dummyPad->GetAttribute() )
|
|
|
|
{
|
|
|
|
case PAD_STANDARD : // Pad through hole, a hole is expected
|
|
|
|
if( m_dummyPad->GetDrillSize().x <= 0 )
|
|
|
|
error_msgs.Add( _( "Incorrect value for pad drill (too small value)" ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PAD_SMD: // SMD and Connector pads (One external copper layer only)
|
|
|
|
case PAD_CONN:
|
|
|
|
if( (padlayers_mask & LAYER_BACK) && (padlayers_mask & LAYER_FRONT) )
|
|
|
|
error_msgs.Add( _( "Error: only one copper layer allowed for this pad" ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PAD_HOLE_NOT_PLATED: // Not plated
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( error_msgs.GetCount() )
|
|
|
|
{
|
|
|
|
HTML_MESSAGE_BOX dlg( this, _("Pad setup errors list" ) );
|
|
|
|
dlg.ListSet( error_msgs );
|
|
|
|
dlg.ShowModal();
|
|
|
|
}
|
|
|
|
return error_msgs.GetCount() == 0;
|
|
|
|
}
|
2010-09-11 16:33:43 +00:00
|
|
|
|
2008-11-22 11:10:40 +00:00
|
|
|
|
2012-03-17 02:11:44 +00:00
|
|
|
void DIALOG_PAD_PROPERTIES::PadPropertiesAccept( wxCommandEvent& event )
|
2008-11-22 11:10:40 +00:00
|
|
|
{
|
2012-04-11 23:30:06 +00:00
|
|
|
if( !padValuesOK() )
|
2012-03-10 13:00:31 +00:00
|
|
|
return;
|
|
|
|
|
2010-09-11 16:33:43 +00:00
|
|
|
bool rastnestIsChanged = false;
|
|
|
|
int isign = m_isFlipped ? -1 : 1;
|
|
|
|
|
2013-03-30 09:28:59 +00:00
|
|
|
transferDataToPad( &m_padMaster );
|
2010-09-11 16:33:43 +00:00
|
|
|
|
2013-03-30 09:28:59 +00:00
|
|
|
if( m_currentPad ) // Set current Pad parameters
|
2010-09-11 16:33:43 +00:00
|
|
|
{
|
2012-02-19 04:02:19 +00:00
|
|
|
wxSize size;
|
2013-03-30 09:28:59 +00:00
|
|
|
MODULE* module = m_currentPad->GetParent();
|
2012-02-19 04:02:19 +00:00
|
|
|
|
2013-03-30 09:28:59 +00:00
|
|
|
m_parent->SaveCopyInUndoList( module, UR_CHANGED );
|
2012-09-05 12:13:33 +00:00
|
|
|
module->SetLastEditTime();
|
2010-09-11 16:33:43 +00:00
|
|
|
|
|
|
|
// redraw the area where the pad was, without pad (delete pad on screen)
|
2013-03-30 09:28:59 +00:00
|
|
|
m_currentPad->SetFlags( DO_NOT_DRAW );
|
|
|
|
m_parent->GetCanvas()->RefreshDrawingRect( m_currentPad->GetBoundingBox() );
|
|
|
|
m_currentPad->ClearFlags( DO_NOT_DRAW );
|
2010-09-11 16:33:43 +00:00
|
|
|
|
|
|
|
// Update values
|
2013-03-30 09:28:59 +00:00
|
|
|
m_currentPad->SetShape( m_padMaster.GetShape() );
|
|
|
|
m_currentPad->SetAttribute( m_padMaster.GetAttribute() );
|
2011-12-21 13:42:02 +00:00
|
|
|
|
2013-03-30 09:28:59 +00:00
|
|
|
if( m_currentPad->GetPosition() != m_padMaster.GetPosition() )
|
2010-09-11 16:33:43 +00:00
|
|
|
{
|
2013-03-30 09:28:59 +00:00
|
|
|
m_currentPad->SetPosition( m_padMaster.GetPosition() );
|
2012-02-19 04:02:19 +00:00
|
|
|
rastnestIsChanged = true;
|
2010-09-11 16:33:43 +00:00
|
|
|
}
|
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
// compute the pos 0 value, i.e. pad position for module with orientation = 0
|
|
|
|
// i.e. relative to module origin (module position)
|
2013-03-30 09:28:59 +00:00
|
|
|
wxPoint pt = m_currentPad->GetPosition() - module->GetPosition();
|
2012-02-19 04:02:19 +00:00
|
|
|
|
|
|
|
RotatePoint( &pt, -module->GetOrientation() );
|
|
|
|
|
2013-03-30 09:28:59 +00:00
|
|
|
m_currentPad->SetPos0( pt );
|
2012-02-19 04:02:19 +00:00
|
|
|
|
2013-03-30 09:28:59 +00:00
|
|
|
m_currentPad->SetOrientation( m_padMaster.GetOrientation() * isign + module->GetOrientation() );
|
2012-02-19 04:02:19 +00:00
|
|
|
|
2013-03-30 09:28:59 +00:00
|
|
|
m_currentPad->SetSize( m_padMaster.GetSize() );
|
2010-09-11 16:33:43 +00:00
|
|
|
|
2013-03-30 09:28:59 +00:00
|
|
|
size = m_padMaster.GetDelta();
|
2012-02-19 04:02:19 +00:00
|
|
|
size.y *= isign;
|
2013-03-30 09:28:59 +00:00
|
|
|
m_currentPad->SetDelta( size );
|
2011-08-19 13:08:24 +00:00
|
|
|
|
2013-03-30 09:28:59 +00:00
|
|
|
m_currentPad->SetDrillSize( m_padMaster.GetDrillSize() );
|
|
|
|
m_currentPad->SetDrillShape( m_padMaster.GetDrillShape() );
|
2011-08-19 13:08:24 +00:00
|
|
|
|
2013-03-30 09:28:59 +00:00
|
|
|
wxPoint offset = m_padMaster.GetOffset();
|
2012-02-19 04:02:19 +00:00
|
|
|
offset.y *= isign;
|
2013-03-30 09:28:59 +00:00
|
|
|
m_currentPad->SetOffset( offset );
|
2012-02-19 04:02:19 +00:00
|
|
|
|
2013-03-30 09:28:59 +00:00
|
|
|
m_currentPad->SetPadToDieLength( m_padMaster.GetPadToDieLength() );
|
2012-02-19 04:02:19 +00:00
|
|
|
|
2013-03-30 09:28:59 +00:00
|
|
|
if( m_currentPad->GetLayerMask() != m_padMaster.GetLayerMask() )
|
2010-09-11 16:33:43 +00:00
|
|
|
{
|
|
|
|
rastnestIsChanged = true;
|
2013-03-30 09:28:59 +00:00
|
|
|
m_currentPad->SetLayerMask( m_padMaster.GetLayerMask() );
|
2010-09-11 16:33:43 +00:00
|
|
|
}
|
2012-02-19 04:02:19 +00:00
|
|
|
|
2010-09-11 16:33:43 +00:00
|
|
|
if( m_isFlipped )
|
2013-04-05 19:04:58 +00:00
|
|
|
m_currentPad->SetLayerMask( FlipLayerMask( m_currentPad->GetLayerMask() ) );
|
2010-09-11 16:33:43 +00:00
|
|
|
|
2013-03-30 09:28:59 +00:00
|
|
|
m_currentPad->SetPadName( m_padMaster.GetPadName() );
|
2010-09-11 16:33:43 +00:00
|
|
|
|
2013-03-30 09:28:59 +00:00
|
|
|
if( m_currentPad->GetNetname() != m_padMaster.GetNetname() )
|
2010-09-11 16:33:43 +00:00
|
|
|
{
|
2013-03-30 09:28:59 +00:00
|
|
|
if( m_padMaster.GetNetname().IsEmpty() )
|
2010-09-11 16:33:43 +00:00
|
|
|
{
|
|
|
|
rastnestIsChanged = true;
|
2013-03-30 09:28:59 +00:00
|
|
|
m_currentPad->SetNet( 0 );
|
|
|
|
m_currentPad->SetNetname( wxEmptyString );
|
2010-09-11 16:33:43 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-03-30 09:28:59 +00:00
|
|
|
const NETINFO_ITEM* net = m_board->FindNet( m_padMaster.GetNetname() );
|
2010-09-11 16:33:43 +00:00
|
|
|
if( net )
|
|
|
|
{
|
|
|
|
rastnestIsChanged = true;
|
2013-03-30 09:28:59 +00:00
|
|
|
m_currentPad->SetNetname( m_padMaster.GetNetname() );
|
|
|
|
m_currentPad->SetNet( net->GetNet() );
|
2010-09-11 16:33:43 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
DisplayError( NULL, _( "Unknown netname, netname not changed" ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-30 09:28:59 +00:00
|
|
|
m_currentPad->SetLocalClearance( m_padMaster.GetLocalClearance() );
|
|
|
|
m_currentPad->SetLocalSolderMaskMargin( m_padMaster.GetLocalSolderMaskMargin() );
|
|
|
|
m_currentPad->SetLocalSolderPasteMargin( m_padMaster.GetLocalSolderPasteMargin() );
|
|
|
|
m_currentPad->SetLocalSolderPasteMarginRatio( m_padMaster.GetLocalSolderPasteMarginRatio() );
|
|
|
|
m_currentPad->SetZoneConnection( m_padMaster.GetZoneConnection() );
|
|
|
|
m_currentPad->SetThermalWidth( m_padMaster.GetThermalWidth() );
|
|
|
|
m_currentPad->SetThermalGap( m_padMaster.GetThermalGap() );
|
2010-09-11 16:33:43 +00:00
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
module->CalculateBoundingBox();
|
2013-03-30 09:28:59 +00:00
|
|
|
m_parent->SetMsgPanel( m_currentPad );
|
2010-09-11 16:33:43 +00:00
|
|
|
|
|
|
|
// redraw the area where the pad was
|
2013-03-30 09:28:59 +00:00
|
|
|
m_parent->GetCanvas()->RefreshDrawingRect( m_currentPad->GetBoundingBox() );
|
|
|
|
m_parent->OnModify();
|
2010-09-11 16:33:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
EndModal( wxID_OK );
|
|
|
|
|
|
|
|
if( rastnestIsChanged ) // The net ratsnest must be recalculated
|
2013-03-30 09:28:59 +00:00
|
|
|
m_board->m_Status_Pcb = 0;
|
2010-09-11 16:33:43 +00:00
|
|
|
}
|
|
|
|
|
2012-04-11 23:51:16 +00:00
|
|
|
|
2012-04-11 23:30:06 +00:00
|
|
|
bool DIALOG_PAD_PROPERTIES::transferDataToPad( D_PAD* aPad )
|
2010-09-11 16:33:43 +00:00
|
|
|
{
|
2012-02-19 04:02:19 +00:00
|
|
|
wxString msg;
|
|
|
|
int x, y;
|
2008-11-22 11:10:40 +00:00
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
aPad->SetAttribute( CodeType[m_PadType->GetSelection()] );
|
|
|
|
aPad->SetShape( CodeShape[m_PadShape->GetSelection()] );
|
2009-11-05 20:59:42 +00:00
|
|
|
|
|
|
|
// Read pad clearances values:
|
2012-04-16 17:39:32 +00:00
|
|
|
aPad->SetLocalClearance( ReturnValueFromTextCtrl( *m_NetClearanceValueCtrl ) );
|
|
|
|
aPad->SetLocalSolderMaskMargin( ReturnValueFromTextCtrl( *m_SolderMaskMarginCtrl ) );
|
|
|
|
aPad->SetLocalSolderPasteMargin( ReturnValueFromTextCtrl( *m_SolderPasteMarginCtrl ) );
|
|
|
|
aPad->SetThermalWidth( ReturnValueFromTextCtrl( *m_ThermalWidthCtrl ) );
|
|
|
|
aPad->SetThermalGap( ReturnValueFromTextCtrl( *m_ThermalGapCtrl ) );
|
2010-09-11 16:33:43 +00:00
|
|
|
double dtmp = 0.0;
|
2009-11-05 20:59:42 +00:00
|
|
|
msg = m_SolderPasteMarginRatioCtrl->GetValue();
|
|
|
|
msg.ToDouble( &dtmp );
|
2010-09-11 16:33:43 +00:00
|
|
|
|
2012-05-18 08:33:57 +00:00
|
|
|
// A -50% margin ratio means no paste on a pad, the ratio must be >= -50%
|
|
|
|
if( dtmp < -50.0 )
|
|
|
|
dtmp = -50.0;
|
|
|
|
// A margin ratio is always <= 0
|
|
|
|
// 0 means use full pad copper area
|
|
|
|
if( dtmp > 0.0 )
|
|
|
|
dtmp = 0.0;
|
2012-02-19 04:02:19 +00:00
|
|
|
|
|
|
|
aPad->SetLocalSolderPasteMarginRatio( dtmp / 100 );
|
2009-11-05 20:59:42 +00:00
|
|
|
|
2012-02-24 23:23:46 +00:00
|
|
|
switch( m_ZoneConnectionChoice->GetSelection() )
|
|
|
|
{
|
|
|
|
default:
|
|
|
|
case 0:
|
|
|
|
aPad->SetZoneConnection( UNDEFINED_CONNECTION );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
aPad->SetZoneConnection( PAD_IN_ZONE );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
aPad->SetZoneConnection( THERMAL_PAD );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
|
|
|
aPad->SetZoneConnection( PAD_NOT_IN_ZONE );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2009-11-05 20:59:42 +00:00
|
|
|
// Read pad position:
|
2012-04-16 17:39:32 +00:00
|
|
|
x = ReturnValueFromTextCtrl( *m_PadPosition_X_Ctrl );
|
|
|
|
y = ReturnValueFromTextCtrl( *m_PadPosition_Y_Ctrl );
|
2012-02-19 04:02:19 +00:00
|
|
|
|
|
|
|
aPad->SetPosition( wxPoint( x, y ) );
|
|
|
|
aPad->SetPos0( wxPoint( x, y ) );
|
2009-11-05 20:59:42 +00:00
|
|
|
|
|
|
|
// Read pad drill:
|
2012-04-16 17:39:32 +00:00
|
|
|
x = ReturnValueFromTextCtrl( *m_PadDrill_X_Ctrl );
|
|
|
|
y = ReturnValueFromTextCtrl( *m_PadDrill_Y_Ctrl );
|
2012-02-19 04:02:19 +00:00
|
|
|
|
2008-11-22 11:10:40 +00:00
|
|
|
if( m_DrillShapeCtrl->GetSelection() == 0 )
|
|
|
|
{
|
2012-02-19 04:02:19 +00:00
|
|
|
aPad->SetDrillShape( PAD_CIRCLE );
|
|
|
|
y = x;
|
2008-11-22 11:10:40 +00:00
|
|
|
}
|
|
|
|
else
|
2012-02-19 04:02:19 +00:00
|
|
|
aPad->SetDrillShape( PAD_OVAL );
|
|
|
|
|
|
|
|
aPad->SetDrillSize( wxSize( x, y ) );
|
2009-11-05 20:59:42 +00:00
|
|
|
|
|
|
|
// Read pad shape size:
|
2012-04-16 17:39:32 +00:00
|
|
|
x = ReturnValueFromTextCtrl( *m_ShapeSize_X_Ctrl );
|
|
|
|
y = ReturnValueFromTextCtrl( *m_ShapeSize_Y_Ctrl );
|
2012-02-19 04:02:19 +00:00
|
|
|
if( aPad->GetShape() == PAD_CIRCLE )
|
|
|
|
y = x;
|
|
|
|
|
|
|
|
aPad->SetSize( wxSize( x, y ) );
|
|
|
|
|
|
|
|
// Read pad length die
|
2012-12-12 11:57:17 +00:00
|
|
|
aPad->SetPadToDieLength( ReturnValueFromTextCtrl( *m_LengthPadToDieCtrl ) );
|
2009-11-05 20:59:42 +00:00
|
|
|
|
|
|
|
// Read pad shape delta size:
|
2010-09-11 16:33:43 +00:00
|
|
|
// m_DeltaSize.x or m_DeltaSize.y must be NULL. for a trapezoid.
|
2011-11-24 17:32:51 +00:00
|
|
|
wxSize delta;
|
2012-02-19 04:02:19 +00:00
|
|
|
|
2012-03-08 20:44:03 +00:00
|
|
|
if( m_trapDeltaDirChoice->GetSelection() == 0 )
|
2012-04-16 17:39:32 +00:00
|
|
|
delta.x = ReturnValueFromTextCtrl( *m_ShapeDelta_Ctrl );
|
2011-11-24 17:32:51 +00:00
|
|
|
else
|
2012-04-16 17:39:32 +00:00
|
|
|
delta.y = ReturnValueFromTextCtrl( *m_ShapeDelta_Ctrl );
|
2011-08-19 13:08:24 +00:00
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
// Test bad values (be sure delta values are not too large)
|
2011-11-24 17:32:51 +00:00
|
|
|
// remember DeltaSize.x is the Y size variation
|
2010-09-11 16:33:43 +00:00
|
|
|
bool error = false;
|
2012-02-19 04:02:19 +00:00
|
|
|
|
|
|
|
if( delta.x < 0 && delta.x <= -aPad->GetSize().y )
|
2010-09-11 16:33:43 +00:00
|
|
|
{
|
2012-02-19 04:02:19 +00:00
|
|
|
delta.x = -aPad->GetSize().y + 2;
|
2010-09-11 16:33:43 +00:00
|
|
|
error = true;
|
|
|
|
}
|
2012-02-19 04:02:19 +00:00
|
|
|
|
|
|
|
if( delta.x > 0 && delta.x >= aPad->GetSize().y )
|
2010-09-11 16:33:43 +00:00
|
|
|
{
|
2012-02-19 04:02:19 +00:00
|
|
|
delta.x = aPad->GetSize().y - 2;
|
2010-09-11 16:33:43 +00:00
|
|
|
error = true;
|
|
|
|
}
|
2012-02-19 04:02:19 +00:00
|
|
|
|
|
|
|
if( delta.y < 0 && delta.y <= -aPad->GetSize().x )
|
2010-09-11 16:33:43 +00:00
|
|
|
{
|
2012-02-19 04:02:19 +00:00
|
|
|
delta.y = -aPad->GetSize().x + 2;
|
2010-09-11 16:33:43 +00:00
|
|
|
error = true;
|
|
|
|
}
|
2012-02-19 04:02:19 +00:00
|
|
|
|
|
|
|
if( delta.y > 0 && delta.y >= aPad->GetSize().x )
|
2010-09-11 16:33:43 +00:00
|
|
|
{
|
2012-02-19 04:02:19 +00:00
|
|
|
delta.y = aPad->GetSize().x - 2;
|
2010-09-11 16:33:43 +00:00
|
|
|
error = true;
|
|
|
|
}
|
2009-11-05 20:59:42 +00:00
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
aPad->SetDelta( delta );
|
|
|
|
|
2009-11-05 20:59:42 +00:00
|
|
|
// Read pad shape offset:
|
2012-04-16 17:39:32 +00:00
|
|
|
x = ReturnValueFromTextCtrl( *m_ShapeOffset_X_Ctrl );
|
|
|
|
y = ReturnValueFromTextCtrl( *m_ShapeOffset_Y_Ctrl );
|
2012-02-19 04:02:19 +00:00
|
|
|
aPad->SetOffset( wxPoint( x, y ) );
|
2009-11-05 20:59:42 +00:00
|
|
|
|
2012-01-04 06:18:38 +00:00
|
|
|
double orient_value = 0;
|
2010-09-11 16:33:43 +00:00
|
|
|
msg = m_PadOrientCtrl->GetValue();
|
2012-01-04 06:18:38 +00:00
|
|
|
msg.ToDouble( &orient_value );
|
|
|
|
|
|
|
|
aPad->SetOrientation( orient_value );
|
2008-11-22 11:10:40 +00:00
|
|
|
|
2010-09-11 16:33:43 +00:00
|
|
|
msg = m_PadNumCtrl->GetValue().Left( 4 );
|
|
|
|
aPad->SetPadName( msg );
|
|
|
|
aPad->SetNetname( m_PadNetNameCtrl->GetValue() );
|
2008-11-22 11:10:40 +00:00
|
|
|
|
2010-02-12 17:15:47 +00:00
|
|
|
// Clear some values, according to the pad type and shape
|
2012-02-19 04:02:19 +00:00
|
|
|
switch( aPad->GetShape() )
|
2010-02-12 17:15:47 +00:00
|
|
|
{
|
|
|
|
case PAD_CIRCLE:
|
2012-02-19 04:02:19 +00:00
|
|
|
aPad->SetOffset( wxPoint( 0, 0 ) );
|
|
|
|
aPad->SetDelta( wxSize( 0, 0 ) );
|
|
|
|
x = aPad->GetSize().x;
|
|
|
|
aPad->SetSize( wxSize( x, x ) );
|
2010-02-12 17:15:47 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PAD_RECT:
|
2012-02-19 04:02:19 +00:00
|
|
|
aPad->SetDelta( wxSize( 0, 0 ) );
|
2010-02-12 17:15:47 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PAD_OVAL:
|
2012-02-19 04:02:19 +00:00
|
|
|
aPad->SetDelta( wxSize( 0, 0 ) );
|
2010-02-12 17:15:47 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PAD_TRAPEZOID:
|
|
|
|
break;
|
2012-02-19 04:02:19 +00:00
|
|
|
|
|
|
|
default:
|
|
|
|
;
|
2010-02-12 17:15:47 +00:00
|
|
|
}
|
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
switch( aPad->GetAttribute() )
|
2010-02-12 17:15:47 +00:00
|
|
|
{
|
|
|
|
case PAD_STANDARD:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PAD_CONN:
|
|
|
|
case PAD_SMD:
|
2012-03-20 20:22:38 +00:00
|
|
|
// SMD and PAD_CONN has no hole.
|
|
|
|
// basically, SMD and PAD_CONN are same type of pads
|
2013-02-12 01:07:04 +00:00
|
|
|
// PAD_CONN has just a default non technical layers that differs from SMD
|
2012-03-20 20:22:38 +00:00
|
|
|
// and are intended to be used in virtual edge board connectors
|
|
|
|
// However we can accept a non null offset,
|
|
|
|
// mainly to allow complex pads build from a set of from basic pad shapes
|
2012-02-19 04:02:19 +00:00
|
|
|
aPad->SetDrillSize( wxSize( 0, 0 ) );
|
2010-02-12 17:15:47 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PAD_HOLE_NOT_PLATED:
|
2011-08-19 13:08:24 +00:00
|
|
|
// Mechanical purpose only:
|
|
|
|
// no offset, no net name, no pad name allowed
|
2012-02-19 04:02:19 +00:00
|
|
|
aPad->SetOffset( wxPoint( 0, 0 ) );
|
2011-08-19 13:08:24 +00:00
|
|
|
aPad->SetPadName( wxEmptyString );
|
|
|
|
aPad->SetNetname( wxEmptyString );
|
2010-02-12 17:15:47 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2011-08-19 13:08:24 +00:00
|
|
|
DisplayError( NULL, wxT( "Error: unknown pad type" ) );
|
2010-02-12 17:15:47 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2013-03-30 17:24:04 +00:00
|
|
|
LAYER_MSK padLayerMask = NO_LAYERS;
|
2012-02-19 04:02:19 +00:00
|
|
|
|
2011-08-19 13:08:24 +00:00
|
|
|
switch( m_rbCopperLayersSel->GetSelection() )
|
|
|
|
{
|
2012-02-19 04:02:19 +00:00
|
|
|
case 0:
|
|
|
|
padLayerMask |= LAYER_FRONT;
|
|
|
|
break;
|
2011-08-19 13:08:24 +00:00
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
case 1:
|
|
|
|
padLayerMask |= LAYER_BACK;
|
|
|
|
break;
|
2011-08-19 13:08:24 +00:00
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
case 2:
|
|
|
|
padLayerMask |= ALL_CU_LAYERS;
|
|
|
|
break;
|
2011-08-19 13:08:24 +00:00
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
case 3: // No copper layers
|
|
|
|
break;
|
2011-08-19 13:08:24 +00:00
|
|
|
}
|
|
|
|
|
2008-11-22 11:10:40 +00:00
|
|
|
if( m_PadLayerAdhCmp->GetValue() )
|
2012-02-19 04:02:19 +00:00
|
|
|
padLayerMask |= ADHESIVE_LAYER_FRONT;
|
2008-11-22 11:10:40 +00:00
|
|
|
if( m_PadLayerAdhCu->GetValue() )
|
2012-02-19 04:02:19 +00:00
|
|
|
padLayerMask |= ADHESIVE_LAYER_BACK;
|
2008-11-22 11:10:40 +00:00
|
|
|
if( m_PadLayerPateCmp->GetValue() )
|
2012-02-19 04:02:19 +00:00
|
|
|
padLayerMask |= SOLDERPASTE_LAYER_FRONT;
|
2008-11-22 11:10:40 +00:00
|
|
|
if( m_PadLayerPateCu->GetValue() )
|
2012-02-19 04:02:19 +00:00
|
|
|
padLayerMask |= SOLDERPASTE_LAYER_BACK;
|
2008-11-22 11:10:40 +00:00
|
|
|
if( m_PadLayerSilkCmp->GetValue() )
|
2012-02-19 04:02:19 +00:00
|
|
|
padLayerMask |= SILKSCREEN_LAYER_FRONT;
|
2008-11-22 11:10:40 +00:00
|
|
|
if( m_PadLayerSilkCu->GetValue() )
|
2012-02-19 04:02:19 +00:00
|
|
|
padLayerMask |= SILKSCREEN_LAYER_BACK;
|
2008-11-22 11:10:40 +00:00
|
|
|
if( m_PadLayerMaskCmp->GetValue() )
|
2012-02-19 04:02:19 +00:00
|
|
|
padLayerMask |= SOLDERMASK_LAYER_FRONT;
|
2008-11-22 11:10:40 +00:00
|
|
|
if( m_PadLayerMaskCu->GetValue() )
|
2012-02-19 04:02:19 +00:00
|
|
|
padLayerMask |= SOLDERMASK_LAYER_BACK;
|
2008-11-22 11:10:40 +00:00
|
|
|
if( m_PadLayerECO1->GetValue() )
|
2012-02-19 04:02:19 +00:00
|
|
|
padLayerMask |= ECO1_LAYER;
|
2008-11-22 11:10:40 +00:00
|
|
|
if( m_PadLayerECO2->GetValue() )
|
2012-02-19 04:02:19 +00:00
|
|
|
padLayerMask |= ECO2_LAYER;
|
2008-11-22 11:10:40 +00:00
|
|
|
if( m_PadLayerDraft->GetValue() )
|
2012-02-19 04:02:19 +00:00
|
|
|
padLayerMask |= DRAW_LAYER;
|
2008-11-22 11:10:40 +00:00
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
aPad->SetLayerMask( padLayerMask );
|
2010-03-07 13:33:20 +00:00
|
|
|
|
2012-03-10 13:00:31 +00:00
|
|
|
return error;
|
2010-09-11 16:33:43 +00:00
|
|
|
}
|
2009-11-05 20:59:42 +00:00
|
|
|
|
2008-11-22 11:10:40 +00:00
|
|
|
|
2010-09-11 16:33:43 +00:00
|
|
|
void DIALOG_PAD_PROPERTIES::OnValuesChanged( wxCommandEvent& event )
|
|
|
|
{
|
|
|
|
if( m_canUpdate )
|
|
|
|
{
|
2012-04-11 23:30:06 +00:00
|
|
|
transferDataToPad( m_dummyPad );
|
2010-09-11 16:33:43 +00:00
|
|
|
m_panelShowPad->Refresh();
|
2008-11-22 11:10:40 +00:00
|
|
|
}
|
|
|
|
}
|
2009-08-23 15:22:44 +00:00
|
|
|
|
2010-09-11 16:33:43 +00:00
|
|
|
|
2009-11-05 20:59:42 +00:00
|
|
|
void DIALOG_PAD_PROPERTIES::OnCancelButtonClick( wxCommandEvent& event )
|
2009-08-23 15:22:44 +00:00
|
|
|
{
|
2010-04-23 14:46:00 +00:00
|
|
|
EndModal( wxID_CANCEL );
|
2009-08-23 15:22:44 +00:00
|
|
|
}
|