diff options
author | Carl Hetherington <carl@carlh.net> | 2011-11-24 19:33:13 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2011-11-24 19:33:13 +0000 |
commit | e355b5df2726894eb81d1a45ff052022ecd09572 (patch) | |
tree | fe562df9e96eec66793bebba757c6489be8c6c3a /libs/ardour | |
parent | bfd3746be241d8c3fab8d152129d66128fc47d7c (diff) |
Add option to glue new regions to bars and beats (#4202).
git-svn-id: svn://localhost/ardour2/branches/3.0@10821 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour')
-rw-r--r-- | libs/ardour/ardour/session_configuration_vars.h | 1 | ||||
-rw-r--r-- | libs/ardour/audio_region_importer.cc | 6 | ||||
-rw-r--r-- | libs/ardour/region.cc | 5 | ||||
-rw-r--r-- | libs/ardour/region_factory.cc | 30 |
4 files changed, 36 insertions, 6 deletions
diff --git a/libs/ardour/ardour/session_configuration_vars.h b/libs/ardour/ardour/session_configuration_vars.h index 6a9d4a81e6..9d854ab2f8 100644 --- a/libs/ardour/ardour/session_configuration_vars.h +++ b/libs/ardour/ardour/session_configuration_vars.h @@ -63,3 +63,4 @@ CONFIG_VARIABLE (framecnt_t, timecode_offset, "timecode-offset", 0) CONFIG_VARIABLE (bool, timecode_offset_negative, "timecode-offset-negative", true) CONFIG_VARIABLE (bool, glue_new_markers_to_bars_and_beats, "glue-new-markers-to-bars-and-beats", false) CONFIG_VARIABLE (bool, midi_copy_is_fork, "midi-copy-is-fork", false) +CONFIG_VARIABLE (bool, glue_new_regions_to_bars_and_beats, "glue-new-regions-to-bars-and-beats", false) diff --git a/libs/ardour/audio_region_importer.cc b/libs/ardour/audio_region_importer.cc index 775bd0119f..6f6bd82501 100644 --- a/libs/ardour/audio_region_importer.cc +++ b/libs/ardour/audio_region_importer.cc @@ -317,7 +317,11 @@ AudioRegionImporter::prepare_region () } // create region and update XML - region.push_back (RegionFactory::create (source_list, xml_region)); + boost::shared_ptr<Region> r = RegionFactory::create (source_list, xml_region); + if (session.config.get_glue_new_regions_to_bars_and_beats ()) { + r->set_position_lock_style (MusicTime); + } + region.push_back (r); if (*region.begin()) { xml_region = (*region.begin())->get_state(); } else { diff --git a/libs/ardour/region.cc b/libs/ardour/region.cc index 5f5988a8bb..71aca0cce6 100644 --- a/libs/ardour/region.cc +++ b/libs/ardour/region.cc @@ -548,10 +548,6 @@ Region::set_position_lock_style (PositionLockStyle ps) boost::shared_ptr<Playlist> pl (playlist()); - if (!pl) { - return; - } - _position_lock_style = ps; if (_position_lock_style == MusicTime) { @@ -559,7 +555,6 @@ Region::set_position_lock_style (PositionLockStyle ps) } send_change (Properties::position_lock_style); - } } diff --git a/libs/ardour/region_factory.cc b/libs/ardour/region_factory.cc index fba60fe0a0..4243d44cb7 100644 --- a/libs/ardour/region_factory.cc +++ b/libs/ardour/region_factory.cc @@ -73,6 +73,11 @@ RegionFactory::create (boost::shared_ptr<const Region> region, bool announce) if (ret) { ret->set_name (new_region_name(ret->name())); + + if (ret->session().config.get_glue_new_regions_to_bars_and_beats ()) { + ret->set_position_lock_style (MusicTime); + } + map_add (ret); /* pure copy constructor - no property list */ @@ -111,6 +116,11 @@ RegionFactory::create (boost::shared_ptr<Region> region, const PropertyList& pli if (ret) { ret->apply_changes (plist); + + if (ret->session().config.get_glue_new_regions_to_bars_and_beats ()) { + ret->set_position_lock_style (MusicTime); + } + map_add (ret); if (announce) { @@ -148,6 +158,11 @@ RegionFactory::create (boost::shared_ptr<Region> region, frameoffset_t offset, c if (ret) { ret->apply_changes (plist); + + if (ret->session().config.get_glue_new_regions_to_bars_and_beats ()) { + ret->set_position_lock_style (MusicTime); + } + map_add (ret); if (announce) { @@ -185,6 +200,11 @@ RegionFactory::create (boost::shared_ptr<Region> region, const SourceList& srcs, if (ret) { ret->apply_changes (plist); + + if (ret->session().config.get_glue_new_regions_to_bars_and_beats ()) { + ret->set_position_lock_style (MusicTime); + } + map_add (ret); if (announce) { @@ -225,6 +245,11 @@ RegionFactory::create (const SourceList& srcs, const PropertyList& plist, bool a if (ret) { ret->apply_changes (plist); + + if (ret->session().config.get_glue_new_regions_to_bars_and_beats ()) { + ret->set_position_lock_style (MusicTime); + } + map_add (ret); if (announce) { @@ -268,6 +293,11 @@ RegionFactory::create (SourceList& srcs, const XMLNode& node) ret.reset (); } else { map_add (ret); + + /* Don't fiddle with position_lock_style here as the region + description is coming from XML. + */ + CheckNewRegion (ret); } } |