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 uint32_t const n = p.get_info()->n_inputs.n_midi ();
771 text += string_compose (ngettext ("\t%1 MIDI input", "\t%1 MIDI inputs", n), n);
774 uint32_t const n = p.get_info()->n_inputs.n_audio ();
775 text += string_compose (ngettext ("\t%1 audio input", "\t%1 audio inputs", n), n);
778 text += _("\nBut at the insertion point, there are:\n");
780 uint32_t const n = streams.count.n_midi ();
781 text += string_compose (ngettext ("\t%1 MIDI channel\n", "\t%1 MIDI channels\n", n), n);
784 uint32_t const n = streams.count.n_audio ();
785 text += string_compose (ngettext ("\t%1 audio channel\n", "\t%1 audio channels\n", n), n);
788 text += string_compose (_("\n%1 is unable to insert this plugin here.\n"), PROGRAM_NAME);
789 label.set_text(text);
791 dialog.get_vbox()->pack_start (label);
792 dialog.add_button (Stock::OK, RESPONSE_ACCEPT);
794 dialog.set_name (X_("PluginIODialog"));
795 dialog.set_position (Gtk::WIN_POS_MOUSE);
796 dialog.set_modal (true);
803 ProcessorBox::choose_insert ()
805 boost::shared_ptr<Processor> processor (new PortInsert (*_session, _route->mute_master()));
806 _route->add_processor (processor, _placement);
809 /* Caller must not hold process lock */
811 ProcessorBox::choose_send ()
813 boost::shared_ptr<Send> send (new Send (*_session, _route->mute_master()));
815 /* make an educated guess at the initial number of outputs for the send */
816 ChanCount outs = (_session->master_out())
817 ? _session->master_out()->n_outputs()
818 : _route->n_outputs();
820 /* XXX need processor lock on route */
822 Glib::Mutex::Lock lm (AudioEngine::instance()->process_lock());
823 send->output()->ensure_io (outs, false, this);
824 } catch (AudioEngine::PortRegistrationFailure& err) {
825 error << string_compose (_("Cannot set up new send: %1"), err.what()) << endmsg;
829 /* let the user adjust the IO setup before creation.
831 Note: this dialog is NOT modal - we just leave it to run and it will
832 return when its Finished signal is emitted - typically when the window
836 IOSelectorWindow *ios = new IOSelectorWindow (_session, send->output(), true);
839 /* keep a reference to the send so it doesn't get deleted while
840 the IOSelectorWindow is doing its stuff
842 _processor_being_created = send;
844 ios->selector().Finished.connect (sigc::bind (
845 sigc::mem_fun(*this, &ProcessorBox::send_io_finished),
846 boost::weak_ptr<Processor>(send), ios));
851 ProcessorBox::send_io_finished (IOSelector::Result r, boost::weak_ptr<Processor> weak_processor, IOSelectorWindow* ios)
853 boost::shared_ptr<Processor> processor (weak_processor.lock());
855 /* drop our temporary reference to the new send */
856 _processor_being_created.reset ();
863 case IOSelector::Cancelled:
864 // processor will go away when all shared_ptrs to it vanish
867 case IOSelector::Accepted:
868 _route->add_processor (processor, _placement);
869 if (Profile->get_sae()) {
870 processor->activate ();
875 delete_when_idle (ios);
879 ProcessorBox::return_io_finished (IOSelector::Result r, boost::weak_ptr<Processor> weak_processor, IOSelectorWindow* ios)
881 boost::shared_ptr<Processor> processor (weak_processor.lock());
883 /* drop our temporary reference to the new return */
884 _processor_being_created.reset ();
891 case IOSelector::Cancelled:
892 // processor will go away when all shared_ptrs to it vanish
895 case IOSelector::Accepted:
896 _route->add_processor (processor, _placement);
897 if (Profile->get_sae()) {
898 processor->activate ();
903 delete_when_idle (ios);
907 ProcessorBox::choose_aux (boost::weak_ptr<Route> wr)
913 boost::shared_ptr<Route> target = wr.lock();
919 boost::shared_ptr<RouteList> rlist (new RouteList);
920 rlist->push_back (_route);
922 _session->add_internal_sends (target, PreFader, rlist);
926 ProcessorBox::route_processors_changed (RouteProcessorChange c)
928 if (c.type == RouteProcessorChange::MeterPointChange && c.meter_visibly_changed == false) {
929 /* the meter has moved, but it was and still is invisible to the user, so nothing to do */
933 redisplay_processors ();
937 ProcessorBox::redisplay_processors ()
939 ENSURE_GUI_THREAD (*this, &ProcessorBox::redisplay_processors)
941 if (no_processor_redisplay) {
945 processor_display.clear ();
947 _route->foreach_processor (sigc::mem_fun (*this, &ProcessorBox::add_processor_to_display));
949 build_processor_tooltip (processor_eventbox, _("Inserts, sends & plugins:"));
951 for (list<ProcessorWindowProxy*>::iterator i = _processor_window_proxies.begin(); i != _processor_window_proxies.end(); ++i) {
952 (*i)->marked = false;
955 _route->foreach_processor (sigc::mem_fun (*this, &ProcessorBox::maybe_add_processor_to_ui_list));
957 /* trim dead wood from the processor window proxy list */
959 list<ProcessorWindowProxy*>::iterator i = _processor_window_proxies.begin();
960 while (i != _processor_window_proxies.end()) {
961 list<ProcessorWindowProxy*>::iterator j = i;
965 ARDOUR_UI::instance()->remove_window_proxy (*i);
967 _processor_window_proxies.erase (i);
974 /** Add a ProcessorWindowProxy for a processor to our list, if that processor does
975 * not already have one.
978 ProcessorBox::maybe_add_processor_to_ui_list (boost::weak_ptr<Processor> w)
980 boost::shared_ptr<Processor> p = w.lock ();
985 list<ProcessorWindowProxy*>::iterator i = _processor_window_proxies.begin ();
986 while (i != _processor_window_proxies.end()) {
988 boost::shared_ptr<Processor> t = (*i)->processor().lock ();
991 /* this processor is already on the list; done */
999 /* not on the list; add it */
1002 if (_parent_strip) {
1003 if (_parent_strip->mixer_owned()) {
1012 ProcessorWindowProxy* wp = new ProcessorWindowProxy (
1013 string_compose ("%1-%2-%3", loc, _route->id(), p->id()),
1014 _session->extra_xml (X_("UI")),
1019 _processor_window_proxies.push_back (wp);
1020 ARDOUR_UI::instance()->add_window_proxy (wp);
1024 ProcessorBox::add_processor_to_display (boost::weak_ptr<Processor> p)
1026 boost::shared_ptr<Processor> processor (p.lock ());
1028 if (!processor || !processor->display_to_user()) {
1032 boost::shared_ptr<Send> send = boost::dynamic_pointer_cast<Send> (processor);
1033 ProcessorEntry* e = 0;
1035 e = new SendProcessorEntry (send, _width);
1037 e = new ProcessorEntry (processor, _width);
1039 e->set_pixel_width (get_allocation().get_width());
1040 processor_display.add_child (e);
1045 ProcessorBox::build_processor_tooltip (EventBox& box, string start)
1049 list<ProcessorEntry*> children = processor_display.children ();
1050 for (list<ProcessorEntry*>::iterator i = children.begin(); i != children.end(); ++i) {
1052 tip += (*i)->processor()->name();
1055 ARDOUR_UI::instance()->set_tip (box, tip);
1059 ProcessorBox::reordered ()
1061 compute_processor_sort_keys ();
1065 ProcessorBox::compute_processor_sort_keys ()
1067 list<ProcessorEntry*> children = processor_display.children ();
1068 Route::ProcessorList our_processors;
1070 for (list<ProcessorEntry*>::iterator iter = children.begin(); iter != children.end(); ++iter) {
1071 our_processors.push_back ((*iter)->processor ());
1074 if (_route->reorder_processors (our_processors)) {
1075 /* Reorder failed, so report this to the user. As far as I can see this must be done
1076 in an idle handler: it seems that the redisplay_processors() that happens below destroys
1077 widgets that were involved in the drag-and-drop on the processor list, which causes problems
1078 when the drag is torn down after this handler function is finished.
1080 Glib::signal_idle().connect_once (sigc::mem_fun (*this, &ProcessorBox::report_failed_reorder));
1085 ProcessorBox::report_failed_reorder ()
1087 /* reorder failed, so redisplay */
1089 redisplay_processors ();
1091 /* now tell them about the problem */
1093 ArdourDialog dialog (_("Plugin Incompatibility"));
1096 label.set_text (_("\
1097 You cannot reorder these plugins/sends/inserts\n\
1098 in that way because the inputs and\n\
1099 outputs will not work correctly."));
1101 dialog.get_vbox()->set_border_width (12);
1102 dialog.get_vbox()->pack_start (label);
1103 dialog.add_button (Stock::OK, RESPONSE_ACCEPT);
1105 dialog.set_name (X_("PluginIODialog"));
1106 dialog.set_position (Gtk::WIN_POS_MOUSE);
1107 dialog.set_modal (true);
1114 ProcessorBox::rename_processors ()
1116 ProcSelection to_be_renamed;
1118 get_selected_processors (to_be_renamed);
1120 if (to_be_renamed.empty()) {
1124 for (ProcSelection::iterator i = to_be_renamed.begin(); i != to_be_renamed.end(); ++i) {
1125 rename_processor (*i);
1130 ProcessorBox::can_cut () const
1132 vector<boost::shared_ptr<Processor> > sel;
1134 get_selected_processors (sel);
1136 /* cut_processors () does not cut inserts */
1138 for (vector<boost::shared_ptr<Processor> >::const_iterator i = sel.begin (); i != sel.end (); ++i) {
1140 if (boost::dynamic_pointer_cast<PluginInsert>((*i)) != 0 ||
1141 (boost::dynamic_pointer_cast<Send>((*i)) != 0) ||
1142 (boost::dynamic_pointer_cast<Return>((*i)) != 0)) {
1151 ProcessorBox::cut_processors ()
1153 ProcSelection to_be_removed;
1155 get_selected_processors (to_be_removed);
1159 ProcessorBox::cut_processors (const ProcSelection& to_be_removed)
1161 if (to_be_removed.empty()) {
1165 XMLNode* node = new XMLNode (X_("cut"));
1166 Route::ProcessorList to_cut;
1168 no_processor_redisplay = true;
1169 for (ProcSelection::const_iterator i = to_be_removed.begin(); i != to_be_removed.end(); ++i) {
1170 // Cut only plugins, sends and returns
1171 if (boost::dynamic_pointer_cast<PluginInsert>((*i)) != 0 ||
1172 (boost::dynamic_pointer_cast<Send>((*i)) != 0) ||
1173 (boost::dynamic_pointer_cast<Return>((*i)) != 0)) {
1175 Window* w = get_processor_ui (*i);
1181 XMLNode& child ((*i)->get_state());
1182 node->add_child_nocopy (child);
1183 to_cut.push_back (*i);
1187 if (_route->remove_processors (to_cut) != 0) {
1189 no_processor_redisplay = false;
1193 _rr_selection.set (node);
1195 no_processor_redisplay = false;
1196 redisplay_processors ();
1200 ProcessorBox::copy_processors ()
1202 ProcSelection to_be_copied;
1203 get_selected_processors (to_be_copied);
1204 copy_processors (to_be_copied);
1208 ProcessorBox::copy_processors (const ProcSelection& to_be_copied)
1210 if (to_be_copied.empty()) {
1214 XMLNode* node = new XMLNode (X_("copy"));
1216 for (ProcSelection::const_iterator i = to_be_copied.begin(); i != to_be_copied.end(); ++i) {
1217 // Copy only plugins, sends, returns
1218 if (boost::dynamic_pointer_cast<PluginInsert>((*i)) != 0 ||
1219 (boost::dynamic_pointer_cast<Send>((*i)) != 0) ||
1220 (boost::dynamic_pointer_cast<Return>((*i)) != 0)) {
1221 node->add_child_nocopy ((*i)->get_state());
1225 _rr_selection.set (node);
1229 ProcessorBox::delete_processors ()
1231 ProcSelection to_be_deleted;
1232 get_selected_processors (to_be_deleted);
1233 delete_processors (to_be_deleted);
1237 ProcessorBox::delete_processors (const ProcSelection& targets)
1239 if (targets.empty()) {
1243 no_processor_redisplay = true;
1245 for (ProcSelection::const_iterator i = targets.begin(); i != targets.end(); ++i) {
1247 Window* w = get_processor_ui (*i);
1253 _route->remove_processor(*i);
1256 no_processor_redisplay = false;
1257 redisplay_processors ();
1261 ProcessorBox::delete_dragged_processors (const list<boost::shared_ptr<Processor> >& procs)
1263 list<boost::shared_ptr<Processor> >::const_iterator x;
1265 no_processor_redisplay = true;
1266 for (x = procs.begin(); x != procs.end(); ++x) {
1268 Window* w = get_processor_ui (*x);
1274 _route->remove_processor(*x);
1277 no_processor_redisplay = false;
1278 redisplay_processors ();
1282 ProcessorBox::idle_delete_processor (boost::weak_ptr<Processor> weak_processor)
1284 boost::shared_ptr<Processor> processor (weak_processor.lock());
1290 /* NOT copied to _mixer.selection() */
1292 no_processor_redisplay = true;
1293 _route->remove_processor (processor);
1294 no_processor_redisplay = false;
1295 redisplay_processors ();
1301 ProcessorBox::rename_processor (boost::shared_ptr<Processor> processor)
1303 ArdourPrompter name_prompter (true);
1305 name_prompter.set_title (_("Rename Processor"));
1306 name_prompter.set_prompt (_("New name:"));
1307 name_prompter.set_initial_text (processor->name());
1308 name_prompter.add_button (_("Rename"), Gtk::RESPONSE_ACCEPT);
1309 name_prompter.set_response_sensitive (Gtk::RESPONSE_ACCEPT, false);
1310 name_prompter.show_all ();
1312 switch (name_prompter.run ()) {
1314 case Gtk::RESPONSE_ACCEPT:
1315 name_prompter.get_result (result);
1316 if (result.length()) {
1319 string test = result;
1321 while (tries < 100) {
1322 if (_session->io_name_is_legal (test)) {
1328 test = string_compose ("%1-%2", result, tries);
1332 processor->set_name (result);
1335 ARDOUR_UI::instance()->popup_error
1336 (string_compose (_("At least 100 IO objects exist with a name like %1 - name not changed"), result));
1346 ProcessorBox::paste_processors ()
1348 if (_rr_selection.processors.empty()) {
1352 paste_processor_state (_rr_selection.processors.get_node().children(), boost::shared_ptr<Processor>());
1356 ProcessorBox::paste_processors (boost::shared_ptr<Processor> before)
1359 if (_rr_selection.processors.empty()) {
1363 paste_processor_state (_rr_selection.processors.get_node().children(), before);
1367 ProcessorBox::paste_processor_state (const XMLNodeList& nlist, boost::shared_ptr<Processor> p)
1369 XMLNodeConstIterator niter;
1370 list<boost::shared_ptr<Processor> > copies;
1372 if (nlist.empty()) {
1376 for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
1378 XMLProperty const * type = (*niter)->property ("type");
1381 boost::shared_ptr<Processor> p;
1383 if (type->value() == "meter" ||
1384 type->value() == "main-outs" ||
1385 type->value() == "amp" ||
1386 type->value() == "intsend" || type->value() == "intreturn") {
1387 /* do not paste meter, main outs, amp or internal send/returns */
1390 } else if (type->value() == "send") {
1392 XMLNode n (**niter);
1393 Send::make_unique (n, *_session);
1394 Send* s = new Send (*_session, _route->mute_master());
1395 if (s->set_state (n, Stateful::loading_state_version)) {
1403 } else if (type->value() == "return") {
1405 XMLNode n (**niter);
1406 Return::make_unique (n, *_session);
1407 Return* r = new Return (*_session);
1409 if (r->set_state (n, Stateful::loading_state_version)) {
1417 /* XXX its a bit limiting to assume that everything else
1421 p.reset (new PluginInsert (*_session));
1422 p->set_state (**niter, Stateful::current_state_version);
1425 copies.push_back (p);
1429 cerr << "plugin insert constructor failed\n";
1433 if (copies.empty()) {
1437 if (_route->add_processors (copies, p)) {
1440 "Copying the set of processors on the clipboard failed,\n\
1441 probably because the I/O configuration of the plugins\n\
1442 could not match the configuration of this track.");
1443 MessageDialog am (msg);
1449 ProcessorBox::activate_processor (boost::shared_ptr<Processor> r)
1455 ProcessorBox::deactivate_processor (boost::shared_ptr<Processor> r)
1461 ProcessorBox::get_selected_processors (ProcSelection& processors) const
1463 const list<ProcessorEntry*> selection = processor_display.selection ();
1464 for (list<ProcessorEntry*>::const_iterator i = selection.begin(); i != selection.end(); ++i) {
1465 processors.push_back ((*i)->processor ());
1470 ProcessorBox::for_selected_processors (void (ProcessorBox::*method)(boost::shared_ptr<Processor>))
1472 list<ProcessorEntry*> selection = processor_display.selection ();
1473 for (list<ProcessorEntry*>::iterator i = selection.begin(); i != selection.end(); ++i) {
1474 (this->*method) ((*i)->processor ());
1479 ProcessorBox::all_processors_active (bool state)
1481 _route->all_processors_active (_placement, state);
1485 ProcessorBox::ab_plugins ()
1487 _route->ab_plugins (ab_direction);
1488 ab_direction = !ab_direction;
1493 ProcessorBox::clear_processors ()
1496 vector<string> choices;
1498 prompt = string_compose (_("Do you really want to remove all processors from %1?\n"
1499 "(this cannot be undone)"), _route->name());
1501 choices.push_back (_("Cancel"));
1502 choices.push_back (_("Yes, remove them all"));
1504 Gtkmm2ext::Choice prompter (_("Remove processors"), prompt, choices);
1506 if (prompter.run () == 1) {
1507 _route->clear_processors (PreFader);
1508 _route->clear_processors (PostFader);
1513 ProcessorBox::clear_processors (Placement p)
1516 vector<string> choices;
1518 if (p == PreFader) {
1519 prompt = string_compose (_("Do you really want to remove all pre-fader processors from %1?\n"
1520 "(this cannot be undone)"), _route->name());
1522 prompt = string_compose (_("Do you really want to remove all post-fader processors from %1?\n"
1523 "(this cannot be undone)"), _route->name());
1526 choices.push_back (_("Cancel"));
1527 choices.push_back (_("Yes, remove them all"));
1529 Gtkmm2ext::Choice prompter (_("Remove processors"), prompt, choices);
1531 if (prompter.run () == 1) {
1532 _route->clear_processors (p);
1537 ProcessorBox::processor_can_be_edited (boost::shared_ptr<Processor> processor)
1539 boost::shared_ptr<AudioTrack> at = boost::dynamic_pointer_cast<AudioTrack> (_route);
1540 if (at && at->freeze_state() == AudioTrack::Frozen) {
1545 boost::dynamic_pointer_cast<Send> (processor) ||
1546 boost::dynamic_pointer_cast<Return> (processor) ||
1547 boost::dynamic_pointer_cast<PluginInsert> (processor) ||
1548 boost::dynamic_pointer_cast<PortInsert> (processor)
1557 ProcessorBox::one_processor_can_be_edited ()
1559 list<ProcessorEntry*> selection = processor_display.selection ();
1560 list<ProcessorEntry*>::iterator i = selection.begin();
1561 while (i != selection.end() && processor_can_be_edited ((*i)->processor()) == false) {
1565 return (i != selection.end());
1569 ProcessorBox::toggle_edit_processor (boost::shared_ptr<Processor> processor)
1571 boost::shared_ptr<Send> send;
1572 boost::shared_ptr<Return> retrn;
1573 boost::shared_ptr<PluginInsert> plugin_insert;
1574 boost::shared_ptr<PortInsert> port_insert;
1577 if (boost::dynamic_pointer_cast<AudioTrack>(_route) != 0) {
1579 if (boost::dynamic_pointer_cast<AudioTrack> (_route)->freeze_state() == AudioTrack::Frozen) {
1584 if ((send = boost::dynamic_pointer_cast<Send> (processor)) != 0) {
1586 if (!_session->engine().connected()) {
1590 if (_parent_strip) {
1591 _parent_strip->show_send (send);
1594 } else if ((retrn = boost::dynamic_pointer_cast<Return> (processor)) != 0) {
1596 if (boost::dynamic_pointer_cast<InternalReturn> (retrn)) {
1597 /* no GUI for these */
1601 if (!_session->engine().connected()) {
1605 boost::shared_ptr<Return> retrn = boost::dynamic_pointer_cast<Return> (processor);
1607 ReturnUIWindow *return_ui;
1608 Window* w = get_processor_ui (retrn);
1612 return_ui = new ReturnUIWindow (retrn, _session);
1613 return_ui->set_title (retrn->name ());
1614 set_processor_ui (send, return_ui);
1617 return_ui = dynamic_cast<ReturnUIWindow *> (w);
1622 } else if ((plugin_insert = boost::dynamic_pointer_cast<PluginInsert> (processor)) != 0) {
1624 PluginUIWindow *plugin_ui;
1626 /* these are both allowed to be null */
1628 Container* toplevel = get_toplevel();
1629 Window* win = dynamic_cast<Gtk::Window*>(toplevel);
1631 Window* w = get_processor_ui (plugin_insert);
1635 plugin_ui = new PluginUIWindow (win, plugin_insert);
1636 plugin_ui->set_title (generate_processor_title (plugin_insert));
1637 set_processor_ui (plugin_insert, plugin_ui);
1640 plugin_ui = dynamic_cast<PluginUIWindow *> (w);
1641 plugin_ui->set_parent (win);
1646 } else if ((port_insert = boost::dynamic_pointer_cast<PortInsert> (processor)) != 0) {
1648 if (!_session->engine().connected()) {
1649 MessageDialog msg ( _("Not connected to JACK - no I/O changes are possible"));
1654 PortInsertWindow *io_selector;
1656 Window* w = get_processor_ui (port_insert);
1659 io_selector = new PortInsertWindow (_session, port_insert);
1660 set_processor_ui (port_insert, io_selector);
1663 io_selector = dynamic_cast<PortInsertWindow *> (w);
1666 gidget = io_selector;
1670 if (gidget->is_visible()) {
1673 gidget->show_all ();
1680 ProcessorBox::register_actions ()
1682 Glib::RefPtr<Gtk::ActionGroup> popup_act_grp = Gtk::ActionGroup::create(X_("processormenu"));
1683 Glib::RefPtr<Action> act;
1686 ActionManager::register_action (popup_act_grp, X_("newplugin"), _("New Plugin"),
1687 sigc::ptr_fun (ProcessorBox::rb_choose_plugin));
1689 act = ActionManager::register_action (popup_act_grp, X_("newinsert"), _("New Insert"),
1690 sigc::ptr_fun (ProcessorBox::rb_choose_insert));
1691 ActionManager::jack_sensitive_actions.push_back (act);
1692 act = ActionManager::register_action (popup_act_grp, X_("newsend"), _("New Send ..."),
1693 sigc::ptr_fun (ProcessorBox::rb_choose_send));
1694 ActionManager::jack_sensitive_actions.push_back (act);
1696 ActionManager::register_action (popup_act_grp, X_("newaux"), _("New Aux Send ..."));
1698 ActionManager::register_action (popup_act_grp, X_("clear"), _("Clear (all)"),
1699 sigc::ptr_fun (ProcessorBox::rb_clear));
1700 ActionManager::register_action (popup_act_grp, X_("clear_pre"), _("Clear (pre-fader)"),
1701 sigc::ptr_fun (ProcessorBox::rb_clear_pre));
1702 ActionManager::register_action (popup_act_grp, X_("clear_post"), _("Clear (post-fader)"),
1703 sigc::ptr_fun (ProcessorBox::rb_clear_post));
1705 /* standard editing stuff */
1706 cut_action = ActionManager::register_action (popup_act_grp, X_("cut"), _("Cut"),
1707 sigc::ptr_fun (ProcessorBox::rb_cut));
1708 ActionManager::plugin_selection_sensitive_actions.push_back(cut_action);
1709 act = ActionManager::register_action (popup_act_grp, X_("copy"), _("Copy"),
1710 sigc::ptr_fun (ProcessorBox::rb_copy));
1711 ActionManager::plugin_selection_sensitive_actions.push_back(act);
1713 act = ActionManager::register_action (popup_act_grp, X_("delete"), _("Delete"),
1714 sigc::ptr_fun (ProcessorBox::rb_delete));
1715 ActionManager::plugin_selection_sensitive_actions.push_back(act); // ??
1717 paste_action = ActionManager::register_action (popup_act_grp, X_("paste"), _("Paste"),
1718 sigc::ptr_fun (ProcessorBox::rb_paste));
1719 rename_action = ActionManager::register_action (popup_act_grp, X_("rename"), _("Rename"),
1720 sigc::ptr_fun (ProcessorBox::rb_rename));
1721 ActionManager::register_action (popup_act_grp, X_("selectall"), _("Select All"),
1722 sigc::ptr_fun (ProcessorBox::rb_select_all));
1723 ActionManager::register_action (popup_act_grp, X_("deselectall"), _("Deselect All"),
1724 sigc::ptr_fun (ProcessorBox::rb_deselect_all));
1726 /* activation etc. */
1728 ActionManager::register_action (popup_act_grp, X_("activate_all"), _("Activate all"),
1729 sigc::ptr_fun (ProcessorBox::rb_activate_all));
1730 ActionManager::register_action (popup_act_grp, X_("deactivate_all"), _("Deactivate all"),
1731 sigc::ptr_fun (ProcessorBox::rb_deactivate_all));
1732 ActionManager::register_action (popup_act_grp, X_("ab_plugins"), _("A/B Plugins"),
1733 sigc::ptr_fun (ProcessorBox::rb_ab_plugins));
1736 edit_action = ActionManager::register_action (popup_act_grp, X_("edit"), _("Edit..."),
1737 sigc::ptr_fun (ProcessorBox::rb_edit));
1739 ActionManager::add_action_group (popup_act_grp);
1743 ProcessorBox::rb_ab_plugins ()
1745 if (_current_processor_box == 0) {
1749 _current_processor_box->ab_plugins ();
1753 ProcessorBox::rb_choose_plugin ()
1755 if (_current_processor_box == 0) {
1758 _current_processor_box->choose_plugin ();
1762 ProcessorBox::rb_choose_insert ()
1764 if (_current_processor_box == 0) {
1767 _current_processor_box->choose_insert ();
1771 ProcessorBox::rb_choose_send ()
1773 if (_current_processor_box == 0) {
1776 _current_processor_box->choose_send ();
1780 ProcessorBox::rb_choose_aux (boost::weak_ptr<Route> wr)
1782 if (_current_processor_box == 0) {
1786 _current_processor_box->choose_aux (wr);
1790 ProcessorBox::rb_clear ()
1792 if (_current_processor_box == 0) {
1796 _current_processor_box->clear_processors ();
1801 ProcessorBox::rb_clear_pre ()
1803 if (_current_processor_box == 0) {
1807 _current_processor_box->clear_processors (PreFader);
1812 ProcessorBox::rb_clear_post ()
1814 if (_current_processor_box == 0) {
1818 _current_processor_box->clear_processors (PostFader);
1822 ProcessorBox::rb_cut ()
1824 if (_current_processor_box == 0) {
1828 _current_processor_box->cut_processors ();
1832 ProcessorBox::rb_delete ()
1834 if (_current_processor_box == 0) {
1838 _current_processor_box->delete_processors ();
1842 ProcessorBox::rb_copy ()
1844 if (_current_processor_box == 0) {
1847 _current_processor_box->copy_processors ();
1851 ProcessorBox::rb_paste ()
1853 if (_current_processor_box == 0) {
1857 _current_processor_box->paste_processors ();
1861 ProcessorBox::rb_rename ()
1863 if (_current_processor_box == 0) {
1866 _current_processor_box->rename_processors ();
1870 ProcessorBox::rb_select_all ()
1872 if (_current_processor_box == 0) {
1876 _current_processor_box->select_all_processors ();
1880 ProcessorBox::rb_deselect_all ()
1882 if (_current_processor_box == 0) {
1886 _current_processor_box->deselect_all_processors ();
1890 ProcessorBox::rb_activate_all ()
1892 if (_current_processor_box == 0) {
1896 _current_processor_box->all_processors_active (true);
1900 ProcessorBox::rb_deactivate_all ()
1902 if (_current_processor_box == 0) {
1905 _current_processor_box->all_processors_active (false);
1909 ProcessorBox::rb_edit ()
1911 if (_current_processor_box == 0) {
1915 _current_processor_box->for_selected_processors (&ProcessorBox::toggle_edit_processor);
1919 ProcessorBox::route_property_changed (const PropertyChange& what_changed)
1921 if (!what_changed.contains (ARDOUR::Properties::name)) {
1925 ENSURE_GUI_THREAD (*this, &ProcessorBox::route_property_changed, what_changed);
1927 boost::shared_ptr<Processor> processor;
1928 boost::shared_ptr<PluginInsert> plugin_insert;
1929 boost::shared_ptr<Send> send;
1931 list<ProcessorEntry*> children = processor_display.children();
1933 for (list<ProcessorEntry*>::iterator iter = children.begin(); iter != children.end(); ++iter) {
1935 processor = (*iter)->processor ();
1937 Window* w = get_processor_ui (processor);
1943 /* rename editor windows for sends and plugins */
1945 if ((send = boost::dynamic_pointer_cast<Send> (processor)) != 0) {
1946 w->set_title (send->name ());
1947 } else if ((plugin_insert = boost::dynamic_pointer_cast<PluginInsert> (processor)) != 0) {
1948 w->set_title (generate_processor_title (plugin_insert));
1954 ProcessorBox::generate_processor_title (boost::shared_ptr<PluginInsert> pi)
1956 string maker = pi->plugin()->maker() ? pi->plugin()->maker() : "";
1957 string::size_type email_pos;
1959 if ((email_pos = maker.find_first_of ('<')) != string::npos) {
1960 maker = maker.substr (0, email_pos - 1);
1963 if (maker.length() > 32) {
1964 maker = maker.substr (0, 32);
1968 return string_compose(_("%1: %2 (by %3)"), _route->name(), pi->name(), maker);
1972 ProcessorBox::on_size_allocate (Allocation& a)
1974 HBox::on_size_allocate (a);
1976 list<ProcessorEntry*> children = processor_display.children ();
1977 for (list<ProcessorEntry*>::const_iterator i = children.begin(); i != children.end(); ++i) {
1978 (*i)->set_pixel_width (a.get_width ());
1982 /** @param p Processor.
1983 * @return the UI window for \a p.
1986 ProcessorBox::get_processor_ui (boost::shared_ptr<Processor> p) const
1988 list<ProcessorWindowProxy*>::const_iterator i = _processor_window_proxies.begin ();
1989 while (i != _processor_window_proxies.end()) {
1990 boost::shared_ptr<Processor> t = (*i)->processor().lock ();
1992 return (*i)->get ();
1998 /* we shouldn't get here, because the ProcessorUIList should always contain
1999 an entry for each processor.
2005 /** Make a note of the UI window that a processor is using.
2006 * @param p Processor.
2007 * @param w UI window.
2010 ProcessorBox::set_processor_ui (boost::shared_ptr<Processor> p, Gtk::Window* w)
2012 list<ProcessorWindowProxy*>::iterator i = _processor_window_proxies.begin ();
2013 while (i != _processor_window_proxies.end()) {
2014 boost::shared_ptr<Processor> t = (*i)->processor().lock ();
2023 /* we shouldn't get here, because the ProcessorUIList should always contain
2024 an entry for each processor.
2029 ProcessorWindowProxy::ProcessorWindowProxy (
2030 string const & name,
2031 XMLNode const * node,
2033 boost::weak_ptr<Processor> processor
2035 : WindowProxy<Gtk::Window> (name, node)
2037 , _processor_box (box)
2038 , _processor (processor)
2045 ProcessorWindowProxy::show ()
2047 boost::shared_ptr<Processor> p = _processor.lock ();
2052 _processor_box->toggle_edit_processor (p);