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