GerbView: ensure view settings are saved/restored in measure tool

Fixes: lp:1754100
* https://bugs.launchpad.net/kicad/+bug/1754100
This commit is contained in:
Jon Evans 2018-03-07 18:56:49 -05:00
parent 1ae721442c
commit c3333d4665
1 changed files with 7 additions and 5 deletions

View File

@ -823,10 +823,11 @@ int GERBVIEW_SELECTION_TOOL::MeasureTool( const TOOL_EVENT& aEvent )
{ {
auto& view = *getView(); auto& view = *getView();
auto& controls = *getViewControls(); auto& controls = *getViewControls();
auto previous_settings = controls.GetSettings();
Activate(); Activate();
getEditFrame<GERBVIEW_FRAME>()->SetToolID( ID_TB_MEASUREMENT_TOOL, m_frame->SetToolID( ID_TB_MEASUREMENT_TOOL, wxCURSOR_PENCIL,
wxCURSOR_PENCIL, _( "Measure distance between two points" ) ); _( "Measure distance" ) );
KIGFX::PREVIEW::TWO_POINT_GEOMETRY_MANAGER twoPtMgr; KIGFX::PREVIEW::TWO_POINT_GEOMETRY_MANAGER twoPtMgr;
KIGFX::PREVIEW::RULER_ITEM ruler( twoPtMgr ); KIGFX::PREVIEW::RULER_ITEM ruler( twoPtMgr );
@ -838,7 +839,7 @@ int GERBVIEW_SELECTION_TOOL::MeasureTool( const TOOL_EVENT& aEvent )
controls.ShowCursor( true ); controls.ShowCursor( true );
controls.SetSnapping( true ); controls.SetSnapping( true );
getViewControls()->SetAdditionalPanButtons( false, true ); controls.SetAdditionalPanButtons( false, true );
while( auto evt = Wait() ) while( auto evt = Wait() )
{ {
@ -904,9 +905,10 @@ int GERBVIEW_SELECTION_TOOL::MeasureTool( const TOOL_EVENT& aEvent )
view.SetVisible( &ruler, false ); view.SetVisible( &ruler, false );
view.Remove( &ruler ); view.Remove( &ruler );
getViewControls()->SetAdditionalPanButtons( false, false );
getEditFrame<GERBVIEW_FRAME>()->SetToolID( ID_NO_TOOL_SELECTED, wxCURSOR_DEFAULT, wxEmptyString ); controls.ApplySettings( previous_settings );
m_frame->SetNoToolSelected();
return 0; return 0;
} }