Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: full syntax highlights and interactive compiler error reporting indicated using a red squiggly line under the affected symbols. #1700

Draft
wants to merge 18 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
10b398f
feat: full syntax highlights and interactive compiler error reporting…
paxcut May 23, 2024
a15db96
fix: changed all unsigned to uint32_t or uint64_t.
paxcut May 23, 2024
9e2516b
Merge branch 'WerWolv:master' into enhanceTextEditor
paxcut May 23, 2024
35cefd3
Merge branch 'master' into enhanceTextEditor
paxcut Jul 30, 2024
ebfb047
Merge branch 'WerWolv:master' into enhanceTextEditor
paxcut Aug 3, 2024
f84a493
Merge branch 'master' into enhanceTextEditor
paxcut Aug 3, 2024
1356637
Merge branch 'master' into enhanceTextEditor
paxcut Aug 3, 2024
4ac2ee7
Improvements to the Pattern editor including full syntax highlights a…
paxcut Aug 4, 2024
c08742a
Fix: global variables not handled properly when only global scope exi…
paxcut Aug 5, 2024
d624497
Merge branch 'WerWolv:master' into enhanceTextEditor
paxcut Aug 10, 2024
0484087
improv: Made m_tokens a const reference to avoid copies.
paxcut Aug 12, 2024
6ef844c
fix: Double-clicking on a string with no spaces could also select clo…
paxcut Aug 12, 2024
88f723c
fix: Scope resolution chains were not being processed correctly in pa…
paxcut Aug 13, 2024
d7cfdcf
fix: Global variables were not highlighting correctly because they we…
paxcut Aug 16, 2024
14644ad
These changes are mostly to correct cppcheck areas of concern but not…
paxcut Aug 18, 2024
d54c1dc
Merge branch 'WerWolv:master' into enhanceTextEditor
paxcut Aug 20, 2024
7cc4f53
Merge branch 'WerWolv:master' into enhanceTextEditor
paxcut Aug 24, 2024
f0d5d77
Merge branch 'master' into enhanceTextEditor
paxcut Sep 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/libimhex/include/hex/ui/imgui_imhex_extensions.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ namespace ImGuiExt {
void HelpHover(const char *text, const char *icon = "(?)", ImU32 iconColor = ImGui::GetColorU32(ImGuiCol_ButtonActive));

void UnderlinedText(const char *label, ImColor color = ImGui::GetStyleColorVec4(ImGuiCol_Text), const ImVec2 &size_arg = ImVec2(0, 0));

void UnderSquiggledText(const char *label, ImColor textColor = ImGui::GetStyleColorVec4(ImGuiCol_Text), ImColor lineColor = ImGui::GetStyleColorVec4(ImGuiCol_Text), const ImVec2 &size_arg = ImVec2(0, 0));
void TextSpinner(const char *label);

void Header(const char *label, bool firstEntry = false);
Expand Down
28 changes: 28 additions & 0 deletions lib/libimhex/source/ui/imgui_imhex_extensions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,34 @@ namespace ImGuiExt {
PopStyleColor();
}

void UnderSquiggledText(const char *label, ImColor textColor, ImColor lineColor, const ImVec2 &size_arg) {
ImGuiWindow *window = GetCurrentWindow();
std::string labelStr(label);
for (char letter : labelStr) {
std::string letterStr(1, letter);
const ImVec2 label_size = CalcTextSize(letterStr.c_str(), nullptr, true);
ImVec2 size = CalcItemSize(size_arg, label_size.x, label_size.y);
ImVec2 pos = window->DC.CursorPos;
float lineWidth = size.x / 3.0f;
float halfLineW = lineWidth / 2.0f;
float lineY = pos.y + size.y;
ImVec2 initial = ImVec2(pos.x, lineY);
ImVec2 pos1 = ImVec2(pos.x + lineWidth, lineY - 2.0f);
ImVec2 pos2 = ImVec2(pos.x + lineWidth + halfLineW, lineY);
ImVec2 pos3 = ImVec2(pos.x + lineWidth * 2 + halfLineW, lineY - 2.0f);
ImVec2 pos4 = ImVec2(pos.x + lineWidth * 3, lineY - 1.0f);

PushStyleColor(ImGuiCol_Text, ImU32(textColor));
TextEx(letterStr.c_str(), nullptr, ImGuiTextFlags_NoWidthForLargeClippedText); // Skip formatting
GetWindowDrawList()->AddLine(initial, pos1, ImU32(lineColor),0.4f);
GetWindowDrawList()->AddLine(pos1, pos2, ImU32(lineColor),0.3f);
GetWindowDrawList()->AddLine(pos2, pos3, ImU32(lineColor),0.4f);
GetWindowDrawList()->AddLine(pos3, pos4, ImU32(lineColor),0.3f);
PopStyleColor();
window->DC.CursorPos = ImVec2(pos.x + size.x, pos.y);
}
}

void TextSpinner(const char *label) {
Text("[%c] %s", "|/-\\"[ImU32(GetTime() * 20) % 4], label);
}
Expand Down
Loading
Loading