change PropertyChange from a bitfield into a real object, with all the many widesprea...
[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 #include "pbd/signals.h"
37
38 #include "ardour/ardour.h"
39
40 #include "io_selector.h"
41 #include "ardour_dialog.h"
42 #include "processor_box.h"
43 #include "route_processor_selection.h"
44 #include "latency_gui.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, public PBD::ScopedConnectionList
59 {
60   public:
61         RouteParams_UI ();
62         ~RouteParams_UI();
63
64         void set_session (ARDOUR::Session*);
65         void session_going_away ();
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              redir_hpane;
85
86         Gtk::Frame               route_select_frame;
87
88         Gtk::HBox                route_hpacker;
89         Gtk::VBox                route_vpacker;
90
91         ProcessorBox*            insert_box;
92
93         Gtk::HPaned              list_hpane;
94
95         Gtk::HPaned              right_hpane;
96
97         Gtk::Frame               route_choice_frame;
98
99         Gtk::Frame               route_param_frame;
100
101         Gtk::VBox                choice_vpacker;
102
103         Gtk::Frame               latency_frame;
104         Gtk::VBox                latency_packer;
105         Gtk::HButtonBox          latency_button_box;
106         Gtk::Button              latency_apply_button;
107         LatencyGUI*              latency_widget;
108         Gtk::Label               delay_label;
109
110         PBD::ScopedConnectionList latency_connections;
111         sigc::connection          latency_click_connection;
112
113         void refresh_latency ();
114
115         Gtk::ToggleButton input_button;
116         Gtk::ToggleButton output_button;
117         Gtk::Label  track_input_label;
118
119         Gtk::Label  title_label;
120
121         Gtk::Container * _active_view;
122         IOSelector     * _input_iosel;
123         IOSelector     * _output_iosel;
124
125         PluginSelector    *_plugin_selector;
126         RouteRedirectSelection  _rr_selection;
127
128         boost::shared_ptr<ARDOUR::Route> _route;
129         PBD::ScopedConnection _route_processors_connection;
130
131         boost::shared_ptr<ARDOUR::Processor> _processor;
132         PBD::ScopedConnection _processor_going_away_connection;
133
134
135         enum ConfigView {
136                 NO_CONFIG_VIEW = 0,
137                 INPUT_CONFIG_VIEW,
138                 OUTPUT_CONFIG_VIEW,
139                 PLUGIN_CONFIG_VIEW,
140                 PORTINSERT_CONFIG_VIEW,
141                 SEND_CONFIG_VIEW
142         };
143
144         ConfigView _current_view;
145
146
147         /* treeview */
148         struct RouteDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
149                 RouteDisplayModelColumns() {
150                         add(text);
151                         add(route);
152                 }
153                 Gtk::TreeModelColumn<Glib::ustring> text;
154                 Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Route> > route;
155         };
156
157         RouteDisplayModelColumns route_display_columns ;
158         Gtk::TreeView route_display;
159         Glib::RefPtr<Gtk::ListStore> route_display_model;
160
161
162         void add_routes (ARDOUR::RouteList&);
163
164         void route_property_changed (const PBD::PropertyChange&, boost::weak_ptr<ARDOUR::Route> route);
165         void route_removed (boost::weak_ptr<ARDOUR::Route> route);
166
167
168         void route_selected();
169         //void route_unselected (gint row, gint col, GdkEvent *ev);
170
171         void setup_io_frames();
172         void cleanup_io_frames();
173         void cleanup_view(bool stopupdate = true);
174         void cleanup_latency_frame ();
175         void setup_latency_frame ();
176
177         void processors_changed (ARDOUR::RouteProcessorChange);
178
179         void setup_processor_boxes();
180         void cleanup_processor_boxes();
181
182         void redirect_selected (boost::shared_ptr<ARDOUR::Processor>);
183
184         void plugin_going_away (ARDOUR::Placement);
185         void processor_going_away (boost::weak_ptr<ARDOUR::Processor>);
186
187         gint edit_input_configuration (GdkEventButton *ev);
188         gint edit_output_configuration (GdkEventButton *ev);
189
190         void update_routeinfo (ARDOUR::Route * route);
191
192         Gtk::Menu *track_menu;
193         void show_track_menu();
194
195         void update_title ();
196         //void unselect_all_redirects ();
197
198         sigc::connection update_connection;
199         void update_views ();
200
201         void start_updating ();
202         void stop_updating ();
203 };
204
205
206 #endif /* __ardour_route_params_ui_h__ */