Use tables for call stack view.

This commit is contained in:
Bartosz Taudul 2020-12-16 15:01:07 +01:00
parent 325bcc035a
commit f1d48b1298

View File

@ -13246,30 +13246,14 @@ void View::DrawCallstackWindow()
ImGui::PopStyleVar();
ImGui::Separator();
ImGui::BeginChild( "##callstack" );
const auto w = ImGui::GetWindowWidth();
static bool widthSet = false;
ImGui::Columns( 4 );
if( !widthSet )
if( ImGui::BeginTable( "##callstack", 4, ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable | ImGuiTableFlags_Borders | ImGuiTableFlags_ScrollY ) )
{
widthSet = true;
ImGui::SetColumnWidth( 0, w * 0.05f );
ImGui::SetColumnWidth( 1, w * 0.425f );
ImGui::SetColumnWidth( 2, w * 0.425f );
ImGui::SetColumnWidth( 3, w * 0.1f );
}
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();
ImGui::TableSetupScrollFreeze( 0, 1 );
ImGui::TableSetupColumn( "Frame", ImGuiTableColumnFlags_NoHide | ImGuiTableColumnFlags_WidthAutoResize );
ImGui::TableSetupColumn( "Function" );
ImGui::TableSetupColumn( "Location" );
ImGui::TableSetupColumn( "Image" );
ImGui::TableHeadersRow();
int fidx = 0;
int bidx = 0;
@ -13278,9 +13262,10 @@ void View::DrawCallstackWindow()
auto frameData = m_worker.GetCallstackFrame( entry );
if( !frameData )
{
ImGui::Separator();
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::Text( "%i", fidx++ );
ImGui::NextColumn();
ImGui::TableNextColumn();
char buf[32];
sprintf( buf, "%p", (void*)m_worker.GetCanonicalPointer( entry ) );
ImGui::TextUnformatted( buf );
@ -13288,9 +13273,6 @@ void View::DrawCallstackWindow()
{
ImGui::SetClipboardText( buf );
}
ImGui::NextColumn();
ImGui::NextColumn();
ImGui::NextColumn();
}
else
{
@ -13316,9 +13298,9 @@ void View::DrawCallstackWindow()
if( match ) continue;
}
ImGui::TableNextRow();
ImGui::TableNextColumn();
bidx++;
ImGui::Separator();
if( f == fsz-1 )
{
ImGui::Text( "%i", fidx++ );
@ -13327,7 +13309,7 @@ void View::DrawCallstackWindow()
{
TextDisabledUnformatted( "inline" );
}
ImGui::NextColumn();
ImGui::TableNextColumn();
{
ImGui::PushTextWrapPos( 0.0f );
if( txt[0] == '[' )
@ -13344,7 +13326,7 @@ void View::DrawCallstackWindow()
{
ImGui::SetClipboardText( txt );
}
ImGui::NextColumn();
ImGui::TableNextColumn();
ImGui::PushTextWrapPos( 0.0f );
float indentVal = 0.f;
if( m_callstackBuzzAnim.Match( bidx ) )
@ -13463,18 +13445,16 @@ void View::DrawCallstackWindow()
ImGui::Unindent( indentVal );
}
ImGui::PopTextWrapPos();
ImGui::NextColumn();
ImGui::TableNextColumn();
if( frameData->imageName.Active() )
{
TextDisabledUnformatted( m_worker.GetString( frameData->imageName ) );
}
ImGui::NextColumn();
}
}
}
ImGui::EndColumns();
ImGui::EndChild();
ImGui::EndTable();
}
ImGui::End();
if( !show )