From 241df7f5c7813fb21385efd1da7db15a2c7804ef Mon Sep 17 00:00:00 2001 From: falkTX Date: Sun, 17 Dec 2023 16:36:54 +0100 Subject: [PATCH] More tweaks for 2.4 update Signed-off-by: falkTX --- include/simd/common.hpp | 31 +++++++++++++++++---- include/simd/functions.hpp | 22 +++++++++++++++ plugins/GlueTheGiant | 2 +- plugins/ImpromptuModularDark/PanelTheme.cpp | 6 ++-- plugins/RebelTech | 2 +- plugins/plugins-mini.cpp | 4 +-- plugins/surgext-helper/surgext-helper.cpp | 8 +++--- src/CardinalCommon.cpp | 2 +- src/custom/asset.cpp | 11 -------- src/custom/dep.cpp | 9 +++--- src/override/MenuBar.cpp | 4 +-- 11 files changed, 65 insertions(+), 36 deletions(-) create mode 100644 include/simd/functions.hpp diff --git a/include/simd/common.hpp b/include/simd/common.hpp index 2a782681..3ff4c8cd 100644 --- a/include/simd/common.hpp +++ b/include/simd/common.hpp @@ -1,8 +1,27 @@ +/* + * DISTRHO Cardinal Plugin + * Copyright (C) 2021-2023 Filipe Coelho + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * For a full copy of the GNU General Public License see the LICENSE file. + */ + #pragma once -#ifdef __SSE4_2__ - #include -#else - #define SIMDE_ENABLE_NATIVE_ALIASES - #include -#endif +#include "emmintrin.h" +#include "immintrin.h" +#include "pmmintrin.h" + +#define SIMDE_ENABLE_NATIVE_ALIASES +#include "simde/x86/ssse3.h" +#include "simde/x86/sse4.1.h" +#include "simde/x86/sse4.2.h" diff --git a/include/simd/functions.hpp b/include/simd/functions.hpp new file mode 100644 index 00000000..d90f7816 --- /dev/null +++ b/include/simd/functions.hpp @@ -0,0 +1,22 @@ +/* + * DISTRHO Cardinal Plugin + * Copyright (C) 2021-2023 Filipe Coelho + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * For a full copy of the GNU General Public License see the LICENSE file. + */ + +#pragma once + +#include "simd/common.hpp" +#include_next "simd/functions.hpp" +#undef SIMDE_MM_FROUND_NO_EXC diff --git a/plugins/GlueTheGiant b/plugins/GlueTheGiant index 5f05d62d..7e20713e 160000 --- a/plugins/GlueTheGiant +++ b/plugins/GlueTheGiant @@ -1 +1 @@ -Subproject commit 5f05d62ddc2773098daf1044eb6698581acd4eb6 +Subproject commit 7e20713eacc51179cd7faf0f4428def2b82273a9 diff --git a/plugins/ImpromptuModularDark/PanelTheme.cpp b/plugins/ImpromptuModularDark/PanelTheme.cpp index 6106d31c..c8f3daee 100644 --- a/plugins/ImpromptuModularDark/PanelTheme.cpp +++ b/plugins/ImpromptuModularDark/PanelTheme.cpp @@ -17,12 +17,12 @@ void writeThemeAndContrastAsDefault() {} void saveThemeAndContrastAsDefault(int, float) {} void loadThemeAndContrastFromDefault(int* panelTheme, float* panelContrast) { - *panelTheme = rack::settings::darkMode ? 1 : 0; + *panelTheme = rack::settings::preferDarkPanels ? 1 : 0; *panelContrast = panelContrastDefault; } bool isDark(int*) { - return rack::settings::darkMode; + return rack::settings::preferDarkPanels; } void readThemeAndContrastFromDefault() {} @@ -47,7 +47,7 @@ void PanelBaseWidget::draw(const DrawArgs& args) { void InverterWidget::draw(const DrawArgs& args) { TransparentWidget::draw(args); - if (rack::settings::darkMode) { + if (rack::settings::preferDarkPanels) { // nvgSave(args.vg); nvgBeginPath(args.vg); nvgFillColor(args.vg, SCHEME_WHITE);// this is the source, the current framebuffer is the dest diff --git a/plugins/RebelTech b/plugins/RebelTech index 6ac79f59..2d06199d 160000 --- a/plugins/RebelTech +++ b/plugins/RebelTech @@ -1 +1 @@ -Subproject commit 6ac79f59c5b95433d82bcc759c4cd0642ec35098 +Subproject commit 2d06199dd36ecdfe33d640ed1602f1041930f013 diff --git a/plugins/plugins-mini.cpp b/plugins/plugins-mini.cpp index 38fdb17e..693a78aa 100644 --- a/plugins/plugins-mini.cpp +++ b/plugins/plugins-mini.cpp @@ -353,7 +353,7 @@ static void initStatic__BogaudioModules() { // Make sure to use match Cardinal theme Skins& skins(Skins::skins()); - skins._default = settings::darkMode ? "dark" : "light"; + skins._default = settings::preferDarkPanels ? "dark" : "light"; p->addModel(modelAD); p->addModel(modelBogaudioLFO); @@ -649,7 +649,7 @@ void destroyStaticPlugins() void updateStaticPluginsDarkMode() { - const bool darkMode = settings::darkMode; + const bool darkMode = settings::preferDarkPanels; // bogaudio { Skins& skins(Skins::skins()); diff --git a/plugins/surgext-helper/surgext-helper.cpp b/plugins/surgext-helper/surgext-helper.cpp index c349e87b..a36204e4 100644 --- a/plugins/surgext-helper/surgext-helper.cpp +++ b/plugins/surgext-helper/surgext-helper.cpp @@ -1,6 +1,6 @@ /* * DISTRHO Cardinal Plugin - * Copyright (C) 2021-2022 Filipe Coelho + * Copyright (C) 2021-2023 Filipe Coelho * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -23,15 +23,15 @@ using namespace sst::surgext_rack::style; void surgext_rack_initialize() { - BaconStyle::get()->activeStyle = rack::settings::darkMode ? BaconStyle::DARK : BaconStyle::LIGHT; + BaconStyle::get()->activeStyle = rack::settings::preferDarkPanels ? BaconStyle::DARK : BaconStyle::LIGHT; XTStyle::initialize(); } void surgext_rack_update_theme() { - BaconStyle::get()->activeStyle = rack::settings::darkMode ? BaconStyle::DARK : BaconStyle::LIGHT; + BaconStyle::get()->activeStyle = rack::settings::preferDarkPanels ? BaconStyle::DARK : BaconStyle::LIGHT; BaconStyle::get()->notifyStyleListeners(); - XTStyle::setGlobalStyle(rack::settings::darkMode ? XTStyle::Style::DARK : XTStyle::Style::LIGHT); + XTStyle::setGlobalStyle(rack::settings::preferDarkPanels ? XTStyle::Style::DARK : XTStyle::Style::LIGHT); XTStyle::notifyStyleListeners(); } diff --git a/src/CardinalCommon.cpp b/src/CardinalCommon.cpp index 8fdba7e3..58f58d3c 100644 --- a/src/CardinalCommon.cpp +++ b/src/CardinalCommon.cpp @@ -410,7 +410,7 @@ Initializer::Initializer(const CardinalBasePlugin* const plugin, const CardinalB settings::browserZoom = -1.f; settings::invertZoom = false; settings::squeezeModules = true; - settings::darkMode = true; + settings::preferDarkPanels = true; settings::uiTheme = "dark"; // runtime behaviour diff --git a/src/custom/asset.cpp b/src/custom/asset.cpp index c1a2897a..f78ea68e 100644 --- a/src/custom/asset.cpp +++ b/src/custom/asset.cpp @@ -31,11 +31,6 @@ namespace rack { namespace asset { -#ifndef HEADLESS -extern bool forceBlackScrew; -extern bool forceSilverScrew; -#endif - std::string configDir; // points to writable config dir (might be equal to userDir) std::string userDir; // points to common writable dir std::string systemDir; // points to plugin resources dir (or installed/local Rack dir) @@ -59,12 +54,6 @@ static inline std::string& trim(std::string& s) // get system resource, trimming "res/" prefix if we are loaded as a plugin bundle std::string system(std::string filename) { - #ifndef HEADLESS - /**/ if (forceBlackScrew && string::endsWith(filename, "/ScrewBlack.svg")) - filename = filename.substr(0, filename.size()-15) + "/./ScrewBlack.svg"; - else if (forceSilverScrew && string::endsWith(filename, "/ScrewSilver.svg")) - filename = filename.substr(0, filename.size()-16) + "/./ScrewSilver.svg"; - #endif return system::join(systemDir, bundlePath.empty() ? filename : trim(filename)); } diff --git a/src/custom/dep.cpp b/src/custom/dep.cpp index 15b5575b..019e86b5 100644 --- a/src/custom/dep.cpp +++ b/src/custom/dep.cpp @@ -28,6 +28,7 @@ void updateStaticPluginsDarkMode(); } namespace settings { int rateLimit = 0; +extern bool preferDarkPanels; extern std::string uiTheme; } namespace ui { @@ -1405,7 +1406,7 @@ NSVGimage* nsvgParseFromFileCardinal(const char* const filename, const char* con const ExtendedNSVGimage ext = { handle, handleOrig, handleMOD, shapesOrig, shapesMOD }; loadedDarkSVGs.push_back(ext); - if (rack::settings::darkMode) + if (rack::settings::preferDarkPanels) { if (shapesMOD != nullptr) handle->shapes = shapesMOD; @@ -1419,7 +1420,7 @@ NSVGimage* nsvgParseFromFileCardinal(const char* const filename, const char* con const ExtendedNSVGimage ext = { handle, handleOrig, handleMOD, shapesOrig, shapesMOD }; loadedLightSVGs.push_back(ext); - if (!rack::settings::darkMode) + if (!rack::settings::preferDarkPanels) { if (shapesMOD != nullptr) handle->shapes = shapesMOD; @@ -1471,9 +1472,7 @@ namespace rack { void switchDarkMode(const bool darkMode) { #ifndef HEADLESS - // TODO sort this out after build with Rack2.4 succeeds - return; - + settings::preferDarkPanels = darkMode; settings::uiTheme = darkMode ? "dark" : "light"; ui::refreshTheme(); plugin::updateStaticPluginsDarkMode(); diff --git a/src/override/MenuBar.cpp b/src/override/MenuBar.cpp index c4464be8..e68abf8e 100644 --- a/src/override/MenuBar.cpp +++ b/src/override/MenuBar.cpp @@ -625,10 +625,10 @@ struct ViewButton : MenuButton { #if DISTRHO_PLUGIN_WANT_DIRECT_ACCESS std::string darkModeText; - if (settings::darkMode) + if (settings::preferDarkPanels) darkModeText = CHECKMARK_STRING; menu->addChild(createMenuItem("Dark Mode", darkModeText, []() { - switchDarkMode(!settings::darkMode); + switchDarkMode(!settings::preferDarkPanels); setAllFramebufferWidgetsDirty(APP->scene); })); #endif