Fix grid selection issue when starting Eeschema or Gerbview:

Eeschema (also Libedit and Libview) starts always to the default grid (50 mils)
Gerbview starts with the last selected grid, but the validity is tested.
In Pcbnew the grid value is always displayed, so it should always be good.
This commit is contained in:
jean-pierre charras 2012-05-06 18:55:51 +02:00
parent 051a7e5733
commit a3f83d771f
4 changed files with 14 additions and 10 deletions

View File

@ -204,6 +204,7 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( SCH_EDIT_FRAME* aParent,
m_tempCopyComponent = NULL;
m_HotkeysZoomAndGridList = s_Libedit_Hokeys_Descr;
m_editPinsPerPartOrConvert = false;
m_LastGridSizeId = ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000;
wxIcon icon;
@ -219,12 +220,10 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( SCH_EDIT_FRAME* aParent,
LoadSettings();
// Initialize grid id to a default value if not found in config or bad:
if( (m_LastGridSizeId <= 0)
|| ( m_LastGridSizeId < (ID_POPUP_GRID_USER - ID_POPUP_GRID_LEVEL_1000) ) )
m_LastGridSizeId = ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000;
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
// Initialize grid id to the default value 50 mils:
m_LastGridSizeId = ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000;
GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
if( m_canvas )

View File

@ -216,11 +216,8 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( wxWindow* father,
/* Get config */
LoadSettings();
// Initialize grid id to a default value if not found in config or bad:
if( (m_LastGridSizeId <= 0)
|| ( m_LastGridSizeId < (ID_POPUP_GRID_USER - ID_POPUP_GRID_LEVEL_1000) ) )
m_LastGridSizeId = ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000;
// Initialize grid id to the default value (50 mils):
m_LastGridSizeId = ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000;
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
if( m_canvas )

View File

@ -130,6 +130,9 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( wxWindow* father, CMP_LIBRARY* Library, wxSemaph
LoadSettings();
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
// Initialize grid id to the default value (50 mils):
m_LastGridSizeId = ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000;
GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
ReCreateHToolbar();

View File

@ -107,6 +107,11 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( wxWindow* father,
// initialize parameters in m_LayersManager
LoadSettings();
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
if( m_LastGridSizeId < ID_POPUP_GRID_LEVEL_1000 )
m_LastGridSizeId = m_LastGridSizeId;
if( m_LastGridSizeId > ID_POPUP_GRID_LEVEL_0_0_1MM )
m_LastGridSizeId = ID_POPUP_GRID_LEVEL_0_0_1MM
GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
ReCreateMenuBar();