Don't allow footprint editor pad tools to run outside footprint editor.

(They can get called if a user re-assigns hotkeys to them.)

Fixes https://gitlab.com/kicad/code/kicad/issues/14166
This commit is contained in:
Jeff Young 2023-03-06 14:30:58 +00:00
parent 05ab9e3836
commit 7dbd920912
1 changed files with 9 additions and 0 deletions

View File

@ -282,6 +282,9 @@ int PAD_TOOL::pushPadSettings( const TOOL_EVENT& aEvent )
int PAD_TOOL::EnumeratePads( const TOOL_EVENT& aEvent )
{
if( !m_isFootprintEditor )
return 0;
if( !board()->GetFirstFootprint() || board()->GetFirstFootprint()->Pads().empty() )
return 0;
@ -491,6 +494,9 @@ int PAD_TOOL::EnumeratePads( const TOOL_EVENT& aEvent )
int PAD_TOOL::PlacePad( const TOOL_EVENT& aEvent )
{
if( !m_isFootprintEditor )
return 0;
if( !board()->GetFirstFootprint() )
return 0;
@ -571,6 +577,9 @@ int PAD_TOOL::PlacePad( const TOOL_EVENT& aEvent )
int PAD_TOOL::EditPad( const TOOL_EVENT& aEvent )
{
if( !m_isFootprintEditor )
return 0;
PCB_DISPLAY_OPTIONS opts = frame()->GetDisplayOptions();
PCB_RENDER_SETTINGS* settings = static_cast<PCB_RENDER_SETTINGS*>( view()->GetPainter()->GetSettings() );
WX_INFOBAR* infoBar = frame()->GetInfoBar();