From 871633cbafd99a8f1dd9ef9d75d85cfba3275a12 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sat, 24 Mar 2018 23:43:51 +0100 Subject: [PATCH] Adapt button size to font size. --- server/TracyView.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 37d9ed0b..94c4dd98 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -288,20 +288,23 @@ void View::DrawImpl() DrawConnection(); } + const auto th = ImGui::GetTextLineHeight(); + const auto bw = 4.7f * th; + std::lock_guard lock( m_worker.GetDataLock() ); ImGui::Begin( m_worker.GetCaptureName().c_str(), nullptr, ImVec2( 1550, 800 ), -1, ImGuiWindowFlags_NoScrollbar ); if( !m_worker.IsDataStatic() ) { - if( ImGui::Button( m_pause ? "Resume" : "Pause", ImVec2( 70, 0 ) ) ) m_pause = !m_pause; + if( ImGui::Button( m_pause ? "Resume" : "Pause", ImVec2( bw, 0 ) ) ) m_pause = !m_pause; ImGui::SameLine(); } - if( ImGui::Button( "Options", ImVec2( 70, 0 ) ) ) m_showOptions = true; + if( ImGui::Button( "Options", ImVec2( bw, 0 ) ) ) m_showOptions = true; ImGui::SameLine(); - if( ImGui::Button( "Messages", ImVec2( 70, 0 ) ) ) m_showMessages = true; + if( ImGui::Button( "Messages", ImVec2( bw, 0 ) ) ) m_showMessages = true; ImGui::SameLine(); - if( ImGui::Button( "Find Zone", ImVec2( 70, 0 ) ) ) m_findZone.show = true; + if( ImGui::Button( "Find Zone", ImVec2( bw, 0 ) ) ) m_findZone.show = true; ImGui::SameLine(); - if( ImGui::Button( "Statistics", ImVec2( 70, 0 ) ) ) m_showStatistics = true; + if( ImGui::Button( "Statistics", ImVec2( bw, 0 ) ) ) m_showStatistics = true; ImGui::SameLine(); ImGui::Text( "Frames: %-7" PRIu64 " Time span: %-10s View span: %-10s Zones: %-13s Queue delay: %s Timer resolution: %s", m_worker.GetFrameCount(), TimeToString( m_worker.GetLastTime() - m_worker.GetFrameBegin( 0 ) ), TimeToString( m_zvEnd - m_zvStart ), RealToString( m_worker.GetZoneCount(), true ), TimeToString( m_worker.GetDelay() ), TimeToString( m_worker.GetResolution() ) ); DrawFrames();