From 07a1383304f7b073c5782a3930946147d4d6b6d6 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Mon, 15 Aug 2022 16:24:44 +0200 Subject: [PATCH] Expose zone name normalization as a separate setting. --- server/TracyView.hpp | 6 ++++-- server/TracyView_Options.cpp | 6 ++++-- server/TracyView_Utility.cpp | 2 +- server/TracyView_ZoneTimeline.cpp | 4 ++-- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/server/TracyView.hpp b/server/TracyView.hpp index 68a5cdbf..a3b2f98b 100644 --- a/server/TracyView.hpp +++ b/server/TracyView.hpp @@ -128,7 +128,9 @@ private: { Never, Always, - WhenNoSpace + OnlyNormalize, + NoSpace, + NoSpaceAndNormalize, }; enum class ShortcutAction : uint8_t @@ -483,7 +485,7 @@ private: bool m_groupWaitStackTopDown = true; ShortcutAction m_shortcut = ShortcutAction::None; - ShortenName m_shortenName = ShortenName::WhenNoSpace; + ShortenName m_shortenName = ShortenName::NoSpaceAndNormalize; Animation m_zoomAnim; BuzzAnim m_callstackBuzzAnim; BuzzAnim m_sampleParentBuzzAnim; diff --git a/server/TracyView_Options.cpp b/server/TracyView_Options.cpp index c264c6e7..8a39e1ea 100644 --- a/server/TracyView_Options.cpp +++ b/server/TracyView_Options.cpp @@ -226,8 +226,10 @@ void View::DrawOptions() ImGui::Indent(); ImGui::PushStyleVar( ImGuiStyleVar_FramePadding, ImVec2( 0, 0 ) ); ImGui::RadioButton( "Never", &ival, 0 ); - ImGui::RadioButton( "Always", &ival, 1 ); - ImGui::RadioButton( "When no space", &ival, 2 ); + ImGui::RadioButton( "Always full", &ival, 1 ); + ImGui::RadioButton( "Only normalize", &ival, 2 ); + ImGui::RadioButton( "No space", &ival, 3 ); + ImGui::RadioButton( "No space + normalize", &ival, 4 ); ImGui::PopStyleVar(); ImGui::Unindent(); m_shortenName = (ShortenName)ival; diff --git a/server/TracyView_Utility.cpp b/server/TracyView_Utility.cpp index c4bc187c..63415bb5 100644 --- a/server/TracyView_Utility.cpp +++ b/server/TracyView_Utility.cpp @@ -923,7 +923,7 @@ const char* View::ShortenZoneName( const char* name, ImVec2& tsz, float zsz ) co } tsz = ImGui::CalcTextSize( ptr, end ); - if( tsz.x < zsz ) return ptr; + if( m_shortenName == ShortenName::OnlyNormalize || tsz.x < zsz ) return ptr; for(;;) { diff --git a/server/TracyView_ZoneTimeline.cpp b/server/TracyView_ZoneTimeline.cpp index 73f1b310..73450e89 100644 --- a/server/TracyView_ZoneTimeline.cpp +++ b/server/TracyView_ZoneTimeline.cpp @@ -217,7 +217,7 @@ int View::DrawGhostLevel( const Vector& vec, bool hover, double pxns, DrawLine( draw, dpos + ImVec2( px0, offset + tsz.y ), dpos + ImVec2( px1-1, offset + tsz.y ), dpos + ImVec2( px1-1, offset ), darkColor, 1.f ); auto origSymName = symName; - if( m_shortenName == ShortenName::Always || ( m_shortenName == ShortenName::WhenNoSpace && tsz.x > zsz ) ) + if( m_shortenName != ShortenName::Never && ( m_shortenName != ShortenName::NoSpace || tsz.x > zsz ) ) { symName = ShortenZoneName( symName, tsz, zsz ); } @@ -510,7 +510,7 @@ int View::DrawZoneLevel( const V& vec, bool hover, double pxns, int64_t nspx, co } auto tsz = ImGui::CalcTextSize( zoneName ); - if( m_shortenName == ShortenName::Always || ( m_shortenName == ShortenName::WhenNoSpace && tsz.x > zsz ) ) + if( m_shortenName != ShortenName::Never && ( m_shortenName != ShortenName::NoSpace || tsz.x > zsz ) ) { zoneName = ShortenZoneName( zoneName, tsz, zsz ); }