feat(editor): enhance card-based editor functionality and streamline initialization

- Updated EditorManager to support new card-based editors, including Emulator, Hex, and Assembly editors.
- Added centralized registration of editor cards with EditorCardManager, improving visibility management.
- Implemented methods to retrieve editor types from categories and manage card visibility dynamically.
- Enhanced initialization processes for various editors to ensure proper card registration and default visibility settings.

Benefits:
- Improved user experience by organizing editor cards and providing quick access to new editor functionalities.
- Streamlined editor management, making it easier to switch between different editing contexts and enhancing overall workflow efficiency.
This commit is contained in:
scawful
2025-10-12 20:43:42 -04:00
parent bdb2d1ed14
commit e5aff24bfc
22 changed files with 595 additions and 670 deletions

View File

@@ -140,25 +140,37 @@ std::vector<ImGuiKey> ParseShortcut(const std::string& shortcut) {
void ExecuteShortcuts(const ShortcutManager& shortcut_manager) {
// Check for keyboard shortcuts using the shortcut manager
for (const auto& shortcut : shortcut_manager.GetShortcuts()) {
bool keys_pressed = true;
// Check for all the keys in the shortcut
bool modifiers_held = true;
bool key_pressed = false;
ImGuiKey main_key = ImGuiKey_None;
// Separate modifiers from main key
for (const auto& key : shortcut.second.keys) {
if (key == ImGuiMod_Ctrl) {
keys_pressed &= ImGui::GetIO().KeyCtrl;
} else if (key == ImGuiMod_Alt) {
keys_pressed &= ImGui::GetIO().KeyAlt;
} else if (key == ImGuiMod_Shift) {
keys_pressed &= ImGui::GetIO().KeyShift;
} else if (key == ImGuiMod_Super) {
keys_pressed &= ImGui::GetIO().KeySuper;
if (key == ImGuiMod_Ctrl || key == ImGuiMod_Alt ||
key == ImGuiMod_Shift || key == ImGuiMod_Super) {
// Check if modifier is held
if (key == ImGuiMod_Ctrl) {
modifiers_held &= ImGui::GetIO().KeyCtrl;
} else if (key == ImGuiMod_Alt) {
modifiers_held &= ImGui::GetIO().KeyAlt;
} else if (key == ImGuiMod_Shift) {
modifiers_held &= ImGui::GetIO().KeyShift;
} else if (key == ImGuiMod_Super) {
modifiers_held &= ImGui::GetIO().KeySuper;
}
} else {
keys_pressed &= ImGui::IsKeyDown(key);
}
if (!keys_pressed) {
break;
// This is the main key - use IsKeyPressed for single trigger
main_key = key;
}
}
if (keys_pressed) {
// Check if main key was pressed (not just held)
if (main_key != ImGuiKey_None) {
key_pressed = ImGui::IsKeyPressed(main_key, false); // false = no repeat
}
// Execute if modifiers held and key pressed
if (modifiers_held && key_pressed && shortcut.second.callback) {
shortcut.second.callback();
}
}