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,19 +7717,24 @@ void View::DrawMessages()
ImGui::TreePop();
}
bool hasCallstack = m_worker.GetCallstackFrameCount() != 0;
ImGui::Separator();
ImGui::BeginChild( "##messages" );
const auto w = ImGui::GetWindowWidth();
static bool widthSet = false;
ImGui::Columns( 4 );
if( !widthSet )
static int widthSet = 0;
const int colNum = hasCallstack ? 4 : 3;
ImGui::Columns( colNum );
if( widthSet != colNum )
{
widthSet = true;
widthSet = colNum;
ImGui::SetColumnWidth( 0, w * 0.07f );
ImGui::SetColumnWidth( 1, w * 0.13f );
ImGui::SetColumnWidth( 2, w * 0.6f );
ImGui::SetColumnWidth( 2, w * ( hasCallstack ? 0.6f : 0.8f ) );
if( hasCallstack )
{
ImGui::SetColumnWidth( 3, w * 0.2f );
}
}
ImGui::TextUnformatted( "Time" );
ImGui::SameLine();
DrawHelpMarker( "Click on message to center timeline on it." );
@ -7738,8 +7743,11 @@ void View::DrawMessages()
ImGui::NextColumn();
ImGui::TextUnformatted( "Message" );
ImGui::NextColumn();
if( hasCallstack )
{
ImGui::TextUnformatted( "Call stack" );
ImGui::NextColumn();
}
ImGui::Separator();
int msgcnt = 0;
@ -7778,6 +7786,8 @@ void View::DrawMessages()
ImGui::TextWrapped( "%s", text );
ImGui::PopStyleColor();
ImGui::NextColumn();
if( hasCallstack )
{
const auto cs = v->callstack.Val();
if( cs != 0 )
{
@ -7790,6 +7800,7 @@ void View::DrawMessages()
DrawCallstackCalls( cs, 4 );
}
ImGui::NextColumn();
}
msgcnt++;
}
}