Enable Menu > Quit to work again after startup on macOS
[ardour.git] / gtk2_ardour / route_params_ui.h
1 /*
2  * Copyright (C) 2005-2007 Taybin Rutkin <taybin@taybin.com>
3  * Copyright (C) 2005-2017 Paul Davis <paul@linuxaudiosystems.com>
4  * Copyright (C) 2007-2011 David Robillard <d@drobilla.net>
5  * Copyright (C) 2009-2012 Carl Hetherington <carl@carlh.net>
6  * Copyright (C) 2014-2019 Robin Gareus <robin@gareus.org>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program; if not, write to the Free Software Foundation, Inc.,
20  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21  */
22
23 #ifndef __ardour_route_params_ui_h__
24 #define __ardour_route_params_ui_h__
25
26 #include <list>
27
28 #include <gtkmm/box.h>
29 #include <gtkmm/button.h>
30 #include <gtkmm/eventbox.h>
31 #include <gtkmm/frame.h>
32 #include <gtkmm/label.h>
33 #include <gtkmm/scrolledwindow.h>
34 #include <gtkmm/togglebutton.h>
35 #include <gtkmm/treeview.h>
36
37 #include "pbd/stateful.h"
38 #include "pbd/signals.h"
39
40 #include "ardour/ardour.h"
41
42 #include <widgets/pane.h>
43
44 #include "ardour_window.h"
45 #include "processor_box.h"
46 #include "processor_selection.h"
47
48 namespace ARDOUR {
49         class Route;
50         class Send;
51         class Processor;
52         class Session;
53         class PortInsert;
54         class Connection;
55         class Plugin;
56 }
57
58 class PluginSelector;
59 class IOSelector;
60
61 class RouteParams_UI : public ArdourWindow, public PBD::ScopedConnectionList
62 {
63 public:
64         RouteParams_UI ();
65         ~RouteParams_UI();
66
67         void set_session (ARDOUR::Session*);
68         void session_going_away ();
69         PluginSelector* plugin_selector();
70
71 private:
72         Gtk::VBox                list_vpacker;
73         Gtk::ScrolledWindow      route_select_scroller;
74
75         Gtk::Notebook            notebook;
76         Gtk::Frame               input_frame;
77         Gtk::Frame               output_frame;
78         ArdourWidgets::HPane     redir_hpane;
79
80         Gtk::Frame               route_select_frame;
81
82         Gtk::HBox                route_hpacker;
83         Gtk::VBox                route_vpacker;
84
85         ProcessorBox*            insert_box;
86
87         ArdourWidgets::HPane     list_hpane;
88
89         ArdourWidgets::HPane     right_hpane;
90
91         Gtk::Frame               route_param_frame;
92
93         Gtk::VBox                choice_vpacker;
94
95
96         Gtk::ToggleButton input_button;
97         Gtk::ToggleButton output_button;
98         Gtk::Label  track_input_label;
99
100         Gtk::Label  title_label;
101
102         Gtk::Container * _active_view;
103         IOSelector     * _input_iosel;
104         IOSelector     * _output_iosel;
105
106         ProcessorSelection  _p_selection;
107
108         boost::shared_ptr<ARDOUR::Route> _route;
109         PBD::ScopedConnection _route_processors_connection;
110         PBD::ScopedConnectionList route_connections;
111
112         boost::shared_ptr<ARDOUR::Processor> _processor;
113         PBD::ScopedConnection _processor_going_away_connection;
114
115
116         enum ConfigView {
117                 NO_CONFIG_VIEW = 0,
118                 INPUT_CONFIG_VIEW,
119                 OUTPUT_CONFIG_VIEW,
120                 PLUGIN_CONFIG_VIEW,
121                 PORTINSERT_CONFIG_VIEW,
122                 SEND_CONFIG_VIEW
123         };
124
125         ConfigView _current_view;
126
127
128         /* treeview */
129         struct RouteDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
130                 RouteDisplayModelColumns() {
131                         add(text);
132                         add(route);
133                 }
134                 Gtk::TreeModelColumn<std::string> text;
135                 Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Route> > route;
136         };
137
138         RouteDisplayModelColumns route_display_columns ;
139         Gtk::TreeView route_display;
140         Glib::RefPtr<Gtk::ListStore> route_display_model;
141
142
143         void add_routes (ARDOUR::RouteList&);
144
145         void route_property_changed (const PBD::PropertyChange&, boost::weak_ptr<ARDOUR::Route> route);
146         void route_removed (boost::weak_ptr<ARDOUR::Route> route);
147         void map_frozen ();
148
149
150         void route_selected();
151         //void route_unselected (gint row, gint col, GdkEvent *ev);
152
153         void setup_io_selector();
154         void cleanup_io_selector();
155         void cleanup_view(bool stopupdate = true);
156
157         void processors_changed (ARDOUR::RouteProcessorChange);
158
159         void setup_processor_boxes();
160         void cleanup_processor_boxes();
161
162         void redirect_selected (boost::shared_ptr<ARDOUR::Processor>);
163
164         void plugin_going_away (ARDOUR::Placement);
165         void processor_going_away (boost::weak_ptr<ARDOUR::Processor>);
166
167         gint edit_input_configuration (GdkEventButton *ev);
168         gint edit_output_configuration (GdkEventButton *ev);
169
170         void update_routeinfo (ARDOUR::Route * route);
171
172         Gtk::Menu *track_menu;
173         void show_track_menu();
174
175         void update_title ();
176         //void unselect_all_redirects ();
177
178         sigc::connection update_connection;
179         void update_views ();
180
181         void start_updating ();
182         void stop_updating ();
183 };
184
185
186 #endif /* __ardour_route_params_ui_h__ */