Fill emptiness in find zone window awaiting for query.

This commit is contained in:
Bartosz Taudul 2024-10-15 01:29:08 +02:00
parent 697ea8b3b3
commit 8a7f540d7c
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3
2 changed files with 23 additions and 5 deletions

View File

@ -641,6 +641,7 @@ private:
int64_t time = 0;
};
bool hasResults = false;
bool show = false;
bool ignoreCase = false;
std::vector<int16_t> match;
@ -698,6 +699,7 @@ private:
selGroup = Unselected;
highlight.active = false;
samples.counts.clear();
hasResults = false;
}
void ResetMatch()

View File

@ -19,6 +19,7 @@ extern double s_time;
#ifndef TRACY_NO_STATISTICS
void View::FindZones()
{
m_findZone.hasResults = true;
m_findZone.match = m_worker.GetMatchingSourceLocation( m_findZone.pattern, m_findZone.ignoreCase );
if( m_findZone.match.empty() ) return;
@ -341,15 +342,31 @@ void View::DrawFindZone()
FindZones();
}
if( !m_findZone.match.empty() )
ImGui::Separator();
ImGui::BeginChild( "##findzone" );
if( m_findZone.match.empty() )
{
ImGui::PushFont( m_bigFont );
ImGui::Dummy( ImVec2( 0, ( ImGui::GetContentRegionAvail().y - ImGui::GetTextLineHeight() * 2 ) * 0.5f ) );
TextCentered( ICON_FA_CROW );
if( m_findZone.hasResults )
{
TextCentered( "No matching zones found" );
}
else
{
TextCentered( "Please enter search pattern" );
}
ImGui::PopFont();
}
else
{
Achieve( "findZone" );
const auto rangeMin = m_findZone.range.min;
const auto rangeMax = m_findZone.range.max;
ImGui::Separator();
ImGui::BeginChild( "##findzone" );
bool expand = ImGui::TreeNodeEx( "Matched source locations", ImGuiTreeNodeFlags_DefaultOpen );
ImGui::SameLine();
ImGui::TextDisabled( "(%zu)", m_findZone.match.size() );
@ -1993,14 +2010,13 @@ void View::DrawFindZone()
}
}
ImGui::EndChild();
if( changeZone != 0 )
{
auto& srcloc = m_worker.GetSourceLocation( changeZone );
m_findZone.ShowZone( changeZone, m_worker.GetString( srcloc.name.active ? srcloc.name : srcloc.function ) );
}
}
ImGui::EndChild();
#endif
ImGui::End();