Use a label for required script instance parameters
authorRobin Gareus <robin@gareus.org>
Mon, 13 Mar 2017 20:25:16 +0000 (21:25 +0100)
committerRobin Gareus <robin@gareus.org>
Mon, 13 Mar 2017 20:25:16 +0000 (21:25 +0100)
gtk2_ardour/script_selector.cc

index a80a0af1cc0ba2c325114872e5210b3efc49ee2c..c13b122cd1faff681154cd9a595c5aa2faa7910e 100644 (file)
@@ -176,17 +176,21 @@ ScriptParameterDialog::ScriptParameterDialog (std::string title,
        }
 
        for (size_t i = 0; i < _lsp.size (); ++i) {
-               CheckButton* c = manage (new CheckButton (_lsp[i]->title));
                Entry* e = manage (new Entry());
-               c->set_active (!_lsp[i]->optional); // also if default ??
-               c->set_sensitive (_lsp[i]->optional);
-               e->set_text (_lsp[i]->dflt);
-               e->set_sensitive (c->get_active ());
+               if (_lsp[i]->optional) {
+                       CheckButton* c = manage (new CheckButton (_lsp[i]->title));
+                       c->set_active (!_lsp[i]->dflt.empty());
+                       c->signal_toggled().connect (sigc::bind (sigc::mem_fun (*this, &ScriptParameterDialog::active_changed), i, c, e));
+                       t->attach (*c, 0, 1, ty, ty+1);
+               } else {
+                       Label* l = manage (new Label (_lsp[i]->title, Gtk::ALIGN_LEFT));
+                       t->attach (*l, 0, 1, ty, ty+1);
+               }
 
-               c->signal_toggled().connect (sigc::bind (sigc::mem_fun (*this, &ScriptParameterDialog::active_changed), i, c, e));
+               e->set_text (_lsp[i]->dflt);
+               e->set_sensitive (!_lsp[i]->dflt.empty());
                e->signal_changed().connect (sigc::bind (sigc::mem_fun (*this, &ScriptParameterDialog::value_changed), i, e));
 
-               t->attach (*c, 0, 1, ty, ty+1);
                t->attach (*e, 1, 2, ty, ty+1);
                ++ty;
        }