initial sort-of-mostly-working integration of new Pane
[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/scrolledwindow.h>
31 #include <gtkmm/togglebutton.h>
32 #include <gtkmm/treeview.h>
33
34 #include "pbd/stateful.h"
35 #include "pbd/signals.h"
36
37 #include "ardour/ardour.h"
38
39 #include <gtkmm2ext/pane.h>
40
41 #include "ardour_window.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 class IOSelector;
58
59 class RouteParams_UI : public ArdourWindow, public PBD::ScopedConnectionList
60 {
61   public:
62         RouteParams_UI ();
63         ~RouteParams_UI();
64
65         void set_session (ARDOUR::Session*);
66         void session_going_away ();
67         PluginSelector* plugin_selector() { return _plugin_selector; }
68
69   private:
70         Gtk::HBox                global_hpacker;
71         Gtk::VBox                global_vpacker;
72         Gtk::ScrolledWindow      scroller;
73         Gtk::EventBox            scroller_base;
74         Gtk::HBox                scroller_hpacker;
75         Gtk::VBox                mixer_scroller_vpacker;
76
77         Gtk::VBox                list_vpacker;
78         Gtk::Label               route_list_button_label;
79         Gtk::Button              route_list_button;
80         Gtk::ScrolledWindow      route_select_scroller;
81
82         Gtk::Notebook            notebook;
83         Gtk::Frame               input_frame;
84         Gtk::Frame               output_frame;
85         Gtkmm2ext::HPane         redir_hpane;
86
87         Gtk::Frame               route_select_frame;
88
89         Gtk::HBox                route_hpacker;
90         Gtk::VBox                route_vpacker;
91
92         ProcessorBox*            insert_box;
93
94         Gtkmm2ext::HPane         list_hpane;
95
96         Gtkmm2ext::HPane         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
111         PBD::ScopedConnectionList latency_connections;
112         sigc::connection          latency_click_connection;
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_view;
123         IOSelector     * _input_iosel;
124         IOSelector     * _output_iosel;
125
126         PluginSelector    *_plugin_selector;
127         RouteProcessorSelection  _rr_selection;
128
129         boost::shared_ptr<ARDOUR::Route> _route;
130         PBD::ScopedConnection _route_processors_connection;
131         PBD::ScopedConnectionList route_connections;
132
133         boost::shared_ptr<ARDOUR::Processor> _processor;
134         PBD::ScopedConnection _processor_going_away_connection;
135
136
137         enum ConfigView {
138                 NO_CONFIG_VIEW = 0,
139                 INPUT_CONFIG_VIEW,
140                 OUTPUT_CONFIG_VIEW,
141                 PLUGIN_CONFIG_VIEW,
142                 PORTINSERT_CONFIG_VIEW,
143                 SEND_CONFIG_VIEW
144         };
145
146         ConfigView _current_view;
147
148
149         /* treeview */
150         struct RouteDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
151                 RouteDisplayModelColumns() {
152                         add(text);
153                         add(route);
154                 }
155                 Gtk::TreeModelColumn<std::string> text;
156                 Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Route> > route;
157         };
158
159         RouteDisplayModelColumns route_display_columns ;
160         Gtk::TreeView route_display;
161         Glib::RefPtr<Gtk::ListStore> route_display_model;
162
163
164         void add_routes (ARDOUR::RouteList&);
165
166         void route_property_changed (const PBD::PropertyChange&, boost::weak_ptr<ARDOUR::Route> route);
167         void route_removed (boost::weak_ptr<ARDOUR::Route> route);
168         void map_frozen ();
169
170
171         void route_selected();
172         //void route_unselected (gint row, gint col, GdkEvent *ev);
173
174         void setup_io_frames();
175         void cleanup_io_frames();
176         void cleanup_view(bool stopupdate = true);
177         void cleanup_latency_frame ();
178         void setup_latency_frame ();
179
180         void processors_changed (ARDOUR::RouteProcessorChange);
181
182         void setup_processor_boxes();
183         void cleanup_processor_boxes();
184
185         void redirect_selected (boost::shared_ptr<ARDOUR::Processor>);
186
187         void plugin_going_away (ARDOUR::Placement);
188         void processor_going_away (boost::weak_ptr<ARDOUR::Processor>);
189
190         gint edit_input_configuration (GdkEventButton *ev);
191         gint edit_output_configuration (GdkEventButton *ev);
192
193         void update_routeinfo (ARDOUR::Route * route);
194
195         Gtk::Menu *track_menu;
196         void show_track_menu();
197
198         void update_title ();
199         //void unselect_all_redirects ();
200
201         sigc::connection update_connection;
202         void update_views ();
203
204         void start_updating ();
205         void stop_updating ();
206 };
207
208
209 #endif /* __ardour_route_params_ui_h__ */