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.
21 #ifndef __ardour_gtk_redirect_box__
22 #define __ardour_gtk_redirect_box__
27 #include <gtkmm/box.h>
28 #include <gtkmm/eventbox.h>
29 #include <gtkmm/menu.h>
30 #include <gtkmm/scrolledwindow.h>
31 #include <gtkmm2ext/dndtreeview.h>
32 #include <gtkmm2ext/auto_spin.h>
33 #include <gtkmm2ext/click_box.h>
34 #include <gtkmm2ext/dndtreeview.h>
36 #include <pbd/stateful.h>
38 #include <ardour/types.h>
39 #include <ardour/ardour.h>
40 #include <ardour/io.h>
41 #include <ardour/insert.h>
42 #include <ardour/redirect.h>
44 #include <pbd/fastlog.h>
47 #include "io_selector.h"
50 class MotionController;
53 class RouteRedirectSelection;
66 class RedirectBox : public Gtk::HBox
69 RedirectBox (ARDOUR::Placement, ARDOUR::Session&,
70 boost::shared_ptr<ARDOUR::Route>, PluginSelector &, RouteRedirectSelection &, bool owner_is_mixer = false);
73 void set_width (Width);
77 void select_all_redirects ();
78 void deselect_all_redirects ();
79 void select_all_plugins ();
80 void select_all_inserts ();
81 void select_all_sends ();
83 sigc::signal<void,boost::shared_ptr<ARDOUR::Redirect> > RedirectSelected;
84 sigc::signal<void,boost::shared_ptr<ARDOUR::Redirect> > RedirectUnselected;
86 static void register_actions();
89 void set_stuff_from_route ();
92 boost::shared_ptr<ARDOUR::Route> _route;
93 ARDOUR::Session & _session;
96 ARDOUR::Placement _placement;
98 PluginSelector & _plugin_selector;
99 RouteRedirectSelection & _rr_selection;
101 struct ModelColumns : public Gtk::TreeModel::ColumnRecord {
107 Gtk::TreeModelColumn<std::string> text;
108 Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Redirect> > redirect;
109 Gtk::TreeModelColumn<Gdk::Color> color;
112 ModelColumns columns;
113 Glib::RefPtr<Gtk::ListStore> model;
115 void selection_changed ();
117 static bool get_colors;
118 static Gdk::Color* active_redirect_color;
119 static Gdk::Color* inactive_redirect_color;
121 Gtk::EventBox redirect_eventbox;
122 Gtk::HBox redirect_hpacker;
123 Gtkmm2ext::DnDTreeView<boost::shared_ptr<ARDOUR::Redirect> > redirect_display;
124 Gtk::ScrolledWindow redirect_scroller;
126 void object_drop (std::string type, uint32_t cnt, const boost::shared_ptr<ARDOUR::Redirect>*);
130 Gtk::Menu *send_action_menu;
131 void build_send_action_menu ();
134 void show_send_controls ();
136 Gtk::Menu *redirect_menu;
137 gint redirect_menu_map_handler (GdkEventAny *ev);
138 Gtk::Menu * build_redirect_menu ();
139 void build_redirect_tooltip (Gtk::EventBox&, string);
140 void show_redirect_menu (gint arg);
143 void send_io_finished (IOSelector::Result, boost::shared_ptr<ARDOUR::Redirect>, IOSelectorWindow*);
144 void choose_insert ();
145 void choose_plugin ();
146 void insert_plugin_chosen (boost::shared_ptr<ARDOUR::Plugin>);
148 bool no_redirect_redisplay;
151 bool redirect_button_press_event (GdkEventButton *);
152 void redisplay_redirects (void* src);
153 void add_redirect_to_display (boost::shared_ptr<ARDOUR::Redirect>);
154 void row_deleted (const Gtk::TreeModel::Path& path);
155 void show_redirect_name (void*, boost::shared_ptr<ARDOUR::Redirect>);
157 /* these are handlers for Redirect signals, so they take Redirect*
158 directly, rather than shared_ptr<Redirect>
161 void show_redirect_active (ARDOUR::Redirect*, void *);
163 string redirect_name (boost::shared_ptr<ARDOUR::Redirect>);
165 void remove_redirect_gui (boost::shared_ptr<ARDOUR::Redirect>);
167 void redirects_reordered (const Gtk::TreeModel::Path&, const Gtk::TreeModel::iterator&, int*);
168 void compute_redirect_sort_keys ();
169 vector<sigc::connection> redirect_active_connections;
170 vector<sigc::connection> redirect_name_connections;
172 bool redirect_drag_in_progress;
173 void redirect_drag_begin (GdkDragContext*);
174 void redirect_drag_end (GdkDragContext*);
175 void all_redirects_active(bool state);
177 void cut_redirects ();
178 void copy_redirects ();
179 void paste_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> paste_action;
188 void paste_redirect_list (std::list<boost::shared_ptr<ARDOUR::Redirect> >& redirects);
190 void activate_redirect (boost::shared_ptr<ARDOUR::Redirect>);
191 void deactivate_redirect (boost::shared_ptr<ARDOUR::Redirect>);
192 void cut_redirect (boost::shared_ptr<ARDOUR::Redirect>);
193 void copy_redirect (boost::shared_ptr<ARDOUR::Redirect>);
194 void edit_redirect (boost::shared_ptr<ARDOUR::Redirect>);
195 void hide_redirect_editor (boost::shared_ptr<ARDOUR::Redirect>);
196 void rename_redirect (boost::shared_ptr<ARDOUR::Redirect>);
198 gint idle_delete_redirect (boost::shared_ptr<ARDOUR::Redirect>);
200 void wierd_plugin_dialog (ARDOUR::Plugin& p, uint32_t streams, boost::shared_ptr<ARDOUR::IO> io);
202 static RedirectBox* _current_redirect_box;
203 static bool enter_box (GdkEventCrossing*, RedirectBox*);
204 static bool leave_box (GdkEventCrossing*, RedirectBox*);
206 static void rb_choose_plugin ();
207 static void rb_choose_insert ();
208 static void rb_choose_send ();
209 static void rb_clear ();
210 static void rb_cut ();
211 static void rb_copy ();
212 static void rb_paste ();
213 static void rb_rename ();
214 static void rb_select_all ();
215 static void rb_deselect_all ();
216 static void rb_activate ();
217 static void rb_deactivate ();
218 static void rb_activate_all ();
219 static void rb_deactivate_all ();
220 static void rb_edit ();
222 void route_name_changed (void* src, PluginUIWindow* plugin_ui, boost::shared_ptr<ARDOUR::PluginInsert> pi);
223 std::string generate_redirect_title (boost::shared_ptr<ARDOUR::PluginInsert> pi);
226 #endif /* __ardour_gtk_redirect_box__ */