Browse Source

Hide a few menu entries

Signed-off-by: falkTX <falktx@falktx.com>
tags/22.02
falkTX 3 years ago
parent
commit
6731453b24
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
2 changed files with 41 additions and 2 deletions
  1. +1
    -0
      src/CardinalPlugin.cpp
  2. +40
    -2
      src/CardinalUI.cpp

+ 1
- 0
src/CardinalPlugin.cpp View File

@@ -53,6 +53,7 @@ struct Initializer {
settings::allowCursorLock = false; settings::allowCursorLock = false;
settings::autoCheckUpdates = false; settings::autoCheckUpdates = false;
settings::autosaveInterval = 0; settings::autosaveInterval = 0;
settings::devMode = true;
settings::discordUpdateActivity = false; settings::discordUpdateActivity = false;
settings::isPlugin = true; settings::isPlugin = true;
settings::skipLoadOnLaunch = true; settings::skipLoadOnLaunch = true;


+ 40
- 2
src/CardinalUI.cpp View File

@@ -15,11 +15,11 @@
* For a full copy of the GNU General Public License see the LICENSE file. * For a full copy of the GNU General Public License see the LICENSE file.
*/ */


#include <app/common.hpp>
#include <app/Scene.hpp> #include <app/Scene.hpp>
#include <context.hpp> #include <context.hpp>
#include <patch.hpp> #include <patch.hpp>
#include <ui/common.hpp>
#include <ui/Button.hpp>
#include <ui/MenuItem.hpp>
#include <window/Window.hpp> #include <window/Window.hpp>


#include "PluginContext.hpp" #include "PluginContext.hpp"
@@ -80,6 +80,44 @@ public:
fContext->window = new rack::window::Window; fContext->window = new rack::window::Window;
rack::window::lastUI = nullptr; 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<rWidget*>::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<rButton*>(*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<rMenuItem*>(*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 :( // we need to reload current patch for things to show on screen :(
// FIXME always save // FIXME always save
if (! fContext->patch->hasAutosave()) if (! fContext->patch->hasAutosave())


Loading…
Cancel
Save