mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2025-06-25 20:07:51 +02:00
Updated to ImGui 1.87 to cleanup UI code
This commit is contained in:
@ -13,7 +13,6 @@
|
||||
#include <gui/file_dialogs.h>
|
||||
#include <utils/freq_formatting.h>
|
||||
#include <gui/dialogs/dialog_box.h>
|
||||
#include <keybinds.h>
|
||||
|
||||
SDRPP_MOD_INFO{
|
||||
/* Name: */ "frequency_manager",
|
||||
@ -197,7 +196,7 @@ private:
|
||||
bool open = true;
|
||||
gui::mainWindow.lockWaterfallControls = true;
|
||||
|
||||
float menuWidth = ImGui::GetContentRegionAvailWidth();
|
||||
float menuWidth = ImGui::GetContentRegionAvail().x;
|
||||
|
||||
std::string id = "New##freq_manager_new_popup_" + name;
|
||||
ImGui::OpenPopup(id.c_str());
|
||||
@ -245,7 +244,7 @@ private:
|
||||
bool selectListsDialog() {
|
||||
gui::mainWindow.lockWaterfallControls = true;
|
||||
|
||||
float menuWidth = ImGui::GetContentRegionAvailWidth();
|
||||
float menuWidth = ImGui::GetContentRegionAvail().x;
|
||||
|
||||
std::string id = "Select lists##freq_manager_sel_popup_" + name;
|
||||
ImGui::OpenPopup(id.c_str());
|
||||
@ -349,7 +348,7 @@ private:
|
||||
|
||||
static void menuHandler(void* ctx) {
|
||||
FrequencyManagerModule* _this = (FrequencyManagerModule*)ctx;
|
||||
float menuWidth = ImGui::GetContentRegionAvailWidth();
|
||||
float menuWidth = ImGui::GetContentRegionAvail().x;
|
||||
|
||||
// TODO: Replace with something that won't iterate every frame
|
||||
std::vector<std::string> selectedNames;
|
||||
@ -422,7 +421,7 @@ private:
|
||||
ImGui::TableNextRow();
|
||||
|
||||
ImGui::TableSetColumnIndex(0);
|
||||
if (ImGui::Button(("Add##_freq_mgr_add_" + _this->name).c_str(), ImVec2(ImGui::GetContentRegionAvailWidth(), 0))) {
|
||||
if (ImGui::Button(("Add##_freq_mgr_add_" + _this->name).c_str(), ImVec2(ImGui::GetContentRegionAvail().x, 0))) {
|
||||
// If there's no VFO selected, just save the center freq
|
||||
if (gui::waterfall.selectedVFO == "") {
|
||||
_this->editedBookmark.frequency = gui::waterfall.getCenterFrequency();
|
||||
@ -460,13 +459,13 @@ private:
|
||||
|
||||
ImGui::TableSetColumnIndex(1);
|
||||
if (selectedNames.size() == 0 && _this->selectedListName != "") { style::beginDisabled(); }
|
||||
if (ImGui::Button(("Remove##_freq_mgr_rem_" + _this->name).c_str(), ImVec2(ImGui::GetContentRegionAvailWidth(), 0))) {
|
||||
if (ImGui::Button(("Remove##_freq_mgr_rem_" + _this->name).c_str(), ImVec2(ImGui::GetContentRegionAvail().x, 0))) {
|
||||
_this->deleteBookmarksOpen = true;
|
||||
}
|
||||
if (selectedNames.size() == 0 && _this->selectedListName != "") { style::endDisabled(); }
|
||||
ImGui::TableSetColumnIndex(2);
|
||||
if (selectedNames.size() != 1 && _this->selectedListName != "") { style::beginDisabled(); }
|
||||
if (ImGui::Button(("Edit##_freq_mgr_edt_" + _this->name).c_str(), ImVec2(ImGui::GetContentRegionAvailWidth(), 0))) {
|
||||
if (ImGui::Button(("Edit##_freq_mgr_edt_" + _this->name).c_str(), ImVec2(ImGui::GetContentRegionAvail().x, 0))) {
|
||||
_this->editOpen = true;
|
||||
_this->editedBookmark = _this->bookmarks[selectedNames[0]];
|
||||
_this->editedBookmarkName = selectedNames[0];
|
||||
@ -498,8 +497,7 @@ private:
|
||||
|
||||
if (ImGui::Selectable((name + "##_freq_mgr_bkm_name_" + _this->name).c_str(), &bm.selected, ImGuiSelectableFlags_SpanAllColumns | ImGuiSelectableFlags_SelectOnClick)) {
|
||||
// if shift or control isn't pressed, deselect all others
|
||||
if (!ImGui::IsKeyDown(KB_KEY_LSHIFT) && !ImGui::IsKeyDown(KB_KEY_RSHIFT) &&
|
||||
!ImGui::IsKeyDown(KB_KEY_LCTRL) && !ImGui::IsKeyDown(KB_KEY_RCTRL)) {
|
||||
if (!ImGui::GetIO().KeyShift && !ImGui::GetIO().KeyCtrl) {
|
||||
for (auto& [_name, _bm] : _this->bookmarks) {
|
||||
if (name == _name) { continue; }
|
||||
_bm.selected = false;
|
||||
@ -531,14 +529,14 @@ private:
|
||||
ImGui::TableNextRow();
|
||||
|
||||
ImGui::TableSetColumnIndex(0);
|
||||
if (ImGui::Button(("Import##_freq_mgr_imp_" + _this->name).c_str(), ImVec2(ImGui::GetContentRegionAvailWidth(), 0)) && !_this->importOpen) {
|
||||
if (ImGui::Button(("Import##_freq_mgr_imp_" + _this->name).c_str(), ImVec2(ImGui::GetContentRegionAvail().x, 0)) && !_this->importOpen) {
|
||||
_this->importOpen = true;
|
||||
_this->importDialog = new pfd::open_file("Import bookmarks", "", { "JSON Files (*.json)", "*.json", "All Files", "*" }, true);
|
||||
}
|
||||
|
||||
ImGui::TableSetColumnIndex(1);
|
||||
if (selectedNames.size() == 0 && _this->selectedListName != "") { style::beginDisabled(); }
|
||||
if (ImGui::Button(("Export##_freq_mgr_exp_" + _this->name).c_str(), ImVec2(ImGui::GetContentRegionAvailWidth(), 0)) && !_this->exportOpen) {
|
||||
if (ImGui::Button(("Export##_freq_mgr_exp_" + _this->name).c_str(), ImVec2(ImGui::GetContentRegionAvail().x, 0)) && !_this->exportOpen) {
|
||||
_this->exportedBookmarks = json::object();
|
||||
config.acquire();
|
||||
for (auto& _name : selectedNames) {
|
||||
|
@ -193,7 +193,7 @@ private:
|
||||
|
||||
static void menuHandler(void* ctx) {
|
||||
RecorderModule* _this = (RecorderModule*)ctx;
|
||||
float menuColumnWidth = ImGui::GetContentRegionAvailWidth();
|
||||
float menuColumnWidth = ImGui::GetContentRegionAvail().x;
|
||||
|
||||
// Recording mode
|
||||
if (_this->recording) { style::beginDisabled(); }
|
||||
|
@ -107,7 +107,7 @@ public:
|
||||
private:
|
||||
static void menuHandler(void* ctx) {
|
||||
SigctlServerModule* _this = (SigctlServerModule*)ctx;
|
||||
float menuWidth = ImGui::GetContentRegionAvailWidth();
|
||||
float menuWidth = ImGui::GetContentRegionAvail().x;
|
||||
|
||||
bool listening = (_this->listener && _this->listener->isListening());
|
||||
|
||||
|
@ -3,7 +3,6 @@
|
||||
#include <gui/gui.h>
|
||||
#include <sched_task.h>
|
||||
#include <map>
|
||||
#include <keybinds.h>
|
||||
|
||||
SDRPP_MOD_INFO{
|
||||
/* Name: */ "scheduler",
|
||||
@ -101,8 +100,7 @@ private:
|
||||
|
||||
if (ImGui::Selectable((name + "##_freq_mgr_bkm_name_" + _this->name).c_str(), &bm.selected, ImGuiSelectableFlags_SpanAllColumns | ImGuiSelectableFlags_SelectOnClick)) {
|
||||
// if shift or control isn't pressed, deselect all others
|
||||
if (!ImGui::IsKeyDown(KB_KEY_LSHIFT) && !ImGui::IsKeyDown(KB_KEY_RSHIFT) &&
|
||||
!ImGui::IsKeyDown(KB_KEY_LCTRL) && !ImGui::IsKeyDown(KB_KEY_RCTRL)) {
|
||||
if (!ImGui::GetIO().KeyShift && !ImGui::GetIO().KeyCtrl) {
|
||||
for (auto& [_name, _bm] : _this->tasks) {
|
||||
if (name == _name) { continue; }
|
||||
_bm.selected = false;
|
||||
|
@ -3,7 +3,6 @@
|
||||
#include <imgui.h>
|
||||
#include <gui/style.h>
|
||||
#include <sched_action.h>
|
||||
#include <keybinds.h>
|
||||
|
||||
class Task {
|
||||
public:
|
||||
@ -78,8 +77,7 @@ public:
|
||||
|
||||
if (ImGui::Selectable((act->getName() + "##scheduler_task_actions_entry").c_str(), &act->selected, ImGuiSelectableFlags_SpanAllColumns | ImGuiSelectableFlags_SelectOnClick)) {
|
||||
// if shift or control isn't pressed, deselect all others
|
||||
if (!ImGui::IsKeyDown(KB_KEY_LSHIFT) && !ImGui::IsKeyDown(KB_KEY_RSHIFT) &&
|
||||
!ImGui::IsKeyDown(KB_KEY_LCTRL) && !ImGui::IsKeyDown(KB_KEY_RCTRL)) {
|
||||
if (!ImGui::GetIO().KeyShift && !ImGui::GetIO().KeyCtrl) {
|
||||
int _id = 0;
|
||||
for (auto& _act : actions) {
|
||||
if (_id == id) { continue; }
|
||||
|
Reference in New Issue
Block a user