From fec0017bb6338aa5e35aad5d5cceb0dafc0ec524 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sun, 25 Nov 2018 19:15:16 +0100 Subject: [PATCH] Add third state (stopped) to the pause/resume button. --- server/TracyView.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index c20a9ebf..82242d09 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -506,10 +506,12 @@ bool View::Draw() static const char* MainWindowButtons[] = { #ifdef TRACY_EXTENDED_FONT ICON_FA_PLAY " Resume", - ICON_FA_PAUSE " Pause" + ICON_FA_PAUSE " Pause", + ICON_FA_SQUARE " Stopped" #else "Resume", - "Pause" + "Pause", + "Stopped" #endif }; @@ -584,7 +586,16 @@ bool View::DrawImpl() std::lock_guard lock( m_worker.GetDataLock() ); if( !m_worker.IsDataStatic() ) { - if( ImGui::Button( m_pause ? MainWindowButtons[0] : MainWindowButtons[1], ImVec2( bw, 0 ) ) ) m_pause = !m_pause; + if( m_worker.IsConnected() ) + { + if( ImGui::Button( m_pause ? MainWindowButtons[0] : MainWindowButtons[1], ImVec2( bw, 0 ) ) ) m_pause = !m_pause; + } + else + { + ImGui::PushStyleColor( ImGuiCol_Button, (ImVec4)ImColor( 0.3f, 0.3f, 0.3f, 1.0f ) ); + ImGui::ButtonEx( MainWindowButtons[2], ImVec2( bw, 0 ), ImGuiButtonFlags_Disabled ); + ImGui::PopStyleColor( 1 ); + } } else {