2 Copyright (C) 2000-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 #include "gtk2ardour-config.h"
28 #include <sigc++/bind.h>
30 #include "pbd/convert.h"
32 #include <glibmm/miscutils.h>
34 #include <gtkmm/messagedialog.h>
36 #include <gtkmm2ext/gtk_ui.h>
37 #include <gtkmm2ext/utils.h>
38 #include <gtkmm2ext/choice.h>
39 #include <gtkmm2ext/utils.h>
40 #include <gtkmm2ext/doi.h>
42 #include "ardour/amp.h"
43 #include "ardour/ardour.h"
44 #include "ardour/audio_track.h"
45 #include "ardour/audioengine.h"
46 #include "ardour/internal_send.h"
47 #include "ardour/internal_return.h"
48 #include "ardour/ladspa_plugin.h"
49 #include "ardour/meter.h"
50 #include "ardour/plugin_insert.h"
51 #include "ardour/port_insert.h"
52 #include "ardour/profile.h"
53 #include "ardour/return.h"
54 #include "ardour/route.h"
55 #include "ardour/send.h"
56 #include "ardour/session.h"
59 #include "ardour_dialog.h"
60 #include "ardour_ui.h"
61 #include "gui_thread.h"
62 #include "io_selector.h"
65 #include "mixer_strip.h"
66 #include "plugin_selector.h"
67 #include "plugin_ui.h"
68 #include "port_insert_ui.h"
69 #include "processor_box.h"
70 #include "public_editor.h"
71 #include "return_ui.h"
72 #include "route_processor_selection.h"
78 #ifdef HAVE_AUDIOUNITS
83 using namespace ARDOUR;
87 using namespace Gtkmm2ext;
89 ProcessorBox* ProcessorBox::_current_processor_box = 0;
90 RefPtr<Action> ProcessorBox::paste_action;
91 RefPtr<Action> ProcessorBox::cut_action;
92 RefPtr<Action> ProcessorBox::rename_action;
93 RefPtr<Action> ProcessorBox::edit_action;
94 Glib::RefPtr<Gdk::Pixbuf> SendProcessorEntry::_slider;
96 ProcessorEntry::ProcessorEntry (boost::shared_ptr<Processor> p, Width w)
100 _hbox.pack_start (_active, false, false);
101 _event_box.add (_name);
102 _hbox.pack_start (_event_box, true, true);
103 _vbox.pack_start (_hbox);
105 _name.set_alignment (0, 0.5);
106 _name.set_text (name ());
107 _name.set_padding (2, 2);
109 if (boost::dynamic_pointer_cast<Amp> (p)) {
110 /* Highlight the fader processor so that pre- and post-fader processors are more obvious */
111 _event_box.modify_bg (STATE_NORMAL, Gdk::Color ("#4f4f4f"));
112 _name.set_padding (2, 4);
115 _active.set_active (_processor->active ());
116 _active.signal_toggled().connect (sigc::mem_fun (*this, &ProcessorEntry::active_toggled));
118 _processor->ActiveChanged.connect (active_connection, invalidator (*this), boost::bind (&ProcessorEntry::processor_active_changed, this), gui_context());
119 _processor->PropertyChanged.connect (name_connection, invalidator (*this), ui_bind (&ProcessorEntry::processor_property_changed, this, _1), gui_context());
123 ProcessorEntry::action_widget ()
129 ProcessorEntry::widget ()
135 ProcessorEntry::drag_text () const
140 boost::shared_ptr<Processor>
141 ProcessorEntry::processor () const
147 ProcessorEntry::set_enum_width (Width w)
153 ProcessorEntry::active_toggled ()
155 if (_active.get_active ()) {
156 if (!_processor->active ()) {
157 _processor->activate ();
160 if (_processor->active ()) {
161 _processor->deactivate ();
167 ProcessorEntry::processor_active_changed ()
169 if (_active.get_active () != _processor->active ()) {
170 _active.set_active (_processor->active ());
175 ProcessorEntry::processor_property_changed (const PropertyChange& what_changed)
177 if (what_changed.contains (ARDOUR::Properties::name)) {
178 _name.set_text (name ());
183 ProcessorEntry::name () const
185 boost::shared_ptr<Send> send;
188 if ((send = boost::dynamic_pointer_cast<Send> (_processor)) != 0 &&
189 !boost::dynamic_pointer_cast<InternalSend>(_processor)) {
193 /* grab the send name out of its overall name */
195 string::size_type lbracket, rbracket;
196 lbracket = send->name().find ('[');
197 rbracket = send->name().find (']');
201 name_display += send->name().substr (lbracket+1, lbracket-rbracket-1);
204 name_display += PBD::short_version (send->name().substr (lbracket+1, lbracket-rbracket-1), 4);
212 name_display += _processor->display_name();
215 name_display += PBD::short_version (_processor->display_name(), 5);
224 SendProcessorEntry::SendProcessorEntry (boost::shared_ptr<Send> s, Width w)
225 : ProcessorEntry (s, w),
227 _adjustment (0, 0, 1, 0.01, 0.1),
228 _fader (_slider, &_adjustment, 0, false),
229 _ignore_gain_change (false)
231 _fader.set_name ("SendFader");
232 _fader.set_controllable (_send->amp()->gain_control ());
233 _vbox.pack_start (_fader);
235 _adjustment.signal_value_changed().connect (sigc::mem_fun (*this, &SendProcessorEntry::gain_adjusted));
236 _send->amp()->gain_control()->Changed.connect (send_gain_connection, invalidator (*this), boost::bind (&SendProcessorEntry::show_gain, this), gui_context());
241 SendProcessorEntry::setup_slider_pix ()
243 _slider = ::get_icon ("fader_belt_h_thin");
248 SendProcessorEntry::show_gain ()
250 ENSURE_GUI_THREAD (*this, &SendProcessorEntry::show_gain)
252 float const value = gain_to_slider_position (_send->amp()->gain ());
254 if (_adjustment.get_value() != value) {
255 _ignore_gain_change = true;
256 _adjustment.set_value (value);
257 _ignore_gain_change = false;
262 SendProcessorEntry::gain_adjusted ()
264 if (_ignore_gain_change) {
268 _send->amp()->set_gain (slider_position_to_gain (_adjustment.get_value()), this);
272 SendProcessorEntry::set_pixel_width (int p)
274 _fader.set_fader_length (p);
277 ProcessorBox::ProcessorBox (ARDOUR::Session* sess, boost::function<PluginSelector*()> get_plugin_selector,
278 RouteRedirectSelection& rsel, MixerStrip* parent, bool owner_is_mixer)
279 : _parent_strip (parent)
280 , _owner_is_mixer (owner_is_mixer)
281 , ab_direction (true)
282 , _get_plugin_selector (get_plugin_selector)
283 , _placement(PreFader)
284 , _rr_selection(rsel)
290 send_action_menu = 0;
291 no_processor_redisplay = false;
293 processor_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
294 processor_scroller.add (processor_display);
295 pack_start (processor_scroller, true, true);
297 processor_display.set_flags (CAN_FOCUS);
298 processor_display.set_name ("ProcessorSelector");
299 processor_display.set_size_request (48, -1);
300 processor_display.set_data ("processorbox", this);
302 processor_display.signal_enter_notify_event().connect (sigc::mem_fun(*this, &ProcessorBox::enter_notify), false);
303 processor_display.signal_leave_notify_event().connect (sigc::mem_fun(*this, &ProcessorBox::leave_notify), false);
305 processor_display.signal_key_press_event().connect (sigc::mem_fun(*this, &ProcessorBox::processor_key_press_event));
306 processor_display.signal_key_release_event().connect (sigc::mem_fun(*this, &ProcessorBox::processor_key_release_event));
308 processor_display.ButtonPress.connect (sigc::mem_fun (*this, &ProcessorBox::processor_button_press_event));
309 processor_display.ButtonRelease.connect (sigc::mem_fun (*this, &ProcessorBox::processor_button_release_event));
311 processor_display.Reordered.connect (sigc::mem_fun (*this, &ProcessorBox::reordered));
312 processor_display.DropFromAnotherBox.connect (sigc::mem_fun (*this, &ProcessorBox::object_drop));
313 processor_display.SelectionChanged.connect (sigc::mem_fun (*this, &ProcessorBox::selection_changed));
316 parent->DeliveryChanged.connect (
317 _mixer_strip_connections, invalidator (*this), ui_bind (&ProcessorBox::mixer_strip_delivery_changed, this, _1), gui_context ()
322 ProcessorBox::~ProcessorBox ()
327 ProcessorBox::set_route (boost::shared_ptr<Route> r)
333 _route_connections.drop_connections();
335 /* new route: any existing block on processor redisplay must be meaningless */
336 no_processor_redisplay = false;
339 _route->processors_changed.connect (
340 _route_connections, invalidator (*this), ui_bind (&ProcessorBox::route_processors_changed, this, _1), gui_context()
343 _route->DropReferences.connect (
344 _route_connections, invalidator (*this), boost::bind (&ProcessorBox::route_going_away, this), gui_context()
347 _route->PropertyChanged.connect (
348 _route_connections, invalidator (*this), ui_bind (&ProcessorBox::route_property_changed, this, _1), gui_context()
351 redisplay_processors ();
355 ProcessorBox::route_going_away ()
357 /* don't keep updating display as processors are deleted */
358 no_processor_redisplay = true;
362 ProcessorBox::object_drop(DnDVBox<ProcessorEntry>* source, ProcessorEntry* position, Glib::RefPtr<Gdk::DragContext> const & context)
364 boost::shared_ptr<Processor> p;
366 p = position->processor ();
369 list<ProcessorEntry*> children = source->selection ();
370 list<boost::shared_ptr<Processor> > procs;
371 for (list<ProcessorEntry*>::const_iterator i = children.begin(); i != children.end(); ++i) {
372 procs.push_back ((*i)->processor ());
375 for (list<boost::shared_ptr<Processor> >::const_iterator i = procs.begin(); i != procs.end(); ++i) {
376 XMLNode& state = (*i)->get_state ();
378 nlist.push_back (&state);
379 paste_processor_state (nlist, p);
383 /* since the dndvbox doesn't take care of this properly, we have to delete the originals
387 if ((context->get_suggested_action() == Gdk::ACTION_MOVE) && source) {
388 ProcessorBox* other = reinterpret_cast<ProcessorBox*> (source->get_data ("processorbox"));
390 cerr << "source was another processor box, delete the selected items\n";
391 other->delete_dragged_processors (procs);
397 ProcessorBox::update()
399 redisplay_processors ();
403 ProcessorBox::set_width (Width w)
411 list<ProcessorEntry*> children = processor_display.children ();
412 for (list<ProcessorEntry*>::iterator i = children.begin(); i != children.end(); ++i) {
413 (*i)->set_enum_width (w);
416 redisplay_processors ();
420 ProcessorBox::build_send_action_menu ()
422 using namespace Menu_Helpers;
424 send_action_menu = new Menu;
425 send_action_menu->set_name ("ArdourContextMenu");
426 MenuList& items = send_action_menu->items();
428 items.push_back (MenuElem (_("New send"), sigc::mem_fun(*this, &ProcessorBox::new_send)));
429 items.push_back (MenuElem (_("Show send controls"), sigc::mem_fun(*this, &ProcessorBox::show_send_controls)));
433 ProcessorBox::build_possible_aux_menu ()
435 boost::shared_ptr<RouteList> rl = _session->get_routes_with_internal_returns();
441 using namespace Menu_Helpers;
442 Menu* menu = manage (new Menu);
443 MenuList& items = menu->items();
445 for (RouteList::iterator r = rl->begin(); r != rl->end(); ++r) {
446 if (!_route->internal_send_for (*r) && *r != _route) {
447 items.push_back (MenuElem ((*r)->name(), sigc::bind (sigc::ptr_fun (ProcessorBox::rb_choose_aux), boost::weak_ptr<Route>(*r))));
455 ProcessorBox::show_send_controls ()
460 ProcessorBox::new_send ()
465 ProcessorBox::show_processor_menu (gint arg)
467 if (processor_menu == 0) {
468 processor_menu = build_processor_menu ();
471 Gtk::MenuItem* plugin_menu_item = dynamic_cast<Gtk::MenuItem*>(ActionManager::get_widget("/processormenu/newplugin"));
473 if (plugin_menu_item) {
474 plugin_menu_item->set_submenu (*_get_plugin_selector()->plugin_menu());
477 Gtk::MenuItem* aux_menu_item = dynamic_cast<Gtk::MenuItem*>(ActionManager::get_widget("/processormenu/newaux"));
480 Menu* m = build_possible_aux_menu();
481 if (m && !m->items().empty()) {
482 aux_menu_item->set_submenu (*m);
483 aux_menu_item->set_sensitive (true);
485 /* stupid gtkmm: we need to pass a null reference here */
486 gtk_menu_item_set_submenu (aux_menu_item->gobj(), 0);
487 aux_menu_item->set_sensitive (false);
491 cut_action->set_sensitive (can_cut());
492 paste_action->set_sensitive (!_rr_selection.processors.empty());
494 processor_menu->popup (1, arg);
498 ProcessorBox::enter_notify (GdkEventCrossing*)
500 _current_processor_box = this;
501 Keyboard::magic_widget_grab_focus ();
502 processor_display.grab_focus ();
508 ProcessorBox::leave_notify (GdkEventCrossing* ev)
510 switch (ev->detail) {
511 case GDK_NOTIFY_INFERIOR:
514 Keyboard::magic_widget_drop_focus ();
521 ProcessorBox::processor_key_press_event (GdkEventKey *)
523 /* do real stuff on key release */
528 ProcessorBox::processor_key_release_event (GdkEventKey *ev)
531 ProcSelection targets;
533 get_selected_processors (targets);
535 if (targets.empty()) {
538 processor_display.get_pointer (x, y);
540 pair<ProcessorEntry *, double> const pointer = processor_display.get_child_at_position (y);
543 targets.push_back (pointer.first->processor ());
548 switch (ev->keyval) {
550 if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
551 processor_display.select_all ();
557 if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
558 copy_processors (targets);
564 if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
565 cut_processors (targets);
571 if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
572 if (targets.empty()) {
575 paste_processors (targets.front());
589 delete_processors (targets);
594 for (ProcSelection::iterator i = targets.begin(); i != targets.end(); ++i) {
595 if ((*i)->active()) {
617 ProcessorBox::processor_button_press_event (GdkEventButton *ev, ProcessorEntry* child)
619 boost::shared_ptr<Processor> processor;
621 processor = child->processor ();
625 bool selected = processor_display.selected (child);
627 if (processor && (Keyboard::is_edit_event (ev) || (ev->button == 1 && ev->type == GDK_2BUTTON_PRESS))) {
629 if (_session->engine().connected()) {
630 /* XXX giving an error message here is hard, because we may be in the midst of a button press */
631 toggle_edit_processor (processor);
635 } else if (processor && ev->button == 1 && selected) {
637 // this is purely informational but necessary for route params UI
638 ProcessorSelected (processor); // emit
640 } else if (!processor && ev->button == 1 && ev->type == GDK_2BUTTON_PRESS) {
643 _get_plugin_selector()->show_manager ();
650 ProcessorBox::processor_button_release_event (GdkEventButton *ev, ProcessorEntry* child)
652 boost::shared_ptr<Processor> processor;
654 processor = child->processor ();
659 if (processor && Keyboard::is_delete_event (ev)) {
661 Glib::signal_idle().connect (sigc::bind (
662 sigc::mem_fun(*this, &ProcessorBox::idle_delete_processor),
663 boost::weak_ptr<Processor>(processor)));
666 } else if (Keyboard::is_context_menu_event (ev)) {
668 /* figure out if we are above or below the fader/amp processor,
669 and set the next insert position appropriately.
673 if (_route->processor_is_prefader (processor)) {
674 _placement = PreFader;
676 _placement = PostFader;
679 _placement = PostFader;
682 show_processor_menu (ev->time);
685 } else if (processor && Keyboard::is_button2_event (ev)
687 && (Keyboard::no_modifier_keys_pressed (ev) && ((ev->state & Gdk::BUTTON2_MASK) == Gdk::BUTTON2_MASK))
691 /* button2-click with no/appropriate modifiers */
693 if (processor->active()) {
694 processor->deactivate ();
696 processor->activate ();
706 ProcessorBox::build_processor_menu ()
708 processor_menu = dynamic_cast<Gtk::Menu*>(ActionManager::get_widget("/processormenu") );
709 processor_menu->set_name ("ArdourContextMenu");
713 return processor_menu;
717 ProcessorBox::selection_changed ()
719 bool const sensitive = (processor_display.selection().empty()) ? false : true;
720 ActionManager::set_sensitive (ActionManager::plugin_selection_sensitive_actions, sensitive);
721 edit_action->set_sensitive (one_processor_can_be_edited ());
723 /* disallow rename for multiple selections and for plugin inserts */
724 rename_action->set_sensitive (
725 processor_display.selection().size() == 1 && boost::dynamic_pointer_cast<PluginInsert> (processor_display.selection().front()->processor()) == 0
730 ProcessorBox::select_all_processors ()
732 processor_display.select_all ();
736 ProcessorBox::deselect_all_processors ()
738 processor_display.select_none ();
742 ProcessorBox::choose_plugin ()
744 _get_plugin_selector()->set_interested_object (*this);
747 /** @return true if an error occurred, otherwise false */
749 ProcessorBox::use_plugins (const SelectedPlugins& plugins)
751 for (SelectedPlugins::const_iterator p = plugins.begin(); p != plugins.end(); ++p) {
753 boost::shared_ptr<Processor> processor (new PluginInsert (*_session, *p));
755 Route::ProcessorStreams err_streams;
757 if (Config->get_new_plugins_active()) {
758 processor->activate ();
761 if (_route->add_processor (processor, _placement, &err_streams)) {
762 weird_plugin_dialog (**p, err_streams);
764 // XXX SHAREDPTR delete plugin here .. do we even need to care?
767 if (Profile->get_sae()) {
768 processor->activate ();
777 ProcessorBox::weird_plugin_dialog (Plugin& p, Route::ProcessorStreams streams)
779 ArdourDialog dialog (_("Plugin Incompatibility"));
782 string text = string_compose(_("You attempted to add the plugin \"%1\" at index %2.\n"),
783 p.name(), streams.index);
785 bool has_midi = streams.count.n_midi() > 0 || p.get_info()->n_inputs.n_midi() > 0;
786 bool has_audio = streams.count.n_audio() > 0 || p.get_info()->n_inputs.n_audio() > 0;
788 text += _("\nThis plugin has:\n");
790 uint32_t const n = p.get_info()->n_inputs.n_midi ();
791 text += string_compose (ngettext ("\t%1 MIDI input", "\t%1 MIDI inputs", n), n);
794 uint32_t const n = p.get_info()->n_inputs.n_audio ();
795 text += string_compose (ngettext ("\t%1 audio input", "\t%1 audio inputs", n), n);
798 text += _("\nBut at the insertion point, there are:\n");
800 uint32_t const n = streams.count.n_midi ();
801 text += string_compose (ngettext ("\t%1 MIDI channel\n", "\t%1 MIDI channels\n", n), n);
804 uint32_t const n = streams.count.n_audio ();
805 text += string_compose (ngettext ("\t%1 audio channel\n", "\t%1 audio channels\n", n), n);
808 text += string_compose (_("\n%1 is unable to insert this plugin here.\n"), PROGRAM_NAME);
809 label.set_text(text);
811 dialog.get_vbox()->pack_start (label);
812 dialog.add_button (Stock::OK, RESPONSE_ACCEPT);
814 dialog.set_name (X_("PluginIODialog"));
815 dialog.set_position (Gtk::WIN_POS_MOUSE);
816 dialog.set_modal (true);
823 ProcessorBox::choose_insert ()
825 boost::shared_ptr<Processor> processor (new PortInsert (*_session, _route->mute_master()));
826 _route->add_processor (processor, _placement);
829 /* Caller must not hold process lock */
831 ProcessorBox::choose_send ()
833 boost::shared_ptr<Send> send (new Send (*_session, _route->mute_master()));
835 /* make an educated guess at the initial number of outputs for the send */
836 ChanCount outs = (_session->master_out())
837 ? _session->master_out()->n_outputs()
838 : _route->n_outputs();
840 /* XXX need processor lock on route */
842 Glib::Mutex::Lock lm (AudioEngine::instance()->process_lock());
843 send->output()->ensure_io (outs, false, this);
844 } catch (AudioEngine::PortRegistrationFailure& err) {
845 error << string_compose (_("Cannot set up new send: %1"), err.what()) << endmsg;
849 /* let the user adjust the IO setup before creation.
851 Note: this dialog is NOT modal - we just leave it to run and it will
852 return when its Finished signal is emitted - typically when the window
856 IOSelectorWindow *ios = new IOSelectorWindow (_session, send->output(), true);
859 /* keep a reference to the send so it doesn't get deleted while
860 the IOSelectorWindow is doing its stuff
862 _processor_being_created = send;
864 ios->selector().Finished.connect (sigc::bind (
865 sigc::mem_fun(*this, &ProcessorBox::send_io_finished),
866 boost::weak_ptr<Processor>(send), ios));
871 ProcessorBox::send_io_finished (IOSelector::Result r, boost::weak_ptr<Processor> weak_processor, IOSelectorWindow* ios)
873 boost::shared_ptr<Processor> processor (weak_processor.lock());
875 /* drop our temporary reference to the new send */
876 _processor_being_created.reset ();
883 case IOSelector::Cancelled:
884 // processor will go away when all shared_ptrs to it vanish
887 case IOSelector::Accepted:
888 _route->add_processor (processor, _placement);
889 if (Profile->get_sae()) {
890 processor->activate ();
895 delete_when_idle (ios);
899 ProcessorBox::return_io_finished (IOSelector::Result r, boost::weak_ptr<Processor> weak_processor, IOSelectorWindow* ios)
901 boost::shared_ptr<Processor> processor (weak_processor.lock());
903 /* drop our temporary reference to the new return */
904 _processor_being_created.reset ();
911 case IOSelector::Cancelled:
912 // processor will go away when all shared_ptrs to it vanish
915 case IOSelector::Accepted:
916 _route->add_processor (processor, _placement);
917 if (Profile->get_sae()) {
918 processor->activate ();
923 delete_when_idle (ios);
927 ProcessorBox::choose_aux (boost::weak_ptr<Route> wr)
933 boost::shared_ptr<Route> target = wr.lock();
939 boost::shared_ptr<RouteList> rlist (new RouteList);
940 rlist->push_back (_route);
942 _session->add_internal_sends (target, PreFader, rlist);
946 ProcessorBox::route_processors_changed (RouteProcessorChange c)
948 if (c.type == RouteProcessorChange::MeterPointChange && c.meter_visibly_changed == false) {
949 /* the meter has moved, but it was and still is invisible to the user, so nothing to do */
953 redisplay_processors ();
957 ProcessorBox::redisplay_processors ()
959 ENSURE_GUI_THREAD (*this, &ProcessorBox::redisplay_processors)
961 if (no_processor_redisplay) {
965 processor_display.clear ();
967 _route->foreach_processor (sigc::mem_fun (*this, &ProcessorBox::add_processor_to_display));
969 build_processor_tooltip (processor_eventbox, _("Inserts, sends & plugins:"));
971 for (list<ProcessorWindowProxy*>::iterator i = _processor_window_proxies.begin(); i != _processor_window_proxies.end(); ++i) {
972 (*i)->marked = false;
975 _route->foreach_processor (sigc::mem_fun (*this, &ProcessorBox::maybe_add_processor_to_ui_list));
977 /* trim dead wood from the processor window proxy list */
979 list<ProcessorWindowProxy*>::iterator i = _processor_window_proxies.begin();
980 while (i != _processor_window_proxies.end()) {
981 list<ProcessorWindowProxy*>::iterator j = i;
985 ARDOUR_UI::instance()->remove_window_proxy (*i);
987 _processor_window_proxies.erase (i);
994 /** Add a ProcessorWindowProxy for a processor to our list, if that processor does
995 * not already have one.
998 ProcessorBox::maybe_add_processor_to_ui_list (boost::weak_ptr<Processor> w)
1000 boost::shared_ptr<Processor> p = w.lock ();
1005 list<ProcessorWindowProxy*>::iterator i = _processor_window_proxies.begin ();
1006 while (i != _processor_window_proxies.end()) {
1008 boost::shared_ptr<Processor> t = (*i)->processor().lock ();
1011 /* this processor is already on the list; done */
1012 (*i)->marked = true;
1019 /* not on the list; add it */
1022 if (_parent_strip) {
1023 if (_parent_strip->mixer_owned()) {
1032 ProcessorWindowProxy* wp = new ProcessorWindowProxy (
1033 string_compose ("%1-%2-%3", loc, _route->id(), p->id()),
1034 _session->extra_xml (X_("UI")),
1039 _processor_window_proxies.push_back (wp);
1040 ARDOUR_UI::instance()->add_window_proxy (wp);
1044 ProcessorBox::add_processor_to_display (boost::weak_ptr<Processor> p)
1046 boost::shared_ptr<Processor> processor (p.lock ());
1048 if (!processor || !processor->display_to_user()) {
1052 boost::shared_ptr<Send> send = boost::dynamic_pointer_cast<Send> (processor);
1053 ProcessorEntry* e = 0;
1055 e = new SendProcessorEntry (send, _width);
1057 e = new ProcessorEntry (processor, _width);
1059 e->set_pixel_width (get_allocation().get_width());
1060 processor_display.add_child (e);
1065 ProcessorBox::build_processor_tooltip (EventBox& box, string start)
1069 list<ProcessorEntry*> children = processor_display.children ();
1070 for (list<ProcessorEntry*>::iterator i = children.begin(); i != children.end(); ++i) {
1072 tip += (*i)->processor()->name();
1075 ARDOUR_UI::instance()->set_tip (box, tip);
1079 ProcessorBox::reordered ()
1081 compute_processor_sort_keys ();
1085 ProcessorBox::compute_processor_sort_keys ()
1087 list<ProcessorEntry*> children = processor_display.children ();
1088 Route::ProcessorList our_processors;
1090 for (list<ProcessorEntry*>::iterator iter = children.begin(); iter != children.end(); ++iter) {
1091 our_processors.push_back ((*iter)->processor ());
1094 if (_route->reorder_processors (our_processors)) {
1095 /* Reorder failed, so report this to the user. As far as I can see this must be done
1096 in an idle handler: it seems that the redisplay_processors() that happens below destroys
1097 widgets that were involved in the drag-and-drop on the processor list, which causes problems
1098 when the drag is torn down after this handler function is finished.
1100 Glib::signal_idle().connect_once (sigc::mem_fun (*this, &ProcessorBox::report_failed_reorder));
1105 ProcessorBox::report_failed_reorder ()
1107 /* reorder failed, so redisplay */
1109 redisplay_processors ();
1111 /* now tell them about the problem */
1113 ArdourDialog dialog (_("Plugin Incompatibility"));
1116 label.set_text (_("\
1117 You cannot reorder these plugins/sends/inserts\n\
1118 in that way because the inputs and\n\
1119 outputs will not work correctly."));
1121 dialog.get_vbox()->set_border_width (12);
1122 dialog.get_vbox()->pack_start (label);
1123 dialog.add_button (Stock::OK, RESPONSE_ACCEPT);
1125 dialog.set_name (X_("PluginIODialog"));
1126 dialog.set_position (Gtk::WIN_POS_MOUSE);
1127 dialog.set_modal (true);
1134 ProcessorBox::rename_processors ()
1136 ProcSelection to_be_renamed;
1138 get_selected_processors (to_be_renamed);
1140 if (to_be_renamed.empty()) {
1144 for (ProcSelection::iterator i = to_be_renamed.begin(); i != to_be_renamed.end(); ++i) {
1145 rename_processor (*i);
1150 ProcessorBox::can_cut () const
1152 vector<boost::shared_ptr<Processor> > sel;
1154 get_selected_processors (sel);
1156 /* cut_processors () does not cut inserts */
1158 for (vector<boost::shared_ptr<Processor> >::const_iterator i = sel.begin (); i != sel.end (); ++i) {
1160 if (boost::dynamic_pointer_cast<PluginInsert>((*i)) != 0 ||
1161 (boost::dynamic_pointer_cast<Send>((*i)) != 0) ||
1162 (boost::dynamic_pointer_cast<Return>((*i)) != 0)) {
1171 ProcessorBox::cut_processors ()
1173 ProcSelection to_be_removed;
1175 get_selected_processors (to_be_removed);
1179 ProcessorBox::cut_processors (const ProcSelection& to_be_removed)
1181 if (to_be_removed.empty()) {
1185 XMLNode* node = new XMLNode (X_("cut"));
1186 Route::ProcessorList to_cut;
1188 no_processor_redisplay = true;
1189 for (ProcSelection::const_iterator i = to_be_removed.begin(); i != to_be_removed.end(); ++i) {
1190 // Cut only plugins, sends and returns
1191 if (boost::dynamic_pointer_cast<PluginInsert>((*i)) != 0 ||
1192 (boost::dynamic_pointer_cast<Send>((*i)) != 0) ||
1193 (boost::dynamic_pointer_cast<Return>((*i)) != 0)) {
1195 Window* w = get_processor_ui (*i);
1201 XMLNode& child ((*i)->get_state());
1202 node->add_child_nocopy (child);
1203 to_cut.push_back (*i);
1207 if (_route->remove_processors (to_cut) != 0) {
1209 no_processor_redisplay = false;
1213 _rr_selection.set (node);
1215 no_processor_redisplay = false;
1216 redisplay_processors ();
1220 ProcessorBox::copy_processors ()
1222 ProcSelection to_be_copied;
1223 get_selected_processors (to_be_copied);
1224 copy_processors (to_be_copied);
1228 ProcessorBox::copy_processors (const ProcSelection& to_be_copied)
1230 if (to_be_copied.empty()) {
1234 XMLNode* node = new XMLNode (X_("copy"));
1236 for (ProcSelection::const_iterator i = to_be_copied.begin(); i != to_be_copied.end(); ++i) {
1237 // Copy only plugins, sends, returns
1238 if (boost::dynamic_pointer_cast<PluginInsert>((*i)) != 0 ||
1239 (boost::dynamic_pointer_cast<Send>((*i)) != 0) ||
1240 (boost::dynamic_pointer_cast<Return>((*i)) != 0)) {
1241 node->add_child_nocopy ((*i)->get_state());
1245 _rr_selection.set (node);
1249 ProcessorBox::delete_processors ()
1251 ProcSelection to_be_deleted;
1252 get_selected_processors (to_be_deleted);
1253 delete_processors (to_be_deleted);
1257 ProcessorBox::delete_processors (const ProcSelection& targets)
1259 if (targets.empty()) {
1263 no_processor_redisplay = true;
1265 for (ProcSelection::const_iterator i = targets.begin(); i != targets.end(); ++i) {
1267 Window* w = get_processor_ui (*i);
1273 _route->remove_processor(*i);
1276 no_processor_redisplay = false;
1277 redisplay_processors ();
1281 ProcessorBox::delete_dragged_processors (const list<boost::shared_ptr<Processor> >& procs)
1283 list<boost::shared_ptr<Processor> >::const_iterator x;
1285 no_processor_redisplay = true;
1286 for (x = procs.begin(); x != procs.end(); ++x) {
1288 Window* w = get_processor_ui (*x);
1294 _route->remove_processor(*x);
1297 no_processor_redisplay = false;
1298 redisplay_processors ();
1302 ProcessorBox::idle_delete_processor (boost::weak_ptr<Processor> weak_processor)
1304 boost::shared_ptr<Processor> processor (weak_processor.lock());
1310 /* NOT copied to _mixer.selection() */
1312 no_processor_redisplay = true;
1313 _route->remove_processor (processor);
1314 no_processor_redisplay = false;
1315 redisplay_processors ();
1321 ProcessorBox::rename_processor (boost::shared_ptr<Processor> processor)
1323 ArdourPrompter name_prompter (true);
1325 name_prompter.set_title (_("Rename Processor"));
1326 name_prompter.set_prompt (_("New name:"));
1327 name_prompter.set_initial_text (processor->name());
1328 name_prompter.add_button (_("Rename"), Gtk::RESPONSE_ACCEPT);
1329 name_prompter.set_response_sensitive (Gtk::RESPONSE_ACCEPT, false);
1330 name_prompter.show_all ();
1332 switch (name_prompter.run ()) {
1334 case Gtk::RESPONSE_ACCEPT:
1335 name_prompter.get_result (result);
1336 if (result.length()) {
1339 string test = result;
1341 while (tries < 100) {
1342 if (_session->io_name_is_legal (test)) {
1348 test = string_compose ("%1-%2", result, tries);
1352 processor->set_name (result);
1355 ARDOUR_UI::instance()->popup_error
1356 (string_compose (_("At least 100 IO objects exist with a name like %1 - name not changed"), result));
1366 ProcessorBox::paste_processors ()
1368 if (_rr_selection.processors.empty()) {
1372 paste_processor_state (_rr_selection.processors.get_node().children(), boost::shared_ptr<Processor>());
1376 ProcessorBox::paste_processors (boost::shared_ptr<Processor> before)
1379 if (_rr_selection.processors.empty()) {
1383 paste_processor_state (_rr_selection.processors.get_node().children(), before);
1387 ProcessorBox::paste_processor_state (const XMLNodeList& nlist, boost::shared_ptr<Processor> p)
1389 XMLNodeConstIterator niter;
1390 list<boost::shared_ptr<Processor> > copies;
1392 if (nlist.empty()) {
1396 for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
1398 XMLProperty const * type = (*niter)->property ("type");
1401 boost::shared_ptr<Processor> p;
1403 if (type->value() == "meter" ||
1404 type->value() == "main-outs" ||
1405 type->value() == "amp" ||
1406 type->value() == "intsend" || type->value() == "intreturn") {
1407 /* do not paste meter, main outs, amp or internal send/returns */
1410 } else if (type->value() == "send") {
1412 XMLNode n (**niter);
1413 Send::make_unique (n, *_session);
1414 Send* s = new Send (*_session, _route->mute_master());
1415 if (s->set_state (n, Stateful::loading_state_version)) {
1423 } else if (type->value() == "return") {
1425 XMLNode n (**niter);
1426 Return::make_unique (n, *_session);
1427 Return* r = new Return (*_session);
1429 if (r->set_state (n, Stateful::loading_state_version)) {
1437 /* XXX its a bit limiting to assume that everything else
1441 p.reset (new PluginInsert (*_session));
1442 p->set_state (**niter, Stateful::current_state_version);
1445 copies.push_back (p);
1449 cerr << "plugin insert constructor failed\n";
1453 if (copies.empty()) {
1457 if (_route->add_processors (copies, p)) {
1460 "Copying the set of processors on the clipboard failed,\n\
1461 probably because the I/O configuration of the plugins\n\
1462 could not match the configuration of this track.");
1463 MessageDialog am (msg);
1469 ProcessorBox::activate_processor (boost::shared_ptr<Processor> r)
1475 ProcessorBox::deactivate_processor (boost::shared_ptr<Processor> r)
1481 ProcessorBox::get_selected_processors (ProcSelection& processors) const
1483 const list<ProcessorEntry*> selection = processor_display.selection ();
1484 for (list<ProcessorEntry*>::const_iterator i = selection.begin(); i != selection.end(); ++i) {
1485 processors.push_back ((*i)->processor ());
1490 ProcessorBox::for_selected_processors (void (ProcessorBox::*method)(boost::shared_ptr<Processor>))
1492 list<ProcessorEntry*> selection = processor_display.selection ();
1493 for (list<ProcessorEntry*>::iterator i = selection.begin(); i != selection.end(); ++i) {
1494 (this->*method) ((*i)->processor ());
1499 ProcessorBox::all_processors_active (bool state)
1501 _route->all_processors_active (_placement, state);
1505 ProcessorBox::ab_plugins ()
1507 _route->ab_plugins (ab_direction);
1508 ab_direction = !ab_direction;
1513 ProcessorBox::clear_processors ()
1516 vector<string> choices;
1518 prompt = string_compose (_("Do you really want to remove all processors from %1?\n"
1519 "(this cannot be undone)"), _route->name());
1521 choices.push_back (_("Cancel"));
1522 choices.push_back (_("Yes, remove them all"));
1524 Gtkmm2ext::Choice prompter (_("Remove processors"), prompt, choices);
1526 if (prompter.run () == 1) {
1527 _route->clear_processors (PreFader);
1528 _route->clear_processors (PostFader);
1533 ProcessorBox::clear_processors (Placement p)
1536 vector<string> choices;
1538 if (p == PreFader) {
1539 prompt = string_compose (_("Do you really want to remove all pre-fader processors from %1?\n"
1540 "(this cannot be undone)"), _route->name());
1542 prompt = string_compose (_("Do you really want to remove all post-fader processors from %1?\n"
1543 "(this cannot be undone)"), _route->name());
1546 choices.push_back (_("Cancel"));
1547 choices.push_back (_("Yes, remove them all"));
1549 Gtkmm2ext::Choice prompter (_("Remove processors"), prompt, choices);
1551 if (prompter.run () == 1) {
1552 _route->clear_processors (p);
1557 ProcessorBox::processor_can_be_edited (boost::shared_ptr<Processor> processor)
1559 boost::shared_ptr<AudioTrack> at = boost::dynamic_pointer_cast<AudioTrack> (_route);
1560 if (at && at->freeze_state() == AudioTrack::Frozen) {
1565 boost::dynamic_pointer_cast<Send> (processor) ||
1566 boost::dynamic_pointer_cast<Return> (processor) ||
1567 boost::dynamic_pointer_cast<PluginInsert> (processor) ||
1568 boost::dynamic_pointer_cast<PortInsert> (processor)
1577 ProcessorBox::one_processor_can_be_edited ()
1579 list<ProcessorEntry*> selection = processor_display.selection ();
1580 list<ProcessorEntry*>::iterator i = selection.begin();
1581 while (i != selection.end() && processor_can_be_edited ((*i)->processor()) == false) {
1585 return (i != selection.end());
1589 ProcessorBox::toggle_edit_processor (boost::shared_ptr<Processor> processor)
1591 boost::shared_ptr<Send> send;
1592 boost::shared_ptr<Return> retrn;
1593 boost::shared_ptr<PluginInsert> plugin_insert;
1594 boost::shared_ptr<PortInsert> port_insert;
1597 if (boost::dynamic_pointer_cast<AudioTrack>(_route) != 0) {
1599 if (boost::dynamic_pointer_cast<AudioTrack> (_route)->freeze_state() == AudioTrack::Frozen) {
1604 if ((send = boost::dynamic_pointer_cast<Send> (processor)) != 0) {
1606 if (!_session->engine().connected()) {
1610 if (_parent_strip) {
1611 _parent_strip->show_send (send);
1614 } else if ((retrn = boost::dynamic_pointer_cast<Return> (processor)) != 0) {
1616 if (boost::dynamic_pointer_cast<InternalReturn> (retrn)) {
1617 /* no GUI for these */
1621 if (!_session->engine().connected()) {
1625 boost::shared_ptr<Return> retrn = boost::dynamic_pointer_cast<Return> (processor);
1627 ReturnUIWindow *return_ui;
1628 Window* w = get_processor_ui (retrn);
1632 return_ui = new ReturnUIWindow (retrn, _session);
1633 return_ui->set_title (retrn->name ());
1634 set_processor_ui (send, return_ui);
1637 return_ui = dynamic_cast<ReturnUIWindow *> (w);
1642 } else if ((plugin_insert = boost::dynamic_pointer_cast<PluginInsert> (processor)) != 0) {
1644 PluginUIWindow *plugin_ui;
1646 /* these are both allowed to be null */
1648 Container* toplevel = get_toplevel();
1649 Window* win = dynamic_cast<Gtk::Window*>(toplevel);
1651 Window* w = get_processor_ui (plugin_insert);
1655 plugin_ui = new PluginUIWindow (win, plugin_insert);
1656 plugin_ui->set_title (generate_processor_title (plugin_insert));
1657 set_processor_ui (plugin_insert, plugin_ui);
1660 plugin_ui = dynamic_cast<PluginUIWindow *> (w);
1661 plugin_ui->set_parent (win);
1666 } else if ((port_insert = boost::dynamic_pointer_cast<PortInsert> (processor)) != 0) {
1668 if (!_session->engine().connected()) {
1669 MessageDialog msg ( _("Not connected to JACK - no I/O changes are possible"));
1674 PortInsertWindow *io_selector;
1676 Window* w = get_processor_ui (port_insert);
1679 io_selector = new PortInsertWindow (_session, port_insert);
1680 set_processor_ui (port_insert, io_selector);
1683 io_selector = dynamic_cast<PortInsertWindow *> (w);
1686 gidget = io_selector;
1690 if (gidget->is_visible()) {
1693 gidget->show_all ();
1700 ProcessorBox::register_actions ()
1702 Glib::RefPtr<Gtk::ActionGroup> popup_act_grp = Gtk::ActionGroup::create(X_("processormenu"));
1703 Glib::RefPtr<Action> act;
1706 ActionManager::register_action (popup_act_grp, X_("newplugin"), _("New Plugin"),
1707 sigc::ptr_fun (ProcessorBox::rb_choose_plugin));
1709 act = ActionManager::register_action (popup_act_grp, X_("newinsert"), _("New Insert"),
1710 sigc::ptr_fun (ProcessorBox::rb_choose_insert));
1711 ActionManager::jack_sensitive_actions.push_back (act);
1712 act = ActionManager::register_action (popup_act_grp, X_("newsend"), _("New Send ..."),
1713 sigc::ptr_fun (ProcessorBox::rb_choose_send));
1714 ActionManager::jack_sensitive_actions.push_back (act);
1716 ActionManager::register_action (popup_act_grp, X_("newaux"), _("New Aux Send ..."));
1718 ActionManager::register_action (popup_act_grp, X_("clear"), _("Clear (all)"),
1719 sigc::ptr_fun (ProcessorBox::rb_clear));
1720 ActionManager::register_action (popup_act_grp, X_("clear_pre"), _("Clear (pre-fader)"),
1721 sigc::ptr_fun (ProcessorBox::rb_clear_pre));
1722 ActionManager::register_action (popup_act_grp, X_("clear_post"), _("Clear (post-fader)"),
1723 sigc::ptr_fun (ProcessorBox::rb_clear_post));
1725 /* standard editing stuff */
1726 cut_action = ActionManager::register_action (popup_act_grp, X_("cut"), _("Cut"),
1727 sigc::ptr_fun (ProcessorBox::rb_cut));
1728 ActionManager::plugin_selection_sensitive_actions.push_back(cut_action);
1729 act = ActionManager::register_action (popup_act_grp, X_("copy"), _("Copy"),
1730 sigc::ptr_fun (ProcessorBox::rb_copy));
1731 ActionManager::plugin_selection_sensitive_actions.push_back(act);
1733 act = ActionManager::register_action (popup_act_grp, X_("delete"), _("Delete"),
1734 sigc::ptr_fun (ProcessorBox::rb_delete));
1735 ActionManager::plugin_selection_sensitive_actions.push_back(act); // ??
1737 paste_action = ActionManager::register_action (popup_act_grp, X_("paste"), _("Paste"),
1738 sigc::ptr_fun (ProcessorBox::rb_paste));
1739 rename_action = ActionManager::register_action (popup_act_grp, X_("rename"), _("Rename"),
1740 sigc::ptr_fun (ProcessorBox::rb_rename));
1741 ActionManager::register_action (popup_act_grp, X_("selectall"), _("Select All"),
1742 sigc::ptr_fun (ProcessorBox::rb_select_all));
1743 ActionManager::register_action (popup_act_grp, X_("deselectall"), _("Deselect All"),
1744 sigc::ptr_fun (ProcessorBox::rb_deselect_all));
1746 /* activation etc. */
1748 ActionManager::register_action (popup_act_grp, X_("activate_all"), _("Activate all"),
1749 sigc::ptr_fun (ProcessorBox::rb_activate_all));
1750 ActionManager::register_action (popup_act_grp, X_("deactivate_all"), _("Deactivate all"),
1751 sigc::ptr_fun (ProcessorBox::rb_deactivate_all));
1752 ActionManager::register_action (popup_act_grp, X_("ab_plugins"), _("A/B Plugins"),
1753 sigc::ptr_fun (ProcessorBox::rb_ab_plugins));
1756 edit_action = ActionManager::register_action (popup_act_grp, X_("edit"), _("Edit..."),
1757 sigc::ptr_fun (ProcessorBox::rb_edit));
1759 ActionManager::add_action_group (popup_act_grp);
1763 ProcessorBox::rb_ab_plugins ()
1765 if (_current_processor_box == 0) {
1769 _current_processor_box->ab_plugins ();
1773 ProcessorBox::rb_choose_plugin ()
1775 if (_current_processor_box == 0) {
1778 _current_processor_box->choose_plugin ();
1782 ProcessorBox::rb_choose_insert ()
1784 if (_current_processor_box == 0) {
1787 _current_processor_box->choose_insert ();
1791 ProcessorBox::rb_choose_send ()
1793 if (_current_processor_box == 0) {
1796 _current_processor_box->choose_send ();
1800 ProcessorBox::rb_choose_aux (boost::weak_ptr<Route> wr)
1802 if (_current_processor_box == 0) {
1806 _current_processor_box->choose_aux (wr);
1810 ProcessorBox::rb_clear ()
1812 if (_current_processor_box == 0) {
1816 _current_processor_box->clear_processors ();
1821 ProcessorBox::rb_clear_pre ()
1823 if (_current_processor_box == 0) {
1827 _current_processor_box->clear_processors (PreFader);
1832 ProcessorBox::rb_clear_post ()
1834 if (_current_processor_box == 0) {
1838 _current_processor_box->clear_processors (PostFader);
1842 ProcessorBox::rb_cut ()
1844 if (_current_processor_box == 0) {
1848 _current_processor_box->cut_processors ();
1852 ProcessorBox::rb_delete ()
1854 if (_current_processor_box == 0) {
1858 _current_processor_box->delete_processors ();
1862 ProcessorBox::rb_copy ()
1864 if (_current_processor_box == 0) {
1867 _current_processor_box->copy_processors ();
1871 ProcessorBox::rb_paste ()
1873 if (_current_processor_box == 0) {
1877 _current_processor_box->paste_processors ();
1881 ProcessorBox::rb_rename ()
1883 if (_current_processor_box == 0) {
1886 _current_processor_box->rename_processors ();
1890 ProcessorBox::rb_select_all ()
1892 if (_current_processor_box == 0) {
1896 _current_processor_box->select_all_processors ();
1900 ProcessorBox::rb_deselect_all ()
1902 if (_current_processor_box == 0) {
1906 _current_processor_box->deselect_all_processors ();
1910 ProcessorBox::rb_activate_all ()
1912 if (_current_processor_box == 0) {
1916 _current_processor_box->all_processors_active (true);
1920 ProcessorBox::rb_deactivate_all ()
1922 if (_current_processor_box == 0) {
1925 _current_processor_box->all_processors_active (false);
1929 ProcessorBox::rb_edit ()
1931 if (_current_processor_box == 0) {
1935 _current_processor_box->for_selected_processors (&ProcessorBox::toggle_edit_processor);
1939 ProcessorBox::route_property_changed (const PropertyChange& what_changed)
1941 if (!what_changed.contains (ARDOUR::Properties::name)) {
1945 ENSURE_GUI_THREAD (*this, &ProcessorBox::route_property_changed, what_changed);
1947 boost::shared_ptr<Processor> processor;
1948 boost::shared_ptr<PluginInsert> plugin_insert;
1949 boost::shared_ptr<Send> send;
1951 list<ProcessorEntry*> children = processor_display.children();
1953 for (list<ProcessorEntry*>::iterator iter = children.begin(); iter != children.end(); ++iter) {
1955 processor = (*iter)->processor ();
1957 Window* w = get_processor_ui (processor);
1963 /* rename editor windows for sends and plugins */
1965 if ((send = boost::dynamic_pointer_cast<Send> (processor)) != 0) {
1966 w->set_title (send->name ());
1967 } else if ((plugin_insert = boost::dynamic_pointer_cast<PluginInsert> (processor)) != 0) {
1968 w->set_title (generate_processor_title (plugin_insert));
1974 ProcessorBox::generate_processor_title (boost::shared_ptr<PluginInsert> pi)
1976 string maker = pi->plugin()->maker() ? pi->plugin()->maker() : "";
1977 string::size_type email_pos;
1979 if ((email_pos = maker.find_first_of ('<')) != string::npos) {
1980 maker = maker.substr (0, email_pos - 1);
1983 if (maker.length() > 32) {
1984 maker = maker.substr (0, 32);
1988 return string_compose(_("%1: %2 (by %3)"), _route->name(), pi->name(), maker);
1992 ProcessorBox::on_size_allocate (Allocation& a)
1994 HBox::on_size_allocate (a);
1996 list<ProcessorEntry*> children = processor_display.children ();
1997 for (list<ProcessorEntry*>::const_iterator i = children.begin(); i != children.end(); ++i) {
1998 (*i)->set_pixel_width (a.get_width ());
2002 /** @param p Processor.
2003 * @return the UI window for \a p.
2006 ProcessorBox::get_processor_ui (boost::shared_ptr<Processor> p) const
2008 list<ProcessorWindowProxy*>::const_iterator i = _processor_window_proxies.begin ();
2009 while (i != _processor_window_proxies.end()) {
2010 boost::shared_ptr<Processor> t = (*i)->processor().lock ();
2012 return (*i)->get ();
2018 /* we shouldn't get here, because the ProcessorUIList should always contain
2019 an entry for each processor.
2025 /** Make a note of the UI window that a processor is using.
2026 * @param p Processor.
2027 * @param w UI window.
2030 ProcessorBox::set_processor_ui (boost::shared_ptr<Processor> p, Gtk::Window* w)
2032 list<ProcessorWindowProxy*>::iterator i = _processor_window_proxies.begin ();
2033 while (i != _processor_window_proxies.end()) {
2034 boost::shared_ptr<Processor> t = (*i)->processor().lock ();
2043 /* we shouldn't get here, because the ProcessorUIList should always contain
2044 an entry for each processor.
2050 ProcessorBox::mixer_strip_delivery_changed (boost::weak_ptr<Delivery> w)
2052 boost::shared_ptr<Delivery> d = w.lock ();
2057 list<ProcessorEntry*> children = processor_display.children ();
2058 list<ProcessorEntry*>::const_iterator i = children.begin();
2059 while (i != children.end() && (*i)->processor() != d) {
2063 if (i == children.end()) {
2064 processor_display.set_active (0);
2066 processor_display.set_active (*i);
2070 ProcessorWindowProxy::ProcessorWindowProxy (
2071 string const & name,
2072 XMLNode const * node,
2074 boost::weak_ptr<Processor> processor
2076 : WindowProxy<Gtk::Window> (name, node)
2078 , _processor_box (box)
2079 , _processor (processor)
2086 ProcessorWindowProxy::show ()
2088 boost::shared_ptr<Processor> p = _processor.lock ();
2093 _processor_box->toggle_edit_processor (p);