Use TooltipIfHovered() where appropriate.

This commit is contained in:
Bartosz Taudul 2022-01-01 16:57:48 +01:00
parent d5f12744c4
commit c6da04a18b
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3
3 changed files with 31 additions and 186 deletions

View File

@ -824,12 +824,7 @@ static void DrawContents()
{
ImGui::SameLine();
tracy::TextColoredUnformatted( 0xFF00FFFF, ICON_FA_EXCLAMATION_TRIANGLE );
if( ImGui::IsItemHovered() )
{
ImGui::BeginTooltip();
ImGui::TextUnformatted( "Filters are active" );
ImGui::EndTooltip();
}
tracy::TooltipIfHovered( "Filters are active" );
if( showFilter )
{
ImGui::SameLine();

View File

@ -1052,12 +1052,7 @@ void SourceView::RenderSymbolView( Worker& worker, View& view )
{
ImGui::SameLine();
TextColoredUnformatted( ImVec4( 1.f, 1.f, 0.2f, 1.f ), ICON_FA_EXCLAMATION_TRIANGLE );
if( ImGui::IsItemHovered() )
{
ImGui::BeginTooltip();
ImGui::TextUnformatted( "Context is limited to an inline function" );
ImGui::EndTooltip();
}
TooltipIfHovered( "Context is limited to an inline function" );
}
if( SmallCheckbox( ICON_FA_SITEMAP " Function:", &m_calcInlineStats ) )
{
@ -1325,21 +1320,11 @@ void SourceView::RenderSymbolView( Worker& worker, View& view )
{
ImGui::PopStyleVar();
ImGui::PopItemFlag();
if( ImGui::IsItemHovered() )
{
ImGui::BeginTooltip();
ImGui::TextUnformatted( "Please wait, processing data..." );
ImGui::EndTooltip();
}
TooltipIfHovered( "Please wait, processing data..." );
}
else
{
if( ImGui::IsItemHovered() )
{
ImGui::BeginTooltip();
ImGui::TextUnformatted( "Press Z key to temporarily reverse selection." );
ImGui::EndTooltip();
}
TooltipIfHovered( "Press Z key to temporarily reverse selection." );
}
ImGui::SameLine();
if( ImGui::SmallButton( m_childCallList ? " " ICON_FA_CARET_UP " " : " " ICON_FA_CARET_DOWN " " ) ) m_childCallList = !m_childCallList;
@ -1358,12 +1343,7 @@ void SourceView::RenderSymbolView( Worker& worker, View& view )
{
ImGui::SameLine();
ImGui::TextDisabled( "(%c%s)", m_childCalls ? '-' : '+', TimeToString( as.ipTotalAsm.ext * worker.GetSamplingPeriod() ) );
if( ImGui::IsItemHovered() )
{
ImGui::BeginTooltip();
ImGui::TextUnformatted( "Child call samples" );
ImGui::EndTooltip();
}
TooltipIfHovered( "Child call samples" );
}
ImGui::SameLine();
ImGui::Spacing();
@ -1380,12 +1360,7 @@ void SourceView::RenderSymbolView( Worker& worker, View& view )
{
ImGui::SameLine();
ImGui::Text( "(%c%s)", m_childCalls ? '-' : '+', RealToString( as.ipTotalAsm.ext ) );
if( ImGui::IsItemHovered() )
{
ImGui::BeginTooltip();
ImGui::TextUnformatted( "Child call samples" );
ImGui::EndTooltip();
}
TooltipIfHovered( "Child call samples" );
}
}
else
@ -1405,12 +1380,7 @@ void SourceView::RenderSymbolView( Worker& worker, View& view )
ImGui::Checkbox( "Limit range", &val );
ImGui::PopItemFlag();
ImGui::PopStyleVar();
if( ImGui::IsItemHovered() )
{
ImGui::BeginTooltip();
ImGui::TextUnformatted( "Please wait, processing data..." );
ImGui::EndTooltip();
}
TooltipIfHovered( "Please wait, processing data..." );
}
else
{
@ -1716,12 +1686,7 @@ void SourceView::RenderSymbolSourceView( const AddrStatData& as, Worker& worker,
if( m_source.is_cached() )
{
TextColoredUnformatted( ImVec4( 0.4f, 0.8f, 0.4f, 1.f ), ICON_FA_DATABASE );
if( ImGui::IsItemHovered() )
{
ImGui::BeginTooltip();
ImGui::TextUnformatted( "Source file cached during profiling run" );
ImGui::EndTooltip();
}
TooltipIfHovered( "Source file cached during profiling run" );
}
else
{
@ -2243,12 +2208,7 @@ uint64_t SourceView::RenderSymbolAsmView( const AddrStatData& as, Worker& worker
if( m_selMicroArch == m_profileMicroArch )
{
TextColoredUnformatted( ImVec4( 0.4f, 0.8f, 0.4f, 1.f ), ICON_FA_MICROCHIP );
if( ImGui::IsItemHovered() )
{
ImGui::BeginTooltip();
ImGui::TextUnformatted( "Selected microarchitecture is the same as the profiled application was running on" );
ImGui::EndTooltip();
}
TooltipIfHovered( "Selected microarchitecture is the same as the profiled application was running on" );
}
else
{

View File

@ -1026,12 +1026,7 @@ bool View::DrawImpl()
auto cx = ImGui::GetCursorPosX();
ImGui::Text( ICON_FA_EYE " %s", TimeToString( m_vd.zvEnd - m_vd.zvStart ) );
if( ImGui::IsItemHovered() )
{
ImGui::BeginTooltip();
ImGui::Text( "View span" );
ImGui::EndTooltip();
}
TooltipIfHovered( "View span" );
ImGui::SameLine();
auto dx = ImGui::GetCursorPosX() - cx;
if( dx < targetLabelSize ) ImGui::SameLine( cx + targetLabelSize );
@ -1054,12 +1049,7 @@ bool View::DrawImpl()
cx = ImGui::GetCursorPosX();
ImGui::Text( ICON_FA_MEMORY " %s", MemSizeToString( memUsage ) );
if( ImGui::IsItemHovered() )
{
ImGui::BeginTooltip();
ImGui::Text( "Profiler memory usage" );
ImGui::EndTooltip();
}
TooltipIfHovered( "Profiler memory usage" );
if( m_totalMemory != 0 )
{
ImGui::SameLine();
@ -1382,12 +1372,7 @@ void View::DrawNotificationArea()
{
ImGui::SameLine();
TextColoredUnformatted( ImVec4( 1, 0.5, 0, 1 ), ICON_FA_EYE_DROPPER );
if( ImGui::IsItemHovered() )
{
ImGui::BeginTooltip();
ImGui::TextUnformatted( "Sampling data and ghost zones may be displayed wrongly due to data inconsistency. Save and reload the trace to fix this." );
ImGui::EndTooltip();
}
TooltipIfHovered( "Sampling data and ghost zones may be displayed wrongly due to data inconsistency. Save and reload the trace to fix this." );
}
if( m_vd.drawEmptyLabels )
{
@ -2487,12 +2472,7 @@ void View::DrawZoneFramesHeader()
const auto step = pow( 10, scale );
ImGui::InvisibleButton( "##zoneFrames", ImVec2( w, ty * 1.5f ) );
if( ImGui::IsItemHovered() )
{
ImGui::BeginTooltip();
ImGui::TextUnformatted( TimeToStringExact( m_vd.zvStart + ( ImGui::GetIO().MousePos.x - wpos.x ) * nspx ) );
ImGui::EndTooltip();
}
TooltipIfHovered( TimeToStringExact( m_vd.zvStart + ( ImGui::GetIO().MousePos.x - wpos.x ) * nspx ) );
const auto dx = step * pxns;
double x = 0;
@ -7700,12 +7680,7 @@ void View::DrawZoneInfoWindow()
ImGui::TextUnformatted( DecodeContextSwitchReasonCode( reason ) );
desc = DecodeContextSwitchReason( reason );
}
if( *desc && ImGui::IsItemHovered() )
{
ImGui::BeginTooltip();
ImGui::TextUnformatted( desc );
ImGui::EndTooltip();
}
if( *desc ) TooltipIfHovered( desc );
}
ImGui::PopID();
}
@ -9032,12 +9007,7 @@ void View::DrawOptions()
const auto expand = ImGui::TreeNode( "Locks" );
ImGui::SameLine();
ImGui::TextDisabled( "(%zu)", lockCnt );
if( ImGui::IsItemHovered() )
{
ImGui::BeginTooltip();
ImGui::TextUnformatted( "Locks with no recorded events are counted, but not listed." );
ImGui::EndTooltip();
}
TooltipIfHovered( "Locks with no recorded events are counted, but not listed." );
if( expand )
{
ImGui::SameLine();
@ -10554,12 +10524,7 @@ void View::DrawFindZone()
ImGui::Spacing();
ImGui::SameLine();
TextFocused( "\xcf\x83:", TimeToString( sd ) );
if( ImGui::IsItemHovered() )
{
ImGui::BeginTooltip();
ImGui::Text( "Standard deviation" );
ImGui::EndTooltip();
}
TooltipIfHovered( "Standard deviation" );
}
TextDisabledUnformatted( "Selection range:" );
@ -12433,12 +12398,7 @@ void View::DrawCompare()
TextColoredUnformatted( ImVec4( 0xDD/511.f, 0xDD/511.f, 0x22/511.f, 1.f ), ICON_FA_LEMON );
ImGui::SameLine();
TextFocused( "\xcf\x83 (this):", TimeToString( sd ) );
if( ImGui::IsItemHovered() )
{
ImGui::BeginTooltip();
ImGui::Text( "Standard deviation" );
ImGui::EndTooltip();
}
TooltipIfHovered( "Standard deviation" );
}
@ -12464,12 +12424,7 @@ void View::DrawCompare()
TextColoredUnformatted( ImVec4( 0xDD/511.f, 0x22/511.f, 0x22/511.f, 1.f ), ICON_FA_GEM );
ImGui::SameLine();
TextFocused( "\xcf\x83 (ext.):", TimeToString( sd ) );
if( ImGui::IsItemHovered() )
{
ImGui::BeginTooltip();
ImGui::Text( "Standard deviation" );
ImGui::EndTooltip();
}
TooltipIfHovered( "Standard deviation" );
}
ImGui::PushStyleColor( ImGuiCol_Text, ImVec4( 0xDD/511.f, 0xDD/511.f, 0x22/511.f, 1.f ) );
@ -13080,12 +13035,7 @@ void View::DrawStatistics()
ImGui::Checkbox( "Limit range", &val );
ImGui::PopItemFlag();
ImGui::PopStyleVar();
if( ImGui::IsItemHovered() )
{
ImGui::BeginTooltip();
ImGui::TextUnformatted( "Waiting for background tasks to finish" );
ImGui::EndTooltip();
}
TooltipIfHovered( "Waiting for background tasks to finish" );
}
else
{
@ -14447,12 +14397,7 @@ void View::DrawInfo()
{
ImGui::SetClipboardText( save );
}
if( ImGui::IsItemHovered() )
{
ImGui::BeginTooltip();
ImGui::TextUnformatted( "Copy user settings location to clipboard." );
ImGui::EndTooltip();
}
TooltipIfHovered( "Copy user settings location to clipboard." );
}
}
}
@ -14486,29 +14431,14 @@ void View::DrawInfo()
ImGui::Spacing();
ImGui::SameLine();
TextFocused( "Extra data:", RealToString( m_worker.GetZoneExtraCount() ) );
if( ImGui::IsItemHovered() )
{
ImGui::BeginTooltip();
ImGui::TextUnformatted( "Count of zones containing any of the following: call stack trace, custom name, user text" );
ImGui::EndTooltip();
}
TooltipIfHovered( "Count of zones containing any of the following: call stack trace, custom name, user text" );
TextFocused( "GPU zones:", RealToString( m_worker.GetGpuZoneCount() ) );
TextFocused( "Lock events:", RealToString( m_worker.GetLockCount() ) );
TextFocused( "Plot data points:", RealToString( m_worker.GetPlotCount() ) );
if( ImGui::IsItemHovered() )
{
ImGui::BeginTooltip();
ImGui::TextUnformatted( "User plots" );
ImGui::EndTooltip();
}
TooltipIfHovered( "User plots" );
ImGui::SameLine();
TextFocused( "+", RealToString( m_worker.GetTracyPlotCount() ) );
if( ImGui::IsItemHovered() )
{
ImGui::BeginTooltip();
ImGui::TextUnformatted( "Automated Tracy plots" );
ImGui::EndTooltip();
}
TooltipIfHovered( "Automated Tracy plots" );
auto& memNameMap = m_worker.GetMemNameMap();
TextFocused( "Memory pools:", RealToString( memNameMap.size() ) );
uint64_t memTotalCnt = 0;
@ -14518,36 +14448,21 @@ void View::DrawInfo()
TextFocused( "Strings:", RealToString( m_worker.GetStringsCount() ) );
TextFocused( "Symbols:", RealToString( m_worker.GetSymbolsCount() ) );
TextFocused( "Symbol code fragments:", RealToString( m_worker.GetSymbolCodeCount() ) );
if( ImGui::IsItemHovered() )
{
ImGui::BeginTooltip();
ImGui::TextUnformatted( MemSizeToString( m_worker.GetSymbolCodeSize() ) );
ImGui::EndTooltip();
}
TooltipIfHovered( MemSizeToString( m_worker.GetSymbolCodeSize() ) );
TextFocused( "Code locations:", RealToString( m_worker.GetCodeLocationsSize() ) );
TextFocused( "Call stacks:", RealToString( m_worker.GetCallstackPayloadCount() ) );
if( m_worker.AreCallstackSamplesReady() )
{
ImGui::SameLine();
TextFocused( "+", RealToString( m_worker.GetCallstackParentPayloadCount() ) );
if( ImGui::IsItemHovered() )
{
ImGui::BeginTooltip();
ImGui::TextUnformatted( "Parent call stacks for stack samples" );
ImGui::EndTooltip();
}
TooltipIfHovered( "Parent call stacks for stack samples" );
}
TextFocused( "Call stack frames:", RealToString( m_worker.GetCallstackFrameCount() ) );
if( m_worker.AreCallstackSamplesReady() )
{
ImGui::SameLine();
TextFocused( "+", RealToString( m_worker.GetCallstackParentFrameCount() ) );
if( ImGui::IsItemHovered() )
{
ImGui::BeginTooltip();
ImGui::TextUnformatted( "Parent call stack frames for stack samples" );
ImGui::EndTooltip();
}
TooltipIfHovered( "Parent call stack frames for stack samples" );
}
TextFocused( "Call stack samples:", RealToString( m_worker.GetCallstackSampleCount() ) );
TextFocused( "Ghost zones:", RealToString( m_worker.GetGhostZonesCount() ) );
@ -14582,20 +14497,10 @@ void View::DrawInfo()
ImGui::EndTooltip();
}
TextFocused( "Context switch regions:", RealToString( m_worker.GetContextSwitchCount() ) );
if( ImGui::IsItemHovered() )
{
ImGui::BeginTooltip();
ImGui::TextUnformatted( "Detailed context switch data regarding application threads" );
ImGui::EndTooltip();
}
TooltipIfHovered( "Detailed context switch data regarding application threads" );
ImGui::SameLine();
TextFocused( "+", RealToString( m_worker.GetContextSwitchPerCpuCount() ) );
if( ImGui::IsItemHovered() )
{
ImGui::BeginTooltip();
ImGui::TextUnformatted( "Coarse CPU core context switch data" );
ImGui::EndTooltip();
}
TooltipIfHovered( "Coarse CPU core context switch data" );
if( m_worker.GetSourceFileCacheCount() == 0 )
{
TextFocused( "Source file cache:", "0" );
@ -14607,12 +14512,7 @@ void View::DrawInfo()
ImGui::PopStyleColor();
ImGui::SameLine();
ImGui::TextUnformatted( RealToString( m_worker.GetSourceFileCacheCount() ) );
if( ImGui::IsItemHovered() )
{
ImGui::BeginTooltip();
ImGui::TextUnformatted( MemSizeToString( m_worker.GetSourceFileCacheSize() ) );
ImGui::EndTooltip();
}
TooltipIfHovered( MemSizeToString( m_worker.GetSourceFileCacheSize() ) );
if( expand )
{
auto& cache = m_worker.GetSourceFileCache();
@ -15693,12 +15593,7 @@ void View::DrawPlayback()
ImGui::SameLine();
ImGui::Checkbox( "Zoom 2\xc3\x97", &m_playback.zoom );
TextFocused( "Timestamp:", TimeToString( tstart ) );
if( ImGui::IsItemHovered() )
{
ImGui::BeginTooltip();
ImGui::TextUnformatted( TimeToStringExact( tstart ) );
ImGui::EndTooltip();
}
TooltipIfHovered( TimeToStringExact( tstart ) );
ImGui::SameLine();
ImGui::Spacing();
ImGui::SameLine();
@ -16106,12 +16001,7 @@ void View::DrawAnnotationList()
{
remove = idx;
}
if( !ctrl && ImGui::IsItemHovered() )
{
ImGui::BeginTooltip();
ImGui::TextUnformatted( "Press ctrl key to enable removal" );
ImGui::EndTooltip();
}
if( !ctrl ) TooltipIfHovered( "Press ctrl key to enable removal" );
ImGui::SameLine();
ImGui::ColorButton( "c", ImGui::ColorConvertU32ToFloat4( ann->color ), ImGuiColorEditFlags_NoTooltip );
ImGui::SameLine();