Use tables for wait regions.

This commit is contained in:
Bartosz Taudul 2020-12-05 14:41:59 +01:00
parent a7cdffa736
commit 99c4b9ef5f

View File

@ -7192,20 +7192,15 @@ void View::DrawZoneInfoWindow()
SmallCheckbox( "Time relative to zone start", &m_ctxSwitchTimeRelativeToZone ); SmallCheckbox( "Time relative to zone start", &m_ctxSwitchTimeRelativeToZone );
const int64_t adjust = m_ctxSwitchTimeRelativeToZone ? ev.Start() : 0; const int64_t adjust = m_ctxSwitchTimeRelativeToZone ? ev.Start() : 0;
ImGui::Columns( 6 ); ImGui::BeginTable( "##waitregions", 6, ImGuiTableFlags_Resizable | ImGuiTableFlags_ScrollY | ImGuiTableFlags_Reorderable | ImGuiTableFlags_RowBg );
ImGui::Text( "Begin" ); ImGui::TableSetupScrollFreeze( 0, 1 );
ImGui::NextColumn(); ImGui::TableSetupColumn( "Begin" );
ImGui::Text( "End" ); ImGui::TableSetupColumn( "End" );
ImGui::NextColumn(); ImGui::TableSetupColumn( "Time" );
ImGui::Text( "Time" ); ImGui::TableSetupColumn( "Wakeup" );
ImGui::NextColumn(); ImGui::TableSetupColumn( "CPU" );
ImGui::Text( "Wakeup" ); ImGui::TableSetupColumn( "State" );
ImGui::NextColumn(); ImGui::TableHeadersRow();
ImGui::Text( "CPU" );
ImGui::NextColumn();
ImGui::Text( "State" );
ImGui::NextColumn();
ImGui::Separator();
const auto wrsz = eit - bit; const auto wrsz = eit - bit;
ImGuiListClipper clipper; ImGuiListClipper clipper;
clipper.Begin( wrsz ); clipper.Begin( wrsz );
@ -7221,23 +7216,27 @@ void View::DrawZoneInfoWindow()
const auto cwakeup = bit[i+1].WakeupVal(); const auto cwakeup = bit[i+1].WakeupVal();
const auto cpu1 = bit[i+1].Cpu(); const auto cpu1 = bit[i+1].Cpu();
ImGui::PushID( i );
ImGui::TableNextRow();
ImGui::TableNextColumn();
auto tt = adjust == 0 ? TimeToStringExact( cend ) : TimeToString( cend - adjust ); auto tt = adjust == 0 ? TimeToStringExact( cend ) : TimeToString( cend - adjust );
if( ImGui::Selectable( tt ) ) if( ImGui::Selectable( tt ) )
{ {
CenterAtTime( cend ); CenterAtTime( cend );
} }
ImGui::NextColumn(); ImGui::TableNextColumn();
tt = adjust == 0 ? TimeToStringExact( cstart ) : TimeToString( cstart - adjust ); tt = adjust == 0 ? TimeToStringExact( cstart ) : TimeToString( cstart - adjust );
if( ImGui::Selectable( tt ) ) if( ImGui::Selectable( tt ) )
{ {
CenterAtTime( cstart ); CenterAtTime( cstart );
} }
ImGui::NextColumn(); ImGui::TableNextColumn();
if( ImGui::Selectable( TimeToString( cwakeup - cend ) ) ) if( ImGui::Selectable( TimeToString( cwakeup - cend ) ) )
{ {
ZoomToRange( cend, cwakeup ); ZoomToRange( cend, cwakeup );
} }
ImGui::NextColumn(); ImGui::TableNextColumn();
if( cstart != cwakeup ) if( cstart != cwakeup )
{ {
if( ImGui::Selectable( TimeToString( cstart - cwakeup ) ) ) if( ImGui::Selectable( TimeToString( cstart - cwakeup ) ) )
@ -7249,7 +7248,7 @@ void View::DrawZoneInfoWindow()
{ {
ImGui::TextUnformatted( "-" ); ImGui::TextUnformatted( "-" );
} }
ImGui::NextColumn(); ImGui::TableNextColumn();
if( cpu0 == cpu1 ) if( cpu0 == cpu1 )
{ {
ImGui::TextUnformatted( RealToString( cpu0 ) ); ImGui::TextUnformatted( RealToString( cpu0 ) );
@ -7273,7 +7272,7 @@ void View::DrawZoneInfoWindow()
} }
} }
} }
ImGui::NextColumn(); ImGui::TableNextColumn();
const char* desc; const char* desc;
if( reason == ContextSwitchData::NoState ) if( reason == ContextSwitchData::NoState )
{ {
@ -7291,11 +7290,10 @@ void View::DrawZoneInfoWindow()
ImGui::TextUnformatted( desc ); ImGui::TextUnformatted( desc );
ImGui::EndTooltip(); ImGui::EndTooltip();
} }
ImGui::NextColumn(); ImGui::PopID();
} }
} }
ImGui::EndColumns(); ImGui::EndTable();
ImGui::TreePop(); ImGui::TreePop();
} }
} }