mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-23 06:44:35 +00:00
Allow selecting image name for filtering from a list.
This commit is contained in:
parent
b6db644ac6
commit
edae542a48
@ -12580,6 +12580,38 @@ void View::DrawStatistics()
|
|||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
m_statisticsImageFilter.Draw( ICON_FA_FILTER "###imageFilter", 200 );
|
m_statisticsImageFilter.Draw( ICON_FA_FILTER "###imageFilter", 200 );
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
|
if( ImGui::BeginCombo( "###imageCombo", nullptr, ImGuiComboFlags_NoPreview | ImGuiComboFlags_HeightLarge ) )
|
||||||
|
{
|
||||||
|
unordered_flat_set<StringIdx, StringIdxHasher, StringIdxComparator> set;
|
||||||
|
std::vector<const char*> imgNames;
|
||||||
|
for( auto& v : m_worker.GetSymbolMap() )
|
||||||
|
{
|
||||||
|
auto it = set.find( v.second.imageName );
|
||||||
|
if( it == set.end() )
|
||||||
|
{
|
||||||
|
set.emplace( v.second.imageName );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
imgNames.reserve( set.size() );
|
||||||
|
for( auto& img : set )
|
||||||
|
{
|
||||||
|
imgNames.emplace_back( m_worker.GetString( img ) );
|
||||||
|
}
|
||||||
|
std::sort( imgNames.begin(), imgNames.end(), [] ( const auto& lhs, const auto& rhs ) { return strcmp( lhs, rhs ) < 0; } );
|
||||||
|
for( auto& img : imgNames )
|
||||||
|
{
|
||||||
|
bool sel = false;
|
||||||
|
if( ImGui::Selectable( img, &sel ) )
|
||||||
|
{
|
||||||
|
auto len = std::min<size_t>( 255, strlen( img ) );
|
||||||
|
memcpy( m_statisticsImageFilter.InputBuf, img, len );
|
||||||
|
m_statisticsImageFilter.InputBuf[len] = 0;
|
||||||
|
m_statisticsImageFilter.Build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ImGui::EndCombo();
|
||||||
|
}
|
||||||
|
ImGui::SameLine();
|
||||||
if( ImGui::Button( ICON_FA_BACKSPACE " Clear###image" ) )
|
if( ImGui::Button( ICON_FA_BACKSPACE " Clear###image" ) )
|
||||||
{
|
{
|
||||||
m_statisticsImageFilter.Clear();
|
m_statisticsImageFilter.Clear();
|
||||||
|
Loading…
Reference in New Issue
Block a user