From 18cfcd7e90dd82a11a28174428f7f4db44929d37 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sat, 4 Jul 2026 18:15:15 +0200 Subject: [PATCH] Add copy from section to compare range limits. --- profiler/src/profiler/TracyView_Compare.cpp | 46 +++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/profiler/src/profiler/TracyView_Compare.cpp b/profiler/src/profiler/TracyView_Compare.cpp index eac57bbe..88f3ff12 100644 --- a/profiler/src/profiler/TracyView_Compare.cpp +++ b/profiler/src/profiler/TracyView_Compare.cpp @@ -383,6 +383,29 @@ void View::DrawCompare() } ImGui::EndMenu(); } + auto& sections = m_worker.GetSections(); + if( sections.empty() ) + { + TextDisabledUnformatted( "Sections" ); + } + else if( ImGui::BeginMenu( "Sections" ) ) + { + int id = 0; + for( auto& v : sections ) + { + ImGui::PushID( id++ ); + if( ImGui::MenuItem( m_worker.GetString( v.text ) ) ) + { + m_compare.range[0].min = v.start.Val(); + m_compare.range[0].max = v.end.Val(); + m_compare.ResetSelection(); + } + ImGui::PopID(); + ImGui::SameLine(); + ImGui::TextDisabled( "%s - %s (%s)", TimeToStringExact( v.start.Val() ), TimeToStringExact( v.end.Val() ), TimeToString( v.end.Val() - v.start.Val() ) ); + } + ImGui::EndMenu(); + } ImGui::EndPopup(); } if( ImGui::BeginPopup( "compareCopyFromExt" ) ) @@ -412,6 +435,29 @@ void View::DrawCompare() } ImGui::EndMenu(); } + auto& sections = m_compare.second->GetSections(); + if( sections.empty() ) + { + TextDisabledUnformatted( "Sections" ); + } + else if( ImGui::BeginMenu( "Sections" ) ) + { + int id = 0; + for( auto& v : sections ) + { + ImGui::PushID( id++ ); + if( ImGui::MenuItem( m_compare.second->GetString( v.text ) ) ) + { + m_compare.range[1].min = v.start.Val(); + m_compare.range[1].max = v.end.Val(); + m_compare.ResetSelection(); + } + ImGui::PopID(); + ImGui::SameLine(); + ImGui::TextDisabled( "%s - %s (%s)", TimeToStringExact( v.start.Val() ), TimeToStringExact( v.end.Val() ), TimeToString( v.end.Val() - v.start.Val() ) ); + } + ImGui::EndMenu(); + } ImGui::EndPopup(); } ImGui::Unindent();