mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-27 00:04:35 +00:00
Move message line drawing to a separate function.
This commit is contained in:
parent
f2d6c79742
commit
333e10c724
@ -8663,21 +8663,35 @@ void View::DrawMessages()
|
||||
int idx = 0;
|
||||
for( const auto& msgIdx : msgList )
|
||||
{
|
||||
const auto& v = msgs[msgIdx];
|
||||
const auto text = m_worker.GetString( v->ref );
|
||||
const auto tid = m_worker.DecompressThread( v->thread );
|
||||
ImGui::PushID( v );
|
||||
if( ImGui::Selectable( TimeToStringExact( v->time ), m_msgHighlight == v, ImGuiSelectableFlags_SpanAllColumns | ImGuiSelectableFlags_AllowItemOverlap ) )
|
||||
DrawMessageLine( *msgs[msgIdx], hasCallstack, idx );
|
||||
}
|
||||
|
||||
if( m_worker.IsConnected() && ImGui::GetScrollY() >= ImGui::GetScrollMaxY() )
|
||||
{
|
||||
CenterAtTime( v->time );
|
||||
ImGui::SetScrollHereY( 1.f );
|
||||
}
|
||||
|
||||
ImGui::EndColumns();
|
||||
ImGui::EndChild();
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
void View::DrawMessageLine( const MessageData& msg, bool hasCallstack, int& idx )
|
||||
{
|
||||
const auto text = m_worker.GetString( msg.ref );
|
||||
const auto tid = m_worker.DecompressThread( msg.thread );
|
||||
ImGui::PushID( &msg );
|
||||
if( ImGui::Selectable( TimeToStringExact( msg.time ), m_msgHighlight == &msg, ImGuiSelectableFlags_SpanAllColumns | ImGuiSelectableFlags_AllowItemOverlap ) )
|
||||
{
|
||||
CenterAtTime( msg.time );
|
||||
}
|
||||
if( ImGui::IsItemHovered() )
|
||||
{
|
||||
m_msgHighlight = v;
|
||||
m_msgHighlight = &msg;
|
||||
|
||||
if( m_showMessageImages )
|
||||
{
|
||||
const auto frameIdx = m_worker.GetFrameRange( *m_frames, v->time, v->time ).first;
|
||||
const auto frameIdx = m_worker.GetFrameRange( *m_frames, msg.time, msg.time ).first;
|
||||
auto fi = m_worker.GetFrameImage( *m_frames, frameIdx );
|
||||
if( fi )
|
||||
{
|
||||
@ -8700,7 +8714,7 @@ void View::DrawMessages()
|
||||
}
|
||||
}
|
||||
}
|
||||
if( m_msgToFocus == v )
|
||||
if( m_msgToFocus == &msg )
|
||||
{
|
||||
ImGui::SetScrollHereY();
|
||||
m_msgToFocus.Decay( nullptr );
|
||||
@ -8714,7 +8728,7 @@ void View::DrawMessages()
|
||||
ImGui::SameLine();
|
||||
ImGui::TextDisabled( "(%s)", RealToString( tid ) );
|
||||
ImGui::NextColumn();
|
||||
ImGui::PushStyleColor( ImGuiCol_Text, v->color );
|
||||
ImGui::PushStyleColor( ImGuiCol_Text, msg.color );
|
||||
const auto cw = ImGui::GetContentRegionAvail().x;
|
||||
const auto tw = ImGui::CalcTextSize( text ).x;
|
||||
ImGui::TextUnformatted( text );
|
||||
@ -8729,7 +8743,7 @@ void View::DrawMessages()
|
||||
ImGui::NextColumn();
|
||||
if( hasCallstack )
|
||||
{
|
||||
const auto cs = v->callstack.Val();
|
||||
const auto cs = msg.callstack.Val();
|
||||
if( cs != 0 )
|
||||
{
|
||||
SmallCallstackButton( ICON_FA_ALIGN_JUSTIFY, cs, idx );
|
||||
@ -8738,16 +8752,6 @@ void View::DrawMessages()
|
||||
}
|
||||
ImGui::NextColumn();
|
||||
}
|
||||
}
|
||||
|
||||
if( m_worker.IsConnected() && ImGui::GetScrollY() >= ImGui::GetScrollMaxY() )
|
||||
{
|
||||
ImGui::SetScrollHereY( 1.f );
|
||||
}
|
||||
|
||||
ImGui::EndColumns();
|
||||
ImGui::EndChild();
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
uint64_t View::GetSelectionTarget( const Worker::ZoneThreadData& ev, FindZone::GroupBy groupBy ) const
|
||||
|
@ -155,6 +155,7 @@ private:
|
||||
int DrawCpuData( int offset, double pxns, const ImVec2& wpos, bool hover, float yMin, float yMax );
|
||||
void DrawOptions();
|
||||
void DrawMessages();
|
||||
void DrawMessageLine( const MessageData& msg, bool hasCallstack, int& idx );
|
||||
void DrawFindZone();
|
||||
void DrawStatistics();
|
||||
void DrawMemory();
|
||||
|
Loading…
Reference in New Issue
Block a user