Renamed Insert to Processor and Redirect to IOProcessor.
[ardour.git] / gtk2_ardour / route_params_ui.h
1 /*
2     Copyright (C) 2000 Paul Davis 
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
20 #ifndef __ardour_route_params_ui_h__
21 #define __ardour_route_params_ui_h__
22
23 #include <list>
24
25 #include <gtkmm/box.h>
26 #include <gtkmm/button.h>
27 #include <gtkmm/eventbox.h>
28 #include <gtkmm/frame.h>
29 #include <gtkmm/label.h>
30 #include <gtkmm/paned.h>
31 #include <gtkmm/scrolledwindow.h>
32 #include <gtkmm/togglebutton.h>
33 #include <gtkmm/treeview.h>
34
35 #include <pbd/stateful.h>
36
37 #include <ardour/ardour.h>
38 #include <ardour/io.h>
39 #include <ardour/io_processor.h>
40
41 #include "io_selector.h"
42 #include "ardour_dialog.h"
43 #include "processor_box.h"
44 #include "route_processor_selection.h"
45
46 namespace ARDOUR {
47         class Route;
48         class Send;
49         class Processor;
50         class Session;
51         class PortInsert;
52         class Connection;
53         class Plugin;
54 }
55
56 class PluginSelector;
57
58 class RouteParams_UI : public ArdourDialog
59 {
60   public:
61         RouteParams_UI ();
62         ~RouteParams_UI();
63
64         void set_session (ARDOUR::Session *);
65         void session_gone ();
66         PluginSelector&  plugin_selector() { return *_plugin_selector; }
67
68   private:
69         Gtk::HBox                global_hpacker;
70         Gtk::VBox                global_vpacker;
71         Gtk::ScrolledWindow      scroller;
72         Gtk::EventBox            scroller_base;
73         Gtk::HBox                scroller_hpacker;
74         Gtk::VBox                mixer_scroller_vpacker;
75
76         Gtk::VBox                list_vpacker;
77         Gtk::Label               route_list_button_label;
78         Gtk::Button              route_list_button;
79         Gtk::ScrolledWindow      route_select_scroller;
80
81         Gtk::Notebook            notebook;
82         Gtk::Frame               input_frame;
83         Gtk::Frame               output_frame;
84         Gtk::HPaned              pre_redir_hpane;
85         Gtk::HPaned              post_redir_hpane;
86         
87         Gtk::Frame               route_select_frame;
88
89         Gtk::HBox                route_hpacker;
90         Gtk::VBox                route_vpacker;
91
92         ProcessorBox              * pre_insert_box;
93         ProcessorBox              * post_insert_box;
94         
95         Gtk::HPaned              list_hpane;
96
97         Gtk::HPaned              right_hpane;
98         
99         Gtk::Frame               route_choice_frame;
100
101         Gtk::Frame               route_param_frame;
102
103         Gtk::VBox                choice_vpacker;
104         
105
106         Gtk::ToggleButton input_button;
107         Gtk::ToggleButton output_button;
108         Gtk::Label  track_input_label;
109         
110         Gtk::Label  title_label;
111         
112         Gtk::Container * _active_pre_view;
113         Gtk::Container * _active_post_view;
114         IOSelector     * _input_iosel;
115         IOSelector     * _output_iosel;
116         
117         PluginSelector    *_plugin_selector;
118         RouteRedirectSelection  _rr_selection;
119
120         boost::shared_ptr<ARDOUR::Route> _route;
121         sigc::connection            _route_conn;
122         sigc::connection            _route_ds_conn;
123
124         boost::shared_ptr<ARDOUR::Processor> _pre_processor;
125         sigc::connection                    _pre_plugin_conn;
126
127         boost::shared_ptr<ARDOUR::Processor> _post_processor;
128         sigc::connection                     _post_plugin_conn;
129         
130         
131         enum ConfigView {
132                 NO_CONFIG_VIEW = 0,
133                 INPUT_CONFIG_VIEW,
134                 OUTPUT_CONFIG_VIEW,
135                 PLUGIN_CONFIG_VIEW,             
136                 PORTINSERT_CONFIG_VIEW,
137                 SEND_CONFIG_VIEW
138         };
139         
140         ConfigView _current_view;
141
142
143         /* treeview */
144         struct RouteDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
145                 RouteDisplayModelColumns() {
146                         add(text);
147                         add(route);
148                 }
149                 Gtk::TreeModelColumn<Glib::ustring> text;
150                 Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Route> > route;
151         };
152
153         RouteDisplayModelColumns route_display_columns ;
154         Gtk::TreeView route_display;
155         Glib::RefPtr<Gtk::ListStore> route_display_model;
156
157         
158         void add_routes (ARDOUR::Session::RouteList&);
159
160         void route_name_changed (boost::shared_ptr<ARDOUR::Route> route);
161         void route_removed (boost::shared_ptr<ARDOUR::Route> route);
162
163
164         void route_selected();
165         //void route_unselected (gint row, gint col, GdkEvent *ev);
166
167         void setup_io_frames();
168         void cleanup_io_frames();
169         void cleanup_pre_view(bool stopupdate = true);
170         void cleanup_post_view(bool stopupdate = true);
171
172         
173         
174         void processors_changed ();
175         
176         void setup_processor_boxes();
177         void cleanup_processor_boxes();
178
179         void redirect_selected (boost::shared_ptr<ARDOUR::Processor>, ARDOUR::Placement);
180         
181         void plugin_going_away (ARDOUR::Placement);
182         void redirect_going_away (boost::shared_ptr<ARDOUR::Processor>);
183
184         gint edit_input_configuration (GdkEventButton *ev);
185         gint edit_output_configuration (GdkEventButton *ev);
186         
187         void update_routeinfo (ARDOUR::Route * route);
188         
189         Gtk::Menu *track_menu;
190         void show_track_menu();
191         
192         void update_title ();
193         //void unselect_all_redirects ();
194
195         sigc::connection update_connection;
196         void update_views ();
197
198         void start_updating ();
199         void stop_updating ();
200 };
201
202
203 #endif /* __ardour_route_params_ui_h__ */