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_processor_box__
21 #define __ardour_gtk_processor_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/plugin_insert.h"
40 #include "ardour/port_insert.h"
41 #include "ardour/processor.h"
43 #include "pbd/fastlog.h"
45 #include "plugin_interest.h"
47 #include "io_selector.h"
51 class MotionController;
54 class RouteRedirectSelection;
69 class ProcessorBox : public Gtk::HBox, public PluginInterestedObject
72 ProcessorBox (ARDOUR::Placement, ARDOUR::Session&, PluginSelector &, RouteRedirectSelection &, MixerStrip* parent, bool owner_is_mixer = false);
75 void set_route (boost::shared_ptr<ARDOUR::Route>);
76 void set_width (Width);
80 void select_all_processors ();
81 void deselect_all_processors ();
82 void select_all_plugins ();
83 void select_all_inserts ();
84 void select_all_sends ();
86 sigc::signal<void,boost::shared_ptr<ARDOUR::Processor> > ProcessorSelected;
87 sigc::signal<void,boost::shared_ptr<ARDOUR::Processor> > ProcessorUnselected;
89 static void register_actions();
92 boost::shared_ptr<ARDOUR::Route> _route;
93 ARDOUR::Session & _session;
94 MixerStrip* _parent_strip; // null if in RouteParamsUI
97 std::vector<sigc::connection> connections;
99 boost::shared_ptr<ARDOUR::Processor> _processor_being_created;
101 ARDOUR::Placement _placement;
103 PluginSelector & _plugin_selector;
104 RouteRedirectSelection & _rr_selection;
106 void route_going_away ();
108 struct ModelColumns : public Gtk::TreeModel::ColumnRecord {
114 Gtk::TreeModelColumn<std::string> text;
115 Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Processor> > processor;
116 Gtk::TreeModelColumn<Gdk::Color> color;
119 ModelColumns columns;
120 Glib::RefPtr<Gtk::ListStore> model;
122 void selection_changed ();
124 static bool get_colors;
125 static Gdk::Color* active_processor_color;
126 static Gdk::Color* inactive_processor_color;
128 Gtk::EventBox processor_eventbox;
129 Gtk::HBox processor_hpacker;
130 Gtkmm2ext::DnDTreeView<boost::shared_ptr<ARDOUR::Processor> > processor_display;
131 Gtk::ScrolledWindow processor_scroller;
133 void object_drop (const std::list<boost::shared_ptr<ARDOUR::Processor> >&, Gtk::TreeView*,
134 Glib::RefPtr<Gdk::DragContext>& context);
138 Gtk::Menu *send_action_menu;
139 void build_send_action_menu ();
142 void show_send_controls ();
144 Gtk::Menu *processor_menu;
145 gint processor_menu_map_handler (GdkEventAny *ev);
146 Gtk::Menu * build_processor_menu ();
147 void build_processor_tooltip (Gtk::EventBox&, std::string);
148 void show_processor_menu (gint arg);
151 void send_io_finished (IOSelector::Result, boost::weak_ptr<ARDOUR::Processor>, IOSelectorWindow*);
152 void choose_return ();
153 void return_io_finished (IOSelector::Result, boost::weak_ptr<ARDOUR::Processor>, IOSelectorWindow*);
154 void choose_insert ();
155 void choose_plugin ();
156 void use_plugins (const SelectedPlugins&);
158 bool no_processor_redisplay;
161 bool processor_button_press_event (GdkEventButton *);
162 bool processor_button_release_event (GdkEventButton *);
163 void redisplay_processors ();
164 void add_processor_to_display (boost::weak_ptr<ARDOUR::Processor>);
165 void row_deleted (const Gtk::TreeModel::Path& path);
166 void show_processor_active (boost::weak_ptr<ARDOUR::Processor>);
167 void show_processor_name (boost::weak_ptr<ARDOUR::Processor>);
168 std::string processor_name (boost::weak_ptr<ARDOUR::Processor>);
170 void remove_processor_gui (boost::shared_ptr<ARDOUR::Processor>);
172 void processors_reordered (const Gtk::TreeModel::Path&, const Gtk::TreeModel::iterator&, int*);
173 void compute_processor_sort_keys ();
174 std::vector<sigc::connection> processor_active_connections;
175 std::vector<sigc::connection> processor_name_connections;
177 bool processor_drag_in_progress;
178 void processor_drag_begin (GdkDragContext*);
179 void processor_drag_end (GdkDragContext*);
180 void all_processors_active(bool state);
181 void all_plugins_active(bool state);
184 void cut_processors ();
185 void copy_processors ();
186 void paste_processors ();
187 void delete_processors ();
188 void delete_dragged_processors (const std::list<boost::shared_ptr<ARDOUR::Processor> >&);
189 void clear_processors ();
190 void rename_processors ();
192 typedef std::vector<boost::shared_ptr<ARDOUR::Processor> > ProcSelection;
194 void for_selected_processors (void (ProcessorBox::*pmf)(boost::shared_ptr<ARDOUR::Processor>));
195 void get_selected_processors (ProcSelection&);
197 static Glib::RefPtr<Gtk::Action> paste_action;
198 void paste_processor_state (const XMLNodeList&);
200 void activate_processor (boost::shared_ptr<ARDOUR::Processor>);
201 void deactivate_processor (boost::shared_ptr<ARDOUR::Processor>);
202 void edit_processor (boost::shared_ptr<ARDOUR::Processor>);
203 void hide_processor_editor (boost::shared_ptr<ARDOUR::Processor>);
204 void rename_processor (boost::shared_ptr<ARDOUR::Processor>);
206 gint idle_delete_processor (boost::weak_ptr<ARDOUR::Processor>);
208 void weird_plugin_dialog (ARDOUR::Plugin& p, ARDOUR::Route::ProcessorStreams streams);
210 static ProcessorBox* _current_processor_box;
211 static bool enter_box (GdkEventCrossing*, ProcessorBox*);
212 static bool leave_box (GdkEventCrossing*, ProcessorBox*);
214 static void rb_choose_plugin ();
215 static void rb_choose_insert ();
216 static void rb_choose_send ();
217 static void rb_choose_return ();
218 static void rb_clear ();
219 static void rb_cut ();
220 static void rb_copy ();
221 static void rb_paste ();
222 static void rb_delete ();
223 static void rb_rename ();
224 static void rb_select_all ();
225 static void rb_deselect_all ();
226 static void rb_activate ();
227 static void rb_deactivate ();
228 static void rb_activate_all ();
229 static void rb_deactivate_all ();
230 static void rb_ab_plugins ();
231 static void rb_edit ();
233 void route_name_changed ();
234 std::string generate_processor_title (boost::shared_ptr<ARDOUR::PluginInsert> pi);
237 #endif /* __ardour_gtk_processor_box__ */