From c6f104b5aeaf124467321acd9f5affe5fd9b143d Mon Sep 17 00:00:00 2001 From: brunoherbelin Date: Sat, 22 Nov 2025 22:38:24 +0100 Subject: [PATCH] Improved terminology and actions for creating Bundle of sources --- src/LayerView.cpp | 69 ++++++++++++++++++++++++------------ src/SessionSource.cpp | 2 +- src/UserInterfaceManager.cpp | 16 +++------ 3 files changed, 51 insertions(+), 36 deletions(-) diff --git a/src/LayerView.cpp b/src/LayerView.cpp index 01a8bb3..f17ae3f 100644 --- a/src/LayerView.cpp +++ b/src/LayerView.cpp @@ -17,6 +17,7 @@ * along with this program. If not, see . **/ +#include "SessionSource.h" #include #include #include @@ -106,22 +107,44 @@ void LayerView::draw() if (ImGui::BeginPopup("LayerSourceContextMenu")) { // work on the current source Source *s = Mixer::manager().currentSource(); - if (s != nullptr) { - for (auto bmode = Shader::blendingFunction.cbegin(); - bmode != Shader::blendingFunction.cend(); - ++bmode) { - int index = bmode - Shader::blendingFunction.cbegin(); - if (ImGuiToolkit::MenuItemIcon(std::get<0>(*bmode), - std::get<1>(*bmode), - std::get<2>(*bmode).c_str(), - nullptr, - s->blendingShader()->blending == index)) { - s->blendingShader()->blending = Shader::BlendMode(index); - s->touch(); - Action::manager().store(s->name() + ": Blending " + std::get<2>(*bmode)); + if (s != nullptr && !s->failed() ) { + + if (ImGuiToolkit::BeginMenuIcon( 5, 6, "Blending" )) { + for (auto bmode = Shader::blendingFunction.cbegin(); + bmode != Shader::blendingFunction.cend(); + ++bmode) { + int index = bmode - Shader::blendingFunction.cbegin(); + if (ImGuiToolkit::MenuItemIcon(std::get<0>(*bmode), + std::get<1>(*bmode), + std::get<2>(*bmode).c_str(), + nullptr, + s->blendingShader()->blending == index)) { + s->blendingShader()->blending = Shader::BlendMode(index); + s->touch(); + Action::manager().store(s->name() + ": Blending " + std::get<2>(*bmode)); + } + } + ImGui::EndMenu(); + } + + if (s->icon() == glm::ivec2(ICON_SOURCE_GROUP) ) + { + if (ImGui::Selectable( ICON_FA_SIGN_IN_ALT " Expand Bundle" )) { + Mixer::manager().import( dynamic_cast(s) ); + } + } + else { + if ( s->cloned() || s->icon() == glm::ivec2(ICON_SOURCE_CLONE)){ + ImGui::TextDisabled( ICON_FA_SIGN_IN_ALT " Encapsulate into a Bundle" ); + } + else { + if (ImGui::Selectable( ICON_FA_SIGN_IN_ALT " Encapsulate into a Bundle" )) { + Mixer::manager().groupCurrent(); + } } } } + ImGui::EndPopup(); } @@ -178,16 +201,6 @@ void LayerView::draw() ImGui::PushStyleColor(ImGuiCol_Text, ImGuiToolkit::HighlightColor()); ImGui::PushStyleColor(ImGuiCol_HeaderHovered, ImVec4(COLOR_MENU_HOVERED, 0.5f)); - // special action of Mixing view - if (candidate_flatten_group){ - if (ImGui::Selectable( ICON_FA_SIGN_IN_ALT " Bundle" )) { - Mixer::manager().groupSelection(); - } - } - else { - ImGui::TextDisabled( ICON_FA_SIGN_IN_ALT " Bundle" ); - } - // Blending all selection if (ImGuiToolkit::BeginMenuIcon( 5, 6, "Blending" )) { for (auto bmode = Shader::blendingFunction.cbegin(); @@ -208,6 +221,16 @@ void LayerView::draw() ImGui::EndMenu(); } + // special action of Mixing view + if (candidate_flatten_group){ + if (ImGui::Selectable( ICON_FA_SIGN_IN_ALT " Encapsulate into a Bundle" )) { + Mixer::manager().groupSelection(); + } + } + else { + ImGui::TextDisabled( ICON_FA_SIGN_IN_ALT " Encapsulate into a Bundle" ); + } + ImGui::Separator(); // manipulation of sources in Mixing view diff --git a/src/SessionSource.cpp b/src/SessionSource.cpp index b862736..e90fa43 100644 --- a/src/SessionSource.cpp +++ b/src/SessionSource.cpp @@ -509,5 +509,5 @@ glm::ivec2 SessionGroupSource::icon() const std::string SessionGroupSource::info() const { - return "Bundle Session"; + return "Bundle of sources"; } diff --git a/src/UserInterfaceManager.cpp b/src/UserInterfaceManager.cpp index fef283e..c656822 100644 --- a/src/UserInterfaceManager.cpp +++ b/src/UserInterfaceManager.cpp @@ -1110,13 +1110,13 @@ void UserInterface::showMenuEdit() // GROUP ImGui::Separator(); - if (ImGuiToolkit::MenuItemIcon(11, 2, " Bundle all active sources", NULL, false, Mixer::manager().numSource() > 0)) { + if (ImGuiToolkit::MenuItemIcon(11, 2, " Create Bundle with active sources", NULL, false, Mixer::manager().numSource() > 0)) { // create a new group session with only active sources Mixer::manager().groupAll( true ); // switch pannel to show first source (created) navigator.showPannelSource(0); } - if (ImGuiToolkit::MenuItemIcon(7, 2, " Expand all bundles", NULL, false, Mixer::manager().numSource() > 0)) { + if (ImGuiToolkit::MenuItemIcon(7, 2, " Expand all Bundles", NULL, false, Mixer::manager().numSource() > 0)) { // create a new group session with all sources Mixer::manager().ungroupAll(); } @@ -3616,16 +3616,7 @@ void Navigator::RenderSourcePannel(Source *s, const ImVec2 &iconsize) UserInterface::manager().showPannel( Mixer::manager().numSource() ); } - // bundle button - if ( s->failed() || s->cloned() || s->icon() == glm::ivec2(ICON_SOURCE_CLONE) ) - ImGuiToolkit::ButtonDisabled( ICON_FA_SIGN_IN_ALT " Bundle", ImVec2((size.x - IMGUI_SAME_LINE)/2.f, 0)); - else if ( ImGui::Button( ICON_FA_SIGN_IN_ALT " Bundle", ImVec2((size.x - IMGUI_SAME_LINE)/2.f, 0)) ) { - Mixer::manager().groupCurrent(); - UserInterface::manager().showPannel( Mixer::manager().numSource() - 1 ); - } - // replace button - ImGui::SameLine(0, IMGUI_SAME_LINE); if ( ImGui::Button( ICON_FA_PLUS_SQUARE " Replace", ImVec2((size.x - IMGUI_SAME_LINE)/2.f, 0)) ) { // prepare panel for new source of same type @@ -3648,7 +3639,8 @@ void Navigator::RenderSourcePannel(Source *s, const ImVec2 &iconsize) } // delete button - if ( ImGui::Button( ACTION_DELETE, size) ) { + ImGui::SameLine(0, IMGUI_SAME_LINE); + if ( ImGui::Button( ACTION_DELETE, ImVec2((size.x - IMGUI_SAME_LINE)/2.f, 0)) ) { Mixer::manager().deleteSource(s); Action::manager().store(sname + std::string(": Deleted")); }