DrawSourceTooltip reports if source was printed.

This commit is contained in:
Bartosz Taudul
2026-05-17 17:58:22 +02:00
parent a7937d2710
commit 5d4ba366ba
3 changed files with 7 additions and 5 deletions

View File

@@ -1420,12 +1420,12 @@ void View::CrashTooltip()
ImGui::EndTooltip();
}
void View::DrawSourceTooltip( const char* filename, uint32_t srcline, int before, int after, bool separateTooltip )
bool View::DrawSourceTooltip( const char* filename, uint32_t srcline, int before, int after, bool separateTooltip )
{
if( !filename ) return;
if( !SourceFileValid( filename, m_worker.GetCaptureTime(), *this, m_worker ) ) return;
if( !filename ) return false;
if( !SourceFileValid( filename, m_worker.GetCaptureTime(), *this, m_worker ) ) return false;
m_srcHintCache.Parse( filename, m_worker, *this );
if( m_srcHintCache.empty() ) return;
if( m_srcHintCache.empty() ) return false;
ImGui::PushStyleVar( ImGuiStyleVar_ItemSpacing, ImVec2( 0, 0 ) );
if( separateTooltip ) ImGui::BeginTooltip();
ImGui::PushFont( g_fonts.mono, FontNormal );
@@ -1478,6 +1478,7 @@ void View::DrawSourceTooltip( const char* filename, uint32_t srcline, int before
ImGui::PopFont();
if( separateTooltip ) ImGui::EndTooltip();
ImGui::PopStyleVar();
return true;
}
bool View::Save( const char* fn, FileCompression comp, int zlevel, bool buildDict, int streams )

View File

@@ -181,7 +181,7 @@ public:
bool DrawGpu( const TimelineContext& ctx, const GpuCtxData& gpu, int& offset );
bool DrawCpuData( const TimelineContext& ctx, const std::vector<CpuUsageDraw>& cpuDraw, const std::vector<std::vector<CpuCtxDraw>>& ctxDraw, int& offset, bool hasCpuData );
void DrawThreadMigrations( const TimelineContext& ctx, const int origOffset, uint64_t thread );
void DrawSourceTooltip( const char* filename, uint32_t line, int before = 3, int after = 3, bool separateTooltip = true );
bool DrawSourceTooltip( const char* filename, uint32_t line, int before = 3, int after = 3, bool separateTooltip = true );
bool IsBackgroundDone() const { return m_worker.IsBackgroundDone(); }

View File

@@ -8,6 +8,7 @@
#include "TracySourceView.hpp"
#include "TracyTimelineContext.hpp"
#include "TracyTimelineDraw.hpp"
#include "TracyUtility.hpp"
#include "TracyView.hpp"
#include "tracy_pdqsort.h"
#include "../Fonts.hpp"