diff --git a/common/dialogs/dialog_locked_items_query.cpp b/common/dialogs/dialog_locked_items_query.cpp index 1f00445ce9..c568514629 100644 --- a/common/dialogs/dialog_locked_items_query.cpp +++ b/common/dialogs/dialog_locked_items_query.cpp @@ -25,8 +25,10 @@ #include -DIALOG_LOCKED_ITEMS_QUERY::DIALOG_LOCKED_ITEMS_QUERY( wxWindow* aParent, int aLockedItemCount ) : - DIALOG_LOCKED_ITEMS_QUERY_BASE( aParent ) +DIALOG_LOCKED_ITEMS_QUERY::DIALOG_LOCKED_ITEMS_QUERY( wxWindow* aParent, std::size_t aLockedItemCount, + PCBNEW_SETTINGS::LOCKING_OPTIONS& aLockingOptions ) : + DIALOG_LOCKED_ITEMS_QUERY_BASE( aParent ), + m_lockingOptions( aLockingOptions ) { m_icon->SetBitmap( KiBitmapBundle( BITMAPS::locked ) ); @@ -36,6 +38,9 @@ DIALOG_LOCKED_ITEMS_QUERY::DIALOG_LOCKED_ITEMS_QUERY( wxWindow* aParent, int aLo m_sdbSizerOK->SetToolTip( _( "Remove locked items from the selection and only apply the " "operation to the unlocked items (if any)." ) ); + m_doNotShowBtn->SetToolTip( _( "Do not show this dialog again until KiCad restarts. " + "You can re-enable this dialog in Pcbnew preferences." ) ); + SetInitialFocus( m_sdbSizerOK ); Layout(); @@ -54,18 +59,13 @@ void DIALOG_LOCKED_ITEMS_QUERY::onOverrideLocks( wxCommandEvent& event ) int DIALOG_LOCKED_ITEMS_QUERY::ShowModal() { - static int doNotShowValue = wxID_ANY; - - if( doNotShowValue != wxID_ANY ) - return doNotShowValue; - int ret = DIALOG_SHIM::ShowModal(); // Has the user asked not to show the dialog again this session? if( m_doNotShowBtn->IsChecked() && ret != wxID_CANCEL ) - doNotShowValue = ret; + { + m_lockingOptions.m_sessionSkipPrompts = true; + } return ret; } - - diff --git a/common/dialogs/dialog_locked_items_query_base.cpp b/common/dialogs/dialog_locked_items_query_base.cpp index c1a93fe66b..ec20f7d72f 100644 --- a/common/dialogs/dialog_locked_items_query_base.cpp +++ b/common/dialogs/dialog_locked_items_query_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 3.9.0 Jun 3 2020) +// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -27,7 +27,7 @@ DIALOG_LOCKED_ITEMS_QUERY_BASE::DIALOG_LOCKED_ITEMS_QUERY_BASE( wxWindow* parent wxBoxSizer* bSizer4; bSizer4 = new wxBoxSizer( wxVERTICAL ); - m_messageLine1 = new wxStaticText( this, wxID_ANY, _("The selection contains %d locked items."), wxDefaultPosition, wxDefaultSize, 0 ); + m_messageLine1 = new wxStaticText( this, wxID_ANY, _("The selection contains %lu locked items."), wxDefaultPosition, wxDefaultSize, 0 ); m_messageLine1->Wrap( -1 ); bSizer4->Add( m_messageLine1, 0, wxALL, 5 ); diff --git a/common/dialogs/dialog_locked_items_query_base.fbp b/common/dialogs/dialog_locked_items_query_base.fbp index a9e0c70c65..6a4c9edd39 100644 --- a/common/dialogs/dialog_locked_items_query_base.fbp +++ b/common/dialogs/dialog_locked_items_query_base.fbp @@ -1,453 +1,462 @@ - + - - - - C++ - 1 - source_name - 0 - 0 - res - UTF-8 - connect - dialog_locked_items_query_base - 1000 - none - - - 1 - dialog_locked_items_query - - . - - 1 - 1 - 1 - 1 - UI - 0 - 0 - 0 - - 0 - wxAUI_MGR_DEFAULT - - - - 1 - 1 - impl_virtual - - - - 0 - wxID_ANY - + + + C++ + + 1 + connect + none + + + 0 + 0 + res + UTF-8 + dialog_locked_items_query_base + 1000 + 1 + 1 + UI + dialog_locked_items_query + . + 0 + source_name + 1 + 0 + source_name + + + 1 + 1 + 0 + 0 + + 0 + wxAUI_MGR_DEFAULT + + + + 1 + 0 + 1 + impl_virtual + + + + 0 + wxID_ANY + + + DIALOG_LOCKED_ITEMS_QUERY_BASE + + -1,-1 + wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER + DIALOG_SHIM; dialog_shim.h + Locked Items + + 0 + + + + OnInitDlg + + + bSizerMain + wxVERTICAL + none + + 5 + wxEXPAND|wxALL + 1 + + 2 + wxBOTH + + + 0 - DIALOG_LOCKED_ITEMS_QUERY_BASE - - -1,-1 - wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER - DIALOG_SHIM; dialog_shim.h - Locked Items - - - - - OnInitDlg - + fgSizer4 + wxFLEX_GROWMODE_SPECIFIED + none + 0 + 10 + + 10 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 - bSizerMain + 1 + m_icon + 1 + + + protected + 1 + + Resizable + 1 + + ; ; forward_declare + 0 + + + + + + + + 5 + wxEXPAND|wxRIGHT + 1 + + + bSizer4 wxVERTICAL none - - 5 - wxEXPAND|wxALL - 1 - - 2 - wxBOTH - - - 0 - - fgSizer4 - wxFLEX_GROWMODE_SPECIFIED - none - 0 - 10 - - 10 - wxALL|wxALIGN_CENTER_VERTICAL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_icon - 1 - - - protected - 1 - - Resizable - 1 - - ; ; forward_declare - 0 - - - - - - - - 5 - wxEXPAND|wxRIGHT - 1 - - - bSizer4 - wxVERTICAL - none - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - The selection contains %d locked items. - 0 - - 0 - - - 0 - - 1 - m_messageLine1 - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - - - - - -1 - - - - 5 - wxBOTTOM|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - These items will be skipped unless you override the locks. - 0 - - 0 - - - 0 - - 1 - m_messageLine2 - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - - - - - -1 - - - - - - 5 - wxEXPAND - 1 - - 0 - protected - 0 - - - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Remember decision for this session. - - 0 - - - 0 - - 1 - m_doNotShowBtn - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - Remember the option selected for the remainder of this session. This dialog will not be shown again until KiCad is restarted. - - wxFILTER_NONE - wxDefaultValidator - - - - - - - + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + The selection contains %lu locked items. + 0 + + 0 + + + 0 + + 1 + m_messageLine1 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + - - 5 - wxEXPAND - 0 - - - bButtonSizer - wxHORIZONTAL - none - - 10 - wxALIGN_CENTER_VERTICAL|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - 0 - - - - - 1 - 0 - 1 - - 1 - - 0 - 0 - - Dock - 0 - Left - 1 - - 1 - - - 0 - 0 - wxID_ANY - Override Locks - - 0 - - 0 - - - 0 - - 1 - m_overrideBtn - 1 - - - protected - 1 - - - - Resizable - 1 - - - - 0 - Override locks and apply the operation on all the items selected. Any locked items will remain locked after the operation is complete. - - wxFILTER_NONE - wxDefaultValidator - - - - - onOverrideLocks - - - - 5 - wxBOTTOM|wxTOP - 1 - - 0 - 1 - 0 - 0 - 0 - 1 - 0 - 0 - - m_sdbSizer - protected - - - + + 5 + wxBOTTOM|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + These items will be skipped unless you override the locks. + 0 + + 0 + + + 0 + + 1 + m_messageLine2 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxEXPAND + 1 + + 0 + protected + 0 + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Remember decision for this session. + + 0 + + + 0 + + 1 + m_doNotShowBtn + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + Remember the option selected for the remainder of this session. This dialog will not be shown again until KiCad is restarted. + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + 5 + wxEXPAND + 0 + + + bButtonSizer + wxHORIZONTAL + none + + 10 + wxALIGN_CENTER_VERTICAL|wxLEFT + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + Override Locks + + 0 + + 0 + + + 0 + + 1 + m_overrideBtn + 1 + + + protected + 1 + + + + Resizable + 1 + + + + 0 + Override locks and apply the operation on all the items selected. Any locked items will remain locked after the operation is complete. + + wxFILTER_NONE + wxDefaultValidator + + + + + onOverrideLocks + + + + 5 + wxBOTTOM|wxTOP + 1 + + 0 + 1 + 0 + 0 + 0 + 1 + 0 + 0 + + m_sdbSizer + protected + + + + + + diff --git a/common/dialogs/dialog_locked_items_query_base.h b/common/dialogs/dialog_locked_items_query_base.h index 8f909828d7..a25b03c3d9 100644 --- a/common/dialogs/dialog_locked_items_query_base.h +++ b/common/dialogs/dialog_locked_items_query_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 3.9.0 Jun 3 2020) +// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -28,7 +28,6 @@ /////////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////////////// /// Class DIALOG_LOCKED_ITEMS_QUERY_BASE /////////////////////////////////////////////////////////////////////////////// @@ -54,6 +53,7 @@ class DIALOG_LOCKED_ITEMS_QUERY_BASE : public DIALOG_SHIM public: DIALOG_LOCKED_ITEMS_QUERY_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Locked Items"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + ~DIALOG_LOCKED_ITEMS_QUERY_BASE(); }; diff --git a/include/dialogs/dialog_locked_items_query.h b/include/dialogs/dialog_locked_items_query.h index 7fe727a214..6dfde94812 100644 --- a/include/dialogs/dialog_locked_items_query.h +++ b/include/dialogs/dialog_locked_items_query.h @@ -21,22 +21,23 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#ifndef DIALOG_LOCKED_ITEMS_QUERY_H -#define DIALOG_LOCKED_ITEMS_QUERY_H +#pragma once #include +#include class DIALOG_LOCKED_ITEMS_QUERY : public DIALOG_LOCKED_ITEMS_QUERY_BASE { public: /// This has no dependencies on calling wxFrame derivative, such as PCB_BASE_FRAME. - DIALOG_LOCKED_ITEMS_QUERY( wxWindow* aParent, int aLockedItemCount ); + DIALOG_LOCKED_ITEMS_QUERY( wxWindow* aParent, std::size_t aLockedItemCount, + PCBNEW_SETTINGS::LOCKING_OPTIONS& aLockingOptions ); int ShowModal() override; private: void onOverrideLocks( wxCommandEvent& event ) override; -}; -#endif // DIALOG_LOCKED_ITEMS_QUERY_H + PCBNEW_SETTINGS::LOCKING_OPTIONS& m_lockingOptions; +}; diff --git a/pcbnew/dialogs/panel_edit_options.cpp b/pcbnew/dialogs/panel_edit_options.cpp index 7d2617d723..c7fc01100f 100644 --- a/pcbnew/dialogs/panel_edit_options.cpp +++ b/pcbnew/dialogs/panel_edit_options.cpp @@ -67,6 +67,7 @@ void PANEL_EDIT_OPTIONS::loadPCBSettings( PCBNEW_SETTINGS* aCfg ) m_trackMouseDragCtrl->SetSelection( (int) aCfg->m_TrackDragAction ); m_boardItemsFlip->SetSelection( static_cast( aCfg->m_FlipDirection ) ); m_allowFreePads->SetValue( aCfg->m_AllowFreePads ); + m_overrideLocks->SetValue( aCfg->m_LockingOptions.m_sessionSkipPrompts ); m_autoRefillZones->SetValue( aCfg->m_AutoRefillZones ); m_magneticPadChoice->SetSelection( static_cast( aCfg->m_MagneticItems.pads ) ); @@ -153,6 +154,7 @@ bool PANEL_EDIT_OPTIONS::TransferDataFromWindow() cfg->m_TrackDragAction = (TRACK_DRAG_ACTION) m_trackMouseDragCtrl->GetSelection(); cfg->m_FlipDirection = static_cast( m_boardItemsFlip->GetSelection() ); cfg->m_AllowFreePads = m_allowFreePads->GetValue(); + cfg->m_LockingOptions.m_sessionSkipPrompts = m_overrideLocks->GetValue(); cfg->m_AutoRefillZones = m_autoRefillZones->GetValue(); cfg->m_MagneticItems.pads = static_cast( m_magneticPadChoice->GetSelection() ); diff --git a/pcbnew/dialogs/panel_edit_options_base.cpp b/pcbnew/dialogs/panel_edit_options_base.cpp index aa4c1523ec..0642044e37 100644 --- a/pcbnew/dialogs/panel_edit_options_base.cpp +++ b/pcbnew/dialogs/panel_edit_options_base.cpp @@ -97,6 +97,11 @@ PANEL_EDIT_OPTIONS_BASE::PANEL_EDIT_OPTIONS_BASE( wxWindow* parent, wxWindowID i m_sizerBoardEdit->Add( m_allowFreePads, 0, wxBOTTOM|wxLEFT, 5 ); + m_overrideLocks = new wxCheckBox( bOptionsSizer->GetStaticBox(), wxID_ANY, _("Do not prompt for lock overrides for this session"), wxDefaultPosition, wxDefaultSize, 0 ); + m_overrideLocks->SetToolTip( _("If checked, no prompt will be shown when attempting to edit locked items. This setting is reset when KiCad restarts.") ); + + m_sizerBoardEdit->Add( m_overrideLocks, 0, wxBOTTOM|wxLEFT, 5 ); + bOptionsSizer->Add( m_sizerBoardEdit, 0, wxEXPAND|wxTOP, 5 ); diff --git a/pcbnew/dialogs/panel_edit_options_base.fbp b/pcbnew/dialogs/panel_edit_options_base.fbp index 2a70a6d6b1..d83ce851eb 100644 --- a/pcbnew/dialogs/panel_edit_options_base.fbp +++ b/pcbnew/dialogs/panel_edit_options_base.fbp @@ -801,6 +801,71 @@ + + 5 + wxBOTTOM|wxLEFT + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Do not prompt for lock overrides for this session + + 0 + + + 0 + + 1 + m_overrideLocks + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + If checked, no prompt will be shown when attempting to edit locked items. This setting is reset when KiCad restarts. + + wxFILTER_NONE + wxDefaultValidator + + + + + + diff --git a/pcbnew/dialogs/panel_edit_options_base.h b/pcbnew/dialogs/panel_edit_options_base.h index 9277e8457f..d8aa58305f 100644 --- a/pcbnew/dialogs/panel_edit_options_base.h +++ b/pcbnew/dialogs/panel_edit_options_base.h @@ -49,6 +49,7 @@ class PANEL_EDIT_OPTIONS_BASE : public RESETTABLE_PANEL wxChoice* m_trackMouseDragCtrl; wxRadioBox* m_boardItemsFlip; wxCheckBox* m_allowFreePads; + wxCheckBox* m_overrideLocks; wxStaticBoxSizer* m_mouseCmdsWinLin; wxStaticText* m_staticText181; wxRadioBox* m_rbCtrlClickAction; diff --git a/pcbnew/pcbnew_settings.cpp b/pcbnew/pcbnew_settings.cpp index c5f700068a..f866289c9f 100644 --- a/pcbnew/pcbnew_settings.cpp +++ b/pcbnew/pcbnew_settings.cpp @@ -90,6 +90,8 @@ PCBNEW_SETTINGS::PCBNEW_SETTINGS() m_MagneticItems.graphics = false; m_MagneticItems.allLayers = false; + m_LockingOptions.m_sessionSkipPrompts = false; + m_params.emplace_back( new PARAM( "aui.show_layer_manager", &m_AuiPanels.show_layer_manager, true ) ); diff --git a/pcbnew/pcbnew_settings.h b/pcbnew/pcbnew_settings.h index d8b865ddb6..b0b024508b 100644 --- a/pcbnew/pcbnew_settings.h +++ b/pcbnew/pcbnew_settings.h @@ -369,6 +369,12 @@ public: bool m_Live3DRefresh; }; + struct LOCKING_OPTIONS + { + // Skip lock prompts for the current session + bool m_sessionSkipPrompts; + }; + PCBNEW_SETTINGS(); virtual ~PCBNEW_SETTINGS(); @@ -459,6 +465,8 @@ public: wxString m_lastFootprint3dDir; + LOCKING_OPTIONS m_LockingOptions; + ACTION_PLUGIN_SETTINGS_LIST m_VisibleActionPlugins; protected: diff --git a/pcbnew/tools/pcb_selection_tool.cpp b/pcbnew/tools/pcb_selection_tool.cpp index ea7335e7d6..2deb1a1b2a 100644 --- a/pcbnew/tools/pcb_selection_tool.cpp +++ b/pcbnew/tools/pcb_selection_tool.cpp @@ -714,9 +714,11 @@ PCB_SELECTION& PCB_SELECTION_TOOL::RequestSelection( CLIENT_SELECTION_FILTER aCl lockedItems.push_back( boardItem ); } - if( !lockedItems.empty() ) + PCBNEW_SETTINGS* settings = m_frame->GetPcbNewSettings(); + if( !lockedItems.empty() && !settings->m_LockingOptions.m_sessionSkipPrompts ) { - DIALOG_LOCKED_ITEMS_QUERY dlg( frame(), (int) lockedItems.size() ); + DIALOG_LOCKED_ITEMS_QUERY dlg( frame(), lockedItems.size(), + settings->m_LockingOptions ); switch( dlg.ShowModal() ) {