Merge big changes (mostly Controllable) from trunk
[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     $Id$
19 */
20
21 #ifndef __ardour_route_params_ui_h__
22 #define __ardour_route_params_ui_h__
23
24 #include <list>
25
26 #include <gtkmm/box.h>
27 #include <gtkmm/button.h>
28 #include <gtkmm/eventbox.h>
29 #include <gtkmm/frame.h>
30 #include <gtkmm/label.h>
31 #include <gtkmm/paned.h>
32 #include <gtkmm/scrolledwindow.h>
33 #include <gtkmm/togglebutton.h>
34 #include <gtkmm/treeview.h>
35
36 #include <pbd/stateful.h>
37
38 #include <ardour/ardour.h>
39 #include <ardour/io.h>
40 #include <ardour/redirect.h>
41
42 #include "io_selector.h"
43 #include "ardour_dialog.h"
44 #include "keyboard_target.h"
45 #include "redirect_box.h"
46 #include "route_redirect_selection.h"
47
48 namespace ARDOUR {
49         class Route;
50         class Send;
51         class Insert;
52         class Session;
53         class PortInsert;
54         class Connection;
55         class Plugin;
56 }
57
58 class PluginSelector;
59
60 class RouteParams_UI : public ArdourDialog
61 {
62   public:
63         RouteParams_UI (ARDOUR::AudioEngine&);
64         ~RouteParams_UI();
65
66         void set_session (ARDOUR::Session *);
67         void session_gone ();
68         PluginSelector&  plugin_selector() { return *_plugin_selector; }
69
70   private:
71         ARDOUR::AudioEngine&     engine;
72
73         Gtk::HBox                global_hpacker;
74         Gtk::VBox                global_vpacker;
75         Gtk::ScrolledWindow      scroller;
76         Gtk::EventBox            scroller_base;
77         Gtk::HBox                scroller_hpacker;
78         Gtk::VBox                mixer_scroller_vpacker;
79
80         Gtk::VBox                list_vpacker;
81         Gtk::Label               route_list_button_label;
82         Gtk::Button              route_list_button;
83         Gtk::ScrolledWindow      route_select_scroller;
84
85         Gtk::Notebook            notebook;
86         Gtk::Frame               input_frame;
87         Gtk::Frame               output_frame;
88         Gtk::HPaned              pre_redir_hpane;
89         Gtk::HPaned              post_redir_hpane;
90         
91         Gtk::Frame               route_select_frame;
92
93         Gtk::HBox                route_hpacker;
94         Gtk::VBox                route_vpacker;
95
96         RedirectBox              * pre_redirect_box;
97         RedirectBox              * post_redirect_box;
98         
99         Gtk::HPaned              list_hpane;
100
101         Gtk::HPaned              right_hpane;
102         
103         Gtk::Frame               route_choice_frame;
104
105         Gtk::Frame               route_param_frame;
106
107         Gtk::VBox                choice_vpacker;
108         
109
110         Gtk::ToggleButton input_button;
111         Gtk::ToggleButton output_button;
112         Gtk::Label  track_input_label;
113         
114         Gtk::Label  title_label;
115         
116         Gtk::Container * _active_pre_view;
117         Gtk::Container * _active_post_view;
118         IOSelector     * _input_iosel;
119         IOSelector     * _output_iosel;
120         
121         PluginSelector    *_plugin_selector;
122         RouteRedirectSelection  _rr_selection;
123
124         ARDOUR::Route           *_route;
125         sigc::connection            _route_conn;
126         sigc::connection            _route_ds_conn;
127
128         ARDOUR::Redirect       * _pre_redirect;
129         sigc::connection            _pre_plugin_conn;
130
131         ARDOUR::Redirect       * _post_redirect;
132         sigc::connection            _post_plugin_conn;
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<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_route (ARDOUR::Route*);
163
164         void route_name_changed (void *src, ARDOUR::Route *route);
165         void route_removed (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_pre_view(bool stopupdate = true);
174         void cleanup_post_view(bool stopupdate = true);
175
176         
177         
178         void redirects_changed (void *src);
179         
180         void setup_redirect_boxes();
181         void cleanup_redirect_boxes();
182
183         void redirect_selected (ARDOUR::Redirect *, ARDOUR::Placement);
184         void redirect_unselected (ARDOUR::Redirect *);
185         
186         void plugin_going_away (ARDOUR::Plugin *foo, ARDOUR::Placement);
187         void redirect_going_away (ARDOUR::Redirect *foo);
188
189         gint edit_input_configuration (GdkEventButton *ev);
190         gint edit_output_configuration (GdkEventButton *ev);
191         
192         void update_routeinfo (ARDOUR::Route * route);
193         
194         Gtk::Menu *track_menu;
195         void show_track_menu();
196         
197         void update_title ();
198         //void unselect_all_redirects ();
199
200         sigc::connection update_connection;
201         void update_views ();
202
203         void start_updating ();
204         void stop_updating ();
205 };
206
207
208 #endif /* __ardour_route_params_ui_h__ */