diff --git a/include/app/RackScrollWidget.hpp b/include/app/RackScrollWidget.hpp index 1759179c..58c18e1f 100644 --- a/include/app/RackScrollWidget.hpp +++ b/include/app/RackScrollWidget.hpp @@ -17,11 +17,12 @@ struct RackScrollWidget : ui::ScrollWidget { math::Vec oldOffset; RackScrollWidget(); + void reset(); void step() override; void draw(const DrawArgs& args) override; void onHoverKey(const event::HoverKey& e) override; void onHoverScroll(const event::HoverScroll& e) override; - void reset(); + void onHover(const event::Hover& e) override; }; diff --git a/include/app/Scene.hpp b/include/app/Scene.hpp index cfce85c2..5389c931 100644 --- a/include/app/Scene.hpp +++ b/include/app/Scene.hpp @@ -32,8 +32,6 @@ struct Scene : widget::OpaqueWidget { void onDragHover(const event::DragHover& e) override; void onHoverKey(const event::HoverKey& e) override; void onPathDrop(const event::PathDrop& e) override; - - void runCheckVersion(); }; diff --git a/include/settings.hpp b/include/settings.hpp index 46189a15..4f85aad9 100644 --- a/include/settings.hpp +++ b/include/settings.hpp @@ -46,7 +46,7 @@ extern bool tooltips; extern bool cpuMeter; extern bool lockModules; extern int frameSwapInterval; -extern float autosavePeriod; +extern float autosaveInterval; extern bool skipLoadOnLaunch; extern std::string patchPath; extern std::list recentPatchPaths; diff --git a/src/app/MenuBar.cpp b/src/app/MenuBar.cpp index 2cdccf74..2a8fa5a8 100644 --- a/src/app/MenuBar.cpp +++ b/src/app/MenuBar.cpp @@ -5,9 +5,6 @@ #include #include -#include -#include -#include #include #include #include @@ -16,6 +13,9 @@ #include #include #include +#include +#include +#include #include #include #include diff --git a/src/app/RackScrollWidget.cpp b/src/app/RackScrollWidget.cpp index 3ed4fdf5..462c3283 100644 --- a/src/app/RackScrollWidget.cpp +++ b/src/app/RackScrollWidget.cpp @@ -20,6 +20,13 @@ RackScrollWidget::RackScrollWidget() { reset(); } + +void RackScrollWidget::reset() { + offset = RACK_OFFSET.mult(zoomWidget->zoom); + offset = offset.minus(math::Vec(30, 30)); +} + + void RackScrollWidget::step() { // Clamp zoom settings::zoom = math::clamp(settings::zoom, -2.f, 2.f); @@ -78,10 +85,12 @@ void RackScrollWidget::step() { oldOffset = offset; } + void RackScrollWidget::draw(const DrawArgs& args) { ScrollWidget::draw(args); } + void RackScrollWidget::onHoverKey(const event::HoverKey& e) { ScrollWidget::onHoverKey(e); if (e.isConsumed()) @@ -116,6 +125,7 @@ void RackScrollWidget::onHoverKey(const event::HoverKey& e) { } } + void RackScrollWidget::onHoverScroll(const event::HoverScroll& e) { if ((APP->window->getMods() & RACK_MOD_MASK) == RACK_MOD_CTRL) { // Increase zoom @@ -131,9 +141,14 @@ void RackScrollWidget::onHoverScroll(const event::HoverScroll& e) { ScrollWidget::onHoverScroll(e); } -void RackScrollWidget::reset() { - offset = RACK_OFFSET.mult(zoomWidget->zoom); - offset = offset.minus(math::Vec(30, 30)); + +void RackScrollWidget::onHover(const event::Hover& e) { + ScrollWidget::onHover(e); + + // Hide menu bar if fullscreen and moving mouse over the RackScrollWidget + if (APP->window->isFullScreen()) { + APP->scene->menuBar->hide(); + } } diff --git a/src/app/Scene.cpp b/src/app/Scene.cpp index b5e02a31..43609c7d 100644 --- a/src/app/Scene.cpp +++ b/src/app/Scene.cpp @@ -56,9 +56,16 @@ Scene::~Scene() { } void Scene::step() { - bool fullscreen = APP->window->isFullScreen(); - menuBar->visible = !fullscreen; - rackScroll->box.pos.y = menuBar->visible ? menuBar->box.size.y : 0; + if (APP->window->isFullScreen()) { + // Expand RackScrollWidget to cover entire screen if fullscreen + rackScroll->box.pos.y = 0; + } + else { + // Always show MenuBar if not fullscreen + menuBar->show(); + rackScroll->box.pos.y = menuBar->box.size.y; + } + frameRateWidget->box.pos.x = box.size.x - frameRateWidget->box.size.x; // Resize owned descendants @@ -66,9 +73,9 @@ void Scene::step() { rackScroll->box.size = box.size.minus(rackScroll->box.pos); // Autosave periodically - if (settings::autosavePeriod > 0.0) { + if (settings::autosaveInterval > 0.0) { double time = glfwGetTime(); - if (time - lastAutosaveTime >= settings::autosavePeriod) { + if (time - lastAutosaveTime >= settings::autosaveInterval) { lastAutosaveTime = time; APP->patch->saveAutosave(); settings::save(asset::settingsPath); @@ -84,6 +91,9 @@ void Scene::draw(const DrawArgs& args) { void Scene::onHover(const event::Hover& e) { mousePos = e.pos; + if (mousePos.y < menuBar->box.size.y) { + menuBar->show(); + } OpaqueWidget::onHover(e); } @@ -169,6 +179,8 @@ void Scene::onHoverKey(const event::HoverKey& e) { } if (e.key == GLFW_KEY_F11 && (e.mods & RACK_MOD_MASK) == 0) { APP->window->setFullScreen(!APP->window->isFullScreen()); + // The MenuBar will be hidden when the mouse moves over the RackScrollWidget. + // menuBar->hide(); e.consume(this); } // Alternate key command for exiting fullscreen, since F11 doesn't work reliably on Mac due to "Show desktop" OS binding. diff --git a/src/settings.cpp b/src/settings.cpp index e709bc6d..66f4adf9 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -37,7 +37,7 @@ bool lockModules = false; #else int frameSwapInterval = 1; #endif -float autosavePeriod = 15.0; +float autosaveInterval = 15.0; bool skipLoadOnLaunch = false; std::string patchPath; std::list recentPatchPaths; @@ -90,7 +90,7 @@ json_t* toJson() { json_object_set_new(rootJ, "frameSwapInterval", json_integer(frameSwapInterval)); - json_object_set_new(rootJ, "autosavePeriod", json_real(autosavePeriod)); + json_object_set_new(rootJ, "autosaveInterval", json_real(autosaveInterval)); if (skipLoadOnLaunch) json_object_set_new(rootJ, "skipLoadOnLaunch", json_boolean(true)); @@ -196,9 +196,9 @@ void fromJson(json_t* rootJ) { if (frameSwapIntervalJ) frameSwapInterval = json_integer_value(frameSwapIntervalJ); - json_t* autosavePeriodJ = json_object_get(rootJ, "autosavePeriod"); - if (autosavePeriodJ) - autosavePeriod = json_number_value(autosavePeriodJ); + json_t* autosaveIntervalJ = json_object_get(rootJ, "autosaveInterval"); + if (autosaveIntervalJ) + autosaveInterval = json_number_value(autosaveIntervalJ); json_t* skipLoadOnLaunchJ = json_object_get(rootJ, "skipLoadOnLaunch"); if (skipLoadOnLaunchJ)