Initial import of gtk2_ardour.
[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 <gtk--.h>
27
28 #include <ardour/ardour.h>
29 #include <ardour/stateful.h>
30 #include <ardour/io.h>
31 #include <ardour/redirect.h>
32
33 #include "io_selector.h"
34 #include "ardour_dialog.h"
35 #include "keyboard_target.h"
36 #include "redirect_box.h"
37 #include "route_redirect_selection.h"
38
39 namespace ARDOUR {
40         class Route;
41         class Send;
42         class Insert;
43         class Session;
44         class PortInsert;
45         class Connection;
46         class Plugin;
47 }
48
49 class PluginSelector;
50
51 class RouteParams_UI : public ArdourDialog
52 {
53   public:
54         RouteParams_UI (ARDOUR::AudioEngine&);
55         ~RouteParams_UI();
56
57         void set_session (ARDOUR::Session *);
58         void session_gone ();
59         PluginSelector&  plugin_selector() { return *_plugin_selector; }
60
61   private:
62         ARDOUR::AudioEngine&     engine;
63
64         Gtk::HBox                global_hpacker;
65         Gtk::VBox                global_vpacker;
66         Gtk::ScrolledWindow      scroller;
67         Gtk::EventBox            scroller_base;
68         Gtk::HBox                scroller_hpacker;
69         Gtk::VBox                mixer_scroller_vpacker;
70
71         Gtk::VBox                list_vpacker;
72         Gtk::CList               route_select_list;
73         Gtk::Label               route_list_button_label;
74         Gtk::Button              route_list_button;
75         Gtk::ScrolledWindow      route_select_scroller;
76
77         Gtk::Notebook            notebook;
78         Gtk::Frame               input_frame;
79         Gtk::Frame               output_frame;
80         Gtk::HPaned              pre_redir_hpane;
81         Gtk::HPaned              post_redir_hpane;
82         
83         Gtk::Frame               route_select_frame;
84
85         Gtk::HBox                route_hpacker;
86         Gtk::VBox                route_vpacker;
87
88         RedirectBox              * pre_redirect_box;
89         RedirectBox              * post_redirect_box;
90         
91         Gtk::HPaned              list_hpane;
92
93         Gtk::HPaned              right_hpane;
94         
95         Gtk::Frame               route_choice_frame;
96
97         Gtk::Frame               route_param_frame;
98
99         Gtk::VBox                choice_vpacker;
100         
101
102         Gtk::ToggleButton input_button;
103         Gtk::ToggleButton output_button;
104         Gtk::Label  track_input_label;
105         
106         Gtk::Label  title_label;
107         
108         Gtk::Container * _active_pre_view;
109         Gtk::Container * _active_post_view;
110         IOSelector     * _input_iosel;
111         IOSelector     * _output_iosel;
112         
113         PluginSelector    *_plugin_selector;
114         RouteRedirectSelection  _rr_selection;
115
116         ARDOUR::Route           *_route;
117         SigC::Connection            _route_conn;
118         SigC::Connection            _route_ds_conn;
119
120         ARDOUR::Redirect       * _pre_redirect;
121         SigC::Connection            _pre_plugin_conn;
122
123         ARDOUR::Redirect       * _post_redirect;
124         SigC::Connection            _post_plugin_conn;
125         
126         
127         enum ConfigView {
128                 NO_CONFIG_VIEW = 0,
129                 INPUT_CONFIG_VIEW,
130                 OUTPUT_CONFIG_VIEW,
131                 PLUGIN_CONFIG_VIEW,             
132                 PORTINSERT_CONFIG_VIEW,
133                 SEND_CONFIG_VIEW
134         };
135         
136         ConfigView _current_view;
137         
138         void add_route (ARDOUR::Route*);
139
140         void route_name_changed (void *src, ARDOUR::Route *route);
141         void route_removed (ARDOUR::Route *route);
142
143
144         void route_selected (gint row, gint col, GdkEvent *ev);
145         void route_unselected (gint row, gint col, GdkEvent *ev);
146
147         void setup_io_frames();
148         void cleanup_io_frames();
149         void cleanup_pre_view(bool stopupdate = true);
150         void cleanup_post_view(bool stopupdate = true);
151
152         
153         
154         void redirects_changed (void *src);
155         
156         void setup_redirect_boxes();
157         void cleanup_redirect_boxes();
158
159         void redirect_selected (ARDOUR::Redirect *, ARDOUR::Placement);
160         void redirect_unselected (ARDOUR::Redirect *);
161         
162         void plugin_going_away (ARDOUR::Plugin *foo, ARDOUR::Placement);
163         void redirect_going_away (ARDOUR::Redirect *foo);
164
165         gint edit_input_configuration (GdkEventButton *ev);
166         gint edit_output_configuration (GdkEventButton *ev);
167         
168         void update_routeinfo (ARDOUR::Route * route);
169         
170         Gtk::Menu *track_menu;
171         void show_track_menu(gint arg);
172         
173         void update_title ();
174         //void unselect_all_redirects ();
175
176         SigC::Connection update_connection;
177         void update_views ();
178
179         void start_updating ();
180         void stop_updating ();
181 };
182
183
184 #endif /* __ardour_route_params_ui_h__ */