From c3333d4665ee12de1a4c34e0ff12afb83aa578ad Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Wed, 7 Mar 2018 18:56:49 -0500 Subject: [PATCH] GerbView: ensure view settings are saved/restored in measure tool Fixes: lp:1754100 * https://bugs.launchpad.net/kicad/+bug/1754100 --- gerbview/tools/selection_tool.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/gerbview/tools/selection_tool.cpp b/gerbview/tools/selection_tool.cpp index 9a26387a68..1af09dfffd 100644 --- a/gerbview/tools/selection_tool.cpp +++ b/gerbview/tools/selection_tool.cpp @@ -823,10 +823,11 @@ int GERBVIEW_SELECTION_TOOL::MeasureTool( const TOOL_EVENT& aEvent ) { auto& view = *getView(); auto& controls = *getViewControls(); + auto previous_settings = controls.GetSettings(); Activate(); - getEditFrame()->SetToolID( ID_TB_MEASUREMENT_TOOL, - wxCURSOR_PENCIL, _( "Measure distance between two points" ) ); + m_frame->SetToolID( ID_TB_MEASUREMENT_TOOL, wxCURSOR_PENCIL, + _( "Measure distance" ) ); KIGFX::PREVIEW::TWO_POINT_GEOMETRY_MANAGER twoPtMgr; KIGFX::PREVIEW::RULER_ITEM ruler( twoPtMgr ); @@ -838,7 +839,7 @@ int GERBVIEW_SELECTION_TOOL::MeasureTool( const TOOL_EVENT& aEvent ) controls.ShowCursor( true ); controls.SetSnapping( true ); - getViewControls()->SetAdditionalPanButtons( false, true ); + controls.SetAdditionalPanButtons( false, true ); while( auto evt = Wait() ) { @@ -904,9 +905,10 @@ int GERBVIEW_SELECTION_TOOL::MeasureTool( const TOOL_EVENT& aEvent ) view.SetVisible( &ruler, false ); view.Remove( &ruler ); - getViewControls()->SetAdditionalPanButtons( false, false ); - getEditFrame()->SetToolID( ID_NO_TOOL_SELECTED, wxCURSOR_DEFAULT, wxEmptyString ); + controls.ApplySettings( previous_settings ); + + m_frame->SetNoToolSelected(); return 0; }