From 4f8b2d07fb488084aeb023c6e582c87f0418db31 Mon Sep 17 00:00:00 2001 From: scawful Date: Sat, 20 Jul 2024 09:04:06 -0400 Subject: [PATCH] Add the cut, copy, paste, redo, unfo shortcuts --- src/app/editor/master_editor.cc | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/app/editor/master_editor.cc b/src/app/editor/master_editor.cc index 3ef76246..ea9b6c1c 100644 --- a/src/app/editor/master_editor.cc +++ b/src/app/editor/master_editor.cc @@ -291,6 +291,33 @@ void MasterEditor::ManageKeyboardShortcuts() { (ImGui::GetIO().KeyCtrl || ImGui::GetIO().KeySuper)) { SaveRom(); } + + if (ImGui::IsKeyDown(ImGuiKey_X) && + (ImGui::GetIO().KeyCtrl || ImGui::GetIO().KeySuper)) { + status_ = current_editor_->Cut(); + } + + if (ImGui::IsKeyDown(ImGuiKey_C) && + (ImGui::GetIO().KeyCtrl || ImGui::GetIO().KeySuper)) { + status_ = current_editor_->Copy(); + } + + if (ImGui::IsKeyDown(ImGuiKey_V) && + (ImGui::GetIO().KeyCtrl || ImGui::GetIO().KeySuper)) { + status_ = current_editor_->Paste(); + } + + if (ImGui::IsKeyDown(ImGuiKey_Z) && + (ImGui::GetIO().KeyCtrl || ImGui::GetIO().KeySuper)) { + status_ = current_editor_->Undo(); + } + + if (ImGui::IsKeyDown(ImGuiKey_Y) && + (ImGui::GetIO().KeyCtrl || ImGui::GetIO().KeySuper)) { + status_ = current_editor_->Redo(); + } + + // TODO: If CMD + F is pressed, open a search dialog } void MasterEditor::DrawFileDialog() {