Update pad locked status when adding footprints from schematic.

Also fixes some latent bugs with not updating the local ratsnest
visibility in other places, and the netcode in update PCB from schematic.

Fixes https://gitlab.com/kicad/code/kicad/issues/7202
This commit is contained in:
Jeff Young 2021-01-25 01:19:35 +00:00
parent 8dfd297ee2
commit d40fe127aa
5 changed files with 22 additions and 12 deletions

View File

@ -39,7 +39,7 @@ PANEL_EDIT_OPTIONS_BASE::PANEL_EDIT_OPTIONS_BASE( wxWindow* parent, wxWindowID i
bSizerBoardEdit = new wxBoxSizer( wxVERTICAL );
m_autoLockPads = new wxCheckBox( bOptionsSizer->GetStaticBox(), wxID_ANY, _("Lock pads of newly added footprints"), wxDefaultPosition, wxDefaultSize, 0 );
m_autoLockPads->SetToolTip( _("If checked, when a footprint is added to the board, the pads will be freely moveable.") );
m_autoLockPads->SetToolTip( _("If checked, when a footprint is added to the board, its pads will be locked and not movable with respect to the footprint.") );
bSizerBoardEdit->Add( m_autoLockPads, 0, wxBOTTOM, 15 );

View File

@ -286,7 +286,7 @@
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip">If checked, when a footprint is added to the board, the pads will be freely moveable.</property>
<property name="tooltip">If checked, when a footprint is added to the board, its pads will be locked and not movable with respect to the footprint.</property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>

View File

@ -738,10 +738,13 @@ void FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB( wxCommandEvent& aEvent )
newFootprint->SetLink( niluuid );
newFootprint->SetFlags(IS_NEW ); // whatever
// Pads in the library all have orphaned nets. Replace with Default.
for( PAD* pad : newFootprint->Pads() )
{
// Set the pads ratsnest settings to the global settings
pad->SetLocalRatsnestVisible( pcbframe->GetDisplayOptions().m_ShowGlobalRatsnest );
pad->SetLocked( !pcbframe->Settings().m_AddUnlockedPads );
// Pads in the library all have orphaned nets. Replace with Default.
pad->SetNetCode( 0 );
}

View File

@ -41,15 +41,14 @@
#include <track.h>
#include <zone.h>
#include <kicad_string.h>
#include "pcb_netlist.h"
#include <pcbnew_settings.h>
#include <pcb_edit_frame.h>
#include <netlist_reader/pcb_netlist.h>
#include <connectivity/connectivity_data.h>
#include <reporter.h>
#include "board_netlist_updater.h"
#include <pcb_edit_frame.h>
BOARD_NETLIST_UPDATER::BOARD_NETLIST_UPDATER( PCB_EDIT_FRAME* aFrame, BOARD* aBoard ) :
m_frame( aFrame ),
@ -168,11 +167,15 @@ FOOTPRINT* BOARD_NETLIST_UPDATER::addNewComponent( COMPONENT* aComponent )
aComponent->GetFPID().Format().wx_str() );
m_reporter->Report( msg, RPT_SEVERITY_ACTION );
// Set the pads ratsnest settings to the global settings
bool set_ratsnest = m_frame->GetDisplayOptions().m_ShowGlobalRatsnest;
for( PAD* pad : footprint->Pads() )
pad->SetLocalRatsnestVisible( set_ratsnest );
{
// Set the pads ratsnest settings to the global settings
pad->SetLocalRatsnestVisible( m_frame->GetDisplayOptions().m_ShowGlobalRatsnest );
pad->SetLocked( !m_frame->Settings().m_AddUnlockedPads );
// Pads in the library all have orphaned nets. Replace with Default.
pad->SetNetCode( 0 );
}
m_newFootprintsCount++;
@ -187,7 +190,9 @@ FOOTPRINT* BOARD_NETLIST_UPDATER::addNewComponent( COMPONENT* aComponent )
return footprint;
}
else
{
delete footprint;
}
return NULL;
}

View File

@ -902,10 +902,12 @@ int BOARD_EDITOR_CONTROL::PlaceModule( const TOOL_EVENT& aEvent )
// Set parent so that clearance can be loaded
fp->SetParent( board );
// Pads in the library all have orphaned nets. Replace with Default.
for( PAD* pad : fp->Pads() )
{
pad->SetLocalRatsnestVisible( m_frame->GetDisplayOptions().m_ShowGlobalRatsnest );
pad->SetLocked( !m_frame->Settings().m_AddUnlockedPads );
// Pads in the library all have orphaned nets. Replace with Default.
pad->SetNetCode( 0 );
}