mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-02 13:37:42 -05:00
feat: Added basic Pattern Language debugger
This commit is contained in:
15
lib/external/imgui/source/TextEditor.cpp
vendored
15
lib/external/imgui/source/TextEditor.cpp
vendored
@@ -823,14 +823,8 @@ void TextEditor::Render() {
|
||||
drawList->AddRectFilled(vstart, vend, mPalette[(int)PaletteIndex::Selection]);
|
||||
}
|
||||
|
||||
// Draw breakpoints
|
||||
auto start = ImVec2(lineStartScreenPos.x + scrollX, lineStartScreenPos.y);
|
||||
|
||||
if (mBreakpoints.count(lineNo + 1) != 0) {
|
||||
auto end = ImVec2(lineStartScreenPos.x + contentSize.x + 2.0f * scrollX, lineStartScreenPos.y + mCharAdvance.y);
|
||||
drawList->AddRectFilled(start, end, mPalette[(int)PaletteIndex::Breakpoint]);
|
||||
}
|
||||
|
||||
// Draw error markers
|
||||
auto errorIt = mErrorMarkers.find(lineNo + 1);
|
||||
if (errorIt != mErrorMarkers.end()) {
|
||||
@@ -856,6 +850,15 @@ void TextEditor::Render() {
|
||||
auto lineNoWidth = ImGui::GetFont()->CalcTextSizeA(ImGui::GetFontSize(), FLT_MAX, -1.0f, buf, nullptr, nullptr).x;
|
||||
drawList->AddText(ImVec2(lineStartScreenPos.x + mTextStart - lineNoWidth, lineStartScreenPos.y), mPalette[(int)PaletteIndex::LineNumber], buf);
|
||||
|
||||
// Draw breakpoints
|
||||
if (mBreakpoints.count(lineNo + 1) != 0) {
|
||||
auto end = ImVec2(lineStartScreenPos.x + contentSize.x + 2.0f * scrollX, lineStartScreenPos.y + mCharAdvance.y);
|
||||
drawList->AddRectFilled(start + ImVec2(mTextStart, 0), end, mPalette[(int)PaletteIndex::Breakpoint]);
|
||||
|
||||
drawList->AddCircleFilled(start + ImVec2(0, mCharAdvance.y) / 2, mCharAdvance.y / 3, mPalette[(int)PaletteIndex::Breakpoint]);
|
||||
drawList->AddCircle(start + ImVec2(0, mCharAdvance.y) / 2, mCharAdvance.y / 3, mPalette[(int)PaletteIndex::Default]);
|
||||
}
|
||||
|
||||
if (mState.mCursorPosition.mLine == lineNo) {
|
||||
auto focused = ImGui::IsWindowFocused();
|
||||
|
||||
|
||||
@@ -15,8 +15,7 @@ namespace hex {
|
||||
|
||||
class View;
|
||||
|
||||
enum class Keys
|
||||
{
|
||||
enum class Keys {
|
||||
Space = GLFW_KEY_SPACE,
|
||||
Apostrophe = GLFW_KEY_APOSTROPHE,
|
||||
Comma = GLFW_KEY_COMMA,
|
||||
@@ -144,11 +143,12 @@ namespace hex {
|
||||
};
|
||||
|
||||
|
||||
constexpr static auto CTRL = Key(static_cast<Keys>(0x0100'0000));
|
||||
constexpr static auto ALT = Key(static_cast<Keys>(0x0200'0000));
|
||||
constexpr static auto SHIFT = Key(static_cast<Keys>(0x0400'0000));
|
||||
constexpr static auto SUPER = Key(static_cast<Keys>(0x0800'0000));
|
||||
constexpr static auto CurrentView = Key(static_cast<Keys>(0x1000'0000));
|
||||
constexpr static auto CTRL = Key(static_cast<Keys>(0x0100'0000));
|
||||
constexpr static auto ALT = Key(static_cast<Keys>(0x0200'0000));
|
||||
constexpr static auto SHIFT = Key(static_cast<Keys>(0x0400'0000));
|
||||
constexpr static auto SUPER = Key(static_cast<Keys>(0x0800'0000));
|
||||
constexpr static auto CurrentView = Key(static_cast<Keys>(0x1000'0000));
|
||||
constexpr static auto AllowWhileTyping = Key(static_cast<Keys>(0x2000'0000));
|
||||
|
||||
#if defined (OS_MACOS)
|
||||
constexpr static auto CTRLCMD = SUPER;
|
||||
|
||||
@@ -37,18 +37,23 @@ namespace hex {
|
||||
void ShortcutManager::process(const std::unique_ptr<View> ¤tView, bool ctrl, bool alt, bool shift, bool super, bool focused, u32 keyCode) {
|
||||
Shortcut pressedShortcut = getShortcut(ctrl, alt, shift, super, focused, keyCode);
|
||||
|
||||
if (ImGui::GetIO().WantTextInput)
|
||||
return;
|
||||
|
||||
if (currentView->m_shortcuts.contains(pressedShortcut))
|
||||
currentView->m_shortcuts[pressedShortcut]();
|
||||
if (currentView->m_shortcuts.contains(pressedShortcut + AllowWhileTyping)) {
|
||||
currentView->m_shortcuts[pressedShortcut + AllowWhileTyping]();
|
||||
} else if (currentView->m_shortcuts.contains(pressedShortcut)) {
|
||||
if (!ImGui::GetIO().WantTextInput)
|
||||
currentView->m_shortcuts[pressedShortcut]();
|
||||
}
|
||||
}
|
||||
|
||||
void ShortcutManager::processGlobals(bool ctrl, bool alt, bool shift, bool super, u32 keyCode) {
|
||||
Shortcut pressedShortcut = getShortcut(ctrl, alt, shift, super, false, keyCode);
|
||||
|
||||
if (ShortcutManager::s_globalShortcuts.contains(pressedShortcut))
|
||||
ShortcutManager::s_globalShortcuts[pressedShortcut]();
|
||||
if (ShortcutManager::s_globalShortcuts.contains(pressedShortcut + AllowWhileTyping)) {
|
||||
ShortcutManager::s_globalShortcuts[pressedShortcut + AllowWhileTyping]();
|
||||
} else if (ShortcutManager::s_globalShortcuts.contains(pressedShortcut)) {
|
||||
if (!ImGui::GetIO().WantTextInput)
|
||||
ShortcutManager::s_globalShortcuts[pressedShortcut]();
|
||||
}
|
||||
}
|
||||
|
||||
void ShortcutManager::clearShortcuts() {
|
||||
|
||||
Reference in New Issue
Block a user