OSC: no op, white space cleanup
[ardour.git] / gtk2_ardour / lua_script_manager.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 #ifndef _gtk2_ardour_lua_script_manager_h_
20 #define _gtk2_ardour_lua_script_manager_h_
21
22 #include <gtkmm.h>
23 #include "ardour/luascripting.h"
24
25 #include "ardour_window.h"
26 #include "luainstance.h"
27
28 class LuaScriptManager : public ArdourWindow
29 {
30 public:
31         LuaScriptManager ();
32
33 protected:
34         void session_going_away();
35
36 private:
37         Gtk::Notebook pages;
38
39         /* action scripts */
40         void setup_actions ();
41         void action_selection_changed ();
42         void set_action_script_name (int, const std::string&);
43
44         void set_action_btn_clicked ();
45         void del_action_btn_clicked ();
46         void edit_action_btn_clicked ();
47         void call_action_btn_clicked ();
48
49         class LuaActionScriptModelColumns : public Gtk::TreeModelColumnRecord
50         {
51                 public:
52                         LuaActionScriptModelColumns ()
53                         {
54                                 add (id);
55                                 add (action);
56                                 add (name);
57                                 add (enabled);
58                         }
59
60                         Gtk::TreeModelColumn<int> id;
61                         Gtk::TreeModelColumn<std::string> action;
62                         Gtk::TreeModelColumn<std::string> name;
63                         Gtk::TreeModelColumn<bool> enabled;
64         };
65
66         Gtk::Button _a_set_button;
67         Gtk::Button _a_del_button;
68         Gtk::Button _a_edit_button;
69         Gtk::Button _a_call_button;
70
71         Glib::RefPtr<Gtk::ListStore> _a_store;
72         LuaActionScriptModelColumns _a_model;
73         Gtk::TreeView _a_view;
74
75         /* action callback hooks */
76         void setup_callbacks ();
77         void callback_selection_changed ();
78         void set_callback_script_name (PBD::ID, const std::string&, const ActionHook& ah);
79
80         void add_callback_btn_clicked ();
81         void del_callback_btn_clicked ();
82
83         class LuaCallbackScriptModelColumns : public Gtk::TreeModelColumnRecord
84         {
85                 public:
86                         LuaCallbackScriptModelColumns ()
87                         {
88                                 add (id);
89                                 add (name);
90                                 add (signals);
91                         }
92
93                         Gtk::TreeModelColumn<PBD::ID> id;
94                         Gtk::TreeModelColumn<std::string> name;
95                         Gtk::TreeModelColumn<std::string> signals;
96         };
97
98         Glib::RefPtr<Gtk::ListStore> _c_store;
99         LuaCallbackScriptModelColumns _c_model;
100         Gtk::TreeView _c_view;
101
102         Gtk::Button _c_add_button;
103         Gtk::Button _c_del_button;
104 };
105
106 #endif /* _gtk2_ardour_lua_script_manager_h_ */