1
0
mirror of https://github.com/wolfpld/tracy.git synced 2025-03-20 07:40:02 +08:00

Change way of updating fonts in View.

This makes the whole process more easy to follow. It also fixes a crash
bug that was occuring when Wayland output scale changed.
This commit is contained in:
Bartosz Taudul
2024-03-01 23:43:53 +01:00
parent bdfcc5b814
commit b329eb1fcc
5 changed files with 28 additions and 25 deletions
+13 -13
View File
@@ -892,19 +892,19 @@ bool View::DrawImpl()
if( ImGui::Button( ICON_FA_MAGNIFYING_GLASS_PLUS ) ) ImGui::OpenPopup( "ZoomPopup" );
if( ImGui::BeginPopup( "ZoomPopup" ) )
{
if( ImGui::Button( "50%" ) ) m_sscb( 1.f/2, m_fixedFont, m_bigFont, m_smallFont );
if( ImGui::Button( "57%" ) ) m_sscb( 1.f/1.75f, m_fixedFont, m_bigFont, m_smallFont );
if( ImGui::Button( "66%" ) ) m_sscb( 1.f/1.5f, m_fixedFont, m_bigFont, m_smallFont );
if( ImGui::Button( "80%" ) ) m_sscb( 1.f/1.25f, m_fixedFont, m_bigFont, m_smallFont );
if( ImGui::Button( "100%" ) ) m_sscb( 1.f, m_fixedFont, m_bigFont, m_smallFont );
if( ImGui::Button( "125%" ) ) m_sscb( 1.25f, m_fixedFont, m_bigFont, m_smallFont );
if( ImGui::Button( "150%" ) ) m_sscb( 1.5f, m_fixedFont, m_bigFont, m_smallFont );
if( ImGui::Button( "175%" ) ) m_sscb( 1.75f, m_fixedFont, m_bigFont, m_smallFont );
if( ImGui::Button( "200%" ) ) m_sscb( 2.f, m_fixedFont, m_bigFont, m_smallFont );
if( ImGui::Button( "225%" ) ) m_sscb( 2.25f, m_fixedFont, m_bigFont, m_smallFont );
if( ImGui::Button( "250%" ) ) m_sscb( 2.5f, m_fixedFont, m_bigFont, m_smallFont );
if( ImGui::Button( "275%" ) ) m_sscb( 2.75f, m_fixedFont, m_bigFont, m_smallFont );
if( ImGui::Button( "300%" ) ) m_sscb( 3.f, m_fixedFont, m_bigFont, m_smallFont );
if( ImGui::Button( "50%" ) ) m_sscb( 1.f/2 );
if( ImGui::Button( "57%" ) ) m_sscb( 1.f/1.75f );
if( ImGui::Button( "66%" ) ) m_sscb( 1.f/1.5f );
if( ImGui::Button( "80%" ) ) m_sscb( 1.f/1.25f );
if( ImGui::Button( "100%" ) ) m_sscb( 1.f );
if( ImGui::Button( "125%" ) ) m_sscb( 1.25f );
if( ImGui::Button( "150%" ) ) m_sscb( 1.5f );
if( ImGui::Button( "175%" ) ) m_sscb( 1.75f );
if( ImGui::Button( "200%" ) ) m_sscb( 2.f );
if( ImGui::Button( "225%" ) ) m_sscb( 2.25f );
if( ImGui::Button( "250%" ) ) m_sscb( 2.5f );
if( ImGui::Button( "275%" ) ) m_sscb( 2.75f );
if( ImGui::Button( "300%" ) ) m_sscb( 3.f );
ImGui::EndPopup();
}
}
+3 -1
View File
@@ -100,7 +100,7 @@ public:
};
using SetTitleCallback = void(*)( const char* );
using SetScaleCallback = void(*)( float, ImFont*&, ImFont*&, ImFont*& );
using SetScaleCallback = void(*)( float );
using AttentionCallback = void(*)();
View( void(*cbMainThread)(const std::function<void()>&, bool), const char* addr, uint16_t port, ImFont* fixedWidth, ImFont* smallFont, ImFont* bigFont, SetTitleCallback stcb, SetScaleCallback sscb, AttentionCallback acb, const Config& config );
@@ -110,6 +110,8 @@ public:
bool Draw();
bool WasActive() const;
void UpdateFont( ImFont* fixed, ImFont* small, ImFont* big ) { m_fixedFont = fixed; m_smallFont = small; m_bigFont = big; }
void NotifyRootWindowSize( float w, float h ) { m_rootWidth = w; m_rootHeight = h; }
void ViewSource( const char* fileName, int line );
void ViewSource( const char* fileName, int line, const char* functionName );