| 465 | } |
| 466 | void key_cfg_screen::finish() {} |
| 467 | void key_cfg_screen::process(int res) { |
| 468 | int i; |
| 469 | for (i = 0; i < N_KEY_CFG_FN; i++) { |
| 470 | if (m_elem[i].GetID() != -1 && m_elem[i].GetID() == res) { |
| 471 | // we chose a slot to configure. |
| 472 | uint8_t elem, controller; |
| 473 | int8_t slot; |
| 474 | ct_type elem_type; |
| 475 | if (m_elem[i].GetActiveSlot() == CFGELEM_SLOT_CLEAR) { |
| 476 | ctl_cfg_element_options_dialog((int16_t)(res - UID_KEYCFG_ID)); |
| 477 | } else if (m_elem[i].Configure(&elem_type, &controller, &elem, &slot)) { |
| 478 | ctl_cfg_set_and_verify_changes((int16_t)(res - UID_KEYCFG_ID), elem_type, controller, elem, slot); |
| 479 | } |
| 480 | break; |
| 481 | } |
| 482 | } |
| 483 | switch (res) { |
| 484 | case UID_RESETDEFAULTS: |
| 485 | for (i = 0; i < NUM_CONTROLLER_FUNCTIONS; i++) { |
| 486 | if (Controller_needs[i].ctype[0] == ctKey) { |
| 487 | ASSERT(Controller_needs[i].ctype[1] == ctKey); |
| 488 | Controller->assign_function(&Controller_needs[i]); |
| 489 | } |
| 490 | } |
| 491 | break; |
| 492 | case UID_CFGSETTINGS: |
| 493 | key_settings_dialog(); |
| 494 | break; |
| 495 | case UID_REVERT: |
| 496 | // restore original settings. |
| 497 | for (i = 0; i < N_KEY_CFG_FN; i++) { |
| 498 | Controller->set_controller_function(Cfg_key_elements[i].fn_id, m_old_controls[i].type, m_old_controls[i].value, |
| 499 | m_old_controls[i].flags); |
| 500 | } |
| 501 | break; |
| 502 | } |
| 503 | } |
| 504 | void key_cfg_screen::realize() { |
| 505 | // create controls |
| 506 | int i, x = 0, y; |
no test coverage detected