void EDA_DRAW_FRAME::SetPresetGrid( int aIndex ) { BASE_SCREEN * screen = GetScreen(); if( ! screen->GridExists( aIndex + ID_POPUP_GRID_LEVEL_1000 ) ) aIndex = screen->GetGrids()[0].m_CmdId; // aIndex is a Command Id relative to ID_POPUP_GRID_LEVEL_1000 comand id code. // we need an index in grid list (the cmd id in list is is screen->GetGrids()[0].m_CmdId): int glistIdx = aIndex + ID_POPUP_GRID_LEVEL_1000 - screen->GetGrids()[0].m_CmdId; if( m_gridSelectBox ) { if( glistIdx < 0 || glistIdx >= (int) m_gridSelectBox->GetCount() ) { wxASSERT_MSG( false, "Invalid grid index" ); return; } m_gridSelectBox->SetSelection( glistIdx ); } // Be sure m_LastGridSizeId is up to date. m_LastGridSizeId = aIndex; GetScreen()->SetGrid( aIndex + ID_POPUP_GRID_LEVEL_1000 ); // Put cursor on new grid SetCrossHairPosition( RefPos( true ) ); }