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 _active.set_active (_processor->active ());
110 _active.signal_toggled().connect (sigc::mem_fun (*this, &ProcessorEntry::active_toggled));
112 _processor->ActiveChanged.connect (active_connection, invalidator (*this), boost::bind (&ProcessorEntry::processor_active_changed, this), gui_context());
113 _processor->PropertyChanged.connect (name_connection, invalidator (*this), ui_bind (&ProcessorEntry::processor_property_changed, this, _1), gui_context());
117 ProcessorEntry::action_widget ()
123 ProcessorEntry::widget ()
129 ProcessorEntry::drag_text () const
134 boost::shared_ptr<Processor>
135 ProcessorEntry::processor () const
141 ProcessorEntry::set_enum_width (Width w)
147 ProcessorEntry::active_toggled ()
149 if (_active.get_active ()) {
150 if (!_processor->active ()) {
151 _processor->activate ();
154 if (_processor->active ()) {
155 _processor->deactivate ();
161 ProcessorEntry::processor_active_changed ()
163 if (_active.get_active () != _processor->active ()) {
164 _active.set_active (_processor->active ());
169 ProcessorEntry::processor_property_changed (const PropertyChange& what_changed)
171 if (what_changed.contains (ARDOUR::Properties::name)) {
172 _name.set_text (name ());
177 ProcessorEntry::name () const
179 boost::shared_ptr<Send> send;
182 if ((send = boost::dynamic_pointer_cast<Send> (_processor)) != 0 &&
183 !boost::dynamic_pointer_cast<InternalSend>(_processor)) {
187 /* grab the send name out of its overall name */
189 string::size_type lbracket, rbracket;
190 lbracket = send->name().find ('[');
191 rbracket = send->name().find (']');
195 name_display += send->name().substr (lbracket+1, lbracket-rbracket-1);
198 name_display += PBD::short_version (send->name().substr (lbracket+1, lbracket-rbracket-1), 4);
206 name_display += _processor->display_name();
209 name_display += PBD::short_version (_processor->display_name(), 5);
218 SendProcessorEntry::SendProcessorEntry (boost::shared_ptr<Send> s, Width w)
219 : ProcessorEntry (s, w),
221 _adjustment (0, 0, 1, 0.01, 0.1),
222 _fader (_slider, &_adjustment, 0, false),
223 _ignore_gain_change (false)
225 _fader.set_controllable (_send->amp()->gain_control ());
226 _vbox.pack_start (_fader);
228 _adjustment.signal_value_changed().connect (sigc::mem_fun (*this, &SendProcessorEntry::gain_adjusted));
229 _send->amp()->gain_control()->Changed.connect (send_gain_connection, invalidator (*this), boost::bind (&SendProcessorEntry::show_gain, this), gui_context());
234 SendProcessorEntry::setup_slider_pix ()
236 _slider = ::get_icon ("fader_belt_h_thin");
241 SendProcessorEntry::show_gain ()
243 ENSURE_GUI_THREAD (*this, &SendProcessorEntry::show_gain)
245 float const value = gain_to_slider_position (_send->amp()->gain ());
247 if (_adjustment.get_value() != value) {
248 _ignore_gain_change = true;
249 _adjustment.set_value (value);
250 _ignore_gain_change = false;
255 SendProcessorEntry::gain_adjusted ()
257 if (_ignore_gain_change) {
261 _send->amp()->set_gain (slider_position_to_gain (_adjustment.get_value()), this);
265 SendProcessorEntry::set_pixel_width (int p)
267 _fader.set_fader_length (p);
270 ProcessorBox::ProcessorBox (ARDOUR::Session* sess, boost::function<PluginSelector*()> get_plugin_selector,
271 RouteRedirectSelection& rsel, MixerStrip* parent, bool owner_is_mixer)
272 : _parent_strip (parent)
273 , _owner_is_mixer (owner_is_mixer)
274 , ab_direction (true)
275 , _get_plugin_selector (get_plugin_selector)
276 , _placement(PreFader)
277 , _rr_selection(rsel)
283 send_action_menu = 0;
284 no_processor_redisplay = false;
286 processor_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
287 processor_scroller.add (processor_display);
288 pack_start (processor_scroller, true, true);
290 processor_display.set_flags (CAN_FOCUS);
291 processor_display.set_name ("ProcessorSelector");
292 processor_display.set_size_request (48, -1);
293 processor_display.set_data ("processorbox", this);
295 processor_display.signal_enter_notify_event().connect (sigc::mem_fun(*this, &ProcessorBox::enter_notify), false);
296 processor_display.signal_leave_notify_event().connect (sigc::mem_fun(*this, &ProcessorBox::leave_notify), false);
298 processor_display.signal_key_press_event().connect (sigc::mem_fun(*this, &ProcessorBox::processor_key_press_event));
299 processor_display.signal_key_release_event().connect (sigc::mem_fun(*this, &ProcessorBox::processor_key_release_event));
301 processor_display.ButtonPress.connect (sigc::mem_fun (*this, &ProcessorBox::processor_button_press_event));
302 processor_display.ButtonRelease.connect (sigc::mem_fun (*this, &ProcessorBox::processor_button_release_event));
304 processor_display.Reordered.connect (sigc::mem_fun (*this, &ProcessorBox::reordered));
305 processor_display.DropFromAnotherBox.connect (sigc::mem_fun (*this, &ProcessorBox::object_drop));
306 processor_display.SelectionChanged.connect (sigc::mem_fun (*this, &ProcessorBox::selection_changed));
309 ProcessorBox::~ProcessorBox ()
314 ProcessorBox::set_route (boost::shared_ptr<Route> r)
320 connections.drop_connections();
322 /* new route: any existing block on processor redisplay must be meaningless */
323 no_processor_redisplay = false;
326 _route->processors_changed.connect (connections, invalidator (*this), ui_bind (&ProcessorBox::route_processors_changed, this, _1), gui_context());
327 _route->DropReferences.connect (connections, invalidator (*this), boost::bind (&ProcessorBox::route_going_away, this), gui_context());
328 _route->PropertyChanged.connect (connections, invalidator (*this), ui_bind (&ProcessorBox::route_property_changed, this, _1), gui_context());
330 redisplay_processors ();
334 ProcessorBox::route_going_away ()
336 /* don't keep updating display as processors are deleted */
337 no_processor_redisplay = true;
341 ProcessorBox::object_drop(DnDVBox<ProcessorEntry>* source, ProcessorEntry* position, Glib::RefPtr<Gdk::DragContext> const & context)
343 boost::shared_ptr<Processor> p;
345 p = position->processor ();
348 list<ProcessorEntry*> children = source->selection ();
349 list<boost::shared_ptr<Processor> > procs;
350 for (list<ProcessorEntry*>::const_iterator i = children.begin(); i != children.end(); ++i) {
351 procs.push_back ((*i)->processor ());
354 for (list<boost::shared_ptr<Processor> >::const_iterator i = procs.begin(); i != procs.end(); ++i) {
355 XMLNode& state = (*i)->get_state ();
357 nlist.push_back (&state);
358 paste_processor_state (nlist, p);
362 /* since the dndvbox doesn't take care of this properly, we have to delete the originals
366 if ((context->get_suggested_action() == Gdk::ACTION_MOVE) && source) {
367 ProcessorBox* other = reinterpret_cast<ProcessorBox*> (source->get_data ("processorbox"));
369 cerr << "source was another processor box, delete the selected items\n";
370 other->delete_dragged_processors (procs);
376 ProcessorBox::update()
378 redisplay_processors ();
382 ProcessorBox::set_width (Width w)
390 list<ProcessorEntry*> children = processor_display.children ();
391 for (list<ProcessorEntry*>::iterator i = children.begin(); i != children.end(); ++i) {
392 (*i)->set_enum_width (w);
395 redisplay_processors ();
399 ProcessorBox::build_send_action_menu ()
401 using namespace Menu_Helpers;
403 send_action_menu = new Menu;
404 send_action_menu->set_name ("ArdourContextMenu");
405 MenuList& items = send_action_menu->items();
407 items.push_back (MenuElem (_("New send"), sigc::mem_fun(*this, &ProcessorBox::new_send)));
408 items.push_back (MenuElem (_("Show send controls"), sigc::mem_fun(*this, &ProcessorBox::show_send_controls)));
412 ProcessorBox::build_possible_aux_menu ()
414 boost::shared_ptr<RouteList> rl = _session->get_routes_with_internal_returns();
420 using namespace Menu_Helpers;
421 Menu* menu = manage (new Menu);
422 MenuList& items = menu->items();
424 for (RouteList::iterator r = rl->begin(); r != rl->end(); ++r) {
425 if (!_route->internal_send_for (*r) && *r != _route) {
426 items.push_back (MenuElem ((*r)->name(), sigc::bind (sigc::ptr_fun (ProcessorBox::rb_choose_aux), boost::weak_ptr<Route>(*r))));
434 ProcessorBox::show_send_controls ()
439 ProcessorBox::new_send ()
444 ProcessorBox::show_processor_menu (gint arg)
446 if (processor_menu == 0) {
447 processor_menu = build_processor_menu ();
450 Gtk::MenuItem* plugin_menu_item = dynamic_cast<Gtk::MenuItem*>(ActionManager::get_widget("/processormenu/newplugin"));
452 if (plugin_menu_item) {
453 plugin_menu_item->set_submenu (*_get_plugin_selector()->plugin_menu());
456 Gtk::MenuItem* aux_menu_item = dynamic_cast<Gtk::MenuItem*>(ActionManager::get_widget("/processormenu/newaux"));
459 Menu* m = build_possible_aux_menu();
460 if (m && !m->items().empty()) {
461 aux_menu_item->set_submenu (*m);
462 aux_menu_item->set_sensitive (true);
464 /* stupid gtkmm: we need to pass a null reference here */
465 gtk_menu_item_set_submenu (aux_menu_item->gobj(), 0);
466 aux_menu_item->set_sensitive (false);
470 cut_action->set_sensitive (can_cut());
471 paste_action->set_sensitive (!_rr_selection.processors.empty());
473 processor_menu->popup (1, arg);
477 ProcessorBox::enter_notify (GdkEventCrossing*)
479 _current_processor_box = this;
480 Keyboard::magic_widget_grab_focus ();
481 processor_display.grab_focus ();
487 ProcessorBox::leave_notify (GdkEventCrossing* ev)
489 switch (ev->detail) {
490 case GDK_NOTIFY_INFERIOR:
493 Keyboard::magic_widget_drop_focus ();
500 ProcessorBox::processor_key_press_event (GdkEventKey *)
502 /* do real stuff on key release */
507 ProcessorBox::processor_key_release_event (GdkEventKey *ev)
510 ProcSelection targets;
512 get_selected_processors (targets);
514 if (targets.empty()) {
517 processor_display.get_pointer (x, y);
520 pair<ProcessorEntry *, double> const pointer = processor_display.get_child_at_position (y);
523 targets.push_back (pointer.first->processor ());
528 switch (ev->keyval) {
530 if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
531 processor_display.select_all ();
537 if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
538 copy_processors (targets);
544 if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
545 cut_processors (targets);
551 if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
552 if (targets.empty()) {
555 paste_processors (targets.front());
569 delete_processors (targets);
574 for (ProcSelection::iterator i = targets.begin(); i != targets.end(); ++i) {
575 if ((*i)->active()) {
597 ProcessorBox::processor_button_press_event (GdkEventButton *ev, ProcessorEntry* child)
599 boost::shared_ptr<Processor> processor;
601 processor = child->processor ();
605 bool selected = processor_display.selected (child);
607 if (processor && (Keyboard::is_edit_event (ev) || (ev->button == 1 && ev->type == GDK_2BUTTON_PRESS))) {
609 if (_session->engine().connected()) {
610 /* XXX giving an error message here is hard, because we may be in the midst of a button press */
611 toggle_edit_processor (processor);
615 } else if (processor && ev->button == 1 && selected) {
617 // this is purely informational but necessary for route params UI
618 ProcessorSelected (processor); // emit
620 } else if (!processor && ev->button == 1 && ev->type == GDK_2BUTTON_PRESS) {
623 _get_plugin_selector()->show_manager ();
630 ProcessorBox::processor_button_release_event (GdkEventButton *ev, ProcessorEntry* child)
632 boost::shared_ptr<Processor> processor;
634 processor = child->processor ();
639 if (processor && Keyboard::is_delete_event (ev)) {
641 Glib::signal_idle().connect (sigc::bind (
642 sigc::mem_fun(*this, &ProcessorBox::idle_delete_processor),
643 boost::weak_ptr<Processor>(processor)));
646 } else if (Keyboard::is_context_menu_event (ev)) {
648 /* figure out if we are above or below the fader/amp processor,
649 and set the next insert position appropriately.
653 if (_route->processor_is_prefader (processor)) {
654 _placement = PreFader;
656 _placement = PostFader;
659 _placement = PostFader;
662 show_processor_menu (ev->time);
665 } else if (processor && Keyboard::is_button2_event (ev)
667 && (Keyboard::no_modifier_keys_pressed (ev) && ((ev->state & Gdk::BUTTON2_MASK) == Gdk::BUTTON2_MASK))
671 /* button2-click with no/appropriate modifiers */
673 if (processor->active()) {
674 processor->deactivate ();
676 processor->activate ();
686 ProcessorBox::build_processor_menu ()
688 processor_menu = dynamic_cast<Gtk::Menu*>(ActionManager::get_widget("/processormenu") );
689 processor_menu->set_name ("ArdourContextMenu");
693 return processor_menu;
697 ProcessorBox::selection_changed ()
699 bool const sensitive = (processor_display.selection().empty()) ? false : true;
700 ActionManager::set_sensitive (ActionManager::plugin_selection_sensitive_actions, sensitive);
701 edit_action->set_sensitive (one_processor_can_be_edited ());
703 /* disallow rename for multiple selections and for plugin inserts */
704 rename_action->set_sensitive (
705 processor_display.selection().size() == 1 && boost::dynamic_pointer_cast<PluginInsert> (processor_display.selection().front()->processor()) == 0
710 ProcessorBox::select_all_processors ()
712 processor_display.select_all ();
716 ProcessorBox::deselect_all_processors ()
718 processor_display.select_none ();
722 ProcessorBox::choose_plugin ()
724 _get_plugin_selector()->set_interested_object (*this);
727 /** @return true if an error occurred, otherwise false */
729 ProcessorBox::use_plugins (const SelectedPlugins& plugins)
731 for (SelectedPlugins::const_iterator p = plugins.begin(); p != plugins.end(); ++p) {
733 boost::shared_ptr<Processor> processor (new PluginInsert (*_session, *p));
735 Route::ProcessorStreams err_streams;
737 if (Config->get_new_plugins_active()) {
738 processor->activate ();
741 if (_route->add_processor (processor, _placement, &err_streams)) {
742 weird_plugin_dialog (**p, err_streams);
744 // XXX SHAREDPTR delete plugin here .. do we even need to care?
747 if (Profile->get_sae()) {
748 processor->activate ();
757 ProcessorBox::weird_plugin_dialog (Plugin& p, Route::ProcessorStreams streams)
759 ArdourDialog dialog (_("Plugin Incompatibility"));
762 string text = string_compose(_("You attempted to add the plugin \"%1\" at index %2.\n"),
763 p.name(), streams.index);
765 bool has_midi = streams.count.n_midi() > 0 || p.get_info()->n_inputs.n_midi() > 0;
766 bool has_audio = streams.count.n_audio() > 0 || p.get_info()->n_inputs.n_audio() > 0;
768 text += _("\nThis plugin has:\n");
770 text += string_compose("\t%1 ", p.get_info()->n_inputs.n_midi()) + _("MIDI input(s)\n");
773 text += string_compose("\t%1 ", p.get_info()->n_inputs.n_audio()) + _("audio input(s)\n");
776 text += _("\nBut at the insertion point, there are:\n");
778 text += string_compose("\t%1 ", streams.count.n_midi()) + _("MIDI channel(s)\n");
781 text += string_compose("\t%1 ", streams.count.n_audio()) + _("audio channel(s)\n");
784 text += string_compose (_("\n%1 is unable to insert this plugin here.\n"), PROGRAM_NAME);
785 label.set_text(text);
787 dialog.get_vbox()->pack_start (label);
788 dialog.add_button (Stock::OK, RESPONSE_ACCEPT);
790 dialog.set_name (X_("PluginIODialog"));
791 dialog.set_position (Gtk::WIN_POS_MOUSE);
792 dialog.set_modal (true);
799 ProcessorBox::choose_insert ()
801 boost::shared_ptr<Processor> processor (new PortInsert (*_session, _route->mute_master()));
802 _route->add_processor (processor, _placement);
805 /* Caller must not hold process lock */
807 ProcessorBox::choose_send ()
809 boost::shared_ptr<Send> send (new Send (*_session, _route->mute_master()));
811 /* make an educated guess at the initial number of outputs for the send */
812 ChanCount outs = (_session->master_out())
813 ? _session->master_out()->n_outputs()
814 : _route->n_outputs();
816 /* XXX need processor lock on route */
818 Glib::Mutex::Lock lm (AudioEngine::instance()->process_lock());
819 send->output()->ensure_io (outs, false, this);
820 } catch (AudioEngine::PortRegistrationFailure& err) {
821 error << string_compose (_("Cannot set up new send: %1"), err.what()) << endmsg;
825 /* let the user adjust the IO setup before creation.
827 Note: this dialog is NOT modal - we just leave it to run and it will
828 return when its Finished signal is emitted - typically when the window
832 IOSelectorWindow *ios = new IOSelectorWindow (_session, send->output(), true);
835 /* keep a reference to the send so it doesn't get deleted while
836 the IOSelectorWindow is doing its stuff
838 _processor_being_created = send;
840 ios->selector().Finished.connect (sigc::bind (
841 sigc::mem_fun(*this, &ProcessorBox::send_io_finished),
842 boost::weak_ptr<Processor>(send), ios));
847 ProcessorBox::send_io_finished (IOSelector::Result r, boost::weak_ptr<Processor> weak_processor, IOSelectorWindow* ios)
849 boost::shared_ptr<Processor> processor (weak_processor.lock());
851 /* drop our temporary reference to the new send */
852 _processor_being_created.reset ();
859 case IOSelector::Cancelled:
860 // processor will go away when all shared_ptrs to it vanish
863 case IOSelector::Accepted:
864 _route->add_processor (processor, _placement);
865 if (Profile->get_sae()) {
866 processor->activate ();
871 delete_when_idle (ios);
875 ProcessorBox::return_io_finished (IOSelector::Result r, boost::weak_ptr<Processor> weak_processor, IOSelectorWindow* ios)
877 boost::shared_ptr<Processor> processor (weak_processor.lock());
879 /* drop our temporary reference to the new return */
880 _processor_being_created.reset ();
887 case IOSelector::Cancelled:
888 // processor will go away when all shared_ptrs to it vanish
891 case IOSelector::Accepted:
892 _route->add_processor (processor, _placement);
893 if (Profile->get_sae()) {
894 processor->activate ();
899 delete_when_idle (ios);
903 ProcessorBox::choose_aux (boost::weak_ptr<Route> wr)
909 boost::shared_ptr<Route> target = wr.lock();
915 boost::shared_ptr<RouteList> rlist (new RouteList);
916 rlist->push_back (_route);
918 _session->add_internal_sends (target, PreFader, rlist);
922 ProcessorBox::route_processors_changed (RouteProcessorChange c)
924 if (c.type == RouteProcessorChange::MeterPointChange && c.meter_visibly_changed == false) {
925 /* the meter has moved, but it was and still is invisible to the user, so nothing to do */
929 redisplay_processors ();
933 ProcessorBox::redisplay_processors ()
935 ENSURE_GUI_THREAD (*this, &ProcessorBox::redisplay_processors)
937 if (no_processor_redisplay) {
941 processor_display.clear ();
943 _route->foreach_processor (sigc::mem_fun (*this, &ProcessorBox::add_processor_to_display));
945 build_processor_tooltip (processor_eventbox, _("Inserts, sends & plugins:"));
947 for (list<ProcessorWindowProxy*>::iterator i = _processor_window_proxies.begin(); i != _processor_window_proxies.end(); ++i) {
948 (*i)->marked = false;
951 _route->foreach_processor (sigc::mem_fun (*this, &ProcessorBox::maybe_add_processor_to_ui_list));
953 /* trim dead wood from the processor window proxy list */
955 list<ProcessorWindowProxy*>::iterator i = _processor_window_proxies.begin();
956 while (i != _processor_window_proxies.end()) {
957 list<ProcessorWindowProxy*>::iterator j = i;
961 ARDOUR_UI::instance()->remove_window_proxy (*i);
963 _processor_window_proxies.erase (i);
970 /** Add a ProcessorWindowProxy for a processor to our list, if that processor does
971 * not already have one.
974 ProcessorBox::maybe_add_processor_to_ui_list (boost::weak_ptr<Processor> w)
976 boost::shared_ptr<Processor> p = w.lock ();
981 list<ProcessorWindowProxy*>::iterator i = _processor_window_proxies.begin ();
982 while (i != _processor_window_proxies.end()) {
984 boost::shared_ptr<Processor> t = (*i)->processor().lock ();
987 /* this processor is already on the list; done */
995 /* not on the list; add it */
999 if (_parent_strip->mixer_owned()) {
1008 ProcessorWindowProxy* wp = new ProcessorWindowProxy (
1009 string_compose ("%1-%2-%3", loc, _route->id(), p->id()),
1010 _session->extra_xml (X_("UI")),
1015 _processor_window_proxies.push_back (wp);
1016 ARDOUR_UI::instance()->add_window_proxy (wp);
1020 ProcessorBox::add_processor_to_display (boost::weak_ptr<Processor> p)
1022 boost::shared_ptr<Processor> processor (p.lock ());
1024 if (!processor || !processor->display_to_user()) {
1028 boost::shared_ptr<Send> send = boost::dynamic_pointer_cast<Send> (processor);
1029 ProcessorEntry* e = 0;
1031 e = new SendProcessorEntry (send, _width);
1033 e = new ProcessorEntry (processor, _width);
1035 e->set_pixel_width (get_allocation().get_width());
1036 processor_display.add_child (e);
1041 ProcessorBox::build_processor_tooltip (EventBox& box, string start)
1045 list<ProcessorEntry*> children = processor_display.children ();
1046 for (list<ProcessorEntry*>::iterator i = children.begin(); i != children.end(); ++i) {
1048 tip += (*i)->processor()->name();
1051 ARDOUR_UI::instance()->set_tip (box, tip);
1055 ProcessorBox::reordered ()
1057 compute_processor_sort_keys ();
1061 ProcessorBox::compute_processor_sort_keys ()
1063 list<ProcessorEntry*> children = processor_display.children ();
1064 Route::ProcessorList our_processors;
1066 for (list<ProcessorEntry*>::iterator iter = children.begin(); iter != children.end(); ++iter) {
1067 our_processors.push_back ((*iter)->processor ());
1070 if (_route->reorder_processors (our_processors)) {
1071 /* Reorder failed, so report this to the user. As far as I can see this must be done
1072 in an idle handler: it seems that the redisplay_processors() that happens below destroys
1073 widgets that were involved in the drag-and-drop on the processor list, which causes problems
1074 when the drag is torn down after this handler function is finished.
1076 Glib::signal_idle().connect_once (sigc::mem_fun (*this, &ProcessorBox::report_failed_reorder));
1081 ProcessorBox::report_failed_reorder ()
1083 /* reorder failed, so redisplay */
1085 redisplay_processors ();
1087 /* now tell them about the problem */
1089 ArdourDialog dialog (_("Plugin Incompatibility"));
1092 label.set_text (_("\
1093 You cannot reorder these plugins/sends/inserts\n\
1094 in that way because the inputs and\n\
1095 outputs will not work correctly."));
1097 dialog.get_vbox()->set_border_width (12);
1098 dialog.get_vbox()->pack_start (label);
1099 dialog.add_button (Stock::OK, RESPONSE_ACCEPT);
1101 dialog.set_name (X_("PluginIODialog"));
1102 dialog.set_position (Gtk::WIN_POS_MOUSE);
1103 dialog.set_modal (true);
1110 ProcessorBox::rename_processors ()
1112 ProcSelection to_be_renamed;
1114 get_selected_processors (to_be_renamed);
1116 if (to_be_renamed.empty()) {
1120 for (ProcSelection::iterator i = to_be_renamed.begin(); i != to_be_renamed.end(); ++i) {
1121 rename_processor (*i);
1126 ProcessorBox::can_cut () const
1128 vector<boost::shared_ptr<Processor> > sel;
1130 get_selected_processors (sel);
1132 /* cut_processors () does not cut inserts */
1134 for (vector<boost::shared_ptr<Processor> >::const_iterator i = sel.begin (); i != sel.end (); ++i) {
1136 if (boost::dynamic_pointer_cast<PluginInsert>((*i)) != 0 ||
1137 (boost::dynamic_pointer_cast<Send>((*i)) != 0) ||
1138 (boost::dynamic_pointer_cast<Return>((*i)) != 0)) {
1147 ProcessorBox::cut_processors ()
1149 ProcSelection to_be_removed;
1151 get_selected_processors (to_be_removed);
1155 ProcessorBox::cut_processors (const ProcSelection& to_be_removed)
1157 if (to_be_removed.empty()) {
1161 XMLNode* node = new XMLNode (X_("cut"));
1162 Route::ProcessorList to_cut;
1164 no_processor_redisplay = true;
1165 for (ProcSelection::const_iterator i = to_be_removed.begin(); i != to_be_removed.end(); ++i) {
1166 // Cut only plugins, sends and returns
1167 if (boost::dynamic_pointer_cast<PluginInsert>((*i)) != 0 ||
1168 (boost::dynamic_pointer_cast<Send>((*i)) != 0) ||
1169 (boost::dynamic_pointer_cast<Return>((*i)) != 0)) {
1171 Window* w = get_processor_ui (*i);
1177 XMLNode& child ((*i)->get_state());
1178 node->add_child_nocopy (child);
1179 to_cut.push_back (*i);
1183 if (_route->remove_processors (to_cut) != 0) {
1185 no_processor_redisplay = false;
1189 _rr_selection.set (node);
1191 no_processor_redisplay = false;
1192 redisplay_processors ();
1196 ProcessorBox::copy_processors ()
1198 ProcSelection to_be_copied;
1199 get_selected_processors (to_be_copied);
1200 copy_processors (to_be_copied);
1204 ProcessorBox::copy_processors (const ProcSelection& to_be_copied)
1206 if (to_be_copied.empty()) {
1210 XMLNode* node = new XMLNode (X_("copy"));
1212 for (ProcSelection::const_iterator i = to_be_copied.begin(); i != to_be_copied.end(); ++i) {
1213 // Copy only plugins, sends, returns
1214 if (boost::dynamic_pointer_cast<PluginInsert>((*i)) != 0 ||
1215 (boost::dynamic_pointer_cast<Send>((*i)) != 0) ||
1216 (boost::dynamic_pointer_cast<Return>((*i)) != 0)) {
1217 node->add_child_nocopy ((*i)->get_state());
1221 _rr_selection.set (node);
1225 ProcessorBox::delete_processors ()
1227 ProcSelection to_be_deleted;
1228 get_selected_processors (to_be_deleted);
1229 delete_processors (to_be_deleted);
1233 ProcessorBox::delete_processors (const ProcSelection& targets)
1235 if (targets.empty()) {
1239 no_processor_redisplay = true;
1241 for (ProcSelection::const_iterator i = targets.begin(); i != targets.end(); ++i) {
1243 Window* w = get_processor_ui (*i);
1249 _route->remove_processor(*i);
1252 no_processor_redisplay = false;
1253 redisplay_processors ();
1257 ProcessorBox::delete_dragged_processors (const list<boost::shared_ptr<Processor> >& procs)
1259 list<boost::shared_ptr<Processor> >::const_iterator x;
1261 no_processor_redisplay = true;
1262 for (x = procs.begin(); x != procs.end(); ++x) {
1264 Window* w = get_processor_ui (*x);
1270 _route->remove_processor(*x);
1273 no_processor_redisplay = false;
1274 redisplay_processors ();
1278 ProcessorBox::idle_delete_processor (boost::weak_ptr<Processor> weak_processor)
1280 boost::shared_ptr<Processor> processor (weak_processor.lock());
1286 /* NOT copied to _mixer.selection() */
1288 no_processor_redisplay = true;
1289 _route->remove_processor (processor);
1290 no_processor_redisplay = false;
1291 redisplay_processors ();
1297 ProcessorBox::rename_processor (boost::shared_ptr<Processor> processor)
1299 ArdourPrompter name_prompter (true);
1301 name_prompter.set_title (_("Rename Processor"));
1302 name_prompter.set_prompt (_("New name:"));
1303 name_prompter.set_initial_text (processor->name());
1304 name_prompter.add_button (_("Rename"), Gtk::RESPONSE_ACCEPT);
1305 name_prompter.set_response_sensitive (Gtk::RESPONSE_ACCEPT, false);
1306 name_prompter.show_all ();
1308 switch (name_prompter.run ()) {
1310 case Gtk::RESPONSE_ACCEPT:
1311 name_prompter.get_result (result);
1312 if (result.length()) {
1315 string test = result;
1317 while (tries < 100) {
1318 if (_session->io_name_is_legal (test)) {
1324 test = string_compose ("%1-%2", result, tries);
1328 processor->set_name (result);
1331 ARDOUR_UI::instance()->popup_error
1332 (string_compose (_("At least 100 IO objects exist with a name like %1 - name not changed"), result));
1342 ProcessorBox::paste_processors ()
1344 if (_rr_selection.processors.empty()) {
1348 paste_processor_state (_rr_selection.processors.get_node().children(), boost::shared_ptr<Processor>());
1352 ProcessorBox::paste_processors (boost::shared_ptr<Processor> before)
1355 if (_rr_selection.processors.empty()) {
1359 paste_processor_state (_rr_selection.processors.get_node().children(), before);
1363 ProcessorBox::paste_processor_state (const XMLNodeList& nlist, boost::shared_ptr<Processor> p)
1365 XMLNodeConstIterator niter;
1366 list<boost::shared_ptr<Processor> > copies;
1368 if (nlist.empty()) {
1372 for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
1374 XMLProperty const * type = (*niter)->property ("type");
1377 boost::shared_ptr<Processor> p;
1379 if (type->value() == "meter" ||
1380 type->value() == "main-outs" ||
1381 type->value() == "amp" ||
1382 type->value() == "intsend" || type->value() == "intreturn") {
1383 /* do not paste meter, main outs, amp or internal send/returns */
1386 } else if (type->value() == "send") {
1388 XMLNode n (**niter);
1389 Send::make_unique (n, *_session);
1390 Send* s = new Send (*_session, _route->mute_master());
1391 if (s->set_state (n, Stateful::loading_state_version)) {
1399 } else if (type->value() == "return") {
1401 XMLNode n (**niter);
1402 Return::make_unique (n, *_session);
1403 Return* r = new Return (*_session);
1405 if (r->set_state (n, Stateful::loading_state_version)) {
1413 /* XXX its a bit limiting to assume that everything else
1417 p.reset (new PluginInsert (*_session));
1418 p->set_state (**niter, Stateful::current_state_version);
1421 copies.push_back (p);
1425 cerr << "plugin insert constructor failed\n";
1429 if (copies.empty()) {
1433 if (_route->add_processors (copies, p)) {
1436 "Copying the set of processors on the clipboard failed,\n\
1437 probably because the I/O configuration of the plugins\n\
1438 could not match the configuration of this track.");
1439 MessageDialog am (msg);
1445 ProcessorBox::activate_processor (boost::shared_ptr<Processor> r)
1451 ProcessorBox::deactivate_processor (boost::shared_ptr<Processor> r)
1457 ProcessorBox::get_selected_processors (ProcSelection& processors) const
1459 const list<ProcessorEntry*> selection = processor_display.selection ();
1460 for (list<ProcessorEntry*>::const_iterator i = selection.begin(); i != selection.end(); ++i) {
1461 processors.push_back ((*i)->processor ());
1466 ProcessorBox::for_selected_processors (void (ProcessorBox::*method)(boost::shared_ptr<Processor>))
1468 list<ProcessorEntry*> selection = processor_display.selection ();
1469 for (list<ProcessorEntry*>::iterator i = selection.begin(); i != selection.end(); ++i) {
1470 (this->*method) ((*i)->processor ());
1475 ProcessorBox::all_processors_active (bool state)
1477 _route->all_processors_active (_placement, state);
1481 ProcessorBox::ab_plugins ()
1483 _route->ab_plugins (ab_direction);
1484 ab_direction = !ab_direction;
1489 ProcessorBox::clear_processors ()
1492 vector<string> choices;
1494 prompt = string_compose (_("Do you really want to remove all processors from %1?\n"
1495 "(this cannot be undone)"), _route->name());
1497 choices.push_back (_("Cancel"));
1498 choices.push_back (_("Yes, remove them all"));
1500 Gtkmm2ext::Choice prompter (_("Remove processors"), prompt, choices);
1502 if (prompter.run () == 1) {
1503 _route->clear_processors (PreFader);
1504 _route->clear_processors (PostFader);
1509 ProcessorBox::clear_processors (Placement p)
1512 vector<string> choices;
1514 if (p == PreFader) {
1515 prompt = string_compose (_("Do you really want to remove all pre-fader processors from %1?\n"
1516 "(this cannot be undone)"), _route->name());
1518 prompt = string_compose (_("Do you really want to remove all post-fader processors from %1?\n"
1519 "(this cannot be undone)"), _route->name());
1522 choices.push_back (_("Cancel"));
1523 choices.push_back (_("Yes, remove them all"));
1525 Gtkmm2ext::Choice prompter (_("Remove processors"), prompt, choices);
1527 if (prompter.run () == 1) {
1528 _route->clear_processors (p);
1533 ProcessorBox::processor_can_be_edited (boost::shared_ptr<Processor> processor)
1535 boost::shared_ptr<AudioTrack> at = boost::dynamic_pointer_cast<AudioTrack> (_route);
1536 if (at && at->freeze_state() == AudioTrack::Frozen) {
1541 boost::dynamic_pointer_cast<Send> (processor) ||
1542 boost::dynamic_pointer_cast<Return> (processor) ||
1543 boost::dynamic_pointer_cast<PluginInsert> (processor) ||
1544 boost::dynamic_pointer_cast<PortInsert> (processor)
1553 ProcessorBox::one_processor_can_be_edited ()
1555 list<ProcessorEntry*> selection = processor_display.selection ();
1556 list<ProcessorEntry*>::iterator i = selection.begin();
1557 while (i != selection.end() && processor_can_be_edited ((*i)->processor()) == false) {
1561 return (i != selection.end());
1565 ProcessorBox::toggle_edit_processor (boost::shared_ptr<Processor> processor)
1567 boost::shared_ptr<Send> send;
1568 boost::shared_ptr<Return> retrn;
1569 boost::shared_ptr<PluginInsert> plugin_insert;
1570 boost::shared_ptr<PortInsert> port_insert;
1573 if (boost::dynamic_pointer_cast<AudioTrack>(_route) != 0) {
1575 if (boost::dynamic_pointer_cast<AudioTrack> (_route)->freeze_state() == AudioTrack::Frozen) {
1580 if ((send = boost::dynamic_pointer_cast<Send> (processor)) != 0) {
1582 if (!_session->engine().connected()) {
1586 if (_parent_strip) {
1587 _parent_strip->show_send (send);
1590 } else if ((retrn = boost::dynamic_pointer_cast<Return> (processor)) != 0) {
1592 if (boost::dynamic_pointer_cast<InternalReturn> (retrn)) {
1593 /* no GUI for these */
1597 if (!_session->engine().connected()) {
1601 boost::shared_ptr<Return> retrn = boost::dynamic_pointer_cast<Return> (processor);
1603 ReturnUIWindow *return_ui;
1604 Window* w = get_processor_ui (retrn);
1608 return_ui = new ReturnUIWindow (retrn, _session);
1609 return_ui->set_title (retrn->name ());
1610 set_processor_ui (send, return_ui);
1613 return_ui = dynamic_cast<ReturnUIWindow *> (w);
1618 } else if ((plugin_insert = boost::dynamic_pointer_cast<PluginInsert> (processor)) != 0) {
1620 PluginUIWindow *plugin_ui;
1622 /* these are both allowed to be null */
1624 Container* toplevel = get_toplevel();
1625 Window* win = dynamic_cast<Gtk::Window*>(toplevel);
1627 Window* w = get_processor_ui (plugin_insert);
1631 plugin_ui = new PluginUIWindow (win, plugin_insert);
1632 plugin_ui->set_title (generate_processor_title (plugin_insert));
1633 set_processor_ui (plugin_insert, plugin_ui);
1636 plugin_ui = dynamic_cast<PluginUIWindow *> (w);
1637 plugin_ui->set_parent (win);
1642 } else if ((port_insert = boost::dynamic_pointer_cast<PortInsert> (processor)) != 0) {
1644 if (!_session->engine().connected()) {
1645 MessageDialog msg ( _("Not connected to JACK - no I/O changes are possible"));
1650 PortInsertWindow *io_selector;
1652 Window* w = get_processor_ui (port_insert);
1655 io_selector = new PortInsertWindow (_session, port_insert);
1656 set_processor_ui (port_insert, io_selector);
1659 io_selector = dynamic_cast<PortInsertWindow *> (w);
1662 gidget = io_selector;
1666 if (gidget->is_visible()) {
1669 gidget->show_all ();
1676 ProcessorBox::register_actions ()
1678 Glib::RefPtr<Gtk::ActionGroup> popup_act_grp = Gtk::ActionGroup::create(X_("processormenu"));
1679 Glib::RefPtr<Action> act;
1682 ActionManager::register_action (popup_act_grp, X_("newplugin"), _("New Plugin"),
1683 sigc::ptr_fun (ProcessorBox::rb_choose_plugin));
1685 act = ActionManager::register_action (popup_act_grp, X_("newinsert"), _("New Insert"),
1686 sigc::ptr_fun (ProcessorBox::rb_choose_insert));
1687 ActionManager::jack_sensitive_actions.push_back (act);
1688 act = ActionManager::register_action (popup_act_grp, X_("newsend"), _("New Send ..."),
1689 sigc::ptr_fun (ProcessorBox::rb_choose_send));
1690 ActionManager::jack_sensitive_actions.push_back (act);
1692 ActionManager::register_action (popup_act_grp, X_("newaux"), _("New Aux Send ..."));
1694 ActionManager::register_action (popup_act_grp, X_("clear"), _("Clear (all)"),
1695 sigc::ptr_fun (ProcessorBox::rb_clear));
1696 ActionManager::register_action (popup_act_grp, X_("clear_pre"), _("Clear (pre-fader)"),
1697 sigc::ptr_fun (ProcessorBox::rb_clear_pre));
1698 ActionManager::register_action (popup_act_grp, X_("clear_post"), _("Clear (post-fader)"),
1699 sigc::ptr_fun (ProcessorBox::rb_clear_post));
1701 /* standard editing stuff */
1702 cut_action = ActionManager::register_action (popup_act_grp, X_("cut"), _("Cut"),
1703 sigc::ptr_fun (ProcessorBox::rb_cut));
1704 ActionManager::plugin_selection_sensitive_actions.push_back(cut_action);
1705 act = ActionManager::register_action (popup_act_grp, X_("copy"), _("Copy"),
1706 sigc::ptr_fun (ProcessorBox::rb_copy));
1707 ActionManager::plugin_selection_sensitive_actions.push_back(act);
1709 act = ActionManager::register_action (popup_act_grp, X_("delete"), _("Delete"),
1710 sigc::ptr_fun (ProcessorBox::rb_delete));
1711 ActionManager::plugin_selection_sensitive_actions.push_back(act); // ??
1713 paste_action = ActionManager::register_action (popup_act_grp, X_("paste"), _("Paste"),
1714 sigc::ptr_fun (ProcessorBox::rb_paste));
1715 rename_action = ActionManager::register_action (popup_act_grp, X_("rename"), _("Rename"),
1716 sigc::ptr_fun (ProcessorBox::rb_rename));
1717 ActionManager::register_action (popup_act_grp, X_("selectall"), _("Select All"),
1718 sigc::ptr_fun (ProcessorBox::rb_select_all));
1719 ActionManager::register_action (popup_act_grp, X_("deselectall"), _("Deselect All"),
1720 sigc::ptr_fun (ProcessorBox::rb_deselect_all));
1722 /* activation etc. */
1724 ActionManager::register_action (popup_act_grp, X_("activate_all"), _("Activate all"),
1725 sigc::ptr_fun (ProcessorBox::rb_activate_all));
1726 ActionManager::register_action (popup_act_grp, X_("deactivate_all"), _("Deactivate all"),
1727 sigc::ptr_fun (ProcessorBox::rb_deactivate_all));
1728 ActionManager::register_action (popup_act_grp, X_("ab_plugins"), _("A/B Plugins"),
1729 sigc::ptr_fun (ProcessorBox::rb_ab_plugins));
1732 edit_action = ActionManager::register_action (popup_act_grp, X_("edit"), _("Edit..."),
1733 sigc::ptr_fun (ProcessorBox::rb_edit));
1735 ActionManager::add_action_group (popup_act_grp);
1739 ProcessorBox::rb_ab_plugins ()
1741 if (_current_processor_box == 0) {
1745 _current_processor_box->ab_plugins ();
1749 ProcessorBox::rb_choose_plugin ()
1751 if (_current_processor_box == 0) {
1754 _current_processor_box->choose_plugin ();
1758 ProcessorBox::rb_choose_insert ()
1760 if (_current_processor_box == 0) {
1763 _current_processor_box->choose_insert ();
1767 ProcessorBox::rb_choose_send ()
1769 if (_current_processor_box == 0) {
1772 _current_processor_box->choose_send ();
1776 ProcessorBox::rb_choose_aux (boost::weak_ptr<Route> wr)
1778 if (_current_processor_box == 0) {
1782 _current_processor_box->choose_aux (wr);
1786 ProcessorBox::rb_clear ()
1788 if (_current_processor_box == 0) {
1792 _current_processor_box->clear_processors ();
1797 ProcessorBox::rb_clear_pre ()
1799 if (_current_processor_box == 0) {
1803 _current_processor_box->clear_processors (PreFader);
1808 ProcessorBox::rb_clear_post ()
1810 if (_current_processor_box == 0) {
1814 _current_processor_box->clear_processors (PostFader);
1818 ProcessorBox::rb_cut ()
1820 if (_current_processor_box == 0) {
1824 _current_processor_box->cut_processors ();
1828 ProcessorBox::rb_delete ()
1830 if (_current_processor_box == 0) {
1834 _current_processor_box->delete_processors ();
1838 ProcessorBox::rb_copy ()
1840 if (_current_processor_box == 0) {
1843 _current_processor_box->copy_processors ();
1847 ProcessorBox::rb_paste ()
1849 if (_current_processor_box == 0) {
1853 _current_processor_box->paste_processors ();
1857 ProcessorBox::rb_rename ()
1859 if (_current_processor_box == 0) {
1862 _current_processor_box->rename_processors ();
1866 ProcessorBox::rb_select_all ()
1868 if (_current_processor_box == 0) {
1872 _current_processor_box->select_all_processors ();
1876 ProcessorBox::rb_deselect_all ()
1878 if (_current_processor_box == 0) {
1882 _current_processor_box->deselect_all_processors ();
1886 ProcessorBox::rb_activate_all ()
1888 if (_current_processor_box == 0) {
1892 _current_processor_box->all_processors_active (true);
1896 ProcessorBox::rb_deactivate_all ()
1898 if (_current_processor_box == 0) {
1901 _current_processor_box->all_processors_active (false);
1905 ProcessorBox::rb_edit ()
1907 if (_current_processor_box == 0) {
1911 _current_processor_box->for_selected_processors (&ProcessorBox::toggle_edit_processor);
1915 ProcessorBox::route_property_changed (const PropertyChange& what_changed)
1917 if (!what_changed.contains (ARDOUR::Properties::name)) {
1921 ENSURE_GUI_THREAD (*this, &ProcessorBox::route_property_changed, what_changed);
1923 boost::shared_ptr<Processor> processor;
1924 boost::shared_ptr<PluginInsert> plugin_insert;
1925 boost::shared_ptr<Send> send;
1927 list<ProcessorEntry*> children = processor_display.children();
1929 for (list<ProcessorEntry*>::iterator iter = children.begin(); iter != children.end(); ++iter) {
1931 processor = (*iter)->processor ();
1933 Window* w = get_processor_ui (processor);
1939 /* rename editor windows for sends and plugins */
1941 if ((send = boost::dynamic_pointer_cast<Send> (processor)) != 0) {
1942 w->set_title (send->name ());
1943 } else if ((plugin_insert = boost::dynamic_pointer_cast<PluginInsert> (processor)) != 0) {
1944 w->set_title (generate_processor_title (plugin_insert));
1950 ProcessorBox::generate_processor_title (boost::shared_ptr<PluginInsert> pi)
1952 string maker = pi->plugin()->maker() ? pi->plugin()->maker() : "";
1953 string::size_type email_pos;
1955 if ((email_pos = maker.find_first_of ('<')) != string::npos) {
1956 maker = maker.substr (0, email_pos - 1);
1959 if (maker.length() > 32) {
1960 maker = maker.substr (0, 32);
1964 return string_compose(_("%1: %2 (by %3)"), _route->name(), pi->name(), maker);
1968 ProcessorBox::on_size_allocate (Allocation& a)
1970 HBox::on_size_allocate (a);
1972 list<ProcessorEntry*> children = processor_display.children ();
1973 for (list<ProcessorEntry*>::const_iterator i = children.begin(); i != children.end(); ++i) {
1974 (*i)->set_pixel_width (a.get_width ());
1978 /** @param p Processor.
1979 * @return the UI window for \a p.
1982 ProcessorBox::get_processor_ui (boost::shared_ptr<Processor> p) const
1984 list<ProcessorWindowProxy*>::const_iterator i = _processor_window_proxies.begin ();
1985 while (i != _processor_window_proxies.end()) {
1986 boost::shared_ptr<Processor> t = (*i)->processor().lock ();
1988 return (*i)->get ();
1994 /* we shouldn't get here, because the ProcessorUIList should always contain
1995 an entry for each processor.
2001 /** Make a note of the UI window that a processor is using.
2002 * @param p Processor.
2003 * @param w UI window.
2006 ProcessorBox::set_processor_ui (boost::shared_ptr<Processor> p, Gtk::Window* w)
2008 list<ProcessorWindowProxy*>::iterator i = _processor_window_proxies.begin ();
2009 while (i != _processor_window_proxies.end()) {
2010 boost::shared_ptr<Processor> t = (*i)->processor().lock ();
2019 /* we shouldn't get here, because the ProcessorUIList should always contain
2020 an entry for each processor.
2025 ProcessorWindowProxy::ProcessorWindowProxy (
2026 string const & name,
2027 XMLNode const * node,
2029 boost::weak_ptr<Processor> processor
2031 : WindowProxy<Gtk::Window> (name, node)
2033 , _processor_box (box)
2034 , _processor (processor)
2041 ProcessorWindowProxy::show ()
2043 boost::shared_ptr<Processor> p = _processor.lock ();
2048 _processor_box->toggle_edit_processor (p);