Minor UI improvements

This commit is contained in:
brunoherbelin
2025-11-23 12:57:37 +01:00
parent 76e23d5e5e
commit 2a6b29e3da
5 changed files with 67 additions and 25 deletions

View File

@@ -18,6 +18,7 @@
**/
#include <string>
#include <vector>
#include <iomanip>
@@ -28,6 +29,7 @@
#include <tinyxml2.h>
#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<int, std::string> > 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<uint> 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;

View File

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

View File

@@ -947,6 +947,34 @@ std::list<uint> Session::assignedInputs()
return inputs;
}
std::list<uint> Session::inputsForSource( uint64_t sid )
{
std::list<uint> 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<Source *>(&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<size_t>(&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();

View File

@@ -181,6 +181,7 @@ public:
bool inputAssigned(uint input);
void swapInputCallback(uint from, uint to);
void copyInputCallback(uint from, uint to);
std::list<uint> inputsForSource( uint64_t id );
void setInputSynchrony(uint input, Metronome::Synchronicity sync);
std::vector<Metronome::Synchronicity> getInputSynchrony();

View File

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