Prompt user when deleting a VCA (amends 01c6f5)

Editor::remove_tracks expected the VCA to be selected, but right-click does not force selection in a VCA strip.
This commit is contained in:
Ben Loftis 2020-02-18 20:41:23 -06:00
parent d6315618da
commit 4f9a91cab8
1 changed files with 37 additions and 2 deletions

View File

@ -36,7 +36,6 @@
#include "floating_text_entry.h"
#include "gui_thread.h"
#include "mixer_ui.h"
#include "public_editor.h"
#include "ui_config.h"
#include "utils.h"
#include "vca_master_strip.h"
@ -469,7 +468,7 @@ VCAMasterStrip::build_context_menu ()
items.push_back (SeparatorElem());
items.push_back (MenuElem (_("Drop All Slaves"), sigc::mem_fun (*this, &VCAMasterStrip::drop_all_slaves)));
items.push_back (SeparatorElem());
items.push_back (MenuElem (_("Remove"), sigc::mem_fun(PublicEditor::instance(), &PublicEditor::remove_tracks)));
items.push_back (MenuElem (_("Remove"), sigc::mem_fun (*this, &VCAMasterStrip::remove)));
}
void
@ -494,6 +493,42 @@ VCAMasterStrip::spill_change (boost::shared_ptr<Stripable> vca)
}
}
void
VCAMasterStrip::remove ()
{
if (!_session) {
return;
}
ArdourMessageDialog checker (_("Do you really want to remove this VCA?"),
true,
Gtk::MESSAGE_QUESTION,
Gtk::BUTTONS_NONE);
string title = string_compose (_("Remove %1"), "VCA");
checker.set_title (title);
checker.set_secondary_text(_("This action cannot be undone."));
checker.add_button (_("No, do nothing."), RESPONSE_CANCEL);
checker.add_button (_("Yes, remove it."), RESPONSE_ACCEPT);
checker.set_default_response (RESPONSE_CANCEL);
checker.set_name (X_("RemoveVcaDialog"));
checker.set_wmclass (X_("ardour_vca_remove"), PROGRAM_NAME);
checker.set_position (Gtk::WIN_POS_MOUSE);
switch (checker.run()) {
case RESPONSE_ACCEPT:
break;
default:
return;
}
checker.hide();
_session->vca_manager().remove_vca (_vca);
}
void
VCAMasterStrip::assign_all_selected ()
{