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,9 +191,21 @@ 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" )){
|
||||
bool do_link = false;
|
||||
if (Mixer::manager().session()->hasLink(selected)) {
|
||||
if (ImGui::Selectable(ICON_FA_LINK " Re-link")) {
|
||||
do_link = true;
|
||||
}
|
||||
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."));
|
||||
@@ -203,15 +215,6 @@ void MixingView::draw()
|
||||
Mixer::selection().clear();
|
||||
Mixer::manager().setCurrentSource( cur );
|
||||
}
|
||||
}
|
||||
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."));
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
|
||||
@@ -606,9 +606,9 @@ void Session::move(int current_index, int target_index)
|
||||
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
|
||||
validate(sources);
|
||||
@@ -617,11 +617,11 @@ bool Session::canlink (SourceList sources)
|
||||
// if this source is linked
|
||||
if ( (*it)->mixingGroup() != nullptr ) {
|
||||
// ask its group to detach it
|
||||
canlink = false;
|
||||
_haslink = true;
|
||||
}
|
||||
}
|
||||
|
||||
return canlink;
|
||||
return _haslink;
|
||||
}
|
||||
|
||||
void Session::link(SourceList sources, Group *parent)
|
||||
|
||||
@@ -145,7 +145,7 @@ public:
|
||||
// get the list of sources in mixing groups
|
||||
std::list<SourceList> getMixingGroups () const;
|
||||
// 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:
|
||||
// can either create a new mixing group or extend an existing group
|
||||
void link (SourceList sources, Group *parent = nullptr);
|
||||
|
||||
Reference in New Issue
Block a user