Gerbview: fix missing grid initialization at starting.

This commit is contained in:
jean-pierre charras 2019-10-03 18:32:09 +02:00
parent c3175b45af
commit 9d617502d5
3 changed files with 14 additions and 5 deletions

View File

@ -287,9 +287,11 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ):
m_auimgr.Update(); m_auimgr.Update();
GetToolManager()->RunAction( ACTIONS::gridPreset, true, m_LastGridSizeId );
GetToolManager()->RunAction( ACTIONS::zoomFitScreen, true ); GetToolManager()->RunAction( ACTIONS::zoomFitScreen, true );
// Init grid size and visibility
GetToolManager()->RunAction( ACTIONS::gridPreset, true, m_LastGridSizeId );
if( GetCanvas() ) if( GetCanvas() )
GetCanvas()->GetGAL()->SetGridVisibility( IsGridVisible() ); GetCanvas()->GetGAL()->SetGridVisibility( IsGridVisible() );

View File

@ -133,8 +133,6 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent ):
if( m_LastGridSizeId > ID_POPUP_GRID_LEVEL_0_0_1MM-ID_POPUP_GRID_LEVEL_1000 ) if( m_LastGridSizeId > ID_POPUP_GRID_LEVEL_0_0_1MM-ID_POPUP_GRID_LEVEL_1000 )
m_LastGridSizeId = ID_POPUP_GRID_LEVEL_0_0_1MM-ID_POPUP_GRID_LEVEL_1000; m_LastGridSizeId = ID_POPUP_GRID_LEVEL_0_0_1MM-ID_POPUP_GRID_LEVEL_1000;
GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
setupTools(); setupTools();
ReCreateMenuBar(); ReCreateMenuBar();
ReCreateHToolbar(); ReCreateHToolbar();
@ -211,6 +209,12 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent ):
m_LayersManager->ReFill(); m_LayersManager->ReFill();
m_LayersManager->ReFillRender(); // Update colors in Render after the config is read m_LayersManager->ReFillRender(); // Update colors in Render after the config is read
GetToolManager()->RunAction( ACTIONS::zoomFitScreen, true );
GetToolManager()->RunAction( ACTIONS::gridPreset, true, m_LastGridSizeId );
if( GetCanvas() )
GetCanvas()->GetGAL()->SetGridVisibility( IsGridVisible() );
// Update the checked state of tools // Update the checked state of tools
SyncToolbars(); SyncToolbars();
} }

View File

@ -1386,13 +1386,16 @@ bool MODULE::BuildPolyCourtyard()
wxString error_msg; wxString error_msg;
#define ARC_ERROR_MAX 0.02 /* error max in mm to approximate a arc by segments */
bool success = ConvertOutlineToPolygon( list_front, m_poly_courtyard_front, bool success = ConvertOutlineToPolygon( list_front, m_poly_courtyard_front,
&error_msg, (unsigned) Millimeter2iu( 0.05 ) ); &error_msg,
(unsigned) Millimeter2iu( ARC_ERROR_MAX ) );
if( success ) if( success )
{ {
success = ConvertOutlineToPolygon( list_back, m_poly_courtyard_back, success = ConvertOutlineToPolygon( list_back, m_poly_courtyard_back,
&error_msg, (unsigned) Millimeter2iu( 0.05 ) ); &error_msg,
(unsigned) Millimeter2iu( ARC_ERROR_MAX ) );
} }
if( !error_msg.IsEmpty() ) if( !error_msg.IsEmpty() )