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

Context menu hide for CPU data.

This commit is contained in:
Bartosz Taudul 2022-08-16 18:48:54 +02:00
parent 3aa62a18cc
commit 4bf6a2b9d2
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3

View File

@ -30,6 +30,7 @@ int View::DrawCpuData( int offset, double pxns, const ImVec2& wpos, bool hover,
static int cpuDataVisStub; static int cpuDataVisStub;
auto& vis = Vis( &cpuDataVisStub ); auto& vis = Vis( &cpuDataVisStub );
bool& showFull = vis.showFull; bool& showFull = vis.showFull;
ImGui::PushID( &vis );
const auto yPos = AdjustThreadPosition( vis, wpos.y, offset ); const auto yPos = AdjustThreadPosition( vis, wpos.y, offset );
const auto oldOffset = offset; const auto oldOffset = offset;
@ -49,9 +50,16 @@ int View::DrawCpuData( int offset, double pxns, const ImVec2& wpos, bool hover,
DrawTextContrast( draw, wpos + ImVec2( ty, offset ), showFull ? 0xFFDD88DD : 0xFF6E446E, "CPU data" ); DrawTextContrast( draw, wpos + ImVec2( ty, offset ), showFull ? 0xFFDD88DD : 0xFF6E446E, "CPU data" );
DrawLine( draw, dpos + ImVec2( 0, offset + ty - 1 ), dpos + ImVec2( w, offset + ty - 1 ), 0x66DD88DD ); DrawLine( draw, dpos + ImVec2( 0, offset + ty - 1 ), dpos + ImVec2( w, offset + ty - 1 ), 0x66DD88DD );
if( hover && IsMouseClicked( 0 ) && ImGui::IsMouseHoveringRect( wpos + ImVec2( 0, offset ), wpos + ImVec2( ty + txtx, offset + ty ) ) ) if( hover && ImGui::IsMouseHoveringRect( wpos + ImVec2( 0, offset ), wpos + ImVec2( ty + txtx, offset + ty ) ) )
{ {
showFull = !showFull; if( IsMouseClicked( 0 ) )
{
showFull = !showFull;
}
if( IsMouseClicked( 1 ) )
{
ImGui::OpenPopup( "menuPopup" );
}
} }
} }
offset += ostep; offset += ostep;
@ -446,9 +454,20 @@ int View::DrawCpuData( int offset, double pxns, const ImVec2& wpos, bool hover,
ImGui::PopFont(); ImGui::PopFont();
} }
if( ImGui::BeginPopup( "menuPopup" ) )
{
if( ImGui::MenuItem( ICON_FA_EYE_SLASH " Hide" ) )
{
m_vd.drawCpuData = false;
ImGui::CloseCurrentPopup();
}
ImGui::EndPopup();
}
offset += ostep * 0.2f; offset += ostep * 0.2f;
AdjustThreadHeight( vis, oldOffset, offset ); AdjustThreadHeight( vis, oldOffset, offset );
ImGui::PopClipRect(); ImGui::PopClipRect();
ImGui::PopID();
return offset; return offset;
} }