From 0748655797e4913cba90e3fbc36acdd6e851d5de Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sat, 9 Mar 2019 00:15:23 +0100 Subject: [PATCH] Allow opening source file view from statistics menu. --- server/TracyView.cpp | 26 +++++++++++++++++++++++++- server/TracyView.hpp | 1 + 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 40443cfa..17769362 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -955,6 +955,7 @@ bool View::DrawImpl() m_findZoneBuzzAnim.Update( io.DeltaTime ); m_optionsLockBuzzAnim.Update( io.DeltaTime ); m_lockInfoAnim.Update( io.DeltaTime ); + m_statBuzzAnim.Update( io.DeltaTime ); return keepOpen; } @@ -7500,7 +7501,30 @@ void View::DrawStatistics() m_findZone.ShowZone( v->first, name ); } ImGui::NextColumn(); - ImGui::TextDisabled( "%s:%i", m_worker.GetString( srcloc.file ), srcloc.line ); + float indentVal = 0.f; + if( m_statBuzzAnim.Match( v->first ) ) + { + const auto time = m_statBuzzAnim.Time(); + indentVal = sin( time * 60.f ) * 10.f * time; + ImGui::Indent( indentVal ); + } + const auto file = m_worker.GetString( srcloc.file ); + ImGui::TextDisabled( "%s:%i", file, srcloc.line ); + if( ImGui::IsItemClicked( 1 ) ) + { + if( FileExists( file ) ) + { + SetTextEditorFile( file, srcloc.line ); + } + else + { + m_statBuzzAnim.Enable( v->first, 0.5f ); + } + } + if( indentVal != 0.f ) + { + ImGui::Unindent( indentVal ); + } ImGui::NextColumn(); ImGui::TextUnformatted( TimeToString( m_statSelf ? v->second.selfTotal : v->second.total ) ); ImGui::NextColumn(); diff --git a/server/TracyView.hpp b/server/TracyView.hpp index bce12e22..c09d16ed 100644 --- a/server/TracyView.hpp +++ b/server/TracyView.hpp @@ -277,6 +277,7 @@ private: BuzzAnim m_findZoneBuzzAnim; BuzzAnim m_optionsLockBuzzAnim; BuzzAnim m_lockInfoAnim; + BuzzAnim m_statBuzzAnim; Vector m_zoneInfoStack; Vector m_gpuInfoStack;