diff --git a/server/TracyView.cpp b/server/TracyView.cpp index caf6f5e7..85f2e0e8 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -836,55 +836,58 @@ bool View::DrawImpl() ImGui::EndPopup(); } } - ImGui::SameLine(); - if( ImGui::SmallButton( " " ICON_FA_CARET_LEFT " " ) ) ZoomToPrevFrame(); - ImGui::SameLine(); + if( m_worker.AreFramesUsed() ) { - const auto vis = Vis( m_frames ); - if( !vis ) + ImGui::SameLine(); + if( ImGui::SmallButton( " " ICON_FA_CARET_LEFT " " ) ) ZoomToPrevFrame(); + ImGui::SameLine(); { - ImGui::PushStyleColor( ImGuiCol_Text, GImGui->Style.Colors[ImGuiCol_TextDisabled] ); - } - ImGui::Text( "%s: %s", GetFrameSetName( *m_frames ), RealToString( m_worker.GetFrameCount( *m_frames ) ) ); - if( !vis ) - { - ImGui::PopStyleColor(); - } - if( ImGui::IsItemClicked() ) ImGui::OpenPopup( "GoToFramePopup" ); - } - ImGui::SameLine(); - if( ImGui::SmallButton( " " ICON_FA_CARET_RIGHT " " ) ) ZoomToNextFrame(); - 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( GetFrameSetName( *fd ), isSelected ) ) + const auto vis = Vis( m_frames ); + if( !vis ) { - m_frames = fd; + ImGui::PushStyleColor( ImGuiCol_Text, GImGui->Style.Colors[ImGuiCol_TextDisabled] ); } - if( isSelected ) + ImGui::Text( "%s: %s", GetFrameSetName( *m_frames ), RealToString( m_worker.GetFrameCount( *m_frames ) ) ); + if( !vis ) { - ImGui::SetItemDefaultFocus(); + ImGui::PopStyleColor(); } - ImGui::SameLine(); - ImGui::TextDisabled( "(%s)", RealToString( fd->frames.size() ) ); + if( ImGui::IsItemClicked() ) ImGui::OpenPopup( "GoToFramePopup" ); + } + ImGui::SameLine(); + if( ImGui::SmallButton( " " ICON_FA_CARET_RIGHT " " ) ) ZoomToNextFrame(); + 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( GetFrameSetName( *fd ), isSelected ) ) + { + m_frames = fd; + } + if( isSelected ) + { + ImGui::SetItemDefaultFocus(); + } + ImGui::SameLine(); + ImGui::TextDisabled( "(%s)", RealToString( fd->frames.size() ) ); + } + ImGui::EndCombo(); + } + if( ImGui::BeginPopup( "GoToFramePopup" ) ) + { + static int frameNum = 1; + const bool mainFrameSet = m_frames->name == 0; + const auto numFrames = mainFrameSet ? m_frames->frames.size() - 1 : m_frames->frames.size(); + const auto frameOffset = mainFrameSet ? 0 : 1; + ImGui::SetNextItemWidth( 120 * GetScale() ); + const bool clicked = ImGui::InputInt( "##goToFrame", &frameNum, 1, 100, ImGuiInputTextFlags_EnterReturnsTrue ); + frameNum = std::min( std::max( frameNum, 1 ), int( numFrames ) ); + if( clicked ) ZoomToRange( m_worker.GetFrameBegin( *m_frames, frameNum - frameOffset ), m_worker.GetFrameEnd( *m_frames, frameNum - frameOffset ) ); + ImGui::EndPopup(); } - ImGui::EndCombo(); - } - if( ImGui::BeginPopup( "GoToFramePopup" ) ) - { - static int frameNum = 1; - const bool mainFrameSet = m_frames->name == 0; - const auto numFrames = mainFrameSet ? m_frames->frames.size() - 1 : m_frames->frames.size(); - const auto frameOffset = mainFrameSet ? 0 : 1; - ImGui::SetNextItemWidth( 120 * GetScale() ); - const bool clicked = ImGui::InputInt( "##goToFrame", &frameNum, 1, 100, ImGuiInputTextFlags_EnterReturnsTrue ); - frameNum = std::min( std::max( frameNum, 1 ), int( numFrames ) ); - if( clicked ) ZoomToRange( m_worker.GetFrameBegin( *m_frames, frameNum - frameOffset ), m_worker.GetFrameEnd( *m_frames, frameNum - frameOffset ) ); - ImGui::EndPopup(); } { diff --git a/server/TracyView_Options.cpp b/server/TracyView_Options.cpp index 77ab4f87..450e076d 100644 --- a/server/TracyView_Options.cpp +++ b/server/TracyView_Options.cpp @@ -696,39 +696,42 @@ void View::DrawOptions() ImGui::TreePop(); } - ImGui::Separator(); - expand = ImGui::TreeNode( ICON_FA_IMAGES " Visible frame sets:" ); - ImGui::SameLine(); - ImGui::TextDisabled( "(%zu)", m_worker.GetFrames().size() ); - if( expand ) + if( m_worker.AreFramesUsed() ) { + ImGui::Separator(); + expand = ImGui::TreeNode( ICON_FA_IMAGES " Visible frame sets:" ); ImGui::SameLine(); - if( ImGui::SmallButton( "Select all" ) ) + ImGui::TextDisabled( "(%zu)", m_worker.GetFrames().size() ); + if( expand ) { - for( const auto& fd : m_worker.GetFrames() ) - { - Vis( fd ) = true; - } - } - ImGui::SameLine(); - if( ImGui::SmallButton( "Unselect all" ) ) - { - for( const auto& fd : m_worker.GetFrames() ) - { - Vis( fd ) = false; - } - } - - int idx = 0; - for( const auto& fd : m_worker.GetFrames() ) - { - ImGui::PushID( idx++ ); - SmallCheckbox( GetFrameSetName( *fd ), &Vis( fd ) ); - ImGui::PopID(); ImGui::SameLine(); - ImGui::TextDisabled( "%s %sframes", RealToString( fd->frames.size() ), fd->continuous ? "" : "discontinuous " ); + if( ImGui::SmallButton( "Select all" ) ) + { + for( const auto& fd : m_worker.GetFrames() ) + { + Vis( fd ) = true; + } + } + ImGui::SameLine(); + if( ImGui::SmallButton( "Unselect all" ) ) + { + for( const auto& fd : m_worker.GetFrames() ) + { + Vis( fd ) = false; + } + } + + int idx = 0; + for( const auto& fd : m_worker.GetFrames() ) + { + ImGui::PushID( idx++ ); + SmallCheckbox( GetFrameSetName( *fd ), &Vis( fd ) ); + ImGui::PopID(); + ImGui::SameLine(); + ImGui::TextDisabled( "%s %sframes", RealToString( fd->frames.size() ), fd->continuous ? "" : "discontinuous " ); + } + ImGui::TreePop(); } - ImGui::TreePop(); } ImGui::End(); } diff --git a/server/TracyView_Timeline.cpp b/server/TracyView_Timeline.cpp index 0c06e8b9..3e39ec7d 100644 --- a/server/TracyView_Timeline.cpp +++ b/server/TracyView_Timeline.cpp @@ -296,12 +296,15 @@ void View::DrawTimeline() m_tc.Begin(); DrawTimelineFramesHeader(); - auto& frames = m_worker.GetFrames(); - for( auto fd : frames ) + if( m_worker.AreFramesUsed() ) { - if( Vis( fd ) ) + auto& frames = m_worker.GetFrames(); + for( auto fd : frames ) { - DrawTimelineFrames( *fd ); + if( Vis( fd ) ) + { + DrawTimelineFrames( *fd ); + } } } diff --git a/server/TracyView_TraceInfo.cpp b/server/TracyView_TraceInfo.cpp index 31366a8c..6c8e5bcc 100644 --- a/server/TracyView_TraceInfo.cpp +++ b/server/TracyView_TraceInfo.cpp @@ -183,7 +183,7 @@ void View::DrawInfo() ImGui::TreePop(); } - if( ImGui::TreeNode( "Frame statistics" ) ) + if( m_worker.AreFramesUsed() && ImGui::TreeNode( "Frame statistics" ) ) { auto fsz = m_worker.GetFullFrameCount( *m_frames ); if( fsz != 0 )