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