1
0
mirror of https://github.com/wolfpld/tracy synced 2025-05-01 13:13:53 +00:00

Pass big font to TracyView.

This commit is contained in:
Bartosz Taudul 2019-07-12 19:16:56 +02:00
parent fc28f827bc
commit 7fb9bde9e9
3 changed files with 13 additions and 9 deletions

View File

@ -449,7 +449,7 @@ int main( int argc, char** argv )
} }
connHistVec = RebuildConnectionHistory( connHistMap ); connHistVec = RebuildConnectionHistory( connHistMap );
view = std::make_unique<tracy::View>( addr, fixedWidth, SetWindowTitleCallback ); view = std::make_unique<tracy::View>( addr, fixedWidth, bigFont, SetWindowTitleCallback );
} }
ImGui::SameLine( 0, ImGui::GetFontSize() * 2 ); ImGui::SameLine( 0, ImGui::GetFontSize() * 2 );
if( ImGui::Button( ICON_FA_FOLDER_OPEN " Open saved trace" ) && !loadThread.joinable() ) if( ImGui::Button( ICON_FA_FOLDER_OPEN " Open saved trace" ) && !loadThread.joinable() )
@ -463,10 +463,10 @@ int main( int argc, char** argv )
auto f = std::shared_ptr<tracy::FileRead>( tracy::FileRead::Open( fn ) ); auto f = std::shared_ptr<tracy::FileRead>( tracy::FileRead::Open( fn ) );
if( f ) if( f )
{ {
loadThread = std::thread( [&view, f, &badVer, fixedWidth] { loadThread = std::thread( [&view, f, &badVer, fixedWidth, bigFont] {
try try
{ {
view = std::make_unique<tracy::View>( *f, fixedWidth, SetWindowTitleCallback ); view = std::make_unique<tracy::View>( *f, fixedWidth, bigFont, SetWindowTitleCallback );
} }
catch( const tracy::UnsupportedVersion& e ) catch( const tracy::UnsupportedVersion& e )
{ {
@ -514,7 +514,7 @@ int main( int argc, char** argv )
if( badProto ) flags |= ImGuiSelectableFlags_Disabled; if( badProto ) flags |= ImGuiSelectableFlags_Disabled;
if( ImGui::Selectable( name->second.c_str(), &sel, flags ) && !loadThread.joinable() ) if( ImGui::Selectable( name->second.c_str(), &sel, flags ) && !loadThread.joinable() )
{ {
view = std::make_unique<tracy::View>( v.second.address.c_str(), fixedWidth, SetWindowTitleCallback ); view = std::make_unique<tracy::View>( v.second.address.c_str(), fixedWidth, bigFont, SetWindowTitleCallback );
} }
ImGui::NextColumn(); ImGui::NextColumn();
const auto acttime = ( v.second.activeTime + ( time - v.second.time ) / 1000 ) * 1000000000ll; const auto acttime = ( v.second.activeTime + ( time - v.second.time ) / 1000 ) * 1000000000ll;

View File

@ -100,12 +100,13 @@ enum { MinFrameSize = 5 };
static View* s_instance = nullptr; static View* s_instance = nullptr;
View::View( const char* addr, ImFont* fixedWidth, SetTitleCallback stcb ) View::View( const char* addr, ImFont* fixedWidth, ImFont* bigFont, SetTitleCallback stcb )
: m_worker( addr ) : m_worker( addr )
, m_staticView( false ) , m_staticView( false )
, m_pause( false ) , m_pause( false )
, m_frames( nullptr ) , m_frames( nullptr )
, m_textEditorFont( fixedWidth ) , m_textEditorFont( fixedWidth )
, m_bigFont( bigFont )
, m_stcb( stcb ) , m_stcb( stcb )
{ {
assert( s_instance == nullptr ); assert( s_instance == nullptr );
@ -114,12 +115,13 @@ View::View( const char* addr, ImFont* fixedWidth, SetTitleCallback stcb )
InitTextEditor(); InitTextEditor();
} }
View::View( FileRead& f, ImFont* fixedWidth, SetTitleCallback stcb ) View::View( FileRead& f, ImFont* fixedWidth, ImFont* bigFont, SetTitleCallback stcb )
: m_worker( f ) : m_worker( f )
, m_staticView( true ) , m_staticView( true )
, m_pause( true ) , m_pause( true )
, m_frames( m_worker.GetFramesBase() ) , m_frames( m_worker.GetFramesBase() )
, m_textEditorFont( fixedWidth ) , m_textEditorFont( fixedWidth )
, m_bigFont( bigFont )
, m_stcb( stcb ) , m_stcb( stcb )
{ {
assert( s_instance == nullptr ); assert( s_instance == nullptr );

View File

@ -61,9 +61,9 @@ public:
using SetTitleCallback = void(*)( const char* ); using SetTitleCallback = void(*)( const char* );
View( ImFont* fixedWidth = nullptr, SetTitleCallback stcb = nullptr ) : View( "127.0.0.1", fixedWidth, stcb ) {} View( ImFont* fixedWidth = nullptr, ImFont* bigFont = nullptr, SetTitleCallback stcb = nullptr ) : View( "127.0.0.1", fixedWidth, bigFont, stcb ) {}
View( const char* addr, ImFont* fixedWidth = nullptr, SetTitleCallback stcb = nullptr ); View( const char* addr, ImFont* fixedWidth = nullptr, ImFont* bigFont = nullptr, SetTitleCallback stcb = nullptr );
View( FileRead& f, ImFont* fixedWidth = nullptr, SetTitleCallback stcb = nullptr ); View( FileRead& f, ImFont* fixedWidth = nullptr, ImFont* bigFont = nullptr, SetTitleCallback stcb = nullptr );
~View(); ~View();
static bool Draw(); static bool Draw();
@ -312,6 +312,8 @@ private:
ImFont* m_textEditorFont; ImFont* m_textEditorFont;
bool m_textEditorWhitespace = true; bool m_textEditorWhitespace = true;
ImFont* m_bigFont;
float m_rootWidth, m_rootHeight; float m_rootWidth, m_rootHeight;
SetTitleCallback m_stcb; SetTitleCallback m_stcb;
bool m_titleSet = false; bool m_titleSet = false;