mirror of
https://github.com/wolfpld/tracy.git
synced 2025-03-20 07:40:02 +08:00
Adding a copy button to the source view.
This commit is contained in:
@@ -33,6 +33,7 @@ void SourceContents::Parse( const char* fileName, const Worker& worker, const Vi
|
||||
if( srcCache.data != nullptr )
|
||||
{
|
||||
m_data = srcCache.data;
|
||||
m_dataSize = srcCache.len;
|
||||
sz = srcCache.len;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -27,6 +27,8 @@ public:
|
||||
const char* filename() const { return m_file; }
|
||||
uint32_t idx() const { return m_fileStringIdx; }
|
||||
bool is_cached() const { return m_data != m_dataBuf; }
|
||||
const char* data() const { return m_data; }
|
||||
size_t data_size() const { return m_dataSize; }
|
||||
|
||||
private:
|
||||
const char* m_file;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include <ctype.h>
|
||||
#include <inttypes.h>
|
||||
#include <sstream>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <capstone.h>
|
||||
@@ -1058,6 +1059,17 @@ void SourceView::Render( Worker& worker, View& view )
|
||||
|
||||
if( m_symAddr == 0 )
|
||||
{
|
||||
ImGui::PushFont( m_bigFont );
|
||||
if( ClipboardButton() )
|
||||
{
|
||||
std::ostringstream stream;
|
||||
stream.write( m_source.data(), m_source.data_size() );
|
||||
ImGui::SetClipboardText( stream.str().c_str() );
|
||||
}
|
||||
ImGui::PopFont();
|
||||
ImGui::SameLine();
|
||||
ImGui::Spacing();
|
||||
ImGui::SameLine();
|
||||
if( m_source.filename() )
|
||||
{
|
||||
ImGui::PushFont( m_bigFont );
|
||||
|
||||
Reference in New Issue
Block a user