add header guards for good measure
[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         bool on_delete_event (GdkEventAny*);
35         void session_going_away();
36
37 private:
38         Gtk::Notebook pages;
39
40         /* action scripts */
41         void setup_actions ();
42         void action_selection_changed ();
43         void set_action_script_name (int, const std::string&);
44
45         void set_action_btn_clicked ();
46         void del_action_btn_clicked ();
47         void edit_action_btn_clicked ();
48         void call_action_btn_clicked ();
49
50         class LuaActionScriptModelColumns : public Gtk::TreeModelColumnRecord
51         {
52                 public:
53                         LuaActionScriptModelColumns ()
54                         {
55                                 add (id);
56                                 add (action);
57                                 add (name);
58                                 add (enabled);
59                         }
60
61                         Gtk::TreeModelColumn<int> id;
62                         Gtk::TreeModelColumn<std::string> action;
63                         Gtk::TreeModelColumn<std::string> name;
64                         Gtk::TreeModelColumn<bool> enabled;
65         };
66
67         Gtk::Button _a_set_button;
68         Gtk::Button _a_del_button;
69         Gtk::Button _a_edit_button;
70         Gtk::Button _a_call_button;
71
72         Glib::RefPtr<Gtk::ListStore> _a_store;
73         LuaActionScriptModelColumns _a_model;
74         Gtk::TreeView _a_view;
75
76         /* action callback hooks */
77         void setup_callbacks ();
78         void callback_selection_changed ();
79         void set_callback_script_name (PBD::ID, const std::string&, const ActionHook& ah);
80
81         void add_callback_btn_clicked ();
82         void del_callback_btn_clicked ();
83
84         class LuaCallbackScriptModelColumns : public Gtk::TreeModelColumnRecord
85         {
86                 public:
87                         LuaCallbackScriptModelColumns ()
88                         {
89                                 add (id);
90                                 add (name);
91                                 add (signals);
92                         }
93
94                         Gtk::TreeModelColumn<PBD::ID> id;
95                         Gtk::TreeModelColumn<std::string> name;
96                         Gtk::TreeModelColumn<std::string> signals;
97         };
98
99         Glib::RefPtr<Gtk::ListStore> _c_store;
100         LuaCallbackScriptModelColumns _c_model;
101         Gtk::TreeView _c_view;
102
103         Gtk::Button _c_add_button;
104         Gtk::Button _c_del_button;
105 };
106
107 #endif /* _gtk2_ardour_lua_script_manager_h_ */