From 58428e7edeccf565393c45816014289ad1caa2c1 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Wed, 29 Jul 2020 18:48:49 +0200 Subject: [PATCH] Dynamically adapt find zone results to range limit. --- server/TracyView.cpp | 8 ++++++-- server/TracyView.hpp | 10 ++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index a82eb923..2dc6fa8a 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -8979,7 +8979,6 @@ void View::DrawFindZone() ImGui::SameLine(); if( ImGui::Checkbox( "Limit range", &m_findZone.range.active ) ) { - m_findZone.ResetMatch(); if( m_findZone.range.active ) { m_findZone.range.min = m_vd.zvStart; @@ -9000,12 +8999,17 @@ void View::DrawFindZone() ImGui::SameLine(); if( ImGui::SmallButton( "Limit to view" ) ) { - m_findZone.ResetMatch(); m_findZone.range.min = m_vd.zvStart; m_findZone.range.max = m_vd.zvEnd; } } + if( m_findZone.rangeSlim != m_findZone.range ) + { + m_findZone.ResetMatch(); + m_findZone.rangeSlim = m_findZone.range; + } + if( findClicked ) { m_findZone.Reset(); diff --git a/server/TracyView.hpp b/server/TracyView.hpp index a1e77f22..d4a2a87d 100644 --- a/server/TracyView.hpp +++ b/server/TracyView.hpp @@ -68,6 +68,15 @@ class View bool modMax = false; }; + struct RangeSlim + { + bool operator==( const Range& other ) const { return other.active == active && other.min == min && other.max == max; } + void operator=( const Range& other ) { active = other.active; min = other.min; max = other.max; } + + int64_t min, max; + bool active = false; + }; + public: struct VisData { @@ -501,6 +510,7 @@ private: int64_t tmin, tmax; bool showZoneInFrames = false; Range range; + RangeSlim rangeSlim; struct {