From acabdf3c2a1360fa00457d4f4310bbde48994ede Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sat, 4 Aug 2018 21:43:29 +0200 Subject: [PATCH] Implement switching between frame sets. --- server/TracyView.cpp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 949a2c7d..09c55683 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -419,9 +419,27 @@ bool View::DrawImpl() ImGui::SameLine(); if( ImGui::Button( "Compare" ) ) m_compare.show = true; ImGui::SameLine(); + if( ImGui::BeginCombo( "##frameCombo", nullptr, ImGuiComboFlags_NoPreview ) ) + { + auto& frames = m_worker.GetFrames(); + for( auto& fd : frames ) + { + bool isSelected = m_frames == fd; + if( ImGui::Selectable( fd->name == 0 ? "Frames" : m_worker.GetString( fd->name ), isSelected ) ) + { + m_frames = fd; + } + if( isSelected ) + { + ImGui::SetItemDefaultFocus(); + } + } + ImGui::EndCombo(); + } + ImGui::SameLine(); if( ImGui::SmallButton( "<" ) ) ZoomToPrevFrame(); ImGui::SameLine(); - ImGui::Text( "Frames: %s", RealToString( m_worker.GetFrameCount( *m_frames ), true ) ); + ImGui::Text( "%s: %s", m_frames->name == 0 ? "Frames" : m_worker.GetString( m_frames->name ), RealToString( m_worker.GetFrameCount( *m_frames ), true ) ); ImGui::SameLine(); if( ImGui::SmallButton( ">" ) ) ZoomToNextFrame(); ImGui::SameLine(); @@ -3745,7 +3763,7 @@ void View::DrawOptions() for( const auto& fd : m_worker.GetFrames() ) { ImGui::PushID( idx++ ); - ImGui::Checkbox( fd->name == 0 ? "Base frame set" : m_worker.GetString( fd->name ), &Visible( fd ) ); + ImGui::Checkbox( fd->name == 0 ? "Frames" : m_worker.GetString( fd->name ), &Visible( fd ) ); ImGui::PopID(); ImGui::SameLine(); ImGui::TextDisabled( "%s frames", RealToString( fd->frames.size(), true ) );