make insert-patch-change from context menu use context click event for position (fixes #4570)

git-svn-id: svn://localhost/ardour2/branches/3.0@11113 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2011-12-30 01:50:34 +00:00
parent 21d4eb56d4
commit 976e163406
4 changed files with 12 additions and 5 deletions

View File

@ -615,7 +615,7 @@
<menuitem action='lower-region-to-bottom'/> <menuitem action='lower-region-to-bottom'/>
</menu> </menu>
<menu action='RegionMenuMIDI'> <menu action='RegionMenuMIDI'>
<menuitem action='insert-patch-change'/> <menuitem action='insert-patch-change-context'/>
<menuitem action='quantize-region'/> <menuitem action='quantize-region'/>
<menuitem action='fork-region'/> <menuitem action='fork-region'/>
<menuitem action='show-region-list-editor'/> <menuitem action='show-region-list-editor'/>

View File

@ -1146,7 +1146,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void reset_region_scale_amplitude (); void reset_region_scale_amplitude ();
void adjust_region_gain (bool up); void adjust_region_gain (bool up);
void quantize_region (); void quantize_region ();
void insert_patch_change (); void insert_patch_change (bool from_context);
void fork_region (); void fork_region ();
void do_insert_time (); void do_insert_time ();

View File

@ -1402,7 +1402,8 @@ Editor::register_region_actions ()
); );
reg_sens (_region_actions, "quantize-region", _("Quantize..."), sigc::mem_fun (*this, &Editor::quantize_region)); reg_sens (_region_actions, "quantize-region", _("Quantize..."), sigc::mem_fun (*this, &Editor::quantize_region));
reg_sens (_region_actions, "insert-patch-change", _("Insert Patch Change..."), sigc::mem_fun (*this, &Editor::insert_patch_change)); reg_sens (_region_actions, "insert-patch-change", _("Insert Patch Change..."), sigc::bind (sigc::mem_fun (*this, &Editor::insert_patch_change), false));
reg_sens (_region_actions, "insert-patch-change-context", _("Insert Patch Change..."), sigc::bind (sigc::mem_fun (*this, &Editor::insert_patch_change), true));
reg_sens (_region_actions, "fork-region", _("Fork"), sigc::mem_fun (*this, &Editor::fork_region)); reg_sens (_region_actions, "fork-region", _("Fork"), sigc::mem_fun (*this, &Editor::fork_region));
reg_sens (_region_actions, "strip-region-silence", _("Strip Silence..."), sigc::mem_fun (*this, &Editor::strip_region_silence)); reg_sens (_region_actions, "strip-region-silence", _("Strip Silence..."), sigc::mem_fun (*this, &Editor::strip_region_silence));
reg_sens (_region_actions, "set-selection-from-region", _("Set Range Selection"), sigc::mem_fun (*this, &Editor::set_selection_from_region)); reg_sens (_region_actions, "set-selection-from-region", _("Set Range Selection"), sigc::mem_fun (*this, &Editor::set_selection_from_region));

View File

@ -4555,14 +4555,20 @@ Editor::quantize_region ()
} }
void void
Editor::insert_patch_change () Editor::insert_patch_change (bool from_context)
{ {
RegionSelection rs = get_regions_from_selection_and_entered (); RegionSelection rs = get_regions_from_selection_and_entered ();
if (rs.empty ()) { if (rs.empty ()) {
return; return;
} }
framepos_t const p = get_preferred_edit_position (false); framepos_t p;
if (!from_context) {
p = get_preferred_edit_position (false);
} else {
p = event_frame (&context_click_event, 0, 0);
}
Evoral::PatchChange<Evoral::MusicalTime> empty (0, 0, 0, 0); Evoral::PatchChange<Evoral::MusicalTime> empty (0, 0, 0, 0);
PatchChangeDialog d (0, _session, empty, Gtk::Stock::ADD); PatchChangeDialog d (0, _session, empty, Gtk::Stock::ADD);