So far, on piano-roll, MarkedSemiTones setting is not saved.

With my patch preservation.diff, each pattern will save this setting.

----
nuio
diff --git a/include/pattern.h b/include/pattern.h
index 4f8b995..4ecad20 100644
--- a/include/pattern.h
+++ b/include/pattern.h
@@ -76,6 +76,8 @@ public:
                                                const bool _quant_pos = true );
        void rearrangeAllNotes();
        void clearNotes();
+       
+       void clearMarked();
 
        inline const NoteVector & notes() const
        {
@@ -128,6 +130,16 @@ public:
        void addSteps( int _n );
        void removeSteps( int _n );
 
+       inline QList<int> markedSemiTonesOfPattern() const
+       {
+               return m_markedSemiTonesOfPattern;
+       }
+       
+       inline void SetmarkedSemiTonesOfPattern(QList<int> in)
+       {
+               m_markedSemiTonesOfPattern = in;
+       }
+       
        virtual trackContentObjectView * createView( trackView * _tv );
 
 
@@ -151,10 +163,11 @@ private:
        InstrumentTrack * m_instrumentTrack;
 
        PatternTypes m_patternType;
-
+       
        // data-stuff
        NoteVector m_notes;
        int m_steps;
+       QList<int> m_markedSemiTonesOfPattern;
 
        // pattern freezing
        sampleBuffer * m_frozenPattern;


diff --git a/src/gui/piano_roll.cpp b/src/gui/piano_roll.cpp
index e94c022..aea7774 100644
--- a/src/gui/piano_roll.cpp
+++ b/src/gui/piano_roll.cpp
@@ -686,6 +686,7 @@ void pianoRoll::markSemiTone( int i )
        qSort( m_markedSemiTones.begin(), m_markedSemiTones.end(), 
qGreater<int>() );
        QList<int>::iterator new_end = std::unique( m_markedSemiTones.begin(), 
m_markedSemiTones.end() );
        m_markedSemiTones.erase( new_end, m_markedSemiTones.end() );
+       m_pattern->SetmarkedSemiTonesOfPattern(m_markedSemiTones);
 }
 
 
@@ -742,6 +743,10 @@ void pianoRoll::setCurrentPattern( pattern * _new_pattern )
                                                NumOctaves * KeysPerOctave );
                }
        }
+       
+       if(!m_pattern->markedSemiTonesOfPattern().empty())
+       m_markedSemiTones = m_pattern->markedSemiTonesOfPattern();
+       
        // resizeEvent() does the rest for us (scrolling, range-checking
        // of start-notes and so on...)
        resizeEvent( NULL );

 
diff --git a/src/tracks/pattern.cpp b/src/tracks/pattern.cpp
index 67f07fb..23f17db 100644
--- a/src/tracks/pattern.cpp
+++ b/src/tracks/pattern.cpp
@@ -289,7 +289,12 @@ void pattern::clearNotes()
        emit dataChanged();
 }
 
-
+void pattern::clearMarked()
+{
+       m_markedSemiTonesOfPattern.clear();
+       
+       emit dataChanged();
+}
 
 
 void pattern::setStep( int _step, bool _enabled )
@@ -359,16 +364,31 @@ void pattern::saveSettings( QDomDocument & _doc, 
QDomElement & _this )
        _this.setAttribute( "muted", isMuted() );
        _this.setAttribute( "steps", m_steps );
        _this.setAttribute( "frozen", m_frozenPattern != NULL );
-
+       
+       QDomElement nodenote = _doc.createElement( "nodenote" );        
+       _this.appendChild(nodenote);
+       
        // now save settings of all notes
        for( NoteVector::Iterator it = m_notes.begin();
                                                it != m_notes.end(); ++it )
        {
                if( ( *it )->length() )
                {
-                       ( *it )->saveState( _doc, _this );
+                       ( *it )->saveState( _doc, nodenote );
                }
        }
+       
+       QDomElement nodemarked = _doc.createElement( "nodemarked" );    
+       _this.appendChild(nodemarked);  
+       
+       for( QList<int>::Iterator it = m_markedSemiTonesOfPattern.begin();
+                                               it != 
m_markedSemiTonesOfPattern.end(); ++it )
+       {
+               QDomElement nodemarkedchild = _doc.createElement( 
"nodemarkedchild" );  
+               nodemarked.appendChild(nodemarkedchild);        
+               nodemarkedchild.setAttribute("marked", *it);
+       }       
+       
 }
 
 
@@ -394,17 +414,18 @@ void pattern::loadSettings( const QDomElement & _this )
        clearNotes();
 
        QDomNode node = _this.firstChild();
-       while( !node.isNull() )
+       QDomNode nodenote = node.firstChild();
+       while( !nodenote.isNull() )
        {
-               if( node.isElement() &&
-                       !node.toElement().attribute( "metadata" ).toInt() )
+               if( nodenote.isElement() &&
+                       !nodenote.toElement().attribute( "metadata" ).toInt() )
                {
                        note * n = new note;
-                       n->restoreState( node.toElement() );
+                       n->restoreState( nodenote.toElement() );
                        m_notes.push_back( n );
                }
-               node = node.nextSibling();
-        }
+               nodenote = nodenote.nextSibling();
+    }
 
        m_steps = _this.attribute( "steps" ).toInt();
        if( m_steps == 0 )
@@ -412,6 +433,20 @@ void pattern::loadSettings( const QDomElement & _this )
                m_steps = midiTime::stepsPerTact();
        }
 
+       clearMarked();
+       node = node.nextSibling();
+       QDomNode nodemarked = node.firstChild();
+       while( !nodemarked.isNull() )
+       {
+               if( nodemarked.isElement() &&
+                       !nodemarked.toElement().attribute( "metadata" ).toInt() 
)
+               {
+                       int n = nodemarked.toElement().attribute( 
"marked").toInt();
+                       m_markedSemiTonesOfPattern.push_back( n );
+               }
+               nodemarked = nodemarked.nextSibling();
+    }  
+       
        ensureBeatNotes();
        checkType();
 /*     if( _this.attribute( "frozen" ).toInt() )
------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
_______________________________________________
LMMS-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/lmms-devel

Reply via email to