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

Add short images option to callstack / wait stacks window.

This commit is contained in:
Bartosz Taudul 2025-02-07 17:34:19 +01:00
parent ad5615cda2
commit 9b7d53a979
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3

View File

@ -103,6 +103,10 @@ void View::DrawCallstackTable( uint32_t callstack, bool globalEntriesButton )
ImGui::SameLine(); ImGui::SameLine();
ImGui::Spacing(); ImGui::Spacing();
ImGui::SameLine(); ImGui::SameLine();
SmallCheckbox( ICON_FA_SCISSORS " Short images", &m_shortImageNames );
ImGui::SameLine();
ImGui::Spacing();
ImGui::SameLine();
ImGui::TextUnformatted( ICON_FA_AT " Frame location:" ); ImGui::TextUnformatted( ICON_FA_AT " Frame location:" );
ImGui::SameLine(); ImGui::SameLine();
ImGui::PushStyleVar( ImGuiStyleVar_FramePadding, ImVec2( 0, 0 ) ); ImGui::PushStyleVar( ImGuiStyleVar_FramePadding, ImVec2( 0, 0 ) );
@ -385,7 +389,28 @@ void View::DrawCallstackTable( uint32_t callstack, bool globalEntriesButton )
} }
ImGui::PopTextWrapPos(); ImGui::PopTextWrapPos();
ImGui::TableNextColumn(); ImGui::TableNextColumn();
if( image ) TextDisabledUnformatted( image ); if( image )
{
const char* end = image + strlen( image );
if( m_shortImageNames )
{
const char* ptr = end - 1;
while( ptr > image && *ptr != '/' && *ptr != '\\' ) ptr--;
if( *ptr == '/' || *ptr == '\\' ) ptr++;
const auto cw = ImGui::GetContentRegionAvail().x;
const auto tw = ImGui::CalcTextSize( image, end ).x;
TextDisabledUnformatted( ptr );
if( ptr != image || tw > cw ) TooltipIfHovered( image );
}
else
{
const auto cw = ImGui::GetContentRegionAvail().x;
const auto tw = ImGui::CalcTextSize( image, end ).x;
TextDisabledUnformatted( image );
if( tw > cw ) TooltipIfHovered( image );
}
}
} }
} }
} }