diff --git a/pcbnew/tools/convert_tool.cpp b/pcbnew/tools/convert_tool.cpp index cea9e81684..693968965a 100644 --- a/pcbnew/tools/convert_tool.cpp +++ b/pcbnew/tools/convert_tool.cpp @@ -235,10 +235,7 @@ CONVERT_TOOL::CONVERT_TOOL() : m_menu( nullptr ), m_frame( nullptr ) { - m_userSettings.m_Strategy = CENTERLINE; - m_userSettings.m_Gap = 0; - m_userSettings.m_LineWidth = 0; - m_userSettings.m_DeleteOriginals = true; + initUserSettings(); } @@ -319,6 +316,15 @@ bool CONVERT_TOOL::Init() } +void CONVERT_TOOL::initUserSettings() +{ + m_userSettings.m_Strategy = CENTERLINE; + m_userSettings.m_Gap = 0; + m_userSettings.m_LineWidth = 0; + m_userSettings.m_DeleteOriginals = true; +} + + int CONVERT_TOOL::CreatePolys( const TOOL_EVENT& aEvent ) { BOARD_DESIGN_SETTINGS& bds = m_frame->GetBoard()->GetDesignSettings(); @@ -400,6 +406,8 @@ int CONVERT_TOOL::CreatePolys( const TOOL_EVENT& aEvent ) showCopyLineWidth = false; } + CONVERT_SETTINGS previousSettings = m_userSettings; + CONVERT_SETTINGS_DIALOG dlg( m_frame, &m_userSettings, showCopyLineWidth, true, true ); if( dlg.ShowModal() != wxID_OK ) @@ -429,6 +437,8 @@ int CONVERT_TOOL::CreatePolys( const TOOL_EVENT& aEvent ) msg = _( "Objects must form a closed shape" ); DisplayErrorMessage( m_frame, _( "Could not convert selection" ), msg ); + + m_userSettings = previousSettings; return 0; } diff --git a/pcbnew/tools/convert_tool.h b/pcbnew/tools/convert_tool.h index 1de29290c9..fd881e040e 100644 --- a/pcbnew/tools/convert_tool.h +++ b/pcbnew/tools/convert_tool.h @@ -96,6 +96,11 @@ private: SHAPE_POLY_SET makePolysFromClosedGraphics( const std::deque& aItems, CONVERT_STRATEGY aStrategy ); + /** + * Initialize the user settings for the tool. + */ + void initUserSettings(); + private: PCB_SELECTION_TOOL* m_selectionTool; CONDITIONAL_MENU* m_menu;