Use columns to display message list.

This commit is contained in:
Bartosz Taudul 2018-05-25 20:53:26 +02:00
parent f7e2683cf1
commit 8118e41559

View File

@ -3171,25 +3171,28 @@ void View::DrawOptions()
void View::DrawMessages() void View::DrawMessages()
{ {
ImGui::Begin( "Messages", &m_showMessages ); ImGui::Begin( "Messages", &m_showMessages );
ImGui::Columns( 2 );
ImGui::Text( "Time" );
ImGui::NextColumn();
ImGui::Text( "Message" );
ImGui::NextColumn();
ImGui::Separator();
for( const auto& v : m_worker.GetMessages() ) for( const auto& v : m_worker.GetMessages() )
{ {
char tmp[64 * 1024]; ImGui::PushID( v );
sprintf( tmp, "%10s | %s", TimeToString( v->time - m_worker.GetFrameBegin( 0 ) ), m_worker.GetString( v->ref ) ); if( ImGui::Selectable( TimeToString( v->time - m_worker.GetFrameBegin( 0 ) ), m_msgHighlight == v, ImGuiSelectableFlags_SpanAllColumns ) )
if( m_msgHighlight == v )
{
ImGui::TextColored( ImVec4( 0xDD / 255.f, 0x22 / 255.f, 0x22 / 255.f, 1.f ), "%s", tmp );
}
else
{
ImGui::Text( "%s", tmp );
}
if( ImGui::IsItemClicked() )
{ {
m_pause = true; m_pause = true;
const auto hr = std::max<uint64_t>( 1, ( m_zvEnd - m_zvStart ) / 2 ); const auto hr = std::max<uint64_t>( 1, ( m_zvEnd - m_zvStart ) / 2 );
ZoomToRange( v->time - hr, v->time + hr ); ZoomToRange( v->time - hr, v->time + hr );
} }
ImGui::PopID();
ImGui::NextColumn();
ImGui::TextWrapped( "%s", m_worker.GetString( v->ref ) );
ImGui::NextColumn();
} }
ImGui::EndColumns();
ImGui::End(); ImGui::End();
} }