MCPcopy Create free account
hub / github.com/jerryuhoo/Fire / setStatesWhenDelete

Method setStatesWhenDelete

Source/Panels/SpectrogramPanel/Multiband.cpp:316–358  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

314}
315
316void Multiband::setStatesWhenDelete(int deletedIndex)
317{
318 // 1. Based on the deleted band's index, update the state of the divider line.
319 // If the last band is deleted (e.g., Band 4), the line to its left (Line 3) must be disabled.
320 if (deletedIndex == lineNum)
321 {
322 if (lineNum > 0)
323 freqDividerGroup[lineNum - 1]->setToggleState(false, juce::sendNotificationSync);
324 }
325 else // Otherwise, just disable the divider line corresponding to the index.
326 {
327 freqDividerGroup[deletedIndex]->setToggleState(false, juce::sendNotificationSync);
328 }
329
330 // 2. Update the visual focus.
331 if (deletedIndex < focusIndex)
332 {
333 focusIndex -= 1;
334 }
335 else if (deletedIndex == focusIndex && focusIndex == lineNum)
336 {
337 focusIndex -= 1;
338 }
339
340 // 3. Shift all bands that came after the deleted one forward.
341 // e.g., if index 1 is deleted, copy settings from 2 to 1, and from 3 to 2.
342 for (int i = deletedIndex; i < 3; ++i)
343 {
344 copyBandSettings(i, i + 1);
345 }
346 // Also shift LFO targets for the same range
347 processor.shiftLfoModulationTargets(deletedIndex + 1, 3, -1);
348
349 // 4. Clean up the state of the last band, as it is now redundant.
350 resetBandToDefault(3);
351 setBandState(3, { true, false }, juce::NotificationType::dontSendNotification);
352
353 processor.clearLfoModulationForBand(3);
354
355 // NOTE: We no longer need to call setSoloRelatedBounds() manually here,
356 // as it will be handled automatically later in the call chain
357 // (sortLines() -> sliderValueChanged() -> resized()).
358}
359
360int Multiband::countLines()
361{

Callers

nothing calls this directly

Calls 2

Tested by

no test coverage detected