From 44e027ad112fb9171084eec78b96667b3038ffbc Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sun, 5 Aug 2018 16:37:51 +0200 Subject: [PATCH] Highlight message markers on timeline. --- server/TracyView.cpp | 26 ++++++++++++++++++++++++-- server/TracyView.hpp | 1 + 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 08e097d7..532a04da 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -228,6 +228,8 @@ View::View( const char* addr ) , m_zoneSrcLocHighlight( 0 ) , m_zoneSrcLocHighlightActive( false ) , m_lockHighlight { -1 } + , m_msgHighlight( nullptr ) + , m_msgHighlightActive( false ) , m_gpuInfoWindow( nullptr ) , m_callstackInfoWindow( 0 ) , m_memoryAllocInfoWindow( -1 ) @@ -269,6 +271,8 @@ View::View( FileRead& f ) , m_zoneInfoWindow( nullptr ) , m_zoneSrcLocHighlight( 0 ) , m_zoneSrcLocHighlightActive( false ) + , m_msgHighlight( nullptr ) + , m_msgHighlightActive( false ) , m_gpuInfoWindow( nullptr ) , m_callstackInfoWindow( 0 ) , m_memoryAllocInfoWindow( -1 ) @@ -1185,7 +1189,14 @@ bool View::DrawZoneFrames( const FrameData& frames ) void View::DrawZones() { - m_msgHighlight = nullptr; + if( m_msgHighlightActive ) + { + m_msgHighlightActive = false; + } + else + { + m_msgHighlight = nullptr; + } if( m_zoneSrcLocHighlightActive ) { m_zoneSrcLocHighlightActive = false; @@ -1361,8 +1372,13 @@ void View::DrawZones() if( dist > 1 ) { draw->AddTriangleFilled( wpos + ImVec2( px - (ty - to) * 0.5, offset + to ), wpos + ImVec2( px + (ty - to) * 0.5, offset + to ), wpos + ImVec2( px, offset + to + th ), 0xFFDDDDDD ); + draw->AddTriangle( wpos + ImVec2( px - (ty - to) * 0.5, offset + to ), wpos + ImVec2( px + (ty - to) * 0.5, offset + to ), wpos + ImVec2( px, offset + to + th ), 0xFFDDDDDD ); + } + else + { + const auto color = ( m_msgHighlight == *it ) ? 0xFF4444FF : 0xFFDDDDDD; + draw->AddTriangle( wpos + ImVec2( px - (ty - to) * 0.5, offset + to ), wpos + ImVec2( px + (ty - to) * 0.5, offset + to ), wpos + ImVec2( px, offset + to + th ), color ); } - draw->AddTriangle( wpos + ImVec2( px - (ty - to) * 0.5, offset + to ), wpos + ImVec2( px + (ty - to) * 0.5, offset + to ), wpos + ImVec2( px, offset + to + th ), 0xFFDDDDDD ); if( hover && ImGui::IsMouseHoveringRect( wpos + ImVec2( px - (ty - to) * 0.5 - 1, offset ), wpos + ImVec2( px + (ty - to) * 0.5 + 1, offset + ty ) ) ) { ImGui::BeginTooltip(); @@ -1379,6 +1395,7 @@ void View::DrawZones() } ImGui::EndTooltip(); m_msgHighlight = *it; + m_msgHighlightActive = true; } it = next; } @@ -3931,6 +3948,11 @@ void View::DrawMessages() { CenterAtTime( v->time ); } + if( ImGui::IsItemHovered() ) + { + m_msgHighlight = v; + m_msgHighlightActive = true; + } ImGui::PopID(); ImGui::NextColumn(); ImGui::Text( "%s", m_worker.GetThreadString( v->thread ) ); diff --git a/server/TracyView.hpp b/server/TracyView.hpp index 78333dad..565799e4 100644 --- a/server/TracyView.hpp +++ b/server/TracyView.hpp @@ -189,6 +189,7 @@ private: bool m_zoneSrcLocHighlightActive; LockHighlight m_lockHighlight; const MessageData* m_msgHighlight; + bool m_msgHighlightActive; const GpuEvent* m_gpuInfoWindow; const GpuEvent* m_gpuHighlight; uint64_t m_gpuInfoWindowThread;