Browse Source

Allow scrolling by keyboard in search panel

Lets you quickly scroll through elements in the board, zooming and
selecting each
pull/18/head
Seth Hillbrand 4 months ago
parent
commit
f14ba983d6
  1. 63
      common/widgets/search_pane_tab.cpp

63
common/widgets/search_pane_tab.cpp

@ -151,13 +151,18 @@ void SEARCH_PANE_LISTVIEW::OnColClicked( wxListEvent& aEvent )
void SEARCH_PANE_LISTVIEW::OnChar( wxKeyEvent& aEvent )
{
if( aEvent.GetKeyCode() == WXK_CONTROL_A )
switch( aEvent.GetKeyCode() )
{
case WXK_CONTROL_A:
{
// Select All
for( int row = 0; row < GetItemCount(); row++ )
SetItemState( row, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED );
break;
}
else if( aEvent.GetKeyCode() == WXK_CONTROL_C )
case WXK_CONTROL_C:
{
// Copy to clipboard the selected rows
if( wxTheClipboard->Open() )
@ -186,6 +191,60 @@ void SEARCH_PANE_LISTVIEW::OnChar( wxKeyEvent& aEvent )
wxTheClipboard->SetData( new wxTextDataObject( txt ) );
wxTheClipboard->Close();
}
break;
}
case WXK_DOWN:
case WXK_NUMPAD_DOWN:
{
// Move selection down
long focused = GetFocusedItem();
if( focused < 0 )
focused = 0;
if( focused < GetItemCount() - 1 )
{
if( !(aEvent.GetModifiers() & wxMOD_SHIFT) )
{
int next = -1;
while( ( next = GetNextSelected( next ) ) != wxNOT_FOUND )
Select( next, false );
}
++focused;
Focus( focused );
Select( focused );
}
break;
}
case WXK_UP:
case WXK_NUMPAD_UP:
{
// Move selection up
long focused = GetFocusedItem();
if( focused < 0 )
focused = 0;
if( focused > 0 )
{
if( !(aEvent.GetModifiers() & wxMOD_SHIFT) )
{
int next = -1;
while( ( next = GetNextSelected( next ) ) != wxNOT_FOUND )
Select( next, false );
}
--focused;
Focus( focused );
Select( focused );
}
break;
}
}
}

Loading…
Cancel
Save