@@ -11,6 +11,7 @@ | |||||
#include <engine/Engine.hpp> | #include <engine/Engine.hpp> | ||||
#include <app/common.hpp> | #include <app/common.hpp> | ||||
#include <app/Scene.hpp> | #include <app/Scene.hpp> | ||||
#include <app/Browser.hpp> | |||||
#include <plugin.hpp> | #include <plugin.hpp> | ||||
#include <context.hpp> | #include <context.hpp> | ||||
#include <window/Window.hpp> | #include <window/Window.hpp> | ||||
@@ -175,6 +176,7 @@ int main(int argc, char* argv[]) { | |||||
keyboard::init(); | keyboard::init(); | ||||
gamepad::init(); | gamepad::init(); | ||||
plugin::init(); | plugin::init(); | ||||
app::browserInit(); | |||||
library::init(); | library::init(); | ||||
discord::init(); | discord::init(); | ||||
if (!settings::headless) { | if (!settings::headless) { | ||||
@@ -7,6 +7,7 @@ namespace rack { | |||||
namespace app { | namespace app { | ||||
PRIVATE void browserInit(); | |||||
PRIVATE widget::Widget* browserCreate(); | PRIVATE widget::Widget* browserCreate(); | ||||
@@ -41,12 +41,10 @@ namespace browser { | |||||
static fuzzysearch::Database<plugin::Model*> modelDb; | static fuzzysearch::Database<plugin::Model*> modelDb; | ||||
static bool modelDbInitialized = false; | |||||
static void fuzzySearchInit() { | |||||
if (modelDbInitialized) | |||||
return; | |||||
static void modelDbInit() { | |||||
modelDb = fuzzysearch::Database<plugin::Model*>(); | |||||
modelDb.setWeights({1.f, 1.f, 0.1f, 1.f, 0.5f, 0.5f}); | modelDb.setWeights({1.f, 1.f, 0.1f, 1.f, 0.5f, 0.5f}); | ||||
modelDb.setThreshold(0.25f); | modelDb.setThreshold(0.25f); | ||||
@@ -75,8 +73,6 @@ static void fuzzySearchInit() { | |||||
modelDb.addEntry(model, fields); | modelDb.addEntry(model, fields); | ||||
} | } | ||||
} | } | ||||
modelDbInitialized = true; | |||||
} | } | ||||
@@ -731,8 +727,6 @@ struct Browser : widget::OpaqueWidget { | |||||
} | } | ||||
} | } | ||||
else { | else { | ||||
// Lazily initialize search database | |||||
fuzzySearchInit(); | |||||
// Score results against search query | // Score results against search query | ||||
auto results = modelDb.search(search); | auto results = modelDb.search(search); | ||||
// DEBUG("============="); | // DEBUG("============="); | ||||
@@ -1013,6 +1007,12 @@ inline void ZoomButton::onAction(const ActionEvent& e) { | |||||
} // namespace browser | } // namespace browser | ||||
void browserInit() { | |||||
browser::modelDbInit(); | |||||
} | |||||
widget::Widget* browserCreate() { | widget::Widget* browserCreate() { | ||||
browser::BrowserOverlay* overlay = new browser::BrowserOverlay; | browser::BrowserOverlay* overlay = new browser::BrowserOverlay; | ||||
overlay->bgColor = nvgRGBAf(0, 0, 0, 0.33); | overlay->bgColor = nvgRGBAf(0, 0, 0, 0.33); | ||||
@@ -32,7 +32,7 @@ struct TipInfo { | |||||
// Remember to use “smart quotes.” | // Remember to use “smart quotes.” | ||||
static std::vector<TipInfo> tipInfos = { | |||||
static const std::vector<TipInfo> tipInfos = { | |||||
{"To add a module to your patch, right-click an empty rack space or press Enter. Click and drag a module from the Module Browser into the desired rack space.\n\nYou can force-move modules by holding " RACK_MOD_CTRL_NAME " while dragging them.\n\nClick and drag on empty rack space to select multiple modules.", "", ""}, | {"To add a module to your patch, right-click an empty rack space or press Enter. Click and drag a module from the Module Browser into the desired rack space.\n\nYou can force-move modules by holding " RACK_MOD_CTRL_NAME " while dragging them.\n\nClick and drag on empty rack space to select multiple modules.", "", ""}, | ||||
{"Pan around the rack by using the scroll bars, dragging while holding the middle mouse button, " RACK_MOD_ALT_NAME "+clicking and dragging, or pressing the arrow keys. Arrow key panning speed can be modified by holding " RACK_MOD_CTRL_NAME ", " RACK_MOD_SHIFT_NAME ", or " RACK_MOD_CTRL_NAME "+" RACK_MOD_SHIFT_NAME ".\n\nZoom in and out using the View menu, " RACK_MOD_CTRL_NAME "+scroll, or " RACK_MOD_CTRL_NAME "+= and " RACK_MOD_CTRL_NAME "+minus.", "", ""}, | {"Pan around the rack by using the scroll bars, dragging while holding the middle mouse button, " RACK_MOD_ALT_NAME "+clicking and dragging, or pressing the arrow keys. Arrow key panning speed can be modified by holding " RACK_MOD_CTRL_NAME ", " RACK_MOD_SHIFT_NAME ", or " RACK_MOD_CTRL_NAME "+" RACK_MOD_SHIFT_NAME ".\n\nZoom in and out using the View menu, " RACK_MOD_CTRL_NAME "+scroll, or " RACK_MOD_CTRL_NAME "+= and " RACK_MOD_CTRL_NAME "+minus.", "", ""}, | ||||
// {"Want to use VCV Rack as a plugin in your DAW? VCV Rack Studio Edition is available now as a 64-bit VST 2 plugin for Ableton Live, FL Studio, Reason, REAPER, Bitwig, and more.", "Learn more", "https://vcvrack.com/Rack"}, | // {"Want to use VCV Rack as a plugin in your DAW? VCV Rack Studio Edition is available now as a 64-bit VST 2 plugin for Ableton Live, FL Studio, Reason, REAPER, Bitwig, and more.", "Learn more", "https://vcvrack.com/Rack"}, | ||||
@@ -158,7 +158,7 @@ struct TipWindow : widget::OpaqueWidget { | |||||
// Increment tip index | // Increment tip index | ||||
settings::tipIndex = math::eucMod(settings::tipIndex + delta, (int) tipInfos.size()); | settings::tipIndex = math::eucMod(settings::tipIndex + delta, (int) tipInfos.size()); | ||||
TipInfo& tipInfo = tipInfos[settings::tipIndex]; | |||||
const TipInfo& tipInfo = tipInfos[settings::tipIndex]; | |||||
label->text = tipInfo.text; | label->text = tipInfo.text; | ||||
linkButton->setVisible(tipInfo.linkText != ""); | linkButton->setVisible(tipInfo.linkText != ""); | ||||
linkButton->text = tipInfo.linkText; | linkButton->text = tipInfo.linkText; | ||||
@@ -49,6 +49,7 @@ static bool isTruncated() { | |||||
void init() { | void init() { | ||||
assert(!outputFile); | assert(!outputFile); | ||||
std::lock_guard<std::mutex> lock(mutex); | std::lock_guard<std::mutex> lock(mutex); | ||||
truncated = false; | |||||
// Don't open a file in development mode. | // Don't open a file in development mode. | ||||
if (logPath.empty()) { | if (logPath.empty()) { | ||||
@@ -70,7 +70,8 @@ void init() { | |||||
void destroy() { | void destroy() { | ||||
curl_global_cleanup(); | curl_global_cleanup(); | ||||
OPENSSL_cleanup(); | |||||
// Don't destroy OpenSSL because it's not designed to be reinitialized. | |||||
// OPENSSL_cleanup(); | |||||
} | } | ||||