diff --git a/profiler/src/profiler/TracyView.hpp b/profiler/src/profiler/TracyView.hpp index cf33765d..b976e894 100644 --- a/profiler/src/profiler/TracyView.hpp +++ b/profiler/src/profiler/TracyView.hpp @@ -641,6 +641,7 @@ private: int64_t time = 0; }; + bool hasResults = false; bool show = false; bool ignoreCase = false; std::vector match; @@ -698,6 +699,7 @@ private: selGroup = Unselected; highlight.active = false; samples.counts.clear(); + hasResults = false; } void ResetMatch() diff --git a/profiler/src/profiler/TracyView_FindZone.cpp b/profiler/src/profiler/TracyView_FindZone.cpp index 560e9ae4..b77d513a 100644 --- a/profiler/src/profiler/TracyView_FindZone.cpp +++ b/profiler/src/profiler/TracyView_FindZone.cpp @@ -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();