mirror of
https://github.com/wolfpld/tracy.git
synced 2026-10-23 01:00:54 +00:00
Access the user manual window through a process singleton.
The per-view and welcome-screen instances were interchangeable handles to shared state; one instance preserves that state across view recreation.
This commit is contained in:
@@ -597,8 +597,7 @@ static void DrawContents()
|
||||
static std::string reconnectAddr;
|
||||
static uint16_t reconnectPort;
|
||||
static bool showFilter = false;
|
||||
static tracy::ManualWindow s_manualWindow( tracy::GetManualData() );
|
||||
static tracy::Markdown s_manualMarkdown( nullptr, nullptr, &s_manualWindow );
|
||||
static tracy::Markdown s_manualMarkdown( nullptr, nullptr, &tracy::GetManualWindow() );
|
||||
|
||||
#ifndef __EMSCRIPTEN__
|
||||
UpdateBroadcastClients();
|
||||
@@ -834,7 +833,7 @@ static void DrawContents()
|
||||
ImGui::Spacing();
|
||||
if( ImGui::Button( ICON_FA_BOOK " Manual" ) )
|
||||
{
|
||||
s_manualWindow.Show() = true;
|
||||
tracy::GetManualWindow().Show() = true;
|
||||
}
|
||||
ImGui::SameLine();
|
||||
if( ImGui::Button( ICON_FA_EARTH_AMERICAS " Web" ) )
|
||||
@@ -1585,10 +1584,10 @@ Would you like to enable achievements?
|
||||
}
|
||||
}
|
||||
|
||||
if( s_manualWindow.Show() )
|
||||
if( tracy::GetManualWindow().Show() )
|
||||
{
|
||||
if( tracy::s_config.achievements ) s_achievements->Achieve( "manual" );
|
||||
if( !viewPtr ) s_manualWindow.Draw( s_manualMarkdown );
|
||||
if( !viewPtr ) tracy::GetManualWindow().Draw( s_manualMarkdown );
|
||||
}
|
||||
|
||||
bptr->EndFrame();
|
||||
|
||||
@@ -172,7 +172,7 @@ std::string TracyLlmChat::ToolCallDescription( const nlohmann::json& json ) cons
|
||||
|
||||
TracyLlmChat::TracyLlmChat( View& view, Worker& worker, const std::vector<LlmSkill>& skills )
|
||||
: m_width( new float[NumRoles] )
|
||||
, m_markdown( &view, &worker, &view.GetManualWindow() )
|
||||
, m_markdown( &view, &worker, &GetManualWindow() )
|
||||
, m_skills( skills )
|
||||
, m_worker( worker )
|
||||
, m_view( view )
|
||||
|
||||
@@ -201,4 +201,10 @@ bool ManualWindow::Navigate( const char* anchor )
|
||||
return true;
|
||||
}
|
||||
|
||||
ManualWindow& GetManualWindow()
|
||||
{
|
||||
static ManualWindow window( GetManualData() );
|
||||
return window;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -28,6 +28,8 @@ private:
|
||||
bool& m_show;
|
||||
};
|
||||
|
||||
ManualWindow& GetManualWindow();
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -55,8 +55,7 @@ View::View( void(*cbMainThread)(const std::function<void()>&, bool), const char*
|
||||
, m_horizontalScrollMultiplier( s_config.horizontalScrollMultiplier )
|
||||
, m_verticalScrollMultiplier( s_config.verticalScrollMultiplier )
|
||||
, m_manualData( GetManualData() )
|
||||
, m_manualWindow( m_manualData )
|
||||
, m_markdown( this, &m_worker, &m_manualWindow )
|
||||
, m_markdown( this, &m_worker, &GetManualWindow() )
|
||||
#ifdef __EMSCRIPTEN__
|
||||
, m_td( 2, "ViewMt" )
|
||||
#else
|
||||
@@ -88,8 +87,7 @@ View::View( void(*cbMainThread)(const std::function<void()>&, bool), FileRead& f
|
||||
, m_horizontalScrollMultiplier( s_config.horizontalScrollMultiplier )
|
||||
, m_verticalScrollMultiplier( s_config.verticalScrollMultiplier )
|
||||
, m_manualData( GetManualData() )
|
||||
, m_manualWindow( m_manualData )
|
||||
, m_markdown( this, &m_worker, &m_manualWindow )
|
||||
, m_markdown( this, &m_worker, &GetManualWindow() )
|
||||
#ifdef __EMSCRIPTEN__
|
||||
, m_td( 2, "ViewMt" )
|
||||
#else
|
||||
@@ -1019,7 +1017,7 @@ bool View::DrawImpl()
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
ImGui::SameLine();
|
||||
ToggleButton( ICON_FA_BOOK, m_manualWindow.Show() );
|
||||
ToggleButton( ICON_FA_BOOK, GetManualWindow().Show() );
|
||||
if( m_sscb )
|
||||
{
|
||||
ImGui::SameLine();
|
||||
@@ -1236,7 +1234,7 @@ bool View::DrawImpl()
|
||||
if( m_sampleParents.symAddr != 0 ) DrawSampleParents();
|
||||
if( m_showRanges ) DrawRanges();
|
||||
if( m_showWaitStacks ) DrawWaitStacks();
|
||||
if( m_manualWindow.Show() ) m_manualWindow.Draw( m_markdown );
|
||||
if( GetManualWindow().Show() ) GetManualWindow().Draw( m_markdown );
|
||||
if( m_showFrameStatistics ) DrawFrameStatistics();
|
||||
#ifndef __EMSCRIPTEN__
|
||||
if( m_llm.m_show ) m_llm.Draw( m_llmConstraint );
|
||||
|
||||
@@ -168,8 +168,6 @@ public:
|
||||
void ViewSymbol( const char* fileName, int line, uint64_t baseAddr, uint64_t symAddr );
|
||||
bool ViewDispatch( const char* fileName, int line, uint64_t symAddr );
|
||||
|
||||
ManualWindow& GetManualWindow() { return m_manualWindow; }
|
||||
|
||||
bool ReconnectRequested() const { return m_reconnectRequested; }
|
||||
std::string GetAddress() const { return m_worker.GetAddr(); }
|
||||
uint16_t GetPort() const { return m_worker.GetPort(); }
|
||||
@@ -1081,7 +1079,6 @@ private:
|
||||
double m_verticalScrollMultiplier = 1.0;
|
||||
|
||||
const TracyManualData& m_manualData;
|
||||
ManualWindow m_manualWindow;
|
||||
Markdown m_markdown;
|
||||
|
||||
TaskDispatch m_td;
|
||||
|
||||
Reference in New Issue
Block a user