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(); 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 ) );
if( hasCallstack )
{
ImGui::SetColumnWidth( 3, w * 0.2f ); ImGui::SetColumnWidth( 3, w * 0.2f );
} }
}
ImGui::TextUnformatted( "Time" ); ImGui::TextUnformatted( "Time" );
ImGui::SameLine(); ImGui::SameLine();
DrawHelpMarker( "Click on message to center timeline on it." ); DrawHelpMarker( "Click on message to center timeline on it." );
@ -7738,8 +7743,11 @@ void View::DrawMessages()
ImGui::NextColumn(); ImGui::NextColumn();
ImGui::TextUnformatted( "Message" ); ImGui::TextUnformatted( "Message" );
ImGui::NextColumn(); ImGui::NextColumn();
if( hasCallstack )
{
ImGui::TextUnformatted( "Call stack" ); ImGui::TextUnformatted( "Call stack" );
ImGui::NextColumn(); ImGui::NextColumn();
}
ImGui::Separator(); ImGui::Separator();
int msgcnt = 0; int msgcnt = 0;
@ -7778,6 +7786,8 @@ void View::DrawMessages()
ImGui::TextWrapped( "%s", text ); ImGui::TextWrapped( "%s", text );
ImGui::PopStyleColor(); ImGui::PopStyleColor();
ImGui::NextColumn(); ImGui::NextColumn();
if( hasCallstack )
{
const auto cs = v->callstack.Val(); const auto cs = v->callstack.Val();
if( cs != 0 ) if( cs != 0 )
{ {
@ -7790,6 +7800,7 @@ void View::DrawMessages()
DrawCallstackCalls( cs, 4 ); DrawCallstackCalls( cs, 4 );
} }
ImGui::NextColumn(); ImGui::NextColumn();
}
msgcnt++; msgcnt++;
} }
} }