void ImageGroundTruthPanelViewer::on_key_down(wxKeyEvent & event) { if(event.ControlDown() && event.GetUnicodeKey() == 'O') { InitIO(); return; } if(mp_ground_truth_manager->IsEmpty()) { return ; } try { switch(event.GetKeyCode()) { case WXK_PAGEUP: LoadNextImage(); break; case WXK_PAGEDOWN: LoadPreviousImage(); break; } if(event.ControlDown()) { switch(event.GetUnicodeKey()) { case 'S': Save(); break; case 'Z': Undo(); break; case 'Y': Redo(); break; case 'A': MarkAsBlind(); break; case 'I': MarkAsUnknown(); break; case 'R': Reject(); break; } } } JPB_wx_CATCH("échec de l'ajout d'une boîtes englobante d'occlusion"); }
PlatformKeyboardEvent::PlatformKeyboardEvent(wxKeyEvent& event) { if (event.GetEventType() == wxEVT_KEY_UP) m_type = KeyUp; else if (event.GetEventType() == wxEVT_KEY_DOWN) m_type = KeyDown; else if (event.GetEventType() == wxEVT_CHAR) m_type = Char; else ASSERT_NOT_REACHED(); if (m_type != Char) m_keyIdentifier = keyIdentifierForWxKeyCode(event.GetKeyCode()); else { //ENTER is an editing command processed as a char (only Enter and Tab are) //unfortunately the unicode key for numpad_enter (370) is NOT what we want here (13) //The unicode values for normal enter and tab are the same as the ASCII values, thus ok //Note that I think this a wx bug, as the Character Code is actually 13 when //numpad_enter is a CHAR event. if (event.GetKeyCode() == 13 && event.GetUnicodeKey() == wxChar(370)) m_text = "\r"; else m_text = wxString(event.GetUnicodeKey()); m_unmodifiedText = m_text; } m_autoRepeat = false; // FIXME: not correct. m_windowsVirtualKeyCode = windowsKeyCodeForKeyEvent(event.GetKeyCode()); m_nativeVirtualKeyCode = event.GetKeyCode(); m_isKeypad = (event.GetKeyCode() >= WXK_NUMPAD_SPACE) && (event.GetKeyCode() <= WXK_NUMPAD_DIVIDE); m_shiftKey = event.ShiftDown(); m_ctrlKey = event.CmdDown(); m_altKey = event.AltDown(); m_metaKey = event.MetaDown(); }
void NotebookNavigationDlg::OnKeyDown(wxKeyEvent& event) { if((event.GetUnicodeKey() == WXK_TAB) && ( #ifdef __WXOSX__ event.AltDown() #else event.CmdDown() #endif && event.ShiftDown())) { // Navigate Up wxDataViewItem item = m_dvListCtrl->GetSelection(); if(item.IsOk()) { int row = m_dvListCtrl->ItemToRow(item); if(row > 0) { --row; item = m_dvListCtrl->RowToItem(row); m_dvListCtrl->Select(item); m_dvListCtrl->EnsureVisible(item); } else { // Select the last item row = m_dvListCtrl->GetItemCount() - 1; item = m_dvListCtrl->RowToItem(row); m_dvListCtrl->Select(item); m_dvListCtrl->EnsureVisible(item); } } } else if((event.GetUnicodeKey() == WXK_TAB) && #ifdef __WXOSX__ event.AltDown() #else event.CmdDown() #endif ) { // Navigate Down wxDataViewItem item = m_dvListCtrl->GetSelection(); if(item.IsOk()) { int row = m_dvListCtrl->ItemToRow(item); if(row < (m_dvListCtrl->GetItemCount() - 1)) { ++row; item = m_dvListCtrl->RowToItem(row); m_dvListCtrl->Select(item); m_dvListCtrl->EnsureVisible(item); } else { // Select the last item item = m_dvListCtrl->RowToItem(0); m_dvListCtrl->Select(item); m_dvListCtrl->EnsureVisible(item); } } } else { event.Skip(); } }
void CRenderWnd::OnChar( wxKeyEvent & event ) { TRACEUSER( "jlh92", _T("CRenderWnd::OnChar \"%c\" \n"), event.GetUnicodeKey() ); if( !AfxGetApp().HandleKeyPress( event ) ) event.Skip(); // Pass the key event on to someone who really wants it. }
bool wxGridCellEditor::IsAcceptedKey(wxKeyEvent& event) { bool ctrl = event.ControlDown(); bool alt; #ifdef __WXMAC__ // On the Mac the Alt key is more like shift and is used for entry of // valid characters, so check for Ctrl and Meta instead. alt = event.MetaDown(); #else // !__WXMAC__ alt = event.AltDown(); #endif // __WXMAC__/!__WXMAC__ // Assume it's not a valid char if ctrl or alt is down, but if both are // down then it may be because of an AltGr key combination, so let them // through in that case. if ((ctrl || alt) && !(ctrl && alt)) return false; #if wxUSE_UNICODE if ( static_cast<int>(event.GetUnicodeKey()) == WXK_NONE ) return false; #else if ( event.GetKeyCode() > WXK_START ) return false; #endif return true; }
void wxG3DCanvas::handleKeyDown(wxKeyEvent& event) { if (_gWindow->keyboardEvents.length() > 200) { _gWindow->keyboardEvents.clear(); } GEvent e; e.key.type = SDL_KEYDOWN; e.key.state = SDL_PRESSED; e.key.keysym.sym = wxKeyCodeToSDLCode(event.KeyCode()); #if (wxUSE_UNICODE == 1) e.key.keysym.unicode = event.GetUnicodeKey(); #elif defined(wxHAS_RAW_KEY_CODES) e.key.keysym.unicode = event.GetRawKeyCode(); #else e.key.keysym.unicode = e.key.keysym.sym; #endif #if defined(wxHAS_RAW_KEY_CODES) e.key.keysym.scancode = event.GetRawKeyCode(); #else e.key.keysym.scancode = 0; #endif _gWindow->keyboardEvents.pushBack(e); event.Skip(); }
void SelectionTool::OnCanvasKeyPress(const wxKeyEvent &event) { if (event.GetUnicodeKey() == REMOVE_SELECTED_KEY) { m_selectionManager.RemoveSelection(); } }
bool wxGridCellEditor::IsAcceptedKey(wxKeyEvent& event) { bool ctrl = event.ControlDown(); bool alt = event.AltDown(); #ifdef __WXMAC__ // On the Mac the Alt key is more like shift and is used for entry of // valid characters, so check for Ctrl and Meta instead. alt = event.MetaDown(); #endif // Assume it's not a valid char if ctrl or alt is down, but if both are // down then it may be because of an AltGr key combination, so let them // through in that case. if ((ctrl || alt) && !(ctrl && alt)) return false; #if wxUSE_UNICODE // if the unicode key code is not really a unicode character (it may // be a function key or etc., the platforms appear to always give us a // small value in this case) then fallback to the ASCII key code but // don't do anything for function keys or etc. if ( event.GetUnicodeKey() > 127 && event.GetKeyCode() > 127 ) return false; #else if ( event.GetKeyCode() > 255 ) return false; #endif return true; }
void MainSequencer::OnChar(wxKeyEvent& event) { wxChar uc = event.GetUnicodeKey(); KeyBinding *binding = keyBindings.Find(uc); if (binding != NULL) { event.StopPropagation(); switch (binding->GetType()) { case TIMING_ADD: InsertTimingMarkFromRange(); break; case TIMING_SPLIT: SplitTimingMark(); break; case KEY_ZOOM_IN: PanelTimeLine->ZoomIn(); break; case KEY_ZOOM_OUT: PanelTimeLine->ZoomOut(); break; case RANDOM_EFFECT: PanelEffectGrid->Paste("Random\t\t\n"); break; case EFFECT_STRING: PanelEffectGrid->Paste(binding->GetEffectName() + "\t" + binding->GetEffectString() + "\t\n"); break; } } //printf("OnChar %d %c\n", uc, uc); switch(uc) { case 'c': case 'C': case WXK_CONTROL_C: if (event.CmdDown() || event.ControlDown()) { CopySelectedEffects(); PanelEffectGrid->SetCanPaste(); event.StopPropagation(); } break; case 'x': case 'X': case WXK_CONTROL_X: if (event.CmdDown() || event.ControlDown()) { CopySelectedEffects(); PanelEffectGrid->DeleteSelectedEffects(); event.StopPropagation(); } break; case 'v': case 'V': case WXK_CONTROL_V: if (event.CmdDown() || event.ControlDown()) { Paste(); event.StopPropagation(); } break; } }
void PipedProcessCtrl::OnUserInput(wxKeyEvent& ke) { if(m_dead) { ke.Skip(); return; } //todo: if user presses navigational keys accept them as navigational (also copy/paste shortcuts?) char* kc1=new char[2]; kc1[0]=ke.GetKeyCode()%256; kc1[1]=0; if(kc1[0]=='\r') { //cbMessageBox(_T("converting keystroke")); kc1[0]='\n'; } // cbMessageBox(_T("key press: ")+wxString::FromAscii(kc1)+wxString::Format(_T(" keycode: %i"),ke.GetKeyCode())); wxChar kc2=ke.GetUnicodeKey(); wxString buf(kc2); //kc1[0]=buf[0]; m_ostream->Write(kc1,1); // m_proc->GetOutputStream()->Write(kc1,1); // cbMessageBox(_T("bytes written: ")+wxString::Format(_T("code: %u"),m_ostream->LastWrite())); m_textctrl->AppendText(kc2); // m_textctrl->SetInsertionPointEnd(); }
void TimeEdit::OnChar(wxKeyEvent &event) { event.Skip(); if (byFrame || insert) return; int key = event.GetUnicodeKey(); if ((key < '0' || key > '9') && key != ';' && key != '.' && key != ',') return; event.Skip(false); long start = GetInsertionPoint(); std::string text = from_wx(GetValue()); // Cursor is at the end so do nothing if (start >= (long)text.size()) return; // If the cursor is at punctuation, move it forward to the next digit if (text[start] == ':' || text[start] == '.' || text[start] == ',') ++start; // : and . hop over punctuation but never insert anything if (key == ':' || key == ';' || key == '.' || key == ',') { SetInsertionPoint(start); return; } // Overwrite the digit text[start] = (char)key; time = text; SetValue(to_wx(time.GetAssFormated())); SetInsertionPoint(start + 1); }
void PipedProcessCtrl::OnUserInput(wxKeyEvent& ke) { if(m_dead) { ke.Skip(); return; } //todo: if user presses navigational keys accept them as navigational (also copy/paste shortcuts?) char* kc1=new char[2]; kc1[0]=ke.GetKeyCode()%256; kc1[1]=0; if(kc1[0]=='\r') kc1[0]='\n'; wxChar kc2=ke.GetUnicodeKey(); wxString buf(kc2); if (!ke.ControlDown() && !ke.AltDown()) if (ke.GetKeyCode()<WXK_START || ke.GetKeyCode()>WXK_COMMAND) { m_ostream->Write(kc1,1); m_textctrl->AppendText(kc2); m_textctrl->GotoPos(m_textctrl->GetLength()); return; } ke.Skip(); }
void wxListCtrlEx::OnKeyDown(wxKeyEvent& event) { if (!m_prefixSearch_enabled) { event.Skip(); return; } int code = event.GetKeyCode(); if (code == WXK_LEFT || code == WXK_RIGHT || code == WXK_UP || code == WXK_DOWN || code == WXK_HOME || code == WXK_END) { ResetSearchPrefix(); } #if defined(__WXMSW__) && wxUSE_UNICODE wxChar key = MapVirtualKey(event.GetUnicodeKey(), 2); if (key < 32) { event.Skip(); return; } else if (key == 32 || event.HasModifiers()) { event.Skip(); return; } HandlePrefixSearch(key); return; #else if (code > 32 && code < 300 && !event.HasModifiers()) { #if wxUSE_UNICODE int unicodeKey = event.GetUnicodeKey(); if (unicodeKey) code = unicodeKey; #endif HandlePrefixSearch(code); } else event.Skip(); #endif //defined(__WXMSW__) && wxUSE_UNICODE }
void AssistPanel::OnCharHook(wxKeyEvent& event) { if( mEffect != NULL ) { if( mEffect->GetEffectIndex() == EffectManager::eff_PICTURES ) { wxChar uc = event.GetUnicodeKey(); switch(uc) { case 'c': case 'C': case WXK_CONTROL_C: if (event.CmdDown() || event.ControlDown()) { if( mGridCanvas != nullptr ) { mGridCanvas->Copy(); } event.StopPropagation(); } break; case 'v': case 'V': case WXK_CONTROL_V: if (event.CmdDown() || event.ControlDown()) { if( mGridCanvas != nullptr ) { mGridCanvas->Paste(); } event.StopPropagation(); } break; #ifdef __WXMSW__ case WXK_INSERT: case WXK_NUMPAD_INSERT: if (event.ControlDown()) // Copy { if (mGridCanvas != nullptr) { mGridCanvas->Copy(); } event.StopPropagation(); } else if (GetKeyState(VK_LSHIFT) || GetKeyState(VK_RSHIFT)) // Paste { if (mGridCanvas != nullptr) { mGridCanvas->Paste(); } event.StopPropagation(); } break; #endif default: event.Skip(); break; } } } }
void InputManager::OnChar(wxKeyEvent& e) { e.Skip(); wxString keystr(e.GetUnicodeKey()); wprintf(L"InputManager::OnChar %s\n", keystr.wc_str()); handleEvent(e); }
void ScriptEditor::OnChar(wxKeyEvent& event) { #if wxUSE_UNICODE and __WXGTK__ if (m_lastKeyDownConsumed && event.GetUnicodeKey() > 255) m_lastKeyDownConsumed = false; #endif wxStyledTextCtrl::OnChar(event); }
void BTextCtrl::OnChar(wxKeyEvent& event) { #if wxUSE_UNICODE if (!m_matchParens || MatchParenthesis(event.GetUnicodeKey())) event.Skip(); #else if (!m_matchParens || MatchParenthesis(event.GetKeyCode())) event.Skip(); #endif }
void EditorCanvas::OnChar(wxKeyEvent& event) { switch(event.GetUnicodeKey()) { case 8: // FIXME what key is this? case 127: scene.deleteSelected(); break; case '.': if (frame < 99) parent->notify(++frame); break; case ',': if (frame > 1) parent->notify(--frame); break; default: break; } Refresh(); }
void wxVListBoxComboPopup::OnComboKeyEvent( wxKeyEvent& event ) { // Saturated key movement on if ( !HandleKey(event.GetKeyCode(),true, #if wxUSE_UNICODE event.GetUnicodeKey() #else 0 #endif ) ) event.Skip(); }
void Canvas::OnKey(wxKeyEvent& event) { if(dimension) { scene.KeyDown(event.GetUnicodeKey()); scene.SpecialKeyDown(event.GetUnicodeKey()); } /*else { scene2D.KeyDown(event.GetUnicodeKey()); if(event.GetUnicodeKey()=='+') Scale2D(); if(event.GetUnicodeKey()=='-') Scale2D(); } */ SetFocus(); Refresh(); }
void wxVListBoxComboPopup::OnComboCharEvent( wxKeyEvent& event ) { // unlike in OnComboKeyEvent, wxEVT_CHAR contains meaningful // printable character information, so pass it #if wxUSE_UNICODE const wxChar charcode = event.GetUnicodeKey(); #else const wxChar charcode = (wxChar)event.GetKeyCode(); #endif if ( !HandleKey(event.GetKeyCode(), true, charcode) ) event.Skip(); }
void NumValidatorBase::OnChar(wxKeyEvent& event) { // By default we just validate this key so don't prevent the normal // handling from taking place. event.Skip(); if ( !m_validatorWindow ) return; #if wxUSE_UNICODE const int ch = event.GetUnicodeKey(); const int c = event.GetKeyCode(); if ( c > WXK_START ) { // It's a character without any Unicode equivalent at all, e.g. cursor // arrow or function key, we never filter those. return; } #else // !wxUSE_UNICODE const int ch = event.GetKeyCode(); const int c = ch; if ( ch > WXK_DELETE ) { // Not a character neither. return; } #endif // wxUSE_UNICODE/!wxUSE_UNICODE // Space is an allowed thousands separator. But we don't allow user to type // it. We will add it at formatting time in OnKillFocus(). if ( c < WXK_SPACE || c == WXK_DELETE ) { // Allow ASCII control characters and Delete. return; } // Check if this character is allowed in the current state. wxString val; int pos; GetCurrentValueAndInsertionPoint(val, pos); if ( !IsCharOk(val, pos, ch) ) { if ( !wxValidator::IsSilent() ) wxBell(); // Do not skip the event in this case, stop handling it here. event.Skip(false); } }
void OSGCanvas::OnKeyUp( wxKeyEvent & event ) { #if wxUSE_UNICODE int key = event.GetUnicodeKey(); #else int key = event.GetKeyCode(); #endif if( _graphics_window.valid() ) _graphics_window->getEventQueue()->keyRelease( key ); // If this key event is not processed here, we should call // event.Skip() to allow processing to continue. }
PlatformKeyboardEvent::PlatformKeyboardEvent(wxKeyEvent& event) { m_text = wxString(event.GetUnicodeKey()); m_unmodifiedText = m_text; m_keyIdentifier = keyIdentifierForWxKeyCode(event.GetKeyCode()); m_isKeyUp = event.GetEventType() == wxEVT_KEY_UP; m_autoRepeat = false; // FIXME: not correct. m_WindowsKeyCode = windowsKeyCodeForKeyEvent(event.GetKeyCode()); m_isKeypad = (event.GetKeyCode() >= WXK_NUMPAD_SPACE) && (event.GetKeyCode() <= WXK_NUMPAD_DIVIDE); m_shiftKey = event.ShiftDown(); m_ctrlKey = event.CmdDown(); m_altKey = event.AltDown(); m_metaKey = event.MetaDown(); }
// Fix for Bug 1389 // July 2016: ANSWER-ME: Does this need reporting upstream to wxWidgets? virtual void StartingKey(wxKeyEvent& event) override { // Lifted from wxGridCellTextEditor and adapted to combo. // [Below is comment from wxWidgets code] // Since this is now happening in the EVT_CHAR event EmulateKeyPress is no // longer an appropriate way to get the character into the text control. // Do it ourselves instead. We know that if we get this far that we have // a valid character, so not a whole lot of testing needs to be done. //The only difference to wxGridCellTextEditor. //wxTextCtrl* tc = (wxTextCtrl *)m_control; wxComboBox * tc = Combo(); int ch; bool isPrintable; #if wxUSE_UNICODE ch = event.GetUnicodeKey(); if ( ch != WXK_NONE ) isPrintable = true; else #endif // wxUSE_UNICODE { ch = event.GetKeyCode(); isPrintable = ch >= WXK_SPACE && ch < WXK_START; } switch (ch) { case WXK_DELETE: // Delete the initial character when starting to edit with DELETE. tc->Remove(0, 1); break; case WXK_BACK: // Delete the last character when starting to edit with BACKSPACE. { const long pos = tc->GetLastPosition(); tc->Remove(pos - 1, pos); } break; default: if ( isPrintable ) tc->WriteText(static_cast<wxChar>(ch)); break; } }
void VideoSlider::OnKeyDown(wxKeyEvent &event) { if (c->videoController->IsPlaying()) return; if (hotkey::check("Video", c, event.GetKeyCode(), event.GetUnicodeKey(), event.GetModifiers())) return; // Forward up/down to grid if (event.GetKeyCode() == WXK_UP || event.GetKeyCode() == WXK_DOWN) { c->subsGrid->GetEventHandler()->ProcessEvent(event); c->subsGrid->SetFocus(); return; } event.Skip(); }
void CurrentTabsPopup::ListEventHandler::OnChar(wxKeyEvent& event) { switch ( event.GetKeyCode() ) { case WXK_ESCAPE: // Cancel tab selection. m_parent->EndModal(wxID_CANCEL); return; case WXK_UP: { // Wrap to bottom of the list if needed. int row = m_parent->m_list->GetSelectedRow(); if (row == 0) { int max = m_parent->m_list->GetItemCount(); m_parent->m_list->SetSelectedRow(max-1); return; } break; } case WXK_DOWN: { // Wrap to top of the list if needed. int row = m_parent->m_list->GetSelectedRow(); int max = m_parent->m_list->GetItemCount(); if (row == max -1) { m_parent->m_list->SetSelectedRow(0); return; } break; } default: const wxChar c = event.GetUnicodeKey(); // If a number 1-9 was pressed, and we have that many rows, // then choose that (-1) as the selected row index. if ((wxT('1') <= c) && ( c <= wxT('9'))) { int max = m_parent->m_list->GetItemCount(); int choice = c-wxT('1'); if (choice < max) { m_parent->m_selectedTabIndex = choice; m_parent->EndModal(wxID_OK); } return; } } event.Skip(); }
void OnKeyUp(wxKeyEvent const &ev) { auto uc = ev.GetUnicodeKey(); if(uc == WXK_NONE ) { return; } if(uc == kPlayback) { auto pj = Project::GetCurrentProject(); auto &tp = pj->GetTransporter(); tp.SetPlaying(!tp.IsPlaying()); } for(int i = 0; i < key_code_for_sample_note_.size(); ++i) { if(key_code_for_sample_note_[i] == uc) { SendSampleNoteOff(i); key_code_for_sample_note_[i] = 0; } } }
void TimeEdit::OnKeyDown(wxKeyEvent &event) { int kc = event.GetKeyCode(); // Needs to be done here to trump user-defined hotkeys int key = event.GetUnicodeKey(); if (event.CmdDown()) { if (key == 'C' || key == 'X') CopyTime(); else if (key == 'V') PasteTime(); else event.Skip(); return; } // Shift-Insert would paste the stuff anyway // but no one updates the private "time" variable. if (event.ShiftDown() && kc == WXK_INSERT) { PasteTime(); return; } if (byFrame || insert) { event.Skip(); return; } // Overwrite mode stuff // On OS X backspace is reported as delete #ifdef __APPLE__ if (kc == WXK_DELETE) kc = WXK_BACK; #endif // Back just moves cursor back one without deleting if (kc == WXK_BACK) { long start = GetInsertionPoint(); if (start > 0) SetInsertionPoint(start - 1); } // Delete just does nothing else if (kc != WXK_DELETE) event.Skip(); }
void wxVListBoxComboPopup::OnChar(wxKeyEvent& event) { if ( m_combo->GetWindowStyle() & wxCB_READONLY ) { // Process partial completion key codes here, but not the arrow keys as // the base class will do that for us #if wxUSE_UNICODE const wxChar charcode = event.GetUnicodeKey(); #else const wxChar charcode = (wxChar)event.GetKeyCode(); #endif if ( wxIsprint(charcode) ) { OnComboCharEvent(event); SetSelection(m_value); // ensure the highlight bar moves return; // don't skip the event } } event.Skip(); }