1
0
mirror of https://github.com/wolfpld/tracy synced 2025-04-29 12:23:53 +00:00

Use tables for message list in zone info window.

This commit is contained in:
Bartosz Taudul 2020-12-06 23:00:26 +01:00
parent 99c4b9ef5f
commit d962301124

View File

@ -7463,23 +7463,16 @@ void View::DrawZoneInfoWindow()
{ {
ImGui::SameLine(); ImGui::SameLine();
SmallCheckbox( "Time relative to zone start", &m_messageTimeRelativeToZone ); SmallCheckbox( "Time relative to zone start", &m_messageTimeRelativeToZone );
static bool widthSet = false; ImGui::BeginTable( "##waitregions", 2, ImGuiTableFlags_ScrollY | ImGuiTableFlags_RowBg | ImGuiTableFlags_BordersInnerV );
ImGui::Columns( 2 ); ImGui::TableSetupScrollFreeze( 0, 1 );
if( !widthSet ) ImGui::TableSetupColumn( "Time", ImGuiTableColumnFlags_WidthAutoResize );
{ ImGui::TableSetupColumn( "Message" );
widthSet = true; ImGui::TableHeadersRow();
const auto w = ImGui::GetWindowWidth();
ImGui::SetColumnWidth( 0, w * 0.2f );
ImGui::SetColumnWidth( 1, w * 0.8f );
}
TextDisabledUnformatted( "Time" );
ImGui::NextColumn();
TextDisabledUnformatted( "Message" );
ImGui::NextColumn();
ImGui::Separator();
do do
{ {
ImGui::PushID( *msgit ); ImGui::PushID( *msgit );
ImGui::TableNextRow();
ImGui::TableNextColumn();
if( ImGui::Selectable( m_messageTimeRelativeToZone ? TimeToString( (*msgit)->time - ev.Start() ) : TimeToStringExact( (*msgit)->time ), m_msgHighlight == *msgit, ImGuiSelectableFlags_SpanAllColumns ) ) if( ImGui::Selectable( m_messageTimeRelativeToZone ? TimeToString( (*msgit)->time - ev.Start() ) : TimeToStringExact( (*msgit)->time ), m_msgHighlight == *msgit, ImGuiSelectableFlags_SpanAllColumns ) )
{ {
CenterAtTime( (*msgit)->time ); CenterAtTime( (*msgit)->time );
@ -7489,14 +7482,13 @@ void View::DrawZoneInfoWindow()
m_msgHighlight = *msgit; m_msgHighlight = *msgit;
} }
ImGui::PopID(); ImGui::PopID();
ImGui::NextColumn(); ImGui::TableNextColumn();
ImGui::PushStyleColor( ImGuiCol_Text, (*msgit)->color ); ImGui::PushStyleColor( ImGuiCol_Text, (*msgit)->color );
ImGui::TextWrapped( "%s", m_worker.GetString( (*msgit)->ref ) ); ImGui::TextWrapped( "%s", m_worker.GetString( (*msgit)->ref ) );
ImGui::PopStyleColor(); ImGui::PopStyleColor();
ImGui::NextColumn();
} }
while( ++msgit != msgend ); while( ++msgit != msgend );
ImGui::EndColumns(); ImGui::EndTable();
ImGui::TreePop(); ImGui::TreePop();
ImGui::Spacing(); ImGui::Spacing();
} }