From 69e60d3982a7acee5244ced04446e00e328eb880 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sat, 1 Jun 2019 01:48:11 +0100 Subject: [PATCH] Make sure grid settings get set in new canvas when switching. --- pcbnew/footprint_edit_frame.cpp | 5 ++++- pcbnew/pcb_edit_frame.cpp | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/pcbnew/footprint_edit_frame.cpp b/pcbnew/footprint_edit_frame.cpp index f50b88521a..be378ab90c 100644 --- a/pcbnew/footprint_edit_frame.cpp +++ b/pcbnew/footprint_edit_frame.cpp @@ -265,11 +265,12 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent, m_auimgr.AddPane( GetGalCanvas(), EDA_PANE().Canvas().Name( "DrawFrame" ).Center() ); GetGalCanvas()->GetGAL()->SetAxesEnabled( true ); - + GetGalCanvas()->GetGAL()->SetGridSize( VECTOR2D( GetScreen()->GetGridSize() ) ); GetGalCanvas()->GetView()->SetScale( GetZoomLevelCoeff() / GetScreen()->GetZoom() ); ActivateGalCanvas(); m_auimgr.Update(); + GetToolManager()->RunAction( ACTIONS::gridPreset, true, m_LastGridSizeId ); GetToolManager()->RunAction( ACTIONS::zoomFitScreen ); updateTitle(); @@ -292,7 +293,9 @@ void FOOTPRINT_EDIT_FRAME::SwitchCanvas( EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasTyp { // switches currently used canvas (Cairo / OpenGL). PCB_BASE_FRAME::SwitchCanvas( aCanvasType ); + GetGalCanvas()->GetGAL()->SetAxesEnabled( true ); + GetGalCanvas()->GetGAL()->SetGridSize( VECTOR2D( GetScreen()->GetGridSize() ) ); // The base class method *does not reinit* the layers manager. We must upate the layer // widget to match board visibility states, both layers and render columns, and and some diff --git a/pcbnew/pcb_edit_frame.cpp b/pcbnew/pcb_edit_frame.cpp index 0bd037fb9b..0f2d0e0fa2 100644 --- a/pcbnew/pcb_edit_frame.cpp +++ b/pcbnew/pcb_edit_frame.cpp @@ -342,6 +342,7 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : syncLayerWidgetLayer(); m_auimgr.Update(); + GetToolManager()->RunAction( ACTIONS::gridPreset, true, m_LastGridSizeId ); GetToolManager()->RunAction( ACTIONS::zoomFitScreen ); m_canvasType = LoadCanvasTypeSetting(); @@ -388,7 +389,7 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : } GetGalCanvas()->SwitchBackend( m_canvasType ); - + galCanvas->GetGAL()->SetGridSize( VECTOR2D( GetScreen()->GetGridSize() ) ); galCanvas->GetView()->SetScale( GetZoomLevelCoeff() / GetScreen()->GetZoom() ); ActivateGalCanvas(); @@ -977,6 +978,8 @@ void PCB_EDIT_FRAME::SwitchCanvas( EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType ) // switches currently used canvas (Cairo / OpenGL). PCB_BASE_FRAME::SwitchCanvas( aCanvasType ); + GetGalCanvas()->GetGAL()->SetGridSize( VECTOR2D( GetScreen()->GetGridSize() ) ); + // The base class method *does not reinit* the layers manager. We must upate the // layer widget to match board visibility states, both layers and render columns. syncLayerVisibilities();