diff --git a/src/engine/engine.cpp b/src/engine/engine.cpp index f35afd424..81a91d689 100644 --- a/src/engine/engine.cpp +++ b/src/engine/engine.cpp @@ -3879,6 +3879,34 @@ bool DivEngine::patchDisconnect(unsigned int src, unsigned int dest) { return false; } +void DivEngine::patchDisconnectAll(unsigned int portSet) { + BUSY_BEGIN; + saveLock.lock(); + + if (portSet&0x1000) { + portSet&=0xfff; + + for (size_t i=0; i=chans) return; BUSY_BEGIN; diff --git a/src/engine/engine.h b/src/engine/engine.h index 01545a67d..31edc8c85 100644 --- a/src/engine/engine.h +++ b/src/engine/engine.h @@ -849,6 +849,9 @@ class DivEngine { // returns false if connection doesn't exist bool patchDisconnect(unsigned int src, unsigned int dest); + // disconnect all in patchbay + void patchDisconnectAll(unsigned int portSet); + // play note void noteOn(int chan, int ins, int note, int vol=-1); diff --git a/src/gui/mixer.cpp b/src/gui/mixer.cpp index f9ab6ed76..c9aa96b80 100644 --- a/src/gui/mixer.cpp +++ b/src/gui/mixer.cpp @@ -107,13 +107,18 @@ bool FurnaceGUI::portSet(String label, unsigned int portSetID, int ins, int outs hovered=ImGui::ItemHoverable(rect,ImGui::GetID(portID.c_str())); active=(hovered && ImGui::IsMouseClicked(ImGuiMouseButton_Left)); + if (hovered && ImGui::IsMouseClicked(ImGuiMouseButton_Right)) { + ImGui::OpenPopup("SubPortOptions"); + selectedPortSet=portSetID; + clickedPort=-1; + } if (hovered) hoveredPortSet=portSetID; if (active) clickedPort=-1; // label dl->AddRectFilled(minArea,maxArea,ImGui::GetColorU32(portSetColor),0.0f); - dl->AddRect(minArea,maxArea,ImGui::GetColorU32(portSetBorderColor),0.0f,dpiScale); + dl->AddRect(minArea,maxArea,ImGui::GetColorU32((selectedPortSet==portSetID)?uiColors[GUI_COLOR_TEXT]:portSetBorderColor),0.0f,0,dpiScale); dl->AddText(ImGui::GetFont(),ImGui::GetFontSize(),textPos,ImGui::GetColorU32(uiColors[GUI_COLOR_TEXT]),label.c_str(),NULL,ImGui::GetWindowSize().x*0.6f); } @@ -385,6 +390,7 @@ void FurnaceGUI::drawMixer() { if (!e->patchConnect(src,dest)) { e->patchDisconnect(src,dest); } + MARK_MODIFIED; } } } @@ -411,6 +417,13 @@ void FurnaceGUI::drawMixer() { } } } + if (ImGui::BeginPopup("SubPortOptions",ImGuiWindowFlags_NoMove|ImGuiWindowFlags_AlwaysAutoResize|ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoSavedSettings)) { + if (ImGui::MenuItem("disconnect all")) { + e->patchDisconnectAll(selectedPortSet); + MARK_MODIFIED; + } + ImGui::EndPopup(); + } ImGui::EndChild(); } if (ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows)) curWindow=GUI_WINDOW_MIXER;