mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 02:31:48 +00:00
Pass global config to View.
This commit is contained in:
parent
1dd0341cff
commit
a2d470690f
@ -30,6 +30,7 @@
|
||||
#include "../../server/tracy_pdqsort.h"
|
||||
#include "../../server/tracy_robin_hood.h"
|
||||
#include "../../server/TracyBadVersion.hpp"
|
||||
#include "../../server/TracyConfig.hpp"
|
||||
#include "../../server/TracyFileHeader.hpp"
|
||||
#include "../../server/TracyFileRead.hpp"
|
||||
#include "../../server/TracyFileselector.hpp"
|
||||
@ -107,6 +108,7 @@ void* zigzagTex;
|
||||
static Backend* bptr;
|
||||
static bool s_customTitle = false;
|
||||
static bool s_isElevated = false;
|
||||
static tracy::Config s_config;
|
||||
|
||||
static void SetWindowTitleCallback( const char* title )
|
||||
{
|
||||
@ -260,12 +262,12 @@ int main( int argc, char** argv )
|
||||
|
||||
if( initFileOpen )
|
||||
{
|
||||
view = std::make_unique<tracy::View>( RunOnMainThread, *initFileOpen, s_fixedWidth, s_smallFont, s_bigFont, SetWindowTitleCallback, SetupScaleCallback, AttentionCallback );
|
||||
view = std::make_unique<tracy::View>( RunOnMainThread, *initFileOpen, s_fixedWidth, s_smallFont, s_bigFont, SetWindowTitleCallback, SetupScaleCallback, AttentionCallback, s_config );
|
||||
initFileOpen.reset();
|
||||
}
|
||||
else if( connectTo )
|
||||
{
|
||||
view = std::make_unique<tracy::View>( RunOnMainThread, connectTo, port, s_fixedWidth, s_smallFont, s_bigFont, SetWindowTitleCallback, SetupScaleCallback, AttentionCallback );
|
||||
view = std::make_unique<tracy::View>( RunOnMainThread, connectTo, port, s_fixedWidth, s_smallFont, s_bigFont, SetWindowTitleCallback, SetupScaleCallback, AttentionCallback, s_config );
|
||||
}
|
||||
|
||||
tracy::Fileselector::Init();
|
||||
@ -663,11 +665,11 @@ static void DrawContents()
|
||||
{
|
||||
std::string addrPart = std::string( addr, ptr );
|
||||
uint16_t portPart = (uint16_t)atoi( ptr+1 );
|
||||
view = std::make_unique<tracy::View>( RunOnMainThread, addrPart.c_str(), portPart, s_fixedWidth, s_smallFont, s_bigFont, SetWindowTitleCallback, SetupScaleCallback, AttentionCallback );
|
||||
view = std::make_unique<tracy::View>( RunOnMainThread, addrPart.c_str(), portPart, s_fixedWidth, s_smallFont, s_bigFont, SetWindowTitleCallback, SetupScaleCallback, AttentionCallback, s_config );
|
||||
}
|
||||
else
|
||||
{
|
||||
view = std::make_unique<tracy::View>( RunOnMainThread, addr, port, s_fixedWidth, s_smallFont, s_bigFont, SetWindowTitleCallback, SetupScaleCallback, AttentionCallback );
|
||||
view = std::make_unique<tracy::View>( RunOnMainThread, addr, port, s_fixedWidth, s_smallFont, s_bigFont, SetWindowTitleCallback, SetupScaleCallback, AttentionCallback, s_config );
|
||||
}
|
||||
}
|
||||
ImGui::SameLine( 0, ImGui::GetTextLineHeight() * 2 );
|
||||
@ -684,7 +686,7 @@ static void DrawContents()
|
||||
loadThread = std::thread( [f] {
|
||||
try
|
||||
{
|
||||
view = std::make_unique<tracy::View>( RunOnMainThread, *f, s_fixedWidth, s_smallFont, s_bigFont, SetWindowTitleCallback, SetupScaleCallback, AttentionCallback );
|
||||
view = std::make_unique<tracy::View>( RunOnMainThread, *f, s_fixedWidth, s_smallFont, s_bigFont, SetWindowTitleCallback, SetupScaleCallback, AttentionCallback, s_config );
|
||||
}
|
||||
catch( const tracy::UnsupportedVersion& e )
|
||||
{
|
||||
@ -812,7 +814,7 @@ static void DrawContents()
|
||||
}
|
||||
if( selected && !loadThread.joinable() )
|
||||
{
|
||||
view = std::make_unique<tracy::View>( RunOnMainThread, v.second.address.c_str(), v.second.port, s_fixedWidth, s_smallFont, s_bigFont, SetWindowTitleCallback, SetupScaleCallback, AttentionCallback );
|
||||
view = std::make_unique<tracy::View>( RunOnMainThread, v.second.address.c_str(), v.second.port, s_fixedWidth, s_smallFont, s_bigFont, SetWindowTitleCallback, SetupScaleCallback, AttentionCallback, s_config );
|
||||
}
|
||||
ImGui::NextColumn();
|
||||
const auto acttime = ( v.second.activeTime + ( time - v.second.time ) / 1000 ) * 1000000000ll;
|
||||
@ -981,7 +983,7 @@ static void DrawContents()
|
||||
viewShutdown.store( ViewShutdown::False, std::memory_order_relaxed );
|
||||
if( reconnect )
|
||||
{
|
||||
view = std::make_unique<tracy::View>( RunOnMainThread, reconnectAddr.c_str(), reconnectPort, s_fixedWidth, s_smallFont, s_bigFont, SetWindowTitleCallback, SetupScaleCallback, AttentionCallback );
|
||||
view = std::make_unique<tracy::View>( RunOnMainThread, reconnectAddr.c_str(), reconnectPort, s_fixedWidth, s_smallFont, s_bigFont, SetWindowTitleCallback, SetupScaleCallback, AttentionCallback, s_config );
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -44,7 +44,7 @@ namespace tracy
|
||||
|
||||
double s_time = 0;
|
||||
|
||||
View::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 )
|
||||
View::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 )
|
||||
: m_worker( addr, port )
|
||||
, m_staticView( false )
|
||||
, m_viewMode( ViewMode::LastFrames )
|
||||
@ -68,7 +68,7 @@ View::View( void(*cbMainThread)(const std::function<void()>&, bool), const char*
|
||||
InitTextEditor();
|
||||
}
|
||||
|
||||
View::View( void(*cbMainThread)(const std::function<void()>&, bool), FileRead& f, ImFont* fixedWidth, ImFont* smallFont, ImFont* bigFont, SetTitleCallback stcb, SetScaleCallback sscb, AttentionCallback acb )
|
||||
View::View( void(*cbMainThread)(const std::function<void()>&, bool), FileRead& f, ImFont* fixedWidth, ImFont* smallFont, ImFont* bigFont, SetTitleCallback stcb, SetScaleCallback sscb, AttentionCallback acb, const Config& config )
|
||||
: m_worker( f )
|
||||
, m_filename( f.GetFilename() )
|
||||
, m_staticView( true )
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
#include "TracyBadVersion.hpp"
|
||||
#include "TracyBuzzAnim.hpp"
|
||||
#include "TracyConfig.hpp"
|
||||
#include "TracyDecayValue.hpp"
|
||||
#include "TracyFileWrite.hpp"
|
||||
#include "TracyShortPtr.hpp"
|
||||
@ -101,8 +102,8 @@ public:
|
||||
using SetScaleCallback = void(*)( float, ImFont*&, ImFont*&, ImFont*& );
|
||||
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 );
|
||||
View( void(*cbMainThread)(const std::function<void()>&, bool), FileRead& f, ImFont* fixedWidth, ImFont* smallFont, ImFont* bigFont, SetTitleCallback stcb, SetScaleCallback sscb, AttentionCallback acb );
|
||||
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 );
|
||||
View( void(*cbMainThread)(const std::function<void()>&, bool), FileRead& f, ImFont* fixedWidth, ImFont* smallFont, ImFont* bigFont, SetTitleCallback stcb, SetScaleCallback sscb, AttentionCallback acb, const Config& config );
|
||||
~View();
|
||||
|
||||
bool Draw();
|
||||
|
Loading…
Reference in New Issue
Block a user