aboutsummaryrefslogtreecommitdiff
path: root/src/ui/source_view.h
diff options
context:
space:
mode:
authorhachem <im@hachem.wtf>2026-09-01 03:49:18 +0200
committerhachem <im@hachem.wtf>2026-09-01 03:49:18 +0200
commit37098d4db1195d3f18f396d839b4eda6942b1f8c (patch)
tree9f988de3e33c333e5f1b1696dfb8c8d958ed91fe /src/ui/source_view.h
parentdc384ed13dc22d2640a20fbb030531b7f5d97502 (diff)
feat: add preferences panel
Diffstat (limited to 'src/ui/source_view.h')
-rw-r--r--src/ui/source_view.h16
1 files changed, 16 insertions, 0 deletions
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<std::string> m_lines;
std::vector<std::vector<SourceSpan>> 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;