From 466785d8fa9ce57c171e8696954d1556b76f1e44 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Sun, 30 May 2021 07:44:45 -0400 Subject: [PATCH] Move control settings from View menu to Edit menu. --- src/app/MenuBar.cpp | 190 ++++++++++++++++++++++---------------------- 1 file changed, 97 insertions(+), 93 deletions(-) diff --git a/src/app/MenuBar.cpp b/src/app/MenuBar.cpp index 0b9ffc99..4130d149 100644 --- a/src/app/MenuBar.cpp +++ b/src/app/MenuBar.cpp @@ -220,6 +220,52 @@ struct DisconnectCablesItem : ui::MenuItem { } }; +struct AllowCursorLockItem : ui::MenuItem { + void onAction(const ActionEvent& e) override { + settings::allowCursorLock ^= true; + } +}; + +struct KnobModeValueItem : ui::MenuItem { + settings::KnobMode knobMode; + void onAction(const ActionEvent& e) override { + settings::knobMode = knobMode; + } +}; + +struct KnobModeItem : ui::MenuItem { + ui::Menu* createChildMenu() override { + ui::Menu* menu = new ui::Menu; + + static const std::vector> knobModes = { + {settings::KNOB_MODE_LINEAR, "Linear"}, + {settings::KNOB_MODE_SCALED_LINEAR, "Scaled linear"}, + {settings::KNOB_MODE_ROTARY_ABSOLUTE, "Absolute rotary"}, + {settings::KNOB_MODE_ROTARY_RELATIVE, "Relative rotary"}, + }; + for (const auto& pair : knobModes) { + KnobModeValueItem* item = new KnobModeValueItem; + item->knobMode = pair.first; + item->text = pair.second; + item->rightText = CHECKMARK(settings::knobMode == pair.first); + menu->addChild(item); + } + return menu; + } +}; + +struct KnobScrollItem : ui::MenuItem { + void onAction(const ActionEvent& e) override { + settings::knobScroll ^= true; + } +}; + +struct LockModulesItem : ui::MenuItem { + void onAction(const ActionEvent& e) override { + settings::lockModules ^= true; + } +}; + struct EditButton : MenuButton { void onAction(const ActionEvent& e) override { ui::Menu* menu = createMenu(); @@ -241,6 +287,28 @@ struct EditButton : MenuButton { DisconnectCablesItem* disconnectCablesItem = new DisconnectCablesItem; disconnectCablesItem->text = "Clear cables"; menu->addChild(disconnectCablesItem); + + menu->addChild(new ui::MenuSeparator); + + AllowCursorLockItem* allowCursorLockItem = new AllowCursorLockItem; + allowCursorLockItem->text = "Lock cursor when dragging parameters"; + allowCursorLockItem->rightText = CHECKMARK(settings::allowCursorLock); + menu->addChild(allowCursorLockItem); + + KnobModeItem* knobModeItem = new KnobModeItem; + knobModeItem->text = "Knob mode"; + knobModeItem->rightText = RIGHT_ARROW; + menu->addChild(knobModeItem); + + KnobScrollItem* knobScrollItem = new KnobScrollItem; + knobScrollItem->text = "Scroll wheel knob control"; + knobScrollItem->rightText = CHECKMARK(settings::knobScroll); + menu->addChild(knobScrollItem); + + LockModulesItem* lockModulesItem = new LockModulesItem; + lockModulesItem->text = "Lock module positions"; + lockModulesItem->rightText = CHECKMARK(settings::lockModules); + menu->addChild(lockModulesItem); } }; @@ -420,52 +488,6 @@ struct TooltipsItem : ui::MenuItem { } }; -struct AllowCursorLockItem : ui::MenuItem { - void onAction(const ActionEvent& e) override { - settings::allowCursorLock ^= true; - } -}; - -struct KnobModeValueItem : ui::MenuItem { - settings::KnobMode knobMode; - void onAction(const ActionEvent& e) override { - settings::knobMode = knobMode; - } -}; - -struct KnobModeItem : ui::MenuItem { - ui::Menu* createChildMenu() override { - ui::Menu* menu = new ui::Menu; - - static const std::vector> knobModes = { - {settings::KNOB_MODE_LINEAR, "Linear"}, - {settings::KNOB_MODE_SCALED_LINEAR, "Scaled linear"}, - {settings::KNOB_MODE_ROTARY_ABSOLUTE, "Absolute rotary"}, - {settings::KNOB_MODE_ROTARY_RELATIVE, "Relative rotary"}, - }; - for (const auto& pair : knobModes) { - KnobModeValueItem* item = new KnobModeValueItem; - item->knobMode = pair.first; - item->text = pair.second; - item->rightText = CHECKMARK(settings::knobMode == pair.first); - menu->addChild(item); - } - return menu; - } -}; - -struct KnobScrollItem : ui::MenuItem { - void onAction(const ActionEvent& e) override { - settings::knobScroll ^= true; - } -}; - -struct LockModulesItem : ui::MenuItem { - void onAction(const ActionEvent& e) override { - settings::lockModules ^= true; - } -}; - struct FrameRateValueItem : ui::MenuItem { int frameSwapInterval; void onAction(const ActionEvent& e) override { @@ -507,57 +529,37 @@ struct ViewButton : MenuButton { tooltipsItem->rightText = CHECKMARK(settings::tooltips); menu->addChild(tooltipsItem); - AllowCursorLockItem* allowCursorLockItem = new AllowCursorLockItem; - allowCursorLockItem->text = "Lock cursor when dragging parameters"; - allowCursorLockItem->rightText = CHECKMARK(settings::allowCursorLock); - menu->addChild(allowCursorLockItem); - - KnobModeItem* knobModeItem = new KnobModeItem; - knobModeItem->text = "Knob mode"; - knobModeItem->rightText = RIGHT_ARROW; - menu->addChild(knobModeItem); - - KnobScrollItem* knobScrollItem = new KnobScrollItem; - knobScrollItem->text = "Scroll wheel knob control"; - knobScrollItem->rightText = CHECKMARK(settings::knobScroll); - menu->addChild(knobScrollItem); + FrameRateItem* frameRateItem = new FrameRateItem; + frameRateItem->text = "Frame rate"; + frameRateItem->rightText = RIGHT_ARROW; + menu->addChild(frameRateItem); - LockModulesItem* lockModulesItem = new LockModulesItem; - lockModulesItem->text = "Lock module positions"; - lockModulesItem->rightText = CHECKMARK(settings::lockModules); - menu->addChild(lockModulesItem); + FullscreenItem* fullscreenItem = new FullscreenItem; + fullscreenItem->text = "Fullscreen"; + fullscreenItem->rightText = "F11"; + if (APP->window->isFullScreen()) + fullscreenItem->rightText = CHECKMARK_STRING " " + fullscreenItem->rightText; + menu->addChild(fullscreenItem); ZoomSlider* zoomSlider = new ZoomSlider; - zoomSlider->box.size.x = 200.0; + zoomSlider->box.size.x = 250.0; menu->addChild(zoomSlider); CableOpacitySlider* cableOpacitySlider = new CableOpacitySlider; - cableOpacitySlider->box.size.x = 200.0; + cableOpacitySlider->box.size.x = 250.0; menu->addChild(cableOpacitySlider); CableTensionSlider* cableTensionSlider = new CableTensionSlider; - cableTensionSlider->box.size.x = 200.0; + cableTensionSlider->box.size.x = 250.0; menu->addChild(cableTensionSlider); RackBrightnessSlider* rackBrightnessSlider = new RackBrightnessSlider; - rackBrightnessSlider->box.size.x = 200.0; + rackBrightnessSlider->box.size.x = 250.0; menu->addChild(rackBrightnessSlider); HaloBrightnessSlider* haloBrightnessSlider = new HaloBrightnessSlider; - haloBrightnessSlider->box.size.x = 200.0; + haloBrightnessSlider->box.size.x = 250.0; menu->addChild(haloBrightnessSlider); - - FrameRateItem* frameRateItem = new FrameRateItem; - frameRateItem->text = "Frame rate"; - frameRateItem->rightText = RIGHT_ARROW; - menu->addChild(frameRateItem); - - FullscreenItem* fullscreenItem = new FullscreenItem; - fullscreenItem->text = "Fullscreen"; - fullscreenItem->rightText = "F11"; - if (APP->window->isFullScreen()) - fullscreenItem->rightText = CHECKMARK_STRING " " + fullscreenItem->rightText; - menu->addChild(fullscreenItem); } }; @@ -1009,18 +1011,6 @@ struct HelpButton : MenuButton { menu->box.pos = getAbsoluteOffset(math::Vec(0, box.size.y)); menu->box.size.x = box.size.x; - if (library::isAppUpdateAvailable()) { - AppUpdateItem* appUpdateItem = new AppUpdateItem; - appUpdateItem->text = "Update " + APP_NAME; - appUpdateItem->rightText = APP_VERSION + " → " + library::appVersion; - menu->addChild(appUpdateItem); - } - else if (!settings::autoCheckUpdates && !settings::devMode) { - CheckAppUpdateItem* checkAppUpdateItem = new CheckAppUpdateItem; - checkAppUpdateItem->text = "Check for " + APP_NAME + " update"; - menu->addChild(checkAppUpdateItem); - } - TipItem* tipItem = new TipItem; tipItem->text = "Tips"; menu->addChild(tipItem); @@ -1036,6 +1026,20 @@ struct HelpButton : MenuButton { websiteItem->url = "https://vcvrack.com/"; menu->addChild(websiteItem); + menu->addChild(new ui::MenuSeparator); + + if (library::isAppUpdateAvailable()) { + AppUpdateItem* appUpdateItem = new AppUpdateItem; + appUpdateItem->text = "Update " + APP_NAME; + appUpdateItem->rightText = APP_VERSION + " → " + library::appVersion; + menu->addChild(appUpdateItem); + } + else if (!settings::autoCheckUpdates && !settings::devMode) { + CheckAppUpdateItem* checkAppUpdateItem = new CheckAppUpdateItem; + checkAppUpdateItem->text = "Check for " + APP_NAME + " update"; + menu->addChild(checkAppUpdateItem); + } + FolderItem* folderItem = new FolderItem; folderItem->text = "Open user folder"; folderItem->path = asset::user("");