1
0
mirror of https://github.com/wolfpld/tracy synced 2025-04-29 04:23:51 +00:00

Expose zone name normalization as a separate setting.

This commit is contained in:
Bartosz Taudul 2022-08-15 16:24:44 +02:00
parent 89016454f8
commit 07a1383304
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3
4 changed files with 11 additions and 7 deletions

View File

@ -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<int> m_callstackBuzzAnim;
BuzzAnim<int> m_sampleParentBuzzAnim;

View File

@ -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;

View File

@ -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(;;)
{

View File

@ -217,7 +217,7 @@ int View::DrawGhostLevel( const Vector<GhostZone>& 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 );
}