diff --git a/core/src/core.cpp b/core/src/core.cpp index 211d69a9..350df093 100644 --- a/core/src/core.cpp +++ b/core/src/core.cpp @@ -221,6 +221,12 @@ int sdrpp_main(int argc, char* argv[]) { defConfig["vfoColors"]["Radio"] = "#FFFFFF"; +#ifdef __ANDROID__ + defConfig["lockMenuOrder"] = true; +#else + defConfig["lockMenuOrder"] = false; +#endif + #if defined(_WIN32) defConfig["modulesDirectory"] = "./modules"; defConfig["resourcesDirectory"] = "./res"; diff --git a/core/src/gui/main_window.cpp b/core/src/gui/main_window.cpp index 7dc0e80b..0c377fdd 100644 --- a/core/src/gui/main_window.cpp +++ b/core/src/gui/main_window.cpp @@ -537,6 +537,7 @@ void MainWindow::draw() { } ImGui::Checkbox("WF Single Click", &gui::waterfall.VFOMoveSingleClick); + ImGui::Checkbox("Lock Menu Order", &gui::menu.locked); ImGui::Spacing(); } diff --git a/core/src/gui/menus/display.cpp b/core/src/gui/menus/display.cpp index 0095d6a0..cf298f8f 100644 --- a/core/src/gui/menus/display.cpp +++ b/core/src/gui/menus/display.cpp @@ -91,6 +91,8 @@ namespace displaymenu { selectedWindow = std::clamp((int)core::configManager.conf["fftWindow"], 0, _FFT_WINDOW_COUNT - 1); gui::mainWindow.setFFTWindow(selectedWindow); + gui::menu.locked = core::configManager.conf["lockMenuOrder"]; + // Define and load UI scales uiScales.define(1.0f, "100%", 1.0f); uiScales.define(2.0f, "200%", 2.0f); @@ -124,6 +126,12 @@ namespace displaymenu { core::configManager.release(true); } + if (ImGui::Checkbox("Lock Menu Order##_sdrpp", &gui::menu.locked)) { + core::configManager.acquire(); + core::configManager.conf["lockMenuOrder"] = gui::menu.locked; + core::configManager.release(true); + } + ImGui::LeftLabel("High-DPI Scaling"); ImGui::FillWidth(); if (ImGui::Combo("##sdrpp_ui_scale", &uiScaleId, uiScales.txt)) { diff --git a/core/src/gui/widgets/menu.cpp b/core/src/gui/widgets/menu.cpp index 29eecbd2..c53d7a42 100644 --- a/core/src/gui/widgets/menu.cpp +++ b/core/src/gui/widgets/menu.cpp @@ -88,7 +88,7 @@ bool Menu::draw(bool updateStates) { clickedMenuName = opt.name; } - if (menuClicked && ImGui::IsMouseDragging(ImGuiMouseButton_Left) && draggedMenuName.empty() && clickedMenuName == opt.name) { + if (menuClicked && ImGui::IsMouseDragging(ImGuiMouseButton_Left) && draggedMenuName.empty() && clickedMenuName == opt.name && !locked) { draggedMenuName = opt.name; draggedId = rawId - 1; draggedOpt = opt; diff --git a/core/src/gui/widgets/menu.h b/core/src/gui/widgets/menu.h index 1e85cb90..91595717 100644 --- a/core/src/gui/widgets/menu.h +++ b/core/src/gui/widgets/menu.h @@ -27,9 +27,12 @@ public: std::vector order; + bool locked = false; + private: bool isInOrderList(std::string name); + bool menuClicked = false; std::string clickedMenuName = ""; std::string draggedMenuName = "";