missing part of lincoln's patch
authorPaul Davis <paul@linuxaudiosystems.com>
Tue, 21 Sep 2010 03:09:24 +0000 (03:09 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Tue, 21 Sep 2010 03:09:24 +0000 (03:09 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@7819 d708f5d6-7413-0410-9779-e7cbd77b26cf

libs/ardour/ardour/region_factory.h
libs/ardour/audioregion.cc
libs/ardour/playlist.cc
libs/ardour/region_factory.cc

index 459699d810c8959014eb34ecc523300eebc56012..e99b9c80dfd780e4be140be61559878809822b42 100644 (file)
@@ -56,7 +56,7 @@ class RegionFactory {
        static PBD::Signal1<void,boost::shared_ptr<Region> >  CheckNewRegion;
 
        /** create a "pure copy" of Region @param other */
-       static boost::shared_ptr<Region> create (boost::shared_ptr<const Region> other);
+       static boost::shared_ptr<Region> create (boost::shared_ptr<const Region> other, bool announce = false);
 
        /** create a region from a single Source */
        static boost::shared_ptr<Region> create (boost::shared_ptr<Source>, 
index afd4456cdd8124e55e2f6dbdf276fe9aa793780e..e4c4b55a545defccc9fd7f0fe25039c41738d734 100644 (file)
@@ -116,8 +116,10 @@ AudioRegion::init ()
 {
        register_properties ();
 
+       suspend_property_changes();
        set_default_fades ();
        set_default_envelope ();
+       resume_property_changes();
 
        listen_to_my_curves ();
        connect_to_analysis_changed ();
@@ -958,6 +960,8 @@ AudioRegion::recompute_at_end ()
        _envelope->truncate_end (_length);
        _envelope->set_max_xval (_length);
         _envelope->thaw ();
+       
+       suspend_property_changes();
 
         if (_left_of_split) {
                 set_default_fade_out ();
@@ -971,6 +975,8 @@ AudioRegion::recompute_at_end ()
                _fade_in->extend_to (_length);
                send_change (PropertyChange (Properties::fade_in));
        }
+       
+       resume_property_changes();
 }
 
 void
@@ -979,6 +985,8 @@ AudioRegion::recompute_at_start ()
        /* as above, but the shift was from the front */
 
        _envelope->truncate_start (_length);
+       
+       suspend_property_changes();
 
         if (_right_of_split) {
                 set_default_fade_in ();
@@ -992,6 +1000,8 @@ AudioRegion::recompute_at_start ()
                _fade_out->extend_to (_length);
                send_change (PropertyChange (Properties::fade_out));
        }
+       
+       resume_property_changes();
 }
 
 int
index 614c0f5e36848227ce7bf8980f963ac78e324491..4dda4f5c52b609c81fb8b96c3e69e53b62bcd597 100644 (file)
@@ -324,7 +324,7 @@ Playlist::copy_regions (RegionList& newlist) const
        RegionLock rlock (const_cast<Playlist *> (this));
 
        for (RegionList::const_iterator i = regions.begin(); i != regions.end(); ++i) {
-               newlist.push_back (RegionFactory::RegionFactory::create (*i));
+               newlist.push_back (RegionFactory::RegionFactory::create (*i, true));
        }
 }
 
@@ -709,7 +709,7 @@ Playlist::add_region (boost::shared_ptr<Region> region, framepos_t position, flo
        */
 
        for (int i = 0; i < itimes; ++i) {
-               boost::shared_ptr<Region> copy = RegionFactory::create (region);
+               boost::shared_ptr<Region> copy = RegionFactory::create (region, true);
                add_region_internal (copy, pos);
                pos += region->length();
        }
@@ -1247,7 +1247,7 @@ Playlist::paste (boost::shared_ptr<Playlist> other, framepos_t position, float t
 
                while (itimes--) {
                        for (RegionList::iterator i = other->regions.begin(); i != other->regions.end(); ++i) {
-                               boost::shared_ptr<Region> copy_of_region = RegionFactory::create (*i);
+                               boost::shared_ptr<Region> copy_of_region = RegionFactory::create (*i, true);
 
                                /* put these new regions on top of all existing ones, but preserve
                                   the ordering they had in the original playlist.
@@ -1283,7 +1283,7 @@ Playlist::duplicate (boost::shared_ptr<Region> region, framepos_t position, floa
        framepos_t pos = position + 1;
 
        while (itimes--) {
-               boost::shared_ptr<Region> copy = RegionFactory::create (region);
+               boost::shared_ptr<Region> copy = RegionFactory::create (region, true);
                add_region_internal (copy, pos);
                pos += region->length();
        }
index d8e862573f39dd08f663c46977b45437d5e51b19..44615e2182be9adba6aa9c2cf9046c5f564a0047 100644 (file)
@@ -45,7 +45,7 @@ Glib::StaticMutex RegionFactory::region_name_map_lock;
 std::map<std::string, uint32_t> RegionFactory::region_name_map;
 
 boost::shared_ptr<Region>
-RegionFactory::create (boost::shared_ptr<const Region> region)
+RegionFactory::create (boost::shared_ptr<const Region> region, bool announce)
 {
        boost::shared_ptr<Region> ret;
        boost::shared_ptr<const AudioRegion> ar;
@@ -72,12 +72,17 @@ RegionFactory::create (boost::shared_ptr<const Region> region)
        }
 
        if (ret) {
+               ret->set_name (new_region_name(ret->name()));
                map_add (ret);
 
                /* pure copy constructor - no property list */
                /* pure copy constructor - no CheckNewRegion emitted */
+               if (announce) {
+                       CheckNewRegion (ret);
+               }
        }
 
+
        return ret;
 }