13
0

add action to "promote" region cue markers to global marks

This commit is contained in:
Paul Davis 2021-05-25 13:56:42 -06:00
parent 232af15b51
commit 8774740e72
5 changed files with 42 additions and 0 deletions

View File

@ -363,6 +363,8 @@
<menu action='RegionMenuMarkers'> <menu action='RegionMenuMarkers'>
<menuitem action='add-region-cue-marker'/> <menuitem action='add-region-cue-marker'/>
<menuitem action='clear-region-cue-markers'/> <menuitem action='clear-region-cue-markers'/>
<separator/>
<menuitem action='make-region-markers-global'/>
</menu> </menu>
<menu action='RegionMenuTrim'> <menu action='RegionMenuTrim'>
<menuitem action='trim-front'/> <menuitem action='trim-front'/>

View File

@ -2958,6 +2958,8 @@ what you would like to do.\n"), PROGRAM_NAME));
image->show(); image->show();
hbox->show(); hbox->show();
Splash::instance()->hide ();
switch (dialog.run ()) { switch (dialog.run ()) {
case RESPONSE_ACCEPT: case RESPONSE_ACCEPT:
return 1; return 1;

View File

@ -588,6 +588,7 @@ public:
void add_region_marker (); void add_region_marker ();
void clear_region_markers (); void clear_region_markers ();
void remove_region_marker (ARDOUR::CueMarker&); void remove_region_marker (ARDOUR::CueMarker&);
void make_region_markers_global ();
protected: protected:
void map_transport_state (); void map_transport_state ();

View File

@ -1654,6 +1654,7 @@ Editor::register_region_actions ()
/* PART 3: actions that operate on the selection and also require the edit point location */ /* PART 3: actions that operate on the selection and also require the edit point location */
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EditPointRegions), "make-region-markers-global", _("Convert Region Cue Markers to Global Markers"), sigc::mem_fun (*this, &Editor::make_region_markers_global));
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EditPointRegions), "add-region-cue-marker", _("Add Region Cue Marker"), sigc::mem_fun (*this, &Editor::add_region_marker)); register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EditPointRegions), "add-region-cue-marker", _("Add Region Cue Marker"), sigc::mem_fun (*this, &Editor::add_region_marker));
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EditPointRegions), "clear-region-cue-markers", _("Clear Region Cue Markers"), sigc::mem_fun (*this, &Editor::clear_region_markers)); register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EditPointRegions), "clear-region-cue-markers", _("Clear Region Cue Markers"), sigc::mem_fun (*this, &Editor::clear_region_markers));
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EditPointRegions), "set-region-sync-position", _("Set Sync Position"), sigc::mem_fun (*this, &Editor::set_region_sync_position)); register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EditPointRegions), "set-region-sync-position", _("Set Sync Position"), sigc::mem_fun (*this, &Editor::set_region_sync_position));

View File

@ -8838,3 +8838,39 @@ Editor::clear_region_markers ()
} }
} }
void
Editor::make_region_markers_global ()
{
RegionSelection rs = get_regions_from_selection_and_edit_point ();
XMLNode& before (_session->locations()->get_state());
bool in_command = false;
for (RegionSelection::iterator r = rs.begin(); r != rs.end(); ++r) {
CueMarkers cues;
(*r)->region()->get_cue_markers (cues, true);
if (!cues.empty()) {
if (!in_command) {
in_command = true;
}
for (CueMarkers::iterator cm = cues.begin(); cm != cues.end(); ++cm) {
/* marker position is absolute within source */
const samplepos_t absolute_pos = (cm->position() - (*r)->region()->start()) + (*r)->region()->position();
Location* loc = new Location (*_session, absolute_pos, absolute_pos, cm->text(), Location::IsMark);
_session->locations()->add (loc, false);
}
}
cues.clear ();
}
if (in_command) {
XMLNode& after (_session->locations()->get_state());
begin_reversible_command (_("region markers -> global markers"));
_session->add_command (new MementoCommand<Locations> (*(_session->locations()), &before, &after));
commit_reversible_command ();
}
}