| 1238 | } |
| 1239 | |
| 1240 | void LfoPanel::buttonClicked(juce::Button* button) |
| 1241 | { |
| 1242 | // Mode Switching |
| 1243 | if (button == &assignButton) |
| 1244 | { |
| 1245 | if (onAssignButtonClicked) |
| 1246 | onAssignButtonClicked(currentLfoIndex); |
| 1247 | return; |
| 1248 | } |
| 1249 | if (button == &editModeButton) |
| 1250 | { |
| 1251 | setEditMode(LfoEditMode::PointEdit); |
| 1252 | return; |
| 1253 | } |
| 1254 | if (button == &brushModeButton) |
| 1255 | { |
| 1256 | setEditMode(LfoEditMode::BrushPaint); |
| 1257 | return; |
| 1258 | } |
| 1259 | |
| 1260 | if (button == &matrixButton) |
| 1261 | { |
| 1262 | // This opens our new panel in a non-modal dialog window. |
| 1263 | juce::DialogWindow::LaunchOptions launchOptions; |
| 1264 | launchOptions.content.setOwned(new ModulationMatrixPanel(processor)); |
| 1265 | launchOptions.content->setSize(800, 400); |
| 1266 | launchOptions.launchAsync(); |
| 1267 | } |
| 1268 | else if (button == &syncButton) |
| 1269 | { |
| 1270 | // This button's state is managed by the ButtonAttachment, so we don't need to do anything here. |
| 1271 | // The parameterChanged callback will handle the UI update. |
| 1272 | } |
| 1273 | else |
| 1274 | { |
| 1275 | int clickedIndex = -1; |
| 1276 | for (int i = 0; i < lfoSelectButtons.size(); ++i) |
| 1277 | { |
| 1278 | if (button == lfoSelectButtons[i].get()) |
| 1279 | { |
| 1280 | clickedIndex = i; |
| 1281 | break; |
| 1282 | } |
| 1283 | } |
| 1284 | |
| 1285 | if (clickedIndex != -1) |
| 1286 | { |
| 1287 | setLfo(clickedIndex); // Call the new helper function |
| 1288 | } |
| 1289 | } |
| 1290 | } |
| 1291 | |
| 1292 | void LfoPanel::setLfo(int newIndex) |
| 1293 | { |