allow filtering zones in Zone finder based on the user text

This commit is contained in:
Kristoffer 2023-04-28 14:49:00 +02:00
parent b83cb3f2ce
commit ef68f3139f
2 changed files with 37 additions and 0 deletions

View File

@ -457,6 +457,7 @@ private:
ImGuiTextFilter m_statisticsFilter;
ImGuiTextFilter m_statisticsImageFilter;
ImGuiTextFilter m_userTextFilter;
Region m_highlight;
Region m_highlightZoom;

View File

@ -1362,6 +1362,23 @@ void View::DrawFindZone()
SmallCheckbox( "Show zone time in frames", &m_findZone.showZoneInFrames );
ImGui::Separator();
ImGui::AlignTextToFramePadding();
TextDisabledUnformatted( "Filter user text:" );
ImGui::SameLine();
bool filterChanged = m_userTextFilter.Draw( ICON_FA_FILTER "###resultFilter", 200 );
ImGui::SameLine();
if( ImGui::Button( ICON_FA_DELETE_LEFT " Clear" ) )
{
m_userTextFilter.Clear();
filterChanged = true;
}
ImGui::Separator();
if( filterChanged )
{
m_findZone.ResetGroups();
}
ImGui::TextUnformatted( "Found zones:" );
ImGui::SameLine();
DrawHelpMarker( "Left click to highlight entry." );
@ -1429,6 +1446,25 @@ void View::DrawFindZone()
zptr++;
continue;
}
if( m_userTextFilter.IsActive() )
{
bool keep = false;
if ( m_worker.HasZoneExtra( *ev.Zone() ) && m_worker.GetZoneExtra( *ev.Zone() ).text.Active() )
{
auto text = m_worker.GetString( m_worker.GetZoneExtra( *ev.Zone() ).text );
if( m_userTextFilter.PassFilter( text ) )
{
keep = true;
}
}
if( !keep )
{
zptr++;
continue;
}
}
auto timespan = end - start;
assert( timespan != 0 );
if( m_findZone.selfTime )