Exit pad edit mode before closing footprint editor.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/16766
This commit is contained in:
Jeff Young 2024-01-26 13:48:41 +00:00
parent f4e123f57e
commit cc058a7927
3 changed files with 14 additions and 8 deletions

View File

@ -808,6 +808,11 @@ bool FOOTPRINT_EDIT_FRAME::canCloseWindow( wxCloseEvent& aEvent )
}
}
PAD_TOOL* padTool = m_toolManager->GetTool<PAD_TOOL>();
if( padTool->InPadEditMode() )
padTool->ExitPadEditMode();
// Save footprint tree column widths
m_adapter->SaveSettings();

View File

@ -690,10 +690,7 @@ int PAD_TOOL::EditPad( const TOOL_EVENT& aEvent )
}
if( m_editPad == niluuid )
{
settings->m_PadEditModePad = nullptr;
exitPadEditMode();
}
ExitPadEditMode();
return 0;
}
@ -728,7 +725,7 @@ int PAD_TOOL::OnUndoRedo( const TOOL_EVENT& aEvent )
if( flaggedPad )
enterPadEditMode();
else
exitPadEditMode();
ExitPadEditMode();
}
return 0;
@ -771,10 +768,14 @@ void PAD_TOOL::enterPadEditMode()
}
void PAD_TOOL::exitPadEditMode()
void PAD_TOOL::ExitPadEditMode()
{
KIGFX::PCB_PAINTER* painter = static_cast<KIGFX::PCB_PAINTER*>( view()->GetPainter() );
PCB_RENDER_SETTINGS* settings = painter->GetSettings();
PCB_DISPLAY_OPTIONS opts = frame()->GetDisplayOptions();
settings->m_PadEditModePad = nullptr;
if( m_previousHighContrastMode != opts.m_ContrastModeDisplay )
{
opts.m_ContrastModeDisplay = m_previousHighContrastMode;

View File

@ -63,6 +63,7 @@ public:
int OnUndoRedo( const TOOL_EVENT& aEvent );
bool InPadEditMode() { return m_editPad != niluuid; }
void ExitPadEditMode();
wxString GetLastPadNumber() const { return m_lastPadNumber; }
void SetLastPadNumber( const wxString& aPadNumber ) { m_lastPadNumber = aPadNumber; }
@ -91,7 +92,6 @@ private:
void explodePad( PAD* aPad, PCB_LAYER_ID* aLayer );
void enterPadEditMode();
void exitPadEditMode();
private:
wxString m_lastPadNumber;