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

Draw text editor with potential source code.

This commit is contained in:
Bartosz Taudul 2018-08-17 15:33:12 +02:00
parent 77a875ff6b
commit facae0b9e1
2 changed files with 15 additions and 0 deletions

View File

@ -595,6 +595,7 @@ bool View::DrawImpl()
if( m_callstackInfoWindow != 0 ) DrawCallstackWindow();
if( m_memoryAllocInfoWindow >= 0 ) DrawMemoryAllocWindow();
if( m_showInfo ) DrawInfo();
if( m_textEditorFile ) DrawTextEditor();
if( m_zoomAnim.active )
{
@ -5830,6 +5831,19 @@ void View::DrawInfo()
ImGui::End();
}
void View::DrawTextEditor()
{
bool show = true;
ImGui::Begin( "Source view", &show );
ImGui::TextColored( ImVec4( 1.f, 0.3f, 0.3f, 1.f ), "/!\\ The source file contents might not reflect the actual profiled code! /!\\" );
TextFocused( "File:", m_textEditorFile );
if( m_textEditorFont ) ImGui::PushFont( m_textEditorFont );
m_textEditor->Render( m_textEditorFile, ImVec2(), true );
if( m_textEditorFont ) ImGui::PopFont();
ImGui::End();
if( !show ) m_textEditorFile = nullptr;
}
template<class T>
void View::ListMemData( T ptr, T end, std::function<void(T&)> DrawAddress, const char* id )
{

View File

@ -92,6 +92,7 @@ private:
void DrawCallstackWindow();
void DrawMemoryAllocWindow();
void DrawInfo();
void DrawTextEditor();
template<class T>
void ListMemData( T ptr, T end, std::function<void(T&)> DrawAddress, const char* id = nullptr );