| 197 | } |
| 198 | |
| 199 | void ModulationMatrixRow::comboBoxChanged(juce::ComboBox* comboBox) |
| 200 | { |
| 201 | // This function now handles changes from BOTH combo boxes. |
| 202 | if (comboBox == &sourceMenu || comboBox == &destinationMenu) |
| 203 | { |
| 204 | // 1. Get the current selections from both menus. |
| 205 | int selectedSourceIndex = sourceMenu.getSelectedId() - 1; |
| 206 | juce::String selectedTargetID = ""; |
| 207 | |
| 208 | int selectedDestinationId = destinationMenu.getSelectedId(); |
| 209 | if (selectedDestinationId > 1) // i.e., not "None" |
| 210 | { |
| 211 | int listIndex = selectedDestinationId - 2; |
| 212 | if (juce::isPositiveAndBelow(listIndex, allPossibleTargets.size())) |
| 213 | { |
| 214 | selectedTargetID = allPossibleTargets[listIndex].parameterID; |
| 215 | } |
| 216 | } |
| 217 | |
| 218 | // 2. Call the new, safe method in the processor to apply the changes. |
| 219 | processor.assignModulation(index, selectedSourceIndex, selectedTargetID); |
| 220 | |
| 221 | // 3. IMPORTANT: Tell the parent panel to rebuild its UI. |
| 222 | // This ensures that if another row was cleared, it will visually update to "None". |
| 223 | if (auto* panel = findParentComponentOfClass<ModulationMatrixPanel>()) |
| 224 | { |
| 225 | panel->buildUiFromProcessorState(); |
| 226 | } |
| 227 | } |
| 228 | } |
| 229 | |
| 230 | //============================================================================== |
| 231 | // ModulationMatrixPanel Implementation |
nothing calls this directly
no test coverage detected