FLTK: Grey out the CRT options when the CRT filter isn't active

This commit is contained in:
rdanbrook 2024-10-29 21:09:35 -06:00
parent e6e98ace97
commit a90607a136
3 changed files with 30 additions and 0 deletions

View file

@ -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);

View file

@ -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();
}

View file

@ -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: