prevent relaying during an undo/redo operation; remove some debug output
authorPaul Davis <paul@linuxaudiosystems.com>
Thu, 4 Mar 2010 15:55:08 +0000 (15:55 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Thu, 4 Mar 2010 15:55:08 +0000 (15:55 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@6728 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/audio_streamview.cc
gtk2_ardour/streamview.cc
libs/ardour/ardour/playlist.h
libs/ardour/playlist.cc
libs/pbd/debug.cc

index ac95bf63c2cda15b30948568e9653619b02791c9..a432f918740322c02acf95646970c4c3f719606f 100644 (file)
@@ -210,8 +210,6 @@ AudioStreamView::remove_region_view (boost::weak_ptr<Region> weak_r)
                return;
        }
 
-       cerr << "a region went way, it appears to be ours (" << this << ")\n";
-
        if (!_trackview.session()->deletion_in_progress()) {
 
                for (CrossfadeViewList::iterator i = crossfade_views.begin(); i != crossfade_views.end();) {
index 3aff2f2d189eb5cd37dbfa8ec578d205dab0b5a6..d405489319e9abd312c4a36f94f77052dd04e6b5 100644 (file)
@@ -198,7 +198,6 @@ StreamView::remove_region_view (boost::weak_ptr<Region> weak_r)
                if (((*i)->region()) == r) {
                        RegionView* rv = *i;
                        region_views.erase (i);
-                       cerr << "Deleting RV for " << r->name() << " @ " << r << endl;
                        delete rv;
                        break;
                }
index bc896f35a4cb4b39fd6787fb59b07dee060d57a1..b6e8719ccd8a2a6906d90c308c09f8c8b5f985e1 100644 (file)
@@ -253,6 +253,7 @@ class Playlist : public SessionObject
        bool             save_on_thaw;
        std::string      last_save_reason;
        uint32_t         in_set_state;
+       bool             in_update;
        bool             first_set_state;
        bool            _hidden;
        bool            _splicing;
index 2b9ce7824f2d309f5fcf8cd2b43ccc3bc158ab3f..054998221716701b932a9c1601c657248c7f4609 100644 (file)
@@ -27,7 +27,6 @@
 
 #include "pbd/failed_constructor.h"
 #include "pbd/stateful_diff_command.h"
-#include "pbd/stl_delete.h"
 #include "pbd/xml++.h"
 
 #include "ardour/debug.h"
@@ -331,6 +330,7 @@ Playlist::init (bool hide)
        _shuffling = false;
        _nudging = false;
        in_set_state = 0;
+        in_update = false;
        _edit_mode = Config->get_edit_mode();
        in_flush = false;
        in_partition = false;
@@ -389,6 +389,7 @@ Playlist::set_name (const string& str)
 void
 Playlist::begin_undo ()
 {
+        in_update = true;
        freeze ();
 }
 
@@ -396,6 +397,7 @@ void
 Playlist::end_undo ()
 {
        thaw ();
+        in_update = false;
 }
 
 void
@@ -719,8 +721,8 @@ Playlist::add_region_internal (boost::shared_ptr<Region> region, framepos_t posi
 
        possibly_splice_unlocked (position, region->length(), region);
 
-       if (!holding_state () && !in_set_state) {
-               /* layers get assigned from XML state */
+       if (!holding_state ()) {
+               /* layers get assigned from XML state, and are not reset during undo/redo */
                relayer ();
        }
 
@@ -794,7 +796,7 @@ Playlist::remove_region_internal (boost::shared_ptr<Region> region)
                        possibly_splice_unlocked (pos, -distance);
 
                        if (!holding_state ()) {
-                               relayer ();
+                                relayer ();
                                remove_dependents (region);
 
                                if (old_length != _get_maximum_extent()) {
@@ -2063,6 +2065,7 @@ Playlist::update (const RegionListProperty::ChangeRecord& change)
         for (RegionListProperty::ChangeContainer::iterator i = change.removed.begin(); i != change.removed.end(); ++i) {
                 remove_region (*i);
         }
+
         thaw ();
 }
 
@@ -2306,6 +2309,12 @@ Playlist::set_edit_mode (EditMode mode)
 void
 Playlist::relayer ()
 {
+        /* never compute layers when changing state for undo/redo or setting from XML*/
+
+        if (in_update || in_set_state) {
+                return;
+        }
+
        bool changed = false;
 
        /* Build up a new list of regions on each layer, stored in a set of lists
index f8abdcb48858cd8c8f0010c98fddef5b3ad996ee..318f85a099770ae1e0024fce36b0e78d1bc69551 100644 (file)
@@ -40,7 +40,6 @@ PBD::new_debug_bit (const char* name)
 {
         uint64_t ret;
         _debug_bit_map.insert (make_pair (name, _debug_bit));
-        cerr << "debug name " << name << " = " << _debug_bit << endl;
         ret = _debug_bit;
         _debug_bit <<= 1;
         return ret;
@@ -83,7 +82,6 @@ PBD::parse_debug_options (const char* str)
 
                 for (map<const char*,uint64_t>::iterator i = _debug_bit_map.begin(); i != _debug_bit_map.end(); ++i) {
                         if (strncasecmp (p, i->first, strlen (p)) == 0) {
-                                cerr << "debug args matched for " << p << " set bit " << i->second << endl;
                                 bits |= i->second;
                         }
                 }
@@ -99,10 +97,10 @@ PBD::parse_debug_options (const char* str)
 void
 PBD::list_debug_options ()
 {
-       cerr << _("The following debug options are available. Separate multipe options with commas.\nNames are case-insensitive and can be abbreviated.") << endl << endl;
-       cerr << "\tAll" << endl;
+       cout << _("The following debug options are available. Separate multipe options with commas.\nNames are case-insensitive and can be abbreviated.") << endl << endl;
+       cout << "\tAll" << endl;
 
         for (map<const char*,uint64_t>::iterator i = _debug_bit_map.begin(); i != _debug_bit_map.end(); ++i) {
-                cerr << "\t" << i->first << endl;
+                cout << "\t" << i->first << endl;
         }
 }