diff src/MainWindow.cpp @ 239:d40c6cdb30a4

Make pitch-track editing operations update the notes as well, automatically
author Chris Cannam
date Thu, 27 Mar 2014 18:02:12 +0000
parents fce61899aeea
children 6ac45eb0f4c7
line wrap: on
line diff
--- a/src/MainWindow.cpp	Thu Mar 27 16:30:26 2014 +0000
+++ b/src/MainWindow.cpp	Thu Mar 27 18:02:12 2014 +0000
@@ -1896,6 +1896,10 @@
     MainWindowBase::clearSelection();
 
     CommandHistory::getInstance()->endCompoundOperation();
+
+    if (!selections.empty()) {
+        auxSnapNotes(*selections.begin());
+    }
 }
 
 void
@@ -1978,6 +1982,8 @@
     }
 
     CommandHistory::getInstance()->endCompoundOperation();
+
+    snapNotesToPitches();
 }
 
 void
@@ -1995,6 +2001,8 @@
     }
 
     CommandHistory::getInstance()->endCompoundOperation();
+
+    snapNotesToPitches();
 }
 
 void
@@ -2027,6 +2035,7 @@
 
             CommandHistory::getInstance()->endCompoundOperation();
 
+            snapNotesToPitches();
         }
     } else {
         octaveShift(true);
@@ -2050,6 +2059,8 @@
             }
 
             CommandHistory::getInstance()->endCompoundOperation();
+
+            snapNotesToPitches();
         }
     } else {
         octaveShift(false);
@@ -2059,10 +2070,6 @@
 void
 MainWindow::snapNotesToPitches()
 {
-    FlexiNoteLayer *layer =
-        qobject_cast<FlexiNoteLayer *>(m_analyser->getLayer(Analyser::Notes));
-    if (!layer) return;
-
     MultiSelection::SelectionList selections = m_viewManager->getSelections();
 
     if (!selections.empty()) {
@@ -2072,7 +2079,7 @@
                 
         for (MultiSelection::SelectionList::iterator k = selections.begin();
              k != selections.end(); ++k) {
-            layer->snapSelectedNotesToPitchTrack(m_analyser->getPane(), *k);
+            auxSnapNotes(*k);
         }
         
         CommandHistory::getInstance()->endCompoundOperation();
@@ -2080,6 +2087,16 @@
 }
 
 void
+MainWindow::auxSnapNotes(Selection s)
+{
+    FlexiNoteLayer *layer =
+        qobject_cast<FlexiNoteLayer *>(m_analyser->getLayer(Analyser::Notes));
+    if (!layer) return;
+
+    layer->snapSelectedNotesToPitchTrack(m_analyser->getPane(), s);
+}    
+
+void
 MainWindow::splitNotesAtSelection()
 {
     FlexiNoteLayer *layer =