From 2a6b29e3da079151b693530c75d65f5ad1794089 Mon Sep 17 00:00:00 2001 From: brunoherbelin Date: Sun, 23 Nov 2025 12:57:37 +0100 Subject: [PATCH] Minor UI improvements --- src/ImGuiVisitor.cpp | 44 ++++++++++++++++++++++-------------- src/ImageFilter.cpp | 2 +- src/Session.cpp | 28 +++++++++++++++++++++++ src/Session.h | 1 + src/UserInterfaceManager.cpp | 17 ++++++++------ 5 files changed, 67 insertions(+), 25 deletions(-) diff --git a/src/ImGuiVisitor.cpp b/src/ImGuiVisitor.cpp index 3ecce48..e2c6335 100644 --- a/src/ImGuiVisitor.cpp +++ b/src/ImGuiVisitor.cpp @@ -18,6 +18,7 @@ **/ +#include #include #include @@ -28,6 +29,7 @@ #include +#include "IconsFontAwesome5.h" #include "imgui.h" #include "imgui_internal.h" @@ -60,6 +62,7 @@ #include "MixingGroup.h" #include "ActionManager.h" #include "Mixer.h" +#include "ControlManager.h" #include "imgui.h" #include "ImGuiToolkit.h" @@ -452,9 +455,13 @@ void ImGuiVisitor::visit (Source& s) // inform on visibility status ImGui::SetCursorPos( ImVec2(preview_width + 20, pos.y ) ); if (s.active()) { - if (s.blendingShader()->color.a > 0.f) - ImGuiToolkit::Indication("Visible", ICON_FA_SUN); - else + if (s.blendingShader()->color.a > 0.f) { + std::string indication = "Visible\nAlpha "; + indication += std::to_string((int)(s.blendingShader()->color.a * 100.f)) + "%"; + if (ImGuiToolkit::IconButton( ICON_FA_SUN, indication.c_str()) ) { + UserInterface::manager().setView(View::MIXING); + } + } else ImGuiToolkit::Indication("not Visible", ICON_FA_MOON); } else @@ -472,23 +479,26 @@ void ImGuiVisitor::visit (Source& s) else ImGuiToolkit::Indication("not Linked", ICON_FA_UNLINK); - // Inform on workspace + // inform of input mapping ImGui::SetCursorPos( ImVec2(preview_width + 20, pos.y + 2.1f * ImGui::GetFrameHeightWithSpacing()) ); - static std::map< int, std::pair > workspaces_ { - { Source::WORKSPACE_BACKGROUND, {10, "in Background"}}, - { Source::WORKSPACE_CENTRAL, {11, "in Workspace"}}, - { Source::WORKSPACE_FOREGROUND, {12, "in Foreground"}} - }; - // in Geometry view, offer to switch current workspace to the source workspace - if (Settings::application.current_view == View::GEOMETRY) { - if (ImGuiToolkit::IconButton( workspaces_[s.workspace()].first, 16, workspaces_[s.workspace()].second.c_str())) { - Settings::application.current_workspace=s.workspace(); - Mixer::manager().setCurrentSource(s.id()); + std::list inputs = Mixer::manager().session()->inputsForSource( s.id() ); + if (!inputs.empty()) { + if (ImGuiToolkit::IconButton( ICON_FA_HAND_PAPER ) ) { + // open input mapping window + Settings::application.widget.inputs = true; + } + if (ImGui::IsItemHovered()) { + std::string tooltip = "Mapped to input"; + tooltip += inputs.size() > 1 ? "s:" : ":" ; + for(const auto& input : inputs) { + tooltip += "\n - "; + tooltip += Control::inputLabel(input); + } + ImGuiToolkit::ToolTip(tooltip.c_str()); } } - // otherwise in other views, just draw in indicator else - ImGuiToolkit::Indication(workspaces_[s.workspace()].second.c_str(), workspaces_[s.workspace()].first, 16); + ImGuiToolkit::Indication("not Mapped to an input", ICON_FA_HAND_PAPER); // locking ImGui::SetCursorPos( ImVec2(preview_width + 20, pos.y + preview_height - ImGui::GetFrameHeightWithSpacing()) ); @@ -517,7 +527,7 @@ void ImGuiVisitor::visit (Source& s) pos = ImGui::GetCursorPos(); // menu icon for image processing - ImGui::SameLine(preview_width, 2 * IMGUI_SAME_LINE); + ImGui::SameLine(preview_width + 5, 2 * IMGUI_SAME_LINE); static uint counter_menu_timeout = 0; if (ImGuiToolkit::IconButton(5, 8) || ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup)) { counter_menu_timeout=0; diff --git a/src/ImageFilter.cpp b/src/ImageFilter.cpp index 41bc7e6..ab2edcb 100644 --- a/src/ImageFilter.cpp +++ b/src/ImageFilter.cpp @@ -80,8 +80,8 @@ std::list< FilteringProgram > FilteringProgram::example_filters = { }; std::list< FilteringProgram > FilteringProgram::example_patterns = { - FilteringProgram("Source", "shaders/filters/source.glsl", "", { }), FilteringProgram("Color", "shaders/filters/color.glsl", "", { }), + FilteringProgram("Source", "shaders/filters/source.glsl", "", { }), FilteringProgram("Color noise", "shaders/filters/RGBnoise.glsl", "", { }), FilteringProgram("Simplex Noise", "shaders/filters/3DSimplexNoise.glsl", "", { }), FilteringProgram("Perlin Noise", "shaders/filters/3DPerlinNoise.glsl", "", { }), diff --git a/src/Session.cpp b/src/Session.cpp index d2f4daf..cff0c11 100644 --- a/src/Session.cpp +++ b/src/Session.cpp @@ -947,6 +947,34 @@ std::list Session::assignedInputs() return inputs; } +std::list Session::inputsForSource( uint64_t sid ) +{ + std::list inputs; + + if (sid > 0 && !input_callbacks_.empty()) { + // test all targets of the list of input callbacks + for(const auto& [key, value] : input_callbacks_) { + if (Source * const* v = std::get_if(&value.target_)) { + // v is a source + if (sid == (*v)->id()) + // v is the source we are looking for + inputs.push_back(key); + } + else if ( const size_t* v = std::get_if(&value.target_)) { + // v is a batch + SourceIdList::iterator it = std::find(batch_[*v].begin(), + batch_[*v].end(),sid); + if ( it != batch_[*v].end()) + // v contains the source we are looking for + inputs.push_back(key); + } + } + // remove duplicates + inputs.unique(); + } + return inputs; +} + bool Session::inputAssigned(uint input) { return input_callbacks_.find(input) != input_callbacks_.end(); diff --git a/src/Session.h b/src/Session.h index db65276..dd1a4b4 100644 --- a/src/Session.h +++ b/src/Session.h @@ -181,6 +181,7 @@ public: bool inputAssigned(uint input); void swapInputCallback(uint from, uint to); void copyInputCallback(uint from, uint to); + std::list inputsForSource( uint64_t id ); void setInputSynchrony(uint input, Metronome::Synchronicity sync); std::vector getInputSynchrony(); diff --git a/src/UserInterfaceManager.cpp b/src/UserInterfaceManager.cpp index c656822..53c255b 100644 --- a/src/UserInterfaceManager.cpp +++ b/src/UserInterfaceManager.cpp @@ -248,7 +248,8 @@ uint64_t UserInterface::Runtime() const void UserInterface::setView(View::Mode mode) { Mixer::manager().setView(mode); - navigator.discardPannel(); + if ( !Settings::application.pannel_always_visible ) + navigator.discardPannel(); } void UserInterface::handleKeyboard() @@ -5099,11 +5100,12 @@ void Navigator::RenderMainPannelSession() ImGui::SetCursorPos( ImVec2( pannel_width_ IMGUI_RIGHT_ALIGN, pos_bot.y - 2.f * ImGui::GetFrameHeightWithSpacing())); ImGuiToolkit::HelpToolTip("Previous versions of the session (latest on top). " - "Double-clic on a version to restore it."); + "Double-clic on a version to restore it.\n\n" + ICON_FA_CODE_BRANCH " With Iterative saving enabled, a new version " + "is kept automatically each time the session is saved."); // toggle button for versioning ImGui::SetCursorPos( ImVec2( pannel_width_ IMGUI_RIGHT_ALIGN, pos_bot.y - ImGui::GetFrameHeightWithSpacing()) ); - ImGuiToolkit::ButtonToggle(" " ICON_FA_CODE_BRANCH " ", &Settings::application.save_version_snapshot, "With iterative saving enabled, a new version " - "is kept each time the session is saved."); + ImGuiToolkit::ButtonToggle(" " ICON_FA_CODE_BRANCH " ", &Settings::application.save_version_snapshot, "Iterative saving"); ImGui::SetCursorPos( pos_bot ); } @@ -5198,11 +5200,12 @@ void Navigator::RenderMainPannelSession() ImGui::SetCursorPos( ImVec2( pannel_width_ IMGUI_RIGHT_ALIGN, pos_bot.y - 2.f * ImGui::GetFrameHeightWithSpacing())); ImGuiToolkit::HelpToolTip("History of actions (latest on top). " - "Double-clic on an action to restore its status."); + "Double-clic on an action to restore its status.\n\n" + ICON_FA_MAP_MARKED_ALT " With Show action View enabled, navigate " + "automatically to the view showing the action on undo/redo."); // toggle button for shhow in view ImGui::SetCursorPos( ImVec2( pannel_width_ IMGUI_RIGHT_ALIGN, pos_bot.y - ImGui::GetFrameHeightWithSpacing()) ); - ImGuiToolkit::ButtonToggle(ICON_FA_MAP_MARKED_ALT, &Settings::application.action_history_follow_view, "Enable Show in view to automatically " - "navigate to the view where the action was done."); + ImGuiToolkit::ButtonToggle(ICON_FA_MAP_MARKED_ALT, &Settings::application.action_history_follow_view, "Show action View"); } ImGui::PopStyleColor(1);