Prevent locking items in footprint editor

Adding footprints to the board now has a preference for whether we want
pads locked or unlocked by default
This commit is contained in:
Seth Hillbrand 2021-01-11 11:23:26 -08:00
parent a41430601e
commit c09dc5abdd
13 changed files with 149 additions and 42 deletions

View File

@ -27,6 +27,7 @@
*/ */
#include <pcb_base_edit_frame.h> #include <pcb_base_edit_frame.h>
#include <pcb_edit_frame.h>
#include <wx/valnum.h> #include <wx/valnum.h>
#include <board_commit.h> #include <board_commit.h>
#include <pcb_layer_box_selector.h> #include <pcb_layer_box_selector.h>
@ -115,6 +116,9 @@ DIALOG_GRAPHIC_ITEM_PROPERTIES::DIALOG_GRAPHIC_ITEM_PROPERTIES( PCB_BASE_EDIT_FR
m_angleCtrl->SetValidator( m_AngleValidator ); m_angleCtrl->SetValidator( m_AngleValidator );
m_AngleValidator.SetWindow( m_angleCtrl ); m_AngleValidator.SetWindow( m_angleCtrl );
// Do not allow locking items in the footprint editor
m_locked->Show( dynamic_cast<PCB_EDIT_FRAME*>( aParent ) != nullptr );
// Configure the layers list selector // Configure the layers list selector
if( m_fp_item ) if( m_fp_item )
{ {

View File

@ -188,6 +188,9 @@ DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES( PCB_BASE_FRAME* aParent, PAD* aPad
m_staticTextInfoPosValue->SetFont( infoFont ); m_staticTextInfoPosValue->SetFont( infoFont );
m_staticTextPrimitiveListWarning->SetFont( infoFont ); m_staticTextPrimitiveListWarning->SetFont( infoFont );
// Do not allow locking items in the footprint editor
m_locked->Show( dynamic_cast<PCB_EDIT_FRAME*>( aParent ) != nullptr );
// Usually, TransferDataToWindow is called by OnInitDialog // Usually, TransferDataToWindow is called by OnInitDialog
// calling it here fixes all widget sizes so FinishDialogSettings can safely fix minsizes // calling it here fixes all widget sizes so FinishDialogSettings can safely fix minsizes
TransferDataToWindow(); TransferDataToWindow();

View File

@ -37,6 +37,7 @@ PANEL_EDIT_OPTIONS::PANEL_EDIT_OPTIONS( PCB_BASE_EDIT_FRAME* aFrame, PAGED_DIALO
m_magneticPads->Show( dynamic_cast<FOOTPRINT_EDIT_FRAME*>( m_frame ) != nullptr ); m_magneticPads->Show( dynamic_cast<FOOTPRINT_EDIT_FRAME*>( m_frame ) != nullptr );
m_magneticGraphics->Show( dynamic_cast<FOOTPRINT_EDIT_FRAME*>( m_frame ) != nullptr ); m_magneticGraphics->Show( dynamic_cast<FOOTPRINT_EDIT_FRAME*>( m_frame ) != nullptr );
m_flipLeftRight->Show( dynamic_cast<PCB_EDIT_FRAME*>( m_frame ) != nullptr ); m_flipLeftRight->Show( dynamic_cast<PCB_EDIT_FRAME*>( m_frame ) != nullptr );
m_addUnlockedPads->Show( dynamic_cast<PCB_EDIT_FRAME*>( m_frame ) != nullptr );
#ifdef __WXOSX_MAC__ #ifdef __WXOSX_MAC__
m_mouseCmdsOSX->Show( true ); m_mouseCmdsOSX->Show( true );
@ -71,6 +72,7 @@ bool PANEL_EDIT_OPTIONS::TransferDataToWindow()
m_magneticTrackChoice->SetSelection( static_cast<int>( general_opts.m_MagneticItems.tracks ) ); m_magneticTrackChoice->SetSelection( static_cast<int>( general_opts.m_MagneticItems.tracks ) );
m_magneticGraphicsChoice->SetSelection( !general_opts.m_MagneticItems.graphics ); m_magneticGraphicsChoice->SetSelection( !general_opts.m_MagneticItems.graphics );
m_flipLeftRight->SetValue( general_opts.m_FlipLeftRight ); m_flipLeftRight->SetValue( general_opts.m_FlipLeftRight );
m_addUnlockedPads->SetValue( general_opts.m_AddUnlockedPads );
m_Show_Page_Limits->SetValue( m_frame->ShowPageLimits() ); m_Show_Page_Limits->SetValue( m_frame->ShowPageLimits() );
@ -115,6 +117,7 @@ bool PANEL_EDIT_OPTIONS::TransferDataFromWindow()
m_frame->Settings().m_FlipLeftRight = m_flipLeftRight->GetValue(); m_frame->Settings().m_FlipLeftRight = m_flipLeftRight->GetValue();
m_frame->SetShowPageLimits( m_Show_Page_Limits->GetValue() ); m_frame->SetShowPageLimits( m_Show_Page_Limits->GetValue() );
m_frame->Settings().m_AddUnlockedPads = m_addUnlockedPads->GetValue();
if( m_rbTrackDragMove->GetValue() ) if( m_rbTrackDragMove->GetValue() )
pcbnewSettings.m_TrackDragAction = TRACK_DRAG_ACTION::MOVE; pcbnewSettings.m_TrackDragAction = TRACK_DRAG_ACTION::MOVE;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 26 2018) // C++ code generated with wxFormBuilder (version 3.9.0 Dec 30 2020)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO *NOT* EDIT THIS FILE! // PLEASE DO *NOT* EDIT THIS FILE!
@ -46,6 +46,11 @@ PANEL_EDIT_OPTIONS_BASE::PANEL_EDIT_OPTIONS_BASE( wxWindow* parent, wxWindowID i
m_flipLeftRight = new wxCheckBox( bOptionsSizer->GetStaticBox(), wxID_ANY, _("Flip board items L/R (default is T/B)"), wxDefaultPosition, wxDefaultSize, 0 ); m_flipLeftRight = new wxCheckBox( bOptionsSizer->GetStaticBox(), wxID_ANY, _("Flip board items L/R (default is T/B)"), wxDefaultPosition, wxDefaultSize, 0 );
bOptionsSizer->Add( m_flipLeftRight, 0, wxALL, 5 ); bOptionsSizer->Add( m_flipLeftRight, 0, wxALL, 5 );
m_addUnlockedPads = new wxCheckBox( bOptionsSizer->GetStaticBox(), wxID_ANY, _("Add footprints with pads unlocked"), wxDefaultPosition, wxDefaultSize, 0 );
m_addUnlockedPads->SetToolTip( _("If checked, when a footprint is added to the board, the pads will be freely moveable.") );
bOptionsSizer->Add( m_addUnlockedPads, 0, wxALL, 5 );
wxFlexGridSizer* fgSizer12; wxFlexGridSizer* fgSizer12;
fgSizer12 = new wxFlexGridSizer( 0, 2, 0, 0 ); fgSizer12 = new wxFlexGridSizer( 0, 2, 0, 0 );
fgSizer12->AddGrowableCol( 1 ); fgSizer12->AddGrowableCol( 1 );

View File

@ -14,6 +14,7 @@
<property name="file">panel_edit_options_base</property> <property name="file">panel_edit_options_base</property>
<property name="first_id">1000</property> <property name="first_id">1000</property>
<property name="help_provider">none</property> <property name="help_provider">none</property>
<property name="image_path_wrapper_function_name"></property>
<property name="indent_with_spaces"></property> <property name="indent_with_spaces"></property>
<property name="internationalize">1</property> <property name="internationalize">1</property>
<property name="name">PanelEditOptions</property> <property name="name">PanelEditOptions</property>
@ -25,6 +26,7 @@
<property name="skip_php_events">1</property> <property name="skip_php_events">1</property>
<property name="skip_python_events">1</property> <property name="skip_python_events">1</property>
<property name="ui_table">UI</property> <property name="ui_table">UI</property>
<property name="use_array_enum">0</property>
<property name="use_enum">1</property> <property name="use_enum">1</property>
<property name="use_microsoft_bom">0</property> <property name="use_microsoft_bom">0</property>
<object class="Panel" expanded="1"> <object class="Panel" expanded="1">
@ -370,6 +372,70 @@
<property name="window_style"></property> <property name="window_style"></property>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Add footprints with pads unlocked</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_addLockedPads</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<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="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP</property> <property name="flag">wxEXPAND|wxTOP</property>
@ -2448,16 +2514,16 @@
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
<property name="window_name"></property> <property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property> <property name="window_style">wxTAB_TRAVERSAL</property>
<object class="wxBoxSizer" expanded="1"> <object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">pcbOptionsSizer</property> <property name="name">pcbOptionsSizer</property>
<property name="orient">wxVERTICAL</property> <property name="orient">wxVERTICAL</property>
<property name="permission">none</property> <property name="permission">none</property>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxEXPAND</property> <property name="flag">wxEXPAND</property>
<property name="proportion">1</property> <property name="proportion">1</property>
<object class="wxStaticBoxSizer" expanded="1"> <object class="wxStaticBoxSizer" expanded="0">
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="label">Magnetic Points</property> <property name="label">Magnetic Points</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
@ -2465,11 +2531,11 @@
<property name="orient">wxVERTICAL</property> <property name="orient">wxVERTICAL</property>
<property name="parent">1</property> <property name="parent">1</property>
<property name="permission">none</property> <property name="permission">none</property>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxEXPAND|wxBOTTOM</property> <property name="flag">wxEXPAND|wxBOTTOM</property>
<property name="proportion">1</property> <property name="proportion">1</property>
<object class="wxFlexGridSizer" expanded="1"> <object class="wxFlexGridSizer" expanded="0">
<property name="cols">2</property> <property name="cols">2</property>
<property name="flexible_direction">wxBOTH</property> <property name="flexible_direction">wxBOTH</property>
<property name="growablecols"></property> <property name="growablecols"></property>
@ -2860,11 +2926,11 @@
</object> </object>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP</property> <property name="flag">wxEXPAND|wxTOP</property>
<property name="proportion">1</property> <property name="proportion">1</property>
<object class="wxStaticBoxSizer" expanded="1"> <object class="wxStaticBoxSizer" expanded="0">
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="label">Ratsnest</property> <property name="label">Ratsnest</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
@ -2872,11 +2938,11 @@
<property name="orient">wxVERTICAL</property> <property name="orient">wxVERTICAL</property>
<property name="parent">1</property> <property name="parent">1</property>
<property name="permission">none</property> <property name="permission">none</property>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property> <property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxCheckBox" expanded="1"> <object class="wxCheckBox" expanded="0">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
<property name="LeftDockable">1</property> <property name="LeftDockable">1</property>
<property name="RightDockable">1</property> <property name="RightDockable">1</property>
@ -2936,11 +3002,11 @@
<property name="window_style"></property> <property name="window_style"></property>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property> <property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxCheckBox" expanded="1"> <object class="wxCheckBox" expanded="0">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
<property name="LeftDockable">1</property> <property name="LeftDockable">1</property>
<property name="RightDockable">1</property> <property name="RightDockable">1</property>
@ -3002,11 +3068,11 @@
</object> </object>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP</property> <property name="flag">wxEXPAND|wxTOP</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxStaticBoxSizer" expanded="1"> <object class="wxStaticBoxSizer" expanded="0">
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="label">Annotations</property> <property name="label">Annotations</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
@ -3080,11 +3146,11 @@
</object> </object>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP</property> <property name="flag">wxEXPAND|wxTOP</property>
<property name="proportion">1</property> <property name="proportion">1</property>
<object class="wxStaticBoxSizer" expanded="1"> <object class="wxStaticBoxSizer" expanded="0">
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="label">Track Editing</property> <property name="label">Track Editing</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
@ -3092,11 +3158,11 @@
<property name="orient">wxVERTICAL</property> <property name="orient">wxVERTICAL</property>
<property name="parent">1</property> <property name="parent">1</property>
<property name="permission">none</property> <property name="permission">none</property>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="0">
<property name="border">3</property> <property name="border">3</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property> <property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxStaticText" expanded="1"> <object class="wxStaticText" expanded="0">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
<property name="LeftDockable">1</property> <property name="LeftDockable">1</property>
<property name="RightDockable">1</property> <property name="RightDockable">1</property>
@ -3153,11 +3219,11 @@
<property name="wrap">-1</property> <property name="wrap">-1</property>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxRIGHT|wxLEFT</property> <property name="flag">wxRIGHT|wxLEFT</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxRadioButton" expanded="1"> <object class="wxRadioButton" expanded="0">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
<property name="LeftDockable">1</property> <property name="LeftDockable">1</property>
<property name="RightDockable">1</property> <property name="RightDockable">1</property>
@ -3217,21 +3283,21 @@
<property name="window_style"></property> <property name="window_style"></property>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxEXPAND</property> <property name="flag">wxEXPAND</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="spacer" expanded="1"> <object class="spacer" expanded="0">
<property name="height">5</property> <property name="height">5</property>
<property name="permission">protected</property> <property name="permission">protected</property>
<property name="width">0</property> <property name="width">0</property>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxRIGHT|wxLEFT</property> <property name="flag">wxRIGHT|wxLEFT</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxRadioButton" expanded="1"> <object class="wxRadioButton" expanded="0">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
<property name="LeftDockable">1</property> <property name="LeftDockable">1</property>
<property name="RightDockable">1</property> <property name="RightDockable">1</property>
@ -3291,21 +3357,21 @@
<property name="window_style"></property> <property name="window_style"></property>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxEXPAND</property> <property name="flag">wxEXPAND</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="spacer" expanded="1"> <object class="spacer" expanded="0">
<property name="height">5</property> <property name="height">5</property>
<property name="permission">protected</property> <property name="permission">protected</property>
<property name="width">0</property> <property name="width">0</property>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property> <property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxRadioButton" expanded="1"> <object class="wxRadioButton" expanded="0">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
<property name="LeftDockable">1</property> <property name="LeftDockable">1</property>
<property name="RightDockable">1</property> <property name="RightDockable">1</property>

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 26 2018) // C++ code generated with wxFormBuilder (version 3.9.0 Dec 30 2020)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO *NOT* EDIT THIS FILE! // PLEASE DO *NOT* EDIT THIS FILE!
@ -45,6 +45,7 @@ class PANEL_EDIT_OPTIONS_BASE : public wxPanel
wxCheckBox* m_magneticGraphics; wxCheckBox* m_magneticGraphics;
wxCheckBox* m_segments45OnlyCtrl; wxCheckBox* m_segments45OnlyCtrl;
wxCheckBox* m_flipLeftRight; wxCheckBox* m_flipLeftRight;
wxCheckBox* m_addUnlockedPads;
wxStaticText* m_staticTextRotationAngle; wxStaticText* m_staticTextRotationAngle;
wxTextCtrl* m_rotationAngle; wxTextCtrl* m_rotationAngle;
wxStaticBoxSizer* m_mouseCmdsWinLin; wxStaticBoxSizer* m_mouseCmdsWinLin;

View File

@ -735,7 +735,21 @@ void FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB( wxCommandEvent& aEvent )
// Create the "new" footprint // Create the "new" footprint
FOOTPRINT* newFootprint = (FOOTPRINT*) GetBoard()->GetFirstFootprint()->Duplicate(); FOOTPRINT* newFootprint = (FOOTPRINT*) GetBoard()->GetFirstFootprint()->Duplicate();
newFootprint->SetParent( pcbframe->GetBoard() ); newFootprint->SetParent( pcbframe->GetBoard() );
newFootprint->SetLink( 0 ); newFootprint->SetLink( niluuid );
newFootprint->SetFlags(IS_NEW ); // whatever
// Pads in the library all have orphaned nets. Replace with Default.
for( PAD* pad : newFootprint->Pads() )
{
pad->SetLocked( !pcbframe->Settings().m_AddUnlockedPads );
pad->SetNetCode( 0 );
}
// Put it on FRONT layer,
// (Can be stored flipped if the lib is an archive built from a board)
if( newFootprint->IsFlipped() )
newFootprint->Flip( newFootprint->GetPosition(),
pcbframe->Settings().m_FlipLeftRight );
KIGFX::VIEW_CONTROLS* viewControls = pcbframe->GetCanvas()->GetViewControls(); KIGFX::VIEW_CONTROLS* viewControls = pcbframe->GetCanvas()->GetViewControls();
VECTOR2D cursorPos = viewControls->GetCursorPosition(); VECTOR2D cursorPos = viewControls->GetCursorPosition();
@ -743,6 +757,7 @@ void FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB( wxCommandEvent& aEvent )
commit.Add( newFootprint ); commit.Add( newFootprint );
viewControls->SetCrossHairCursorPosition( VECTOR2D( 0, 0 ), false ); viewControls->SetCrossHairCursorPosition( VECTOR2D( 0, 0 ), false );
pcbframe->PlaceFootprint( newFootprint ); pcbframe->PlaceFootprint( newFootprint );
newFootprint->SetPosition( wxPoint( 0, 0 ) ); newFootprint->SetPosition( wxPoint( 0, 0 ) );
viewControls->SetCrossHairCursorPosition( cursorPos, false ); viewControls->SetCrossHairCursorPosition( cursorPos, false );
commit.Push( wxT( "Insert footprint" ) ); commit.Push( wxT( "Insert footprint" ) );

View File

@ -67,6 +67,7 @@ PCBNEW_SETTINGS::PCBNEW_SETTINGS()
m_TrackDragAction( TRACK_DRAG_ACTION::DRAG ), m_TrackDragAction( TRACK_DRAG_ACTION::DRAG ),
m_Use45DegreeGraphicSegments( false ), m_Use45DegreeGraphicSegments( false ),
m_FlipLeftRight( false ), m_FlipLeftRight( false ),
m_AddUnlockedPads( false ),
m_PolarCoords( false ), m_PolarCoords( false ),
m_RotationAngle( 900 ), m_RotationAngle( 900 ),
m_PlotLineWidth( 0.1 ), m_PlotLineWidth( 0.1 ),
@ -103,6 +104,9 @@ PCBNEW_SETTINGS::PCBNEW_SETTINGS()
m_params.emplace_back( new PARAM<bool>( "editing.flip_left_right", m_params.emplace_back( new PARAM<bool>( "editing.flip_left_right",
&m_FlipLeftRight, true ) ); &m_FlipLeftRight, true ) );
m_params.emplace_back( new PARAM<bool>( "editing.add_unlocked_pads",
&m_AddUnlockedPads, false ) );
m_params.emplace_back( new PARAM<bool>( "editing.magnetic_graphics", m_params.emplace_back( new PARAM<bool>( "editing.magnetic_graphics",
&m_MagneticItems.graphics, true ) ); &m_MagneticItems.graphics, true ) );

View File

@ -281,6 +281,9 @@ public:
bool m_FlipLeftRight; // True: Flip footprints across Y axis bool m_FlipLeftRight; // True: Flip footprints across Y axis
// False: Flip footprints across X axis // False: Flip footprints across X axis
bool m_AddUnlockedPads; // True: Pads are unlocked when new footprints are added to the board
// False: Pads are locked in new footprints
bool m_PolarCoords; bool m_PolarCoords;
int m_RotationAngle; int m_RotationAngle;

View File

@ -904,7 +904,10 @@ int BOARD_EDITOR_CONTROL::PlaceModule( const TOOL_EVENT& aEvent )
// Pads in the library all have orphaned nets. Replace with Default. // Pads in the library all have orphaned nets. Replace with Default.
for( PAD* pad : fp->Pads() ) for( PAD* pad : fp->Pads() )
{
pad->SetLocked( !m_frame->Settings().m_AddUnlockedPads );
pad->SetNetCode( 0 ); pad->SetNetCode( 0 );
}
// Put it on FRONT layer, // Put it on FRONT layer,
// (Can be stored flipped if the lib is an archive built from a board) // (Can be stored flipped if the lib is an archive built from a board)

View File

@ -251,7 +251,7 @@ int EDIT_TOOL::Drag( const TOOL_EVENT& aEvent )
BOARD_ITEM* item = aCollector[ i ]; BOARD_ITEM* item = aCollector[ i ];
// We don't operate on pads; convert them to footprint selections // We don't operate on pads; convert them to footprint selections
if( !sTool->IsFootprintEditor() && item->Type() == PCB_PAD_T if( !sTool->IsFootprintEditor() && item->IsLocked() && item->Type() == PCB_PAD_T
&& !item->GetParent()->IsLocked() ) && !item->GetParent()->IsLocked() )
{ {
aCollector.Remove( item ); aCollector.Remove( item );
@ -263,7 +263,7 @@ int EDIT_TOOL::Drag( const TOOL_EVENT& aEvent )
sTool->FilterCollectorForGroups( aCollector ); sTool->FilterCollectorForGroups( aCollector );
}, },
true /* prompt user regarding locked items */ ); !m_isFootprintEditor /* prompt user regarding locked items */ );
if( selection.Empty() ) if( selection.Empty() )
return 0; return 0;
@ -358,7 +358,7 @@ int EDIT_TOOL::doMoveSelection( TOOL_EVENT aEvent, bool aPickReference )
for( BOARD_ITEM* item : to_add ) for( BOARD_ITEM* item : to_add )
aCollector.Append( item ); aCollector.Append( item );
}, },
true /* prompt user regarding locked items */ ); !m_isFootprintEditor /* prompt user regarding locked items only in pcb editor*/ );
if( selection.Empty() ) if( selection.Empty() )
return 0; return 0;
@ -988,7 +988,7 @@ int EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
sTool->FilterCollectorForGroups( aCollector ); sTool->FilterCollectorForGroups( aCollector );
}, },
!m_dragging /* prompt user regarding locked items */ ); !m_dragging && !m_isFootprintEditor /* prompt user regarding locked items */ );
if( selection.Empty() ) if( selection.Empty() )
return 0; return 0;
@ -1114,7 +1114,7 @@ int EDIT_TOOL::Mirror( const TOOL_EVENT& aEvent )
sTool->FilterCollectorForGroups( aCollector ); sTool->FilterCollectorForGroups( aCollector );
}, },
!m_dragging /* prompt user regarding locked items */ ); !m_dragging && !m_isFootprintEditor /* prompt user regarding locked items */ );
if( selection.Empty() ) if( selection.Empty() )
return 0; return 0;
@ -1233,7 +1233,7 @@ int EDIT_TOOL::Flip( const TOOL_EVENT& aEvent )
sTool->FilterCollectorForGroups( aCollector ); sTool->FilterCollectorForGroups( aCollector );
}, },
!m_dragging /* prompt user regarding locked items */ ); !m_dragging && !m_isFootprintEditor/* prompt user regarding locked items */ );
if( selection.Empty() ) if( selection.Empty() )
return 0; return 0;
@ -1323,7 +1323,7 @@ int EDIT_TOOL::Remove( const TOOL_EVENT& aEvent )
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, PCB_SELECTION_TOOL* sTool ) []( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, PCB_SELECTION_TOOL* sTool )
{ {
}, },
true /* prompt user regarding locked items */ ); !m_isFootprintEditor /* prompt user regarding locked items */ );
} }
bool isHover = selectionCopy.IsHover(); bool isHover = selectionCopy.IsHover();
@ -1530,7 +1530,7 @@ int EDIT_TOOL::MoveExact( const TOOL_EVENT& aEvent )
sTool->FilterCollectorForGroups( aCollector ); sTool->FilterCollectorForGroups( aCollector );
}, },
true /* prompt user regarding locked items */ ); !m_isFootprintEditor /* prompt user regarding locked items */ );
if( selection.Empty() ) if( selection.Empty() )
return 0; return 0;
@ -1958,7 +1958,7 @@ int EDIT_TOOL::copyToClipboard( const TOOL_EVENT& aEvent )
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, PCB_SELECTION_TOOL* sTool ) []( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, PCB_SELECTION_TOOL* sTool )
{ {
}, },
aEvent.IsAction( &ACTIONS::cut ) /* prompt user regarding locked items */ ); aEvent.IsAction( &ACTIONS::cut ) && !m_isFootprintEditor /* prompt user regarding locked items */ );
if( !selection.Empty() ) if( !selection.Empty() )
{ {

View File

@ -484,7 +484,7 @@ int ALIGN_DISTRIBUTE_TOOL::DistributeHorizontally( const TOOL_EVENT& aEvent )
aCollector.Remove( item ); aCollector.Remove( item );
} }
}, },
true /* prompt user regarding locked items */ ); m_frame->IsType( FRAME_PCB_EDITOR ) /* prompt user regarding locked items */ );
if( selection.Size() <= 1 ) if( selection.Size() <= 1 )
return 0; return 0;
@ -605,7 +605,7 @@ int ALIGN_DISTRIBUTE_TOOL::DistributeVertically( const TOOL_EVENT& aEvent )
aCollector.Remove( item ); aCollector.Remove( item );
} }
}, },
true /* prompt user regarding locked items */ ); m_frame->IsType( FRAME_PCB_EDITOR ) /* prompt user regarding locked items */ );
if( selection.Size() <= 1 ) if( selection.Size() <= 1 )
return 0; return 0;

View File

@ -78,7 +78,7 @@ int POSITION_RELATIVE_TOOL::PositionRelative( const TOOL_EVENT& aEvent )
aCollector.Remove( item ); aCollector.Remove( item );
} }
}, },
true /* prompt user regarding locked items */ ); !m_isFootprintEditor /* prompt user regarding locked items */ );
if( selection.Empty() ) if( selection.Empty() )
return 0; return 0;