From e2be45c0ba777cf6a1634c12b861dafe4aba28af Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sat, 27 Mar 2021 13:32:38 +0100 Subject: [PATCH] Show preview of lock source locations in options window. --- server/TracyView.cpp | 54 +++++++++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 21 deletions(-) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 22a165d0..802a5549 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -8713,15 +8713,19 @@ void View::DrawOptions() ImGui::SameLine(); } ImGui::TextDisabled( "(%s) %s:%i", RealToString( l.second->timeline.size() ), fileName, sl.line ); - if( ImGui::IsItemClicked( 1 ) ) + if( ImGui::IsItemHovered() ) { - if( SourceFileValid( fileName, m_worker.GetCaptureTime(), *this, m_worker ) ) + DrawSourceTooltip( fileName, sl.line, 1, 1 ); + if( ImGui::IsItemClicked( 1 ) ) { - ViewSource( fileName, sl.line ); - } - else - { - m_optionsLockBuzzAnim.Enable( l.second->srcloc, 0.5f ); + if( SourceFileValid( fileName, m_worker.GetCaptureTime(), *this, m_worker ) ) + { + ViewSource( fileName, sl.line ); + } + else + { + m_optionsLockBuzzAnim.Enable( l.second->srcloc, 0.5f ); + } } } } @@ -8787,15 +8791,19 @@ void View::DrawOptions() ImGui::SameLine(); } ImGui::TextDisabled( "(%s) %s:%i", RealToString( l.second->timeline.size() ), fileName, sl.line ); - if( ImGui::IsItemClicked( 1 ) ) + if( ImGui::IsItemHovered() ) { - if( SourceFileValid( fileName, m_worker.GetCaptureTime(), *this, m_worker ) ) + DrawSourceTooltip( fileName, sl.line, 1, 1 ); + if( ImGui::IsItemClicked( 1 ) ) { - ViewSource( fileName, sl.line ); - } - else - { - m_optionsLockBuzzAnim.Enable( l.second->srcloc, 0.5f ); + if( SourceFileValid( fileName, m_worker.GetCaptureTime(), *this, m_worker ) ) + { + ViewSource( fileName, sl.line ); + } + else + { + m_optionsLockBuzzAnim.Enable( l.second->srcloc, 0.5f ); + } } } } @@ -8861,15 +8869,19 @@ void View::DrawOptions() ImGui::SameLine(); } ImGui::TextDisabled( "(%s) %s:%i", RealToString( l.second->timeline.size() ), fileName, sl.line ); - if( ImGui::IsItemClicked( 1 ) ) + if( ImGui::IsItemHovered() ) { - if( SourceFileValid( fileName, m_worker.GetCaptureTime(), *this, m_worker ) ) + DrawSourceTooltip( fileName, sl.line, 1, 1 ); + if( ImGui::IsItemClicked( 1 ) ) { - ViewSource( fileName, sl.line ); - } - else - { - m_optionsLockBuzzAnim.Enable( l.second->srcloc, 0.5f ); + if( SourceFileValid( fileName, m_worker.GetCaptureTime(), *this, m_worker ) ) + { + ViewSource( fileName, sl.line ); + } + else + { + m_optionsLockBuzzAnim.Enable( l.second->srcloc, 0.5f ); + } } } }