1
0
mirror of https://github.com/wolfpld/tracy synced 2025-05-07 15:33:52 +00:00

Allow changing display order of threads.

This commit is contained in:
Bartosz Taudul 2019-03-24 13:54:36 +01:00
parent f7eca24e18
commit 1c495f077b

View File

@ -5624,10 +5624,36 @@ void View::DrawOptions()
} }
} }
const auto th = 18.f * ImGui::GetTextLineHeight() / 15.f;
int idIdx = 0;
int idx = 0; int idx = 0;
int upIdx = -1;
int downIdx = -1;
for( const auto& t : m_threadOrder ) for( const auto& t : m_threadOrder )
{ {
ImGui::PushID( idx++ ); ImGui::PushID( idIdx++ );
#ifdef TRACY_EXTENDED_FONT
if( ImGui::Button( ICON_FA_CARET_UP, ImVec2( th, 0 ) ) )
#else
if( ImGui::Button( "^", ImVec2( th, 0 ) ) )
#endif
{
upIdx = idx;
}
ImGui::PopID();
ImGui::SameLine();
ImGui::PushID( idIdx++ );
#ifdef TRACY_EXTENDED_FONT
if( ImGui::Button( ICON_FA_CARET_DOWN, ImVec2( th, 0 ) ) )
#else
if( ImGui::Button( "v", ImVec2( th, 0 ) ) )
#endif
{
downIdx = idx;
}
ImGui::PopID();
ImGui::SameLine();
ImGui::PushID( idIdx++ );
ImGui::Checkbox( m_worker.GetThreadString( t->id ), &Vis( t ).visible ); ImGui::Checkbox( m_worker.GetThreadString( t->id ), &Vis( t ).visible );
ImGui::PopID(); ImGui::PopID();
if( crash.thread == t->id ) if( crash.thread == t->id )
@ -5647,6 +5673,15 @@ void View::DrawOptions()
} }
ImGui::SameLine(); ImGui::SameLine();
ImGui::TextDisabled( "%s top level zones", RealToString( t->timeline.size(), true ) ); ImGui::TextDisabled( "%s top level zones", RealToString( t->timeline.size(), true ) );
idx++;
}
if( upIdx > 0 )
{
std::swap( m_threadOrder[upIdx], m_threadOrder[upIdx-1] );
}
if( downIdx >= 0 && downIdx < m_threadOrder.size() - 1 )
{
std::swap( m_threadOrder[downIdx], m_threadOrder[downIdx+1] );
} }
ImGui::TreePop(); ImGui::TreePop();
} }