| @@ -1,8 +1,27 @@ | |||||
| /* | |||||
| * DISTRHO Cardinal Plugin | |||||
| * Copyright (C) 2021-2023 Filipe Coelho <falktx@falktx.com> | |||||
| * | |||||
| * 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 | #pragma once | ||||
| #ifdef __SSE4_2__ | |||||
| #include <nmmintrin.h> | |||||
| #else | |||||
| #define SIMDE_ENABLE_NATIVE_ALIASES | |||||
| #include <simde/x86/sse4.2.h> | |||||
| #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" | |||||
| @@ -0,0 +1,22 @@ | |||||
| /* | |||||
| * DISTRHO Cardinal Plugin | |||||
| * Copyright (C) 2021-2023 Filipe Coelho <falktx@falktx.com> | |||||
| * | |||||
| * 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 | |||||
| @@ -1 +1 @@ | |||||
| Subproject commit 5f05d62ddc2773098daf1044eb6698581acd4eb6 | |||||
| Subproject commit 7e20713eacc51179cd7faf0f4428def2b82273a9 | |||||
| @@ -17,12 +17,12 @@ void writeThemeAndContrastAsDefault() {} | |||||
| void saveThemeAndContrastAsDefault(int, float) {} | void saveThemeAndContrastAsDefault(int, float) {} | ||||
| void loadThemeAndContrastFromDefault(int* panelTheme, float* panelContrast) { | void loadThemeAndContrastFromDefault(int* panelTheme, float* panelContrast) { | ||||
| *panelTheme = rack::settings::darkMode ? 1 : 0; | |||||
| *panelTheme = rack::settings::preferDarkPanels ? 1 : 0; | |||||
| *panelContrast = panelContrastDefault; | *panelContrast = panelContrastDefault; | ||||
| } | } | ||||
| bool isDark(int*) { | bool isDark(int*) { | ||||
| return rack::settings::darkMode; | |||||
| return rack::settings::preferDarkPanels; | |||||
| } | } | ||||
| void readThemeAndContrastFromDefault() {} | void readThemeAndContrastFromDefault() {} | ||||
| @@ -47,7 +47,7 @@ void PanelBaseWidget::draw(const DrawArgs& args) { | |||||
| void InverterWidget::draw(const DrawArgs& args) { | void InverterWidget::draw(const DrawArgs& args) { | ||||
| TransparentWidget::draw(args); | TransparentWidget::draw(args); | ||||
| if (rack::settings::darkMode) { | |||||
| if (rack::settings::preferDarkPanels) { | |||||
| // nvgSave(args.vg); | // nvgSave(args.vg); | ||||
| nvgBeginPath(args.vg); | nvgBeginPath(args.vg); | ||||
| nvgFillColor(args.vg, SCHEME_WHITE);// this is the source, the current framebuffer is the dest | nvgFillColor(args.vg, SCHEME_WHITE);// this is the source, the current framebuffer is the dest | ||||
| @@ -1 +1 @@ | |||||
| Subproject commit 6ac79f59c5b95433d82bcc759c4cd0642ec35098 | |||||
| Subproject commit 2d06199dd36ecdfe33d640ed1602f1041930f013 | |||||
| @@ -353,7 +353,7 @@ static void initStatic__BogaudioModules() | |||||
| { | { | ||||
| // Make sure to use match Cardinal theme | // Make sure to use match Cardinal theme | ||||
| Skins& skins(Skins::skins()); | Skins& skins(Skins::skins()); | ||||
| skins._default = settings::darkMode ? "dark" : "light"; | |||||
| skins._default = settings::preferDarkPanels ? "dark" : "light"; | |||||
| p->addModel(modelAD); | p->addModel(modelAD); | ||||
| p->addModel(modelBogaudioLFO); | p->addModel(modelBogaudioLFO); | ||||
| @@ -649,7 +649,7 @@ void destroyStaticPlugins() | |||||
| void updateStaticPluginsDarkMode() | void updateStaticPluginsDarkMode() | ||||
| { | { | ||||
| const bool darkMode = settings::darkMode; | |||||
| const bool darkMode = settings::preferDarkPanels; | |||||
| // bogaudio | // bogaudio | ||||
| { | { | ||||
| Skins& skins(Skins::skins()); | Skins& skins(Skins::skins()); | ||||
| @@ -1,6 +1,6 @@ | |||||
| /* | /* | ||||
| * DISTRHO Cardinal Plugin | * DISTRHO Cardinal Plugin | ||||
| * Copyright (C) 2021-2022 Filipe Coelho <falktx@falktx.com> | |||||
| * Copyright (C) 2021-2023 Filipe Coelho <falktx@falktx.com> | |||||
| * | * | ||||
| * This program is free software; you can redistribute it and/or | * This program is free software; you can redistribute it and/or | ||||
| * modify it under the terms of the GNU General Public License as | * 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() | 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(); | XTStyle::initialize(); | ||||
| } | } | ||||
| void surgext_rack_update_theme() | 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(); | 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(); | XTStyle::notifyStyleListeners(); | ||||
| } | } | ||||
| @@ -410,7 +410,7 @@ Initializer::Initializer(const CardinalBasePlugin* const plugin, const CardinalB | |||||
| settings::browserZoom = -1.f; | settings::browserZoom = -1.f; | ||||
| settings::invertZoom = false; | settings::invertZoom = false; | ||||
| settings::squeezeModules = true; | settings::squeezeModules = true; | ||||
| settings::darkMode = true; | |||||
| settings::preferDarkPanels = true; | |||||
| settings::uiTheme = "dark"; | settings::uiTheme = "dark"; | ||||
| // runtime behaviour | // runtime behaviour | ||||
| @@ -31,11 +31,6 @@ | |||||
| namespace rack { | namespace rack { | ||||
| namespace asset { | 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 configDir; // points to writable config dir (might be equal to userDir) | ||||
| std::string userDir; // points to common writable dir | std::string userDir; // points to common writable dir | ||||
| std::string systemDir; // points to plugin resources dir (or installed/local Rack 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 | // get system resource, trimming "res/" prefix if we are loaded as a plugin bundle | ||||
| std::string system(std::string filename) { | 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)); | return system::join(systemDir, bundlePath.empty() ? filename : trim(filename)); | ||||
| } | } | ||||
| @@ -28,6 +28,7 @@ void updateStaticPluginsDarkMode(); | |||||
| } | } | ||||
| namespace settings { | namespace settings { | ||||
| int rateLimit = 0; | int rateLimit = 0; | ||||
| extern bool preferDarkPanels; | |||||
| extern std::string uiTheme; | extern std::string uiTheme; | ||||
| } | } | ||||
| namespace ui { | namespace ui { | ||||
| @@ -1405,7 +1406,7 @@ postparse: | |||||
| const ExtendedNSVGimage ext = { handle, handleOrig, handleMOD, shapesOrig, shapesMOD }; | const ExtendedNSVGimage ext = { handle, handleOrig, handleMOD, shapesOrig, shapesMOD }; | ||||
| loadedDarkSVGs.push_back(ext); | loadedDarkSVGs.push_back(ext); | ||||
| if (rack::settings::darkMode) | |||||
| if (rack::settings::preferDarkPanels) | |||||
| { | { | ||||
| if (shapesMOD != nullptr) | if (shapesMOD != nullptr) | ||||
| handle->shapes = shapesMOD; | handle->shapes = shapesMOD; | ||||
| @@ -1419,7 +1420,7 @@ postparse: | |||||
| const ExtendedNSVGimage ext = { handle, handleOrig, handleMOD, shapesOrig, shapesMOD }; | const ExtendedNSVGimage ext = { handle, handleOrig, handleMOD, shapesOrig, shapesMOD }; | ||||
| loadedLightSVGs.push_back(ext); | loadedLightSVGs.push_back(ext); | ||||
| if (!rack::settings::darkMode) | |||||
| if (!rack::settings::preferDarkPanels) | |||||
| { | { | ||||
| if (shapesMOD != nullptr) | if (shapesMOD != nullptr) | ||||
| handle->shapes = shapesMOD; | handle->shapes = shapesMOD; | ||||
| @@ -1471,9 +1472,7 @@ namespace rack { | |||||
| void switchDarkMode(const bool darkMode) | void switchDarkMode(const bool darkMode) | ||||
| { | { | ||||
| #ifndef HEADLESS | #ifndef HEADLESS | ||||
| // TODO sort this out after build with Rack2.4 succeeds | |||||
| return; | |||||
| settings::preferDarkPanels = darkMode; | |||||
| settings::uiTheme = darkMode ? "dark" : "light"; | settings::uiTheme = darkMode ? "dark" : "light"; | ||||
| ui::refreshTheme(); | ui::refreshTheme(); | ||||
| plugin::updateStaticPluginsDarkMode(); | plugin::updateStaticPluginsDarkMode(); | ||||
| @@ -625,10 +625,10 @@ struct ViewButton : MenuButton { | |||||
| #if DISTRHO_PLUGIN_WANT_DIRECT_ACCESS | #if DISTRHO_PLUGIN_WANT_DIRECT_ACCESS | ||||
| std::string darkModeText; | std::string darkModeText; | ||||
| if (settings::darkMode) | |||||
| if (settings::preferDarkPanels) | |||||
| darkModeText = CHECKMARK_STRING; | darkModeText = CHECKMARK_STRING; | ||||
| menu->addChild(createMenuItem("Dark Mode", darkModeText, []() { | menu->addChild(createMenuItem("Dark Mode", darkModeText, []() { | ||||
| switchDarkMode(!settings::darkMode); | |||||
| switchDarkMode(!settings::preferDarkPanels); | |||||
| setAllFramebufferWidgetsDirty(APP->scene); | setAllFramebufferWidgetsDirty(APP->scene); | ||||
| })); | })); | ||||
| #endif | #endif | ||||