mirror of
https://github.com/wolfpld/tracy.git
synced 2025-03-20 07:40:02 +08:00
Replace source file viewer with one that actually works.
This is much simpler, custom implementation of a text file viewer. It is able to perform these two tasks as intended: - center source view on the selected line, - highlight that line.
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
#include <vector>
|
||||
|
||||
struct ImFont;
|
||||
|
||||
namespace tracy
|
||||
{
|
||||
|
||||
class SourceView
|
||||
{
|
||||
struct Line
|
||||
{
|
||||
const char* begin;
|
||||
const char* end;
|
||||
};
|
||||
|
||||
public:
|
||||
SourceView( ImFont* font );
|
||||
~SourceView();
|
||||
|
||||
void Open( const char* fileName, int line );
|
||||
void Render();
|
||||
|
||||
private:
|
||||
void RenderLine( const Line& line, int lineNum );
|
||||
|
||||
ImFont* m_font;
|
||||
const char* m_file;
|
||||
char* m_data;
|
||||
size_t m_dataSize;
|
||||
int m_targetLine;
|
||||
int m_selectedLine;
|
||||
|
||||
std::vector<Line> m_lines;
|
||||
};
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user