From 5eddfcf196e41aed7fc7475838bd804a0850abeb Mon Sep 17 00:00:00 2001 From: Bruno Date: Wed, 4 Aug 2021 00:29:31 +0200 Subject: [PATCH] Add tag icon in thumbnail to identify as user defined --- SessionCreator.cpp | 4 +++- SessionCreator.h | 2 ++ UserInterfaceManager.cpp | 8 +++++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/SessionCreator.cpp b/SessionCreator.cpp index f162d46..661674d 100644 --- a/SessionCreator.cpp +++ b/SessionCreator.cpp @@ -56,8 +56,10 @@ SessionInformation SessionCreator::info(const std::string& filename) if (session != nullptr ) { const XMLElement *thumbnailelement = session->FirstChildElement("Thumbnail"); // if there is a user defined thumbnail, get it - if (thumbnailelement) + if (thumbnailelement) { ret.thumbnail = XMLToImage(thumbnailelement); + ret.user_thumbnail_ = true; + } // otherwise get the default saved thumbnail in session else ret.thumbnail = XMLToImage(session); diff --git a/SessionCreator.h b/SessionCreator.h index d34241b..4cde17c 100644 --- a/SessionCreator.h +++ b/SessionCreator.h @@ -82,9 +82,11 @@ protected: struct SessionInformation { std::string description; FrameBufferImage *thumbnail; + bool user_thumbnail_; SessionInformation() { description = ""; thumbnail = nullptr; + user_thumbnail_ = false; } }; diff --git a/UserInterfaceManager.cpp b/UserInterfaceManager.cpp index 4ac833f..4fb91d3 100644 --- a/UserInterfaceManager.cpp +++ b/UserInterfaceManager.cpp @@ -4118,6 +4118,7 @@ void Navigator::RenderMainPannelVimix() static std::string _file_info = ""; static Thumbnail _file_thumbnail; + static bool with_tag_ = false; // load info only if changed from the one already displayed if (_displayed_over != _file_over) { @@ -4127,6 +4128,7 @@ void Navigator::RenderMainPannelVimix() if (info.thumbnail) { // set image content to thumbnail display _file_thumbnail.fill( info.thumbnail ); + with_tag_ = info.user_thumbnail_; delete info.thumbnail; } else _file_thumbnail.reset(); @@ -4135,10 +4137,14 @@ void Navigator::RenderMainPannelVimix() if ( !_file_info.empty()) { ImGui::BeginTooltip(); + ImVec2 p_ = ImGui::GetCursorScreenPos(); _file_thumbnail.Render(size.x); ImGui::Text("%s", _file_info.c_str()); + if (with_tag_) { + ImGui::SetCursorScreenPos(p_ + ImVec2(6, 6)); + ImGui::Text(ICON_FA_TAG); + } ImGui::EndTooltip(); - } else selection_session_mode_changed = true;