From a90607a136a2896e916263ff7eb9780effe91228 Mon Sep 17 00:00:00 2001 From: rdanbrook <1869094+rdanbrook@users.noreply.github.com> Date: Tue, 29 Oct 2024 21:09:35 -0600 Subject: [PATCH] FLTK: Grey out the CRT options when the CRT filter isn't active --- source/fltkui/fltkui.cpp | 1 + source/fltkui/fltkui_settings.cpp | 28 ++++++++++++++++++++++++++++ source/fltkui/fltkui_settings.h | 1 + 3 files changed, 30 insertions(+) diff --git a/source/fltkui/fltkui.cpp b/source/fltkui/fltkui.cpp index 07feebf..1ff4a90 100644 --- a/source/fltkui/fltkui.cpp +++ b/source/fltkui/fltkui.cpp @@ -614,6 +614,7 @@ void FltkUi::nstwin_open(const char *name) { // Settings Window setwin = new NstSettingsWindow(500, 550, "Settings", *jgm, *setmgr, *inputmgr); + setwin->set_crt_active(setmgr->get_setting("v_postproc")->val == 3); // Main Window nstwin = new NstWindow(rw, rh + UI_MBARHEIGHT, name); diff --git a/source/fltkui/fltkui_settings.cpp b/source/fltkui/fltkui_settings.cpp index 8bac844..bd1933a 100644 --- a/source/fltkui/fltkui_settings.cpp +++ b/source/fltkui/fltkui_settings.cpp @@ -237,6 +237,30 @@ void NstSettingsWindow::set_choice_value(std::string tab, std::string label, int } } +void NstSettingsWindow::set_crt_active(bool active) { + Fl_Group *g = this->as_group()->child(0)->as_group(); + + for (int i = 0; i < g->children(); ++i) { + if (std::string(g->child(i)->label()) == "Interface") { + g = g->child(i)->as_group(); + break; + } + } + + for (int i = 0; i < g->children(); ++i) { + if (g->child(i)->label()) { + if (std::string(g->child(i)->label()).find("CRT") != std::string::npos) { + if (active) { + g->child(i)->activate(); + } + else { + g->child(i)->deactivate(); + } + } + } + } +} + void NstSettingsWindow::cb_chooser(Fl_Widget *w, void *data) { jg_setting_t *setting = (jg_setting_t*)data; setting->val = ((Fl_Choice*)w)->value(); @@ -248,6 +272,10 @@ void NstSettingsWindow::cb_chooser(Fl_Widget *w, void *data) { jgm.rehash(); } + if (std::string(setting->name) == "v_postproc") { + set_crt_active(setting->val == 3); + } + if (setting->flags & JG_SETTING_INPUT) { inputmgr.reassign(); } diff --git a/source/fltkui/fltkui_settings.h b/source/fltkui/fltkui_settings.h index cd4aa00..78a46dc 100644 --- a/source/fltkui/fltkui_settings.h +++ b/source/fltkui/fltkui_settings.h @@ -37,6 +37,7 @@ public: NstSettingsWindow(int w, int h, const char* t, JGManager& j, SettingManager& m, InputManager& i); void set_choice_value(std::string tab, std::string label, int val); + void set_crt_active(bool active); void show_inputmsg(int show); private: