From 76d85fb411127ead58155085b9b7d4c08d895113 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Sat, 22 Dec 2012 18:27:33 +0000 Subject: [PATCH] add Delete button to patch change dialog when editing it git-svn-id: svn://localhost/ardour2/branches/3.0@13710 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/editor_selection.cc | 3 +++ gtk2_ardour/midi_region_view.cc | 12 ++++++++++-- gtk2_ardour/patch_change_dialog.cc | 6 +++++- gtk2_ardour/patch_change_dialog.h | 3 ++- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/gtk2_ardour/editor_selection.cc b/gtk2_ardour/editor_selection.cc index 7ee19bdcec..41652196f1 100644 --- a/gtk2_ardour/editor_selection.cc +++ b/gtk2_ardour/editor_selection.cc @@ -1141,6 +1141,9 @@ Editor::sensitize_the_right_region_actions () _region_actions->get_action("show-region-properties")->set_sensitive (false); _region_actions->get_action("rename-region")->set_sensitive (false); if (have_audio) { + /* XXX need to check whether there is than 1 per + playlist, because otherwise this makes no sense. + */ _region_actions->get_action("combine-regions")->set_sensitive (true); } else { _region_actions->get_action("combine-regions")->set_sensitive (false); diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc index eb94989fb0..54a0bc4f2d 100644 --- a/gtk2_ardour/midi_region_view.cc +++ b/gtk2_ardour/midi_region_view.cc @@ -3783,11 +3783,19 @@ MidiRegionView::trim_front_ending () void MidiRegionView::edit_patch_change (ArdourCanvas::CanvasPatchChange* pc) { - PatchChangeDialog d (&_source_relative_time_converter, trackview.session(), *pc->patch (), instrument_info(), Gtk::Stock::APPLY); + PatchChangeDialog d (&_source_relative_time_converter, trackview.session(), *pc->patch (), instrument_info(), Gtk::Stock::APPLY, true); d.set_position (Gtk::WIN_POS_MOUSE); + + int response = d.run(); - if (d.run () != Gtk::RESPONSE_ACCEPT) { + switch (response) { + case Gtk::RESPONSE_ACCEPT: + break; + case Gtk::RESPONSE_REJECT: + delete_patch_change (pc); + return; + default: return; } diff --git a/gtk2_ardour/patch_change_dialog.cc b/gtk2_ardour/patch_change_dialog.cc index a7fc024a8f..97fcb39ae6 100644 --- a/gtk2_ardour/patch_change_dialog.cc +++ b/gtk2_ardour/patch_change_dialog.cc @@ -44,7 +44,8 @@ PatchChangeDialog::PatchChangeDialog ( ARDOUR::Session* session, Evoral::PatchChange const & patch, ARDOUR::InstrumentInfo& info, - const Gtk::BuiltinStockID& ok + const Gtk::BuiltinStockID& ok, + bool allow_delete ) : ArdourDialog (_("Patch Change"), true) , _time_converter (tc) @@ -114,6 +115,9 @@ PatchChangeDialog::PatchChangeDialog ( add_button (Stock::CANCEL, RESPONSE_CANCEL); add_button (ok, RESPONSE_ACCEPT); + if (allow_delete) { + add_button (Stock::DELETE, RESPONSE_REJECT); + } set_default_response (RESPONSE_ACCEPT); fill_bank_combo (); diff --git a/gtk2_ardour/patch_change_dialog.h b/gtk2_ardour/patch_change_dialog.h index 0d02112091..c462ff0c77 100644 --- a/gtk2_ardour/patch_change_dialog.h +++ b/gtk2_ardour/patch_change_dialog.h @@ -45,7 +45,8 @@ public: ARDOUR::Session *, Evoral::PatchChange const &, ARDOUR::InstrumentInfo&, - const Gtk::BuiltinStockID & + const Gtk::BuiltinStockID &, + bool allow_delete = false ); Evoral::PatchChange patch () const;