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 <ardour/types.h>
37 #include <ardour/ardour.h>
38 #include <ardour/io.h>
39 #include <ardour/insert.h>
40 #include <ardour/stateful.h>
41 #include <ardour/redirect.h>
43 #include <pbd/fastlog.h>
46 #include "io_selector.h"
49 class MotionController;
51 class RouteRedirectSelection;
64 class RedirectBox : public Gtk::HBox
67 RedirectBox (ARDOUR::Placement, ARDOUR::Session&, ARDOUR::Route &, PluginSelector &, RouteRedirectSelection &, bool owner_is_mixer = false);
70 void set_width (Width);
72 void set_title (const std::string & title);
73 void set_title_shown (bool flag);
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,ARDOUR::Redirect *> RedirectSelected;
84 sigc::signal<void,ARDOUR::Redirect *> RedirectUnselected;
87 void set_stuff_from_route ();
90 ARDOUR::Route & _route;
91 ARDOUR::Session & _session;
94 ARDOUR::Placement _placement;
96 PluginSelector & _plugin_selector;
97 RouteRedirectSelection & _rr_selection;
99 struct ModelColumns : public Gtk::TreeModel::ColumnRecord {
104 Gtk::TreeModelColumn<std::string> text;
105 Gtk::TreeModelColumn<ARDOUR::Redirect*> redirect;
108 ModelColumns columns;
109 Glib::RefPtr<Gtk::ListStore> model;
110 Glib::RefPtr<Gtk::TreeSelection> selection;
112 Gtk::EventBox redirect_eventbox;
113 Gtk::HBox redirect_hpacker;
114 Gtkmm2ext::DnDTreeView redirect_display;
115 Gtk::ScrolledWindow redirect_scroller;
117 void object_drop (std::string type, uint32_t cnt, void**);
121 sigc::connection newplug_connection;
123 Gtk::Menu *send_action_menu;
124 void build_send_action_menu ();
127 void show_send_controls ();
129 Glib::RefPtr<Gtk::UIManager> popup_ui_mgr;
130 Glib::RefPtr<Gtk::ActionGroup> popup_act_grp;
131 Gtk::Menu *redirect_menu;
132 vector<Glib::RefPtr<Gtk::Action> > selection_dependent_items;
133 gint redirect_menu_map_handler (GdkEventAny *ev);
134 Gtk::Menu * build_redirect_menu ();
135 void build_redirect_tooltip (Gtk::EventBox&, string);
136 void show_redirect_menu (gint arg);
139 void send_io_finished (IOSelector::Result, ARDOUR::Redirect*, IOSelectorWindow*);
140 void choose_insert ();
141 void choose_plugin ();
142 void insert_plugin_chosen (ARDOUR::Plugin *);
144 gint redirect_button (GdkEventButton *);
145 void redirects_changed (void *);
146 void show_redirect_active (ARDOUR::Redirect *, void *);
147 void show_redirect_name (void*, ARDOUR::Redirect *);
148 void add_redirect_to_display (ARDOUR::Redirect *);
150 void show_plugin_selector ();
153 string redirect_name (ARDOUR::Redirect&);
156 void remove_redirect_gui (ARDOUR::Redirect *);
158 void disconnect_newplug();
160 void redirects_reordered (const Gtk::TreeModel::Path&, const Gtk::TreeModel::iterator&, int*);
161 gint compute_redirect_sort_keys ();
162 vector<sigc::connection> redirect_active_connections;
163 vector<sigc::connection> redirect_name_connections;
165 bool redirect_drag_in_progress;
166 void redirect_drag_begin (GdkDragContext*);
167 void redirect_drag_end (GdkDragContext*);
168 void all_redirects_active(bool state);
170 void cut_redirects ();
171 void copy_redirects ();
172 void paste_redirects ();
173 void clear_redirects ();
174 void clone_redirects ();
175 void rename_redirects ();
177 void for_selected_redirects (void (RedirectBox::*pmf)(ARDOUR::Redirect*));
178 void get_selected_redirects (vector<ARDOUR::Redirect*>&);
181 void activate_redirect (ARDOUR::Redirect*);
182 void deactivate_redirect (ARDOUR::Redirect*);
183 void cut_redirect (ARDOUR::Redirect*);
184 void copy_redirect (ARDOUR::Redirect*);
185 void edit_redirect (ARDOUR::Redirect*);
186 void hide_redirect_editor (ARDOUR::Redirect*);
187 void rename_redirect (ARDOUR::Redirect*);
189 gint idle_delete_redirect (ARDOUR::Redirect *);
191 void wierd_plugin_dialog (ARDOUR::Plugin& p, uint32_t streams, ARDOUR::IO& io);
195 #endif /* __ardour_gtk_redirect_box__ */