mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-16 12:49:59 +01:00
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:
@@ -191,27 +191,30 @@ void MixingView::draw()
|
|||||||
|
|
||||||
// special action of Mixing view: link or unlink
|
// special action of Mixing view: link or unlink
|
||||||
SourceList selected = Mixer::selection().getCopy();
|
SourceList selected = Mixer::selection().getCopy();
|
||||||
if ( Mixer::manager().session()->canlink( selected )) {
|
bool do_link = false;
|
||||||
// the selected sources can be linked
|
if (Mixer::manager().session()->hasLink(selected)) {
|
||||||
if (ImGui::Selectable( ICON_FA_LINK " Link" )){
|
if (ImGui::Selectable(ICON_FA_LINK " Re-link")) {
|
||||||
// assemble a MixingGroup
|
do_link = true;
|
||||||
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 );
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else {
|
|
||||||
// the selected sources cannot be linked: offer to unlink!
|
|
||||||
if (ImGui::Selectable( ICON_FA_UNLINK " Unlink" )){
|
if (ImGui::Selectable( ICON_FA_UNLINK " Unlink" )){
|
||||||
// dismantle MixingGroup(s)
|
// dismantle MixingGroup(s)
|
||||||
Mixer::manager().session()->unlink(selected);
|
Mixer::manager().session()->unlink(selected);
|
||||||
Action::manager().store(std::string("Sources unlinked."));
|
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();
|
ImGui::Separator();
|
||||||
|
|
||||||
|
|||||||
@@ -606,9 +606,9 @@ void Session::move(int current_index, int target_index)
|
|||||||
sources_.insert(to, s);
|
sources_.insert(to, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Session::canlink (SourceList sources)
|
bool Session::hasLink (SourceList sources)
|
||||||
{
|
{
|
||||||
bool canlink = true;
|
bool _haslink = false;
|
||||||
|
|
||||||
// verify that all sources given are valid in the sesion
|
// verify that all sources given are valid in the sesion
|
||||||
validate(sources);
|
validate(sources);
|
||||||
@@ -617,11 +617,11 @@ bool Session::canlink (SourceList sources)
|
|||||||
// if this source is linked
|
// if this source is linked
|
||||||
if ( (*it)->mixingGroup() != nullptr ) {
|
if ( (*it)->mixingGroup() != nullptr ) {
|
||||||
// ask its group to detach it
|
// ask its group to detach it
|
||||||
canlink = false;
|
_haslink = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return canlink;
|
return _haslink;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Session::link(SourceList sources, Group *parent)
|
void Session::link(SourceList sources, Group *parent)
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ public:
|
|||||||
// get the list of sources in mixing groups
|
// get the list of sources in mixing groups
|
||||||
std::list<SourceList> getMixingGroups () const;
|
std::list<SourceList> getMixingGroups () const;
|
||||||
// returns true if something can be done to create a mixing group
|
// returns true if something can be done to create a mixing group
|
||||||
bool canlink (SourceList sources);
|
bool hasLink (SourceList sources);
|
||||||
// try to link sources of the given list:
|
// try to link sources of the given list:
|
||||||
// can either create a new mixing group or extend an existing group
|
// can either create a new mixing group or extend an existing group
|
||||||
void link (SourceList sources, Group *parent = nullptr);
|
void link (SourceList sources, Group *parent = nullptr);
|
||||||
|
|||||||
Reference in New Issue
Block a user