Grids: update context menu on changes to grids
Fixes: https://gitlab.com/kicad/code/kicad/-/issues/15492
This commit is contained in:
parent
2764e59400
commit
c7abbccfac
|
@ -70,15 +70,17 @@ void GRID_MENU::update()
|
||||||
APP_SETTINGS_BASE* settings = m_parent->config();
|
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;
|
||||||
wxArrayString gridsList;
|
wxArrayString gridsList;
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
GRID_MENU::BuildChoiceList( &gridsList, settings, m_parent );
|
GRID_MENU::BuildChoiceList( &gridsList, settings, m_parent );
|
||||||
|
|
||||||
for( unsigned int i = 0; i < GetMenuItemCount(); ++i )
|
while( GetMenuItemCount() > 0 )
|
||||||
{
|
Delete( FindItemByPosition( 0 ) );
|
||||||
wxMenuItem* menuItem = FindItemByPosition( i );
|
|
||||||
|
|
||||||
menuItem->SetItemLabel( gridsList[ i ] ); // Refresh label in case units have changed
|
for( const wxString& grid : gridsList )
|
||||||
menuItem->Check( i == current ); // Refresh checkmark
|
{
|
||||||
|
Append( i, grid, wxEmptyString, wxITEM_CHECK )->Check( i == (int) current );
|
||||||
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue