housekeeping
This commit is contained in:
@@ -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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Submodule src/lib/imgui updated: f9cda1fa24...fe09ebbe0a
Reference in New Issue
Block a user