| 1293 | } |
| 1294 | |
| 1295 | Uint32 UICodeEditor::onKeyDown( const KeyEvent& event ) { |
| 1296 | if ( getUISceneNode()->getWindow()->getIME().isEditing() ) |
| 1297 | return 0; |
| 1298 | |
| 1299 | mLastActivity.restart(); |
| 1300 | |
| 1301 | if ( NULL == mFont || mUISceneNode->getUIEventDispatcher()->justGainedFocus() ) |
| 1302 | return 0; |
| 1303 | |
| 1304 | for ( auto& plugin : mPlugins ) |
| 1305 | if ( plugin->onKeyDown( this, event ) ) |
| 1306 | return 1; |
| 1307 | |
| 1308 | std::string cmd = mKeyBindings.getCommandFromKeyBind( { event.getKeyCode(), event.getMod() } ); |
| 1309 | if ( !cmd.empty() ) { |
| 1310 | // Allow copy selection on locked mode |
| 1311 | if ( !mLocked || mUnlockedCmd.find( cmd ) != mUnlockedCmd.end() ) { |
| 1312 | mDoc->execute( cmd, this ); |
| 1313 | mLastCmdHash = String::hash( cmd ); |
| 1314 | mLastExecuteEventId = getInput()->getEventsSentId(); |
| 1315 | return 1; |
| 1316 | } |
| 1317 | } |
| 1318 | |
| 1319 | return 0; |
| 1320 | } |
| 1321 | |
| 1322 | Uint32 UICodeEditor::onKeyUp( const KeyEvent& event ) { |
| 1323 | mLastActivity.restart(); |
nothing calls this directly
no test coverage detected