Add source preview to statistics window.

This commit is contained in:
Bartosz Taudul 2021-03-27 14:02:52 +01:00
parent 62ac5544b6
commit ff6ecef5f3
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3

View File

@ -12492,15 +12492,19 @@ void View::DrawStatistics()
const auto file = m_worker.GetString( srcloc.file ); const auto file = m_worker.GetString( srcloc.file );
ImGui::TextDisabled( "%s:%i", file, srcloc.line ); ImGui::TextDisabled( "%s:%i", file, srcloc.line );
if( ImGui::IsItemClicked( 1 ) ) if( ImGui::IsItemHovered() )
{ {
if( SourceFileValid( file, m_worker.GetCaptureTime(), *this, m_worker ) ) DrawSourceTooltip( file, srcloc.line );
if( ImGui::IsItemClicked( 1 ) )
{ {
ViewSource( file, srcloc.line ); if( SourceFileValid( file, m_worker.GetCaptureTime(), *this, m_worker ) )
} {
else ViewSource( file, srcloc.line );
{ }
m_statBuzzAnim.Enable( v.srcloc, 0.5f ); else
{
m_statBuzzAnim.Enable( v.srcloc, 0.5f );
}
} }
} }
if( indentVal != 0.f ) if( indentVal != 0.f )
@ -12934,30 +12938,34 @@ void View::DrawStatistics()
{ {
TextDisabledUnformatted( file ); TextDisabledUnformatted( file );
} }
if( ImGui::IsItemClicked( 1 ) ) if( ImGui::IsItemHovered() )
{ {
if( SourceFileValid( file, m_worker.GetCaptureTime(), *this, m_worker ) ) DrawSourceTooltip( file, line );
if( ImGui::IsItemClicked( 1 ) )
{ {
ViewSymbol( file, line, codeAddr, v.symAddr ); if( SourceFileValid( file, m_worker.GetCaptureTime(), *this, m_worker ) )
if( !m_statSeparateInlines ) m_sourceView->CalcInlineStats( false );
}
else if( symlen != 0 )
{
uint32_t len;
if( m_worker.GetSymbolCode( codeAddr, len ) )
{ {
ViewSymbol( nullptr, 0, codeAddr, v.symAddr ); ViewSymbol( file, line, codeAddr, v.symAddr );
if( !m_statSeparateInlines ) m_sourceView->CalcInlineStats( false ); if( !m_statSeparateInlines ) m_sourceView->CalcInlineStats( false );
} }
else if( symlen != 0 )
{
uint32_t len;
if( m_worker.GetSymbolCode( codeAddr, len ) )
{
ViewSymbol( nullptr, 0, codeAddr, v.symAddr );
if( !m_statSeparateInlines ) m_sourceView->CalcInlineStats( false );
}
else
{
m_statBuzzAnim.Enable( v.symAddr, 0.5f );
}
}
else else
{ {
m_statBuzzAnim.Enable( v.symAddr, 0.5f ); m_statBuzzAnim.Enable( v.symAddr, 0.5f );
} }
} }
else
{
m_statBuzzAnim.Enable( v.symAddr, 0.5f );
}
} }
if( indentVal != 0.f ) if( indentVal != 0.f )
{ {
@ -13107,30 +13115,34 @@ void View::DrawStatistics()
{ {
TextDisabledUnformatted( file ); TextDisabledUnformatted( file );
} }
if( ImGui::IsItemClicked( 1 ) ) if( ImGui::IsItemHovered() )
{ {
if( SourceFileValid( file, m_worker.GetCaptureTime(), *this, m_worker ) ) DrawSourceTooltip( file, line );
if( ImGui::IsItemClicked( 1 ) )
{ {
ViewSymbol( file, line, codeAddr, iv.symAddr ); if( SourceFileValid( file, m_worker.GetCaptureTime(), *this, m_worker ) )
if( !m_statSeparateInlines ) m_sourceView->CalcInlineStats( true );
}
else if( symlen != 0 )
{
uint32_t len;
if( m_worker.GetSymbolCode( codeAddr, len ) )
{ {
ViewSymbol( nullptr, 0, codeAddr, iv.symAddr ); ViewSymbol( file, line, codeAddr, iv.symAddr );
if( !m_statSeparateInlines ) m_sourceView->CalcInlineStats( true ); if( !m_statSeparateInlines ) m_sourceView->CalcInlineStats( true );
} }
else if( symlen != 0 )
{
uint32_t len;
if( m_worker.GetSymbolCode( codeAddr, len ) )
{
ViewSymbol( nullptr, 0, codeAddr, iv.symAddr );
if( !m_statSeparateInlines ) m_sourceView->CalcInlineStats( true );
}
else
{
m_statBuzzAnim.Enable( iv.symAddr, 0.5f );
}
}
else else
{ {
m_statBuzzAnim.Enable( iv.symAddr, 0.5f ); m_statBuzzAnim.Enable( iv.symAddr, 0.5f );
} }
} }
else
{
m_statBuzzAnim.Enable( iv.symAddr, 0.5f );
}
} }
if( indentVal != 0.f ) if( indentVal != 0.f )
{ {