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

Add scale setup callback infrastructure.

This commit is contained in:
Bartosz Taudul
2021-11-18 22:22:11 +01:00
parent 5a9344716d
commit 89ca010146
3 changed files with 21 additions and 12 deletions
+4 -2
View File
@@ -134,7 +134,7 @@ enum { MinFrameSize = 5 };
static View* s_instance = nullptr;
View::View( void(*cbMainThread)(std::function<void()>), const char* addr, uint16_t port, ImFont* fixedWidth, ImFont* smallFont, ImFont* bigFont, SetTitleCallback stcb, GetWindowCallback gwcb )
View::View( void(*cbMainThread)(std::function<void()>), const char* addr, uint16_t port, ImFont* fixedWidth, ImFont* smallFont, ImFont* bigFont, SetTitleCallback stcb, GetWindowCallback gwcb, SetScaleCallback sscb )
: m_worker( addr, port )
, m_staticView( false )
, m_viewMode( ViewMode::LastFrames )
@@ -149,6 +149,7 @@ View::View( void(*cbMainThread)(std::function<void()>), const char* addr, uint16
, m_fixedFont( fixedWidth )
, m_stcb( stcb )
, m_gwcb( gwcb )
, m_sscb( sscb )
, m_userData()
, m_cbMainThread( cbMainThread )
{
@@ -159,7 +160,7 @@ View::View( void(*cbMainThread)(std::function<void()>), const char* addr, uint16
InitTextEditor( fixedWidth );
}
View::View( void(*cbMainThread)(std::function<void()>), FileRead& f, ImFont* fixedWidth, ImFont* smallFont, ImFont* bigFont, SetTitleCallback stcb, GetWindowCallback gwcb )
View::View( void(*cbMainThread)(std::function<void()>), FileRead& f, ImFont* fixedWidth, ImFont* smallFont, ImFont* bigFont, SetTitleCallback stcb, GetWindowCallback gwcb, SetScaleCallback sscb )
: m_worker( f )
, m_filename( f.GetFilename() )
, m_staticView( true )
@@ -171,6 +172,7 @@ View::View( void(*cbMainThread)(std::function<void()>), FileRead& f, ImFont* fix
, m_fixedFont( fixedWidth )
, m_stcb( stcb )
, m_gwcb( gwcb )
, m_sscb( sscb )
, m_userData( m_worker.GetCaptureProgram().c_str(), m_worker.GetCaptureTime() )
, m_cbMainThread( cbMainThread )
{
+5 -3
View File
@@ -90,10 +90,11 @@ public:
using SetTitleCallback = void(*)( const char* );
using GetWindowCallback = void*(*)();
using SetScaleCallback = void(*)( float, ImFont*&, ImFont*&, ImFont*& );
View( void(*cbMainThread)(std::function<void()>), ImFont* fixedWidth = nullptr, ImFont* smallFont = nullptr, ImFont* bigFont = nullptr, SetTitleCallback stcb = nullptr, GetWindowCallback gwcb = nullptr ) : View( cbMainThread, "127.0.0.1", 8086, fixedWidth, smallFont, bigFont, stcb, gwcb ) {}
View( void(*cbMainThread)(std::function<void()>), const char* addr, uint16_t port, ImFont* fixedWidth = nullptr, ImFont* smallFont = nullptr, ImFont* bigFont = nullptr, SetTitleCallback stcb = nullptr, GetWindowCallback gwcb = nullptr );
View( void(*cbMainThread)(std::function<void()>), FileRead& f, ImFont* fixedWidth = nullptr, ImFont* smallFont = nullptr, ImFont* bigFont = nullptr, SetTitleCallback stcb = nullptr, GetWindowCallback gwcb = nullptr );
View( void(*cbMainThread)(std::function<void()>), ImFont* fixedWidth = nullptr, ImFont* smallFont = nullptr, ImFont* bigFont = nullptr, SetTitleCallback stcb = nullptr, GetWindowCallback gwcb = nullptr, SetScaleCallback sscb = nullptr ) : View( cbMainThread, "127.0.0.1", 8086, fixedWidth, smallFont, bigFont, stcb, gwcb, sscb ) {}
View( void(*cbMainThread)(std::function<void()>), const char* addr, uint16_t port, ImFont* fixedWidth = nullptr, ImFont* smallFont = nullptr, ImFont* bigFont = nullptr, SetTitleCallback stcb = nullptr, GetWindowCallback gwcb = nullptr, SetScaleCallback sscb = nullptr );
View( void(*cbMainThread)(std::function<void()>), FileRead& f, ImFont* fixedWidth = nullptr, ImFont* smallFont = nullptr, ImFont* bigFont = nullptr, SetTitleCallback stcb = nullptr, GetWindowCallback gwcb = nullptr, SetScaleCallback sscb = nullptr );
~View();
static bool Draw();
@@ -479,6 +480,7 @@ private:
SetTitleCallback m_stcb;
bool m_titleSet = false;
GetWindowCallback m_gwcb;
SetScaleCallback m_sscb;
float m_notificationTime = 0;
std::string m_notificationText;