From de5f258b0356971b55d68773170cf578b2ac3e33 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Thu, 29 Apr 2021 20:33:10 +0200 Subject: [PATCH] Display complementary assembly address tooltips. --- server/TracySourceView.cpp | 41 ++++++++++++++++++++++++++++++++------ 1 file changed, 35 insertions(+), 6 deletions(-) diff --git a/server/TracySourceView.cpp b/server/TracySourceView.cpp index 20bc6269..07a69ee6 100644 --- a/server/TracySourceView.cpp +++ b/server/TracySourceView.cpp @@ -2723,13 +2723,42 @@ void SourceView::RenderAsmLine( AsmLine& line, const AddrStat& ipcnt, const Addr { TextDisabledUnformatted( buf ); } - if( ImGui::IsItemClicked( 0 ) ) + if( ImGui::IsItemHovered() ) { - m_asmCountBase = asmIdx; - } - else if( ImGui::IsItemClicked( 1 ) ) - { - m_asmCountBase = -1; + if( m_font ) ImGui::PopFont(); + ImGui::BeginTooltip(); + if( m_asmCountBase >= 0 ) + { + TextDisabledUnformatted( "Absolute address:" ); + ImGui::SameLine(); + ImGui::Text( "%" PRIx64, line.addr ); + TextDisabledUnformatted( "Relative address:" ); + ImGui::SameLine(); + ImGui::Text( "+%" PRIx64, line.addr - m_baseAddr ); + } + else if( m_asmRelative ) + { + TextDisabledUnformatted( "Absolute address:" ); + ImGui::SameLine(); + ImGui::Text( "%" PRIx64, line.addr ); + } + else + { + TextDisabledUnformatted( "Relative address:" ); + ImGui::SameLine(); + ImGui::Text( "+%" PRIx64, line.addr - m_baseAddr ); + } + ImGui::EndTooltip(); + if( m_font ) ImGui::PushFont( m_font ); + + if( ImGui::IsItemClicked( 0 ) ) + { + m_asmCountBase = asmIdx; + } + else if( ImGui::IsItemClicked( 1 ) ) + { + m_asmCountBase = -1; + } } const auto stw = ImGui::CalcTextSize( " " ).x;