1
0
mirror of https://github.com/wolfpld/tracy synced 2025-04-30 04:43:53 +00:00

Add color boxes to file selection.

This commit is contained in:
Bartosz Taudul 2020-04-08 23:01:44 +02:00
parent d300d17f9e
commit 3e2260bdcb

View File

@ -568,12 +568,18 @@ void SourceView::RenderSymbolSourceView( uint32_t iptotal, unordered_flat_map<ui
ImGui::SameLine(); ImGui::SameLine();
TextDisabledUnformatted( "File:" ); TextDisabledUnformatted( "File:" );
ImGui::SameLine(); ImGui::SameLine();
const auto fileColor = GetHsvColor( m_fileStringIdx, 0 );
SmallColorBox( fileColor );
ImGui::SameLine();
ImGui::SetNextItemWidth( -1 ); ImGui::SetNextItemWidth( -1 );
ImGui::PushStyleVar( ImGuiStyleVar_FramePadding, ImVec2( 0, 0 ) ); ImGui::PushStyleVar( ImGuiStyleVar_FramePadding, ImVec2( 0, 0 ) );
if( ImGui::BeginCombo( "##fileList", m_file, ImGuiComboFlags_HeightLargest ) ) if( ImGui::BeginCombo( "##fileList", m_file, ImGuiComboFlags_HeightLargest ) )
{ {
for( auto& v : m_sourceFiles ) for( auto& v : m_sourceFiles )
{ {
const auto color = GetHsvColor( v.first, 0 );
SmallColorBox( color );
ImGui::SameLine();
auto fstr = worker.GetString( StringIdx( v.first ) ); auto fstr = worker.GetString( StringIdx( v.first ) );
ImGui::PushID( v.first ); ImGui::PushID( v.first );
if( ImGui::Selectable( fstr, fstr == m_file ) ) if( ImGui::Selectable( fstr, fstr == m_file ) )