add previous-tab and next-tab actions and bind to PRIMARY-page-up/down by default
[ardour.git] / gtk2_ardour / luawindow.h
1 /*
2     Copyright (C) 2016 Robin Gareus <robin@gareus.org>
3
4     This program is free software; you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation; either version 2 of the License, or
7     (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., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18 */
19 #ifndef __ardour_luawindow_h__
20 #define __ardour_luawindow_h__
21
22 #include <glibmm/thread.h>
23
24 #include <gtkmm/box.h>
25 #include <gtkmm/scrolledwindow.h>
26 #include <gtkmm/label.h>
27 #include <gtkmm/window.h>
28
29 #include "ardour/ardour.h"
30 #include "ardour/types.h"
31 #include "ardour/session_handle.h"
32
33 #include "pbd/stateful.h"
34 #include "pbd/signals.h"
35
36 #include "gtkmm2ext/visibility_tracker.h"
37
38 #include "lua/luastate.h"
39
40 class LuaWindow :
41         public Gtk::Window,
42         public PBD::ScopedConnectionList,
43         public ARDOUR::SessionHandlePtr,
44         public Gtkmm2ext::VisibilityTracker
45 {
46   public:
47         static LuaWindow* instance();
48         ~LuaWindow();
49
50         void show_window ();
51         bool hide_window (GdkEventAny *ev);
52
53         void set_session (ARDOUR::Session* s);
54
55   private:
56         LuaWindow ();
57         static LuaWindow* _instance;
58
59         bool _visible;
60         Gtk::VBox global_vpacker;
61
62         void session_going_away ();
63         void update_title ();
64
65         Gtk::Entry entry;
66         Gtk::TextView outtext;
67         Gtk::ScrolledWindow scrollwin;
68
69         void append_text (std::string s);
70         void scroll_to_bottom ();
71         void clear_output ();
72
73         void entry_activated ();
74
75         LuaState lua;
76 };
77
78 #endif