summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSampo Savolainen <v2@iki.fi>2007-04-11 17:53:42 +0000
committerSampo Savolainen <v2@iki.fi>2007-04-11 17:53:42 +0000
commit871a1f0e72327faac1816d1ebdc574e2f2ca4f5a (patch)
tree110c1d9c2037d8a142c3867c4cc61fb93f81e8f0
parent5dbc46cad3f0ab6ee967dfaafbabc997fcbbcc83 (diff)
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
-rw-r--r--gtk2_ardour/ardour.menus1
-rw-r--r--gtk2_ardour/redirect_box.cc64
-rw-r--r--gtk2_ardour/redirect_box.h2
-rw-r--r--libs/ardour/ardour/send.h2
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 @@
<menuitem action='cut'/>
<menuitem action='copy'/>
<menuitem action='paste'/>
+ <menuitem action='delete'/>
<separator/>
<menuitem action='rename'/>
<separator/>
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<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);
}
@@ -790,10 +794,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
@@ -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);
@@ -1232,6 +1270,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) {
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; }