[studio] Remap toggle explorer keyboard shortcut, add Ctrl+1-0 mappings for jumping between tabs
All checks were successful
Build / build (push) Successful in 3m17s
All checks were successful
Build / build (push) Successful in 3m17s
This commit is contained in:
parent
55a1660242
commit
dd50bd0249
@ -82,7 +82,7 @@ StudioUI::StudioUI(turbine::Context &ctx, ox::StringParam projectDataDir) noexce
|
||||
}
|
||||
}
|
||||
|
||||
void StudioUI::handleKeyEvent(turbine::Key key, bool down) noexcept {
|
||||
void StudioUI::handleKeyEvent(turbine::Key const key, bool const down) noexcept {
|
||||
for (auto p : m_popups) {
|
||||
if (p->isOpen()) {
|
||||
if (key == turbine::Key::Escape) {
|
||||
@ -168,7 +168,7 @@ void StudioUI::drawMenu() noexcept {
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
if (ImGui::BeginMenu("View")) {
|
||||
if (ImGui::MenuItem("Project Explorer", "Ctrl+1", m_showProjectExplorer)) {
|
||||
if (ImGui::MenuItem("Project Explorer", "Ctrl+Shift+1", m_showProjectExplorer)) {
|
||||
toggleProjectExplorer();
|
||||
}
|
||||
ImGui::EndMenu();
|
||||
@ -317,8 +317,22 @@ void StudioUI::handleKeyInput() noexcept {
|
||||
} else if (ImGui::IsKeyPressed(ImGuiKey_Z)) {
|
||||
auto const undoStack = m_activeEditor ? m_activeEditor->undoStack() : nullptr;
|
||||
if (undoStack) { oxLogError(undoStack->undo()); }
|
||||
} else if (ImGui::IsKeyPressed(ImGuiKey_1)) {
|
||||
} else if (ImGui::IsKeyPressed(ImGuiKey_1) && ImGui::IsKeyPressed(ImGuiKey_ModShift)) {
|
||||
toggleProjectExplorer();
|
||||
} else {
|
||||
if (!m_editors.empty()) {
|
||||
auto const range = ox::min<size_t>(9u, m_editors.size()) - 1;
|
||||
for (auto i = 0u; i < 9; ++i) {
|
||||
if (ImGui::IsKeyPressed(static_cast<ImGuiKey>(static_cast<int>(ImGuiKey_1) + i))) {
|
||||
m_activeEditor = m_editors[i < m_editors.size() ? i : range].get();
|
||||
m_activeEditorUpdatePending = m_activeEditor;
|
||||
}
|
||||
}
|
||||
if (ImGui::IsKeyPressed(ImGuiKey_0)) {
|
||||
m_activeEditor = m_editors[10 < m_editors.size() ? 10 : range].get();
|
||||
m_activeEditorUpdatePending = m_activeEditor;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user