From e564b63f7713e6a75adbc4cfb7c6acc505c93dd8 Mon Sep 17 00:00:00 2001 From: brunoherbelin Date: Sun, 24 Jan 2021 22:18:31 +0100 Subject: [PATCH] Added icon to toggle lock in pannel (and fixed icon) --- ImGuiVisitor.cpp | 33 +++++++++++++++------------------ MediaSource.cpp | 2 +- 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/ImGuiVisitor.cpp b/ImGuiVisitor.cpp index 4fbac0c..994c0a2 100644 --- a/ImGuiVisitor.cpp +++ b/ImGuiVisitor.cpp @@ -414,15 +414,8 @@ void ImGuiVisitor::visit (Source& s) else ImGuiToolkit::HelpMarker("Inactive", ICON_FA_SNOWFLAKE); - // Inform on status of lock - ImGui::SetCursorPos( ImVec2(preview_width + 20, pos.y -height + ImGui::GetFrameHeight()) ); - if (s.locked()) - ImGuiToolkit::HelpMarker("Locked", ICON_FA_LOCK); - else - ImGuiToolkit::HelpMarker("Unlocked", ICON_FA_LOCK_OPEN); - // Inform on workspace - ImGui::SetCursorPos( ImVec2(preview_width + 20, pos.y -height + 2.f * ImGui::GetFrameHeight()) ); + ImGui::SetCursorPos( ImVec2(preview_width + 20, pos.y -height + ImGui::GetFrameHeight()) ); if (s.workspace() == Source::BACKGROUND) ImGuiToolkit::HelpIcon("Background",10, 16); else if (s.workspace() == Source::FOREGROUND) @@ -430,6 +423,13 @@ void ImGuiVisitor::visit (Source& s) else ImGuiToolkit::HelpIcon("Stage",11, 16); + // locking + ImGui::SetCursorPos( ImVec2(preview_width + 20, pos.y -height + 2.f * ImGui::GetFrameHeightWithSpacing()) ); + const char *tooltip[2] = {"Unlocked", "Locked"}; + bool l = s.locked(); + if (ImGuiToolkit::IconToggle(15,6,17,6, &l, tooltip ) ) + s.setLocked(l); + // toggle enable/disable image processing bool on = s.imageProcessingEnabled(); ImGui::SetCursorPos( ImVec2(preview_width + 15, pos.y -ImGui::GetFrameHeight() ) ); @@ -455,16 +455,13 @@ void ImGuiVisitor::visit (Source& s) void ImGuiVisitor::visit (MediaSource& s) { - if ( s.mediaplayer()->isImage() ) { - ImGuiToolkit::Icon(2,9); - ImGui::SameLine(0, 10); + ImGuiToolkit::Icon(s.icon().x, s.icon().y); + ImGui::SameLine(0, 10); + if ( s.mediaplayer()->isImage() ) ImGui::Text("Image File"); - } - else { - ImGuiToolkit::Icon(18,13); - ImGui::SameLine(0, 10); + else ImGui::Text("Video File"); - } + if ( ImGui::Button(IMGUI_TITLE_MEDIAPLAYER, ImVec2(IMGUI_RIGHT_ALIGN, 0)) ) UserInterface::manager().showMediaPlayer( s.mediaplayer()); ImGuiToolkit::ButtonOpenUrl( SystemToolkit::path_filename(s.path()).c_str(), ImVec2(IMGUI_RIGHT_ALIGN, 0) ); @@ -489,9 +486,9 @@ void ImGuiVisitor::visit (SessionSource& s) Action::manager().store(oss.str(), s.id()); } - if ( ImGui::Button( ICON_FA_FILE_UPLOAD " Make Current", ImVec2(IMGUI_RIGHT_ALIGN, 0)) ) + if ( ImGui::Button( ICON_FA_FILE_UPLOAD " Open Session", ImVec2(IMGUI_RIGHT_ALIGN, 0)) ) Mixer::manager().set( s.detach() ); - if ( ImGui::Button( ICON_FA_FILE_EXPORT " Import", ImVec2(IMGUI_RIGHT_ALIGN, 0)) ) + if ( ImGui::Button( ICON_FA_FILE_EXPORT " Import Session", ImVec2(IMGUI_RIGHT_ALIGN, 0)) ) Mixer::manager().merge( s.detach() ); ImGuiToolkit::ButtonOpenUrl( SystemToolkit::path_filename(s.path()).c_str(), ImVec2(IMGUI_RIGHT_ALIGN, 0) ); diff --git a/MediaSource.cpp b/MediaSource.cpp index 631842d..8559663 100644 --- a/MediaSource.cpp +++ b/MediaSource.cpp @@ -45,7 +45,7 @@ MediaPlayer *MediaSource::mediaplayer() const glm::ivec2 MediaSource::icon() const { if (mediaplayer_->isImage()) - return glm::ivec2(2, 9); + return glm::ivec2(4, 9); else return glm::ivec2(18, 13); }