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.
24 #include <sigc++/bind.h>
26 #include <gtkmm2ext/gtk_ui.h>
27 #include <gtkmm2ext/utils.h>
28 #include <gtkmm2ext/choice.h>
29 #include <gtkmm2ext/utils.h>
30 #include <gtkmm2ext/stop_signal.h>
31 #include <gtkmm2ext/doi.h>
33 #include <ardour/ardour.h>
34 #include <ardour/session.h>
35 #include <ardour/audioengine.h>
36 #include <ardour/route.h>
37 #include <ardour/audio_track.h>
38 #include <ardour/diskstream.h>
39 #include <ardour/send.h>
40 #include <ardour/insert.h>
41 #include <ardour/ladspa_plugin.h>
42 #include <ardour/connection.h>
43 #include <ardour/session_connection.h>
45 #include "ardour_ui.h"
46 #include "ardour_dialog.h"
47 #include "ardour_message.h"
48 #include "public_editor.h"
49 #include "redirect_box.h"
51 #include "plugin_selector.h"
52 #include "route_redirect_selection.h"
56 #include "plugin_ui.h"
58 #include "io_selector.h"
60 #include "gui_thread.h"
65 using namespace ARDOUR;
68 using namespace Gtkmm2ext;
71 RedirectBox::RedirectBox (Placement pcmnt, Session& sess, Route& rt, PluginSelector &plugsel,
72 RouteRedirectSelection & rsel, bool owner_is_mixer)
75 _owner_is_mixer (owner_is_mixer),
77 _plugin_selector(plugsel),
79 //redirect_display (1)
84 redirect_drag_in_progress = false;
86 model = ListStore::create(columns);
88 RefPtr<TreeSelection> selection = redirect_display.get_selection();
89 selection->set_mode (Gtk::SELECTION_MULTIPLE);
90 selection->signal_changed().connect (mem_fun (*this, &RedirectBox::selection_changed));
92 redirect_display.set_model (model);
93 redirect_display.append_column (NULL, columns.text);
94 redirect_display.set_name ("MixerRedirectSelector");
95 redirect_display.set_headers_visible (false);
96 redirect_display.set_reorderable (true);
97 redirect_display.set_size_request (-1, 48);
98 redirect_display.add_object_drag (columns.redirect.index(), "redirects");
99 redirect_display.signal_object_drop.connect (mem_fun (*this, &RedirectBox::object_drop));
101 // Does this adequately replace the drag start/stop signal handlers?
102 model->signal_rows_reordered().connect (mem_fun (*this, &RedirectBox::redirects_reordered));
103 redirect_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
105 redirect_scroller.add (redirect_display);
106 redirect_eventbox.add (redirect_scroller);
107 pack_start (redirect_eventbox, true, true);
109 redirect_scroller.show ();
110 redirect_display.show ();
111 redirect_eventbox.show ();
114 _route.redirects_changed.connect (mem_fun(*this, &RedirectBox::redirects_changed));
116 redirect_display.signal_button_press_event().connect (mem_fun(*this, &RedirectBox::redirect_button));
117 redirect_display.signal_button_release_event().connect (mem_fun(*this, &RedirectBox::redirect_button));
119 //redirect_display.signal_button_release_event().connect_after (ptr_fun (do_not_propagate));
120 set_stuff_from_route ();
122 /* start off as a passthru strip. we'll correct this, if necessary,
123 in update_diskstream_display().
126 //set_name ("AudioTrackStripBase");
128 /* now force an update of all the various elements */
130 redirects_changed (0);
132 //add_events (Gdk::BUTTON_RELEASE_MASK);
135 RedirectBox::~RedirectBox ()
137 // GoingAway(); /* EMIT_SIGNAL */
142 RedirectBox::object_drop (string type, uint32_t cnt, void** ptr)
144 if (type != "redirects") {
150 RedirectBox::set_stuff_from_route ()
155 RedirectBox::set_title (const std::string & title)
157 redirect_display.get_column(0)->set_title (title);
161 RedirectBox::set_title_shown (bool flag)
167 RedirectBox::update()
169 redirects_changed(0);
174 RedirectBox::set_width (Width w)
181 redirects_changed(0);
186 RedirectBox::remove_redirect_gui (Redirect *redirect)
190 PortInsert *port_insert = 0;
192 if ((insert = dynamic_cast<Insert *> (redirect)) != 0) {
194 if ((port_insert = dynamic_cast<PortInsert *> (insert)) != 0) {
195 PortInsertUI *io_selector = reinterpret_cast<PortInsertUI *> (port_insert->get_gui());
196 port_insert->set_gui (0);
200 } else if ((send = dynamic_cast<Send *> (insert)) != 0) {
201 SendUIWindow *sui = reinterpret_cast<SendUIWindow*> (send->get_gui());
208 RedirectBox::build_send_action_menu ()
211 using namespace Menu_Helpers;
213 send_action_menu = new Menu;
214 send_action_menu->set_name ("ArdourContextMenu");
215 MenuList& items = send_action_menu->items();
217 items.push_back (MenuElem (_("New send"), mem_fun(*this, &RedirectBox::new_send)));
218 items.push_back (MenuElem (_("Show send controls"), mem_fun(*this, &RedirectBox::show_send_controls)));
222 RedirectBox::show_send_controls ()
228 RedirectBox::new_send ()
234 RedirectBox::show_redirect_menu (gint arg)
236 if (redirect_menu == 0) {
237 redirect_menu = build_redirect_menu ();
240 redirect_menu->popup (1, 0);
244 RedirectBox::redirect_drag_begin (GdkDragContext *context)
246 redirect_drag_in_progress = true;
250 RedirectBox::redirect_drag_end (GdkDragContext *context)
252 redirect_drag_in_progress = false;
256 RedirectBox::redirect_button (GdkEventButton *ev)
259 TreeModel::Row row = *(redirect_display.get_selection()->get_selected());
260 redirect = row[columns.redirect];
263 case GDK_BUTTON_PRESS:
264 if (ev->button == 3) {
265 show_redirect_menu (0); // Handle the context-click menu here as well
271 case GDK_2BUTTON_PRESS:
272 if (ev->state != 0) {
275 /* might be edit event, see below */
278 case GDK_BUTTON_RELEASE:
282 /* shouldn't be here, but gcc complains */
286 if (redirect && Keyboard::is_delete_event (ev)) {
288 Glib::signal_idle().connect (bind (mem_fun(*this, &RedirectBox::idle_delete_redirect), redirect));
291 } else if (redirect && (Keyboard::is_edit_event (ev) || ev->type == GDK_2BUTTON_PRESS)) {
293 if (_session.engine().connected()) {
294 /* XXX giving an error message here is hard, because we may be in the midst of a button press */
295 edit_redirect (redirect);
299 } else if (Keyboard::is_context_menu_event (ev)) {
300 show_redirect_menu(0);
301 return TRUE; //stop_signal (*clist, "button-release-event");
304 switch (ev->button) {
311 redirect->set_active (!redirect->active(), this);
327 RedirectBox::build_redirect_menu ()
329 popup_act_grp = Gtk::ActionGroup::create(X_("redirectmenu"));
330 Glib::RefPtr<Action> act;
333 ActionManager::register_action (popup_act_grp, X_("newplugin"), _("New Plugin ..."), mem_fun(*this, &RedirectBox::choose_plugin));
334 ActionManager::register_action (popup_act_grp, X_("newinsert"), _("New Insert"), mem_fun(*this, &RedirectBox::choose_insert));
335 ActionManager::register_action (popup_act_grp, X_("newsend"), _("New Send ..."), mem_fun(*this, &RedirectBox::choose_send));
336 ActionManager::register_action (popup_act_grp, X_("clear"), _("Clear"), mem_fun(*this, &RedirectBox::clear_redirects));
338 /* standard editing stuff */
339 act = ActionManager::register_action (popup_act_grp, X_("cut"), _("Cut"), mem_fun(*this, &RedirectBox::cut_redirects));
340 ActionManager::plugin_selection_sensitive_actions.push_back(act);
341 act = ActionManager::register_action (popup_act_grp, X_("copy"), _("Copy"), mem_fun(*this, &RedirectBox::copy_redirects));
342 ActionManager::plugin_selection_sensitive_actions.push_back(act);
343 ActionManager::ActionManager::register_action (popup_act_grp, X_("paste"), _("Paste"), mem_fun(*this, &RedirectBox::paste_redirects));
344 act = ActionManager::register_action (popup_act_grp, X_("rename"), _("Rename"), mem_fun(*this, &RedirectBox::rename_redirects));
345 ActionManager::plugin_selection_sensitive_actions.push_back(act);
346 ActionManager::register_action (popup_act_grp, X_("selectall"), _("Select All"), mem_fun(*this, &RedirectBox::select_all_redirects));
347 ActionManager::register_action (popup_act_grp, X_("deselectall"), _("Deselect All"), mem_fun(*this, &RedirectBox::deselect_all_redirects));
350 act = ActionManager::register_action (popup_act_grp, X_("activate"), _("Activate"), bind (mem_fun(*this, &RedirectBox::for_selected_redirects), &RedirectBox::activate_redirect));
351 ActionManager::plugin_selection_sensitive_actions.push_back(act);
352 act = ActionManager::register_action (popup_act_grp, X_("deactivate"), _("Deactivate"), bind (mem_fun(*this, &RedirectBox::for_selected_redirects), &RedirectBox::deactivate_redirect));
353 ActionManager::plugin_selection_sensitive_actions.push_back(act);
354 ActionManager::register_action (popup_act_grp, X_("activate"), _("Activate"), bind (mem_fun(*this, &RedirectBox::all_redirects_active),true));
355 ActionManager::register_action (popup_act_grp, X_("activate"), _("Activate"), bind (mem_fun(*this, &RedirectBox::all_redirects_active), false));
358 act = ActionManager::register_action (popup_act_grp, X_("edit"), _("Edit"), bind (mem_fun(*this, &RedirectBox::for_selected_redirects), &RedirectBox::edit_redirect));
359 ActionManager::plugin_selection_sensitive_actions.push_back(act);
361 ActionManager::add_action_group (popup_act_grp);
363 redirect_menu = dynamic_cast<Gtk::Menu*>(ActionManager::get_widget("/redirectmenu") );
364 redirect_menu->signal_map_event().connect (mem_fun(*this, &RedirectBox::redirect_menu_map_handler));
365 redirect_menu->set_name ("ArdourContextMenu");
369 return redirect_menu;
373 RedirectBox::selection_changed ()
375 bool sensitive = (redirect_display.get_selection()->count_selected_rows()) ? true : false;
377 for (vector<Glib::RefPtr<Gtk::Action> >::iterator i = ActionManager::plugin_selection_sensitive_actions.begin(); i != ActionManager::plugin_selection_sensitive_actions.end(); ++i) {
378 (*i)->set_sensitive (sensitive);
383 RedirectBox::redirect_menu_map_handler (GdkEventAny *ev)
385 popup_act_grp->get_action("paste")->set_sensitive (!_rr_selection.redirects.empty());
390 RedirectBox::select_all_redirects ()
392 redirect_display.get_selection()->select_all();
396 RedirectBox::deselect_all_redirects ()
398 redirect_display.get_selection()->unselect_all();
402 RedirectBox::choose_plugin ()
404 sigc::connection newplug_connection = _plugin_selector.PluginCreated.connect (mem_fun(*this,&RedirectBox::insert_plugin_chosen));
405 _plugin_selector.run ();
406 newplug_connection.disconnect();
410 RedirectBox::insert_plugin_chosen (Plugin *plugin)
414 Redirect *redirect = new PluginInsert (_session, *plugin, _placement);
416 redirect->active_changed.connect (mem_fun(*this, &RedirectBox::show_redirect_active));
418 uint32_t err_streams;
420 if (_route.add_redirect (redirect, this, &err_streams)) {
421 wierd_plugin_dialog (*plugin, err_streams, _route);
428 RedirectBox::wierd_plugin_dialog (Plugin& p, uint32_t streams, IO& io)
430 ArdourDialog dialog ("wierd plugin dialog");
432 Button button (_("OK"));
436 /* i hate this kind of code */
438 if (streams > p.get_info().n_inputs) {
439 label.set_text (string_compose (_(
440 "You attempted to add a plugin (%1).\n"
441 "The plugin has %2 inputs\n"
442 "but at the insertion point, there are\n"
443 "%3 active signal streams.\n"
445 "This makes no sense - you are throwing away\n"
446 "part of the signal."),
448 p.get_info().n_inputs,
450 } else if (streams < p.get_info().n_inputs) {
451 label.set_text (string_compose (_(
452 "You attempted to add a plugin (%1).\n"
453 "The plugin has %2 inputs\n"
454 "but at the insertion point there are\n"
455 "only %3 active signal streams.\n"
457 "This makes no sense - unless the plugin supports\n"
458 "side-chain inputs. A future version of Ardour will\n"
459 "support this type of configuration."),
461 p.get_info().n_inputs,
464 label.set_text (string_compose (_(
465 "You attempted to add a plugin (%1).\n"
467 "The I/O configuration doesn't make sense:\n"
469 "The plugin has %2 inputs and %3 outputs.\n"
470 "The track/bus has %4 inputs and %5 outputs.\n"
471 "The insertion point, has %6 active signals.\n"
473 "Ardour does not understand what to do in such situations.\n"),
475 p.get_info().n_inputs,
476 p.get_info().n_outputs,
482 button_box.pack_start (button, false, true);
484 vpacker.set_spacing (12);
485 vpacker.set_border_width (12);
486 vpacker.pack_start (label);
487 vpacker.pack_start (button_box);
489 button.signal_clicked().connect (bind (mem_fun (dialog, &ArdourDialog::stop), 0));
491 dialog.add (vpacker);
492 dialog.set_name (X_("PluginIODialog"));
493 dialog.set_position (Gtk::WIN_POS_MOUSE);
494 dialog.set_modal (true);
499 //dialog.get_window()->set_decorations (Gdk::WMDecoration (GDK_DECOR_BORDER|GDK_DECOR_RESIZEH));
505 RedirectBox::choose_insert ()
507 Redirect *redirect = new PortInsert (_session, _placement);
508 redirect->active_changed.connect (mem_fun(*this, &RedirectBox::show_redirect_active));
509 _route.add_redirect (redirect, this);
513 RedirectBox::choose_send ()
515 Send *send = new Send (_session, _placement);
517 /* XXX need redirect lock on route */
519 send->ensure_io (0, _route.max_redirect_outs(), false, this);
521 IOSelectorWindow *ios = new IOSelectorWindow (_session, *send, false, true);
524 ios->selector().Finished.connect (bind (mem_fun(*this, &RedirectBox::send_io_finished), static_cast<Redirect*>(send), ios));
528 RedirectBox::send_io_finished (IOSelector::Result r, Redirect* redirect, IOSelectorWindow* ios)
531 case IOSelector::Cancelled:
535 case IOSelector::Accepted:
536 _route.add_redirect (redirect, this);
540 delete_when_idle (ios);
544 RedirectBox::redirects_changed (void *src)
546 ENSURE_GUI_THREAD(bind (mem_fun(*this, &RedirectBox::redirects_changed), src));
548 //redirect_display.freeze ();
550 redirect_active_connections.clear ();
551 redirect_name_connections.clear ();
553 _route.foreach_redirect (this, &RedirectBox::add_redirect_to_display);
555 switch (_placement) {
557 build_redirect_tooltip(redirect_eventbox, _("Pre-fader inserts, sends & plugins:"));
560 build_redirect_tooltip(redirect_eventbox, _("Post-fader inserts, sends & plugins:"));
563 //redirect_display.thaw ();
567 RedirectBox::add_redirect_to_display (Redirect *redirect)
569 if (redirect->placement() != _placement) {
573 Gtk::TreeModel::Row row = *(model->append());
574 row[columns.text] = redirect_name (*redirect);
575 row[columns.redirect] = redirect;
577 show_redirect_active (redirect, this);
579 redirect_active_connections.push_back (redirect->active_changed.connect (mem_fun(*this, &RedirectBox::show_redirect_active)));
580 redirect_name_connections.push_back (redirect->name_changed.connect (bind (mem_fun(*this, &RedirectBox::show_redirect_name), redirect)));
584 RedirectBox::redirect_name (Redirect& redirect)
589 if (!redirect.active()) {
593 if ((send = dynamic_cast<Send *> (&redirect)) != 0) {
597 /* grab the send name out of its overall name */
599 string::size_type lbracket, rbracket;
600 lbracket = send->name().find ('[');
601 rbracket = send->name().find (']');
605 name_display += send->name().substr (lbracket+1, lbracket-rbracket-1);
608 name_display += short_version (send->name().substr (lbracket+1, lbracket-rbracket-1), 4);
616 name_display += redirect.name();
619 name_display += short_version (redirect.name(), 5);
625 if (!redirect.active()) {
633 RedirectBox::build_redirect_tooltip (EventBox& box, string start)
637 Gtk::TreeModel::Children children = model->children();
638 for(Gtk::TreeModel::Children::iterator iter = children.begin(); iter != children.end(); ++iter) {
639 Gtk::TreeModel::Row row = *iter;
641 tip += row[columns.text];
643 ARDOUR_UI::instance()->tooltips().set_tip (box, tip);
647 RedirectBox::show_redirect_name (void* src, Redirect *redirect)
649 ENSURE_GUI_THREAD(bind (mem_fun(*this, &RedirectBox::show_redirect_name), src, redirect));
651 show_redirect_active (redirect, src);
655 RedirectBox::show_redirect_active (Redirect *redirect, void *src)
657 ENSURE_GUI_THREAD(bind (mem_fun(*this, &RedirectBox::show_redirect_active), redirect, src));
659 Gtk::TreeModel::Children children = model->children();
660 Gtk::TreeModel::Children::iterator iter = children.begin();
662 while( iter != children.end())
664 if ((*iter)[columns.redirect] == redirect)
669 (*iter)[columns.text] = redirect_name (*redirect);
671 if (redirect->active()) {
672 redirect_display.get_selection()->select (iter);
674 redirect_display.get_selection()->unselect (iter);
679 RedirectBox::redirects_reordered (const TreeModel::Path& path,const TreeModel::iterator& iter ,int* hmm)
681 /* this is called before the reorder has been done, so just queue
682 something for idle time.
685 Glib::signal_idle().connect (mem_fun(*this, &RedirectBox::compute_redirect_sort_keys));
689 RedirectBox::compute_redirect_sort_keys ()
691 uint32_t sort_key = 0;
692 Gtk::TreeModel::Children children = model->children();
694 for (Gtk::TreeModel::Children::iterator iter = children.begin(); iter != children.end(); ++iter) {
695 Redirect *redirect = (*iter)[columns.redirect];
696 redirect->set_sort_key (sort_key, this);
700 if (_route.sort_redirects ()) {
702 redirects_changed (0);
704 /* now tell them about the problem */
706 ArdourDialog dialog ("wierd plugin dialog");
708 Button button (_("OK"));
713 You cannot reorder this set of redirects\n\
714 in that way because the inputs and\n\
715 outputs do not work correctly."));
717 button_box.pack_start (button, false, true);
719 vpacker.set_spacing (12);
720 vpacker.set_border_width (12);
721 vpacker.pack_start (label);
722 vpacker.pack_start (button_box);
724 button.signal_clicked().connect (bind (mem_fun (dialog, &ArdourDialog::stop), 0));
726 dialog.add (vpacker);
727 dialog.set_name (X_("PluginIODialog"));
728 dialog.set_position (Gtk::WIN_POS_MOUSE);
729 dialog.set_modal (true);
734 //dialog.get_window()->set_decorations (Gdk::WMDecoration (GDK_DECOR_BORDER|GDK_DECOR_RESIZEH));
743 RedirectBox::rename_redirects ()
745 vector<Redirect*> to_be_renamed;
747 get_selected_redirects (to_be_renamed);
749 if (to_be_renamed.empty()) {
753 for (vector<Redirect*>::iterator i = to_be_renamed.begin(); i != to_be_renamed.end(); ++i) {
754 rename_redirect (*i);
759 RedirectBox::cut_redirects ()
761 vector<Redirect*> to_be_removed;
763 get_selected_redirects (to_be_removed);
765 if (to_be_removed.empty()) {
769 /* this essentially transfers ownership of the redirect
770 of the redirect from the route to the mixer
774 _rr_selection.set (to_be_removed);
776 for (vector<Redirect*>::iterator i = to_be_removed.begin(); i != to_be_removed.end(); ++i) {
778 void* gui = (*i)->get_gui ();
781 static_cast<Gtk::Widget*>(gui)->hide ();
784 if (_route.remove_redirect (*i, this)) {
786 _rr_selection.remove (*i);
793 RedirectBox::copy_redirects ()
795 vector<Redirect*> to_be_copied;
796 vector<Redirect*> copies;
798 get_selected_redirects (to_be_copied);
800 if (to_be_copied.empty()) {
804 for (vector<Redirect*>::iterator i = to_be_copied.begin(); i != to_be_copied.end(); ++i) {
805 copies.push_back (Redirect::clone (**i));
808 _rr_selection.set (copies);
812 RedirectBox::idle_delete_redirect (Redirect *redirect)
814 /* NOT copied to _mixer.selection() */
816 if (_route.remove_redirect (redirect, this)) {
826 RedirectBox::rename_redirect (Redirect* redirect)
828 ArdourDialog dialog ("rename redirect dialog");
832 Button ok_button (_("OK"));
833 Button cancel_button (_("Cancel"));
835 dialog.set_title (_("ardour: rename redirect"));
836 dialog.set_name ("RedirectRenameWindow");
837 dialog.set_size_request (300, -1);
838 dialog.set_position (Gtk::WIN_POS_MOUSE);
839 dialog.set_modal (true);
841 vbox.set_border_width (12);
842 vbox.set_spacing (12);
843 vbox.pack_start (entry, false, false);
844 vbox.pack_start (hbox, false, false);
845 hbox.pack_start (ok_button);
846 hbox.pack_start (cancel_button);
850 entry.set_name ("RedirectNameDisplay");
851 entry.set_text (redirect->name());
852 entry.select_region (0, -1);
855 ok_button.set_name ("EditorGTKButton");
856 cancel_button.set_name ("EditorGTKButton");
858 entry.signal_activate().connect (bind (mem_fun (dialog, &ArdourDialog::stop), 1));
859 cancel_button.signal_clicked().connect (bind (mem_fun (dialog, &ArdourDialog::stop), -1));
860 ok_button.signal_clicked().connect (bind (mem_fun (dialog, &ArdourDialog::stop), 1));
864 dialog.set_keyboard_input (true);
867 if (dialog.run_status() == 1) {
868 redirect->set_name (entry.get_text(), this);
873 RedirectBox::cut_redirect (Redirect *redirect)
875 /* this essentially transfers ownership of the redirect
876 of the redirect from the route to the mixer
880 _rr_selection.add (redirect);
882 void* gui = redirect->get_gui ();
885 static_cast<Gtk::Widget*>(gui)->hide ();
888 if (_route.remove_redirect (redirect, this)) {
889 _rr_selection.remove (redirect);
894 RedirectBox::copy_redirect (Redirect *redirect)
896 Redirect* copy = Redirect::clone (*redirect);
897 _rr_selection.add (copy);
901 RedirectBox::paste_redirects ()
903 if (_rr_selection.redirects.empty()) {
907 RedirectSelection& sel (_rr_selection.redirects);
908 list<Redirect*> others;
910 for (list<Redirect*>::iterator i = sel.begin(); i != sel.end(); ++i) {
912 Redirect* copy = Redirect::clone (**i);
914 copy->set_placement (_placement, this);
915 others.push_back (copy);
918 if (_route.add_redirects (others, this)) {
919 for (list<Redirect*>::iterator i = others.begin(); i != others.end(); ++i) {
924 "Copying the set of redirects on the clipboard failed,\n\
925 probably because the I/O configuration of the plugins\n\
926 could not match the configuration of this track.");
927 ArdourMessage am (0, X_("bad redirect copy dialog"), msg);
932 RedirectBox::activate_redirect (Redirect *r)
934 r->set_active (true, 0);
938 RedirectBox::deactivate_redirect (Redirect *r)
940 r->set_active (false, 0);
944 RedirectBox::get_selected_redirects (vector<Redirect*>& redirects)
946 vector<Gtk::TreeModel::Path> pathlist = redirect_display.get_selection()->get_selected_rows();
948 for (vector<Gtk::TreeModel::Path>::iterator iter = pathlist.begin(); iter != pathlist.end(); ++iter)
949 redirects.push_back ((*(model->get_iter(*iter)))[columns.redirect]);
953 RedirectBox::for_selected_redirects (void (RedirectBox::*pmf)(Redirect*))
955 vector<Gtk::TreeModel::Path> pathlist = redirect_display.get_selection()->get_selected_rows();
957 for (vector<Gtk::TreeModel::Path>::iterator iter = pathlist.begin(); iter != pathlist.end(); ++iter) {
958 Redirect* redirect = (*(model->get_iter(*iter)))[columns.redirect];
959 (this->*pmf)(redirect);
964 RedirectBox::clone_redirects ()
966 RouteSelection& routes (_rr_selection.routes);
968 if (!routes.empty()) {
969 if (_route.copy_redirects (*routes.front(), _placement)) {
971 "Copying the set of redirects on the clipboard failed,\n\
972 probably because the I/O configuration of the plugins\n\
973 could not match the configuration of this track.");
974 ArdourMessage am (0, X_("bad redirect copy dialog"), msg);
980 RedirectBox::all_redirects_active (bool state)
982 _route.all_redirects_active (state);
986 RedirectBox::clear_redirects()
989 vector<string> choices;
991 if (dynamic_cast<AudioTrack*>(&_route) != 0) {
992 prompt = _("Do you really want to remove all redirects from this track?\n"
993 "(this cannot be undone)");
995 prompt = _("Do you really want to remove all redirects from this bus?\n"
996 "(this cannot be undone)");
999 choices.push_back (_("Yes, remove them all"));
1000 choices.push_back (_("Cancel"));
1002 Gtkmm2ext::Choice prompter (prompt, choices);
1004 prompter.chosen.connect(sigc::ptr_fun(Gtk::Main::quit));
1005 prompter.show_all ();
1009 if (prompter.get_choice() == 0) {
1010 _route.clear_redirects (this);
1016 RedirectBox::edit_redirect (Redirect* redirect)
1020 if (dynamic_cast<AudioTrack*>(&_route) != 0) {
1022 if (dynamic_cast<AudioTrack*> (&_route)->freeze_state() == AudioTrack::Frozen) {
1027 if ((insert = dynamic_cast<Insert *> (redirect)) == 0) {
1031 if (!_session.engine().connected()) {
1035 Send *send = dynamic_cast<Send*> (redirect);
1037 SendUIWindow *send_ui;
1039 if (send->get_gui() == 0) {
1042 title = string_compose(_("ardour: %1"), send->name());
1044 send_ui = new SendUIWindow (*send, _session);
1045 send_ui->set_title (title);
1046 send->set_gui (send_ui);
1049 send_ui = reinterpret_cast<SendUIWindow *> (send->get_gui());
1052 if (send_ui->is_visible()) {
1053 send_ui->get_window()->raise ();
1055 send_ui->show_all ();
1062 PluginInsert *plugin_insert;
1063 PortInsert *port_insert;
1065 if ((plugin_insert = dynamic_cast<PluginInsert *> (insert)) != 0) {
1067 PluginUIWindow *plugin_ui;
1069 if (plugin_insert->get_gui() == 0) {
1072 string maker = plugin_insert->plugin().maker();
1073 string::size_type email_pos;
1075 if ((email_pos = maker.find_first_of ('<')) != string::npos) {
1076 maker = maker.substr (0, email_pos - 1);
1079 if (maker.length() > 32) {
1080 maker = maker.substr (0, 32);
1084 title = string_compose(_("ardour: %1: %2 (by %3)"), _route.name(), plugin_insert->name(), maker);
1086 plugin_ui = new PluginUIWindow (_session.engine(), *plugin_insert);
1087 if (_owner_is_mixer) {
1088 ARDOUR_UI::instance()->the_mixer()->ensure_float (*plugin_ui);
1090 ARDOUR_UI::instance()->the_editor().ensure_float (*plugin_ui);
1092 plugin_ui->set_title (title);
1093 plugin_insert->set_gui (plugin_ui);
1096 plugin_ui = reinterpret_cast<PluginUIWindow *> (plugin_insert->get_gui());
1099 if (plugin_ui->is_visible()) {
1100 plugin_ui->get_window()->raise ();
1102 plugin_ui->show_all ();
1105 } else if ((port_insert = dynamic_cast<PortInsert *> (insert)) != 0) {
1107 if (!_session.engine().connected()) {
1108 ArdourMessage msg (NULL, "nojackdialog", _("Not connected to JACK - no I/O changes are possible"));
1112 PortInsertWindow *io_selector;
1114 if (port_insert->get_gui() == 0) {
1115 io_selector = new PortInsertWindow (_session, *port_insert);
1116 port_insert->set_gui (io_selector);
1119 io_selector = reinterpret_cast<PortInsertWindow *> (port_insert->get_gui());
1122 if (io_selector->is_visible()) {
1123 io_selector->get_window()->raise ();
1125 io_selector->show_all ();