From 0741f265d79c3d7c5279171bbbbdbd36fe389850 Mon Sep 17 00:00:00 2001 From: Ryzerth Date: Wed, 28 Jul 2021 20:16:31 +0200 Subject: [PATCH] Fixed bugs with the frequency manager --- core/src/version.h | 2 +- frequency_manager/src/main.cpp | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/core/src/version.h b/core/src/version.h index 7a2ed301..e9d9683a 100644 --- a/core/src/version.h +++ b/core/src/version.h @@ -1,3 +1,3 @@ #pragma once -#define VERSION_STR "1.0.0_rc1" \ No newline at end of file +#define VERSION_STR "1.0.0_rc2" \ No newline at end of file diff --git a/frequency_manager/src/main.cpp b/frequency_manager/src/main.cpp index 7868ab04..d65fc519 100644 --- a/frequency_manager/src/main.cpp +++ b/frequency_manager/src/main.cpp @@ -198,19 +198,20 @@ private: ImGui::EndTable(); - if (strlen(nameBuf) == 0) { style::beginDisabled(); } + bool applyDisabled = (strlen(nameBuf) == 0) || (bookmarks.find(editedBookmarkName) != bookmarks.end() && editedBookmarkName != firstEditedBookmarkName); + if (applyDisabled) { style::beginDisabled(); } if (ImGui::Button("Apply")) { open = false; // If editing, delete the original one if (editOpen) { - bookmarks.erase(firstEeditedBookmarkName); + bookmarks.erase(firstEditedBookmarkName); } - bookmarks[nameBuf] = editedBookmark; + bookmarks[editedBookmarkName] = editedBookmark; saveByName(selectedListName); } - if (strlen(nameBuf) == 0) { style::endDisabled(); } + if (applyDisabled) { style::endDisabled(); } ImGui::SameLine(); if (ImGui::Button("Cancel")) { open = false; @@ -463,7 +464,7 @@ private: _this->editedBookmark.selected = false; - _this->editOpen = true; + _this->createOpen = true; // Find new unique default name if (_this->bookmarks.find("New Bookmark") == _this->bookmarks.end()) { @@ -492,7 +493,7 @@ private: _this->editOpen = true; _this->editedBookmark = _this->bookmarks[selectedNames[0]]; _this->editedBookmarkName = selectedNames[0]; - _this->firstEeditedBookmarkName = selectedNames[0]; + _this->firstEditedBookmarkName = selectedNames[0]; } if (selectedNames.size() != 1 && _this->selectedListName != "") { style::endDisabled(); } @@ -808,7 +809,7 @@ private: std::map bookmarks; std::string editedBookmarkName = ""; - std::string firstEeditedBookmarkName = ""; + std::string firstEditedBookmarkName = ""; FrequencyBookmark editedBookmark; std::vector listNames;