Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/wolfpld/tracy.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authorBartosz Taudul <wolf@nereid.pl>2022-09-05 21:12:36 +0300
committerBartosz Taudul <wolf@nereid.pl>2022-09-05 21:12:36 +0300
commit5200ea2c84641aae66e0bf27dc78ac606d8e6296 (patch)
treeae9c6cf575b20b31d8dbb1296c748385c7ee58aa /server
parent23ebce2862a364667d874b9ac2d3c0ca95f6f276 (diff)
Hide frame related information if no frame instrumentation.
Diffstat (limited to 'server')
-rw-r--r--server/TracyView.cpp87
-rw-r--r--server/TracyView_Options.cpp51
-rw-r--r--server/TracyView_Timeline.cpp11
-rw-r--r--server/TracyView_TraceInfo.cpp2
4 files changed, 80 insertions, 71 deletions
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::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 )
+ ImGui::SameLine();
+ if( ImGui::SmallButton( " " ICON_FA_CARET_LEFT " " ) ) ZoomToPrevFrame();
+ ImGui::SameLine();
{
- 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() )
+ ImGui::SameLine();
+ if( ImGui::SmallButton( "Select all" ) )
{
- Vis( fd ) = true;
+ for( const auto& fd : m_worker.GetFrames() )
+ {
+ Vis( fd ) = true;
+ }
}
- }
- ImGui::SameLine();
- if( ImGui::SmallButton( "Unselect all" ) )
- {
- for( const auto& fd : m_worker.GetFrames() )
+ ImGui::SameLine();
+ if( ImGui::SmallButton( "Unselect all" ) )
{
- Vis( fd ) = false;
+ 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 " );
+ 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 )