| 426 | } |
| 427 | |
| 428 | void step() override |
| 429 | { |
| 430 | if (module == nullptr) |
| 431 | return; |
| 432 | |
| 433 | // Set bgColor and selected state |
| 434 | if (module->learningId == id) |
| 435 | { |
| 436 | bgColor = color; |
| 437 | bgColor.a = 0.125f; |
| 438 | |
| 439 | if (ParamWidget* const touchedParam = APP->scene->rack->touchedParam) |
| 440 | { |
| 441 | APP->scene->rack->touchedParam = nullptr; |
| 442 | DISTRHO_SAFE_ASSERT_RETURN(mapping.hostParamId < kModuleParameterCount,); |
| 443 | |
| 444 | const int64_t moduleId = touchedParam->module->id; |
| 445 | const int paramId = touchedParam->paramId; |
| 446 | module->learnParam(id, moduleId, paramId); |
| 447 | } |
| 448 | } |
| 449 | else |
| 450 | { |
| 451 | bgColor = nvgRGB(0, 0, 0); |
| 452 | } |
| 453 | |
| 454 | // Set text |
| 455 | text.clear(); |
| 456 | |
| 457 | // mapped |
| 458 | if (module->mappings[id].hostParamId < kModuleParameterCount) |
| 459 | text += string::f("P%02d: ", module->mappings[id].hostParamId + 1); |
| 460 | if (module->mappings[id].paramHandle.moduleId >= 0) |
| 461 | text += getParamName(); |
| 462 | |
| 463 | // Set text color |
| 464 | if (text.empty() && module->learningId != id) |
| 465 | color.a = 0.75f; |
| 466 | else |
| 467 | color.a = 1.0f; |
| 468 | |
| 469 | // unmapped |
| 470 | if (text.empty()) |
| 471 | { |
| 472 | if (module->learningId == id) |
| 473 | text = "Mapping..."; |
| 474 | else |
| 475 | text = module->numMappedParmeters == 1 ? "Click here to map" : "Unmapped"; |
| 476 | } |
| 477 | } |
| 478 | |
| 479 | void onButton(const ButtonEvent& e) override |
| 480 | { |
nothing calls this directly
no test coverage detected