New behavior for Mixing View link

If selection for linking contains linked sources, offer to RE-link to change previous link (instead of only offer to remove the link)
This commit is contained in:
Bruno Herbelin
2024-01-13 12:00:59 +01:00
parent e36bae2ab6
commit 9768d17b9b
3 changed files with 22 additions and 19 deletions

View File

@@ -191,27 +191,30 @@ void MixingView::draw()
// special action of Mixing view: link or unlink
SourceList selected = Mixer::selection().getCopy();
if ( Mixer::manager().session()->canlink( selected )) {
// the selected sources can be linked
if (ImGui::Selectable( ICON_FA_LINK " Link" )){
// assemble a MixingGroup
Mixer::manager().session()->link(selected, scene.fg() );
Action::manager().store(std::string("Sources linked."));
// clear selection and select one of the sources of the group
Source *cur = Mixer::selection().front();
Mixer::manager().unsetCurrentSource();
Mixer::selection().clear();
Mixer::manager().setCurrentSource( cur );
bool do_link = false;
if (Mixer::manager().session()->hasLink(selected)) {
if (ImGui::Selectable(ICON_FA_LINK " Re-link")) {
do_link = true;
}
}
else {
// the selected sources cannot be linked: offer to unlink!
if (ImGui::Selectable( ICON_FA_UNLINK " Unlink" )){
// dismantle MixingGroup(s)
Mixer::manager().session()->unlink(selected);
Action::manager().store(std::string("Sources unlinked."));
}
}
else if (ImGui::Selectable( ICON_FA_LINK " Link" )){
do_link = true;
}
if (do_link){
// assemble a MixingGroup
Mixer::manager().session()->link(selected, scene.fg() );
Action::manager().store(std::string("Sources linked."));
// clear selection and select one of the sources of the group
Source *cur = Mixer::selection().front();
Mixer::manager().unsetCurrentSource();
Mixer::selection().clear();
Mixer::manager().setCurrentSource( cur );
}
ImGui::Separator();