2 Copyright (C) 2004 Paul Davis
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.
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.
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.
20 #ifndef __ardour_gtk_redirect_box__
21 #define __ardour_gtk_redirect_box__
26 #include <gtkmm/box.h>
27 #include <gtkmm/eventbox.h>
28 #include <gtkmm/menu.h>
29 #include <gtkmm/scrolledwindow.h>
30 #include <gtkmm2ext/dndtreeview.h>
31 #include <gtkmm2ext/auto_spin.h>
32 #include <gtkmm2ext/click_box.h>
33 #include <gtkmm2ext/dndtreeview.h>
35 #include <pbd/stateful.h>
37 #include <ardour/types.h>
38 #include <ardour/ardour.h>
39 #include <ardour/io.h>
40 #include <ardour/insert.h>
41 #include <ardour/redirect.h>
43 #include <pbd/fastlog.h>
45 #include "plugin_interest.h"
47 #include "io_selector.h"
50 class MotionController
;
53 class RouteRedirectSelection
;
66 class RedirectBox
: public Gtk::HBox
, public PluginInterestedObject
69 RedirectBox (ARDOUR::Placement
, ARDOUR::Session
&,
70 PluginSelector
&, RouteRedirectSelection
&, bool owner_is_mixer
= false);
73 void set_route (boost::shared_ptr
<ARDOUR::Route
>);
75 void set_width (Width
);
79 void select_all_redirects ();
80 void deselect_all_redirects ();
81 void select_all_plugins ();
82 void select_all_inserts ();
83 void select_all_sends ();
85 sigc::signal
<void,boost::shared_ptr
<ARDOUR::Redirect
> > RedirectSelected
;
86 sigc::signal
<void,boost::shared_ptr
<ARDOUR::Redirect
> > RedirectUnselected
;
88 static void register_actions();
91 boost::shared_ptr
<ARDOUR::Route
> _route
;
92 ARDOUR::Session
& _session
;
94 std::vector
<sigc::connection
> connections
;
96 ARDOUR::Placement _placement
;
98 PluginSelector
& _plugin_selector
;
99 RouteRedirectSelection
& _rr_selection
;
101 void route_going_away ();
102 bool can_cut_redirects ();
104 struct ModelColumns
: public Gtk::TreeModel::ColumnRecord
{
110 Gtk::TreeModelColumn
<std::string
> text
;
111 Gtk::TreeModelColumn
<boost::shared_ptr
<ARDOUR::Redirect
> > redirect
;
112 Gtk::TreeModelColumn
<Gdk::Color
> color
;
115 ModelColumns columns
;
116 Glib::RefPtr
<Gtk::ListStore
> model
;
118 void selection_changed ();
120 static bool get_colors
;
121 static Gdk::Color
* active_redirect_color
;
122 static Gdk::Color
* inactive_redirect_color
;
124 Gtk::EventBox redirect_eventbox
;
125 Gtk::HBox redirect_hpacker
;
126 Gtkmm2ext::DnDTreeView
<boost::shared_ptr
<ARDOUR::Redirect
> > redirect_display
;
127 Gtk::ScrolledWindow redirect_scroller
;
129 void object_drop (const std::list
<boost::shared_ptr
<ARDOUR::Redirect
> >&);
133 Gtk::Menu
*send_action_menu
;
134 void build_send_action_menu ();
137 void show_send_controls ();
139 Gtk::Menu
*redirect_menu
;
140 gint
redirect_menu_map_handler (GdkEventAny
*ev
);
141 Gtk::Menu
* build_redirect_menu ();
142 void build_redirect_tooltip (Gtk::EventBox
&, string
);
143 void show_redirect_menu (gint arg
);
146 void send_io_finished (IOSelector::Result
, boost::weak_ptr
<ARDOUR::Redirect
>, IOSelectorWindow
*);
147 void choose_insert ();
148 void choose_plugin ();
149 void use_plugins (const SelectedPlugins
&);
151 bool no_redirect_redisplay
;
154 bool redirect_button_press_event (GdkEventButton
*);
155 bool redirect_button_release_event (GdkEventButton
*);
156 void redisplay_redirects (void* src
);
157 void add_redirect_to_display (boost::shared_ptr
<ARDOUR::Redirect
>);
158 void row_deleted (const Gtk::TreeModel::Path
& path
);
159 void show_redirect_active_r (ARDOUR::Redirect
*, void *, boost::weak_ptr
<ARDOUR::Redirect
>);
160 void show_redirect_active (boost::weak_ptr
<ARDOUR::Redirect
>);
161 void show_redirect_name (void* src
, boost::weak_ptr
<ARDOUR::Redirect
>);
162 string
redirect_name (boost::weak_ptr
<ARDOUR::Redirect
>);
164 void remove_redirect_gui (boost::shared_ptr
<ARDOUR::Redirect
>);
166 void redirects_reordered (const Gtk::TreeModel::Path
&, const Gtk::TreeModel::iterator
&, int*);
167 void compute_redirect_sort_keys ();
168 vector
<sigc::connection
> redirect_active_connections
;
169 vector
<sigc::connection
> redirect_name_connections
;
171 bool redirect_drag_in_progress
;
172 void redirect_drag_begin (GdkDragContext
*);
173 void redirect_drag_end (GdkDragContext
*);
174 void all_redirects_active(bool state
);
176 void cut_redirects ();
177 void copy_redirects ();
178 void paste_redirects ();
179 void delete_redirects ();
180 void clear_redirects ();
181 void clone_redirects ();
182 void rename_redirects ();
184 void for_selected_redirects (void (RedirectBox::*pmf
)(boost::shared_ptr
<ARDOUR::Redirect
>));
185 void get_selected_redirects (vector
<boost::shared_ptr
<ARDOUR::Redirect
> >&);
187 static Glib::RefPtr
<Gtk::Action
> cut_action
;
188 static Glib::RefPtr
<Gtk::Action
> paste_action
;
189 void paste_redirect_list (const std::list
<boost::shared_ptr
<ARDOUR::Redirect
> >& redirects
);
191 void activate_redirect (boost::shared_ptr
<ARDOUR::Redirect
>);
192 void deactivate_redirect (boost::shared_ptr
<ARDOUR::Redirect
>);
193 void cut_redirect (boost::shared_ptr
<ARDOUR::Redirect
>);
194 void copy_redirect (boost::shared_ptr
<ARDOUR::Redirect
>);
195 void edit_redirect (boost::shared_ptr
<ARDOUR::Redirect
>);
196 void hide_redirect_editor (boost::shared_ptr
<ARDOUR::Redirect
>);
197 void rename_redirect (boost::shared_ptr
<ARDOUR::Redirect
>);
199 gint
idle_delete_redirect (boost::weak_ptr
<ARDOUR::Redirect
>);
201 void weird_plugin_dialog (ARDOUR::Plugin
& p
, uint32_t streams
, boost::shared_ptr
<ARDOUR::IO
> io
);
203 static RedirectBox
* _current_redirect_box
;
204 static bool enter_box (GdkEventCrossing
*, RedirectBox
*);
205 static bool leave_box (GdkEventCrossing
*, RedirectBox
*);
207 static void rb_choose_plugin ();
208 static void rb_choose_insert ();
209 static void rb_choose_send ();
210 static void rb_clear ();
211 static void rb_cut ();
212 static void rb_copy ();
213 static void rb_paste ();
214 static void rb_delete ();
215 static void rb_rename ();
216 static void rb_select_all ();
217 static void rb_deselect_all ();
218 static void rb_activate ();
219 static void rb_deactivate ();
220 static void rb_activate_all ();
221 static void rb_deactivate_all ();
222 static void rb_edit ();
224 void route_name_changed (void* src
);
225 std::string
generate_redirect_title (boost::shared_ptr
<ARDOUR::PluginInsert
> pi
);
228 #endif /* __ardour_gtk_redirect_box__ */