Fix index calculation in grid submenu

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15514
This commit is contained in:
Ian McInerney 2023-08-26 22:10:13 +01:00
parent 208d146a03
commit 375c2db844
1 changed files with 5 additions and 2 deletions

View File

@ -68,7 +68,7 @@ void GRID_MENU::UpdateTitle()
void GRID_MENU::update()
{
APP_SETTINGS_BASE* settings = m_parent->config();
unsigned int current = settings->m_Window.grid.last_size_idx;
unsigned int current = settings->m_Window.grid.last_size_idx + ID_POPUP_GRID_START;
wxArrayString gridsList;
int i = ID_POPUP_GRID_START;
@ -78,7 +78,10 @@ void GRID_MENU::update()
Delete( FindItemByPosition( 0 ) );
for( const wxString& grid : gridsList )
Append( i++, grid, wxEmptyString, wxITEM_CHECK )->Check( i == (int) current );
{
int idx = i++;
Append( idx, grid, wxEmptyString, wxITEM_CHECK )->Check( idx == (int) current );
}
}
void GRID_MENU::BuildChoiceList( wxArrayString* aGridsList, APP_SETTINGS_BASE* aCfg,