track combine ops per-playlist to avoid name collisions for compound regions

git-svn-id: svn://localhost/ardour2/branches/3.0@9529 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2011-05-16 21:21:16 +00:00
parent 99aa8c6338
commit c8a27ebdbf
4 changed files with 13 additions and 5 deletions

View file

@ -588,6 +588,7 @@
<menuitem action='pitch-shift-region'/>
<menuitem action='transpose-region'/>
<menuitem action='naturalize-region'/>
<menuitem action='combine-regions'/>
<menuitem action='split-region'/>
<menuitem action='split-multichannel-region'/>
<menuitem action='remove-region'/>

View file

@ -2500,9 +2500,7 @@ RouteTimeAxisView::combine_regions ()
_view->foreach_selected_regionview (sigc::bind (sigc::ptr_fun (add_region_to_list), &selected_regions, &max_level));
uint32_t num_joined_regions = playlist->count_joined_regions();
string name = string_compose (_("%1 compound-%2 (%3)"), playlist->name(), num_joined_regions+1, max_level+1);
string name = string_compose (_("%1 compound-%2 (%3)"), playlist->name(), playlist->combine_ops()+1, max_level+1);
playlist->clear_changes ();
playlist->join (selected_regions, name);

View file

@ -229,6 +229,7 @@ public:
}
framepos_t find_next_top_layer_position (framepos_t) const;
uint32_t combine_ops() const { return _combine_ops; }
protected:
friend class Session;
@ -295,6 +296,7 @@ public:
uint64_t layer_op_counter;
framecnt_t freeze_length;
bool auto_partition;
uint32_t _combine_ops;
/** true if relayering should be done using region's current layers and their `pending explicit relayer'
* flags; otherwise false if relayering should be done using the layer-model (most recently moved etc.)

View file

@ -28,10 +28,10 @@
#include <boost/lexical_cast.hpp>
#include "pbd/convert.h"
#include "pbd/failed_constructor.h"
#include "pbd/stateful_diff_command.h"
#include "pbd/xml++.h"
#include "pbd/stacktrace.h"
#include "ardour/debug.h"
#include "ardour/playlist.h"
@ -357,6 +357,7 @@ Playlist::init (bool hide)
layer_op_counter = 0;
freeze_length = 0;
_explicit_relayering = false;
_combine_ops = 0;
_session.history().BeginUndoRedo.connect_same_thread (*this, boost::bind (&Playlist::begin_undo, this));
_session.history().EndUndoRedo.connect_same_thread (*this, boost::bind (&Playlist::end_undo, this));
@ -2277,6 +2278,8 @@ Playlist::set_state (const XMLNode& node, int version)
_orig_diskstream_id = prop->value ();
} else if (prop->name() == X_("frozen")) {
_frozen = string_is_affirmative (prop->value());
} else if (prop->name() == X_("combine-ops")) {
_combine_ops = atoi (prop->value());
}
}
@ -2369,7 +2372,7 @@ XMLNode&
Playlist::state (bool full_state)
{
XMLNode *node = new XMLNode (X_("Playlist"));
char buf[64] = "";
char buf[64];
node->add_property (X_("id"), id().to_s());
node->add_property (X_("name"), _name);
@ -2383,6 +2386,9 @@ Playlist::state (bool full_state)
RegionLock rlock (this, false);
XMLNode* nested_node = 0;
snprintf (buf, sizeof (buf), "%u", _combine_ops);
node->add_property ("combine-ops", buf);
for (RegionList::iterator i = regions.begin(); i != regions.end(); ++i) {
if ((*i)->max_source_level() > 0) {
@ -3208,6 +3214,7 @@ Playlist::join (const RegionList& r, const std::string& name)
/* add the new region at the right location */
add_region (compound_region, earliest_position);
_combine_ops++;
thaw ();
}