(Source List) Fix drag-n-drop.
[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 <widgets/pane.h>
40
41 #include "ardour_window.h"
42 #include "processor_box.h"
43 #include "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();
68
69 private:
70         Gtk::VBox                list_vpacker;
71         Gtk::ScrolledWindow      route_select_scroller;
72
73         Gtk::Notebook            notebook;
74         Gtk::Frame               input_frame;
75         Gtk::Frame               output_frame;
76         ArdourWidgets::HPane     redir_hpane;
77
78         Gtk::Frame               route_select_frame;
79
80         Gtk::HBox                route_hpacker;
81         Gtk::VBox                route_vpacker;
82
83         ProcessorBox*            insert_box;
84
85         ArdourWidgets::HPane     list_hpane;
86
87         ArdourWidgets::HPane     right_hpane;
88
89         Gtk::Frame               route_param_frame;
90
91         Gtk::VBox                choice_vpacker;
92
93         Gtk::Frame               latency_frame;
94         Gtk::VBox                latency_packer;
95         LatencyGUI*              latency_widget;
96         Gtk::Label               delay_label;
97
98         PBD::ScopedConnectionList latency_connections;
99         sigc::connection          latency_click_connection;
100
101         void refresh_latency ();
102
103         Gtk::ToggleButton input_button;
104         Gtk::ToggleButton output_button;
105         Gtk::Label  track_input_label;
106
107         Gtk::Label  title_label;
108
109         Gtk::Container * _active_view;
110         IOSelector     * _input_iosel;
111         IOSelector     * _output_iosel;
112
113         ProcessorSelection  _p_selection;
114
115         boost::shared_ptr<ARDOUR::Route> _route;
116         PBD::ScopedConnection _route_processors_connection;
117         PBD::ScopedConnectionList route_connections;
118
119         boost::shared_ptr<ARDOUR::Processor> _processor;
120         PBD::ScopedConnection _processor_going_away_connection;
121
122
123         enum ConfigView {
124                 NO_CONFIG_VIEW = 0,
125                 INPUT_CONFIG_VIEW,
126                 OUTPUT_CONFIG_VIEW,
127                 PLUGIN_CONFIG_VIEW,
128                 PORTINSERT_CONFIG_VIEW,
129                 SEND_CONFIG_VIEW
130         };
131
132         ConfigView _current_view;
133
134
135         /* treeview */
136         struct RouteDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
137                 RouteDisplayModelColumns() {
138                         add(text);
139                         add(route);
140                 }
141                 Gtk::TreeModelColumn<std::string> text;
142                 Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Route> > route;
143         };
144
145         RouteDisplayModelColumns route_display_columns ;
146         Gtk::TreeView route_display;
147         Glib::RefPtr<Gtk::ListStore> route_display_model;
148
149
150         void add_routes (ARDOUR::RouteList&);
151
152         void route_property_changed (const PBD::PropertyChange&, boost::weak_ptr<ARDOUR::Route> route);
153         void route_removed (boost::weak_ptr<ARDOUR::Route> route);
154         void map_frozen ();
155
156
157         void route_selected();
158         //void route_unselected (gint row, gint col, GdkEvent *ev);
159
160         void setup_io_selector();
161         void cleanup_io_selector();
162         void cleanup_view(bool stopupdate = true);
163         void cleanup_latency_frame ();
164         void setup_latency_frame ();
165
166         void processors_changed (ARDOUR::RouteProcessorChange);
167
168         void setup_processor_boxes();
169         void cleanup_processor_boxes();
170
171         void redirect_selected (boost::shared_ptr<ARDOUR::Processor>);
172
173         void plugin_going_away (ARDOUR::Placement);
174         void processor_going_away (boost::weak_ptr<ARDOUR::Processor>);
175
176         gint edit_input_configuration (GdkEventButton *ev);
177         gint edit_output_configuration (GdkEventButton *ev);
178
179         void update_routeinfo (ARDOUR::Route * route);
180
181         Gtk::Menu *track_menu;
182         void show_track_menu();
183
184         void update_title ();
185         //void unselect_all_redirects ();
186
187         sigc::connection update_connection;
188         void update_views ();
189
190         void start_updating ();
191         void stop_updating ();
192 };
193
194
195 #endif /* __ardour_route_params_ui_h__ */