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

Method onCommand

cr3gui/src/dictdlg.cpp:419–480  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

417}
418
419bool CRT9Keyboard::onCommand( int command, int params )
420{
421 switch ( command ) {
422 case MCMD_SELECT_0:
423 case MCMD_SELECT_1:
424 case MCMD_SELECT_2:
425 case MCMD_SELECT_3:
426 case MCMD_SELECT_4:
427 case MCMD_SELECT_5:
428 case MCMD_SELECT_6:
429 case MCMD_SELECT_7:
430 case MCMD_SELECT_8:
431 case MCMD_SELECT_9:
432 selector_.push_button( command - MCMD_SELECT_0 + '0' );
433 setDirty();
434 break;
435 case MCMD_SCROLL_FORWARD:
436 selector_.down();
437 break;
438 case MCMD_KBD_NEXTLAYOUT:
439 setLayout( _wm->getKeyboardLayouts().nextLayout() );
440 break;
441 case MCMD_KBD_PREVLAYOUT:
442 setLayout( _wm->getKeyboardLayouts().prevLayout() );
443 break;
444 case MCMD_SCROLL_BACK:
445 selector_.up();
446 break;
447 case MCMD_OK:
448 {
449 lString8 translated;
450 lString8 output;
451 lString16 src = selector_.get();
452 if ( src.empty() ) {
453 _mainwin->getDocView()->clearSelection();
454 _wm->closeWindow(this);
455 return true;
456 }
457 CRLog::info("Closing dict");
458 _buf = src;
459 _mainwin->getDocView()->clearSelection();
460 _wm->postCommand( _command, 1 );
461 _wm->closeWindow(this);
462 };
463 break;
464 case MCMD_CANCEL:
465 if ( selector_.pop() ) {
466 _mainwin->getDocView()->clearSelection();
467 _wm->closeWindow(this);
468 return true;
469 }
470 setDirty();
471 break;
472 case MCMD_CLEAR:
473 while ( !selector_.pop() )
474 ;
475 _mainwin->getDocView()->clearSelection();
476 setDirty();

Callers

nothing calls this directly

Calls 12

push_buttonMethod · 0.80
downMethod · 0.80
nextLayoutMethod · 0.80
prevLayoutMethod · 0.80
upMethod · 0.80
closeWindowMethod · 0.80
postCommandMethod · 0.80
getMethod · 0.45
emptyMethod · 0.45
clearSelectionMethod · 0.45
getDocViewMethod · 0.45
popMethod · 0.45

Tested by

no test coverage detected