Gerbview, GAL mode: fix "Zoom to fit" area size calculation when nothing is loaded.

Also ensure the worksheet is displayed after clearing the gerber layers.
This commit is contained in:
jean-pierre charras 2018-06-01 09:27:23 +02:00
parent 9a228d8ec9
commit bfa89039c4
4 changed files with 19 additions and 0 deletions

View File

@ -55,6 +55,9 @@ bool GERBVIEW_FRAME::Clear_DrawLayers( bool query )
m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD );
canvas->GetView()->Clear();
// Reinit the worksheet view, cleared by GetView()->Clear():
SetPageSettings( GetPageSettings() );
}
GetImagesList()->DeleteAllImages();

View File

@ -168,3 +168,12 @@ void GERBVIEW_DRAW_PANEL_GAL::SetTopLayer( int aLayer )
m_view->UpdateAllLayersOrder();
}
BOX2I GERBVIEW_DRAW_PANEL_GAL::GetDefaultViewBBox() const
{
if( m_worksheet )
return m_worksheet->ViewBBox();
return BOX2I();
}

View File

@ -61,6 +61,9 @@ public:
///> @copydoc EDA_DRAW_PANEL_GAL::SetTopLayer
virtual void SetTopLayer( int aLayer ) override;
///> @copydoc EDA_DRAW_PANEL_GAL::GetDefaultViewBBox()
BOX2I GetDefaultViewBBox() const override;
/**
* Sets (or updates) worksheet used by the draw panel.
* @param aWorksheet is the worksheet to be used.

View File

@ -75,6 +75,10 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent ):
// obviously depends on the monitor,
// but this is an acceptable value
// Be sure a page info is set. this default value will be overwritten later.
PAGE_INFO pageInfo( wxT( "GERBER" ) );
SetPageSettings( pageInfo );
m_show_layer_manager_tools = true;
m_showAxis = true; // true to show X and Y axis on screen