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

Use tables for callstack sample parents.

This commit is contained in:
Bartosz Taudul 2020-12-16 15:05:35 +01:00
parent f1d48b1298
commit 6e715cf346

View File

@ -15349,30 +15349,14 @@ void View::DrawSampleParents()
auto& cs = m_worker.GetParentCallstack( data[m_sampleParents.sel]->first ); auto& cs = m_worker.GetParentCallstack( data[m_sampleParents.sel]->first );
ImGui::Separator(); ImGui::Separator();
ImGui::BeginChild( "##callstack" ); if( ImGui::BeginTable( "##callstack", 4, ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable | ImGuiTableFlags_Borders | ImGuiTableFlags_ScrollY ) )
const auto w = ImGui::GetWindowWidth();
static bool widthSet = false;
ImGui::Columns( 4 );
if( !widthSet )
{ {
widthSet = true; ImGui::TableSetupScrollFreeze( 0, 1 );
ImGui::SetColumnWidth( 0, w * 0.05f ); ImGui::TableSetupColumn( "Frame", ImGuiTableColumnFlags_NoHide | ImGuiTableColumnFlags_WidthAutoResize );
ImGui::SetColumnWidth( 1, w * 0.425f ); ImGui::TableSetupColumn( "Function" );
ImGui::SetColumnWidth( 2, w * 0.425f ); ImGui::TableSetupColumn( "Location" );
ImGui::SetColumnWidth( 3, w * 0.1f ); ImGui::TableSetupColumn( "Image" );
} ImGui::TableHeadersRow();
ImGui::TextUnformatted( "Frame" );
ImGui::NextColumn();
ImGui::TextUnformatted( "Function" );
ImGui::SameLine();
DrawHelpMarker( "Click on entry to copy it to clipboard." );
ImGui::NextColumn();
ImGui::TextUnformatted( "Location" );
ImGui::SameLine();
DrawHelpMarker( "Click on entry to copy it to clipboard.\nRight click on entry to try to open source file." );
ImGui::NextColumn();
ImGui::TextUnformatted( "Image" );
ImGui::NextColumn();
int fidx = 0; int fidx = 0;
int bidx = 0; int bidx = 0;
@ -15386,7 +15370,8 @@ void View::DrawSampleParents()
const auto& frame = frameData->data[f]; const auto& frame = frameData->data[f];
auto txt = m_worker.GetString( frame.name ); auto txt = m_worker.GetString( frame.name );
bidx++; bidx++;
ImGui::Separator(); ImGui::TableNextRow();
ImGui::TableNextColumn();
if( f == fsz-1 ) if( f == fsz-1 )
{ {
ImGui::Text( "%i", fidx++ ); ImGui::Text( "%i", fidx++ );
@ -15395,7 +15380,7 @@ void View::DrawSampleParents()
{ {
TextDisabledUnformatted( "inline" ); TextDisabledUnformatted( "inline" );
} }
ImGui::NextColumn(); ImGui::TableNextColumn();
{ {
ImGui::PushTextWrapPos( 0.0f ); ImGui::PushTextWrapPos( 0.0f );
if( txt[0] == '[' ) if( txt[0] == '[' )
@ -15412,7 +15397,7 @@ void View::DrawSampleParents()
{ {
ImGui::SetClipboardText( txt ); ImGui::SetClipboardText( txt );
} }
ImGui::NextColumn(); ImGui::TableNextColumn();
ImGui::PushTextWrapPos( 0.0f ); ImGui::PushTextWrapPos( 0.0f );
float indentVal = 0.f; float indentVal = 0.f;
if( m_sampleParentBuzzAnim.Match( bidx ) ) if( m_sampleParentBuzzAnim.Match( bidx ) )
@ -15524,17 +15509,15 @@ void View::DrawSampleParents()
ImGui::Unindent( indentVal ); ImGui::Unindent( indentVal );
} }
ImGui::PopTextWrapPos(); ImGui::PopTextWrapPos();
ImGui::NextColumn(); ImGui::TableNextColumn();
if( frameData->imageName.Active() ) if( frameData->imageName.Active() )
{ {
TextDisabledUnformatted( m_worker.GetString( frameData->imageName ) ); TextDisabledUnformatted( m_worker.GetString( frameData->imageName ) );
} }
ImGui::NextColumn();
} }
} }
ImGui::EndTable();
ImGui::EndColumns(); }
ImGui::EndChild();
ImGui::End(); ImGui::End();
if( !show ) if( !show )