From 91bb401939b7f98c1d3d17e0bafa606311ebfd48 Mon Sep 17 00:00:00 2001 From: Javier Serrano Polo Date: Thu, 10 Aug 2006 19:06:19 +0000 Subject: [PATCH] - added disabled tracks - fixed BB-track 0 cloning bug git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@303 0778d3d1-df1d-0410-868b-ea421aaaa00d --- src/tracks/bb_track.cpp | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/src/tracks/bb_track.cpp b/src/tracks/bb_track.cpp index 7256704f3..282f9a473 100644 --- a/src/tracks/bb_track.cpp +++ b/src/tracks/bb_track.cpp @@ -448,12 +448,26 @@ void bbTrack::saveTrackSpecificSettings( QDomDocument & _doc, /* _this.setAttribute( "current", s_infoMap[this] == eng()->getBBEditor()->currentBB() );*/ if( s_infoMap[this] == 0 && - _this.parentNode().nodeName() != "clone" && + _this.parentNode().parentNode().nodeName() != "clone" && _this.parentNode().nodeName() != "journaldata" ) { ( (journallingObject *)( eng()->getBBEditor() ) )->saveState( _doc, _this ); } + + int track_num = 0; + trackVector tracks = eng()->getBBEditor()->tracks(); + for( trackVector::iterator it = tracks.begin(); it != tracks.end(); + ++it, ++track_num ) + { + if( isDisabled( *it ) ) + { + QDomElement disabled = _doc.createElement( + "disabled-track" ); + disabled.setAttribute( "num", track_num ); + _this.appendChild( disabled ); + } + } } @@ -466,10 +480,11 @@ void bbTrack::loadTrackSpecificSettings( const QDomElement & _this ) { m_trackLabel->setPixmapFile( _this.attribute( "icon" ) ); } - if( _this.firstChild().isElement() ) + QDomNode node = _this.namedItem( trackContainer::classNodeName() ); + if( node.isElement() ) { ( (journallingObject *)( eng()->getBBEditor() ) )->restoreState( - _this.firstChild().toElement() ); + 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 @@ -478,6 +493,18 @@ void bbTrack::loadTrackSpecificSettings( const QDomElement & _this ) { eng()->getBBEditor()->setCurrentBB( s_infoMap[this] ); }*/ + + trackVector tracks = eng()->getBBEditor()->tracks(); + node = _this.firstChild(); + while( !node.isNull() ) + { + if( node.isElement() && node.nodeName() == "disabled-track" ) + { + disableTrack( tracks[node.toElement().attribute( "num" ) + .toInt()] ); + } + node = node.nextSibling(); + } }