From 871a1f0e72327faac1816d1ebdc574e2f2ca4f5a Mon Sep 17 00:00:00 2001 From: Sampo Savolainen Date: Wed, 11 Apr 2007 17:53:42 +0000 Subject: Prevent copy & paste of sends and inserts. Add "delete" command to the redirect box. Notice to translators: this text needs to be translated. I apologize for the inconvenience, but something had to be done to this issue. git-svn-id: svn://localhost/ardour2/trunk@1702 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/ardour.menus | 1 + gtk2_ardour/redirect_box.cc | 64 +++++++++++++++++++++++++++++++++++++++------ gtk2_ardour/redirect_box.h | 2 ++ libs/ardour/ardour/send.h | 2 +- 4 files changed, 60 insertions(+), 9 deletions(-) diff --git a/gtk2_ardour/ardour.menus b/gtk2_ardour/ardour.menus index e7463553d2..9b857b5a52 100644 --- a/gtk2_ardour/ardour.menus +++ b/gtk2_ardour/ardour.menus @@ -369,6 +369,7 @@ + diff --git a/gtk2_ardour/redirect_box.cc b/gtk2_ardour/redirect_box.cc index d3e616eb0b..687ae0805d 100644 --- a/gtk2_ardour/redirect_box.cc +++ b/gtk2_ardour/redirect_box.cc @@ -760,15 +760,19 @@ RedirectBox::cut_redirects () no_redirect_redisplay = true; for (vector >::iterator i = to_be_removed.begin(); i != to_be_removed.end(); ++i) { + // Do not cut inserts or sends + if (boost::dynamic_pointer_cast((*i)) != 0) { + void* gui = (*i)->get_gui (); - void* gui = (*i)->get_gui (); - - if (gui) { - static_cast(gui)->hide (); - } + if (gui) { + static_cast(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); } @@ -790,10 +794,40 @@ RedirectBox::copy_redirects () } for (vector >::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((*i)) != 0) { + copies.push_back (Redirect::clone (*i)); + } } _rr_selection.set (copies); + +} + +void +RedirectBox::delete_redirects () +{ + vector > to_be_deleted; + + get_selected_redirects (to_be_deleted); + + if (to_be_deleted.empty()) { + return; + } + + for (vector >::iterator i = to_be_deleted.begin(); i != to_be_deleted.end(); ++i) { + + void* gui = (*i)->get_gui (); + + if (gui) { + static_cast(gui)->hide (); + } + + _route->remove_redirect( *i, this); + } + + no_redirect_redisplay = false; + redisplay_redirects (this); } gint @@ -1161,6 +1195,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); @@ -1231,6 +1269,16 @@ RedirectBox::rb_cut () _current_redirect_box->cut_redirects (); } +void +RedirectBox::rb_delete () +{ + if (_current_redirect_box == 0) { + return; + } + + _current_redirect_box->delete_redirects (); +} + void RedirectBox::rb_copy () { diff --git a/gtk2_ardour/redirect_box.h b/gtk2_ardour/redirect_box.h index 7e93efee1b..cb126dc13f 100644 --- a/gtk2_ardour/redirect_box.h +++ b/gtk2_ardour/redirect_box.h @@ -174,6 +174,7 @@ class RedirectBox : public Gtk::HBox void cut_redirects (); void copy_redirects (); void paste_redirects (); + void delete_redirects (); void clear_redirects (); void clone_redirects (); void rename_redirects (); @@ -207,6 +208,7 @@ class RedirectBox : public Gtk::HBox static void rb_cut (); static void rb_copy (); static void rb_paste (); + static void rb_delete (); static void rb_rename (); static void rb_select_all (); static void rb_deselect_all (); diff --git a/libs/ardour/ardour/send.h b/libs/ardour/ardour/send.h index 7f88f0624f..92e4fdade2 100644 --- a/libs/ardour/ardour/send.h +++ b/libs/ardour/ardour/send.h @@ -38,7 +38,7 @@ class Send : public Redirect Send (Session&, Placement); Send (Session&, const XMLNode&); Send (const Send&); - ~Send (); + virtual ~Send (); uint32_t bit_slot() const { return bitslot; } -- cgit v1.2.3