mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 14:54:56 +01:00
Deinterlace MIDI: gui part
This commit is contained in:
parent
11543b1c9b
commit
84111a343e
5 changed files with 59 additions and 6 deletions
|
|
@ -334,6 +334,7 @@
|
|||
<menuitem action='remove-overlap'/>
|
||||
<menuitem action='transform-region'/>
|
||||
<menuitem action='fork-region'/>
|
||||
<menuitem action='deinterlace-midi'/>
|
||||
<menuitem action='show-region-list-editor'/>
|
||||
</menu>
|
||||
<menu action='RegionMenuGain'>
|
||||
|
|
@ -817,6 +818,7 @@
|
|||
<menuitem action='remove-overlap'/>
|
||||
<menuitem action='transform-region'/>
|
||||
<menuitem action='fork-region'/>
|
||||
<menuitem action='deinterlace-midi'/>
|
||||
<menuitem action='show-region-list-editor'/>
|
||||
</menu>
|
||||
<menu action='RegionMenuPosition'>
|
||||
|
|
|
|||
|
|
@ -1320,6 +1320,7 @@ private:
|
|||
void align_region_internal (boost::shared_ptr<ARDOUR::Region>, ARDOUR::RegionPoint point, Temporal::timepos_t const & position);
|
||||
void recover_regions (ARDOUR::RegionList);
|
||||
void remove_selected_regions ();
|
||||
void remove_regions (const RegionSelection&, bool can_ripple, bool as_part_of_other_command);
|
||||
void remove_clicked_region ();
|
||||
void show_region_properties ();
|
||||
void show_midi_list_editor ();
|
||||
|
|
@ -1343,6 +1344,8 @@ private:
|
|||
void quantize_regions (const RegionSelection& rs);
|
||||
void legatize_region (bool shrink_only);
|
||||
void legatize_regions (const RegionSelection& rs, bool shrink_only);
|
||||
void deinterlace_midi_regions (const RegionSelection& rs);
|
||||
void deinterlace_selected_midi_regions ();
|
||||
void transform_region ();
|
||||
void transform_regions (const RegionSelection& rs);
|
||||
void transpose_region ();
|
||||
|
|
|
|||
|
|
@ -1874,6 +1874,7 @@ Editor::register_region_actions ()
|
|||
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "quantize-region", _("Quantize..."), sigc::mem_fun (*this, &Editor::quantize_region));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "legatize-region", _("Legatize"), sigc::bind(sigc::mem_fun (*this, &Editor::legatize_region), false));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "deinterlace-midi", _("Deinterlace Into Layers"), sigc::mem_fun (*this, &Editor::deinterlace_selected_midi_regions));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "transform-region", _("Transform..."), sigc::mem_fun (*this, &Editor::transform_region));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "remove-overlap", _("Remove Overlap"), sigc::bind(sigc::mem_fun (*this, &Editor::legatize_region), true));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "insert-patch-change", _("Insert Patch Change..."), sigc::bind (sigc::mem_fun (*this, &Editor::insert_patch_change), false));
|
||||
|
|
|
|||
|
|
@ -4627,16 +4627,26 @@ Editor::recover_regions (ARDOUR::RegionList regions)
|
|||
}
|
||||
|
||||
|
||||
/** Remove the selected regions */
|
||||
/** This is an editor Action, called with no arguments */
|
||||
void
|
||||
Editor::remove_selected_regions ()
|
||||
{
|
||||
RegionSelection rs = get_regions_from_selection_and_entered ();
|
||||
|
||||
if (!_session || rs.empty()) {
|
||||
remove_regions (rs, true /*can_ripple*/, false /*as_part_of_other_command*/);
|
||||
}
|
||||
|
||||
/** Remove region(s) from their associated playlists */
|
||||
void
|
||||
Editor::remove_regions (const RegionSelection& sel, bool can_ripple, bool as_part_of_other_command)
|
||||
{
|
||||
if (!_session || sel.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* make a local copy */
|
||||
RegionSelection rs = sel;
|
||||
|
||||
list<boost::shared_ptr<Region> > regions_to_remove;
|
||||
|
||||
for (RegionSelection::iterator i = rs.begin(); i != rs.end(); ++i) {
|
||||
|
|
@ -4675,7 +4685,7 @@ Editor::remove_selected_regions ()
|
|||
playlist->freeze ();
|
||||
playlist->remove_region (*rl);
|
||||
|
||||
if (should_ripple()) {
|
||||
if (can_ripple && should_ripple()) {
|
||||
do_ripple (playlist, (*rl)->position(), -(*rl)->length(), boost::shared_ptr<Region>(), false);
|
||||
}
|
||||
}
|
||||
|
|
@ -4690,7 +4700,7 @@ Editor::remove_selected_regions ()
|
|||
so we need to do a recursive diff here.
|
||||
*/
|
||||
|
||||
if (!in_command) {
|
||||
if (!in_command && !as_part_of_other_command) {
|
||||
begin_reversible_command (_("remove region"));
|
||||
in_command = true;
|
||||
}
|
||||
|
|
@ -4701,7 +4711,7 @@ Editor::remove_selected_regions ()
|
|||
_session->add_command(new StatefulDiffCommand (*pl));
|
||||
}
|
||||
|
||||
if (in_command) {
|
||||
if (in_command && !as_part_of_other_command) {
|
||||
commit_reversible_command ();
|
||||
}
|
||||
}
|
||||
|
|
@ -5839,6 +5849,43 @@ Editor::legatize_region (bool shrink_only)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
Editor::deinterlace_midi_regions (const RegionSelection& rs)
|
||||
{
|
||||
begin_reversible_command (_("de-interlace midi"));
|
||||
|
||||
RegionSelection rcopy = rs;
|
||||
if (_session) {
|
||||
|
||||
for (RegionSelection::iterator i = rcopy.begin (); i != rcopy.end(); i++) {
|
||||
MidiRegionView* const mrv = dynamic_cast<MidiRegionView*> (*i);
|
||||
if (mrv) {
|
||||
XMLNode& before (mrv->region()->playlist()->get_state());
|
||||
|
||||
/* pass the regions to deinterlace_midi_region*/
|
||||
_session->deinterlace_midi_region(mrv->midi_region());
|
||||
|
||||
XMLNode& after (mrv->region()->playlist()->get_state());
|
||||
_session->add_command (new MementoCommand<Playlist>(*(mrv->region()->playlist()), &before, &after));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Remove the original region(s) safely, without rippling, as part of this command */
|
||||
remove_regions(rs, false /*can_ripple*/, true /*as_part_of_other_command*/);
|
||||
|
||||
commit_reversible_command ();
|
||||
}
|
||||
|
||||
void
|
||||
Editor::deinterlace_selected_midi_regions ()
|
||||
{
|
||||
if (_session) {
|
||||
RegionSelection rs = get_regions_from_selection_and_entered ();
|
||||
deinterlace_midi_regions(rs);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Editor::legatize_regions (const RegionSelection& rs, bool shrink_only)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -767,7 +767,7 @@ EditorSources::remove_selected_sources ()
|
|||
|
||||
}
|
||||
|
||||
_editor->remove_selected_regions(); // this operation is undo-able
|
||||
_editor->remove_regions( _editor->get_regions_from_selection_and_entered(), false /*can_ripple*/, false /*as_part_of_other_command*/); // this operation is undo-able
|
||||
|
||||
if (opt==2) {
|
||||
for (std::list<boost::weak_ptr<ARDOUR::Source> >::iterator i = to_be_removed.begin(); i != to_be_removed.end(); ++i) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue