diff --git a/pcbnew/dialogs/dialog_set_grid.cpp b/pcbnew/dialogs/dialog_set_grid.cpp index ad0323476a..a4e575e921 100644 --- a/pcbnew/dialogs/dialog_set_grid.cpp +++ b/pcbnew/dialogs/dialog_set_grid.cpp @@ -34,8 +34,10 @@ #include #include #include + #include #include +#include class DIALOG_SET_GRID : public DIALOG_SET_GRID_BASE @@ -227,12 +229,12 @@ bool PCB_BASE_FRAME::InvokeDialogGrid() if( screen->GetGridId() == ID_POPUP_GRID_USER ) screen->SetGrid( ID_POPUP_GRID_USER ); - if( IsGalCanvasActive() ) - { - GetGalCanvas()->GetGAL()->SetGridSize( VECTOR2D( screen->GetGrid().m_Size.x, - screen->GetGrid().m_Size.y ) ); - GetGalCanvas()->GetView()->MarkTargetDirty( KIGFX::TARGET_NONCACHED ); - } + // Notify GAL + TOOL_MANAGER* mgr = GetToolManager(); + + if( mgr && IsGalCanvasActive() ) + mgr->RunAction( "common.Control.gridPreset", true, + ID_POPUP_GRID_USER - ID_POPUP_GRID_LEVEL_1000 ); m_canvas->Refresh(); diff --git a/pcbnew/tools/pcbnew_control.cpp b/pcbnew/tools/pcbnew_control.cpp index c34d834780..99da5fa518 100644 --- a/pcbnew/tools/pcbnew_control.cpp +++ b/pcbnew/tools/pcbnew_control.cpp @@ -135,10 +135,15 @@ int PCBNEW_CONTROL::ZoomPreset( const TOOL_EVENT& aEvent ) m_frame->SetPresetZoom( idx ); - if( idx == 0 ) + if( idx == 0 ) // Zoom Auto + { return ZoomFitScreen( aEvent ); + } else if( idx < 0 || idx >= zoomList.size() ) + { + assert( false ); return 0; + } double selectedZoom = zoomList[idx]; double zoomFactor = gal->GetWorldScale() / gal->GetZoomFactor();