| 679 | } |
| 680 | |
| 681 | void KeyConfigPrefs::OnFilterKeyDown(wxKeyEvent & e) |
| 682 | { |
| 683 | wxTextCtrl *t = (wxTextCtrl *)e.GetEventObject(); |
| 684 | int keycode = e.GetKeyCode(); |
| 685 | |
| 686 | // Make sure we can navigate away from the hotkey textctrl. |
| 687 | // On Linux and OSX, it an get stuck, but it doesn't hurt |
| 688 | // to do it for Windows as well. |
| 689 | if (keycode == WXK_TAB) { |
| 690 | wxNavigationKeyEvent nevent; |
| 691 | nevent.SetWindowChange(e.ControlDown()); |
| 692 | nevent.SetDirection(!e.ShiftDown()); |
| 693 | nevent.SetEventObject(t); |
| 694 | nevent.SetCurrentFocus(t); |
| 695 | t->GetParent()->GetEventHandler()->ProcessEvent(nevent); |
| 696 | |
| 697 | return; |
| 698 | } |
| 699 | |
| 700 | if (mViewType == ViewByKey) { |
| 701 | wxString key = KeyEventToKeyString(e).Display(); |
| 702 | t->SetValue(key); |
| 703 | |
| 704 | if (!key.empty()) { |
| 705 | mView->SetFilter(t->GetValue()); |
| 706 | } |
| 707 | } |
| 708 | else |
| 709 | { |
| 710 | if (keycode == WXK_RETURN) { |
| 711 | mFilterPending = false; |
| 712 | mView->SetFilter(t->GetValue()); |
| 713 | } |
| 714 | else { |
| 715 | mFilterPending = true; |
| 716 | mFilterTimer.Start(500, wxTIMER_ONE_SHOT); |
| 717 | |
| 718 | e.Skip(); |
| 719 | } |
| 720 | } |
| 721 | } |
| 722 | |
| 723 | void KeyConfigPrefs::OnFilterChar(wxEvent & e) |
| 724 | { |
nothing calls this directly
no test coverage detected