From 3e6f8324eb0eedad397fe6dbf567e9fb3f474cc9 Mon Sep 17 00:00:00 2001 From: poikilos <7557867+poikilos@users.noreply.github.com> Date: Sun, 28 Mar 2021 08:50:51 -0400 Subject: [PATCH] Fix duplicate menu items by respecting the addToEngine bool. resolves #6 --- Engine.cpp | 1 + UserInterface.cpp | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Engine.cpp b/Engine.cpp index 98fd3c6..95f4e39 100644 --- a/Engine.cpp +++ b/Engine.cpp @@ -343,6 +343,7 @@ Engine::Engine() this->m_EnableTestAndExit = false; settings.set_int("max_recent", 10); std::string profile = std::getenv("HOME"); + // ^ changes to USERPROFILE below if blank std::string appdataParent; std::string appdatas; std::string myAppData; diff --git a/UserInterface.cpp b/UserInterface.cpp index fa8864f..f7e93ac 100644 --- a/UserInterface.cpp +++ b/UserInterface.cpp @@ -35,6 +35,9 @@ const u32 UserInterface::UIC_FILE_RECENT_FIRST = UIE_RECENTMENU + 1; // PRIVATE void UserInterface::setupUserInterface() { + this->recent_initialized = false; + this->recentMenu = nullptr; + // Menu menu = m_Gui->addMenu(); menu->addItem(L"File", UIE_FILEMENU, true, true); @@ -893,7 +896,9 @@ void UserInterface::addRecentMenuItem(std::string path, bool addToEngine) } this->m_file_recent_last_idx = menu->getID(); */ - this->m_Engine->addRecent(path); + if (addToEngine) { + this->m_Engine->addRecent(path); + } } }