|
|
@ -1,13 +1,15 @@ |
|
|
|
/*******************************************************************/ |
|
|
|
/* dialog_pad_properties.cpp: Pad editing functions and dialog box */ |
|
|
|
/* see also dialog_pad_properties_base.xxx (built with wxFormBuilder) */ |
|
|
|
/*******************************************************************/ |
|
|
|
/**
|
|
|
|
* @file dialog_pad_properties.cpp. |
|
|
|
* @brief Pad editing functions and dialog pad editor |
|
|
|
*/ |
|
|
|
|
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application. |
|
|
|
* |
|
|
|
* Copyright (C) 2012 Jean-Pierre Charras |
|
|
|
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors. |
|
|
|
* 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. |
|
|
|
* |
|
|
|
* This program is free software; you can redistribute it and/or |
|
|
|
* modify it under the terms of the GNU General Public License |
|
|
@ -93,15 +95,16 @@ public: |
|
|
|
} |
|
|
|
|
|
|
|
private: |
|
|
|
PCB_BASE_FRAME* m_Parent; |
|
|
|
D_PAD* m_CurrentPad; // pad currently being edited
|
|
|
|
PCB_BASE_FRAME* m_parent; |
|
|
|
D_PAD* m_currentPad; // pad currently being edited
|
|
|
|
D_PAD* m_dummyPad; // a working copy used to show changes
|
|
|
|
BOARD* m_Board; |
|
|
|
D_PAD& m_Pad_Master; |
|
|
|
BOARD* m_board; |
|
|
|
D_PAD& m_padMaster; |
|
|
|
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; |
|
|
|
|
|
|
|
private: |
|
|
|
void initValues(); |
|
|
|
|
|
|
|
bool padValuesOK(); ///< test if all values are acceptable for the pad
|
|
|
@ -143,18 +146,18 @@ DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES( PCB_BASE_FRAME* aParent, D_PAD* aP |
|
|
|
// use aParent's parent, which is the original BOARD, not the dummy module editor BOARD,
|
|
|
|
// since FOOTPRINT_EDIT_FRAME::GetDesignSettings() is tricked out to use the PCB_EDIT_FRAME's
|
|
|
|
// BOARD, not its own BOARD.
|
|
|
|
m_Pad_Master( aParent->GetDesignSettings().m_Pad_Master ) |
|
|
|
m_padMaster( aParent->GetDesignSettings().m_Pad_Master ) |
|
|
|
{ |
|
|
|
m_canUpdate = false; |
|
|
|
m_Parent = aParent; |
|
|
|
m_CurrentPad = aPad; |
|
|
|
m_Board = m_Parent->GetBoard(); |
|
|
|
m_parent = aParent; |
|
|
|
m_currentPad = aPad; |
|
|
|
m_board = m_parent->GetBoard(); |
|
|
|
m_dummyPad = new D_PAD( (MODULE*) NULL ); |
|
|
|
|
|
|
|
if( aPad ) |
|
|
|
m_dummyPad->Copy( aPad ); |
|
|
|
else |
|
|
|
m_dummyPad->Copy( &m_Pad_Master ); |
|
|
|
m_dummyPad->Copy( &m_padMaster ); |
|
|
|
|
|
|
|
initValues(); |
|
|
|
|
|
|
@ -175,12 +178,12 @@ void DIALOG_PAD_PROPERTIES::OnPaintShowPanel( wxPaintEvent& event ) |
|
|
|
|
|
|
|
if( m_dummyPad->GetLayerMask() & LAYER_FRONT ) |
|
|
|
{ |
|
|
|
color = m_Board->GetVisibleElementColor( PAD_FR_VISIBLE ); |
|
|
|
color = m_board->GetVisibleElementColor( PAD_FR_VISIBLE ); |
|
|
|
} |
|
|
|
|
|
|
|
if( m_dummyPad->GetLayerMask() & LAYER_BACK ) |
|
|
|
{ |
|
|
|
color = ColorFromInt( color | m_Board->GetVisibleElementColor( PAD_BK_VISIBLE ) ); // XXX EVIL merge
|
|
|
|
color = ColorFromInt( color | m_board->GetVisibleElementColor( PAD_BK_VISIBLE ) ); // XXX EVIL merge
|
|
|
|
} |
|
|
|
|
|
|
|
if( color == 0 ) |
|
|
@ -249,26 +252,26 @@ void DIALOG_PAD_PROPERTIES::initValues() |
|
|
|
|
|
|
|
// Setup layers names from board
|
|
|
|
// Should be made first, before calling m_rbCopperLayersSel->SetSelection()
|
|
|
|
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 ) ); |
|
|
|
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 ) ); |
|
|
|
|
|
|
|
m_isFlipped = false; |
|
|
|
|
|
|
|
if( m_CurrentPad ) |
|
|
|
if( m_currentPad ) |
|
|
|
{ |
|
|
|
MODULE* module = m_CurrentPad->GetParent(); |
|
|
|
MODULE* module = m_currentPad->GetParent(); |
|
|
|
|
|
|
|
if( module->GetLayer() == LAYER_N_BACK ) |
|
|
|
{ |
|
|
@ -383,11 +386,11 @@ void DIALOG_PAD_PROPERTIES::initValues() |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
if( m_CurrentPad ) |
|
|
|
if( m_currentPad ) |
|
|
|
{ |
|
|
|
MODULE* module = m_CurrentPad->GetParent(); |
|
|
|
MODULE* module = m_currentPad->GetParent(); |
|
|
|
|
|
|
|
angle = m_CurrentPad->GetOrientation() - module->GetOrientation(); |
|
|
|
angle = m_currentPad->GetOrientation() - module->GetOrientation(); |
|
|
|
|
|
|
|
if( m_isFlipped ) |
|
|
|
NEGATE( angle ); |
|
|
@ -740,109 +743,109 @@ void DIALOG_PAD_PROPERTIES::PadPropertiesAccept( wxCommandEvent& event ) |
|
|
|
bool rastnestIsChanged = false; |
|
|
|
int isign = m_isFlipped ? -1 : 1; |
|
|
|
|
|
|
|
transferDataToPad( &m_Pad_Master ); |
|
|
|
transferDataToPad( &m_padMaster ); |
|
|
|
|
|
|
|
if( m_CurrentPad ) // Set current Pad parameters
|
|
|
|
if( m_currentPad ) // Set current Pad parameters
|
|
|
|
{ |
|
|
|
wxSize size; |
|
|
|
MODULE* module = m_CurrentPad->GetParent(); |
|
|
|
MODULE* module = m_currentPad->GetParent(); |
|
|
|
|
|
|
|
m_Parent->SaveCopyInUndoList( module, UR_CHANGED ); |
|
|
|
m_parent->SaveCopyInUndoList( module, UR_CHANGED ); |
|
|
|
module->SetLastEditTime(); |
|
|
|
|
|
|
|
// redraw the area where the pad was, without pad (delete pad on screen)
|
|
|
|
m_CurrentPad->SetFlags( DO_NOT_DRAW ); |
|
|
|
m_Parent->GetCanvas()->RefreshDrawingRect( m_CurrentPad->GetBoundingBox() ); |
|
|
|
m_CurrentPad->ClearFlags( DO_NOT_DRAW ); |
|
|
|
m_currentPad->SetFlags( DO_NOT_DRAW ); |
|
|
|
m_parent->GetCanvas()->RefreshDrawingRect( m_currentPad->GetBoundingBox() ); |
|
|
|
m_currentPad->ClearFlags( DO_NOT_DRAW ); |
|
|
|
|
|
|
|
// Update values
|
|
|
|
m_CurrentPad->SetShape( m_Pad_Master.GetShape() ); |
|
|
|
m_CurrentPad->SetAttribute( m_Pad_Master.GetAttribute() ); |
|
|
|
m_currentPad->SetShape( m_padMaster.GetShape() ); |
|
|
|
m_currentPad->SetAttribute( m_padMaster.GetAttribute() ); |
|
|
|
|
|
|
|
if( m_CurrentPad->GetPosition() != m_Pad_Master.GetPosition() ) |
|
|
|
if( m_currentPad->GetPosition() != m_padMaster.GetPosition() ) |
|
|
|
{ |
|
|
|
m_CurrentPad->SetPosition( m_Pad_Master.GetPosition() ); |
|
|
|
m_currentPad->SetPosition( m_padMaster.GetPosition() ); |
|
|
|
rastnestIsChanged = true; |
|
|
|
} |
|
|
|
|
|
|
|
// compute the pos 0 value, i.e. pad position for module with orientation = 0
|
|
|
|
// i.e. relative to module origin (module position)
|
|
|
|
wxPoint pt = m_CurrentPad->GetPosition() - module->GetPosition(); |
|
|
|
wxPoint pt = m_currentPad->GetPosition() - module->GetPosition(); |
|
|
|
|
|
|
|
RotatePoint( &pt, -module->GetOrientation() ); |
|
|
|
|
|
|
|
m_CurrentPad->SetPos0( pt ); |
|
|
|
m_currentPad->SetPos0( pt ); |
|
|
|
|
|
|
|
m_CurrentPad->SetOrientation( m_Pad_Master.GetOrientation() * isign + module->GetOrientation() ); |
|
|
|
m_currentPad->SetOrientation( m_padMaster.GetOrientation() * isign + module->GetOrientation() ); |
|
|
|
|
|
|
|
m_CurrentPad->SetSize( m_Pad_Master.GetSize() ); |
|
|
|
m_currentPad->SetSize( m_padMaster.GetSize() ); |
|
|
|
|
|
|
|
size = m_Pad_Master.GetDelta(); |
|
|
|
size = m_padMaster.GetDelta(); |
|
|
|
size.y *= isign; |
|
|
|
m_CurrentPad->SetDelta( size ); |
|
|
|
m_currentPad->SetDelta( size ); |
|
|
|
|
|
|
|
m_CurrentPad->SetDrillSize( m_Pad_Master.GetDrillSize() ); |
|
|
|
m_CurrentPad->SetDrillShape( m_Pad_Master.GetDrillShape() ); |
|
|
|
m_currentPad->SetDrillSize( m_padMaster.GetDrillSize() ); |
|
|
|
m_currentPad->SetDrillShape( m_padMaster.GetDrillShape() ); |
|
|
|
|
|
|
|
wxPoint offset = m_Pad_Master.GetOffset(); |
|
|
|
wxPoint offset = m_padMaster.GetOffset(); |
|
|
|
offset.y *= isign; |
|
|
|
m_CurrentPad->SetOffset( offset ); |
|
|
|
m_currentPad->SetOffset( offset ); |
|
|
|
|
|
|
|
m_CurrentPad->SetPadToDieLength( m_Pad_Master.GetPadToDieLength() ); |
|
|
|
m_currentPad->SetPadToDieLength( m_padMaster.GetPadToDieLength() ); |
|
|
|
|
|
|
|
if( m_CurrentPad->GetLayerMask() != m_Pad_Master.GetLayerMask() ) |
|
|
|
if( m_currentPad->GetLayerMask() != m_padMaster.GetLayerMask() ) |
|
|
|
{ |
|
|
|
rastnestIsChanged = true; |
|
|
|
m_CurrentPad->SetLayerMask( m_Pad_Master.GetLayerMask() ); |
|
|
|
m_currentPad->SetLayerMask( m_padMaster.GetLayerMask() ); |
|
|
|
} |
|
|
|
|
|
|
|
if( m_isFlipped ) |
|
|
|
m_CurrentPad->SetLayerMask( ChangeSideMaskLayer( m_CurrentPad->GetLayerMask() ) ); |
|
|
|
m_currentPad->SetLayerMask( ChangeSideMaskLayer( m_currentPad->GetLayerMask() ) ); |
|
|
|
|
|
|
|
m_CurrentPad->SetPadName( m_Pad_Master.GetPadName() ); |
|
|
|
m_currentPad->SetPadName( m_padMaster.GetPadName() ); |
|
|
|
|
|
|
|
if( m_CurrentPad->GetNetname() != m_Pad_Master.GetNetname() ) |
|
|
|
if( m_currentPad->GetNetname() != m_padMaster.GetNetname() ) |
|
|
|
{ |
|
|
|
if( m_Pad_Master.GetNetname().IsEmpty() ) |
|
|
|
if( m_padMaster.GetNetname().IsEmpty() ) |
|
|
|
{ |
|
|
|
rastnestIsChanged = true; |
|
|
|
m_CurrentPad->SetNet( 0 ); |
|
|
|
m_CurrentPad->SetNetname( wxEmptyString ); |
|
|
|
m_currentPad->SetNet( 0 ); |
|
|
|
m_currentPad->SetNetname( wxEmptyString ); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
const NETINFO_ITEM* net = m_Parent->GetBoard()->FindNet( m_Pad_Master.GetNetname() ); |
|
|
|
const NETINFO_ITEM* net = m_board->FindNet( m_padMaster.GetNetname() ); |
|
|
|
if( net ) |
|
|
|
{ |
|
|
|
rastnestIsChanged = true; |
|
|
|
m_CurrentPad->SetNetname( m_Pad_Master.GetNetname() ); |
|
|
|
m_CurrentPad->SetNet( net->GetNet() ); |
|
|
|
m_currentPad->SetNetname( m_padMaster.GetNetname() ); |
|
|
|
m_currentPad->SetNet( net->GetNet() ); |
|
|
|
} |
|
|
|
else |
|
|
|
DisplayError( NULL, _( "Unknown netname, netname not changed" ) ); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
m_CurrentPad->SetLocalClearance( m_Pad_Master.GetLocalClearance() ); |
|
|
|
m_CurrentPad->SetLocalSolderMaskMargin( m_Pad_Master.GetLocalSolderMaskMargin() ); |
|
|
|
m_CurrentPad->SetLocalSolderPasteMargin( m_Pad_Master.GetLocalSolderPasteMargin() ); |
|
|
|
m_CurrentPad->SetLocalSolderPasteMarginRatio( m_Pad_Master.GetLocalSolderPasteMarginRatio() ); |
|
|
|
m_CurrentPad->SetZoneConnection( m_Pad_Master.GetZoneConnection() ); |
|
|
|
m_CurrentPad->SetThermalWidth( m_Pad_Master.GetThermalWidth() ); |
|
|
|
m_CurrentPad->SetThermalGap( m_Pad_Master.GetThermalGap() ); |
|
|
|
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() ); |
|
|
|
|
|
|
|
module->CalculateBoundingBox(); |
|
|
|
m_Parent->SetMsgPanel( m_CurrentPad ); |
|
|
|
m_parent->SetMsgPanel( m_currentPad ); |
|
|
|
|
|
|
|
// redraw the area where the pad was
|
|
|
|
m_Parent->GetCanvas()->RefreshDrawingRect( m_CurrentPad->GetBoundingBox() ); |
|
|
|
m_Parent->OnModify(); |
|
|
|
m_parent->GetCanvas()->RefreshDrawingRect( m_currentPad->GetBoundingBox() ); |
|
|
|
m_parent->OnModify(); |
|
|
|
} |
|
|
|
|
|
|
|
EndModal( wxID_OK ); |
|
|
|
|
|
|
|
if( rastnestIsChanged ) // The net ratsnest must be recalculated
|
|
|
|
m_Parent->GetBoard()->m_Status_Pcb = 0; |
|
|
|
m_board->m_Status_Pcb = 0; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|