diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 50173622..9c886699 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -71,6 +71,7 @@ View::View( const char* addr ) , m_zoneInfoWindow( nullptr ) , m_lockHighlight { -1 } , m_showOptions( false ) + , m_showMessages( false ) , m_drawZones( true ) , m_drawLocks( true ) , m_drawPlots( true ) @@ -102,6 +103,7 @@ View::View( FileRead& f ) , m_zvScroll( 0 ) , m_zoneInfoWindow( nullptr ) , m_showOptions( false ) + , m_showMessages( false ) , m_drawZones( true ) , m_drawLocks( true ) , m_drawPlots( true ) @@ -1150,6 +1152,8 @@ void View::DrawImpl() ImGui::SameLine(); if( ImGui::Button( "Options", ImVec2( 70, 0 ) ) ) m_showOptions = true; ImGui::SameLine(); + if( ImGui::Button( "Messages", ImVec2( 70, 0 ) ) ) m_showMessages = true; + ImGui::SameLine(); ImGui::Text( "Frames: %-7" PRIu64 " Time span: %-10s View span: %-10s Zones: %-10" PRIu64" Queue delay: %s Timer resolution: %s", m_frames.size(), TimeToString( GetLastTime() - m_frames[0] ), TimeToString( m_zvEnd - m_zvStart ), m_zonesCnt, TimeToString( m_delay ), TimeToString( m_resolution ) ); DrawFrames(); DrawZones(); @@ -1158,6 +1162,7 @@ void View::DrawImpl() m_zoneHighlight = nullptr; DrawZoneInfoWindow(); if( m_showOptions ) DrawOptions(); + if( m_showMessages ) DrawMessages(); if( m_zvStartNext != 0 ) { @@ -2424,6 +2429,25 @@ void View::DrawOptions() ImGui::End(); } +void View::DrawMessages() +{ + ImGui::Begin( "Messages", &m_showMessages, ImGuiWindowFlags_ShowBorders ); + for( auto& v : m_messages ) + { + char tmp[4096]; + sprintf( tmp, "%10s | %s", TimeToString( v->time - m_frames[0] ), v->txt ); + ImGui::Text( tmp ); + if( ImGui::IsItemClicked() ) + { + m_pause = true; + const auto hr = std::max( 1ll, ( m_zvEnd - m_zvStart ) / 2 ); + m_zvStart = v->time - hr; + m_zvEnd = v->time + hr; + } + } + ImGui::End(); +} + uint32_t View::GetZoneColor( const Event& ev ) { return GetZoneColor( GetSourceLocation( ev.srcloc ) ); diff --git a/server/TracyView.hpp b/server/TracyView.hpp index f9cb7055..3ff7c7c2 100644 --- a/server/TracyView.hpp +++ b/server/TracyView.hpp @@ -153,6 +153,7 @@ private: int DrawPlots( int offset, double pxns, const ImVec2& wpos, bool hover ); void DrawPlotPoint( const ImVec2& wpos, float x, float y, int offset, uint32_t color, bool hover, bool hasPrev, double val, double prev ); void DrawOptions(); + void DrawMessages(); void HandleZoneViewMouse( int64_t timespan, const ImVec2& wpos, float w, double& pxns ); @@ -236,6 +237,7 @@ private: LockHighlight m_lockHighlight; bool m_showOptions; + bool m_showMessages; bool m_drawZones; bool m_drawLocks; bool m_drawPlots;