From ed2f2257ce77cddf3babc8e7823d6aca1ee0d0f6 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Tue, 18 May 2021 23:11:45 +0100 Subject: [PATCH] Remove footprint locking in the footprint editor. (It doesn't make any sense there as the position is always {0, 0} in the editor.) For discussion see: https://kicad.zulipchat.com/#narrow/stream/258851-Developer-Chat/topic/Is.20there.20a.20reason.20why.20kicad.20now.20seems.20to.20lock.20pads.3F --- .../dialog_footprint_properties_fp_editor.cpp | 6 -- ...og_footprint_properties_fp_editor_base.cpp | 21 ++--- ...og_footprint_properties_fp_editor_base.fbp | 90 ++++--------------- ...alog_footprint_properties_fp_editor_base.h | 2 - pcbnew/plugins/kicad/pcb_parser.cpp | 3 + 5 files changed, 29 insertions(+), 93 deletions(-) diff --git a/pcbnew/dialogs/dialog_footprint_properties_fp_editor.cpp b/pcbnew/dialogs/dialog_footprint_properties_fp_editor.cpp index 223c80027b..af9a4bdca1 100644 --- a/pcbnew/dialogs/dialog_footprint_properties_fp_editor.cpp +++ b/pcbnew/dialogs/dialog_footprint_properties_fp_editor.cpp @@ -228,10 +228,6 @@ bool DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::TransferDataToWindow() m_itemsGrid->ProcessTableMessage( tmsg ); // Footprint Properties - m_AutoPlaceCtrl->SetSelection( m_footprint->IsLocked() ? 1 : 0 ); - m_AutoPlaceCtrl->SetItemToolTip( 0, _( "Enable hotkey move commands and Auto Placement" ) ); - m_AutoPlaceCtrl->SetItemToolTip( 1, _( "Disable hotkey move commands and Auto Placement" ) ); - m_CostRot90Ctrl->SetValue( m_footprint->GetPlacementCost90() ); m_CostRot180Ctrl->SetValue( m_footprint->GetPlacementCost180() ); @@ -660,8 +656,6 @@ bool DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::TransferDataFromWindow() view->Add( newText ); } - m_footprint->SetLocked( m_AutoPlaceCtrl->GetSelection() == 1 ); - int attributes = 0; switch( m_componentType->GetSelection() ) diff --git a/pcbnew/dialogs/dialog_footprint_properties_fp_editor_base.cpp b/pcbnew/dialogs/dialog_footprint_properties_fp_editor_base.cpp index b8713ec318..a91c87fd1a 100644 --- a/pcbnew/dialogs/dialog_footprint_properties_fp_editor_base.cpp +++ b/pcbnew/dialogs/dialog_footprint_properties_fp_editor_base.cpp @@ -132,12 +132,6 @@ DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE::DIALOG_FOOTPRINT_PROPERTIES_FP_EDITO wxBoxSizer* bSizerProperties; bSizerProperties = new wxBoxSizer( wxHORIZONTAL ); - wxString m_AutoPlaceCtrlChoices[] = { _("Unlock footprint"), _("Lock footprint") }; - int m_AutoPlaceCtrlNChoices = sizeof( m_AutoPlaceCtrlChoices ) / sizeof( wxString ); - m_AutoPlaceCtrl = new wxRadioBox( m_PanelGeneral, wxID_ANY, _("Move and Place"), wxDefaultPosition, wxDefaultSize, m_AutoPlaceCtrlNChoices, m_AutoPlaceCtrlChoices, 1, wxRA_SPECIFY_COLS ); - m_AutoPlaceCtrl->SetSelection( 1 ); - bSizerProperties->Add( m_AutoPlaceCtrl, 1, wxTOP|wxRIGHT|wxLEFT, 5 ); - m_sizerAP = new wxStaticBoxSizer( new wxStaticBox( m_PanelGeneral, wxID_ANY, _("Auto-placement Rules") ), wxVERTICAL ); m_sizerAllow90 = new wxBoxSizer( wxVERTICAL ); @@ -149,7 +143,7 @@ DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE::DIALOG_FOOTPRINT_PROPERTIES_FP_EDITO m_sizerAllow90->Add( m_allow90Label, 0, 0, 5 ); m_CostRot90Ctrl = new wxSlider( m_sizerAP->GetStaticBox(), wxID_ANY, 0, 0, 10, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS ); - m_sizerAllow90->Add( m_CostRot90Ctrl, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); + m_sizerAllow90->Add( m_CostRot90Ctrl, 0, wxEXPAND|wxRIGHT|wxLEFT, 10 ); m_sizerAP->Add( m_sizerAllow90, 0, wxEXPAND, 5 ); @@ -166,21 +160,24 @@ DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE::DIALOG_FOOTPRINT_PROPERTIES_FP_EDITO m_sizerAllow180->Add( m_allow180Label, 0, 0, 5 ); m_CostRot180Ctrl = new wxSlider( m_sizerAP->GetStaticBox(), wxID_ANY, 0, 0, 10, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS ); - m_sizerAllow180->Add( m_CostRot180Ctrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + m_sizerAllow180->Add( m_CostRot180Ctrl, 0, wxEXPAND|wxRIGHT|wxLEFT, 10 ); - m_sizerAP->Add( m_sizerAllow180, 0, wxEXPAND, 5 ); + m_sizerAP->Add( m_sizerAllow180, 0, wxEXPAND|wxBOTTOM, 5 ); bSizerProperties->Add( m_sizerAP, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); + + bSizerProperties->Add( 10, 0, 0, wxEXPAND, 5 ); + wxStaticBoxSizer* sbFabSizer; sbFabSizer = new wxStaticBoxSizer( new wxStaticBox( m_PanelGeneral, wxID_ANY, _("Fabrication Attributes") ), wxVERTICAL ); wxBoxSizer* bPartTypeSizer; bPartTypeSizer = new wxBoxSizer( wxHORIZONTAL ); - m_componentTypeLabel = new wxStaticText( sbFabSizer->GetStaticBox(), wxID_ANY, _("Component:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_componentTypeLabel = new wxStaticText( sbFabSizer->GetStaticBox(), wxID_ANY, _("Component type:"), wxDefaultPosition, wxDefaultSize, 0 ); m_componentTypeLabel->Wrap( -1 ); bPartTypeSizer->Add( m_componentTypeLabel, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); @@ -188,10 +185,10 @@ DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE::DIALOG_FOOTPRINT_PROPERTIES_FP_EDITO int m_componentTypeNChoices = sizeof( m_componentTypeChoices ) / sizeof( wxString ); m_componentType = new wxChoice( sbFabSizer->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_componentTypeNChoices, m_componentTypeChoices, 0 ); m_componentType->SetSelection( 0 ); - bPartTypeSizer->Add( m_componentType, 1, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + bPartTypeSizer->Add( m_componentType, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - sbFabSizer->Add( bPartTypeSizer, 0, wxEXPAND, 5 ); + sbFabSizer->Add( bPartTypeSizer, 0, wxEXPAND|wxBOTTOM|wxRIGHT, 5 ); m_boardOnly = new wxCheckBox( sbFabSizer->GetStaticBox(), wxID_ANY, _("Not in schematic"), wxDefaultPosition, wxDefaultSize, 0 ); sbFabSizer->Add( m_boardOnly, 0, wxALL, 5 ); diff --git a/pcbnew/dialogs/dialog_footprint_properties_fp_editor_base.fbp b/pcbnew/dialogs/dialog_footprint_properties_fp_editor_base.fbp index 00893b0694..24dfc07f3f 100644 --- a/pcbnew/dialogs/dialog_footprint_properties_fp_editor_base.fbp +++ b/pcbnew/dialogs/dialog_footprint_properties_fp_editor_base.fbp @@ -850,72 +850,6 @@ bSizerProperties wxHORIZONTAL none - - 5 - wxTOP|wxRIGHT|wxLEFT - 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - "Unlock footprint" "Lock footprint" - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Move and Place - 1 - - 0 - - - 0 - - 1 - m_AutoPlaceCtrl - 1 - - - protected - 1 - - Resizable - 1 - 1 - - wxRA_SPECIFY_COLS - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - 5 wxEXPAND|wxTOP|wxRIGHT|wxLEFT @@ -999,7 +933,7 @@ - 5 + 10 wxEXPAND|wxRIGHT|wxLEFT 0 @@ -1077,7 +1011,7 @@ 5 - wxEXPAND + wxEXPAND|wxBOTTOM 0 @@ -1146,8 +1080,8 @@ - 5 - wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT + 10 + wxEXPAND|wxRIGHT|wxLEFT 0 1 @@ -1214,6 +1148,16 @@ + + 5 + wxEXPAND + 0 + + 0 + protected + 10 + + 5 wxEXPAND|wxTOP|wxRIGHT|wxLEFT @@ -1228,7 +1172,7 @@ none 5 - wxEXPAND + wxEXPAND|wxBOTTOM|wxRIGHT 0 @@ -1267,7 +1211,7 @@ 0 0 wxID_ANY - Component: + Component type: 0 0 @@ -1299,7 +1243,7 @@ 5 wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT - 1 + 0 1 1 diff --git a/pcbnew/dialogs/dialog_footprint_properties_fp_editor_base.h b/pcbnew/dialogs/dialog_footprint_properties_fp_editor_base.h index b38cdbe47d..620689f95c 100644 --- a/pcbnew/dialogs/dialog_footprint_properties_fp_editor_base.h +++ b/pcbnew/dialogs/dialog_footprint_properties_fp_editor_base.h @@ -29,7 +29,6 @@ class WX_GRID; #include #include #include -#include #include #include #include @@ -59,7 +58,6 @@ class DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE : public DIALOG_SHIM wxTextCtrl* m_DocCtrl; wxStaticText* staticKeywordsLabel; wxTextCtrl* m_KeywordCtrl; - wxRadioBox* m_AutoPlaceCtrl; wxStaticBoxSizer* m_sizerAP; wxBoxSizer* m_sizerAllow90; wxStaticText* m_allow90Label; diff --git a/pcbnew/plugins/kicad/pcb_parser.cpp b/pcbnew/plugins/kicad/pcb_parser.cpp index c6628fb73b..e819539bd2 100644 --- a/pcbnew/plugins/kicad/pcb_parser.cpp +++ b/pcbnew/plugins/kicad/pcb_parser.cpp @@ -500,6 +500,9 @@ BOARD_ITEM* PCB_PARSER::Parse() case T_module: // legacy token case T_footprint: item = (BOARD_ITEM*) parseFOOTPRINT( initial_comments.release() ); + + // Locking a footprint has no meaning outside of a board. + item->SetLocked( false ); break; default: