a more reliable/robust/less complex version of previous commit
[ardour.git] / gtk2_ardour / script_selector.h
1 /*
2  * Copyright (C) 2016 Robin Gareus <robin@gareus.org>
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
17  */
18
19 #include <gtkmm.h>
20 #include "ardour/luascripting.h"
21
22 #include "ardour_dialog.h"
23
24 class ScriptSelector : public ArdourDialog
25 {
26 public:
27         ScriptSelector (std::string title, ARDOUR::LuaScriptInfo::ScriptType t);
28         ARDOUR::LuaScriptInfoPtr script() const { return _script; }
29
30 private:
31         void setup_list ();
32         void refresh ();
33         void script_combo_changed ();
34
35         Gtk::Button* _add;
36         Gtk::ComboBoxText _script_combo;
37
38         Gtk::Label  _type;
39         Gtk::Label  _author;
40         Gtk::Label  _description;
41
42         ARDOUR::LuaScriptList _scripts;
43         ARDOUR::LuaScriptInfoPtr _script;
44         ARDOUR::LuaScriptInfo::ScriptType _script_type;
45         sigc::connection _combocon;
46 };
47
48 class SessionScriptManager : public ArdourDialog
49 {
50 public:
51         SessionScriptManager (std::string title, const std::vector<std::string>&);
52         std::string name () { return _names_combo.get_active_text (); }
53
54 private:
55         Gtk::ComboBoxText _names_combo;
56 };
57
58 class ScriptParameterDialog : public ArdourDialog
59 {
60 public:
61         ScriptParameterDialog (std::string title, const ARDOUR::LuaScriptInfoPtr&, const std::vector<std::string>&, ARDOUR::LuaScriptParamList&);
62         std::string name () { return _name_entry.get_text (); }
63
64 private:
65         void update_sensitivity ();
66         void active_changed (int, Gtk::CheckButton*, Gtk::Entry*);
67         void value_changed (int, Gtk::Entry*);
68
69         Gtk::Entry _name_entry;
70         Gtk::Button* _add;
71         const std::vector<std::string> &_existing_names;
72         ARDOUR::LuaScriptParamList& _lsp;
73 };