diff --git a/pcbnew/footprint_edit_frame.cpp b/pcbnew/footprint_edit_frame.cpp index 8d6a68b97e..b8d23fa124 100644 --- a/pcbnew/footprint_edit_frame.cpp +++ b/pcbnew/footprint_edit_frame.cpp @@ -808,6 +808,11 @@ bool FOOTPRINT_EDIT_FRAME::canCloseWindow( wxCloseEvent& aEvent ) } } + PAD_TOOL* padTool = m_toolManager->GetTool(); + + if( padTool->InPadEditMode() ) + padTool->ExitPadEditMode(); + // Save footprint tree column widths m_adapter->SaveSettings(); diff --git a/pcbnew/tools/pad_tool.cpp b/pcbnew/tools/pad_tool.cpp index 975f046c67..643ebcd1da 100644 --- a/pcbnew/tools/pad_tool.cpp +++ b/pcbnew/tools/pad_tool.cpp @@ -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,9 +768,13 @@ void PAD_TOOL::enterPadEditMode() } -void PAD_TOOL::exitPadEditMode() +void PAD_TOOL::ExitPadEditMode() { - PCB_DISPLAY_OPTIONS opts = frame()->GetDisplayOptions(); + KIGFX::PCB_PAINTER* painter = static_cast( view()->GetPainter() ); + PCB_RENDER_SETTINGS* settings = painter->GetSettings(); + PCB_DISPLAY_OPTIONS opts = frame()->GetDisplayOptions(); + + settings->m_PadEditModePad = nullptr; if( m_previousHighContrastMode != opts.m_ContrastModeDisplay ) { diff --git a/pcbnew/tools/pad_tool.h b/pcbnew/tools/pad_tool.h index 8d807b4e0b..2a4553a33c 100644 --- a/pcbnew/tools/pad_tool.h +++ b/pcbnew/tools/pad_tool.h @@ -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;