Implement our own navigation out of a grid.

While wxWidgets has Navigate() and NavigateIn(), they're not compiled
on GTK because it supposedly has native TAB control.  Of course its
native TAB control won't get you out of a grid, so that leaves us in
a bit of a pinch.  This implements a poor-man's Navigate() which will
at least get us out of the grid.

Fixes: lp:1810569
* https://bugs.launchpad.net/kicad/+bug/1810569
This commit is contained in:
Jeff Young 2019-06-24 13:35:25 +01:00
parent f088d4d762
commit cda3a82c66
1 changed files with 47 additions and 0 deletions

View File

@ -347,6 +347,53 @@ void GRID_TRICKS::onKeyDown( wxKeyEvent& ev )
return;
}
// ctrl-tab for exit grid
#ifdef __APPLE__
bool ctrl = ev.RawControlDown();
#else
bool ctrl = ev.ControlDown();
#endif
if( ctrl && ev.GetKeyCode() == WXK_TAB )
{
wxWindow* test = m_grid->GetNextSibling();
if( !test )
test = m_grid->GetParent()->GetNextSibling();
while( test && !test->IsTopLevel() )
{
test->SetFocus();
if( test->HasFocus() )
break;
if( !test->GetChildren().empty() )
test = test->GetChildren().front();
else if( test->GetNextSibling() )
test = test->GetNextSibling();
else
{
while( test )
{
test = test->GetParent();
if( test && test->IsTopLevel() )
{
break;
}
else if( test && test->GetNextSibling() )
{
test = test->GetNextSibling();
break;
}
}
}
}
return;
}
ev.Skip( true );
}