housekeeping

This commit is contained in:
scawful
2024-07-23 21:02:44 -04:00
parent 8672ab4372
commit e7c5cf59a6
3 changed files with 18 additions and 25 deletions

View File

@@ -42,6 +42,7 @@ namespace editor {
using ImGui::BeginMenu; using ImGui::BeginMenu;
using ImGui::BulletText; using ImGui::BulletText;
using ImGui::Checkbox; using ImGui::Checkbox;
using ImGui::IsKeyDown;
using ImGui::MenuItem; using ImGui::MenuItem;
using ImGui::SameLine; using ImGui::SameLine;
using ImGui::Separator; using ImGui::Separator;
@@ -275,9 +276,10 @@ void MasterEditor::ManageActiveEditors() {
} }
void MasterEditor::ManageKeyboardShortcuts() { void MasterEditor::ManageKeyboardShortcuts() {
bool ctrl_or_super = (ImGui::GetIO().KeyCtrl || ImGui::GetIO().KeySuper);
// If CMD + R is pressed, reload the top result of recent files // If CMD + R is pressed, reload the top result of recent files
if (ImGui::IsKeyDown(ImGuiKey_R) && if (IsKeyDown(ImGuiKey_R) && ctrl_or_super) {
(ImGui::GetIO().KeyCtrl || ImGui::GetIO().KeySuper)) {
static RecentFilesManager manager("recent_files.txt"); static RecentFilesManager manager("recent_files.txt");
manager.Load(); manager.Load();
if (!manager.GetRecentFiles().empty()) { if (!manager.GetRecentFiles().empty()) {
@@ -287,55 +289,46 @@ void MasterEditor::ManageKeyboardShortcuts() {
} }
} }
if (ImGui::IsKeyDown(ImGuiKey_F1)) { if (IsKeyDown(ImGuiKey_F1)) {
about_ = true; about_ = true;
} }
// If CMD + Q is pressed, quit the application // If CMD + Q is pressed, quit the application
if (ImGui::IsKeyDown(ImGuiKey_Q) && if (IsKeyDown(ImGuiKey_Q) && ctrl_or_super) {
(ImGui::GetIO().KeyCtrl || ImGui::GetIO().KeySuper)) {
quit_ = true; quit_ = true;
} }
// If CMD + O is pressed, open a file dialog // If CMD + O is pressed, open a file dialog
if (ImGui::IsKeyDown(ImGuiKey_O) && if (IsKeyDown(ImGuiKey_O) && ctrl_or_super) {
(ImGui::GetIO().KeyCtrl || ImGui::GetIO().KeySuper)) {
LoadRom(); LoadRom();
} }
// If CMD + S is pressed, save the current ROM // If CMD + S is pressed, save the current ROM
if (ImGui::IsKeyDown(ImGuiKey_S) && if (IsKeyDown(ImGuiKey_S) && ctrl_or_super) {
(ImGui::GetIO().KeyCtrl || ImGui::GetIO().KeySuper)) {
SaveRom(); SaveRom();
} }
if (ImGui::IsKeyDown(ImGuiKey_X) && if (IsKeyDown(ImGuiKey_X) && ctrl_or_super) {
(ImGui::GetIO().KeyCtrl || ImGui::GetIO().KeySuper)) {
status_ = current_editor_->Cut(); status_ = current_editor_->Cut();
} }
if (ImGui::IsKeyDown(ImGuiKey_C) && if (IsKeyDown(ImGuiKey_C) && ctrl_or_super) {
(ImGui::GetIO().KeyCtrl || ImGui::GetIO().KeySuper)) {
status_ = current_editor_->Copy(); status_ = current_editor_->Copy();
} }
if (ImGui::IsKeyDown(ImGuiKey_V) && if (IsKeyDown(ImGuiKey_V) && ctrl_or_super) {
(ImGui::GetIO().KeyCtrl || ImGui::GetIO().KeySuper)) {
status_ = current_editor_->Paste(); status_ = current_editor_->Paste();
} }
if (ImGui::IsKeyDown(ImGuiKey_Z) && if (IsKeyDown(ImGuiKey_Z) && ctrl_or_super) {
(ImGui::GetIO().KeyCtrl || ImGui::GetIO().KeySuper)) {
status_ = current_editor_->Undo(); status_ = current_editor_->Undo();
} }
if (ImGui::IsKeyDown(ImGuiKey_Y) && if (IsKeyDown(ImGuiKey_Y) && ctrl_or_super) {
(ImGui::GetIO().KeyCtrl || ImGui::GetIO().KeySuper)) {
status_ = current_editor_->Redo(); status_ = current_editor_->Redo();
} }
if (ImGui::IsKeyDown(ImGuiKey_F) && if (IsKeyDown(ImGuiKey_F) && ctrl_or_super) {
(ImGui::GetIO().KeyCtrl || ImGui::GetIO().KeySuper)) {
status_ = current_editor_->Find(); status_ = current_editor_->Find();
} }
} }

View File

@@ -69,11 +69,11 @@ constexpr int kArmorPalettes = 0xDD308;
constexpr int kSpritesPalettesAux1 = 0xDD39E; // 7 colors each constexpr int kSpritesPalettesAux1 = 0xDD39E; // 7 colors each
constexpr int kSpritesPalettesAux2 = 0xDD446; // 7 colors each constexpr int kSpritesPalettesAux2 = 0xDD446; // 7 colors each
constexpr int kSpritesPalettesAux3 = 0xDD4E0; // 7 colors each constexpr int kSpritesPalettesAux3 = 0xDD4E0; // 7 colors each
constexpr int kSwordPalettes = 0xDD630; // 3 colors each - 4 entries constexpr int kSwordPalettes = 0xDD630; // 3 colors each - 4 entries
constexpr int kShieldPalettes = 0xDD648; // 4 colors each - 3 entries constexpr int kShieldPalettes = 0xDD648; // 4 colors each - 3 entries
constexpr int kHudPalettes = 0xDD660; constexpr int kHudPalettes = 0xDD660;
constexpr int dungeonMapPalettes = 0xDD70A; // 21 colors constexpr int dungeonMapPalettes = 0xDD70A; // 21 colors
constexpr int kDungeonMainPalettes = 0xDD734; //(15*6) colors each - 20 entries constexpr int kDungeonMainPalettes = 0xDD734; //(15*6) colors each - 20 entries
constexpr int dungeonMapBgPalettes = 0xDE544; // 16*6 constexpr int dungeonMapBgPalettes = 0xDE544; // 16*6
// Mirrored Value at 0x75645 : 0x75625 // Mirrored Value at 0x75645 : 0x75625
constexpr int kHardcodedGrassLW = 0x5FEA9; constexpr int kHardcodedGrassLW = 0x5FEA9;