implemented correct behaviour when cloning BB-tracks (closes #2042409)
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1465 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
@@ -1613,7 +1613,7 @@ track * track::create( TrackTypes _tt, trackContainer * _tc )
|
||||
|
||||
|
||||
|
||||
/*! \brief Create a track from track type in a QDomElement and a container object.
|
||||
/*! \brief Create a track inside trackContainer from track type in a QDomElement and restore state from XML
|
||||
*
|
||||
* \param _this The QDomElement containing the type of track to create
|
||||
* \param _tc The track container to attach to
|
||||
|
||||
@@ -437,6 +437,10 @@ void bbTrack::saveTrackSpecificSettings( QDomDocument & _doc,
|
||||
( (journallingObject *)( engine::getBBTrackContainer() ) )->
|
||||
saveState( _doc, _this );
|
||||
}
|
||||
if( _this.parentNode().parentNode().nodeName() == "clone" )
|
||||
{
|
||||
_this.setAttribute( "clonebbt", s_infoMap[this] );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -448,13 +452,30 @@ void bbTrack::loadTrackSpecificSettings( const QDomElement & _this )
|
||||
{
|
||||
m_trackLabel->setPixmapFile( _this.attribute( "icon" ) );
|
||||
}*/
|
||||
// engine::getBBTrackContainer()->updateComboBox();
|
||||
|
||||
QDomNode node = _this.namedItem( trackContainer::classNodeName() );
|
||||
if( node.isElement() )
|
||||
if( _this.hasAttribute( "clonebbt" ) )
|
||||
{
|
||||
( (journallingObject *)engine::getBBTrackContainer() )->
|
||||
const int src = _this.attribute( "clonebb" ).toInt();
|
||||
const int dst = s_infoMap[this];
|
||||
engine::getBBTrackContainer()->createTCOsForBB( dst );
|
||||
trackContainer::trackList tl =
|
||||
engine::getBBTrackContainer()->tracks();
|
||||
for( trackContainer::trackList::iterator it = tl.begin();
|
||||
it != tl.end(); ++it )
|
||||
{
|
||||
( *it )->getTCO( src )->copy();
|
||||
( *it )->getTCO( dst )->paste();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
QDomNode node = _this.namedItem(
|
||||
trackContainer::classNodeName() );
|
||||
if( node.isElement() )
|
||||
{
|
||||
( (journallingObject *)engine::getBBTrackContainer() )->
|
||||
restoreState( node.toElement() );
|
||||
}
|
||||
}
|
||||
/* doesn't work yet because bbTrack-ctor also sets current bb so if
|
||||
bb-tracks are created after this function is called, this doesn't
|
||||
|
||||
Reference in New Issue
Block a user