diff options
Diffstat (limited to 'gtk2_ardour/redirect_box.cc')
-rw-r--r-- | gtk2_ardour/redirect_box.cc | 88 |
1 files changed, 73 insertions, 15 deletions
diff --git a/gtk2_ardour/redirect_box.cc b/gtk2_ardour/redirect_box.cc index 6ef254dbb5..1c881c4838 100644 --- a/gtk2_ardour/redirect_box.cc +++ b/gtk2_ardour/redirect_box.cc @@ -761,15 +761,19 @@ RedirectBox::cut_redirects () no_redirect_redisplay = true; for (vector<boost::shared_ptr<Redirect> >::iterator i = to_be_removed.begin(); i != to_be_removed.end(); ++i) { + // Do not cut inserts or sends + if (boost::dynamic_pointer_cast<PluginInsert>((*i)) != 0) { + void* gui = (*i)->get_gui (); - void* gui = (*i)->get_gui (); - - if (gui) { - static_cast<Gtk::Widget*>(gui)->hide (); - } + if (gui) { + static_cast<Gtk::Widget*>(gui)->hide (); + } - if (_route->remove_redirect (*i, this)) { - /* removal failed */ + if (_route->remove_redirect (*i, this)) { + /* removal failed */ + _rr_selection.remove (*i); + } + } else { _rr_selection.remove (*i); } @@ -791,10 +795,40 @@ RedirectBox::copy_redirects () } for (vector<boost::shared_ptr<Redirect> >::iterator i = to_be_copied.begin(); i != to_be_copied.end(); ++i) { - copies.push_back (Redirect::clone (*i)); + // Do not copy inserts or sends + if (boost::dynamic_pointer_cast<PluginInsert>((*i)) != 0) { + copies.push_back (Redirect::clone (*i)); + } } _rr_selection.set (copies); + +} + +void +RedirectBox::delete_redirects () +{ + vector<boost::shared_ptr<Redirect> > to_be_deleted; + + get_selected_redirects (to_be_deleted); + + if (to_be_deleted.empty()) { + return; + } + + for (vector<boost::shared_ptr<Redirect> >::iterator i = to_be_deleted.begin(); i != to_be_deleted.end(); ++i) { + + void* gui = (*i)->get_gui (); + + if (gui) { + static_cast<Gtk::Widget*>(gui)->hide (); + } + + _route->remove_redirect( *i, this); + } + + no_redirect_redisplay = false; + redisplay_redirects (this); } gint @@ -958,21 +992,31 @@ could not match the configuration of this track."); void RedirectBox::all_redirects_active (bool state) { - _route->all_redirects_active (state); + _route->all_redirects_active (_placement, state); } void -RedirectBox::clear_redirects() +RedirectBox::clear_redirects () { string prompt; vector<string> choices; if (boost::dynamic_pointer_cast<AudioTrack>(_route) != 0) { - prompt = _("Do you really want to remove all redirects from this track?\n" - "(this cannot be undone)"); + if (_placement == PreFader) { + prompt = _("Do you really want to remove all pre-fader redirects from this track?\n" + "(this cannot be undone)"); + } else { + prompt = _("Do you really want to remove all post-fader redirects from this track?\n" + "(this cannot be undone)"); + } } else { - prompt = _("Do you really want to remove all redirects from this bus?\n" - "(this cannot be undone)"); + if (_placement == PreFader) { + prompt = _("Do you really want to remove all pre-fader redirects from this bus?\n" + "(this cannot be undone)"); + } else { + prompt = _("Do you really want to remove all post-fader redirects from this bus?\n" + "(this cannot be undone)"); + } } choices.push_back (_("Cancel")); @@ -981,7 +1025,7 @@ RedirectBox::clear_redirects() Gtkmm2ext::Choice prompter (prompt, choices); if (prompter.run () == 1) { - _route->clear_redirects (this); + _route->clear_redirects (_placement, this); } } @@ -1153,6 +1197,10 @@ RedirectBox::register_actions () ActionManager::plugin_selection_sensitive_actions.push_back(act); act = ActionManager::register_action (popup_act_grp, X_("copy"), _("Copy"), sigc::ptr_fun (RedirectBox::rb_copy)); ActionManager::plugin_selection_sensitive_actions.push_back(act); + + act = ActionManager::register_action (popup_act_grp, X_("delete"), _("Delete"), sigc::ptr_fun (RedirectBox::rb_delete)); + ActionManager::plugin_selection_sensitive_actions.push_back(act); // ?? + paste_action = ActionManager::register_action (popup_act_grp, X_("paste"), _("Paste"), sigc::ptr_fun (RedirectBox::rb_paste)); act = ActionManager::register_action (popup_act_grp, X_("rename"), _("Rename"), sigc::ptr_fun (RedirectBox::rb_rename)); ActionManager::plugin_selection_sensitive_actions.push_back(act); @@ -1224,6 +1272,16 @@ RedirectBox::rb_cut () } void +RedirectBox::rb_delete () +{ + if (_current_redirect_box == 0) { + return; + } + + _current_redirect_box->delete_redirects (); +} + +void RedirectBox::rb_copy () { if (_current_redirect_box == 0) { |