impr: Moved pattern editor shortcuts to the Shortcut manager (#1892)

### Problem description
There are some recent issues about Mac keys not configured properly for
the pattern editor. This PR moves all the shortcuts to the shortcut
manager, so they can be edited at will. Even if the key is not
identified correctly it should be possible to use preferred keys for any
action.

---------

Co-authored-by: Nik <werwolv98@gmail.com>
This commit is contained in:
paxcut
2024-09-15 06:18:50 -07:00
committed by GitHub
parent 187d90e8f2
commit 4b3bbb4a97
6 changed files with 553 additions and 248 deletions

View File

@@ -22,6 +22,15 @@ namespace pl::ptrn { class Pattern; }
namespace hex::plugin::builtin {
constexpr static auto textEditorView = "/Pattern editor_";
constexpr static auto consoleView = "/##console_";
constexpr static auto variablesView = "/##env_vars_";
constexpr static auto settingsView = "/##settings_";
constexpr static auto sectionsView = "/##sections_table_";
constexpr static auto virtualFilesView = "/Virtual File Tree_";
constexpr static auto debuggerView = "/##debugger_";
class PatternSourceCode {
public:
const std::string& get(prv::Provider *provider) {
@@ -260,9 +269,13 @@ namespace hex::plugin::builtin {
u32 m_accessHistoryIndex = 0;
bool m_parentHighlightingEnabled = true;
bool m_replaceMode = false;
bool m_openFindReplacePopUp = false;
std::map<std::fs::path, std::string> m_patternNames;
ImRect m_textEditorHoverBox;
ImRect m_consoleHoverBox;
std::string m_focusedSubWindowName;
static inline std::array<std::string,256> m_findHistory;
static inline u32 m_findHistorySize = 0;
@@ -281,7 +294,7 @@ namespace hex::plugin::builtin {
void drawPatternTooltip(pl::ptrn::Pattern *pattern);
void drawFindReplaceDialog(std::string &findWord, bool &requestFocus, u64 &position, u64 &count, bool &updateCount);
void drawFindReplaceDialog(TextEditor *textEditor, std::string &findWord, bool &requestFocus, u64 &position, u64 &count, bool &updateCount, bool canReplace);
void historyInsert(std::array<std::string, 256> &history, u32 &size, u32 &index, const std::string &value);
@@ -290,6 +303,9 @@ namespace hex::plugin::builtin {
void parsePattern(const std::string &code, prv::Provider *provider);
void evaluatePattern(const std::string &code, prv::Provider *provider);
TextEditor *getEditorFromFocusedWindow();
void setupFindReplace(TextEditor *editor);
void registerEvents();
void registerMenuItems();
void registerHandlers();