Be very careful when "doing what I mean".

Just wanting a SMD pad isn't enough -- the user may have already
set SMD settings into the master pad and changing the SizeX is
then very unexpected.  Make sure the settings directly conflict
before making any "do what I mean" adjustments.

Also fixes the parent-footprint info when no parent exists.

Also gives a better title to the dialog when used to edit the masterPad
properties.

Fixes https://gitlab.com/kicad/code/kicad/issues/9427
This commit is contained in:
Jeff Young 2021-10-20 00:36:11 +01:00
parent b37664092d
commit 463b82cf46
5 changed files with 29 additions and 17 deletions

View File

@ -477,6 +477,8 @@ void DIALOG_PAD_PROPERTIES::initValues()
if( m_currentPad )
{
SetTitle( _( "Pad Properties" ) );
m_locked->SetValue( m_currentPad->IsLocked() );
m_isFlipped = m_currentPad->IsFlipped();
@ -501,6 +503,8 @@ void DIALOG_PAD_PROPERTIES::initValues()
}
else
{
SetTitle( _( "Default Pad Properties for Add Pad Tool" ) );
m_locked->Hide();
m_isFlipped = false;
}

View File

@ -950,7 +950,7 @@ DIALOG_PAD_PROPERTIES_BASE::DIALOG_PAD_PROPERTIES_BASE( wxWindow* parent, wxWind
wxBoxSizer* bottomSizer;
bottomSizer = new wxBoxSizer( wxHORIZONTAL );
m_parentInfo = new wxStaticText( this, wxID_ANY, _("Footprint R1 (300K), back side (mirrored), rotated 180.0º"), wxDefaultPosition, wxDefaultSize, 0 );
m_parentInfo = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_parentInfo->Wrap( -1 );
bottomSizer->Add( m_parentInfo, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT, 8 );
@ -961,7 +961,7 @@ DIALOG_PAD_PROPERTIES_BASE::DIALOG_PAD_PROPERTIES_BASE( wxWindow* parent, wxWind
bottomSizer->Add( m_cbShowPadOutline, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bottomSizer->Add( 20, 0, 1, wxEXPAND, 5 );
bottomSizer->Add( 40, 0, 0, wxEXPAND, 5 );
m_sdbSizer = new wxStdDialogButtonSizer();
m_sdbSizerOK = new wxButton( this, wxID_OK );

View File

@ -10761,7 +10761,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Footprint R1 (300K), back side (mirrored), rotated 180.0º</property>
<property name="label"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@ -10868,11 +10868,11 @@
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<property name="proportion">0</property>
<object class="spacer" expanded="0">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">20</property>
<property name="width">40</property>
</object>
</object>
<object class="sizeritem" expanded="0">

View File

@ -64,9 +64,7 @@ PAD::PAD( FOOTPRINT* parent ) :
m_lengthPadToDie = 0;
if( m_parent && m_parent->Type() == PCB_FOOTPRINT_T )
{
m_pos = GetParent()->GetPosition();
}
SetShape( PAD_SHAPE::CIRCLE ); // Default pad shape is PAD_CIRCLE.
SetAnchorPadShape( PAD_SHAPE::CIRCLE ); // Default shape for custom shaped pads
@ -86,14 +84,14 @@ PAD::PAD( FOOTPRINT* parent ) :
m_chamferScale = 0.2; // Size of chamfer: ratio of smallest of X,Y size
m_chamferPositions = RECT_NO_CHAMFER; // No chamfered corner
m_zoneConnection = ZONE_CONNECTION::INHERITED; // Use parent setting by default
m_thermalWidth = 0; // Use parent setting by default
m_thermalGap = 0; // Use parent setting by default
m_zoneConnection = ZONE_CONNECTION::INHERITED; // Use parent setting by default
m_thermalWidth = 0; // Use parent setting by default
m_thermalGap = 0; // Use parent setting by default
m_customShapeClearanceArea = CUST_PAD_SHAPE_IN_ZONE_OUTLINE;
// Set layers mask to default for a standard thru hole pad.
m_layerMask = PTHMask();
m_layerMask = PTHMask();
SetSubRatsnest( 0 ); // used in ratsnest calculations
@ -1367,9 +1365,9 @@ void PAD::ImportSettingsFrom( const PAD& aMasterPad )
// I am not sure the m_LengthPadToDie must be imported, because this is
// a parameter really specific to a given pad (JPC).
// So this is currently non imported
#if 0
#if 0
SetPadToDieLength( aMasterPad.GetPadToDieLength() );
#endif
#endif
// The pad orientation, for historical reasons is the
// pad rotation + parent rotation.

View File

@ -481,18 +481,28 @@ int PAD_TOOL::PlacePad( const TOOL_EVENT& aEvent )
std::unique_ptr<BOARD_ITEM> CreateItem() override
{
PAD* pad = new PAD( m_board->GetFirstFootprint() );
PAD* master = m_frame->GetDesignSettings().m_Pad_Master.get();
pad->ImportSettingsFrom( *(m_frame->GetDesignSettings().m_Pad_Master.get()) );
pad->ImportSettingsFrom( *master );
// If the user has set the footprint type to SMD, we assume that they would like to place
// SMD pads
if( m_board->GetFirstFootprint()->GetAttributes() & FP_SMD )
// If the footprint type and master pad type directly conflict then make some
// adjustments. Otherwise assume the user set what they wanted.
if( ( m_board->GetFirstFootprint()->GetAttributes() & FP_SMD )
&& master->GetAttribute() == PAD_ATTRIB::PTH )
{
pad->SetAttribute( PAD_ATTRIB::SMD );
pad->SetShape( PAD_SHAPE::ROUNDRECT );
pad->SetSizeX( 1.5 * pad->GetSizeY() );
pad->SetLayerSet( PAD::SMDMask() );
}
else if( ( m_board->GetFirstFootprint()->GetAttributes() & FP_THROUGH_HOLE )
&& master->GetAttribute() == PAD_ATTRIB::SMD )
{
pad->SetAttribute( PAD_ATTRIB::PTH );
pad->SetShape( PAD_SHAPE::CIRCLE );
pad->SetSize( wxSize( pad->GetSizeX(), pad->GetSizeX() ) );
pad->SetLayerSet( PAD::PTHMask() );
}
if( pad->CanHaveNumber() )
{