1
0
mirror of https://github.com/wolfpld/tracy synced 2025-04-30 04:43:53 +00:00

Use tables in the failure callstack view.

This commit is contained in:
Bartosz Taudul 2020-12-08 01:45:45 +01:00
parent a0bf2f5605
commit 34683ceb4d

View File

@ -460,23 +460,13 @@ bool View::Draw()
{ {
ImGui::BeginChild( "##callstackFailure", ImVec2( 1200, 500 ) ); ImGui::BeginChild( "##callstackFailure", ImVec2( 1200, 500 ) );
const auto w = ImGui::GetWindowWidth(); const auto w = ImGui::GetWindowWidth();
ImGui::Columns( 4 ); if( ImGui::BeginTable( "##callstack", 4, ImGuiTableFlags_Resizable | ImGuiTableFlags_RowBg | ImGuiTableFlags_Borders ) )
ImGui::SetColumnWidth( 0, w * 0.05f ); {
ImGui::SetColumnWidth( 1, w * 0.425f ); ImGui::TableSetupColumn( "Frame", ImGuiTableColumnFlags_WidthAutoResize );
ImGui::SetColumnWidth( 2, w * 0.425f ); ImGui::TableSetupColumn( "Function" );
ImGui::SetColumnWidth( 3, w * 0.1f ); ImGui::TableSetupColumn( "Location" );
ImGui::TextUnformatted( "Frame" ); ImGui::TableSetupColumn( "Image" );
ImGui::NextColumn(); ImGui::TableHeadersRow();
ImGui::TextUnformatted( "Function" );
ImGui::SameLine();
s_instance->DrawHelpMarker( "Click on entry to copy it to clipboard." );
ImGui::NextColumn();
ImGui::TextUnformatted( "Location" );
ImGui::SameLine();
s_instance->DrawHelpMarker( "Click on entry to copy it to clipboard." );
ImGui::NextColumn();
ImGui::TextUnformatted( "Image" );
ImGui::NextColumn();
auto& cs = s_instance->m_worker.GetCallstack( data.callstack ); auto& cs = s_instance->m_worker.GetCallstack( data.callstack );
int fidx = 0; int fidx = 0;
@ -486,19 +476,23 @@ bool View::Draw()
auto frameData = s_instance->m_worker.GetCallstackFrame( entry ); auto frameData = s_instance->m_worker.GetCallstackFrame( entry );
if( !frameData ) if( !frameData )
{ {
ImGui::Separator(); ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::Text( "%i", fidx++ ); ImGui::Text( "%i", fidx++ );
ImGui::NextColumn(); ImGui::TableNextColumn();
char buf[32]; char buf[32];
sprintf( buf, "%p", (void*)s_instance->m_worker.GetCanonicalPointer( entry ) ); sprintf( buf, "%p", (void*)s_instance->m_worker.GetCanonicalPointer( entry ) );
ImGui::TextUnformatted( buf ); ImGui::TextUnformatted( buf );
if( ImGui::IsItemHovered() )
{
ImGui::BeginTooltip();
ImGui::TextUnformatted( "Click on entry to copy it to clipboard." );
ImGui::EndTooltip();
if( ImGui::IsItemClicked() ) if( ImGui::IsItemClicked() )
{ {
ImGui::SetClipboardText( buf ); ImGui::SetClipboardText( buf );
} }
ImGui::NextColumn(); }
ImGui::NextColumn();
ImGui::NextColumn();
} }
else else
{ {
@ -526,7 +520,8 @@ bool View::Draw()
bidx++; bidx++;
ImGui::Separator(); ImGui::TableNextRow();
ImGui::TableNextColumn();
if( f == fsz-1 ) if( f == fsz-1 )
{ {
ImGui::Text( "%i", fidx++ ); ImGui::Text( "%i", fidx++ );
@ -535,7 +530,7 @@ bool View::Draw()
{ {
TextDisabledUnformatted( "inline" ); TextDisabledUnformatted( "inline" );
} }
ImGui::NextColumn(); ImGui::TableNextColumn();
{ {
ImGui::PushTextWrapPos( 0.0f ); ImGui::PushTextWrapPos( 0.0f );
if( txt[0] == '[' ) if( txt[0] == '[' )
@ -548,11 +543,17 @@ bool View::Draw()
} }
ImGui::PopTextWrapPos(); ImGui::PopTextWrapPos();
} }
if( ImGui::IsItemHovered() )
{
ImGui::BeginTooltip();
ImGui::TextUnformatted( "Click on entry to copy it to clipboard." );
ImGui::EndTooltip();
if( ImGui::IsItemClicked() ) if( ImGui::IsItemClicked() )
{ {
ImGui::SetClipboardText( txt ); ImGui::SetClipboardText( txt );
} }
ImGui::NextColumn(); }
ImGui::TableNextColumn();
ImGui::PushTextWrapPos( 0.0f ); ImGui::PushTextWrapPos( 0.0f );
txt = s_instance->m_worker.GetString( frame.file ); txt = s_instance->m_worker.GetString( frame.file );
if( frame.line == 0 ) if( frame.line == 0 )
@ -563,22 +564,27 @@ bool View::Draw()
{ {
ImGui::TextDisabled( "%s:%i", txt, frame.line ); ImGui::TextDisabled( "%s:%i", txt, frame.line );
} }
if( ImGui::IsItemHovered() )
{
ImGui::BeginTooltip();
ImGui::TextUnformatted( "Click on entry to copy it to clipboard." );
ImGui::EndTooltip();
if( ImGui::IsItemClicked() ) if( ImGui::IsItemClicked() )
{ {
ImGui::SetClipboardText( txt ); ImGui::SetClipboardText( txt );
} }
}
ImGui::PopTextWrapPos(); ImGui::PopTextWrapPos();
ImGui::NextColumn(); ImGui::TableNextColumn();
if( frameData->imageName.Active() ) if( frameData->imageName.Active() )
{ {
TextDisabledUnformatted( s_instance->m_worker.GetString( frameData->imageName ) ); TextDisabledUnformatted( s_instance->m_worker.GetString( frameData->imageName ) );
} }
ImGui::NextColumn();
} }
} }
} }
ImGui::EndTable();
ImGui::EndColumns(); }
ImGui::EndChild(); ImGui::EndChild();
ImGui::TreePop(); ImGui::TreePop();
} }