diff layer/FlexiNoteLayer.cpp @ 658:050404ae7799 tonioni

toggle button for boundary constraints and note recalculation
author gyorgyf
date Thu, 20 Jun 2013 10:58:40 +0100
parents ac26de7b727a
children 8663a831838f
line wrap: on
line diff
--- a/layer/FlexiNoteLayer.cpp	Wed Jun 19 22:56:17 2013 +0100
+++ b/layer/FlexiNoteLayer.cpp	Thu Jun 20 10:58:40 2013 +0100
@@ -61,7 +61,8 @@
     m_editingCommand(0),
     m_verticalScale(AutoAlignScale),
     m_scaleMinimum(34), 
-    m_scaleMaximum(77)
+    m_scaleMaximum(77),
+    m_intelligentActions(true)
 {
 }
 
@@ -1019,10 +1020,10 @@
     
     switch (m_editMode) {
         case LeftBoundary : {
-            // left
-            if (dragFrame <= m_greatestLeftNeighbourFrame) dragFrame = m_greatestLeftNeighbourFrame + 1;
+            // left 
+            if (m_intelligentActions && dragFrame <= m_greatestLeftNeighbourFrame) dragFrame = m_greatestLeftNeighbourFrame + 1;
             // right
-            if (dragFrame >= m_originalPoint.frame + m_originalPoint.duration) {
+            if (m_intelligentActions && dragFrame >= m_originalPoint.frame + m_originalPoint.duration) {
                 dragFrame = m_originalPoint.frame + m_originalPoint.duration - 1;
             }
             m_editingPoint.frame = dragFrame;
@@ -1031,16 +1032,16 @@
         }
         case RightBoundary : {
             // left
-            if (dragFrame <= m_greatestLeftNeighbourFrame) dragFrame = m_greatestLeftNeighbourFrame + 1;
-            if (dragFrame >= m_smallestRightNeighbourFrame) dragFrame = m_smallestRightNeighbourFrame - 1;
+            if (m_intelligentActions && dragFrame <= m_greatestLeftNeighbourFrame) dragFrame = m_greatestLeftNeighbourFrame + 1;
+            if (m_intelligentActions && dragFrame >= m_smallestRightNeighbourFrame) dragFrame = m_smallestRightNeighbourFrame - 1;
             m_editingPoint.duration = dragFrame - m_originalPoint.frame + 1;
             break;
         }
         case DragNote : {
             // left
-            if (dragFrame <= m_greatestLeftNeighbourFrame) dragFrame = m_greatestLeftNeighbourFrame + 1;
+            if (m_intelligentActions && dragFrame <= m_greatestLeftNeighbourFrame) dragFrame = m_greatestLeftNeighbourFrame + 1;
             // right
-            if (dragFrame + m_originalPoint.duration >= m_smallestRightNeighbourFrame) {
+            if (m_intelligentActions && dragFrame + m_originalPoint.duration >= m_smallestRightNeighbourFrame) {
                 dragFrame = m_smallestRightNeighbourFrame - m_originalPoint.duration;
             }
             m_editingPoint.frame = dragFrame;
@@ -1137,9 +1138,11 @@
     FlexiNote newNote2(frame, note.value, 
                        note.duration - newNote1.duration, 
                        note.level, note.label);
-
-    updateNoteValue(v,newNote1);
-    updateNoteValue(v,newNote2);
+                       
+    if (m_intelligentActions) {
+        updateNoteValue(v,newNote1);
+        updateNoteValue(v,newNote2);
+    }
 
     FlexiNoteModel::EditCommand *command = new FlexiNoteModel::EditCommand
         (m_model, tr("Edit Point"));