replace ::cast_dynamic() with relevant ActionManager::get_*_action() calls
[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/button.h>
20 #include <gtkmm/comboboxtext.h>
21 #include <gtkmm/label.h>
22
23 #include "ardour/luascripting.h"
24
25 #include "ardour_dialog.h"
26
27 class ScriptSelector : public ArdourDialog
28 {
29 public:
30         ScriptSelector (std::string title, ARDOUR::LuaScriptInfo::ScriptType t);
31         ARDOUR::LuaScriptInfoPtr script() const { return _script; }
32
33 private:
34         void setup_list ();
35         void refresh ();
36         void script_combo_changed ();
37         bool script_separator (const Glib::RefPtr<Gtk::TreeModel> &, const Gtk::TreeModel::iterator &i);
38         
39         Gtk::Button* _add;
40         Gtk::ComboBoxText _script_combo;
41
42         Gtk::Label  _type_label;
43         Gtk::Label  _type;
44         Gtk::Label  _author_label;
45         Gtk::Label  _author;
46         Gtk::Label  _description;
47
48         ARDOUR::LuaScriptList _scripts;
49         ARDOUR::LuaScriptInfoPtr _script;
50         ARDOUR::LuaScriptInfo::ScriptType _script_type;
51         sigc::connection _combocon;
52 };
53
54 class SessionScriptManager : public ArdourDialog
55 {
56 public:
57         SessionScriptManager (std::string title, const std::vector<std::string>&);
58         std::string name () { return _names_combo.get_active_text (); }
59
60 private:
61         Gtk::ComboBoxText _names_combo;
62 };
63
64 class ScriptParameterDialog : public ArdourDialog
65 {
66 public:
67         ScriptParameterDialog (std::string title, const ARDOUR::LuaScriptInfoPtr&, const std::vector<std::string>&, ARDOUR::LuaScriptParamList&);
68         std::string name () { return _name_entry.get_text (); }
69         bool need_interation () const;
70
71 private:
72         void update_sensitivity ();
73         bool parameters_ok () const;
74         void active_changed (int, Gtk::CheckButton*, Gtk::Entry*);
75         void value_changed (int, Gtk::Entry*);
76
77         Gtk::Entry _name_entry;
78         Gtk::Button* _add;
79         const std::vector<std::string> &_existing_names;
80         ARDOUR::LuaScriptParamList& _lsp;
81 };