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 <gtkmm/messagedialog.h>
28 #include <gtkmm2ext/gtk_ui.h>
29 #include <gtkmm2ext/utils.h>
30 #include <gtkmm2ext/choice.h>
31 #include <gtkmm2ext/utils.h>
32 #include <gtkmm2ext/stop_signal.h>
33 #include <gtkmm2ext/doi.h>
35 #include <ardour/ardour.h>
36 #include <ardour/session.h>
37 #include <ardour/audioengine.h>
38 #include <ardour/route.h>
39 #include <ardour/audio_track.h>
40 #include <ardour/diskstream.h>
41 #include <ardour/send.h>
42 #include <ardour/insert.h>
43 #include <ardour/ladspa_plugin.h>
44 #include <ardour/connection.h>
45 #include <ardour/session_connection.h>
47 #include "ardour_ui.h"
48 #include "ardour_dialog.h"
49 #include "public_editor.h"
50 #include "redirect_box.h"
52 #include "plugin_selector.h"
53 #include "route_redirect_selection.h"
57 #include "plugin_ui.h"
59 #include "io_selector.h"
61 #include "gui_thread.h"
66 using namespace ARDOUR;
69 using namespace Gtkmm2ext;
71 RedirectBox* RedirectBox::_current_redirect_box = 0;
72 RefPtr<Action> RedirectBox::paste_action;
73 bool RedirectBox::get_colors = true;
74 Gdk::Color* RedirectBox::active_redirect_color;
75 Gdk::Color* RedirectBox::inactive_redirect_color;
77 RedirectBox::RedirectBox (Placement pcmnt, Session& sess, Route& rt, PluginSelector &plugsel,
78 RouteRedirectSelection & rsel, bool owner_is_mixer)
81 _owner_is_mixer (owner_is_mixer),
83 _plugin_selector(plugsel),
87 active_redirect_color = new Gdk::Color;
88 inactive_redirect_color = new Gdk::Color;
89 set_color (*active_redirect_color, rgba_from_style ("RedirectSelector", 0xff, 0, 0, 0, "fg", Gtk::STATE_ACTIVE, false ));
90 set_color (*inactive_redirect_color, rgba_from_style ("RedirectSelector", 0xff, 0, 0, 0, "fg", Gtk::STATE_NORMAL, false ));
97 redirect_drag_in_progress = false;
98 no_redirect_redisplay = false;
99 ignore_delete = false;
101 model = ListStore::create(columns);
103 RefPtr<TreeSelection> selection = redirect_display.get_selection();
104 selection->set_mode (Gtk::SELECTION_MULTIPLE);
105 selection->signal_changed().connect (mem_fun (*this, &RedirectBox::selection_changed));
107 redirect_display.set_model (model);
108 redirect_display.append_column (X_("notshown"), columns.text);
109 redirect_display.set_name ("RedirectSelector");
110 redirect_display.set_headers_visible (false);
111 redirect_display.set_reorderable (true);
112 redirect_display.set_size_request (-1, 40);
113 redirect_display.get_column(0)->set_sizing(TREE_VIEW_COLUMN_FIXED);
114 redirect_display.get_column(0)->set_fixed_width(48);
115 redirect_display.add_object_drag (columns.redirect.index(), "redirects");
116 redirect_display.signal_object_drop.connect (mem_fun (*this, &RedirectBox::object_drop));
118 TreeViewColumn* name_col = redirect_display.get_column(0);
119 CellRendererText* renderer = dynamic_cast<CellRendererText*>(redirect_display.get_column_cell_renderer (0));
120 name_col->add_attribute(renderer->property_foreground_gdk(), columns.color);
122 redirect_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
124 model->signal_row_deleted().connect (mem_fun (*this, &RedirectBox::row_deleted));
126 redirect_scroller.add (redirect_display);
127 redirect_eventbox.add (redirect_scroller);
129 redirect_scroller.set_size_request (-1, 40);
131 pack_start (redirect_eventbox, true, true);
133 _route.redirects_changed.connect (mem_fun(*this, &RedirectBox::redisplay_redirects));
135 redirect_eventbox.signal_enter_notify_event().connect (bind (sigc::ptr_fun (RedirectBox::enter_box), this));
137 redirect_display.signal_button_press_event().connect (mem_fun(*this, &RedirectBox::redirect_button_press_event), false);
138 redirect_display.signal_button_release_event().connect (mem_fun(*this, &RedirectBox::redirect_button_press_event));
140 /* start off as a passthru strip. we'll correct this, if necessary,
141 in update_diskstream_display().
144 /* now force an update of all the various elements */
146 redisplay_redirects (0);
149 RedirectBox::~RedirectBox ()
154 RedirectBox::object_drop (string type, uint32_t cnt, void** ptr)
156 if (type != "redirects" || cnt == 0 || ptr == 0) {
160 /* do something with the dropped redirects */
162 list<Redirect*> redirects;
164 for (uint32_t n = 0; n < cnt; ++n) {
165 redirects.push_back ((Redirect*) ptr[n]);
168 paste_redirect_list (redirects);
172 RedirectBox::update()
174 redisplay_redirects (0);
179 RedirectBox::set_width (Width w)
186 redisplay_redirects (0);
190 RedirectBox::remove_redirect_gui (Redirect *redirect)
194 PortInsert *port_insert = 0;
196 if ((insert = dynamic_cast<Insert *> (redirect)) != 0) {
198 if ((port_insert = dynamic_cast<PortInsert *> (insert)) != 0) {
199 PortInsertUI *io_selector = reinterpret_cast<PortInsertUI *> (port_insert->get_gui());
200 port_insert->set_gui (0);
204 } else if ((send = dynamic_cast<Send *> (insert)) != 0) {
205 SendUIWindow *sui = reinterpret_cast<SendUIWindow*> (send->get_gui());
212 RedirectBox::build_send_action_menu ()
215 using namespace Menu_Helpers;
217 send_action_menu = new Menu;
218 send_action_menu->set_name ("ArdourContextMenu");
219 MenuList& items = send_action_menu->items();
221 items.push_back (MenuElem (_("New send"), mem_fun(*this, &RedirectBox::new_send)));
222 items.push_back (MenuElem (_("Show send controls"), mem_fun(*this, &RedirectBox::show_send_controls)));
226 RedirectBox::show_send_controls ()
232 RedirectBox::new_send ()
238 RedirectBox::show_redirect_menu (gint arg)
240 if (redirect_menu == 0) {
241 redirect_menu = build_redirect_menu ();
244 paste_action->set_sensitive (!_rr_selection.redirects.empty());
246 redirect_menu->popup (1, 0);
250 RedirectBox::redirect_drag_begin (GdkDragContext *context)
252 redirect_drag_in_progress = true;
256 RedirectBox::redirect_drag_end (GdkDragContext *context)
258 redirect_drag_in_progress = false;
262 RedirectBox::redirect_button_press_event (GdkEventButton *ev)
265 TreeModel::Path path;
266 TreeViewColumn* column;
269 Redirect* redirect = 0;
271 bool selected = false;
273 if (redirect_display.get_path_at_pos ((int)ev->x, (int)ev->y, path, column, cellx, celly)) {
274 if ((iter = model->get_iter (path))) {
275 redirect = (*iter)[columns.redirect];
276 selected = redirect_display.get_selection()->is_selected (iter);
281 if (redirect && Keyboard::is_delete_event (ev)) {
283 Glib::signal_idle().connect (bind (mem_fun(*this, &RedirectBox::idle_delete_redirect), redirect));
286 } else if (redirect && (Keyboard::is_edit_event (ev) || (ev->button == 1 && ev->type == GDK_2BUTTON_PRESS && ev->state == 0))) {
288 if (_session.engine().connected()) {
289 /* XXX giving an error message here is hard, because we may be in the midst of a button press */
290 edit_redirect (redirect);
294 } else if (Keyboard::is_context_menu_event (ev)) {
296 show_redirect_menu(0);
299 } else if (redirect && ev->button == 2 && ev->state == 0) {
301 redirect->set_active (!redirect->active(), this);
310 RedirectBox::build_redirect_menu ()
312 redirect_menu = dynamic_cast<Gtk::Menu*>(ActionManager::get_widget("/redirectmenu") );
313 redirect_menu->set_name ("ArdourContextMenu");
317 return redirect_menu;
321 RedirectBox::selection_changed ()
323 bool sensitive = (redirect_display.get_selection()->count_selected_rows()) ? true : false;
324 ActionManager::set_sensitive (ActionManager::plugin_selection_sensitive_actions, sensitive);
328 RedirectBox::select_all_redirects ()
330 redirect_display.get_selection()->select_all();
334 RedirectBox::deselect_all_redirects ()
336 redirect_display.get_selection()->unselect_all();
340 RedirectBox::choose_plugin ()
342 sigc::connection newplug_connection = _plugin_selector.PluginCreated.connect (mem_fun(*this,&RedirectBox::insert_plugin_chosen));
343 _plugin_selector.show_all();
344 _plugin_selector.run ();
345 newplug_connection.disconnect();
349 RedirectBox::insert_plugin_chosen (Plugin *plugin)
353 Redirect *redirect = new PluginInsert (_session, *plugin, _placement);
355 redirect->active_changed.connect (mem_fun(*this, &RedirectBox::show_redirect_active));
357 uint32_t err_streams;
359 if (_route.add_redirect (redirect, this, &err_streams)) {
360 wierd_plugin_dialog (*plugin, err_streams, _route);
367 RedirectBox::wierd_plugin_dialog (Plugin& p, uint32_t streams, IO& io)
369 ArdourDialog dialog ("wierd plugin dialog");
372 /* i hate this kind of code */
374 if (streams > p.get_info().n_inputs) {
375 label.set_text (string_compose (_(
376 "You attempted to add a plugin (%1).\n"
377 "The plugin has %2 inputs\n"
378 "but at the insertion point, there are\n"
379 "%3 active signal streams.\n"
381 "This makes no sense - you are throwing away\n"
382 "part of the signal."),
384 p.get_info().n_inputs,
386 } else if (streams < p.get_info().n_inputs) {
387 label.set_text (string_compose (_(
388 "You attempted to add a plugin (%1).\n"
389 "The plugin has %2 inputs\n"
390 "but at the insertion point there are\n"
391 "only %3 active signal streams.\n"
393 "This makes no sense - unless the plugin supports\n"
394 "side-chain inputs. A future version of Ardour will\n"
395 "support this type of configuration."),
397 p.get_info().n_inputs,
400 label.set_text (string_compose (_(
401 "You attempted to add a plugin (%1).\n"
403 "The I/O configuration doesn't make sense:\n"
405 "The plugin has %2 inputs and %3 outputs.\n"
406 "The track/bus has %4 inputs and %5 outputs.\n"
407 "The insertion point, has %6 active signals.\n"
409 "Ardour does not understand what to do in such situations.\n"),
411 p.get_info().n_inputs,
412 p.get_info().n_outputs,
418 dialog.get_vbox()->pack_start (label);
419 dialog.add_button (Stock::OK, RESPONSE_ACCEPT);
421 dialog.set_name (X_("PluginIODialog"));
422 dialog.set_position (Gtk::WIN_POS_MOUSE);
423 dialog.set_modal (true);
428 //dialog.get_window()->set_decorations (Gdk::WMDecoration (GDK_DECOR_BORDER|GDK_DECOR_RESIZEH));
434 RedirectBox::choose_insert ()
436 Redirect *redirect = new PortInsert (_session, _placement);
437 redirect->active_changed.connect (mem_fun(*this, &RedirectBox::show_redirect_active));
438 _route.add_redirect (redirect, this);
442 RedirectBox::choose_send ()
444 Send *send = new Send (_session, _placement);
446 /* XXX need redirect lock on route */
448 send->ensure_io (0, _route.max_redirect_outs(), false, this);
450 IOSelectorWindow *ios = new IOSelectorWindow (_session, *send, false, true);
453 ios->selector().Finished.connect (bind (mem_fun(*this, &RedirectBox::send_io_finished), static_cast<Redirect*>(send), ios));
457 RedirectBox::send_io_finished (IOSelector::Result r, Redirect* redirect, IOSelectorWindow* ios)
460 case IOSelector::Cancelled:
464 case IOSelector::Accepted:
465 _route.add_redirect (redirect, this);
469 delete_when_idle (ios);
473 RedirectBox::redisplay_redirects (void *src)
475 ENSURE_GUI_THREAD(bind (mem_fun(*this, &RedirectBox::redisplay_redirects), src));
477 if (no_redirect_redisplay) {
481 ignore_delete = true;
483 ignore_delete = false;
485 redirect_active_connections.clear ();
486 redirect_name_connections.clear ();
488 _route.foreach_redirect (this, &RedirectBox::add_redirect_to_display);
490 switch (_placement) {
492 build_redirect_tooltip(redirect_eventbox, _("Pre-fader inserts, sends & plugins:"));
495 build_redirect_tooltip(redirect_eventbox, _("Post-fader inserts, sends & plugins:"));
501 RedirectBox::add_redirect_to_display (Redirect *redirect)
503 if (redirect->placement() != _placement) {
507 Gtk::TreeModel::Row row = *(model->append());
508 row[columns.text] = redirect_name (*redirect);
509 row[columns.redirect] = redirect;
511 show_redirect_active (redirect, this);
513 redirect_active_connections.push_back (redirect->active_changed.connect (mem_fun(*this, &RedirectBox::show_redirect_active)));
514 redirect_name_connections.push_back (redirect->name_changed.connect (bind (mem_fun(*this, &RedirectBox::show_redirect_name), redirect)));
518 RedirectBox::redirect_name (Redirect& redirect)
523 if (!redirect.active()) {
527 if ((send = dynamic_cast<Send *> (&redirect)) != 0) {
531 /* grab the send name out of its overall name */
533 string::size_type lbracket, rbracket;
534 lbracket = send->name().find ('[');
535 rbracket = send->name().find (']');
539 name_display += send->name().substr (lbracket+1, lbracket-rbracket-1);
542 name_display += short_version (send->name().substr (lbracket+1, lbracket-rbracket-1), 4);
550 name_display += redirect.name();
553 name_display += short_version (redirect.name(), 5);
559 if (!redirect.active()) {
567 RedirectBox::build_redirect_tooltip (EventBox& box, string start)
571 Gtk::TreeModel::Children children = model->children();
572 for(Gtk::TreeModel::Children::iterator iter = children.begin(); iter != children.end(); ++iter) {
573 Gtk::TreeModel::Row row = *iter;
575 tip += row[columns.text];
577 ARDOUR_UI::instance()->tooltips().set_tip (box, tip);
581 RedirectBox::show_redirect_name (void* src, Redirect *redirect)
583 ENSURE_GUI_THREAD(bind (mem_fun(*this, &RedirectBox::show_redirect_name), src, redirect));
585 show_redirect_active (redirect, src);
589 RedirectBox::show_redirect_active (Redirect *redirect, void *src)
591 ENSURE_GUI_THREAD(bind (mem_fun(*this, &RedirectBox::show_redirect_active), redirect, src));
593 Gtk::TreeModel::Children children = model->children();
594 Gtk::TreeModel::Children::iterator iter = children.begin();
596 while( iter != children.end())
598 if ((*iter)[columns.redirect] == redirect)
603 (*iter)[columns.text] = redirect_name (*redirect);
605 if (redirect->active()) {
606 (*iter)[columns.color] = *active_redirect_color;
608 (*iter)[columns.color] = *inactive_redirect_color;
613 RedirectBox::row_deleted (const Gtk::TreeModel::Path& path)
615 if (!ignore_delete) {
616 compute_redirect_sort_keys ();
621 RedirectBox::compute_redirect_sort_keys ()
623 uint32_t sort_key = 0;
624 Gtk::TreeModel::Children children = model->children();
626 for (Gtk::TreeModel::Children::iterator iter = children.begin(); iter != children.end(); ++iter) {
627 Redirect *redirect = (*iter)[columns.redirect];
628 redirect->set_sort_key (sort_key);
632 if (_route.sort_redirects ()) {
634 redisplay_redirects (0);
636 /* now tell them about the problem */
638 ArdourDialog dialog ("wierd plugin dialog");
642 You cannot reorder this set of redirects\n\
643 in that way because the inputs and\n\
644 outputs do not work correctly."));
646 dialog.get_vbox()->pack_start (label);
647 dialog.add_button (Stock::OK, RESPONSE_ACCEPT);
649 dialog.set_name (X_("PluginIODialog"));
650 dialog.set_position (Gtk::WIN_POS_MOUSE);
651 dialog.set_modal (true);
659 RedirectBox::rename_redirects ()
661 vector<Redirect*> to_be_renamed;
663 get_selected_redirects (to_be_renamed);
665 if (to_be_renamed.empty()) {
669 for (vector<Redirect*>::iterator i = to_be_renamed.begin(); i != to_be_renamed.end(); ++i) {
670 rename_redirect (*i);
675 RedirectBox::cut_redirects ()
677 vector<Redirect*> to_be_removed;
679 get_selected_redirects (to_be_removed);
681 if (to_be_removed.empty()) {
685 /* this essentially transfers ownership of the redirect
686 of the redirect from the route to the mixer
690 _rr_selection.set (to_be_removed);
692 for (vector<Redirect*>::iterator i = to_be_removed.begin(); i != to_be_removed.end(); ++i) {
694 void* gui = (*i)->get_gui ();
697 static_cast<Gtk::Widget*>(gui)->hide ();
700 if (_route.remove_redirect (*i, this)) {
702 _rr_selection.remove (*i);
709 RedirectBox::copy_redirects ()
711 vector<Redirect*> to_be_copied;
712 vector<Redirect*> copies;
714 get_selected_redirects (to_be_copied);
716 if (to_be_copied.empty()) {
720 for (vector<Redirect*>::iterator i = to_be_copied.begin(); i != to_be_copied.end(); ++i) {
721 copies.push_back (Redirect::clone (**i));
724 _rr_selection.set (copies);
728 RedirectBox::idle_delete_redirect (Redirect *redirect)
730 /* NOT copied to _mixer.selection() */
732 if (_route.remove_redirect (redirect, this)) {
742 RedirectBox::rename_redirect (Redirect* redirect)
744 ArdourPrompter name_prompter (true);
746 name_prompter.set_prompt (_("rename redirect"));
747 name_prompter.set_initial_text (redirect->name());
748 name_prompter.show_all ();
750 switch (name_prompter.run ()) {
752 case Gtk::RESPONSE_ACCEPT:
753 name_prompter.get_result (result);
754 if (result.length()) {
755 redirect->set_name (result, this);
765 RedirectBox::cut_redirect (Redirect *redirect)
767 /* this essentially transfers ownership of the redirect
768 of the redirect from the route to the mixer
772 _rr_selection.add (redirect);
774 void* gui = redirect->get_gui ();
777 static_cast<Gtk::Widget*>(gui)->hide ();
780 if (_route.remove_redirect (redirect, this)) {
781 _rr_selection.remove (redirect);
786 RedirectBox::copy_redirect (Redirect *redirect)
788 Redirect* copy = Redirect::clone (*redirect);
789 _rr_selection.add (copy);
793 RedirectBox::paste_redirects ()
795 if (_rr_selection.redirects.empty()) {
799 paste_redirect_list (_rr_selection.redirects);
803 RedirectBox::paste_redirect_list (list<Redirect*>& redirects)
805 list<Redirect*> copies;
807 for (list<Redirect*>::iterator i = redirects.begin(); i != redirects.end(); ++i) {
809 Redirect* copy = Redirect::clone (**i);
811 copy->set_placement (_placement, this);
812 copies.push_back (copy);
815 if (_route.add_redirects (copies, this)) {
816 for (list<Redirect*>::iterator i = copies.begin(); i != copies.end(); ++i) {
821 "Copying the set of redirects on the clipboard failed,\n\
822 probably because the I/O configuration of the plugins\n\
823 could not match the configuration of this track.");
824 MessageDialog am (msg);
830 RedirectBox::activate_redirect (Redirect *r)
832 r->set_active (true, 0);
836 RedirectBox::deactivate_redirect (Redirect *r)
838 r->set_active (false, 0);
842 RedirectBox::get_selected_redirects (vector<Redirect*>& redirects)
844 vector<Gtk::TreeModel::Path> pathlist = redirect_display.get_selection()->get_selected_rows();
846 for (vector<Gtk::TreeModel::Path>::iterator iter = pathlist.begin(); iter != pathlist.end(); ++iter)
847 redirects.push_back ((*(model->get_iter(*iter)))[columns.redirect]);
851 RedirectBox::for_selected_redirects (void (RedirectBox::*pmf)(Redirect*))
853 vector<Gtk::TreeModel::Path> pathlist = redirect_display.get_selection()->get_selected_rows();
855 for (vector<Gtk::TreeModel::Path>::iterator iter = pathlist.begin(); iter != pathlist.end(); ++iter) {
856 Redirect* redirect = (*(model->get_iter(*iter)))[columns.redirect];
857 (this->*pmf)(redirect);
862 RedirectBox::clone_redirects ()
864 RouteSelection& routes (_rr_selection.routes);
866 if (!routes.empty()) {
867 if (_route.copy_redirects (*routes.front(), _placement)) {
869 "Copying the set of redirects on the clipboard failed,\n\
870 probably because the I/O configuration of the plugins\n\
871 could not match the configuration of this track.");
872 MessageDialog am (msg);
879 RedirectBox::all_redirects_active (bool state)
881 _route.all_redirects_active (state);
885 RedirectBox::clear_redirects()
888 vector<string> choices;
890 if (dynamic_cast<AudioTrack*>(&_route) != 0) {
891 prompt = _("Do you really want to remove all redirects from this track?\n"
892 "(this cannot be undone)");
894 prompt = _("Do you really want to remove all redirects from this bus?\n"
895 "(this cannot be undone)");
898 choices.push_back (_("Yes, remove them all"));
899 choices.push_back (_("Cancel"));
901 Gtkmm2ext::Choice prompter (prompt, choices);
903 prompter.chosen.connect(sigc::ptr_fun(Gtk::Main::quit));
904 prompter.show_all ();
908 if (prompter.get_choice() == 0) {
909 _route.clear_redirects (this);
915 RedirectBox::edit_redirect (Redirect* redirect)
919 if (dynamic_cast<AudioTrack*>(&_route) != 0) {
921 if (dynamic_cast<AudioTrack*> (&_route)->freeze_state() == AudioTrack::Frozen) {
926 if ((insert = dynamic_cast<Insert *> (redirect)) == 0) {
930 if (!_session.engine().connected()) {
934 Send *send = dynamic_cast<Send*> (redirect);
936 SendUIWindow *send_ui;
938 if (send->get_gui() == 0) {
941 title = string_compose(_("ardour: %1"), send->name());
943 send_ui = new SendUIWindow (*send, _session);
944 send_ui->set_title (title);
945 send->set_gui (send_ui);
948 send_ui = reinterpret_cast<SendUIWindow *> (send->get_gui());
951 if (send_ui->is_visible()) {
952 send_ui->get_window()->raise ();
954 send_ui->show_all ();
961 PluginInsert *plugin_insert;
962 PortInsert *port_insert;
964 if ((plugin_insert = dynamic_cast<PluginInsert *> (insert)) != 0) {
966 PluginUIWindow *plugin_ui;
968 if (plugin_insert->get_gui() == 0) {
971 string maker = plugin_insert->plugin().maker();
972 string::size_type email_pos;
974 if ((email_pos = maker.find_first_of ('<')) != string::npos) {
975 maker = maker.substr (0, email_pos - 1);
978 if (maker.length() > 32) {
979 maker = maker.substr (0, 32);
983 title = string_compose(_("ardour: %1: %2 (by %3)"), _route.name(), plugin_insert->name(), maker);
985 plugin_ui = new PluginUIWindow (_session.engine(), *plugin_insert);
986 if (_owner_is_mixer) {
987 ARDOUR_UI::instance()->the_mixer()->ensure_float (*plugin_ui);
989 ARDOUR_UI::instance()->the_editor().ensure_float (*plugin_ui);
991 plugin_ui->set_title (title);
992 plugin_insert->set_gui (plugin_ui);
995 plugin_ui = reinterpret_cast<PluginUIWindow *> (plugin_insert->get_gui());
998 if (plugin_ui->is_visible()) {
999 plugin_ui->get_window()->raise ();
1001 plugin_ui->show_all ();
1004 } else if ((port_insert = dynamic_cast<PortInsert *> (insert)) != 0) {
1006 if (!_session.engine().connected()) {
1007 MessageDialog msg ( _("Not connected to JACK - no I/O changes are possible"));
1012 PortInsertWindow *io_selector;
1014 if (port_insert->get_gui() == 0) {
1015 io_selector = new PortInsertWindow (_session, *port_insert);
1016 port_insert->set_gui (io_selector);
1019 io_selector = reinterpret_cast<PortInsertWindow *> (port_insert->get_gui());
1022 if (io_selector->is_visible()) {
1023 io_selector->get_window()->raise ();
1025 io_selector->show_all ();
1032 RedirectBox::enter_box (GdkEventCrossing *ev, RedirectBox* rb)
1034 switch (ev->detail) {
1035 case GDK_NOTIFY_INFERIOR:
1038 case GDK_NOTIFY_VIRTUAL:
1042 _current_redirect_box = rb;
1049 RedirectBox::register_actions ()
1051 Glib::RefPtr<Gtk::ActionGroup> popup_act_grp = Gtk::ActionGroup::create(X_("redirectmenu"));
1052 Glib::RefPtr<Action> act;
1055 ActionManager::register_action (popup_act_grp, X_("newplugin"), _("New Plugin ..."), sigc::ptr_fun (RedirectBox::rb_choose_plugin));
1056 ActionManager::register_action (popup_act_grp, X_("newinsert"), _("New Insert"), sigc::ptr_fun (RedirectBox::rb_choose_insert));
1057 ActionManager::register_action (popup_act_grp, X_("newsend"), _("New Send ..."), sigc::ptr_fun (RedirectBox::rb_choose_send));
1058 ActionManager::register_action (popup_act_grp, X_("clear"), _("Clear"), sigc::ptr_fun (RedirectBox::rb_clear));
1060 /* standard editing stuff */
1061 act = ActionManager::register_action (popup_act_grp, X_("cut"), _("Cut"), sigc::ptr_fun (RedirectBox::rb_cut));
1062 ActionManager::plugin_selection_sensitive_actions.push_back(act);
1063 act = ActionManager::register_action (popup_act_grp, X_("copy"), _("Copy"), sigc::ptr_fun (RedirectBox::rb_copy));
1064 ActionManager::plugin_selection_sensitive_actions.push_back(act);
1065 paste_action = ActionManager::register_action (popup_act_grp, X_("paste"), _("Paste"), sigc::ptr_fun (RedirectBox::rb_paste));
1066 act = ActionManager::register_action (popup_act_grp, X_("rename"), _("Rename"), sigc::ptr_fun (RedirectBox::rb_rename));
1067 ActionManager::plugin_selection_sensitive_actions.push_back(act);
1068 ActionManager::register_action (popup_act_grp, X_("selectall"), _("Select All"), sigc::ptr_fun (RedirectBox::rb_select_all));
1069 ActionManager::register_action (popup_act_grp, X_("deselectall"), _("Deselect All"), sigc::ptr_fun (RedirectBox::rb_deselect_all));
1072 act = ActionManager::register_action (popup_act_grp, X_("activate"), _("Activate"), sigc::ptr_fun (RedirectBox::rb_activate));
1073 ActionManager::plugin_selection_sensitive_actions.push_back(act);
1074 act = ActionManager::register_action (popup_act_grp, X_("deactivate"), _("Deactivate"), sigc::ptr_fun (RedirectBox::rb_deactivate));
1075 ActionManager::plugin_selection_sensitive_actions.push_back(act);
1076 ActionManager::register_action (popup_act_grp, X_("activate_all"), _("Activate all"), sigc::ptr_fun (RedirectBox::rb_activate_all));
1077 ActionManager::register_action (popup_act_grp, X_("deactivate_all"), _("Deactivate all"), sigc::ptr_fun (RedirectBox::rb_deactivate_all));
1080 act = ActionManager::register_action (popup_act_grp, X_("edit"), _("Edit"), sigc::ptr_fun (RedirectBox::rb_edit));
1081 ActionManager::plugin_selection_sensitive_actions.push_back(act);
1083 ActionManager::add_action_group (popup_act_grp);
1087 RedirectBox::rb_choose_plugin ()
1089 if (_current_redirect_box == 0) {
1092 _current_redirect_box->choose_plugin ();
1096 RedirectBox::rb_choose_insert ()
1098 if (_current_redirect_box == 0) {
1101 _current_redirect_box->choose_insert ();
1105 RedirectBox::rb_choose_send ()
1107 if (_current_redirect_box == 0) {
1110 _current_redirect_box->choose_send ();
1114 RedirectBox::rb_clear ()
1116 if (_current_redirect_box == 0) {
1120 _current_redirect_box->clear_redirects ();
1124 RedirectBox::rb_cut ()
1126 if (_current_redirect_box == 0) {
1130 _current_redirect_box->cut_redirects ();
1134 RedirectBox::rb_copy ()
1136 if (_current_redirect_box == 0) {
1139 _current_redirect_box->copy_redirects ();
1143 RedirectBox::rb_paste ()
1145 if (_current_redirect_box == 0) {
1149 _current_redirect_box->paste_redirects ();
1153 RedirectBox::rb_rename ()
1155 if (_current_redirect_box == 0) {
1158 _current_redirect_box->rename_redirects ();
1162 RedirectBox::rb_select_all ()
1164 if (_current_redirect_box == 0) {
1168 _current_redirect_box->select_all_redirects ();
1172 RedirectBox::rb_deselect_all ()
1174 if (_current_redirect_box == 0) {
1178 _current_redirect_box->deselect_all_redirects ();
1182 RedirectBox::rb_activate ()
1184 if (_current_redirect_box == 0) {
1188 _current_redirect_box->for_selected_redirects (&RedirectBox::activate_redirect);
1192 RedirectBox::rb_deactivate ()
1194 if (_current_redirect_box == 0) {
1197 _current_redirect_box->for_selected_redirects (&RedirectBox::deactivate_redirect);
1201 RedirectBox::rb_activate_all ()
1203 if (_current_redirect_box == 0) {
1207 _current_redirect_box->all_redirects_active (true);
1211 RedirectBox::rb_deactivate_all ()
1213 if (_current_redirect_box == 0) {
1216 _current_redirect_box->all_redirects_active (false);
1220 RedirectBox::rb_edit ()
1222 if (_current_redirect_box == 0) {
1226 _current_redirect_box->for_selected_redirects (&RedirectBox::edit_redirect);