1
0
mirror of https://github.com/wolfpld/tracy synced 2025-04-29 20:33:52 +00:00

Allow copying callstack frames name/file to clipboard.

This commit is contained in:
Bartosz Taudul 2018-06-22 20:44:57 +02:00
parent b8f7a4daac
commit 17194cb591

View File

@ -4826,8 +4826,24 @@ void View::DrawCallstackWindow()
ImGui::Text( "Frame" );
ImGui::NextColumn();
ImGui::Text( "Function" );
ImGui::SameLine();
ImGui::TextDisabled( "(?)" );
if( ImGui::IsItemHovered() )
{
ImGui::BeginTooltip();
ImGui::Text( "Click on entry to copy it to clipboard." );
ImGui::EndTooltip();
}
ImGui::NextColumn();
ImGui::Text( "Location" );
ImGui::SameLine();
ImGui::TextDisabled( "(?)" );
if( ImGui::IsItemHovered() )
{
ImGui::BeginTooltip();
ImGui::Text( "Click on entry to copy it to clipboard." );
ImGui::EndTooltip();
}
ImGui::NextColumn();
int fidx = 0;
@ -4840,22 +4856,38 @@ void View::DrawCallstackWindow()
auto frame = m_worker.GetCallstackFrame( entry );
if( !frame )
{
ImGui::Text( "0x%" PRIX64, entry );
char buf[32];
sprintf( buf, "%p", (void*)entry );
ImGui::Text( "%s", buf );
if( ImGui::IsItemClicked() )
{
ImGui::SetClipboardText( buf );
}
ImGui::NextColumn();
ImGui::NextColumn();
}
else
{
ImGui::TextWrapped( "%s", m_worker.GetString( frame->name ) );
auto txt = m_worker.GetString( frame->name );
ImGui::TextWrapped( "%s", txt );
if( ImGui::IsItemClicked() )
{
ImGui::SetClipboardText( txt );
}
ImGui::NextColumn();
ImGui::PushTextWrapPos( 0.0f );
txt = m_worker.GetString( frame->file );
if( frame->line == 0 )
{
ImGui::TextDisabled( "%s", m_worker.GetString( frame->file ) );
ImGui::TextDisabled( "%s", txt );
}
else
{
ImGui::TextDisabled( "%s:%i", m_worker.GetString( frame->file ), frame->line );
ImGui::TextDisabled( "%s:%i", txt, frame->line );
}
if( ImGui::IsItemClicked() )
{
ImGui::SetClipboardText( txt );
}
ImGui::PopTextWrapPos();
ImGui::NextColumn();