Added Link status next to source preview in left pannel

Give quick access to select the linked group.
This commit is contained in:
Bruno Herbelin
2022-01-07 18:31:25 +01:00
parent 5e7c325874
commit c91a4670de

View File

@@ -51,6 +51,7 @@
#include "SessionVisitor.h" #include "SessionVisitor.h"
#include "Settings.h" #include "Settings.h"
#include "Mixer.h" #include "Mixer.h"
#include "MixingGroup.h"
#include "ActionManager.h" #include "ActionManager.h"
#include "imgui.h" #include "imgui.h"
@@ -259,9 +260,9 @@ void ImGuiVisitor::visit(ImageProcessingShader &n)
{ {
ImGui::PushID(std::to_string(n.id()).c_str()); ImGui::PushID(std::to_string(n.id()).c_str());
ImGuiToolkit::Icon(6, 2); // ImGuiToolkit::Icon(6, 2);
ImGui::SameLine(0, IMGUI_SAME_LINE); // ImGui::SameLine(0, IMGUI_SAME_LINE);
ImGui::Text("Filters"); // ImGui::Text("Filters");
if (ImGuiToolkit::IconButton(6, 4)) { if (ImGuiToolkit::IconButton(6, 4)) {
n.gamma = glm::vec4(1.f, 1.f, 1.f, 1.f); n.gamma = glm::vec4(1.f, 1.f, 1.f, 1.f);
@@ -454,8 +455,19 @@ void ImGuiVisitor::visit (Source& s)
else else
ImGuiToolkit::Indication("in Workspace",11, 16); ImGuiToolkit::Indication("in Workspace",11, 16);
// locking // Inform on link
ImGui::SetCursorPos( ImVec2(preview_width + 20, pos.y + 2.f * ImGui::GetFrameHeightWithSpacing()) ); ImGui::SetCursorPos( ImVec2(preview_width + 20, pos.y + 2.f * ImGui::GetFrameHeightWithSpacing()) );
if (s.mixingGroup() != nullptr) {
if (ImGuiToolkit::IconButton(ICON_FA_LINK, "Linked")){
Mixer::selection().clear();
Mixer::selection().add( s.mixingGroup()->getCopy() );
}
}
else
ImGuiToolkit::Indication("not Linked", ICON_FA_UNLINK);
// locking
ImGui::SetCursorPos( ImVec2(preview_width + 20, pos.y + 3.f * ImGui::GetFrameHeightWithSpacing()) );
const char *tooltip[2] = {"Unlocked", "Locked"}; const char *tooltip[2] = {"Unlocked", "Locked"};
bool l = s.locked(); bool l = s.locked();
if (ImGuiToolkit::IconToggle(15,6,17,6, &l, tooltip ) ) { if (ImGuiToolkit::IconToggle(15,6,17,6, &l, tooltip ) ) {
@@ -472,19 +484,23 @@ void ImGuiVisitor::visit (Source& s)
// toggle enable/disable image processing // toggle enable/disable image processing
bool on = s.imageProcessingEnabled(); bool on = s.imageProcessingEnabled();
ImGui::SetCursorPos( ImVec2(preview_width + 15, pos.y + 3.5f * ImGui::GetFrameHeightWithSpacing()) ); ImGui::SetCursorPos( ImVec2( pos.x, pos.y + preview_height));
if ( ImGuiToolkit::ButtonIconToggle(6, 2, 6, 2, &on, "Filters") ){ if ( ImGuiToolkit::ButtonIconToggle(6, 2, 6, 2, &on) ){
std::ostringstream oss; std::ostringstream oss;
oss << s.name() << ": " << ( on ? "Enable Filter" : "Disable Filter"); oss << s.name() << ": " << ( on ? "Enable Filter" : "Disable Filter");
Action::manager().store(oss.str()); Action::manager().store(oss.str());
} }
s.setImageProcessingEnabled(on); s.setImageProcessingEnabled(on);
ImGui::SameLine(0, IMGUI_SAME_LINE);
ImGui::Text("Filters");
pos = ImGui::GetCursorPos();
// image processing pannel // image processing pannel
if (s.imageProcessingEnabled()) { if (s.imageProcessingEnabled()) {
// menu icon for image processing // menu icon for image processing
ImGui::SetCursorPos( ImVec2( preview_width - ImGui::GetTextLineHeight(), pos.y + 4.5f * ImGui::GetFrameHeightWithSpacing())); // ...come back ImGui::SameLine(preview_width, 2 * IMGUI_SAME_LINE);
if (ImGuiToolkit::IconButton(5, 8)) if (ImGuiToolkit::IconButton(5, 8))
ImGui::OpenPopup( "MenuImageProcessing" ); ImGui::OpenPopup( "MenuImageProcessing" );
if (ImGui::BeginPopup( "MenuImageProcessing" )) if (ImGui::BeginPopup( "MenuImageProcessing" ))
@@ -540,7 +556,7 @@ void ImGuiVisitor::visit (Source& s)
} }
// full panel for image processing // full panel for image processing
ImGui::SetCursorPos( ImVec2( pos.x, pos.y + preview_height)); // ...come back ImGui::SetCursorPos( pos );
if (s.processingshader_link_.connected()) { if (s.processingshader_link_.connected()) {
ImGuiToolkit::Icon(6, 2); ImGuiToolkit::Icon(6, 2);
@@ -555,6 +571,8 @@ void ImGuiVisitor::visit (Source& s)
s.processingShader()->accept(*this); s.processingShader()->accept(*this);
} }
ImGui::Spacing();
ImGui::PopID(); ImGui::PopID();
} }