Improved terminology and actions for creating Bundle of sources

This commit is contained in:
brunoherbelin
2025-11-22 22:38:24 +01:00
parent c554f69970
commit c6f104b5ae
3 changed files with 51 additions and 36 deletions

View File

@@ -17,6 +17,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
**/
#include "SessionSource.h"
#include <glad/glad.h>
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
@@ -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<SessionSource*>(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

View File

@@ -509,5 +509,5 @@ glm::ivec2 SessionGroupSource::icon() const
std::string SessionGroupSource::info() const
{
return "Bundle Session";
return "Bundle of sources";
}

View File

@@ -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"));
}