[nostalgia/studio] Get Undo/Redo working

This commit is contained in:
2022-02-16 20:16:49 -06:00
parent 72ce8ea4d9
commit c92ecdf499
5 changed files with 30 additions and 12 deletions
+18
View File
@@ -87,6 +87,23 @@ void StudioUI::drawMenu() noexcept {
}
ImGui::EndMenu();
}
if (ImGui::BeginMenu("Edit")) {
auto undoStack = m_acitveEditor ? m_acitveEditor->undoStack() : nullptr;
if (ImGui::MenuItem("Undo", "Ctrl+Z", false, undoStack)) {
m_acitveEditor->undoStack()->undo();
}
if (ImGui::MenuItem("Redo", "Ctrl+Y", false, undoStack)) {
m_acitveEditor->undoStack()->redo();
}
ImGui::Separator();
if (ImGui::MenuItem("Copy", "Ctrl+N")) {
}
if (ImGui::MenuItem("Cut", "Ctrl+X")) {
}
if (ImGui::MenuItem("Paste", "Ctrl+V")) {
}
ImGui::EndMenu();
}
if (ImGui::BeginMenu("View", false)) {
ImGui::EndMenu();
}
@@ -147,6 +164,7 @@ void StudioUI::drawTabs() noexcept {
auto const &e = *it;
bool open = true;
if (ImGui::BeginTabItem(e->itemDisplayName().c_str(), &open)) {
m_acitveEditor = e.get();
e->draw(m_ctx);
ImGui::EndTabItem();
}