From 6731453b245d932ef2ccae916fe548178d6af0db Mon Sep 17 00:00:00 2001 From: falkTX Date: Mon, 18 Oct 2021 15:21:55 +0100 Subject: [PATCH] Hide a few menu entries Signed-off-by: falkTX --- src/CardinalPlugin.cpp | 1 + src/CardinalUI.cpp | 42 ++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/src/CardinalPlugin.cpp b/src/CardinalPlugin.cpp index 069d701..d92e4be 100644 --- a/src/CardinalPlugin.cpp +++ b/src/CardinalPlugin.cpp @@ -53,6 +53,7 @@ struct Initializer { settings::allowCursorLock = false; settings::autoCheckUpdates = false; settings::autosaveInterval = 0; + settings::devMode = true; settings::discordUpdateActivity = false; settings::isPlugin = true; settings::skipLoadOnLaunch = true; diff --git a/src/CardinalUI.cpp b/src/CardinalUI.cpp index bc1afe7..0a8d7fa 100644 --- a/src/CardinalUI.cpp +++ b/src/CardinalUI.cpp @@ -15,11 +15,11 @@ * For a full copy of the GNU General Public License see the LICENSE file. */ -#include #include #include #include -#include +#include +#include #include #include "PluginContext.hpp" @@ -80,6 +80,44 @@ public: fContext->window = new rack::window::Window; rack::window::lastUI = nullptr; + // Hide non-wanted menu entries + typedef rack::ui::Button rButton; + // typedef rack::ui::MenuItem rMenuItem; + typedef rack::widget::Widget rWidget; + typedef std::list::iterator rWidgetIterator; + + rWidget* const layout = fContext->scene->menuBar->children.front(); + + for (rWidgetIterator it = layout->children.begin(); it != layout->children.end(); ++it) + { + if (rButton* const button = reinterpret_cast(*it)) + { + /* FIXME this doesnt work + if (button->text == "Engine") + { + for (rWidgetIterator it2 = button->children.begin(); it2 != button->children.end(); ++it2) + { + if (rMenuItem* const item = reinterpret_cast(*it2)) + { + if (item->text == "Sample rate") + { + button->children.erase(it2); + delete button; + break; + } + } + } + } + */ + if (button->text == "Library") + { + layout->children.erase(it); + delete button; + break; + } + } + } + // we need to reload current patch for things to show on screen :( // FIXME always save if (! fContext->patch->hasAutosave())