hachem.wtf
aboutsummaryrefslogtreecommitdiff
path: root/src/ui/source_view.h
diff options
context:
space:
mode:
authorhachem <im@hachem.wtf>2025-12-14 16:44:22 +0100
committerhachem <im@hachem.wtf>2025-12-14 16:44:22 +0100
commit0e8a995bc2cb5416228c12add93d10a631b7f952 (patch)
tree0c440a2a7c537df5f6bad73d901638d59fdd0470 /src/ui/source_view.h
parent643287696ea9baccc90a26643b6adb9fabcdf433 (diff)
feat: macro expansion
Diffstat (limited to 'src/ui/source_view.h')
-rw-r--r--src/ui/source_view.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/ui/source_view.h b/src/ui/source_view.h
index dd3ed27..6750d17 100644
--- a/src/ui/source_view.h
+++ b/src/ui/source_view.h
@@ -1,12 +1,16 @@
#pragma once
#include "core/result.h"
+#include "ui/macro_expander.h"
#include <cstdint>
#include <filesystem>
+#include <optional>
#include <string>
#include <vector>
+struct ImDrawList;
+
namespace Hsdbg
{
class Debugger;
@@ -20,6 +24,7 @@ namespace Hsdbg
Number,
Comment,
Preprocessor,
+ Macro,
};
struct SourceSpan
@@ -49,20 +54,30 @@ namespace Hsdbg
auto line_count() const -> size_t { return m_lines.size(); }
auto is_open() const -> bool { return !m_lines.empty(); }
+ auto macros() const -> const MacroTable& { return m_macros; }
+
+ auto take_macro_request() -> std::optional<std::string>;
+
private:
auto draw_open_bar() -> void;
auto draw_lines(Debugger& debugger) -> void;
+ auto draw_macro_span(ImDrawList* draw_list, const std::string& line,
+ const SourceSpan& span) -> void;
+
std::filesystem::path m_path;
std::vector<std::string> m_lines;
std::vector<std::vector<SourceSpan>> m_spans;
+ MacroTable m_macros;
+ std::optional<std::string> m_macro_request;
bool m_highlight = false;
bool m_highlighting_enabled = true;
bool m_line_numbers = true;
bool m_highlight_current_line = true;
- unsigned int m_syntax_colors[7] = {
+ unsigned int m_syntax_colors[8] = {
0, 0xFFD69C56, 0xFFB0C94E, 0xFF7891CE, 0xFFA8CEB5, 0xFF55996A, 0xFFC086C5,
+ 0xFF4FA3E0,
};
unsigned int m_current_line_color = 0xFF2E483A;
std::string m_path_input;