MCPcopy Create free account
hub / github.com/buggins/coolreader / onKeyPressed

Method onKeyPressed

cr3gui/src/cr3pocketbook.cpp:359–386  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

357 return -1;
358 }
359 bool onKeyPressed( int key, int flags )
360 {
361 CRLog::trace("CRPocketBookWindowManager::onKeyPressed(%d, %d)", key, flags);
362 if (pbGlobals->isTranslateTimerRunning()) {
363 CRGUIAcceleratorTableRef accTable = _accTables.get("dict");
364 if (!accTable.isNull()) {
365 int cmd, param;
366 if (accTable->translate(key, flags, cmd, param)) {
367 switch (cmd) {
368 case PB_CMD_LEFT:
369 case PB_CMD_RIGHT:
370 case PB_CMD_UP:
371 case PB_CMD_DOWN:
372 case MCMD_CANCEL:
373 case MCMD_OK:
374 CRLog::trace("Killing translate timer, cmd = %d", cmd);
375 pbGlobals->killTranslateTimer();
376 if (cmd == MCMD_OK)
377 onCommand(PB_CMD_TRANSLATE, 0);
378 break;
379 default:
380 break;
381 }
382 }
383 }
384 }
385 return CRGUIWindowManager::onKeyPressed(key, flags);
386 }
387};
388
389CRPocketBookWindowManager * CRPocketBookWindowManager::instance = NULL;

Callers 1

main_handlerFunction · 0.45

Calls 5

killTranslateTimerMethod · 0.80
getMethod · 0.45
isNullMethod · 0.45
translateMethod · 0.45

Tested by

no test coverage detected