From 37098d4db1195d3f18f396d839b4eda6942b1f8c Mon Sep 17 00:00:00 2001 From: hachem Date: Tue, 1 Sep 2026 03:49:18 +0200 Subject: feat: add preferences panel --- src/ui/source_view.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/ui/source_view.h') diff --git a/src/ui/source_view.h b/src/ui/source_view.h index d3b3ed5..2e1a20f 100644 --- a/src/ui/source_view.h +++ b/src/ui/source_view.h @@ -40,6 +40,13 @@ namespace Hsdbg auto draw(Debugger& debugger) -> void; auto set_highlighted_line(uint32_t line) -> void; + auto set_highlighting(bool enabled) -> void { m_highlighting_enabled = enabled; } + auto set_line_numbers(bool enabled) -> void { m_line_numbers = enabled; } + auto set_highlight_current_line(bool enabled) -> void { m_highlight_current_line = enabled; } + + // packed ImU32 (0xAABBGGRR) colours, one per SyntaxKind, index 0 unused + auto set_syntax_color(size_t kind, unsigned int color) -> void { m_syntax_colors[kind] = color; } + auto set_current_line_color(unsigned int color) -> void { m_current_line_color = color; } auto path() const -> const std::filesystem::path& { return m_path; } auto line_count() const -> size_t { return m_lines.size(); } @@ -53,6 +60,15 @@ namespace Hsdbg std::vector m_lines; std::vector> m_spans; bool m_highlight = false; + bool m_highlighting_enabled = true; + bool m_line_numbers = true; + bool m_highlight_current_line = true; + + // indexed by SyntaxKind; the defaults match the built-in dark palette + unsigned int m_syntax_colors[7] = { + 0, 0xFFD69C56, 0xFFB0C94E, 0xFF7891CE, 0xFFA8CEB5, 0xFF55996A, 0xFFC086C5, + }; + unsigned int m_current_line_color = 0xFF2E483A; std::string m_path_input; std::string m_error; uint32_t m_highlighted_line = 0; -- cgit v1.3