1
0
mirror of https://github.com/wolfpld/tracy.git synced 2025-03-20 07:40:02 +08:00

Message list window.

This commit is contained in:
Bartosz Taudul 2017-10-14 14:36:30 +02:00
parent fa8030009f
commit 3ba349565a
2 changed files with 26 additions and 0 deletions

View File

@ -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 ) );

View File

@ -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;