Don't display callstack message column if there are no callstacks.

This commit is contained in:
Bartosz Taudul 2019-11-15 20:34:19 +01:00
parent 31e1558467
commit 18fd928a9d

View File

@ -7717,18 +7717,23 @@ void View::DrawMessages()
ImGui::TreePop(); ImGui::TreePop();
} }
bool hasCallstack = m_worker.GetCallstackFrameCount() != 0;
ImGui::Separator(); ImGui::Separator();
ImGui::BeginChild( "##messages" ); ImGui::BeginChild( "##messages" );
const auto w = ImGui::GetWindowWidth(); const auto w = ImGui::GetWindowWidth();
static bool widthSet = false; static int widthSet = 0;
ImGui::Columns( 4 ); const int colNum = hasCallstack ? 4 : 3;
if( !widthSet ) ImGui::Columns( colNum );
if( widthSet != colNum )
{ {
widthSet = true; widthSet = colNum;
ImGui::SetColumnWidth( 0, w * 0.07f ); ImGui::SetColumnWidth( 0, w * 0.07f );
ImGui::SetColumnWidth( 1, w * 0.13f ); ImGui::SetColumnWidth( 1, w * 0.13f );
ImGui::SetColumnWidth( 2, w * 0.6f ); ImGui::SetColumnWidth( 2, w * ( hasCallstack ? 0.6f : 0.8f ) );
ImGui::SetColumnWidth( 3, w * 0.2f ); if( hasCallstack )
{
ImGui::SetColumnWidth( 3, w * 0.2f );
}
} }
ImGui::TextUnformatted( "Time" ); ImGui::TextUnformatted( "Time" );
ImGui::SameLine(); ImGui::SameLine();
@ -7738,8 +7743,11 @@ void View::DrawMessages()
ImGui::NextColumn(); ImGui::NextColumn();
ImGui::TextUnformatted( "Message" ); ImGui::TextUnformatted( "Message" );
ImGui::NextColumn(); ImGui::NextColumn();
ImGui::TextUnformatted( "Call stack" ); if( hasCallstack )
ImGui::NextColumn(); {
ImGui::TextUnformatted( "Call stack" );
ImGui::NextColumn();
}
ImGui::Separator(); ImGui::Separator();
int msgcnt = 0; int msgcnt = 0;
@ -7778,18 +7786,21 @@ void View::DrawMessages()
ImGui::TextWrapped( "%s", text ); ImGui::TextWrapped( "%s", text );
ImGui::PopStyleColor(); ImGui::PopStyleColor();
ImGui::NextColumn(); ImGui::NextColumn();
const auto cs = v->callstack.Val(); if( hasCallstack )
if( cs != 0 )
{ {
const auto cs = v->callstack.Val();
if( cs != 0 )
{
#ifdef TRACY_EXTENDED_FONT #ifdef TRACY_EXTENDED_FONT
SmallCallstackButton( ICON_FA_ALIGN_JUSTIFY, cs, idx ); SmallCallstackButton( ICON_FA_ALIGN_JUSTIFY, cs, idx );
#else #else
SmallCallstackButton( "Show", cs, idx ); SmallCallstackButton( "Show", cs, idx );
#endif #endif
ImGui::SameLine(); ImGui::SameLine();
DrawCallstackCalls( cs, 4 ); DrawCallstackCalls( cs, 4 );
}
ImGui::NextColumn();
} }
ImGui::NextColumn();
msgcnt++; msgcnt++;
} }
} }