From c6207ed0e96f5c86a34fc6e1cab95ba4a5c3f283 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Mon, 14 Oct 2019 20:07:55 +0200 Subject: [PATCH] Move extra tools to main window button bar popup. --- server/TracyView.cpp | 55 ++++++++++++++++++++++---------------------- 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 168ad5f8..5f4f7ad4 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -557,6 +557,34 @@ bool View::DrawImpl() ToggleButton( "Info", m_showInfo ); #endif ImGui::SameLine(); +#ifdef TRACY_EXTENDED_FONT + if( ImGui::Button( ICON_FA_TOOLS ) ) ImGui::OpenPopup( "ToolsPopup" ); +#else + if( ImGui::Button( "Tools" ) ) ImGui::OpenPopup( "ToolsPopup" ); +#endif + if( ImGui::BeginPopup( "ToolsPopup" ) ) + { + const auto ficnt = m_worker.GetFrameImageCount(); +#ifdef TRACY_EXTENDED_FONT + if( ButtonDisablable( ICON_FA_PLAY " Playback", ficnt == 0 ) ) +#else + if( ButtonDisablable( "Playback", , ficnt == 0) ) +#endif + { + m_showPlayback = true; + } + const auto& ctd = m_worker.GetCpuThreadData(); +#ifdef TRACY_EXTENDED_FONT + if( ButtonDisablable( ICON_FA_SLIDERS_H " CPU data", ctd.empty() ) ) +#else + if( ButtonDisablable( "CPU data", ctd.empty() ) ) +#endif + { + m_showCpuDataWindow = true; + } + ImGui::EndPopup(); + } + ImGui::SameLine(); #ifdef TRACY_EXTENDED_FONT if( ImGui::SmallButton( " " ICON_FA_CARET_LEFT " " ) ) ZoomToPrevFrame(); #else @@ -10894,33 +10922,6 @@ void View::DrawInfo() ImGui::TreePop(); } - if( ficnt != 0 ) - { - ImGui::Separator(); -#ifdef TRACY_EXTENDED_FONT - if( ImGui::Button( ICON_FA_PLAY " Playback" ) ) -#else - if( ImGui::Button( "Playback" ) ) -#endif - { - m_showPlayback = true; - } - } - - const auto& ctd = m_worker.GetCpuThreadData(); - if( !ctd.empty() ) - { - if( ficnt != 0 ) ImGui::SameLine(); -#ifdef TRACY_EXTENDED_FONT - if( ImGui::Button( ICON_FA_SLIDERS_H " CPU data" ) ) -#else - if( ImGui::Button( "CPU data" ) ) -#endif - { - m_showCpuDataWindow = true; - } - } - ImGui::Separator(); TextFocused( "PID:", RealToString( m_worker.GetPid(), true ) ); TextFocused( "Host info:", m_worker.GetHostInfo().c_str() );